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 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 * 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 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 in the kernel. that should cover all cases where we actually need root

View File

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

View File

@ -7,14 +7,14 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>459</width> <width>459</width>
<height>361</height> <height>575</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="0" column="0"> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -42,7 +42,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -90,6 +90,55 @@
</layout> </layout>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<resources/> <resources/>

View File

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