author | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
commit | 951d1d4125a80dc814f95d2956853bf53ca52e9a (patch) (unidiff) | |
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 @@ | |||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "sysinfo.h" | 21 | #include "sysinfo.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main( int argc, char *argv[] ) | ||
26 | { | ||
27 | QPEApplication a( argc, argv ); | ||
28 | |||
29 | SystemInfo *si = new SystemInfo(); | ||
30 | a.showMainWidget( si ); | ||
31 | |||
32 | return a.exec(); | ||
33 | } | ||
34 | 26 | ||
27 | 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 @@ | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | FileSysInfo::FileSysInfo( QWidget *parent, const char *name ) | 39 | FileSysInfo::FileSysInfo( QWidget *parent, const char *name ) |
40 | : QWidget( parent, name ) | 40 | : QWidget( parent, name ) |
41 | { | 41 | { |
42 | QVBoxLayout *tmpvb = new QVBoxLayout( this ); | 42 | QVBoxLayout *tmpvb = new QVBoxLayout( this ); |
43 | QScrollView *sv = new QScrollView( this ); | 43 | QScrollView *sv = new QScrollView( this ); |
44 | tmpvb->addWidget( sv, 0, 0 ); | 44 | tmpvb->addWidget( sv, 0, 0 ); |
45 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 45 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
46 | sv->setFrameStyle( QFrame::NoFrame ); | 46 | sv->setFrameStyle( QFrame::NoFrame ); |
47 | container = new QWidget( sv->viewport() ); | 47 | container = new QWidget( sv->viewport() ); |
48 | sv->addChild( container ); | 48 | sv->addChild( container ); |
49 | vb = 0x0; | 49 | vb = 0x0; |
50 | 50 | ||
51 | storage = new StorageInfo( this ); | 51 | storage = new StorageInfo( this ); |
52 | connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) ); | 52 | connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) ); |
53 | 53 | ||
54 | lines.setAutoDelete(TRUE); | 54 | lines.setAutoDelete(TRUE); |
55 | 55 | ||
56 | rebuildDisks = TRUE; | 56 | rebuildDisks = TRUE; |
57 | updateMounts(); | 57 | updateMounts(); |
58 | startTimer( 5000 ); | 58 | startTimer( 5000 ); |
59 | } | 59 | } |
60 | 60 | ||
61 | |||
61 | void FileSysInfo::timerEvent(QTimerEvent*) | 62 | void FileSysInfo::timerEvent(QTimerEvent*) |
62 | { | 63 | { |
63 | updateMounts(); | 64 | updateMounts(); |
64 | } | 65 | } |
65 | 66 | ||
66 | void FileSysInfo::updateMounts() | 67 | void FileSysInfo::updateMounts() |
67 | { | 68 | { |
68 | storage->update(); | 69 | storage->update(); |
69 | 70 | ||
70 | if ( rebuildDisks ) | 71 | if ( rebuildDisks ) |
71 | { | 72 | { |
72 | // Cannot auto delete QDict<MountInfo> disks because it seems to delete | ||
73 | // the filesystem object as well causing a segfault | ||
74 | MountInfo *mi; | ||
75 | for ( QDictIterator<MountInfo> delit(disks); delit.current(); ++delit ) | ||
76 | { | ||
77 | mi = delit.current(); | ||
78 | mi->fs = 0x0; | ||
79 | delete mi; | ||
80 | } | ||
81 | disks.clear(); | 73 | disks.clear(); |
82 | lines.clear(); | 74 | lines.clear(); |
83 | 75 | ||
84 | delete vb; | 76 | delete vb; |
85 | vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ ); | 77 | vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ ); |
86 | 78 | ||
87 | bool frst=TRUE; | 79 | bool frst=TRUE; |
88 | 80 | ||
89 | FileSystem *fs; | 81 | FileSystem *fs; |
90 | for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it ) | 82 | for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it ) |
91 | { | 83 | { |
92 | fs = it.current(); | 84 | fs = it.current(); |
93 | 85 | ||
94 | if ( !frst ) | 86 | if ( !frst ) |
95 | { | 87 | { |
96 | QFrame *f = new QFrame( container ); | 88 | QFrame *f = new QFrame( container ); |
97 | vb->addWidget(f); | 89 | vb->addWidget(f); |
98 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 90 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
99 | lines.append(f); | 91 | lines.append(f); |
100 | f->show(); | 92 | f->show(); |
101 | } | 93 | } |
102 | frst = FALSE; | 94 | frst = FALSE; |
103 | 95 | ||
104 | MountInfo *mi = new MountInfo( fs, container ); | 96 | MountInfo *mi = new MountInfo( fs, container ); |
105 | vb->addWidget( mi ); | 97 | vb->addWidget( mi ); |
106 | disks.insert( fs->path(), mi ); | 98 | disks.insert( fs->path(), mi ); |
107 | mi->show(); | 99 | mi->show(); |
108 | QString tempstr = fs->name().left( 2 ); | 100 | QString tempstr = fs->name().left( 2 ); |
109 | if ( tempstr == tr( "CF" ) ) | 101 | if ( tempstr == tr( "CF" ) ) |
110 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) ); | 102 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) ); |
111 | else if ( tempstr == tr( "Ha" ) ) | 103 | else if ( tempstr == tr( "Ha" ) ) |
112 | QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); | 104 | QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); |
113 | else if ( tempstr == tr( "SD" ) ) | 105 | else if ( tempstr == tr( "SD" ) ) |
114 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); | 106 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); |
115 | else if ( tempstr == tr( "SC" ) ) | 107 | else if ( tempstr == tr( "SC" ) ) |
116 | QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); | 108 | QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); |
117 | else if ( tempstr == tr( "In" ) ) | 109 | else if ( tempstr == tr( "In" ) ) |
118 | 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." ) ); | 110 | 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." ) ); |
119 | else if ( tempstr == tr( "RA" ) ) | 111 | else if ( tempstr == tr( "RA" ) ) |
120 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) ); | 112 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) ); |
121 | } | 113 | } |
122 | vb->addStretch(); | 114 | vb->addStretch(); |
123 | } | 115 | } |
124 | else | 116 | else |
125 | { | 117 | { |
126 | for (QDictIterator<MountInfo> i(disks); i.current(); ++i) | 118 | for (QDictIterator<MountInfo> i(disks); i.current(); ++i) |
127 | i.current()->updateData(); | 119 | i.current()->updateData(); |
128 | } | 120 | } |
129 | 121 | ||
130 | rebuildDisks = FALSE; | 122 | rebuildDisks = FALSE; |
131 | } | 123 | } |
132 | 124 | ||
133 | void FileSysInfo::disksChanged() | 125 | void FileSysInfo::disksChanged() |
134 | { | 126 | { |
135 | rebuildDisks = TRUE; | 127 | rebuildDisks = TRUE; |
136 | } | 128 | } |
137 | 129 | ||
138 | MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name ) | 130 | MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name ) |
139 | : QWidget( parent, name ) | 131 | : QWidget( parent, name ) |
140 | { | 132 | { |
141 | QVBoxLayout *vb = new QVBoxLayout( this, 3 ); | 133 | QVBoxLayout *vb = new QVBoxLayout( this, 3 ); |
142 | 134 | ||
143 | totalSize = new QLabel( this ); | 135 | totalSize = new QLabel( this ); |
144 | vb->addWidget( totalSize ); | 136 | vb->addWidget( totalSize ); |
145 | 137 | ||
146 | fs = filesys; | 138 | fs = filesys; |
147 | title = fs->name(); | 139 | title = fs->name(); |
148 | 140 | ||
149 | data = new GraphData(); | 141 | data = new GraphData(); |
150 | graph = new BarGraph( this ); | 142 | graph = new BarGraph( this ); |
151 | graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 143 | graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
152 | vb->addWidget( graph, 1 ); | 144 | vb->addWidget( graph, 1 ); |
153 | graph->setData( data ); | 145 | graph->setData( data ); |
154 | 146 | ||
155 | legend = new GraphLegend( this ); | 147 | legend = new GraphLegend( this ); |
156 | legend->setOrientation(Horizontal); | 148 | legend->setOrientation(Horizontal); |
157 | vb->addWidget( legend ); | 149 | vb->addWidget( legend ); |
158 | legend->setData( data ); | 150 | legend->setData( data ); |
159 | 151 | ||
160 | updateData(); | 152 | updateData(); |
161 | } | 153 | } |
162 | 154 | ||
163 | MountInfo::~MountInfo() | 155 | MountInfo::~MountInfo() |
164 | { | 156 | { |
165 | delete data; | 157 | delete data; |
166 | delete fs; | ||
167 | } | 158 | } |
168 | 159 | ||
169 | void MountInfo::updateData() | 160 | void MountInfo::updateData() |
170 | { | 161 | { |
171 | long mult = fs->blockSize() / 1024; | 162 | long mult = fs->blockSize() / 1024; |
172 | long div = 1024 / fs->blockSize(); | 163 | long div = 1024 / fs->blockSize(); |
173 | if ( !mult ) mult = 1; | 164 | if ( !mult ) mult = 1; |
174 | if ( !div ) div = 1; | 165 | if ( !div ) div = 1; |
175 | long total = fs->totalBlocks() * mult / div; | 166 | long total = fs->totalBlocks() * mult / div; |
176 | long avail = fs->availBlocks() * mult / div; | 167 | long avail = fs->availBlocks() * mult / div; |
177 | long used = total - avail; | 168 | long used = total - avail; |
178 | totalSize->setText( title + tr(" : %1 kB").arg( total ) ); | 169 | totalSize->setText( title + tr(" : %1 kB").arg( total ) ); |
179 | data->clear(); | 170 | data->clear(); |
180 | data->addItem( tr("Used (%1 kB)").arg(used), used ); | 171 | data->addItem( tr("Used (%1 kB)").arg(used), used ); |
181 | data->addItem( tr("Available (%1 kB)").arg(avail), avail ); | 172 | data->addItem( tr("Available (%1 kB)").arg(avail), avail ); |
182 | graph->repaint( FALSE ); | 173 | 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 @@ | |||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | ********************************************************************** | 19 | ********************************************************************** |
20 | ** | 20 | ** |
21 | ** Enhancements by: Dan Williams, <williamsdr@acm.org> | 21 | ** Enhancements by: Dan Williams, <williamsdr@acm.org> |
22 | ** | 22 | ** |
23 | **********************************************************************/ | 23 | **********************************************************************/ |
24 | 24 | ||
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
26 | 26 | ||
27 | class SystemInfo : public QWidget | 27 | class SystemInfo : public QWidget |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | SystemInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 31 | SystemInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
32 | static QString appName() { return QString::fromLatin1("sysinfo"); } | ||
32 | }; | 33 | }; |
33 | 34 | ||
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 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = memory.h \ | 2 | HEADERS = memory.h \ |
5 | graph.h \ | 3 | graph.h \ |
6 | load.h \ | 4 | load.h \ |
7 | storage.h \ | 5 | storage.h \ |
8 | processinfo.h \ | 6 | processinfo.h \ |
9 | modulesinfo.h \ | 7 | modulesinfo.h \ |
10 | detail.h \ | 8 | detail.h \ |
11 | versioninfo.h \ | 9 | versioninfo.h \ |
12 | sysinfo.h | 10 | sysinfo.h |
13 | SOURCES = main.cpp \ | 11 | SOURCES = main.cpp \ |
14 | memory.cpp \ | 12 | memory.cpp \ |
15 | graph.cpp \ | 13 | graph.cpp \ |
16 | load.cpp \ | 14 | load.cpp \ |
17 | storage.cpp \ | 15 | storage.cpp \ |
18 | processinfo.cpp \ | 16 | processinfo.cpp \ |
19 | modulesinfo.cpp \ | 17 | modulesinfo.cpp \ |
20 | detail.cpp \ | 18 | detail.cpp \ |
21 | versioninfo.cpp \ | 19 | versioninfo.cpp \ |
22 | sysinfo.cpp | 20 | sysinfo.cpp |
23 | INTERFACES = | 21 | |
24 | INCLUDEPATH += $(OPIEDIR)/include | 22 | INCLUDEPATH += $(OPIEDIR)/include |
25 | DEPENDPATH += $(OPIEDIR)/include | 23 | DEPENDPATH += $(OPIEDIR)/include |
26 | LIBS += -lqpe -lopie | 24 | LIBS += -lqpe -lopie |
27 | TARGET = sysinfo | 25 | |
26 | TARGET= sysinfo | ||
28 | 27 | ||
29 | TRANSLATIONS = ../../../i18n/de/sysinfo.ts \ | 28 | TRANSLATIONS = ../../../i18n/de/sysinfo.ts \ |
30 | ../../../i18n/nl/sysinfo.ts \ | 29 | ../../../i18n/nl/sysinfo.ts \ |
31 | ../../../i18n/xx/sysinfo.ts \ | 30 | ../../../i18n/xx/sysinfo.ts \ |
32 | ../../../i18n/en/sysinfo.ts \ | 31 | ../../../i18n/en/sysinfo.ts \ |
33 | ../../../i18n/es/sysinfo.ts \ | 32 | ../../../i18n/es/sysinfo.ts \ |
34 | ../../../i18n/fr/sysinfo.ts \ | 33 | ../../../i18n/fr/sysinfo.ts \ |
35 | ../../../i18n/hu/sysinfo.ts \ | 34 | ../../../i18n/hu/sysinfo.ts \ |
36 | ../../../i18n/ja/sysinfo.ts \ | 35 | ../../../i18n/ja/sysinfo.ts \ |
37 | ../../../i18n/ko/sysinfo.ts \ | 36 | ../../../i18n/ko/sysinfo.ts \ |
38 | ../../../i18n/no/sysinfo.ts \ | 37 | ../../../i18n/no/sysinfo.ts \ |
39 | ../../../i18n/pl/sysinfo.ts \ | 38 | ../../../i18n/pl/sysinfo.ts \ |
40 | ../../../i18n/pt/sysinfo.ts \ | 39 | ../../../i18n/pt/sysinfo.ts \ |
41 | ../../../i18n/pt_BR/sysinfo.ts \ | 40 | ../../../i18n/pt_BR/sysinfo.ts \ |
42 | ../../../i18n/sl/sysinfo.ts \ | 41 | ../../../i18n/sl/sysinfo.ts \ |
43 | ../../../i18n/zh_CN/sysinfo.ts \ | 42 | ../../../i18n/zh_CN/sysinfo.ts \ |