add option to specify the minimum log level

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1100568
This commit is contained in:
Volker Lanz 2010-03-07 21:20:33 +00:00
parent 4d6b168474
commit fe9ad46a98
4 changed files with 65 additions and 12 deletions

2
TODO
View File

@ -21,8 +21,6 @@ Random plans and ideas for 1.1 and beyond:
* let the user specify extern command locations and options in the settings
* let the user specify in the options which log levels to show in the global log
* write a setup-kcm in the style of k3b's so that the user can set the r/w
permissions of the disks there; also use kauth to update the partition table
in the kernel. that should cover all cases where we actually need root

View File

@ -25,6 +25,9 @@
<entry name="firstRun" type="Bool">
<default>true</default>
</entry>
<entry name="minLogLevel" type="Int">
<default>0</default>
</entry>
<entry name="sectorAlignment" type="Int">
<default>2048</default>
</entry>

View File

@ -7,14 +7,14 @@
<x>0</x>
<y>0</y>
<width>459</width>
<height>361</height>
<height>575</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -42,7 +42,7 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -90,6 +90,55 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Logging</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Hide Messages Below:</string>
</property>
<property name="buddy">
<cstring>kcfg_minLogLevel</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="kcfg_minLogLevel">
<item>
<property name="text">
<string>Debug</string>
</property>
</item>
<item>
<property name="text">
<string>Information</string>
</property>
</item>
<item>
<property name="text">
<string>Warning</string>
</property>
</item>
<item>
<property name="text">
<string>Error</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -161,12 +161,15 @@ void TreeLog::onNewLogMessage(Log::Level logLevel, const QString& s)
kDebug() << s;
QTreeWidgetItem* item = new QTreeWidgetItem();
if (logLevel >= Config::minLogLevel())
{
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setIcon(0, SmallIcon(icons[logLevel]));
item->setText(1, QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
item->setText(2, s);
item->setIcon(0, SmallIcon(icons[logLevel]));
item->setText(1, QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
item->setText(2, s);
treeLog().addTopLevelItem(item);
treeLog().scrollToBottom();
treeLog().addTopLevelItem(item);
treeLog().scrollToBottom();
}
}