summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/storage.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/sysinfo/storage.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/storage.cpp27
1 files changed, 9 insertions, 18 deletions
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
@@ -47,63 +47,55 @@ FileSysInfo::FileSysInfo( QWidget *parent, const char *name )
container = new QWidget( sv->viewport() );
sv->addChild( container );
vb = 0x0;
storage = new StorageInfo( this );
connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) );
-
+
lines.setAutoDelete(TRUE);
rebuildDisks = TRUE;
updateMounts();
startTimer( 5000 );
}
+
void FileSysInfo::timerEvent(QTimerEvent*)
{
updateMounts();
}
void FileSysInfo::updateMounts()
{
storage->update();
-
+
if ( rebuildDisks )
{
- // Cannot auto delete QDict<MountInfo> disks because it seems to delete
- // the filesystem object as well causing a segfault
- MountInfo *mi;
- for ( QDictIterator<MountInfo> delit(disks); delit.current(); ++delit )
- {
- mi = delit.current();
- mi->fs = 0x0;
- delete mi;
- }
disks.clear();
lines.clear();
-
+
delete vb;
vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ );
bool frst=TRUE;
-
+
FileSystem *fs;
for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it )
{
fs = it.current();
-
+
if ( !frst )
{
QFrame *f = new QFrame( container );
vb->addWidget(f);
f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
lines.append(f);
f->show();
}
frst = FALSE;
-
+
MountInfo *mi = new MountInfo( fs, container );
vb->addWidget( mi );
disks.insert( fs->path(), mi );
mi->show();
QString tempstr = fs->name().left( 2 );
if ( tempstr == tr( "CF" ) )
@@ -123,13 +115,13 @@ void FileSysInfo::updateMounts()
}
else
{
for (QDictIterator<MountInfo> i(disks); i.current(); ++i)
i.current()->updateData();
}
-
+
rebuildDisks = FALSE;
}
void FileSysInfo::disksChanged()
{
rebuildDisks = TRUE;
@@ -142,13 +134,13 @@ MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name )
totalSize = new QLabel( this );
vb->addWidget( totalSize );
fs = filesys;
title = fs->name();
-
+
data = new GraphData();
graph = new BarGraph( this );
graph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
vb->addWidget( graph, 1 );
graph->setData( data );
@@ -160,13 +152,12 @@ MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name )
updateData();
}
MountInfo::~MountInfo()
{
delete data;
- delete fs;
}
void MountInfo::updateData()
{
long mult = fs->blockSize() / 1024;
long div = 1024 / fs->blockSize();