author | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
commit | 951d1d4125a80dc814f95d2956853bf53ca52e9a (patch) (side-by-side diff) | |
tree | 46c7a70b80a7eebb54cd59c46204c28335f3821c /noncore/settings/sysinfo | |
parent | f0a15a9866f9eddfe10596e63a1e6300b92b9e3f (diff) | |
download | opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.zip opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.tar.gz opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.tar.bz2 |
merge noncore/apps/* except
- advancedfm (ljp, please...)
- odict (tille, please...)
-rw-r--r-- | noncore/settings/sysinfo/main.cpp | 11 | ||||
-rw-r--r-- | noncore/settings/sysinfo/storage.cpp | 27 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.h | 1 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.pro | 9 |
4 files changed, 16 insertions, 32 deletions
diff --git a/noncore/settings/sysinfo/main.cpp b/noncore/settings/sysinfo/main.cpp index 6e889db..02b1098 100644 --- a/noncore/settings/sysinfo/main.cpp +++ b/noncore/settings/sysinfo/main.cpp @@ -8,27 +8,20 @@ ** 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "sysinfo.h" #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> -int main( int argc, char *argv[] ) -{ - QPEApplication a( argc, argv ); - - SystemInfo *si = new SystemInfo(); - a.showMainWidget( si ); - - return a.exec(); -} +OPIE_EXPORT_APP( OApplicationFactory<SystemInfo> ) diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp index c4474d5..4ef7122 100644 --- a/noncore/settings/sysinfo/storage.cpp +++ b/noncore/settings/sysinfo/storage.cpp @@ -37,146 +37,137 @@ #endif FileSysInfo::FileSysInfo( QWidget *parent, const char *name ) : QWidget( parent, name ) { QVBoxLayout *tmpvb = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); tmpvb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); container = new QWidget( sv->viewport() ); sv->addChild( container ); vb = 0x0; storage = new StorageInfo( this ); connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) ); - + lines.setAutoDelete(TRUE); rebuildDisks = TRUE; updateMounts(); startTimer( 5000 ); } + void FileSysInfo::timerEvent(QTimerEvent*) { updateMounts(); } void FileSysInfo::updateMounts() { storage->update(); - + if ( rebuildDisks ) { - // Cannot auto delete QDict<MountInfo> disks because it seems to delete - // the filesystem object as well causing a segfault - MountInfo *mi; - for ( QDictIterator<MountInfo> delit(disks); delit.current(); ++delit ) - { - mi = delit.current(); - mi->fs = 0x0; - delete mi; - } disks.clear(); lines.clear(); - + delete vb; vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ ); bool frst=TRUE; - + FileSystem *fs; for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it ) { fs = it.current(); - + if ( !frst ) { QFrame *f = new QFrame( container ); vb->addWidget(f); f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); lines.append(f); f->show(); } frst = FALSE; - + MountInfo *mi = new MountInfo( fs, container ); vb->addWidget( mi ); disks.insert( fs->path(), mi ); mi->show(); QString tempstr = fs->name().left( 2 ); if ( tempstr == tr( "CF" ) ) QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) ); else if ( tempstr == tr( "Ha" ) ) QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); else if ( tempstr == tr( "SD" ) ) QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); else if ( tempstr == tr( "SC" ) ) QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); else if ( tempstr == tr( "In" ) ) QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the built-in memory (i.e. Flash memory) on this handheld device." ) ); else if ( tempstr == tr( "RA" ) ) QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) ); } vb->addStretch(); } else { for (QDictIterator<MountInfo> i(disks); i.current(); ++i) i.current()->updateData(); } - + rebuildDisks = FALSE; } void FileSysInfo::disksChanged() { rebuildDisks = TRUE; } MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name ) : QWidget( parent, name ) { QVBoxLayout *vb = new QVBoxLayout( this, 3 ); totalSize = new QLabel( this ); vb->addWidget( totalSize ); fs = filesys; title = fs->name(); - + data = new GraphData(); graph = new BarGraph( this ); graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); vb->addWidget( graph, 1 ); graph->setData( data ); legend = new GraphLegend( this ); legend->setOrientation(Horizontal); vb->addWidget( legend ); legend->setData( data ); updateData(); } MountInfo::~MountInfo() { delete data; - delete fs; } void MountInfo::updateData() { long mult = fs->blockSize() / 1024; long div = 1024 / fs->blockSize(); if ( !mult ) mult = 1; if ( !div ) div = 1; long total = fs->totalBlocks() * mult / div; long avail = fs->availBlocks() * mult / div; long used = total - avail; totalSize->setText( title + tr(" : %1 kB").arg( total ) ); data->clear(); data->addItem( tr("Used (%1 kB)").arg(used), used ); data->addItem( tr("Available (%1 kB)").arg(avail), avail ); graph->repaint( FALSE ); diff --git a/noncore/settings/sysinfo/sysinfo.h b/noncore/settings/sysinfo/sysinfo.h index d69346a..94c3876 100644 --- a/noncore/settings/sysinfo/sysinfo.h +++ b/noncore/settings/sysinfo/sysinfo.h @@ -16,18 +16,19 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** ********************************************************************** ** ** Enhancements by: Dan Williams, <williamsdr@acm.org> ** **********************************************************************/ #include <qwidget.h> class SystemInfo : public QWidget { Q_OBJECT public: SystemInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); + static QString appName() { return QString::fromLatin1("sysinfo"); } }; diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro index 2582ea2..2322989 100644 --- a/noncore/settings/sysinfo/sysinfo.pro +++ b/noncore/settings/sysinfo/sysinfo.pro @@ -1,43 +1,42 @@ -TEMPLATE = app -CONFIG = qt warn_on release -DESTDIR = $(OPIEDIR)/bin +CONFIG = qt warn_on release quick-app HEADERS = memory.h \ graph.h \ load.h \ storage.h \ processinfo.h \ modulesinfo.h \ detail.h \ versioninfo.h \ sysinfo.h SOURCES = main.cpp \ memory.cpp \ graph.cpp \ load.cpp \ storage.cpp \ processinfo.cpp \ modulesinfo.cpp \ detail.cpp \ versioninfo.cpp \ sysinfo.cpp -INTERFACES = + INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -TARGET = sysinfo + +TARGET = sysinfo TRANSLATIONS = ../../../i18n/de/sysinfo.ts \ ../../../i18n/nl/sysinfo.ts \ ../../../i18n/xx/sysinfo.ts \ ../../../i18n/en/sysinfo.ts \ ../../../i18n/es/sysinfo.ts \ ../../../i18n/fr/sysinfo.ts \ ../../../i18n/hu/sysinfo.ts \ ../../../i18n/ja/sysinfo.ts \ ../../../i18n/ko/sysinfo.ts \ ../../../i18n/no/sysinfo.ts \ ../../../i18n/pl/sysinfo.ts \ ../../../i18n/pt/sysinfo.ts \ ../../../i18n/pt_BR/sysinfo.ts \ ../../../i18n/sl/sysinfo.ts \ ../../../i18n/zh_CN/sysinfo.ts \ |