author | drw <drw> | 2002-07-16 01:08:45 (UTC) |
---|---|---|
committer | drw <drw> | 2002-07-16 01:08:45 (UTC) |
commit | b1849c87eade2706908caddeda5924866c040441 (patch) (unidiff) | |
tree | f36cbfb15eaa2eeea9f20438a5655188ee6165ab | |
parent | 72eb74051ed8f1b7696041e241ab99df3af5b08d (diff) | |
download | opie-b1849c87eade2706908caddeda5924866c040441.zip opie-b1849c87eade2706908caddeda5924866c040441.tar.gz opie-b1849c87eade2706908caddeda5924866c040441.tar.bz2 |
New tab widget
-rw-r--r-- | noncore/settings/sysinfo/opie-sysinfo.control | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/otabwidget.cpp | 71 | ||||
-rw-r--r-- | noncore/settings/sysinfo/otabwidget.h | 62 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.cpp | 18 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.pro | 2 |
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 @@ | |||
1 | Files: bin/sysinfo apps/Applications/sysinfo.desktop | 1 | Files: bin/sysinfo apps/Applications/sysinfo.desktop pics/sysinfo |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: Warwick Allison <warwick@trolltech.com> | 4 | Maintainer: Warwick Allison <warwick@trolltech.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: System Information dialog | 8 | Description: 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 | |||
28 | OTabWidget::OTabWidget( QWidget *parent, const char *name ) | ||
29 | : QTabWidget( parent, name ) | ||
30 | { | ||
31 | connect( this, SIGNAL( currentChanged( QWidget * ) ), | ||
32 | this, SLOT( tabChangedSlot( QWidget * ) ) ); | ||
33 | } | ||
34 | |||
35 | OTabWidget::~OTabWidget() | ||
36 | { | ||
37 | } | ||
38 | |||
39 | void 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 | |||
45 | void 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 | |||
64 | QPixmap 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 | |||
25 | class TabInfo | ||
26 | { | ||
27 | public: | ||
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 | |||
35 | private: | ||
36 | QWidget *c; | ||
37 | QString i; | ||
38 | QString l; | ||
39 | }; | ||
40 | |||
41 | typedef QValueList<TabInfo> TabInfoList; | ||
42 | |||
43 | class OTabWidget : public QTabWidget | ||
44 | { | ||
45 | Q_OBJECT | ||
46 | public: | ||
47 | OTabWidget( QWidget *, const char * ); | ||
48 | ~OTabWidget(); | ||
49 | |||
50 | void addTab( QWidget *, const QString &, const QString & ); | ||
51 | |||
52 | private: | ||
53 | TabInfoList Tabs; | ||
54 | TabInfoList::Iterator CurrentTab; | ||
55 | |||
56 | QPixmap loadSmooth( const QString & ); | ||
57 | |||
58 | private 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 | ||
36 | SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f ) | 35 | SystemInfo::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 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = memory.h \ | 4 | HEADERS = 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 |
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 | 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 |
25 | INTERFACES = | 27 | INTERFACES = |
26 | INCLUDEPATH += $(OPIEDIR)/include | 28 | INCLUDEPATH += $(OPIEDIR)/include |
27 | DEPENDPATH += $(OPIEDIR)/include | 29 | DEPENDPATH += $(OPIEDIR)/include |
28 | LIBS += -lqpe | 30 | LIBS += -lqpe |
29 | TARGET = sysinfo | 31 | TARGET = sysinfo |
30 | 32 | ||
31 | TRANSLATIONS = ../../../i18n/de/sysinfo.ts \ | 33 | TRANSLATIONS = ../../../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 |