blob: 46ea88de490cbe099385a7841c7d17518d24f893 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/***************************************************************************
* Copyright (C) 2006 by Ivan Vasic *
* ivasic@gmail.com *
* *
* 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 "logprefwidget.h"
#include "logviewerpluginsettings.h"
#include "logflags.h"
#include <kglobal.h>
#include <klocale.h>
#include <tqwidget.h>
#include <tqstring.h>
#include <tqcheckbox.h>
#include <tqcombobox.h>
namespace kt
{
LogPrefWidget::LogPrefWidget(TQWidget *parent, const char *name)
:LogPrefWidgetBase(parent, name)
{
m_sysgen->setCurrentItem(getLevel(LogViewerPluginSettings::sysGEN()));
m_syscon->setCurrentItem(getLevel(LogViewerPluginSettings::sysCON()));
m_sysdht->setCurrentItem(getLevel(LogViewerPluginSettings::sysDHT()));
m_systrk->setCurrentItem(getLevel(LogViewerPluginSettings::sysTRK()));
m_sysdio->setCurrentItem(getLevel(LogViewerPluginSettings::sysDIO()));
m_sysipf->setCurrentItem(getLevel(LogViewerPluginSettings::sysIPF()));
m_syspfi->setCurrentItem(getLevel(LogViewerPluginSettings::sysPFI()));
m_sysinw->setCurrentItem(getLevel(LogViewerPluginSettings::sysINW()));
m_syspnp->setCurrentItem(getLevel(LogViewerPluginSettings::sysPNP()));
m_syssrc->setCurrentItem(getLevel(LogViewerPluginSettings::sysSRC()));
m_sysscd->setCurrentItem(getLevel(LogViewerPluginSettings::sysSCD()));
m_syssnf->setCurrentItem(getLevel(LogViewerPluginSettings::sysSNF()));
m_sysrss->setCurrentItem(getLevel(LogViewerPluginSettings::sysRSS()));
m_sysweb->setCurrentItem(getLevel(LogViewerPluginSettings::sysWEB()));
m_useRich->setChecked(LogViewerPluginSettings::useRichText());
}
bool LogPrefWidget::apply()
{
LogViewerPluginSettings::setSysGEN(getArg(m_sysgen->currentItem()));
LogViewerPluginSettings::setSysCON(getArg(m_syscon->currentItem()));
LogViewerPluginSettings::setSysDHT(getArg(m_sysdht->currentItem()));
LogViewerPluginSettings::setSysTRK(getArg(m_systrk->currentItem()));
LogViewerPluginSettings::setSysDIO(getArg(m_sysdio->currentItem()));
LogViewerPluginSettings::setSysIPF(getArg(m_sysipf->currentItem()));
LogViewerPluginSettings::setSysPFI(getArg(m_syspfi->currentItem()));
LogViewerPluginSettings::setSysINW(getArg(m_sysinw->currentItem()));
LogViewerPluginSettings::setSysPNP(getArg(m_syspnp->currentItem()));
LogViewerPluginSettings::setSysSRC(getArg(m_syssrc->currentItem()));
LogViewerPluginSettings::setSysSCD(getArg(m_sysscd->currentItem()));
LogViewerPluginSettings::setSysSNF(getArg(m_syssnf->currentItem()));
LogViewerPluginSettings::setSysRSS(getArg(m_sysrss->currentItem()));
LogViewerPluginSettings::setSysWEB(getArg(m_sysweb->currentItem()));
LogViewerPluginSettings::setUseRichText(m_useRich->isChecked());
LogViewerPluginSettings::writeConfig();
LogFlags::instance().updateFlags();
return true;
}
int LogPrefWidget::getLevel(unsigned int arg)
{
switch(arg)
{
case 0x0F:
return 0;
case 0x07:
return 1;
case 0x03:
return 2;
case 0x01:
return 3;
case 0x00:
return 4;
default:
return 0;
}
}
unsigned int LogPrefWidget::getArg(int level)
{
switch(level)
{
case 0:
return 0x0F;
case 1:
return 0x07;
case 2:
return 0x03;
case 3:
return 0x01;
case 4:
return 0x00;
default:
return 0;
}
}
}
#include "logprefwidget.moc"
|