summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/opie-sysinfo.control2
-rw-r--r--noncore/settings/sysinfo/otabwidget.cpp71
-rw-r--r--noncore/settings/sysinfo/otabwidget.h62
-rw-r--r--noncore/settings/sysinfo/sysinfo.cpp18
-rw-r--r--noncore/settings/sysinfo/sysinfo.pro2
5 files changed, 144 insertions, 11 deletions
diff --git a/noncore/settings/sysinfo/opie-sysinfo.control b/noncore/settings/sysinfo/opie-sysinfo.control
index 95acc92..415854c 100644
--- a/noncore/settings/sysinfo/opie-sysinfo.control
+++ b/noncore/settings/sysinfo/opie-sysinfo.control
@@ -1,4 +1,4 @@
1Files: bin/sysinfo apps/Applications/sysinfo.desktop 1Files: bin/sysinfo apps/Applications/sysinfo.desktop pics/sysinfo
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications
4Maintainer: Warwick Allison <warwick@trolltech.com> 4Maintainer: Warwick Allison <warwick@trolltech.com>
diff --git a/noncore/settings/sysinfo/otabwidget.cpp b/noncore/settings/sysinfo/otabwidget.cpp
new file mode 100644
index 0000000..5d5b3e6
--- a/dev/null
+++ b/noncore/settings/sysinfo/otabwidget.cpp
@@ -0,0 +1,71 @@
1/**********************************************************************
2** OTabWidget
3**
4** Modified tab widget control
5**
6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org
8** http://draknor.net
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 "otabwidget.h"
21
22#include <qpe/resource.h>
23
24#include <qlist.h>
25#include <qtabbar.h>
26
27
28OTabWidget::OTabWidget( QWidget *parent, const char *name )
29 : QTabWidget( parent, name )
30{
31 connect( this, SIGNAL( currentChanged( QWidget * ) ),
32 this, SLOT( tabChangedSlot( QWidget * ) ) );
33}
34
35OTabWidget::~OTabWidget()
36{
37}
38
39void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
40{
41 Tabs.append( TabInfo( child, icon, label ) );
42 QTabWidget::addTab( child, loadSmooth( icon ), QString::null );
43}
44
45void OTabWidget::tabChangedSlot( QWidget *child )
46{
47 TabInfoList::Iterator it;
48
49 if ( CurrentTab != 0x0 )
50 {
51 changeTab( (*CurrentTab).control(), loadSmooth( (*CurrentTab).icon() ), QString::null );
52 }
53
54 for ( it = Tabs.begin(); it != Tabs.end(); ++it )
55 {
56 if ( (*it).control() == child )
57 {
58 CurrentTab = it;
59 changeTab( (*CurrentTab).control(), loadSmooth( (*CurrentTab).icon() ), (*CurrentTab).label() );
60 }
61 }
62}
63
64QPixmap OTabWidget::loadSmooth( const QString &name )
65{
66 QImage image = Resource::loadImage( name );
67 QPixmap pixmap;
68 pixmap.convertFromImage( image.smoothScale( 16, 16 ) );
69 return pixmap;
70}
71
diff --git a/noncore/settings/sysinfo/otabwidget.h b/noncore/settings/sysinfo/otabwidget.h
new file mode 100644
index 0000000..4588cb9
--- a/dev/null
+++ b/noncore/settings/sysinfo/otabwidget.h
@@ -0,0 +1,62 @@
1/**********************************************************************
2** OTabWidget
3**
4** Modified tab widget control
5**
6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org
8** http://draknor.net
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 OTABWIDGET_H
21#define OTABWIDGET_H
22
23#include <qtabwidget.h>
24
25class TabInfo
26{
27public:
28 TabInfo() : c( 0 ), i( 0 ), l( QString::null ) {}
29 TabInfo( QWidget *control, const QString &icon, const QString &label )
30 : c( control ), i( icon ), l( label ) {}
31 QString label() const { return l; }
32 QWidget *control() const { return c; }
33 QString icon() const { return i; }
34
35private:
36 QWidget *c;
37 QString i;
38 QString l;
39};
40
41typedef QValueList<TabInfo> TabInfoList;
42
43class OTabWidget : public QTabWidget
44{
45 Q_OBJECT
46public:
47 OTabWidget( QWidget *, const char * );
48 ~OTabWidget();
49
50 void addTab( QWidget *, const QString &, const QString & );
51
52private:
53 TabInfoList Tabs;
54 TabInfoList::Iterator CurrentTab;
55
56 QPixmap loadSmooth( const QString & );
57
58private slots:
59 void tabChangedSlot( QWidget * );
60};
61
62#endif
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp
index 13f810a..56ac488 100644
--- a/noncore/settings/sysinfo/sysinfo.cpp
+++ b/noncore/settings/sysinfo/sysinfo.cpp
@@ -21,16 +21,15 @@
21#include "memory.h" 21#include "memory.h"
22#include "load.h" 22#include "load.h"
23#include "storage.h" 23#include "storage.h"
24//#include "graphics.h"
25#include "processinfo.h" 24#include "processinfo.h"
26#include "modulesinfo.h" 25#include "modulesinfo.h"
27#include "versioninfo.h" 26#include "versioninfo.h"
28#include "sysinfo.h" 27#include "sysinfo.h"
29 28
29#include "otabwidget.h"
30 30
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qtabwidget.h>
34#include <qlayout.h> 33#include <qlayout.h>
35 34
36SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f ) 35SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f )
@@ -39,17 +38,16 @@ SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f )
39 setIcon( Resource::loadPixmap( "system_icon" ) ); 38 setIcon( Resource::loadPixmap( "system_icon" ) );
40 setCaption( tr("System Info") ); 39 setCaption( tr("System Info") );
41 QVBoxLayout *lay = new QVBoxLayout( this ); 40 QVBoxLayout *lay = new QVBoxLayout( this );
42 QTabWidget *tab = new QTabWidget( this ); 41 OTabWidget *tab = new OTabWidget( this, "tabwidget" );
43 lay->addWidget( tab ); 42 lay->addWidget( tab );
44 tab->addTab( new MemoryInfo( tab ), tr("Memory") ); 43 tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon.png", tr("Memory") );
45#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 44#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
46 tab->addTab( new StorageInfo( tab ), tr("Storage") ); 45 tab->addTab( new StorageInfo( tab ), "sysinfo/storagetabicon.png", tr("Storage") );
47#endif 46#endif
48 tab->addTab( new LoadInfo( tab ), tr("CPU") ); 47 tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon.png", tr("CPU") );
49// tab->addTab( new Graphics( tab ), tr("Graphics") ); 48 tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon.png", tr("Process") );
50 tab->addTab( new ProcessInfo( tab ), tr("Process") ); 49 tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon.png", tr("Modules") );
51 tab->addTab( new ModulesInfo( tab ), tr("Modules") ); 50 tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon.png", tr("Version") );
52 tab->addTab( new VersionInfo( tab ), tr("Version") );
53 51
54 resize( 220, 180 ); 52 resize( 220, 180 );
55} 53}
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro
index c0cef8f..a5adb26 100644
--- a/noncore/settings/sysinfo/sysinfo.pro
+++ b/noncore/settings/sysinfo/sysinfo.pro
@@ -10,6 +10,7 @@ HEADERS = memory.h \
10 modulesinfo.h \ 10 modulesinfo.h \
11 modulesdetail.h \ 11 modulesdetail.h \
12 versioninfo.h \ 12 versioninfo.h \
13 otabwidget.h \
13 sysinfo.h 14 sysinfo.h
14SOURCES = main.cpp \ 15SOURCES = main.cpp \
15 memory.cpp \ 16 memory.cpp \
@@ -21,6 +22,7 @@ SOURCES = main.cpp \
21 processdetail.cpp \ 22 processdetail.cpp \
22 modulesdetail.cpp \ 23 modulesdetail.cpp \
23 versioninfo.cpp \ 24 versioninfo.cpp \
25 otabwidget.cpp \
24 sysinfo.cpp 26 sysinfo.cpp
25INTERFACES = 27INTERFACES =
26INCLUDEPATH += $(OPIEDIR)/include 28INCLUDEPATH += $(OPIEDIR)/include