summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (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 @@
-Files: bin/sysinfo apps/Applications/sysinfo.desktop
+Files: bin/sysinfo apps/Applications/sysinfo.desktop pics/sysinfo
Priority: optional
Section: opie/applications
Maintainer: 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 @@
+/**********************************************************************
+** OTabWidget
+**
+** Modified tab widget control
+**
+** Copyright (C) 2002, Dan Williams
+** williamsdr@acm.org
+** http://draknor.net
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "otabwidget.h"
+
+#include <qpe/resource.h>
+
+#include <qlist.h>
+#include <qtabbar.h>
+
+
+OTabWidget::OTabWidget( QWidget *parent, const char *name )
+ : QTabWidget( parent, name )
+{
+ connect( this, SIGNAL( currentChanged( QWidget * ) ),
+ this, SLOT( tabChangedSlot( QWidget * ) ) );
+}
+
+OTabWidget::~OTabWidget()
+{
+}
+
+void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
+{
+ Tabs.append( TabInfo( child, icon, label ) );
+ QTabWidget::addTab( child, loadSmooth( icon ), QString::null );
+}
+
+void OTabWidget::tabChangedSlot( QWidget *child )
+{
+ TabInfoList::Iterator it;
+
+ if ( CurrentTab != 0x0 )
+ {
+ changeTab( (*CurrentTab).control(), loadSmooth( (*CurrentTab).icon() ), QString::null );
+ }
+
+ for ( it = Tabs.begin(); it != Tabs.end(); ++it )
+ {
+ if ( (*it).control() == child )
+ {
+ CurrentTab = it;
+ changeTab( (*CurrentTab).control(), loadSmooth( (*CurrentTab).icon() ), (*CurrentTab).label() );
+ }
+ }
+}
+
+QPixmap OTabWidget::loadSmooth( const QString &name )
+{
+ QImage image = Resource::loadImage( name );
+ QPixmap pixmap;
+ pixmap.convertFromImage( image.smoothScale( 16, 16 ) );
+ return pixmap;
+}
+
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 @@
+/**********************************************************************
+** OTabWidget
+**
+** Modified tab widget control
+**
+** Copyright (C) 2002, Dan Williams
+** williamsdr@acm.org
+** http://draknor.net
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef OTABWIDGET_H
+#define OTABWIDGET_H
+
+#include <qtabwidget.h>
+
+class TabInfo
+{
+public:
+ TabInfo() : c( 0 ), i( 0 ), l( QString::null ) {}
+ TabInfo( QWidget *control, const QString &icon, const QString &label )
+ : c( control ), i( icon ), l( label ) {}
+ QString label() const { return l; }
+ QWidget *control() const { return c; }
+ QString icon() const { return i; }
+
+private:
+ QWidget *c;
+ QString i;
+ QString l;
+};
+
+typedef QValueList<TabInfo> TabInfoList;
+
+class OTabWidget : public QTabWidget
+{
+ Q_OBJECT
+public:
+ OTabWidget( QWidget *, const char * );
+ ~OTabWidget();
+
+ void addTab( QWidget *, const QString &, const QString & );
+
+private:
+ TabInfoList Tabs;
+ TabInfoList::Iterator CurrentTab;
+
+ QPixmap loadSmooth( const QString & );
+
+private slots:
+ void tabChangedSlot( QWidget * );
+};
+
+#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 @@
#include "memory.h"
#include "load.h"
#include "storage.h"
-//#include "graphics.h"
#include "processinfo.h"
#include "modulesinfo.h"
#include "versioninfo.h"
#include "sysinfo.h"
+#include "otabwidget.h"
#include <qpe/resource.h>
-#include <qtabwidget.h>
#include <qlayout.h>
SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f )
@@ -39,17 +38,16 @@ SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f )
setIcon( Resource::loadPixmap( "system_icon" ) );
setCaption( tr("System Info") );
QVBoxLayout *lay = new QVBoxLayout( this );
- QTabWidget *tab = new QTabWidget( this );
+ OTabWidget *tab = new OTabWidget( this, "tabwidget" );
lay->addWidget( tab );
- tab->addTab( new MemoryInfo( tab ), tr("Memory") );
+ tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon.png", tr("Memory") );
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
- tab->addTab( new StorageInfo( tab ), tr("Storage") );
+ tab->addTab( new StorageInfo( tab ), "sysinfo/storagetabicon.png", tr("Storage") );
#endif
- tab->addTab( new LoadInfo( tab ), tr("CPU") );
-// tab->addTab( new Graphics( tab ), tr("Graphics") );
- tab->addTab( new ProcessInfo( tab ), tr("Process") );
- tab->addTab( new ModulesInfo( tab ), tr("Modules") );
- tab->addTab( new VersionInfo( tab ), tr("Version") );
+ tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon.png", tr("CPU") );
+ tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon.png", tr("Process") );
+ tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon.png", tr("Modules") );
+ tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon.png", tr("Version") );
resize( 220, 180 );
}
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 \
modulesinfo.h \
modulesdetail.h \
versioninfo.h \
+ otabwidget.h \
sysinfo.h
SOURCES = main.cpp \
memory.cpp \
@@ -21,6 +22,7 @@ SOURCES = main.cpp \
processdetail.cpp \
modulesdetail.cpp \
versioninfo.cpp \
+ otabwidget.cpp \
sysinfo.cpp
INTERFACES =
INCLUDEPATH += $(OPIEDIR)/include