|
CenGen - Генератор ценников
1.1
|
00001 #ifndef EDITOR_H 00002 #define EDITOR_H 00003 00004 //EDITOR of templates for price lists in XML format 00005 00006 #include <QMainWindow> 00007 #include <QGraphicsScene> 00008 #include <QGraphicsView> 00009 #include <QGraphicsRectItem> 00010 #include <QGraphicsTextItem> 00011 #include <QGraphicsItem> 00012 #include <QGroupBox> 00013 #include <QSpinBox> 00014 #include <QPushButton> 00015 #include <QLabel> 00016 #include <QLineEdit> 00017 #include <QGridLayout> 00018 #include <QtXml> 00019 #include <QFontDialog> 00020 #include <QFileDialog> 00021 #include <QTextCodec> 00022 00023 #include "addlinemaster.h" 00024 00025 #include "cen_viewer.h" 00026 00027 00028 #include <QDebug> 00029 00030 QT_BEGIN_NAMESPACE 00031 class QGraphicsView; 00032 class QGraphicsScene; 00033 class QSpinBox; 00034 class QPushButton; 00035 QT_END_NAMESPACE 00036 00037 class editor : public QDialog 00038 { 00039 Q_OBJECT 00040 00041 public: 00042 explicit editor(QWidget *parent = 0, Qt::WFlags f = Qt::WindowSystemMenuHint); 00043 // About(QWidget *parent = 0, Qt::WFlags f = Qt::WindowSystemMenuHint); 00044 00045 ~editor(); 00046 00047 void load_xml_data_into_editor(QDomElement* domElement); 00048 void set_file_name(QString name); 00049 QDomDocument get_new_shablon(); 00050 QString get_new_fileName(); 00051 00052 00053 private slots: 00054 void on_addRectButton_clicked(); 00055 00056 void on_exitButton_clicked(); 00057 00058 void on_clearButton_clicked(); 00059 00060 void on_saveButton_clicked(); 00061 00062 void generate_preview(); 00063 00064 void on_widthSpin_valueChanged(int ); 00065 00066 void on_heithSpin_valueChanged(int ); 00067 00068 void on_nameButton_clicked(); 00069 00070 void on_scene_selected(); 00071 00072 void on_propert_spin_changed(); 00073 00074 void c_items_initialize(); 00075 00076 void on_priceButton_clicked(); 00077 00078 void switch_cennic_element(QGraphicsItem* item); //add or remove a cennic element 00079 00080 void on_barcodeButton_clicked(); 00081 00082 void on_oldpriceButton_clicked(); 00083 00084 void on_dateButton_clicked(); 00085 00086 void on_nomerButton_clicked(); 00087 00088 void on_fontSelectButton_clicked(); 00089 00090 void on_textEdit_textChanged(QString ); 00091 00092 void on_delButton_clicked(); 00093 00094 void add_element_to_scene(QString type, 00095 float startX, float startY, 00096 float width, float heith, 00097 QBrush brush = QBrush(Qt::green), 00098 QFont font = QFont("Arial", 10), 00099 QString text = "some text", 00100 bool to_removal = true); 00101 void add_element_to_scene(QString type, 00102 float startX, float startY, 00103 float width, float heith, 00104 float linethick); 00105 00106 00107 void on_loadButton_clicked(); 00108 00109 void set_spin_value(QSpinBox* widget, float value); 00110 00111 00112 void on_setLeftButton_clicked(); 00113 00114 void on_setTopButton_clicked(); 00115 00116 void on_setRightButton_clicked(); 00117 00118 void on_setButtomButton_clicked(); 00119 00120 void on_barTextButton_clicked(); 00121 00122 void on_zoomOutButton_clicked(); 00123 00124 void on_zoomInButton_clicked(); 00125 00126 void on_lineButton_clicked(); 00127 00128 void delete_item(QGraphicsItem* item); 00129 00130 00131 private: 00132 //элементы формы 00133 QWidget *mainWidget; 00134 QGridLayout *mainLayout; 00135 QLabel *label5; 00136 QLineEdit* ui_shalon_nameEdit; 00137 QLabel *label, *label2; 00138 QSpinBox* ui_widthSpin, *ui_heithSpin; 00139 QGraphicsScene* ui_scene; 00140 QGraphicsView* ui_view; 00141 00142 QPushButton *loadButton, *saveButton, *exitButton, *clearButton; 00143 00144 QPushButton *barcodeButton, *barTextButton, *nomerButton, 00145 *priceButton, *oldpriceButton, *lineButton, 00146 *dateButton, *nameButton, *addRectButton; 00147 00148 QGraphicsScene *ui_preScene; 00149 QGraphicsView *ui_preView; 00150 00151 //элементы бокса выбора свойств элемента 00152 QGroupBox *ui_propertBox; 00153 QGridLayout *propertLay; 00154 QLabel *label3, *label4; 00155 QPushButton *fontSelectbutton; 00156 QPushButton *delButton; 00157 QSpinBox *ui_fontSizeSpin; 00158 QSpinBox* ui_pwidthSpin, *ui_pheithSpin; 00159 QLineEdit* ui_textEdit; 00160 QLabel *br_label1, *br_label2; 00161 QSpinBox *br_addition_box, *br_otstup_box; //эти для управления баркодом 00162 00163 //элементы бокса позиционирования элемента 00164 QGroupBox *posBox; 00165 QGridLayout *posLay; 00166 QPushButton *setTopButton, *setButtomButton, 00167 *setLeftButton, *setRightButton, 00168 *setCenterButton; 00169 00170 //элементы группы управления масштабом поля редактора 00171 QGroupBox *zoomBox; 00172 QGridLayout *zoomLay; 00173 QPushButton *zoomInButton, *zoomOutButton; 00174 00175 00176 00177 00178 00179 QDomDocument doc; 00180 QString fileName; 00181 QTextCodec *codec_utf8; 00182 00183 int number; 00184 00185 QGraphicsRectItem* baseRect; 00186 00187 00188 QMap<QString, QGraphicsItem* > c_items; 00189 struct cennicTextItmes { 00190 QString text; 00191 QFont font; 00192 }; 00193 QMap<QString, cennicTextItmes> c_text_items; 00194 00195 bool isSaved; 00196 00197 00198 //signals: 00199 // void shablon_is_ready(QDomDocument ); 00200 00201 }; 00202 00203 #endif // EDITOR_H