summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-01-05 15:48:48 (UTC)
committer mickeyl <mickeyl>2005-01-05 15:48:48 (UTC)
commitfecdd65b5188f3492ae92108b9d19393011de666 (patch) (unidiff)
tree9f19107d3f722d59bdaa789c1d8dd07ea336d84e
parent34ae22499b91f483f1cf505e515047ea11e8eaf0 (diff)
downloadopie-fecdd65b5188f3492ae92108b9d19393011de666.zip
opie-fecdd65b5188f3492ae92108b9d19393011de666.tar.gz
opie-fecdd65b5188f3492ae92108b9d19393011de666.tar.bz2
read font size from qpe.conf
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/sysinfo.pro2
-rw-r--r--noncore/settings/sysinfo/sysloginfo.cpp7
2 files changed, 6 insertions, 3 deletions
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro
index 46d6117..fc754d7 100644
--- a/noncore/settings/sysinfo/sysinfo.pro
+++ b/noncore/settings/sysinfo/sysinfo.pro
@@ -1,36 +1,36 @@
1CONFIG = qt warn_on quick-app 1CONFIG = qt warn_on quick-app
2HEADERS = \ 2HEADERS = \
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 sysloginfo.h \
13 versioninfo.h \ 13 versioninfo.h \
14 sysinfo.h 14 sysinfo.h
15SOURCES = main.cpp \ 15SOURCES = main.cpp \
16 memory.cpp \ 16 memory.cpp \
17 graph.cpp \ 17 graph.cpp \
18 load.cpp \ 18 load.cpp \
19 storage.cpp \ 19 storage.cpp \
20 processinfo.cpp \ 20 processinfo.cpp \
21 modulesinfo.cpp \ 21 modulesinfo.cpp \
22 detail.cpp \ 22 detail.cpp \
23 contrib/dhry.c contrib/fft.c \ 23 contrib/dhry.c contrib/fft.c \
24 benchmarkinfo.cpp \ 24 benchmarkinfo.cpp \
25 sysloginfo.cpp \ 25 sysloginfo.cpp \
26 versioninfo.cpp \ 26 versioninfo.cpp \
27 sysinfo.cpp 27 sysinfo.cpp
28 28
29INCLUDEPATH += $(OPIEDIR)/include 29INCLUDEPATH += $(OPIEDIR)/include
30DEPENDPATH += $(OPIEDIR)/include 30DEPENDPATH += $(OPIEDIR)/include
31LIBS += -lqpe -lopiecore2 -lopieui2 31LIBS += -lqpe -lopiecore2 -lopieui2
32DEFINES += UNIX 32DEFINES += UNIX
33TARGET = sysinfo 33TARGET = sysinfo
34VERSION = 1.2.0 34VERSION = 1.2.1
35 35
36include( $(OPIEDIR)/include.pro ) 36include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/sysinfo/sysloginfo.cpp b/noncore/settings/sysinfo/sysloginfo.cpp
index 89c04e0..a9e98e3 100644
--- a/noncore/settings/sysinfo/sysloginfo.cpp
+++ b/noncore/settings/sysinfo/sysloginfo.cpp
@@ -1,116 +1,119 @@
1/********************************************************************** 1/**********************************************************************
2** SyslogInfo 2** SyslogInfo
3** 3**
4** Display Syslog information 4** Display Syslog information
5** 5**
6** Copyright (C) 2004, Michael Lauer 6** Copyright (C) 2004, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** This file may be distributed and/or modified under the terms of the 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 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 12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file. 13** packaging of this file.
14** 14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#include "sysloginfo.h" 20#include "sysloginfo.h"
21#include "detail.h" 21#include "detail.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/olistview.h> 24#include <opie2/olistview.h>
25#include <qpe/qpeapplication.h> 25#include <opie2/oconfig.h>
26using namespace Opie::Core;
26using namespace Opie::Ui; 27using namespace Opie::Ui;
27 28
28/* QT */ 29/* QT */
29#include <qcombobox.h> 30#include <qcombobox.h>
30#include <qfile.h> 31#include <qfile.h>
31#include <qlayout.h> 32#include <qlayout.h>
32#include <qmessagebox.h> 33#include <qmessagebox.h>
33#include <qpushbutton.h> 34#include <qpushbutton.h>
34#include <qsocketnotifier.h> 35#include <qsocketnotifier.h>
35#include <qtextbrowser.h> 36#include <qtextbrowser.h>
36#include <qtimer.h> 37#include <qtimer.h>
37#include <qwhatsthis.h> 38#include <qwhatsthis.h>
38#include <qtextview.h> 39#include <qtextview.h>
39 40
40/* STD */ 41/* STD */
41#include <sys/klog.h> 42#include <sys/klog.h>
42#include <sys/types.h> 43#include <sys/types.h>
43#include <sys/stat.h> 44#include <sys/stat.h>
44#include <fcntl.h> 45#include <fcntl.h>
45#include <assert.h> 46#include <assert.h>
46#include <unistd.h> 47#include <unistd.h>
47#include <string.h> 48#include <string.h>
48#include <errno.h> 49#include <errno.h>
49 50
50#define SYSLOG_READ 2 51#define SYSLOG_READ 2
51#define SYSLOG_READ_ALL 3 52#define SYSLOG_READ_ALL 3
52#define SYSLOG_READ_ALL_CLEAR 4 53#define SYSLOG_READ_ALL_CLEAR 4
53#define SYSLOG_UNREAD 9 54#define SYSLOG_UNREAD 9
54 55
55#undef APPEND 56#undef APPEND
56 57
57const unsigned int bufsize = 16384; 58const unsigned int bufsize = 16384;
58char buf[bufsize]; 59char buf[bufsize];
59 60
60SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl ) 61SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl )
61 : QWidget( parent, name, fl ) 62 : QWidget( parent, name, fl )
62{ 63{
63 QGridLayout *layout = new QGridLayout( this ); 64 QGridLayout *layout = new QGridLayout( this );
64 layout->setSpacing( 4 ); 65 layout->setSpacing( 4 );
65 layout->setMargin( 4 ); 66 layout->setMargin( 4 );
66 67
67 syslogview = new QTextView( this ); 68 syslogview = new QTextView( this );
68 syslogview->setTextFormat( PlainText ); 69 syslogview->setTextFormat( PlainText );
69 syslogview->setFont( QFont( "Fixed" ) ); 70 OConfig cfg( "qpe" );
71 cfg.setGroup( "Appearance" );
72 syslogview->setFont( QFont( "Fixed", cfg.readNumEntry( "FontSize", 10 ) ) );
70 layout->addWidget( syslogview, 0, 0 ); 73 layout->addWidget( syslogview, 0, 0 );
71 syslogview->setText( "..." ); 74 syslogview->setText( "..." );
72 75
73 memset( buf, 0, bufsize ); 76 memset( buf, 0, bufsize );
74 ::klogctl( SYSLOG_READ_ALL, buf, bufsize ); 77 ::klogctl( SYSLOG_READ_ALL, buf, bufsize );
75 syslogview->setText( buf ); 78 syslogview->setText( buf );
76 79
77#ifdef APPEND 80#ifdef APPEND
78 fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC ); 81 fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC );
79 if ( fd == -1 ) 82 if ( fd == -1 )
80 { 83 {
81 syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) ); 84 syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) );
82 return; 85 return;
83 } 86 }
84 QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this ); 87 QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this );
85 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) ); 88 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) );
86#else 89#else
87 QPushButton* pb = new QPushButton( "&Refresh", this ); 90 QPushButton* pb = new QPushButton( "&Refresh", this );
88 layout->addWidget( pb, 1, 0 ); 91 layout->addWidget( pb, 1, 0 );
89 QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) ); 92 QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) );
90#endif 93#endif
91} 94}
92 95
93SyslogInfo::~SyslogInfo() 96SyslogInfo::~SyslogInfo()
94{ 97{
95 if ( fd != -1 ) ::close( fd ); 98 if ( fd != -1 ) ::close( fd );
96} 99}
97 100
98void SyslogInfo::updateData() 101void SyslogInfo::updateData()
99{ 102{
100 qDebug( "SyslogInfo: updateData" ); 103 qDebug( "SyslogInfo: updateData" );
101#ifdef APPEND 104#ifdef APPEND
102 memset( buf, 0, bufsize ); 105 memset( buf, 0, bufsize );
103 int num = ::read( fd, buf, bufsize ); 106 int num = ::read( fd, buf, bufsize );
104 if ( num ) // -1 = error (permission denied) 107 if ( num ) // -1 = error (permission denied)
105 { 108 {
106 syslogview->append( "\n" ); 109 syslogview->append( "\n" );
107 syslogview->append( buf ); 110 syslogview->append( buf );
108 qDebug( "SyslogInfo: adding '%s'", buf ); 111 qDebug( "SyslogInfo: adding '%s'", buf );
109 } 112 }
110#else 113#else
111 memset( buf, 0, bufsize ); 114 memset( buf, 0, bufsize );
112 ::klogctl( SYSLOG_READ_ALL, buf, bufsize ); 115 ::klogctl( SYSLOG_READ_ALL, buf, bufsize );
113 syslogview->setText( buf ); 116 syslogview->setText( buf );
114 syslogview->ensureVisible( 0, syslogview->contentsHeight() ); 117 syslogview->ensureVisible( 0, syslogview->contentsHeight() );
115#endif 118#endif
116} 119}