author | mickeyl <mickeyl> | 2004-12-20 11:44:19 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-12-20 11:44:19 (UTC) |
commit | 4e1958e50a18bfa9a7cd2d41400a753c99fedbf9 (patch) (unidiff) | |
tree | 98bfc2080c87ffeeb93304118d469d83505aeff6 | |
parent | a226cb8cc1ff4f81d43c0c8ecafca889ba817f9f (diff) | |
download | opie-4e1958e50a18bfa9a7cd2d41400a753c99fedbf9.zip opie-4e1958e50a18bfa9a7cd2d41400a753c99fedbf9.tar.gz opie-4e1958e50a18bfa9a7cd2d41400a753c99fedbf9.tar.bz2 |
add syslog and bump version
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.cpp | 13 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.pro | 4 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysloginfo.cpp | 116 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysloginfo.h | 42 |
4 files changed, 168 insertions, 7 deletions
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp index 4c58999..7000175 100644 --- a/noncore/settings/sysinfo/sysinfo.cpp +++ b/noncore/settings/sysinfo/sysinfo.cpp | |||
@@ -1,74 +1,75 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | ********************************************************************** | 19 | ********************************************************************** |
20 | ** | 20 | ** |
21 | ** Enhancements by: Dan Williams, <williamsdr@acm.org> | 21 | ** Enhancements by: Dan Williams, <williamsdr@acm.org> |
22 | ** | 22 | ** |
23 | **********************************************************************/ | 23 | **********************************************************************/ |
24 | 24 | ||
25 | #include "memory.h" | 25 | #include "memory.h" |
26 | #include "load.h" | 26 | #include "load.h" |
27 | #include "storage.h" | 27 | #include "storage.h" |
28 | #include "processinfo.h" | 28 | #include "processinfo.h" |
29 | #include "modulesinfo.h" | 29 | #include "modulesinfo.h" |
30 | #include "benchmarkinfo.h" | 30 | #include "benchmarkinfo.h" |
31 | #include "sysloginfo.h" | ||
31 | #include "versioninfo.h" | 32 | #include "versioninfo.h" |
32 | #include "sysinfo.h" | 33 | #include "sysinfo.h" |
33 | 34 | ||
35 | /* OPIE */ | ||
34 | #include <opie2/otabwidget.h> | 36 | #include <opie2/otabwidget.h> |
35 | 37 | using namespace Opie::Ui; | |
36 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
37 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
38 | 40 | ||
41 | /* QT */ | ||
39 | #include <qlayout.h> | 42 | #include <qlayout.h> |
40 | 43 | ||
41 | using namespace Opie::Ui; | ||
42 | SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) | 44 | SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) |
43 | : QWidget( parent, name, WStyle_ContextHelp ) | 45 | : QWidget( parent, name, WStyle_ContextHelp ) |
44 | { | 46 | { |
45 | setIcon( Resource::loadPixmap( "system_icon" ) ); | 47 | setIcon( Resource::loadPixmap( "system_icon" ) ); |
46 | setCaption( tr("System Info") ); | 48 | setCaption( tr("System Info") ); |
47 | 49 | ||
48 | resize( 220, 180 ); | 50 | resize( 220, 180 ); |
49 | 51 | ||
50 | Config config( "qpe" ); | 52 | Config config( "qpe" ); |
51 | config.setGroup( "Appearance" ); | 53 | config.setGroup( "Appearance" ); |
52 | bool advanced = config.readBoolEntry( "Advanced", TRUE ); | 54 | bool advanced = config.readBoolEntry( "Advanced", TRUE ); |
53 | 55 | ||
54 | QVBoxLayout *lay = new QVBoxLayout( this ); | 56 | QVBoxLayout *lay = new QVBoxLayout( this ); |
55 | OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); | 57 | OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); |
56 | lay->addWidget( tab ); | 58 | lay->addWidget( tab ); |
57 | 59 | ||
58 | tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon", tr("Memory") ); | 60 | tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon", tr("Memory") ); |
59 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 61 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
60 | tab->addTab( new FileSysInfo( tab ), "sysinfo/storagetabicon", tr("Storage") ); | 62 | tab->addTab( new FileSysInfo( tab ), "sysinfo/storagetabicon", tr("Storage") ); |
61 | #endif | 63 | #endif |
62 | tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon", tr("CPU") ); | 64 | tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon", tr("CPU") ); |
63 | if ( advanced ) | 65 | if ( advanced ) |
64 | { | 66 | { |
65 | tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon", tr("Process") ); | 67 | tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon", tr( "Process" ) ); |
66 | tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr("Modules") ); | 68 | tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr( "Modules" ) ); |
67 | } | 69 | } |
70 | tab->addTab( new SyslogInfo( tab ), "sysinfo/syslogtabicon", tr( "Syslog" ) ); | ||
68 | tab->addTab( new BenchmarkInfo( tab ), "sysinfo/benchmarktabicon", tr( "Benchmark" ) ); | 71 | tab->addTab( new BenchmarkInfo( tab ), "sysinfo/benchmarktabicon", tr( "Benchmark" ) ); |
69 | tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", tr("Version") ); | 72 | tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", tr("Version") ); |
70 | 73 | ||
71 | tab->setCurrentTab( tr( "Memory" ) ); | 74 | tab->setCurrentTab( tr( "Memory" ) ); |
72 | } | 75 | } |
73 | |||
74 | |||
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro index dd35563..e92d725 100644 --- a/noncore/settings/sysinfo/sysinfo.pro +++ b/noncore/settings/sysinfo/sysinfo.pro | |||
@@ -1,34 +1,36 @@ | |||
1 | CONFIG = qt warn_on quick-app | 1 | CONFIG = qt warn_on quick-app |
2 | HEADERS = \ | 2 | HEADERS = \ |
3 | memory.h \ | 3 | memory.h \ |
4 | graph.h \ | 4 | graph.h \ |
5 | load.h \ | 5 | load.h \ |
6 | storage.h \ | 6 | storage.h \ |
7 | processinfo.h \ | 7 | processinfo.h \ |
8 | modulesinfo.h \ | 8 | modulesinfo.h \ |
9 | detail.h \ | 9 | detail.h \ |
10 | contrib/dhry.h \ | 10 | contrib/dhry.h \ |
11 | benchmarkinfo.h \ | 11 | benchmarkinfo.h \ |
12 | sysloginfo.h \ | ||
12 | versioninfo.h \ | 13 | versioninfo.h \ |
13 | sysinfo.h | 14 | sysinfo.h |
14 | SOURCES = main.cpp \ | 15 | SOURCES = main.cpp \ |
15 | memory.cpp \ | 16 | memory.cpp \ |
16 | graph.cpp \ | 17 | graph.cpp \ |
17 | load.cpp \ | 18 | load.cpp \ |
18 | storage.cpp \ | 19 | storage.cpp \ |
19 | processinfo.cpp \ | 20 | processinfo.cpp \ |
20 | modulesinfo.cpp \ | 21 | modulesinfo.cpp \ |
21 | detail.cpp \ | 22 | detail.cpp \ |
22 | contrib/dhry.c contrib/fft.c \ | 23 | contrib/dhry.c contrib/fft.c \ |
23 | benchmarkinfo.cpp \ | 24 | benchmarkinfo.cpp \ |
25 | sysloginfo.cpp \ | ||
24 | versioninfo.cpp \ | 26 | versioninfo.cpp \ |
25 | sysinfo.cpp | 27 | sysinfo.cpp |
26 | 28 | ||
27 | INCLUDEPATH += $(OPIEDIR)/include | 29 | INCLUDEPATH += $(OPIEDIR)/include |
28 | DEPENDPATH += $(OPIEDIR)/include | 30 | DEPENDPATH += $(OPIEDIR)/include |
29 | LIBS += -lqpe -lopiecore2 -lopieui2 | 31 | LIBS += -lqpe -lopiecore2 -lopieui2 |
30 | DEFINES += UNIX | 32 | DEFINES += UNIX |
31 | TARGET = sysinfo | 33 | TARGET = sysinfo |
32 | VERSION = 1.1.1 | 34 | VERSION = 1.2.0 |
33 | 35 | ||
34 | include ( $(OPIEDIR)/include.pro ) | 36 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/sysinfo/sysloginfo.cpp b/noncore/settings/sysinfo/sysloginfo.cpp new file mode 100644 index 0000000..89c04e0 --- a/dev/null +++ b/noncore/settings/sysinfo/sysloginfo.cpp | |||
@@ -0,0 +1,116 @@ | |||
1 | /********************************************************************** | ||
2 | ** SyslogInfo | ||
3 | ** | ||
4 | ** Display Syslog information | ||
5 | ** | ||
6 | ** Copyright (C) 2004, Michael Lauer | ||
7 | ** mickey@tm.informatik.uni-frankfurt.de | ||
8 | ** http://www.Vanille.de | ||
9 | ** | ||
10 | ** This file may be distributed and/or modified under the terms of the | ||
11 | ** GNU General Public License version 2 as published by the Free Software | ||
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
13 | ** packaging of this file. | ||
14 | ** | ||
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** | ||
18 | **********************************************************************/ | ||
19 | |||
20 | #include "sysloginfo.h" | ||
21 | #include "detail.h" | ||
22 | |||
23 | /* OPIE */ | ||
24 | #include <opie2/olistview.h> | ||
25 | #include <qpe/qpeapplication.h> | ||
26 | using namespace Opie::Ui; | ||
27 | |||
28 | /* QT */ | ||
29 | #include <qcombobox.h> | ||
30 | #include <qfile.h> | ||
31 | #include <qlayout.h> | ||
32 | #include <qmessagebox.h> | ||
33 | #include <qpushbutton.h> | ||
34 | #include <qsocketnotifier.h> | ||
35 | #include <qtextbrowser.h> | ||
36 | #include <qtimer.h> | ||
37 | #include <qwhatsthis.h> | ||
38 | #include <qtextview.h> | ||
39 | |||
40 | /* STD */ | ||
41 | #include <sys/klog.h> | ||
42 | #include <sys/types.h> | ||
43 | #include <sys/stat.h> | ||
44 | #include <fcntl.h> | ||
45 | #include <assert.h> | ||
46 | #include <unistd.h> | ||
47 | #include <string.h> | ||
48 | #include <errno.h> | ||
49 | |||
50 | #define SYSLOG_READ 2 | ||
51 | #define SYSLOG_READ_ALL 3 | ||
52 | #define SYSLOG_READ_ALL_CLEAR 4 | ||
53 | #define SYSLOG_UNREAD 9 | ||
54 | |||
55 | #undef APPEND | ||
56 | |||
57 | const unsigned int bufsize = 16384; | ||
58 | char buf[bufsize]; | ||
59 | |||
60 | SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl ) | ||
61 | : QWidget( parent, name, fl ) | ||
62 | { | ||
63 | QGridLayout *layout = new QGridLayout( this ); | ||
64 | layout->setSpacing( 4 ); | ||
65 | layout->setMargin( 4 ); | ||
66 | |||
67 | syslogview = new QTextView( this ); | ||
68 | syslogview->setTextFormat( PlainText ); | ||
69 | syslogview->setFont( QFont( "Fixed" ) ); | ||
70 | layout->addWidget( syslogview, 0, 0 ); | ||
71 | syslogview->setText( "..." ); | ||
72 | |||
73 | memset( buf, 0, bufsize ); | ||
74 | ::klogctl( SYSLOG_READ_ALL, buf, bufsize ); | ||
75 | syslogview->setText( buf ); | ||
76 | |||
77 | #ifdef APPEND | ||
78 | fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC ); | ||
79 | if ( fd == -1 ) | ||
80 | { | ||
81 | syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) ); | ||
82 | return; | ||
83 | } | ||
84 | QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this ); | ||
85 | QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) ); | ||
86 | #else | ||
87 | QPushButton* pb = new QPushButton( "&Refresh", this ); | ||
88 | layout->addWidget( pb, 1, 0 ); | ||
89 | QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) ); | ||
90 | #endif | ||
91 | } | ||
92 | |||
93 | SyslogInfo::~SyslogInfo() | ||
94 | { | ||
95 | if ( fd != -1 ) ::close( fd ); | ||
96 | } | ||
97 | |||
98 | void SyslogInfo::updateData() | ||
99 | { | ||
100 | qDebug( "SyslogInfo: updateData" ); | ||
101 | #ifdef APPEND | ||
102 | memset( buf, 0, bufsize ); | ||
103 | int num = ::read( fd, buf, bufsize ); | ||
104 | if ( num ) // -1 = error (permission denied) | ||
105 | { | ||
106 | syslogview->append( "\n" ); | ||
107 | syslogview->append( buf ); | ||
108 | qDebug( "SyslogInfo: adding '%s'", buf ); | ||
109 | } | ||
110 | #else | ||
111 | memset( buf, 0, bufsize ); | ||
112 | ::klogctl( SYSLOG_READ_ALL, buf, bufsize ); | ||
113 | syslogview->setText( buf ); | ||
114 | syslogview->ensureVisible( 0, syslogview->contentsHeight() ); | ||
115 | #endif | ||
116 | } | ||
diff --git a/noncore/settings/sysinfo/sysloginfo.h b/noncore/settings/sysinfo/sysloginfo.h new file mode 100644 index 0000000..7bf8d17 --- a/dev/null +++ b/noncore/settings/sysinfo/sysloginfo.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /********************************************************************** | ||
2 | ** SyslogInfo | ||
3 | ** | ||
4 | ** Display Syslog information | ||
5 | ** | ||
6 | ** Copyright (C) 2004, Michael Lauer | ||
7 | ** mickey@tm.informatik.uni-frankfurt.de | ||
8 | ** http://www.Vanille.de | ||
9 | ** | ||
10 | ** This file may be distributed and/or modified under the terms of the | ||
11 | ** GNU General Public License version 2 as published by the Free Software | ||
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
13 | ** packaging of this file. | ||
14 | ** | ||
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** | ||
18 | **********************************************************************/ | ||
19 | |||
20 | #ifndef SYSLOGINFO_H | ||
21 | #define SYSLOGINFO_H | ||
22 | |||
23 | #include <qwidget.h> | ||
24 | |||
25 | class QTextView; | ||
26 | |||
27 | class SyslogInfo : public QWidget | ||
28 | { | ||
29 | Q_OBJECT | ||
30 | public: | ||
31 | SyslogInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | ||
32 | ~SyslogInfo(); | ||
33 | |||
34 | private: | ||
35 | QTextView* syslogview; | ||
36 | int fd; | ||
37 | |||
38 | private slots: | ||
39 | void updateData(); | ||
40 | }; | ||
41 | |||
42 | #endif | ||