1
/***************************************************************************
2
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
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. *
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. *
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
***************************************************************************/
20
#include "gui/treelog.h"
22
#include "gui/partitionmanagerwidget.h"
24
#include "util/globallog.h"
26
#include <kactioncollection.h>
28
#include <kiconloader.h>
30
#include <QTreeWidget>
33
/** Creates a new TreeLog instance.
34
@param parent the parent widget
36
TreeLog::TreeLog(QWidget* parent) :
39
m_ActionCollection(NULL),
40
m_PartitionManagerWidget(NULL)
45
void TreeLog::onNewLogMessage(log::Level logLevel, const QString& s)
47
static const char* icons[] =
57
QTreeWidgetItem* item = new QTreeWidgetItem();
59
item->setIcon(0, SmallIcon(icons[logLevel]));
60
item->setText(0, QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
63
treeLog().addTopLevelItem(item);
65
for (int i = 0; i < treeLog().model()->columnCount(); i++)
66
treeLog().resizeColumnToContents(i);
68
treeLog().scrollToBottom();