1/*
2* kdfwidget.h
3*
4* Copyright (c) 1998 Michael Kropfberger <michael.kropfberger@gmx.net>
5* 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com>
6
7* This program is free software; you can redistribute it and/or modify
8* it under the terms of the GNU General Public License as published by
9* the Free Software Foundation; either version 2 of the License, or
10* (at your option) any later version.
11*
12* This program is distributed in the hope that it will be useful,
13* but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15* GNU General Public License for more details.
16*
17* You should have received a copy of the GNU General Public License
18* along with this program; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KDFWIDGET_H
23#define KDFWIDGET_H
24
25#include "disks.h"
26#include "disklist.h"
27#include "mntconfig.h"
28#include "kdfconfig.h"
29#include "stdoption.h"
30
31#include "kdfitemdelegate.h"
32#include "kdfsortproxymodel.h"
33
34class QTreeView;
35//class QTreeWidgetItem;
36class QTimer;
37class COptionDialog;
38class KMenu;
39
40class QStandardItemModel;
41
42/* Column class (id, column number, column name) */
43class Column
44{
45 public:
46
47 Column(const QString& _name, const QString& _columnName, int _defaultWidth, int _number)
48 {
49 name = _name;
50 columnName = _columnName;
51 defaultWidth = _defaultWidth;
52 number = _number;
53 }
54
55 QString name;
56 QString columnName;
57 int defaultWidth;
58 int number;
59
60};
61
62class KDFWidget : public QWidget
63{
64 Q_OBJECT
65
66 public:
67 explicit KDFWidget( QWidget *parent=0, bool init=false);
68 ~KDFWidget( );
69
70 enum ColumnNumber{
71 IconCol = 0,
72 DeviceCol = 1,
73 TypeCol = 2,
74 SizeCol = 3,
75 MountPointCol = 4,
76 FreeCol = 5,
77 FullCol = 6,
78 UsageBarCol = 7
79 };
80
81 public Q_SLOTS:
82 void settingsChanged( void );
83 void loadSettings( void );
84 void applySettings( void );
85 void updateDF( void );
86 void updateDFDone( void );
87 void settingsBtnClicked( void );
88
89 private Q_SLOTS:
90 void criticallyFull( DiskEntry *disk );
91 void contextMenuRequested ( const QPoint &p );
92 void setUpdateFrequency( int frequency );
93 void invokeHelp( void );
94
95 protected:
96 void timerEvent( QTimerEvent * );
97 void closeEvent( QCloseEvent * );
98
99 private:
100 void makeColumns( void );
101 DiskEntry *selectedDisk( QModelIndex index );
102 QIcon generateIcon( QString iconName , bool mode, bool mounted);
103
104 bool readingDF;
105 COptionDialog *mOptionDialog;
106 KMenu *mPopup;
107 QTimer *mTimer;
108 DiskList mDiskList;
109 bool mIsTopLevel;
110 CStdOption mStd;
111
112 QTreeView * m_listWidget;
113 KDFItemDelegate * m_itemDelegate;
114 QList<Column> m_columnList;
115
116 QStandardItemModel * m_listModel;
117 KDFSortFilterProxyModel * m_sortModel;
118};
119
120#endif
121
122