-rw-r--r-- | noncore/settings/sysinfo/modulesdetail.cpp | 12 | ||||
-rw-r--r-- | noncore/settings/sysinfo/modulesinfo.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/sysinfo/processdetail.cpp | 10 | ||||
-rw-r--r-- | noncore/settings/sysinfo/processinfo.cpp | 9 | ||||
-rw-r--r-- | noncore/settings/sysinfo/versioninfo.cpp | 41 |
5 files changed, 51 insertions, 29 deletions
diff --git a/noncore/settings/sysinfo/modulesdetail.cpp b/noncore/settings/sysinfo/modulesdetail.cpp index 48d47f6..ea5f352 100644 --- a/noncore/settings/sysinfo/modulesdetail.cpp +++ b/noncore/settings/sysinfo/modulesdetail.cpp @@ -1,85 +1,89 @@ /********************************************************************** ** ModulesDetail ** ** Display module information ** ** Copyright (C) 2002, Michael Lauer ** mickey@tm.informatik.uni-frankfurt.de ** http://www.Vanille.de ** ** Based on ProcessDetail by Dan Williams <williamsdr@acm.org> ** ** 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 "modulesdetail.h" #include <sys/types.h> #include <stdio.h> + #include <qcombobox.h> -#include <qpushbutton.h> -#include <qtextview.h> #include <qlayout.h> #include <qlistview.h> #include <qmessagebox.h> +#include <qpushbutton.h> +#include <qtextview.h> +#include <qwhatsthis.h> ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags fl ) - : QWidget( parent, name, fl ) + : QWidget( parent, name, WStyle_ContextHelp ) { modname = ""; QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); CommandCB = new QComboBox( FALSE, this, "CommandCB" ); 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." ) ); ModulesView = new QTextView( this, "ModulesView" ); layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); + QWhatsThis::add( ModulesView, tr( "This area shows detailed information about this module." ) ); SendButton = new QPushButton( this, "SendButton" ); SendButton->setMinimumSize( QSize( 50, 24 ) ); SendButton->setMaximumSize( QSize( 50, 24 ) ); SendButton->setText( tr( "Send" ) ); connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); layout->addWidget( SendButton, 1, 1 ); + QWhatsThis::add( SendButton, tr( "Click here to send the selected command to this module." ) ); } ModulesDetail::~ModulesDetail() { } void ModulesDetail::slotSendClicked() { QString command = QString( "/sbin/" ) + CommandCB->currentText() + QString( " " ) + modname; if ( QMessageBox::warning( this, caption(), tr( "You really want to \n" + CommandCB->currentText() + "\nthis Module?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) { FILE* stream = popen( command, "r" ); if ( stream ) pclose( stream ); { hide(); } } } diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp index 7a32c20..a0d26c7 100644 --- a/noncore/settings/sysinfo/modulesinfo.cpp +++ b/noncore/settings/sysinfo/modulesinfo.cpp @@ -1,120 +1,122 @@ /********************************************************************** ** ModulesInfo ** ** Display Modules information ** ** Copyright (C) 2002, Michael Lauer ** mickey@tm.informatik.uni-frankfurt.de ** http://www.Vanille.de ** ** Based on ProcessInfo by Dan Williams <williamsdr@acm.org> ** ** 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 <qpe/qpeapplication.h> +#include <qfile.h> #include <qheader.h> -#include <qlistview.h> #include <qlayout.h> +#include <qlistview.h> #include <qtimer.h> -#include <qfile.h> +#include <qwhatsthis.h> #include "modulesinfo.h" ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QVBoxLayout *layout = new QVBoxLayout( this, 5 ); ModulesView = new QListView( this, "ModulesView" ); int colnum = ModulesView->addColumn( tr( "Module" ) ); colnum = ModulesView->addColumn( tr( "Size" ) ); ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ModulesView->addColumn( tr( "Use#" ) ); ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ModulesView->addColumn( tr( "Used By" ) ); ModulesView->setAllColumnsShowFocus( TRUE ); QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), this, SLOT( viewModules( QListViewItem * ) ) ); - layout->addWidget( ModulesView ); + 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." ) ); + QTimer *t = new QTimer( this ); connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); t->start( 5000 ); updateData(); ModulesDtl = new ModulesDetail( 0, 0, 0 ); ModulesDtl->ModulesView->setTextFormat( PlainText ); } ModulesInfo::~ModulesInfo() { } void ModulesInfo::updateData() { char modname[64]; char usage[200]; int modsize, usecount; ModulesView->clear(); FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); if ( procfile ) { while ( true ) { int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); if ( success == EOF ) break; QString qmodname = QString( modname ); QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); QString qusage = QString( usage ); ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); } fclose( procfile ); } } void ModulesInfo::viewModules( QListViewItem *modules ) { 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 ) { 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 ); } ModulesDtl->showMaximized(); } diff --git a/noncore/settings/sysinfo/processdetail.cpp b/noncore/settings/sysinfo/processdetail.cpp index 5c0d335..661e32c 100644 --- a/noncore/settings/sysinfo/processdetail.cpp +++ b/noncore/settings/sysinfo/processdetail.cpp @@ -1,88 +1,92 @@ /********************************************************************** ** ProcessDetail ** ** Display process information ** ** 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 "processdetail.h" #include <sys/types.h> #include <signal.h> #include <qcombobox.h> -#include <qpushbutton.h> -#include <qtextview.h> #include <qlayout.h> #include <qlistview.h> #include <qmessagebox.h> +#include <qpushbutton.h> +#include <qtextview.h> +#include <qwhatsthis.h> ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags fl ) - : QWidget( parent, name, fl ) + : QWidget( parent, name, WStyle_ContextHelp ) { pid = 0; QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); SignalCB = new QComboBox( FALSE, this, "SignalCB" ); SignalCB->insertItem( " 1: SIGHUP" ); SignalCB->insertItem( " 2: SIGINT" ); SignalCB->insertItem( " 3: SIGQUIT" ); SignalCB->insertItem( " 5: SIGTRAP" ); SignalCB->insertItem( " 6: SIGABRT" ); SignalCB->insertItem( " 9: SIGKILL" ); SignalCB->insertItem( "14: SIGALRM" ); SignalCB->insertItem( "15: SIGTERM" ); SignalCB->insertItem( "18: SIGCONT" ); SignalCB->insertItem( "19: SIGSTOP" ); layout->addWidget( SignalCB, 1, 0 ); + QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) ); ProcessView = new QTextView( this, "ProcessView" ); layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); + QWhatsThis::add( ProcessView, tr( "This area shows detailed information about this process." ) ); SendButton = new QPushButton( this, "SendButton" ); SendButton->setMinimumSize( QSize( 50, 24 ) ); SendButton->setMaximumSize( QSize( 50, 24 ) ); SendButton->setText( tr( "Send" ) ); connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); layout->addWidget( SendButton, 1, 1 ); + QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) ); } ProcessDetail::~ProcessDetail() { } void ProcessDetail::slotSendClicked() { QString sigstr = SignalCB->currentText(); sigstr.truncate(2); int sigid = sigstr.toUInt(); if ( QMessageBox::warning( this, caption(), tr( "You really want to send\n" + SignalCB->currentText() + "\nto this process?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) { if ( kill( pid, sigid ) == 0 ) { hide(); } } } diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp index 0512141..86133a9 100644 --- a/noncore/settings/sysinfo/processinfo.cpp +++ b/noncore/settings/sysinfo/processinfo.cpp @@ -1,133 +1,134 @@ /********************************************************************** ** ProcessInfo ** ** Display process information ** ** 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 <qpe/qpeapplication.h> +#include <qdir.h> +#include <qfile.h> #include <qheader.h> -#include <qlistview.h> #include <qlayout.h> +#include <qlistview.h> #include <qtimer.h> -#include <qfile.h> -#include <qdir.h> +#include <qwhatsthis.h> #include "processinfo.h" ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QVBoxLayout *layout = new QVBoxLayout( this, 5 ); ProcessView = new QListView( this, "ProcessView" ); int colnum = ProcessView->addColumn( tr( "PID" ) ); ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ProcessView->addColumn( tr( "Command" ),96 ); colnum = ProcessView->addColumn( tr( "Status" ) ); colnum = ProcessView->addColumn( tr( "Time" ) ); ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); ProcessView->setAllColumnsShowFocus( TRUE ); QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold ); connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), this, SLOT( viewProcess( QListViewItem * ) ) ); - layout->addWidget( ProcessView ); + QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) ); QTimer *t = new QTimer( this ); connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); t->start( 5000 ); updateData(); ProcessDtl = new ProcessDetail( 0, 0, 0 ); ProcessDtl->ProcessView->setTextFormat( RichText ); } ProcessInfo::~ProcessInfo() { } void ProcessInfo::updateData() { int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, signal, blocked, sigignore, sigcatch; uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, endcode, startstack, kstkesp, kstkeip, wchan; char state; char comm[64]; ProcessView->clear(); QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs); QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); if ( proclist ) { QFileInfoListIterator it(*proclist); QFileInfo *f; while ( ( f = it.current() ) != 0 ) { ++it; QString processnum = f->fileName(); if ( processnum >= "1" && processnum <= "99999" ) { FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r"); if ( procfile ) { fscanf( procfile, "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u", &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); processnum = processnum.rightJustify( 5, ' ' ); QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" ); QString processstatus = QChar(state); QString processtime = QString::number( ( utime + stime ) / 100 ); processtime = processtime.rightJustify( 9, ' ' ); fclose( procfile ); ( void ) new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); } } } } delete proclist; delete procdir; } void ProcessInfo::viewProcess( QListViewItem *process ) { QString pid= process->text( 0 ).stripWhiteSpace(); QString command = process->text( 1 ); ProcessDtl->setCaption( pid + " - " + command ); ProcessDtl->pid = pid.toUInt(); FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); if ( statfile ) { char line[81]; fgets( line, 81, statfile ); ProcessDtl->ProcessView->setText( line ); while ( fgets( line, 81, statfile ) ) { ProcessDtl->ProcessView->append( line ); } fclose( statfile ); } ProcessDtl->showMaximized(); } diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp index 79e7fea..658f371 100644 --- a/noncore/settings/sysinfo/versioninfo.cpp +++ b/noncore/settings/sysinfo/versioninfo.cpp @@ -1,133 +1,144 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** 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 <qpe/resource.h> #include <qpe/version.h> #include <qfile.h> #include <qimage.h> #include <qlabel.h> #include <qlayout.h> #include <qpixmap.h> #include <qpainter.h> #include <qtextstream.h> #include <qtimer.h> #include <qwhatsthis.h> #include "versioninfo.h" #include <opie/odevice.h> using namespace Opie; VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) : QWidget( parent, name, f ) { setMinimumSize( 200, 150 ); QVBoxLayout *vb = new QVBoxLayout( this, 4 ); - + QString kernelVersionString; QFile file( "/proc/version" ); if ( file.open( IO_ReadOnly ) ) { QTextStream t( &file ); QString v; t >> v; t >> v; t >> v; v = v.left( 20 ); - kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ) + v + "<p>"; + kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ); + kernelVersionString.append( v ); + kernelVersionString.append( "<p>" ); t >> v; - kernelVersionString += tr( "Compiled by: " ) + v; + kernelVersionString.append( tr( "Compiled by: " ) ); + kernelVersionString.append( v ); file.close(); } - QString palmtopVersionString; - palmtopVersionString = tr( "<b>Opie</b><p>Version: " ) + QPE_VERSION + "<p>"; + QString palmtopVersionString = tr( "<b>Opie</b><p>Version: " ); + palmtopVersionString.append( QPE_VERSION ); + palmtopVersionString.append( "<p>" ); #ifdef QPE_VENDOR QString builder = QPE_VENDOR; #else QString builder = "Unknown"; -#endif - palmtopVersionString += tr( "Compiled by: " ) + builder + "<p>"; - palmtopVersionString += tr( "Built on: " ) + __DATE__; +#endif + palmtopVersionString.append( tr( "Compiled by: " ) ); + palmtopVersionString.append( builder ); + palmtopVersionString.append( "<p>" ); + palmtopVersionString.append( tr( "Built on: " ) ); + palmtopVersionString.append( __DATE__ ); + - QHBoxLayout *hb1 = new QHBoxLayout( vb ); hb1->setSpacing( 2 ); QLabel *palmtopLogo = new QLabel( this ); QImage logo1 = Resource::loadImage( "logo/opielogo" ); logo1 = logo1.smoothScale( 50, 55 ); QPixmap logo1Pixmap; logo1Pixmap.convertFromImage( logo1 ); palmtopLogo->setPixmap( logo1Pixmap ); palmtopLogo->setFixedSize( 60, 60 ); hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); QLabel *palmtopVersion = new QLabel( this ); palmtopVersion->setText( palmtopVersionString ); hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); QHBoxLayout *hb2 = new QHBoxLayout( vb ); hb1->setSpacing( 2 ); QLabel *linuxLogo = new QLabel( this ); QImage logo2 = Resource::loadImage( "logo/tux-logo" ); logo2 = logo2.smoothScale( 55, 60 ); QPixmap logo2Pixmap; logo2Pixmap.convertFromImage( logo2 ); linuxLogo->setPixmap( logo2Pixmap ); linuxLogo->setFixedSize( 60, 60 ); hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); - + QLabel *kernelVersion = new QLabel( this ); kernelVersion->setText( kernelVersionString ); hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); QHBoxLayout *hb3 = new QHBoxLayout( vb ); hb3->setSpacing( 2 ); QLabel *palmtopLogo3 = new QLabel( this ); QImage logo3 = Resource::loadImage( "SystemInfo" ); logo3 = logo3.smoothScale( 50, 55 ); QPixmap logo3Pixmap; logo3Pixmap.convertFromImage( logo3 ); palmtopLogo3->setPixmap( logo3Pixmap ); palmtopLogo3->setFixedSize( 60, 60 ); hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); -// QString systemString = tr( "<b>System</b><p>System: ") + ODevice::inst()->systemString() - QString systemString = "<b>"+ ODevice::inst()->systemString()+"</b>" - +tr("<p>Version: " ) + ODevice::inst()->systemVersionString() - +tr("<p>Model: ") + ODevice::inst()->modelString() - +tr("<p>Vendor: ") + ODevice::inst()->vendorString(); + QString systemString = "<b>"; + systemString.append( ODevice::inst()->systemString() ); + systemString.append( "</b>" ); + systemString.append( tr( "<p>Version: " ) ); + systemString.append( ODevice::inst()->systemVersionString() ); + systemString.append( tr( "<p>Model: " ) ); + systemString.append( ODevice::inst()->modelString() ); + systemString.append( tr( "<p>Vendor: " ) ); + systemString.append( ODevice::inst()->vendorString() ); QLabel *systemVersion = new QLabel( this ); systemVersion->setText( systemString ); hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) ); } VersionInfo::~VersionInfo() { } |