summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/opie-sysinfo.control4
-rw-r--r--noncore/settings/sysinfo/otabwidget.cpp264
-rw-r--r--noncore/settings/sysinfo/otabwidget.h97
-rw-r--r--noncore/settings/sysinfo/sysinfo.cpp9
-rw-r--r--noncore/settings/sysinfo/sysinfo.h4
-rw-r--r--noncore/settings/sysinfo/sysinfo.pro4
6 files changed, 14 insertions, 368 deletions
diff --git a/noncore/settings/sysinfo/opie-sysinfo.control b/noncore/settings/sysinfo/opie-sysinfo.control
index 415854c..796f734 100644
--- a/noncore/settings/sysinfo/opie-sysinfo.control
+++ b/noncore/settings/sysinfo/opie-sysinfo.control
@@ -2,8 +2,8 @@ Files: bin/sysinfo apps/Applications/sysinfo.desktop pics/sysinfo
Priority: optional
Section: opie/applications
-Maintainer: Warwick Allison <warwick@trolltech.com>
+Maintainer: Dan Williams <wiliamsdr@acm.org>
Architecture: arm
Version: $QPE_VERSION-$SUB_VERSION
-Depends: opie-base ($QPE_VERSION)
+Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION)
Description: System Information dialog
For the Opie environment.
diff --git a/noncore/settings/sysinfo/otabwidget.cpp b/noncore/settings/sysinfo/otabwidget.cpp
deleted file mode 100644
index 9fe6c4b..0000000
--- a/noncore/settings/sysinfo/otabwidget.cpp
+++ b/dev/null
@@ -1,264 +0,0 @@
-/**********************************************************************
-** 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/config.h>
-#include <qpe/resource.h>
-
-#include <qcombobox.h>
-#include <qtabbar.h>
-#include <qwidgetstack.h>
-
-OTabWidget::OTabWidget( QWidget *parent, const char *name = 0x0,
- TabStyle s = Global, TabPosition p = Top )
- : QWidget( parent, name )
-{
- if ( s == Global )
- {
- Config config( "qpe" );
- config.setGroup( "Appearance" );
- tabBarStyle = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
- if ( tabBarStyle <= Global || tabBarStyle > IconList)
- {
- tabBarStyle = IconTab;
- }
- QString pos = config.readEntry( "TabPosition", "Top");
- if ( pos == "Top" )
- {
- tabBarPosition = Top;
- }
- else
- {
- tabBarPosition = Bottom;
- }
- }
- else
- {
- tabBarStyle = s;
- tabBarPosition = p;
- }
-
- widgetStack = new QWidgetStack( this, "widgetstack" );
- widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
- widgetStack->setLineWidth( style().defaultFrameWidth() );
-
- tabBarStack = new QWidgetStack( this, "tabbarstack" );
-
- tabBar = new QTabBar( tabBarStack, "tabbar" );
- tabBarStack->addWidget( tabBar, 0 );
- connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) );
-
- tabList = new QComboBox( false, tabBarStack, "tablist" );
- tabBarStack->addWidget( tabList, 1 );
- connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) );
-
- if ( tabBarStyle == TextTab || tabBarStyle == IconTab )
- {
- tabBarStack->raiseWidget( tabBar );
- }
- else if ( tabBarStyle == TextList || tabBarStyle == IconList )
- {
- tabBarStack->raiseWidget( tabList );
- }
-
- if ( tabBarPosition == Bottom )
- {
- tabBar->setShape( QTabBar::RoundedBelow );
- }
-
- currentTab= 0x0;
-}
-
-OTabWidget::~OTabWidget()
-{
-}
-
-void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
-{
- QPixmap iconset = loadSmooth( icon );
-
- // Add to tabBar
- QTab * tab = new QTab();
- if ( tabBarStyle == IconTab )
- {
- tab->label = QString::null;
- }
- else
- {
- tab->label = label;
- }
- if ( tabBarStyle == IconTab || tabBarStyle == IconList)
- {
- tab->iconset = new QIconSet( iconset );
- }
- int tabid = tabBar->addTab( tab );
-
- // Add to tabList
- if ( tabBarStyle == IconTab || tabBarStyle == IconList )
- {
- tabList->insertItem( iconset, label, -1 );
- }
- else
- {
- tabList->insertItem( label );
- }
-
- // Add child to widget list
- widgetStack->addWidget( child, tabid );
- widgetStack->raiseWidget( child );
-
- // Save tab information
- TabInfo *tabinfo = new TabInfo( tabid, child, icon, label );
- tabs.append( tabinfo );
- selectTab( tabinfo );
-
-// setUpLayout();
-}
-
-void OTabWidget::setCurrentTab( QWidget *childwidget )
-{
- TabInfo *newtab = tabs.first();
- while ( newtab && newtab->control() != childwidget )
- {
- newtab = tabs.next();
- }
- if ( newtab && newtab->control() == childwidget )
- {
- selectTab( newtab );
- }
-}
-
-void OTabWidget::setCurrentTab( QString tabname )
-{
- TabInfo *newtab = tabs.first();
- while ( newtab && newtab->label() != tabname )
- {
- newtab = tabs.next();
- }
- if ( newtab && newtab->label() == tabname )
- {
- selectTab( newtab );
- }
-}
-
-OTabWidget::TabStyle OTabWidget::tabStyle() const
-{
- return tabBarStyle;
-}
-
-void OTabWidget::setTabStyle( TabStyle s )
-{
- tabBarStyle = s;
-}
-
-OTabWidget::TabPosition OTabWidget::tabPosition() const
-{
- return tabBarPosition;
-}
-
-void OTabWidget::setTabPosition( TabPosition p )
-{
- tabBarPosition = p;
-}
-
-void OTabWidget::slotTabBarSelected( int id )
-{
- TabInfo *newtab = tabs.first();
- while ( newtab && newtab->id() != id )
- {
- newtab = tabs.next();
- }
- if ( newtab && newtab->id() == id )
- {
- selectTab( newtab );
- }
-}
-
-void OTabWidget::slotTabListSelected( int index )
-{
- TabInfo *newtab = tabs.at( index );
- if ( newtab )
- {
- selectTab( newtab );
- }
-}
-
-QPixmap OTabWidget::loadSmooth( const QString &name )
-{
- QImage image = Resource::loadImage( name );
- QPixmap pixmap;
- pixmap.convertFromImage( image.smoothScale( 16, 16 ) );
- return pixmap;
-}
-
-void OTabWidget::selectTab( TabInfo *tab )
-{
- if ( tabBarStyle == IconTab )
- {
- if ( currentTab )
- {
- tabBar->tab( currentTab->id() )->setText( QString::null );
- setUpLayout();
- }
- tabBar->tab( tab->id() )->setText( tab->label() );
- currentTab = tab;
- }
- tabBar->setCurrentTab( tab->id() );
- setUpLayout();
- tabBar->update();
-
- widgetStack->raiseWidget( tab->control() );
-}
-
-void OTabWidget::setUpLayout()
-{
- tabBar->layoutTabs();
- QSize t( tabBarStack->sizeHint() );
- if ( t.width() > width() )
- t.setWidth( width() );
- int lw = widgetStack->lineWidth();
- if ( tabBarPosition == Bottom )
- {
- tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() );
- widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) );
- }
- else
- { // Top
- tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() );
- widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX(0, lw-2));
- }
-
-// if ( !onlyCheck )
-// update();
- if ( autoMask() )
- updateMask();
-}
-
-QSize OTabWidget::sizeHint() const
-{
- QSize s( widgetStack->sizeHint() );
- QSize t( tabBarStack->sizeHint() );
- return QSize( QMAX( s.width(), t.width()), s.height() + t.height() );
-}
-
-void OTabWidget::resizeEvent( QResizeEvent * )
-{
- setUpLayout();
-}
diff --git a/noncore/settings/sysinfo/otabwidget.h b/noncore/settings/sysinfo/otabwidget.h
deleted file mode 100644
index 7450d51..0000000
--- a/noncore/settings/sysinfo/otabwidget.h
+++ b/dev/null
@@ -1,97 +0,0 @@
-/**********************************************************************
-** 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 <qwidget.h>
-#include <qlist.h>
-
-class QComboBox;
-class QPixmap;
-class QTabBar;
-class QWidgetStack;
-
-class TabInfo
-{
-public:
- TabInfo() : i( -1 ), c( 0 ), p( 0 ), l( QString::null ) {}
- TabInfo( int id, QWidget *control, const QString &icon, const QString &label )
- : i( id ), c( control ), p( icon ), l( label ) {}
- int id() const { return i; }
- QString label() const { return l; }
- QWidget *control() const { return c; }
- QString icon() const { return p; }
-
-private:
- int i;
- QWidget *c;
- QString p;
- QString l;
-};
-
-typedef QList<TabInfo> TabInfoList;
-
-class OTabWidget : public QWidget
-{
- Q_OBJECT
-public:
- enum TabStyle { Global, TextTab, IconTab, TextList, IconList };
- TabStyle tabStyle() const;
- void setTabStyle( TabStyle );
-
- enum TabPosition { Top, Bottom };
- TabPosition tabPosition() const;
- void setTabPosition( TabPosition );
-
- OTabWidget( QWidget *, const char *, TabStyle, TabPosition );
- ~OTabWidget();
-
- void addTab( QWidget *, const QString &, const QString & );
- void setCurrentTab( QWidget * );
- void setCurrentTab( QString );
- QSize sizeHint() const;
-
-
-protected:
- void resizeEvent( QResizeEvent * );
-
-private:
- TabInfoList tabs;
- TabInfo *currentTab;
-
- TabStyle tabBarStyle;
- TabPosition tabBarPosition;
-
- QWidgetStack *tabBarStack;
- QTabBar *tabBar;
- QComboBox *tabList;
-
- QWidgetStack *widgetStack;
-
- QPixmap loadSmooth( const QString & );
- void selectTab( TabInfo * );
- void setUpLayout();
-
-private slots:
- void slotTabBarSelected( int );
- void slotTabListSelected( int );
-};
-
-#endif
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp
index ca08ae2..a6d7f1c 100644
--- a/noncore/settings/sysinfo/sysinfo.cpp
+++ b/noncore/settings/sysinfo/sysinfo.cpp
@@ -18,4 +18,8 @@
**
**********************************************************************/
+**
+** Enhancements by: Dan Williams, <williamsdr@acm.org>
+**
+**********************************************************************/
#include "memory.h"
@@ -27,5 +31,5 @@
#include "sysinfo.h"
-#include "otabwidget.h"
+#include <opie/otabwidget.h>
#include <qpe/config.h>
@@ -47,5 +51,5 @@ SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f )
QVBoxLayout *lay = new QVBoxLayout( this );
- OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
+ OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global );
lay->addWidget( tab );
tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon.png", tr("Memory") );
@@ -61,4 +65,5 @@ SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f )
tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon.png", tr("Version") );
+ tab->setCurrentTab( tr( "Memory" ) );
}
diff --git a/noncore/settings/sysinfo/sysinfo.h b/noncore/settings/sysinfo/sysinfo.h
index abbf955..91eba9d 100644
--- a/noncore/settings/sysinfo/sysinfo.h
+++ b/noncore/settings/sysinfo/sysinfo.h
@@ -18,4 +18,8 @@
**
**********************************************************************/
+**
+** Enhancements by: Dan Williams, <williamsdr@acm.org>
+**
+**********************************************************************/
#include <qwidget.h>
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro
index a5adb26..231085d 100644
--- a/noncore/settings/sysinfo/sysinfo.pro
+++ b/noncore/settings/sysinfo/sysinfo.pro
@@ -11,5 +11,4 @@ HEADERS = memory.h \
modulesdetail.h \
versioninfo.h \
- otabwidget.h \
sysinfo.h
SOURCES = main.cpp \
@@ -23,10 +22,9 @@ SOURCES = main.cpp \
modulesdetail.cpp \
versioninfo.cpp \
- otabwidget.cpp \
sysinfo.cpp
INTERFACES =
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe
+LIBS += -lqpe -lopie
TARGET = sysinfo