| 1 |
#ifndef PAPERDIALOG_H |
| 2 |
#define PAPERDIALOG_H |
| 3 |
|
| 4 |
#include "Stationery.h" |
| 5 |
|
| 6 |
#include <QDialog> |
| 7 |
#include <QSpinBox> |
| 8 |
#include <QAbstractButton> |
| 9 |
|
| 10 |
namespace Ui { |
| 11 |
class PaperDialog; |
| 12 |
} |
| 13 |
|
| 14 |
class InchesSpinBox : public QSpinBox |
| 15 |
{ |
| 16 |
public: |
| 17 |
InchesSpinBox(QWidget * parent=0); |
| 18 |
protected: |
| 19 |
virtual int valueFromText(const QString &text) const; |
| 20 |
virtual QString textFromValue(int val) const; |
| 21 |
private: |
| 22 |
mutable int mNumerator; // deniminator is always 16 |
| 23 |
}; |
| 24 |
|
| 25 |
|
| 26 |
class StationeryDialog : public QDialog |
| 27 |
{ |
| 28 |
Q_OBJECT |
| 29 |
|
| 30 |
public: |
| 31 |
explicit StationeryDialog(QWidget *parent = 0); |
| 32 |
~StationeryDialog(); |
| 33 |
|
| 34 |
public slots: |
| 35 |
void paperSizeChanged(QString value); |
| 36 |
void colorChanged(QString value); |
| 37 |
void inchesMm(bool checked); |
| 38 |
void landscape(bool checked); |
| 39 |
void buttonClicked(); |
| 40 |
|
| 41 |
private: |
| 42 |
QSharedPointer<Stationery> createRecord(); |
| 43 |
|
| 44 |
|
| 45 |
Ui::PaperDialog *ui; |
| 46 |
InchesSpinBox* mTopMarginSpinBox; |
| 47 |
|
| 48 |
enum PaperSizes //TODO move to right place |
| 49 |
{ |
| 50 |
Letter, // 8.5x11 |
| 51 |
Legal, // 8.5x14 |
| 52 |
Ledger, // 11x17 |
| 53 |
Tabloid, // 11x17 |
| 54 |
LetterFanFold,// 9.5x11 |
| 55 |
LegalFanFold, // 15x11 |
| 56 |
USStdFanFold, // 14.875x11 |
| 57 |
A0, |
| 58 |
A1, |
| 59 |
A2, |
| 60 |
A3, |
| 61 |
A4, |
| 62 |
Custom |
| 63 |
}; |
| 64 |
}; |
| 65 |
|
| 66 |
#endif // PAPERDIALOG_H |