diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
index 08a90dc..18f096b 100644
--- a/src/gui/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -94,7 +94,9 @@ MainWindow::MainWindow(QWidget* parent, KActionCollection* coll) :
void MainWindow::init()
{
- connect(GlobalLog::instance(), SIGNAL(newMessage(log::Level, const QString&)), SLOT(onNewLogMessage(log::Level, const QString&)));
+ treeLog().init(actionCollection(), &pmWidget());
+
+ connect(GlobalLog::instance(), SIGNAL(newMessage(log::Level, const QString&)), &treeLog(), SLOT(onNewLogMessage(log::Level, const QString&)));
setupActions();
setupStatusBar();
@@ -245,28 +247,3 @@ void MainWindow::updateSelection(const Partition* p)
updateWindowTitle();
}
-void MainWindow::onNewLogMessage(log::Level logLevel, const QString& s)
-{
- static const char* icons[] =
- {
- "tools-report-bug",
- "dialog-information",
- "dialog-warning",
- "dialog-error"
- };
-
- kDebug() << s;
-
- QTreeWidgetItem* item = new QTreeWidgetItem();
-
- item->setIcon(0, SmallIcon(icons[logLevel]));
- item->setText(0, QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
- item->setText(1, s);
-
- treeLog().addTopLevelItem(item);
-
- for (int i = 0; i < treeLog().model()->columnCount(); i++)
- treeLog().resizeColumnToContents(i);
-
- treeLog().scrollToBottom();
-}
diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h
index bfea282..1b674da 100644
--- a/src/gui/mainwindow.h
+++ b/src/gui/mainwindow.h
@@ -70,6 +70,9 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi
ListOperations& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
const ListOperations& listOperations() const { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
+ TreeLog& treeLog() { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
+ const TreeLog& treeLog() const { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
+
QDockWidget& dockInformation() { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
const QDockWidget& dockInformation() const { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
@@ -82,9 +85,6 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi
QDockWidget& dockLog() { Q_ASSERT(m_DockLog); return *m_DockLog; }
const QDockWidget& dockLog() const { Q_ASSERT(m_DockLog); return *m_DockLog; }
- QTreeWidget& treeLog() { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
- const QTreeWidget& treeLog() const { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
-
QLabel& statusText() { Q_ASSERT(m_StatusText); return *m_StatusText; }
const QLabel& statusText() const { Q_ASSERT(m_StatusText); return *m_StatusText; }
@@ -94,11 +94,9 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi
void closeEvent(QCloseEvent*);
void changeEvent(QEvent* event);
- void onNewLogMessage(log::Level logLevel, const QString& s);
void init();
void updateDevices();
void updateStatusBar();
-// void updateOperations();
void updateSelection(const Partition* p);
private:
diff --git a/src/gui/mainwindowbase.ui b/src/gui/mainwindowbase.ui
index a578d1a..df7242e 100644
--- a/src/gui/mainwindowbase.ui
+++ b/src/gui/mainwindowbase.ui
@@ -82,45 +82,7 @@
-
-
-
- false
-
-
- QAbstractItemView::NoSelection
-
-
- Qt::ElideNone
-
-
- 0
-
-
- false
-
-
- false
-
-
- true
-
-
- true
-
-
- false
-
-
-
- Time
-
-
-
-
- Message
-
-
-
+
@@ -145,6 +107,12 @@
1
+
+ TreeLog
+ QWidget
+
+ 1
+
diff --git a/src/gui/treelog.cpp b/src/gui/treelog.cpp
new file mode 100644
index 0000000..665b2fa
--- /dev/null
+++ b/src/gui/treelog.cpp
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (C) 2008,2009 by Volker Lanz *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "gui/treelog.h"
+
+#include "gui/partitionmanagerwidget.h"
+
+#include "util/globallog.h"
+
+#include
+#include
+#include
+
+#include
+#include
+
+/** Creates a new TreeLog instance.
+ @param parent the parent widget
+*/
+TreeLog::TreeLog(QWidget* parent) :
+ QWidget(parent),
+ Ui::TreeLogBase(),
+ m_ActionCollection(NULL),
+ m_PartitionManagerWidget(NULL)
+{
+ setupUi(this);
+}
+
+void TreeLog::onNewLogMessage(log::Level logLevel, const QString& s)
+{
+ static const char* icons[] =
+ {
+ "tools-report-bug",
+ "dialog-information",
+ "dialog-warning",
+ "dialog-error"
+ };
+
+ kDebug() << s;
+
+ QTreeWidgetItem* item = new QTreeWidgetItem();
+
+ item->setIcon(0, SmallIcon(icons[logLevel]));
+ item->setText(0, QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
+ item->setText(1, s);
+
+ treeLog().addTopLevelItem(item);
+
+ for (int i = 0; i < treeLog().model()->columnCount(); i++)
+ treeLog().resizeColumnToContents(i);
+
+ treeLog().scrollToBottom();
+}
diff --git a/src/gui/treelog.h b/src/gui/treelog.h
new file mode 100644
index 0000000..96d8cc9
--- /dev/null
+++ b/src/gui/treelog.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ * Copyright (C) 2008,2009 by Volker Lanz *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#if !defined(TREELOG__H)
+
+#define TREELOG__H
+
+#include "util/libpartitionmanagerexport.h"
+
+#include "ui_treelogbase.h"
+
+#include "util/globallog.h"
+
+#include
+
+#include
+
+class PartitionManagerWidget;
+class KActionCollection;
+class QTreeWidget;
+
+/** @brief A tree for formatted log output.
+ @author vl@fidra.de
+*/
+class LIBPARTITIONMANAGERPRIVATE_EXPORT TreeLog: public QWidget, public Ui::TreeLogBase
+{
+ Q_OBJECT
+
+ public:
+ TreeLog(QWidget* parent);
+
+ public:
+ void init(KActionCollection* coll, PartitionManagerWidget* pm_widget) { m_ActionCollection = coll; m_PartitionManagerWidget = pm_widget; }
+
+ public slots:
+ void onNewLogMessage(log::Level logLevel, const QString& s);
+
+ protected:
+ QTreeWidget& treeLog() { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
+ const QTreeWidget& treeLog() const { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
+
+ PartitionManagerWidget& pmWidget() { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
+ const PartitionManagerWidget& pmWidget() const { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
+ KActionCollection* actionCollection() { return m_ActionCollection; }
+
+ protected slots:
+
+ private:
+ KActionCollection* m_ActionCollection;
+ PartitionManagerWidget* m_PartitionManagerWidget;
+};
+
+#endif
+
diff --git a/src/gui/treelogbase.ui b/src/gui/treelogbase.ui
new file mode 100644
index 0000000..0e6bece
--- /dev/null
+++ b/src/gui/treelogbase.ui
@@ -0,0 +1,61 @@
+
+ TreeLogBase
+
+
+
+ 0
+ 0
+ 565
+ 209
+
+
+
+ Form
+
+
+ -
+
+
+ false
+
+
+ QAbstractItemView::NoSelection
+
+
+ Qt::ElideNone
+
+
+ 0
+
+
+ false
+
+
+ false
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+
+ Time
+
+
+
+
+ Message
+
+
+
+
+
+
+
+
+