kdf
kdfwidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KDFWIDGET_H
00025 #define KDFWIDGET_H
00026
00027 #include <QtCore/QVector>
00028 #include <QtCore/qglobal.h>
00029
00030 #include <Qt3Support/Q3ListView>
00031
00032 #include "disks.h"
00033 #include "disklist.h"
00034 #include "mntconfig.h"
00035 #include "kdfconfig.h"
00036 #include "stdoption.h"
00037
00038 class CListView;
00039 class COptionDialog;
00040 class QTimer;
00041 class KMenu;
00042
00043
00044
00045 class CTabEntry
00046 {
00047 public:
00048 CTabEntry( const QString &res, const QString &name, bool visible,
00049 uint width )
00050 {
00051 mRes = res;
00052 mName = name;
00053 mVisible = visible;
00054 mWidth = width;
00055 }
00056 CTabEntry( void ) { }
00057 ~CTabEntry( void ) { }
00058
00059
00060 QString mRes;
00061 QString mName;
00062 bool mVisible;
00063 uint mWidth;
00064 };
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 class CListViewItem : public Q3ListViewItem
00075 {
00076 public:
00077 CListViewItem ( CListView * parent, Q3ListViewItem * after );
00078
00079 virtual int compare ( Q3ListViewItem* i, int col, bool) const;
00080
00081 void setKeys ( int kb_size, int kb_avail, float percent_full ) ;
00082
00083 private:
00084 int size;
00085 int avail;
00086 float full;
00087 };
00088
00089
00090
00091 class KDFWidget : public QWidget
00092 {
00093 Q_OBJECT
00094
00095 public:
00096 enum ColId
00097 {
00098 iconCol = 0,
00099 deviceCol = 1,
00100 typeCol = 2,
00101 sizeCol = 3,
00102 mntCol = 4,
00103 freeCol = 5,
00104 fullCol = 6,
00105 usageCol = 7
00106 };
00107
00108 public:
00109 explicit KDFWidget( QWidget *parent=0, bool init=false);
00110 ~KDFWidget( );
00111
00112 public slots:
00113 void settingsChanged( void );
00114 void loadSettings( void );
00115 void applySettings( void );
00116 void updateDF( void );
00117 void updateDFDone( void );
00118 void settingsBtnClicked( void );
00119
00120 private slots:
00121 void criticallyFull( DiskEntry *disk );
00122 void rightButtonPressed( Q3ListViewItem *item, const QPoint &p, int );
00123 void popupMenu( Q3ListViewItem *item, const QPoint &p );
00124 void setUpdateFrequency( int frequency );
00125 void columnSizeChanged( int column, int, int newSize );
00126 void updateDiskBarPixmaps( void );
00127 void invokeHelp( void );
00128
00129 protected:
00130 void timerEvent( QTimerEvent * );
00131 void closeEvent( QCloseEvent * );
00132 void resizeEvent( QResizeEvent * );
00133
00134 private:
00135 void makeColumns( void );
00136 DiskEntry *selectedDisk( Q3ListViewItem *item=0 );
00137
00138 private:
00139 bool readingDF;
00140 QVector<CTabEntry*> mTabProp;
00141 CListView *mList;
00142 COptionDialog *mOptionDialog;
00143 KMenu *mPopup;
00144 QTimer *mTimer;
00145 DiskList mDiskList;
00146 bool mIsTopLevel;
00147 CStdOption mStd;
00148 };
00149
00150 #endif