blob: 9e3e666d7a20f216c2c536239b256e3a034c595e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later version.
*/
#ifndef ARCHIVEVIEW_H
#define ARCHIVEVIEW_H
#include <QDialog>
#include <QRegExp>
#include <QSortFilterProxyModel>
#include <QWidget>
#include "archivemodel.h"
#include "smtreeview.h"
class QComboBox;
class QLabel;
class QLineEdit;
class QSortFilterProxyModel;
class ArchiveTree;
class ArchiveFiles;
class ArchiveProxy;
class ArchiveProgressDialog;
class ArchiveView : public QWidget {
Q_OBJECT
public:
explicit ArchiveView(QWidget *parent = 0);
int currentSortOrder() const;
void writeSettings();
// this is needed for displaying the progress dialog in the
// center of the main window...
void setConstructingDone() { mConstructing = false; }
ArchiveModel *archiveModel() { return mArchiveModel; }
ArchiveTree *archiveTree() { return mTree; }
QWidget *progressDialog();
public slots:
void refreshArchive();
void setExpanded();
private slots:
void setFilter();
void clearFilter();
void collectorStarted();
void collectorFinished();
void showDatabaseError(const QString &errorMsg);
void expandItem(const QModelIndex &idx);
void collapseItem(const QModelIndex &idx);
private:
QComboBox *mSortOrder;
QLineEdit *mFilter;
ArchiveTree *mTree;
ArchiveFiles *mFiles;
ArchiveModel *mArchiveModel;
ArchiveProxy *mProxy;
ArchiveProgressDialog *mProgress;
QList<QPersistentModelIndex> mExpandedItems;
bool mConstructing;
};
class ArchiveTree : public SmTreeView {
Q_OBJECT
public:
explicit ArchiveTree(QWidget *parent = 0);
virtual void setModel(ArchiveProxy *model);
public slots:
void rename();
void remove();
private:
void impossible(const QString msg = tr("Unable to perform function!"));
ArchiveProxy *mProxy;
ArchiveModel *mModel;
};
class ArchiveProgressDialog : public QDialog {
Q_OBJECT
public:
explicit ArchiveProgressDialog(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowStaysOnTopHint);
public slots:
void setMessage(const QString &msg);
private:
QLabel *mMessage;
};
class ArchiveFiles : public SmTreeView {
public:
explicit ArchiveFiles(QWidget *parent = 0);
};
class ArchiveProxy : public QSortFilterProxyModel {
Q_OBJECT
public:
ArchiveProxy(QObject *parent = 0);
public slots:
void setFilter(const QString &filter, int sortOrder);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
private:
QRegExp mFilter;
int mSortOrder;
};
#endif // ARCHIVEVIEW_H
|