summaryrefslogtreecommitdiffstats
path: root/kbarcode/barcodedialogs.h
blob: 56e3a58d8946ab2ac8e7fe39bdfa1fbf0e21e988 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/***************************************************************************
                          barcodedialogs.h  -  description
                             -------------------
    begin                : Fre Sep 5 2003
    copyright            : (C) 2003 by Dominik Seichter
    email                : domseichter@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef BARCODEDIALOGS_H
#define BARCODEDIALOGS_H

#include <qmap.h>
#include <qptrlist.h>
#include <qwidget.h>
#include <qvbox.h>
#include <kdialogbase.h>

class Barkode;
class KColorButton;
class KComboBox;
class KDoubleNumInput;
class KIntNumInput;
class QCheckBox;
class QRadioButton;

/** A base class for all widgets, that will be used in AdvancedBarcodeDialog
  * to modify the settings of a barcode. The API is simple. You can only set the
  * current barcode settings and retrieve them after the user modified them.
  *
  * @author Dominik Seichter
  */
class BarcodeDlgBase {
    public:
        virtual void setData( Barkode* b ) = 0;
        virtual void getData( Barkode* b ) const = 0;
};

/**
  * A configuration dialog for advanced barcode settings.
  * Used in BarcodeWidget. It loads the wigets below into tabs.
  * @see TBarcodeDlg
  * @see PDF417BarcodeDlg
  * @see DataMatrixDlg
  * @seeSequenceDlg
  *
  * @author Dominik Seichter
  */
class AdvancedBarcodeDialog : public KDialogBase {
    Q_OBJECT
    public:
        AdvancedBarcodeDialog( QString type, QWidget* parent = 0, const char* name = 0 );
        ~AdvancedBarcodeDialog();

        void setData( Barkode* b );
        void getData( Barkode* b );

    private:
        QPtrList<BarcodeDlgBase> list;
};

/** A configuration widget for TBarcode settings.
  * @author Dominik Seichter
  */
class TBarcodeDlg : public QWidget, public BarcodeDlgBase {
   Q_OBJECT
    public: 
        TBarcodeDlg(QWidget *parent=0, const char *name=0);

        void setData( Barkode* b );
        void getData( Barkode* b ) const;

    private:
        KDoubleNumInput* spinModule;
        KIntNumInput* spinHeight;
        QCheckBox* checkEscape;
        QCheckBox* checkAbove;
        QCheckBox* checkAutoCorrect;
        KComboBox* comboCheckSum;

        QMap<QString,int> map;
};

/** A configuration Dialog for PDF417 settings.
  * @author Dominik Seichter
  */
class PDF417BarcodeDlg : public QWidget, public BarcodeDlgBase {
   Q_OBJECT
    public:
        PDF417BarcodeDlg(QWidget *parent=0, const char *name=0);

        void setData( Barkode* b );
        void getData( Barkode* b ) const;
        
    private:
        KIntNumInput* spinRow;
        KIntNumInput* spinCol;
        KIntNumInput* spinErr;
};

/** A configuration widget for DataMatrix settings.
  * @author Dominik Seichter
  */
class DataMatrixDlg : public QWidget, public BarcodeDlgBase {
   Q_OBJECT
    public:
        DataMatrixDlg(QWidget *parent=0, const char *name=0);

        void setData( Barkode* b );
        void getData( Barkode* b ) const;
        
    private:
        KComboBox* comboDataMatrix;
};

/** A configuration widget for barcode sequences.
  * @author Dominik Seichter
  */
class SequenceDlg : public QWidget, public BarcodeDlgBase {
    Q_OBJECT
    public:
        SequenceDlg(QWidget *parent=0, const char *name=0);

        void setData( Barkode* b );
        void getData( Barkode* b ) const;

    private slots:
        void enableControls();
        
    private:
        QCheckBox* checkSequence;
        QRadioButton* radioNumbers;
        QRadioButton* radioAlpha;
        QRadioButton* radioAlphaNum;

        KIntNumInput* spinStep;
        KIntNumInput* spinStart;
};

/** A configuration widget for colors in pure postscript barcodes
  * @author Dominik Seichter
  */
class ColorDlg : public QVBox, public BarcodeDlgBase {
    Q_OBJECT
    public:
        ColorDlg(QWidget *parent=0, const char *name=0);

        void setData( Barkode* b );
        void getData( Barkode* b ) const;

    private:
        KColorButton* buttonBarColor;
        KColorButton* buttonBackColor;
        KColorButton* buttonTextColor;
};

/** A configuration widget for colors in pure postscript barcodes
  * @author Dominik Seichter
  */
class PurePostscriptDlg : public QVBox, public BarcodeDlgBase {
    Q_OBJECT
    public:
        PurePostscriptDlg(QWidget *parent=0, const char *name=0);

        void setData( Barkode* b );
        void getData( Barkode* b ) const;

    private:
        QCheckBox* checkChecksum;
};

#endif