~ubuntu-branches/ubuntu/precise/partitionmanager/precise

« back to all changes in this revision

Viewing changes to src/gui/treelog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter
  • Date: 2009-05-02 14:50:18 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090502145018-ktgdpdforvzltn86
Tags: 1.0.0~beta2-0ubuntu1
* New upstream release
* Remove debian/patches (icon is now included)
  + drop quilt build-dep
* Bump standards-version to 3.8.1
* Update lintian override with manpage for partitionmanager-bin, the 
  actually binary is now a wrapper around -bin, so we don't need an
  additional manpage
* Use pkg-kde-tools for building instead of CDBS' kde4.mk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de>                  *
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU General Public License as published by  *
 
6
 *   the Free Software Foundation; either version 2 of the License, or     *
 
7
 *   (at your option) any later version.                                   *
 
8
 *                                                                         *
 
9
 *   This program is distributed in the hope that it will be useful,       *
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
 *   GNU General Public License for more details.                          *
 
13
 *                                                                         *
 
14
 *   You should have received a copy of the GNU General Public License     *
 
15
 *   along with this program; if not, write to the                         *
 
16
 *   Free Software Foundation, Inc.,                                       *
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
 
18
 ***************************************************************************/
 
19
 
 
20
#include "gui/treelog.h"
 
21
 
 
22
#include "gui/partitionmanagerwidget.h"
 
23
 
 
24
#include "util/globallog.h"
 
25
 
 
26
#include <kactioncollection.h>
 
27
#include <kdebug.h>
 
28
#include <kiconloader.h>
 
29
 
 
30
#include <QTreeWidget>
 
31
#include <QDateTime>
 
32
 
 
33
/** Creates a new TreeLog instance.
 
34
        @param parent the parent widget
 
35
*/
 
36
TreeLog::TreeLog(QWidget* parent) :
 
37
        QWidget(parent),
 
38
        Ui::TreeLogBase(),
 
39
        m_ActionCollection(NULL),
 
40
        m_PartitionManagerWidget(NULL)
 
41
{
 
42
        setupUi(this);
 
43
}
 
44
 
 
45
void TreeLog::onNewLogMessage(log::Level logLevel, const QString& s)
 
46
{
 
47
        static const char* icons[] =
 
48
        {
 
49
                "tools-report-bug",
 
50
                "dialog-information",
 
51
                "dialog-warning",
 
52
                "dialog-error"
 
53
        };
 
54
 
 
55
        kDebug() << s;
 
56
 
 
57
        QTreeWidgetItem* item = new QTreeWidgetItem();
 
58
 
 
59
        item->setIcon(0, SmallIcon(icons[logLevel]));
 
60
        item->setText(0, QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
 
61
        item->setText(1, s);
 
62
 
 
63
        treeLog().addTopLevelItem(item);
 
64
 
 
65
        for (int i = 0; i < treeLog().model()->columnCount(); i++)
 
66
                treeLog().resizeColumnToContents(i);
 
67
 
 
68
        treeLog().scrollToBottom();
 
69
}