author | drw <drw> | 2002-12-16 01:55:56 (UTC) |
---|---|---|
committer | drw <drw> | 2002-12-16 01:55:56 (UTC) |
commit | 64bc40080abc56e6bd804dadb44d2510f25f2efa (patch) (unidiff) | |
tree | 20d1840b63dc76608aee6f80bf011811d392fbac /noncore/settings/sysinfo/storage.cpp | |
parent | e4057ee7fe74c83e2dc44f8b9870f65da60fc4fa (diff) | |
download | opie-64bc40080abc56e6bd804dadb44d2510f25f2efa.zip opie-64bc40080abc56e6bd804dadb44d2510f25f2efa.tar.gz opie-64bc40080abc56e6bd804dadb44d2510f25f2efa.tar.bz2 |
1. Added RAM disk to storage tab (could someone verify works on Z?) 2. QScrollView for storage tab 3. Removed module detail dialog since it did not provide any useful information 4. Fix compiler warnings 5. Removed unneeded qDebugs
Diffstat (limited to 'noncore/settings/sysinfo/storage.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/sysinfo/storage.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
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 | |||
@@ -17,12 +17,13 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // additions copyright 2002 by L.J. Potter | 20 | // additions copyright 2002 by L.J. Potter |
21 | #include <qlabel.h> | 21 | #include <qlabel.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qscrollview.h> | ||
23 | #include <qtimer.h> | 24 | #include <qtimer.h> |
24 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
25 | 26 | ||
26 | #include "graph.h" | 27 | #include "graph.h" |
27 | #include "storage.h" | 28 | #include "storage.h" |
28 | 29 | ||
@@ -32,13 +33,21 @@ | |||
32 | #include <mntent.h> | 33 | #include <mntent.h> |
33 | #endif | 34 | #endif |
34 | 35 | ||
35 | StorageInfo::StorageInfo( QWidget *parent, const char *name ) | 36 | StorageInfo::StorageInfo( QWidget *parent, const char *name ) |
36 | : QWidget( parent, name ) | 37 | : QWidget( parent, name ) |
37 | { | 38 | { |
38 | vb = 0; | 39 | QVBoxLayout *tmpvb = new QVBoxLayout( this ); |
40 | QScrollView *sv = new QScrollView( this ); | ||
41 | tmpvb->addWidget( sv, 0, 0 ); | ||
42 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
43 | sv->setFrameStyle( QFrame::NoFrame ); | ||
44 | container = new QWidget( sv->viewport() ); | ||
45 | sv->addChild( container ); | ||
46 | vb = 0x0; | ||
47 | |||
39 | disks.setAutoDelete(TRUE); | 48 | disks.setAutoDelete(TRUE); |
40 | lines.setAutoDelete(TRUE); | 49 | lines.setAutoDelete(TRUE); |
41 | updateMounts(); | 50 | updateMounts(); |
42 | startTimer( 5000 ); | 51 | startTimer( 5000 ); |
43 | } | 52 | } |
44 | 53 | ||
@@ -81,16 +90,15 @@ void StorageInfo::updateMounts() | |||
81 | QStringList fsT; | 90 | QStringList fsT; |
82 | bool rebuild = FALSE; | 91 | bool rebuild = FALSE; |
83 | int n=0; | 92 | int n=0; |
84 | if ( mntfp ) { | 93 | if ( mntfp ) { |
85 | while ( (me = getmntent( mntfp )) != 0 ) { | 94 | while ( (me = getmntent( mntfp )) != 0 ) { |
86 | QString fs = me->mnt_fsname; | 95 | QString fs = me->mnt_fsname; |
87 | qDebug(fs+" "+(QString)me->mnt_type); | ||
88 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" | 96 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" |
89 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" | 97 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" |
90 | || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs") { | 98 | || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs" || fs.left(5) == "tmpfs" ) { |
91 | n++; | 99 | n++; |
92 | curdisks.append(fs); | 100 | curdisks.append(fs); |
93 | QString d = me->mnt_dir; | 101 | QString d = me->mnt_dir; |
94 | curfs.append(d); | 102 | curfs.append(d); |
95 | QString mount = me->mnt_dir; | 103 | QString mount = me->mnt_dir; |
96 | mountList.append(mount); | 104 | mountList.append(mount); |
@@ -103,29 +111,28 @@ void StorageInfo::updateMounts() | |||
103 | endmntent( mntfp ); | 111 | endmntent( mntfp ); |
104 | } | 112 | } |
105 | if ( rebuild || n != (int)disks.count() ) { | 113 | if ( rebuild || n != (int)disks.count() ) { |
106 | disks.clear(); | 114 | disks.clear(); |
107 | lines.clear(); | 115 | lines.clear(); |
108 | delete vb; | 116 | delete vb; |
109 | vb = new QVBoxLayout( this, n > 3 ? 1 : 5 ); | 117 | vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ ); |
110 | bool frst=TRUE; | 118 | bool frst=TRUE; |
111 | QStringList::ConstIterator it=curdisks.begin(); | 119 | QStringList::ConstIterator it=curdisks.begin(); |
112 | QStringList::ConstIterator fsit=curfs.begin(); | 120 | QStringList::ConstIterator fsit=curfs.begin(); |
113 | QStringList::ConstIterator fsmount=mountList.begin(); | 121 | QStringList::ConstIterator fsmount=mountList.begin(); |
114 | QStringList::ConstIterator fsTit=fsT.begin(); | 122 | QStringList::ConstIterator fsTit=fsT.begin(); |
115 | 123 | ||
116 | for (; it!=curdisks.end(); ++it, ++fsit) { | 124 | for (; it!=curdisks.end(); ++it, ++fsit) { |
117 | if ( !frst ) { | 125 | if ( !frst ) { |
118 | QFrame *f = new QFrame( this ); | 126 | QFrame *f = new QFrame( container ); |
119 | vb->addWidget(f); | 127 | vb->addWidget(f); |
120 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 128 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
121 | lines.append(f); | 129 | lines.append(f); |
122 | f->show(); | 130 | f->show(); |
123 | } frst=FALSE; | 131 | } frst=FALSE; |
124 | QString humanname=*it; | 132 | QString humanname=*it; |
125 | // qDebug(humanname); | ||
126 | if ( isCF(humanname) ) | 133 | if ( isCF(humanname) ) |
127 | humanname = tr( "CF Card: " ); | 134 | humanname = tr( "CF Card: " ); |
128 | else if ( humanname == "/dev/hda1" ) | 135 | else if ( humanname == "/dev/hda1" ) |
129 | humanname = tr( "Hard Disk " ); | 136 | humanname = tr( "Hard Disk " ); |
130 | else if ( humanname.left(9) == "/dev/mmcd" ) | 137 | else if ( humanname.left(9) == "/dev/mmcd" ) |
131 | humanname = tr( "SD Card " ); | 138 | humanname = tr( "SD Card " ); |
@@ -138,19 +145,21 @@ void StorageInfo::updateMounts() | |||
138 | else if ( humanname.left(14) == "/dev/mtdblock/" ) | 145 | else if ( humanname.left(14) == "/dev/mtdblock/" ) |
139 | humanname = tr( "Int. Storage /dev/mtdblock/ " ); | 146 | humanname = tr( "Int. Storage /dev/mtdblock/ " ); |
140 | else if ( humanname.left(13) == "/dev/mtdblock" ) | 147 | else if ( humanname.left(13) == "/dev/mtdblock" ) |
141 | humanname = tr( "Int. Storage /dev/mtdblock " ); | 148 | humanname = tr( "Int. Storage /dev/mtdblock " ); |
142 | else if ( humanname.left(9) == "/dev/root" ) | 149 | else if ( humanname.left(9) == "/dev/root" ) |
143 | humanname = tr( "Int. Storage " ); | 150 | humanname = tr( "Int. Storage " ); |
151 | else if ( humanname.left(5) == "tmpfs" ) | ||
152 | humanname = tr( "RAM disk" ); | ||
144 | // etc. | 153 | // etc. |
145 | humanname.append( *fsmount ); | 154 | humanname.append( *fsmount ); |
146 | humanname.append( " " ); | 155 | humanname.append( " " ); |
147 | humanname.append( *fsTit ); | 156 | humanname.append( *fsTit ); |
148 | humanname.append( " " ); | 157 | humanname.append( " " ); |
149 | 158 | ||
150 | MountInfo* mi = new MountInfo( *fsit, humanname, this ); | 159 | MountInfo* mi = new MountInfo( *fsit, humanname, container ); |
151 | vb->addWidget(mi); | 160 | vb->addWidget(mi); |
152 | disks.insert(*fsit,mi); | 161 | disks.insert(*fsit,mi); |
153 | mi->show(); | 162 | mi->show(); |
154 | fsmount++;fsTit++; | 163 | fsmount++;fsTit++; |
155 | QString tempstr = humanname.left( 2 ); | 164 | QString tempstr = humanname.left( 2 ); |
156 | if ( tempstr == tr( "CF" ) ) | 165 | if ( tempstr == tr( "CF" ) ) |
@@ -160,12 +169,14 @@ void StorageInfo::updateMounts() | |||
160 | else if ( tempstr == tr( "SD" ) ) | 169 | else if ( tempstr == tr( "SD" ) ) |
161 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); | 170 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); |
162 | else if ( tempstr == tr( "SC" ) ) | 171 | else if ( tempstr == tr( "SC" ) ) |
163 | QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); | 172 | QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); |
164 | else if ( tempstr == tr( "In" ) ) | 173 | else if ( tempstr == tr( "In" ) ) |
165 | 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." ) ); | 174 | 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." ) ); |
175 | else if ( tempstr == tr( "RA" ) ) | ||
176 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) ); | ||
166 | } | 177 | } |
167 | vb->addStretch(); | 178 | vb->addStretch(); |
168 | } else { | 179 | } else { |
169 | // just update them | 180 | // just update them |
170 | for (QDictIterator<MountInfo> i(disks); i.current(); ++i) | 181 | for (QDictIterator<MountInfo> i(disks); i.current(); ++i) |
171 | i.current()->updateData(); | 182 | i.current()->updateData(); |
@@ -174,13 +185,12 @@ void StorageInfo::updateMounts() | |||
174 | } | 185 | } |
175 | 186 | ||
176 | 187 | ||
177 | MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, const char *name ) | 188 | MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, const char *name ) |
178 | : QWidget( parent, name ), title(ttl) | 189 | : QWidget( parent, name ), title(ttl) |
179 | { | 190 | { |
180 | qDebug("new path is "+path); | ||
181 | fs = new FileSystem( path ); | 191 | fs = new FileSystem( path ); |
182 | QVBoxLayout *vb = new QVBoxLayout( this, 3 ); | 192 | QVBoxLayout *vb = new QVBoxLayout( this, 3 ); |
183 | 193 | ||
184 | totalSize = new QLabel( this ); | 194 | totalSize = new QLabel( this ); |
185 | vb->addWidget( totalSize ); | 195 | vb->addWidget( totalSize ); |
186 | 196 | ||