summaryrefslogtreecommitdiff
authordrw <drw>2002-03-09 21:58:30 (UTC)
committer drw <drw>2002-03-09 21:58:30 (UTC)
commita07cd819c6ce288e6b4426ce1668e57bb629c868 (patch) (unidiff)
treea4b7418180eb56f22529e0471bfce9cae6cbe833
parent80be7dabb1e1390e4d412c785d9f44e2293b2d5d (diff)
downloadopie-a07cd819c6ce288e6b4426ce1668e57bb629c868.zip
opie-a07cd819c6ce288e6b4426ce1668e57bb629c868.tar.gz
opie-a07cd819c6ce288e6b4426ce1668e57bb629c868.tar.bz2
drw: Code enhancements to reduce executable size.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/processdetail.cpp22
-rw-r--r--noncore/settings/sysinfo/processdetail.h6
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp41
-rw-r--r--noncore/settings/sysinfo/processinfo.h3
4 files changed, 32 insertions, 40 deletions
diff --git a/noncore/settings/sysinfo/processdetail.cpp b/noncore/settings/sysinfo/processdetail.cpp
index 06e5c0d..ef612e6 100644
--- a/noncore/settings/sysinfo/processdetail.cpp
+++ b/noncore/settings/sysinfo/processdetail.cpp
@@ -31,4 +31,4 @@
31 31
32ProcessDetail::ProcessDetail( QWidget* parent, const char* name, bool modal, WFlags fl ) 32ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags fl )
33 : QDialog( parent, name, modal, fl ) 33 : QWidget( parent, name, fl )
34{ 34{
@@ -37,9 +37,6 @@ ProcessDetail::ProcessDetail( QWidget* parent, const char* name, bool modal, WF
37 QGridLayout *layout = new QGridLayout( this ); 37 QGridLayout *layout = new QGridLayout( this );
38 layout->setSpacing( 6 ); 38 layout->setSpacing( 4 );
39 layout->setMargin( 11 ); 39 layout->setMargin( 4 );
40 40
41 SignalCB = new QComboBox( FALSE, this, "SignalCB" ); 41 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
42 SignalCB->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)7, SignalCB->sizePolicy().hasHeightForWidth() ) );
43 SignalCB->setMinimumSize( QSize( 50, 24 ) );
44 SignalCB->setMaximumSize( QSize( 600, 24 ) );
45 SignalCB->insertItem( " 1: SIGHUP" ); 42 SignalCB->insertItem( " 1: SIGHUP" );
@@ -53,3 +50,2 @@ ProcessDetail::ProcessDetail( QWidget* parent, const char* name, bool modal, WF
53 ProcessView = new QTextView( this, "ProcessView" ); 50 ProcessView = new QTextView( this, "ProcessView" );
54 ProcessView->setFrameShadow( QTextView::Plain );
55 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); 51 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
@@ -57,3 +53,2 @@ ProcessDetail::ProcessDetail( QWidget* parent, const char* name, bool modal, WF
57 SendButton = new QPushButton( this, "SendButton" ); 53 SendButton = new QPushButton( this, "SendButton" );
58 SendButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SendButton->sizePolicy().hasHeightForWidth() ) );
59 SendButton->setMinimumSize( QSize( 50, 24 ) ); 54 SendButton->setMinimumSize( QSize( 50, 24 ) );
@@ -75,5 +70,6 @@ void ProcessDetail::slotSendClicked()
75 70
76 if ( !QMessageBox::information( this, caption(), 71 if ( QMessageBox::warning( this, caption(),
77 ( tr( "You really want to send\n" + SignalCB->currentText() + "\nto this process?") ), 72 tr( "You really want to send\n" + SignalCB->currentText() + "\nto this process?"),
78 ( tr( "Yes" ) ), ( tr( "No" ) ), 0 ) ) 73 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
74 == QMessageBox::Yes )
79 { 75 {
@@ -81,3 +77,3 @@ void ProcessDetail::slotSendClicked()
81 { 77 {
82 accept(); 78 hide();
83 } 79 }
diff --git a/noncore/settings/sysinfo/processdetail.h b/noncore/settings/sysinfo/processdetail.h
index 5d418ac..22e196f 100644
--- a/noncore/settings/sysinfo/processdetail.h
+++ b/noncore/settings/sysinfo/processdetail.h
@@ -22,3 +22,3 @@
22 22
23#include <qdialog.h> 23#include <qwidget.h>
24#include <qcombo.h> 24#include <qcombo.h>
@@ -28,3 +28,3 @@
28 28
29class ProcessDetail : public QDialog 29class ProcessDetail : public QWidget
30{ 30{
@@ -33,3 +33,3 @@ class ProcessDetail : public QDialog
33public: 33public:
34 ProcessDetail( QWidget* parent, const char* name, bool modal, WFlags fl ); 34 ProcessDetail( QWidget* parent, const char* name, WFlags fl );
35 ~ProcessDetail(); 35 ~ProcessDetail();
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 225da63..ad81d7b 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -27,3 +27,2 @@
27#include "processinfo.h" 27#include "processinfo.h"
28#include "processdetail.h"
29 28
@@ -51,2 +50,5 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
51 updateData(); 50 updateData();
51
52 ProcessDtl = new ProcessDetail( 0, 0, 0 );
53 ProcessDtl->ProcessView->setTextFormat( RichText );
52} 54}
@@ -59,6 +61,2 @@ void ProcessInfo::updateData()
59{ 61{
60 QString processnum("");
61 QString processcmd("");
62 QString processstatus("");
63 QString processtime("");
64 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, 62 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
@@ -68,3 +66,3 @@ void ProcessInfo::updateData()
68 char state; 66 char state;
69 char comm[255]; 67 char comm[64];
70 68
@@ -72,5 +70,3 @@ void ProcessInfo::updateData()
72 70
73 QDir *procdir = new QDir("/proc"); 71 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs);
74 procdir->setFilter(QDir::Dirs);
75 procdir->setSorting(QDir::Name);
76 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); 72 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList()));
@@ -83,4 +79,4 @@ void ProcessInfo::updateData()
83 ++it; 79 ++it;
84 processnum = f->fileName(); 80 QString processnum = f->fileName();
85 if ( processnum >= "0" && processnum <= "99999" ) 81 if ( processnum >= "1" && processnum <= "99999" )
86 { 82 {
@@ -97,6 +93,5 @@ void ProcessInfo::updateData()
97 processnum = processnum.rightJustify( 5, ' ' ); 93 processnum = processnum.rightJustify( 5, ' ' );
98 processcmd = QString( comm ).replace( QRegExp( "(" ), "" ); 94 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" );
99 processcmd = processcmd.replace( QRegExp( ")" ), "" ); 95 QString processstatus = QChar(state);
100 processstatus = state; 96 QString processtime = QString::number( ( utime + stime ) / 100 );
101 processtime.setNum( ( utime + stime ) / 100 );
102 processtime = processtime.rightJustify( 9, ' ' ); 97 processtime = processtime.rightJustify( 9, ' ' );
@@ -116,8 +111,6 @@ void ProcessInfo::viewProcess(QListViewItem *process)
116{ 111{
117 QString pid= process->text(0).stripWhiteSpace(); 112 QString pid= process->text( 0 ).stripWhiteSpace();
118 QString command = process->text(1); 113 QString command = process->text( 1 );
119 ProcessDetail *processdtl = new ProcessDetail( this, 0, TRUE, 0); 114 ProcessDtl->setCaption( pid + " - " + command );
120 processdtl->setCaption( pid + " - " + command ); 115 ProcessDtl->pid = pid.toUInt();
121 processdtl->pid = pid.toUInt();
122 processdtl->ProcessView->setTextFormat( RichText );
123 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); 116 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
@@ -127,6 +120,6 @@ void ProcessInfo::viewProcess(QListViewItem *process)
127 fgets( line, 81, statfile ); 120 fgets( line, 81, statfile );
128 processdtl->ProcessView->setText( line ); 121 ProcessDtl->ProcessView->setText( line );
129 while ( fgets( line, 81, statfile ) ) 122 while ( fgets( line, 81, statfile ) )
130 { 123 {
131 processdtl->ProcessView->append( line ); 124 ProcessDtl->ProcessView->append( line );
132 } 125 }
@@ -135,3 +128,3 @@ void ProcessInfo::viewProcess(QListViewItem *process)
135 128
136 processdtl->showMaximized(); 129 ProcessDtl->showMaximized();
137} 130}
diff --git a/noncore/settings/sysinfo/processinfo.h b/noncore/settings/sysinfo/processinfo.h
index e5bacca..89d1a93 100644
--- a/noncore/settings/sysinfo/processinfo.h
+++ b/noncore/settings/sysinfo/processinfo.h
@@ -25,2 +25,4 @@
25 25
26#include "processdetail.h"
27
26class ProcessInfo : public QWidget 28class ProcessInfo : public QWidget
@@ -38,2 +40,3 @@ private:
38 QListView* ProcessView; 40 QListView* ProcessView;
41 ProcessDetail *ProcessDtl;
39}; 42};