-rw-r--r-- | noncore/settings/sysinfo/load.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/memory.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/modulesdetail.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/modulesinfo.cpp | 83 | ||||
-rw-r--r-- | noncore/settings/sysinfo/modulesinfo.h | 14 | ||||
-rw-r--r-- | noncore/settings/sysinfo/processdetail.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/storage.cpp | 28 | ||||
-rw-r--r-- | noncore/settings/sysinfo/storage.h | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.pro | 2 |
10 files changed, 80 insertions, 59 deletions
diff --git a/noncore/settings/sysinfo/load.cpp b/noncore/settings/sysinfo/load.cpp index 900b3d3..d9d7a66 100644 --- a/noncore/settings/sysinfo/load.cpp +++ b/noncore/settings/sysinfo/load.cpp @@ -130,3 +130,3 @@ Load::Load( QWidget *parent, const char *name, WFlags f ) -void Load::paintEvent( QPaintEvent *ev ) +void Load::paintEvent( QPaintEvent * ) { diff --git a/noncore/settings/sysinfo/memory.cpp b/noncore/settings/sysinfo/memory.cpp index 30d42d5..4f612d8 100644 --- a/noncore/settings/sysinfo/memory.cpp +++ b/noncore/settings/sysinfo/memory.cpp @@ -30,3 +30,3 @@ -MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags f ) +MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags ) : QWidget( parent, name, WStyle_ContextHelp ) diff --git a/noncore/settings/sysinfo/modulesdetail.cpp b/noncore/settings/sysinfo/modulesdetail.cpp index ea5f352..ea9cdfa 100644 --- a/noncore/settings/sysinfo/modulesdetail.cpp +++ b/noncore/settings/sysinfo/modulesdetail.cpp @@ -34,3 +34,3 @@ -ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags fl ) +ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags ) : QWidget( parent, name, WStyle_ContextHelp ) diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp index a0d26c7..c558fad 100644 --- a/noncore/settings/sysinfo/modulesinfo.cpp +++ b/noncore/settings/sysinfo/modulesinfo.cpp @@ -23,2 +23,3 @@ +#include <qcombobox.h> #include <qfile.h> @@ -27,2 +28,5 @@ #include <qlistview.h> +#include <qmessagebox.h> +#include <qpushbutton.h> +#include <qstring.h> #include <qtimer.h> @@ -35,5 +39,7 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) { - QVBoxLayout *layout = new QVBoxLayout( this, 5 ); + QGridLayout *layout = new QGridLayout( this ); + layout->setSpacing( 4 ); + layout->setMargin( 4 ); - ModulesView = new QListView( this, "ModulesView" ); + ModulesView = new QListView( this ); int colnum = ModulesView->addColumn( tr( "Module" ) ); @@ -45,8 +51,20 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) ModulesView->setAllColumnsShowFocus( TRUE ); - QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); - connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), - this, SLOT( viewModules( QListViewItem * ) ) ); - layout->addWidget( ModulesView ); + layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) ); + CommandCB = new QComboBox( FALSE, this ); + CommandCB->insertItem( "modprobe -r" ); + CommandCB->insertItem( "rmmod" ); + // I can't think of other useful commands yet. Anyone? + layout->addWidget( CommandCB, 1, 0 ); + QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) ); + + QPushButton *btn = new QPushButton( this ); + btn->setMinimumSize( QSize( 50, 24 ) ); + btn->setMaximumSize( QSize( 50, 24 ) ); + btn->setText( tr( "Send" ) ); + connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); + layout->addWidget( btn, 1, 1 ); + QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) ); + QTimer *t = new QTimer( this ); @@ -56,5 +74,2 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) updateData(); - - ModulesDtl = new ModulesDetail( 0, 0, 0 ); - ModulesDtl->ModulesView->setTextFormat( PlainText ); } @@ -70,3 +85,3 @@ void ModulesInfo::updateData() int modsize, usecount; - + ModulesView->clear(); @@ -77,5 +92,5 @@ void ModulesInfo::updateData() { - while ( true ) { + while ( true ) { int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); - + if ( success == EOF ) @@ -87,6 +102,6 @@ void ModulesInfo::updateData() QString qusage = QString( usage ); - + ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); } - + fclose( procfile ); @@ -95,28 +110,24 @@ void ModulesInfo::updateData() -void ModulesInfo::viewModules( QListViewItem *modules ) +void ModulesInfo::slotSendClicked() { - QString modname = modules->text( 0 ); - ModulesDtl->setCaption( QString( "Module: " ) + modname ); - ModulesDtl->modname = modname; - QString command = QString( "/sbin/modinfo " ) + modules->text( 0 ); - - FILE* modinfo = popen( command, "r" ); - - if ( modinfo ) + QString capstr = tr( "You really want to execute\n" ); + capstr.append( CommandCB->currentText() ); + capstr.append( "\nfor this module?" ); + + if ( QMessageBox::warning( this, caption(), capstr, + QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) { - char line[200]; - ModulesDtl->ModulesView->setText( " Details:\n------------\n" ); - - while( true ) - { - int success = fscanf( modinfo, "%[^\n]\n", line ); - if ( success == EOF ) - break; - ModulesDtl->ModulesView->append( line ); - } - - pclose( modinfo ); + QString command = "/sbin/"; + command.append( CommandCB->currentText() ); + command.append( " " ); + command.append( ModulesView->currentItem()->text( 0 ) ); + + FILE* stream = popen( command, "r" ); + if ( stream ) + pclose( stream ); + //{ + // hide(); + //} } - ModulesDtl->showMaximized(); } diff --git a/noncore/settings/sysinfo/modulesinfo.h b/noncore/settings/sysinfo/modulesinfo.h index c702f24..ef1f805 100644 --- a/noncore/settings/sysinfo/modulesinfo.h +++ b/noncore/settings/sysinfo/modulesinfo.h @@ -25,5 +25,5 @@ #include <qwidget.h> -#include <qlistview.h> -#include "modulesdetail.h" +class QComboBox; +class QListView; @@ -36,9 +36,9 @@ public: -private slots: - void updateData(); - void viewModules( QListViewItem * ); - private: QListView* ModulesView; - ModulesDetail *ModulesDtl; + QComboBox* CommandCB; + +private slots: + void updateData(); + void slotSendClicked(); }; diff --git a/noncore/settings/sysinfo/processdetail.cpp b/noncore/settings/sysinfo/processdetail.cpp index 661e32c..fcb871f 100644 --- a/noncore/settings/sysinfo/processdetail.cpp +++ b/noncore/settings/sysinfo/processdetail.cpp @@ -32,3 +32,3 @@ -ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags fl ) +ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags ) : QWidget( parent, name, WStyle_ContextHelp ) diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp index c33663e..5d6cd1b 100644 --- a/noncore/settings/sysinfo/storage.cpp +++ b/noncore/settings/sysinfo/storage.cpp @@ -22,2 +22,3 @@ #include <qlayout.h> +#include <qscrollview.h> #include <qtimer.h> @@ -37,4 +38,12 @@ StorageInfo::StorageInfo( QWidget *parent, const char *name ) { - vb = 0; - disks.setAutoDelete(TRUE); + 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; + + disks.setAutoDelete(TRUE); lines.setAutoDelete(TRUE); @@ -86,6 +95,5 @@ void StorageInfo::updateMounts() QString fs = me->mnt_fsname; - qDebug(fs+" "+(QString)me->mnt_type); if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" - || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs") { + || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs" || fs.left(5) == "tmpfs" ) { n++; @@ -108,3 +116,3 @@ void StorageInfo::updateMounts() delete vb; - vb = new QVBoxLayout( this, n > 3 ? 1 : 5 ); + vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ ); bool frst=TRUE; @@ -117,3 +125,3 @@ void StorageInfo::updateMounts() if ( !frst ) { - QFrame *f = new QFrame( this ); + QFrame *f = new QFrame( container ); vb->addWidget(f); @@ -124,3 +132,2 @@ void StorageInfo::updateMounts() QString humanname=*it; -// qDebug(humanname); if ( isCF(humanname) ) @@ -143,2 +150,4 @@ void StorageInfo::updateMounts() humanname = tr( "Int. Storage " ); + else if ( humanname.left(5) == "tmpfs" ) + humanname = tr( "RAM disk" ); // etc. @@ -149,3 +158,3 @@ void StorageInfo::updateMounts() - MountInfo* mi = new MountInfo( *fsit, humanname, this ); + MountInfo* mi = new MountInfo( *fsit, humanname, container ); vb->addWidget(mi); @@ -165,2 +174,4 @@ void StorageInfo::updateMounts() 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." ) ); } @@ -179,3 +190,2 @@ MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, { - qDebug("new path is "+path); fs = new FileSystem( path ); diff --git a/noncore/settings/sysinfo/storage.h b/noncore/settings/sysinfo/storage.h index 3fa5b79..7e8b4e0 100644 --- a/noncore/settings/sysinfo/storage.h +++ b/noncore/settings/sysinfo/storage.h @@ -31,2 +31,3 @@ class MountInfo; class QVBoxLayout; +class QWidget; @@ -47,2 +48,3 @@ private: QVBoxLayout *vb; + QWidget *container; }; diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp index 6d2a64f..872492e 100644 --- a/noncore/settings/sysinfo/sysinfo.cpp +++ b/noncore/settings/sysinfo/sysinfo.cpp @@ -39,3 +39,3 @@ -SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f ) +SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) : QWidget( parent, name, WStyle_ContextHelp ) diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro index 236fc02..7e66451 100644 --- a/noncore/settings/sysinfo/sysinfo.pro +++ b/noncore/settings/sysinfo/sysinfo.pro @@ -10,3 +10,2 @@ HEADERS = memory.h \ modulesinfo.h \ - modulesdetail.h \ versioninfo.h \ @@ -21,3 +20,2 @@ SOURCES = main.cpp \ processdetail.cpp \ - modulesdetail.cpp \ versioninfo.cpp \ |