CycloBranch
cBricksDatabaseWidget.h
Go to the documentation of this file.
1
7#ifndef _CBRICKSDATABASEWIDGET_H
8#define _CBRICKSDATABASEWIDGET_H
9
10#include <QWidget>
11#include <QDesktopServices>
12#include <QUrl>
13#include <QFileInfo>
14#include <QMainWindow>
15#include <QToolBar>
16#include <QAction>
17#include <QTableView>
18#include <QStandardItemModel>
19#include <QStandardItem>
20#include <QComboBox>
21#include <fstream>
22#include "core/utilities.h"
28
29
30// forward declaration
31class QHBoxLayout;
32class QVBoxLayout;
33class QPushButton;
34class QLineEdit;
35class QMenuBar;
36class QMenu;
37
38
45int numberOfOccurrences(const string& s, char c);
46
47
51class cBricksDatabaseWidget : public QMainWindow
52{
53 Q_OBJECT
54
55public:
56
57
63 cBricksDatabaseWidget(cGlobalPreferences* globalpreferences, QWidget* parent = (QWidget *)0);
64
65
70
71
76 void closeEvent(QCloseEvent *event);
77
78
83 void applyGlobalPreferences(cGlobalPreferences* globalpreferences);
84
85
86private:
87
88 QString editorname;
89
90 QWidget* parent;
91
92 cGlobalPreferences* globalpreferences;
93
94 QMenuBar* menuBar;
95 QMenu* menuFile;
96 QMenu* menuEdit;
97 QMenu* menuHelp;
98
99 QToolBar* toolbarFile;
100 QAction* actionNewDatabase;
101 QAction* actionOpenDatabase;
102 QAction* actionSaveDatabase;
103 QAction* actionSaveDatabaseAs;
104 QAction* actionImportDatabase;
105 QAction* actionCloseWindow;
106
107 QToolBar* toolbarEdit;
108 QAction* actionAddRow;
109 QAction* actionRemoveSelectedRows;
110 QAction* actionSelectAll;
111 QAction* actionUnselectAll;
112
113 QToolBar* toolbarHelp;
114 QAction* actionHTMLDocumentation;
115
116 QToolBar* toolbarFilter;
117 QWidget* rowsfilterwidget;
118 QHBoxLayout* rowsfilterhbox;
119 QComboBox* rowsfilteroperator;
120 QComboBox* rowsfiltercombobox1;
121 QComboBox* rowsfiltercomparatorcombobox1;
122 QLineEdit* rowsfilterline1;
123 QComboBox* rowsfiltercombobox2;
124 QComboBox* rowsfiltercomparatorcombobox2;
125 QLineEdit* rowsfilterline2;
126 QCheckBox* rowsfiltercasesensitive;
127 QCheckBox* rowsfilterwholeword;
128 QPushButton* rowsfilterbutton;
129 QPushButton* rowsfilterclearbutton;
130
131 QTableView* database;
132 QStandardItemModel* databasemodel;
133 cBricksDatabaseProxyModel* proxymodel;
134 QVBoxLayout* mainlayout;
135 QWidget* mainwidget;
136
137 QString databasefile;
138 QString lastdir;
139 ifstream inputstream;
140 ofstream outputstream;
141 cBricksDatabase bricks;
142
143 bool datamodified;
144
145 void deleteTable();
146
147 void resetHeader();
148
149 bool checkTable();
150
151 bool checkFormula(int row, cSummaryFormula& formula);
152
153 void setDataModified(bool datamodified);
154
155protected:
156
157
162 void keyPressEvent(QKeyEvent *event);
163
164
165private slots:
166
167 void closeWindow();
168
169 void openDatabase();
170
171 bool saveDatabase();
172
173 bool saveDatabaseAs();
174
175 void saveDatabaseCheck();
176
177 void addRow();
178
179 void removeSelectedRows();
180
181 void itemChanged(QStandardItem* item);
182
183 void headerItemClicked(int index);
184
185 void filterRows();
186
187 void resetFilter();
188
189 void createNewDatabase();
190
191 void importDatabase();
192
193 void selectAll();
194
195 void unselectAll();
196
197 void showHTMLDocumentation();
198
199};
200
201#endif
202
The database of building blocks.
A proxy model for editor of database of building blocks.
int numberOfOccurrences(const string &s, char c)
Number of occurrences of a char in a string.
Definition: cBricksDatabaseWidget.cpp:22
A checkbox item delegate.
The representation of a set of peptide sequence candidates.
A delegate to create multiple buttons.
The class representing a database of building blocks (bricks).
Definition: cBricksDatabase.h:66
A proxy model for editor of database of building blocks.
Definition: cBricksDatabaseProxyModel.h:21
An editor of building blocks database.
Definition: cBricksDatabaseWidget.h:52
void applyGlobalPreferences(cGlobalPreferences *globalpreferences)
Apply new global preferences.
Definition: cBricksDatabaseWidget.cpp:316
cBricksDatabaseWidget(cGlobalPreferences *globalpreferences, QWidget *parent=(QWidget *) 0)
The constructor.
Definition: cBricksDatabaseWidget.cpp:33
~cBricksDatabaseWidget()
The destructor.
Definition: cBricksDatabaseWidget.cpp:266
void keyPressEvent(QKeyEvent *event)
Handle a key press event.
Definition: cBricksDatabaseWidget.cpp:461
void closeEvent(QCloseEvent *event)
Handle the window close event.
Definition: cBricksDatabaseWidget.cpp:310
The class storing global preferences.
Definition: cGlobalPreferences.h:104
The representation of a summary formula.
Definition: cSummaryFormula.h:59
Auxiliary funtions and structures.