Debian Codegraph @

HercPrinter/StationeryDialog.h

raw symbols SCIP
1 /*
2 * File: StationeryDialog.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 handles the stationery definition dialog for the Hercules Studio printer
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 PAPERDIALOG_H
28 #define PAPERDIALOG_H
29
30 #include "Stationery.h"
31
32 #include <QDialog>
33 #include <QSpinBox>
34 #include <QComboBox>
35 #include <QAbstractButton>
36
37 namespace Ui {
38 class PaperDialog;
39 }
40
41 class InchesSpinBox : public QSpinBox
42 {
43 public:
44 InchesSpinBox(QWidget * parent=0);
45 void setValue(int val);
46 int value();
47
48 protected:
49 virtual int valueFromText(const QString &text) const;
50 virtual QString textFromValue(int val) const;
51 private:
52 mutable int mNumerator; // deniminator is always 16
53 };
54
55 class StationeryDialog;
56
57 class PaperPreview : public QWidget
58 {
59 Q_OBJECT
60 public:
61 PaperPreview(StationeryDialog * dialog, QWidget *parent = 0);
62 inline void setBarsRgb(int rgb)
63 {
64 mBarsRgb = rgb;
65 }
66
67 protected:
68 virtual void paintEvent(QPaintEvent*);
69
70 private:
71 StationeryDialog* mDialog;
72 int mBarsRgb; // bars color
73 };
74
75 class StationeryDialog : public QDialog
76 {
77 Q_OBJECT
78
79 public:
80 explicit StationeryDialog(QWidget *parent = 0, const QString& item=QString());
81 ~StationeryDialog();
82
83 public slots:
84 void stationeryNameChanged(QString newName);
85 void stationeryNameEdited(QString newName);
86 void deleteClicked();
87 void cancelClicked();
88 void paperSizeChanged(QString value);
89 void barsColorChanged(QString value);
90 void inchesMm(bool checked);
91 void landscape(bool checked);
92 void decorationToggeled();
93 void feedHolesToggeled();
94 void customColorChanged();
95
96 private:
97 StationeryPtr createRecord();
98 void populate();
99 void save(QString name);
100 bool builtinStationery(QString stationeryName);
101 void setProtected(bool disabled);
102
103
104 Ui::PaperDialog *ui;
105 InchesSpinBox* mTopMarginSpinBox;//TODO
106 PaperPreview *mPaperPreview;//TODO
107 int mRgb;
108 QString mCurrentName;
109
110 enum class PaperSizes //TODO move to right place, fix sizes
111 {
112 Letter, // 8.5x11
113 Legal, // 8.5x14
114 Ledger, // 11x17
115 Tabloid, // 11x17
116 LetterFanFold,// 9.5x11
117 LegalFanFold, // 15x11
118 USStdFanFold, // 14.875x11
119 A0,
120 A1,
121 A2,
122 A3,
123 A4,
124 Custom
125 };
126
127 friend class PaperPreview;
128 };
129
130 #endif // PAPERDIALOG_H