-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
99 lines (90 loc) · 2.45 KB
/
mainwindow.h
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
/*
* MainWindow.h
*
* Created on: Dec 1, 2008
* Author: Vincent
*/
#ifndef MAINWINDOW_H_
#define MAINWINDOW_H_
#include <QMainWindow>
#include "ui_mainwindow.h"
#include <QStandardItemModel>
#include "silofilter.h"
#include <QProgressDialog>
#include "findwidget.h"
#include <QList>
#include "common.h"
using namespace Silo;
class MainWindow: public QMainWindow, private Ui::MainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
void appendFilter(SiloFilter *filter);
void clearFilters();
protected:
bool eventFilter(QObject *watched, QEvent *event);
private slots:
void newFile();
bool save();
bool load();
void add();
void del();
void resizeColumns();
void resizeRows();
void onFindTextChanged(const QString &text);
void find();
void onSelectionChanged();
void onLabelEdited();
void onCommentEdited();
void onUndoFind();
void enableSorting(bool enabled);
void onFindViewShown(bool shown);
void about();
void onFindTypeChanged(int index);
void onFindUnitChanged(int unit);
void onAdvancedFind();
void onLanguageChanged();
private:
bool saveFile(const QString &fileName);
bool loadSiloDatabase(const QString &fileName);
void addDir(const QString &dirName, const QString &root,
const QString &label = QString(), const QString &comment =
QString());
void showError(const QString &message);
void connectModel();
void disconnectModel();
void clearModel();
void showTemporary(const QString &message);
void rowsSelected(QList<int> &rows);
void rowsSelectedSorted(QList<int> &rows);
void updateEditors();
void linkEditors();
void updateModelFromEditor(ColumnType editorId);
void updateRowCount();
void setupShortcuts();
void setupStatusBar();
void setupConnections();
void setupEventFilters();
void setupAppearance();
int selectionCount() {
return tableView->selectionModel()->selectedRows().size();
}
private:
static void rowsFromSelection(QList<int> &rows,
const QItemSelectionModel *selectionModel);
static void rowsFromSelectionSorted(QList<int> &rows,
const QItemSelectionModel *selectionModel);
private:
QStandardItemModel model;
SiloFilter *filter;
QList<SiloFilter *> filters;
int temporaryDuration;
QLineEdit *( editors[ID_MAX]);
QString lastOpenedPath;
QProgressDialog progress;
QLabel rowCountLabel;
bool isMulti[ID_MAX];
FindWidget findWidget;
QActionGroup *languages;
};
#endif /* MAINWINDOW_H_ */