summaryrefslogtreecommitdiff
authordrw <drw>2002-07-16 01:08:45 (UTC)
committer drw <drw>2002-07-16 01:08:45 (UTC)
commitb1849c87eade2706908caddeda5924866c040441 (patch) (unidiff)
treef36cbfb15eaa2eeea9f20438a5655188ee6165ab
parent72eb74051ed8f1b7696041e241ab99df3af5b08d (diff)
downloadopie-b1849c87eade2706908caddeda5924866c040441.zip
opie-b1849c87eade2706908caddeda5924866c040441.tar.gz
opie-b1849c87eade2706908caddeda5924866c040441.tar.bz2
New tab widget
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,9 +1,9 @@
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>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: System Information dialog 8Description: System Information dialog
9 For the Opie environment. 9 For the Opie environment.
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
@@ -1,57 +1,55 @@
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#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 )
37 : QWidget( parent, name, f ) 36 : QWidget( parent, name, f )
38{ 37{
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}
56 54
57 55
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
@@ -1,44 +1,46 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = memory.h \ 4HEADERS = memory.h \
5 graph.h \ 5 graph.h \
6 load.h \ 6 load.h \
7 storage.h \ 7 storage.h \
8 processinfo.h \ 8 processinfo.h \
9 processdetail.h \ 9 processdetail.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 \
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 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
27DEPENDPATH += $(OPIEDIR)/include 29DEPENDPATH += $(OPIEDIR)/include
28LIBS += -lqpe 30LIBS += -lqpe
29TARGET = sysinfo 31TARGET = sysinfo
30 32
31TRANSLATIONS = ../../../i18n/de/sysinfo.ts \ 33TRANSLATIONS = ../../../i18n/de/sysinfo.ts \
32 ../../../i18n/en/sysinfo.ts \ 34 ../../../i18n/en/sysinfo.ts \
33 ../../../i18n/es/sysinfo.ts \ 35 ../../../i18n/es/sysinfo.ts \
34 ../../../i18n/fr/sysinfo.ts \ 36 ../../../i18n/fr/sysinfo.ts \
35 ../../../i18n/hu/sysinfo.ts \ 37 ../../../i18n/hu/sysinfo.ts \
36 ../../../i18n/ja/sysinfo.ts \ 38 ../../../i18n/ja/sysinfo.ts \
37 ../../../i18n/ko/sysinfo.ts \ 39 ../../../i18n/ko/sysinfo.ts \
38 ../../../i18n/no/sysinfo.ts \ 40 ../../../i18n/no/sysinfo.ts \
39 ../../../i18n/pl/sysinfo.ts \ 41 ../../../i18n/pl/sysinfo.ts \
40 ../../../i18n/pt/sysinfo.ts \ 42 ../../../i18n/pt/sysinfo.ts \
41 ../../../i18n/pt_BR/sysinfo.ts \ 43 ../../../i18n/pt_BR/sysinfo.ts \
42 ../../../i18n/sl/sysinfo.ts \ 44 ../../../i18n/sl/sysinfo.ts \
43 ../../../i18n/zh_CN/sysinfo.ts \ 45 ../../../i18n/zh_CN/sysinfo.ts \
44 ../../../i18n/zh_TW/sysinfo.ts 46 ../../../i18n/zh_TW/sysinfo.ts