Debian Codegraph @

HercPrinter/DecolationDialog.h

raw symbols SCIP
1 /*
2 * File: DecolationDialog.h
3 *
4 * Author: Jacob Dekel
5 * Created on: May 10, 2014
6 *
7 * Copyright (c) 2009-2014 Jacob Dekel
8 * $Id$
9 *
10 * This object is the decolation definition/management dialog
11 *
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 *
25 */
26
27 #ifndef DECOLATIONDIALOG_H
28 #define DECOLATIONDIALOG_H
29
30 #include "DecolationRules.h"
31
32 #include <QDialog>
33 #include <QAbstractTableModel>
34 #include <QList>
35
36 class DecolationRules;
37
38 #define DecTableType QList<QStringList>
39 class DecolationModelBase : public QAbstractTableModel
40 {
41 public:
42 DecolationModelBase(QObject * parent = 0);
43 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
44 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
45 virtual bool removeRow ( int row, const QModelIndex & parent = QModelIndex() );
46 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
47 virtual QVariant rowData(const QModelIndex &index) const;
48 virtual Qt::ItemFlags flags(const QModelIndex &index) const;
49 virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
50 virtual void clear();
51
52 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const = 0;
53 virtual void addToDecolation(DecolationRules & decolationRules) = 0;
54
55 protected:
56 DecTableType zmTable;
57 };
58
59 class SepTableModel : public DecolationModelBase
60 {
61 public:
62 SepTableModel(QObject * parent = 0);
63
64 virtual bool insertRow(int row, const QModelIndex &, int line, int column, const QString &value, Trigger::TriggerType type);
65 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
66 virtual void addToDecolation(DecolationRules & decolationRules);
67 };
68
69 class AccountingTableModel : public DecolationModelBase
70 {
71 public:
72 AccountingTableModel(QObject * parent = 0);
73
74 virtual bool insertRow(int row, const QModelIndex &, int line, int column, int length, QString name);
75 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
76 virtual void addToDecolation(DecolationRules & decolationRules);
77 };
78
79
80 namespace Ui {
81 class DecolationDialog;
82 }
83
84 class DecolationDialog : public QDialog
85 {
86 Q_OBJECT
87
88 public:
89 explicit DecolationDialog(QWidget *parent = 0, const QString& item=QString());
90 ~DecolationDialog();
91
92 private:
93 void populate();
94 void save(QString name);
95 bool builtinDecolation(QString decName);
96 void setProtected(bool protect);
97
98 Ui::DecolationDialog *ui;
99
100 SepTableModel * mSepModel;
101 AccountingTableModel * mAccModel;
102 QString mCurrentName;
103
104 private slots:
105 void deleteClicked();
106 void cancelClicked();
107 void nameChanged(int index);
108 void nameEdited(QString name);
109 void addSeperator();
110 void addAccounting();
111 void insertSeperator();
112 void insertAccounting();
113 void deleteSeperator();
114 void deleteAccounting();
115 };
116
117 #endif // DECOLATIONDIALOG_H