comparison mupdf-source/thirdparty/zint/frontend_qt/mainwindow.h @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 /***************************************************************************
2 * Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
3 * Copyright (C) 2009-2024 by Robin Stuart <rstuart114@gmail.com> *
4 * *
5 * This program is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * You should have received a copy of the GNU General Public License *
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
15 ***************************************************************************/
16 /* SPDX-License-Identifier: GPL-3.0-or-later */
17
18 #ifndef Z_MAINWINDOW_H
19 #define Z_MAINWINDOW_H
20
21 #include <QButtonGroup>
22 #include <QMainWindow>
23 #include <QGraphicsItem>
24 #include <QGraphicsScene>
25 #include <QSettings>
26
27 class QLabel;
28 class QShortcut;
29 class QDoubleSpinBox;
30 class QPushButton;
31 class QToolButton;
32
33 #include "ui_mainWindow.h"
34 #include "barcodeitem.h"
35
36 class ScaleWindow;
37
38 class MainWindow : public QWidget, private Ui::mainWindow
39 {
40 Q_OBJECT
41
42 public:
43 MainWindow(QWidget *parent = 0, Qt::WindowFlags fl = Qt::WindowFlags());
44 ~MainWindow();
45
46 static QString get_zint_version(void);
47
48 #ifdef Q_OS_MACOS
49 static void mac_hack_vLayouts(QWidget *win);
50 static void mac_hack_statusBars(QWidget *win, const char *name = nullptr);
51 #endif
52
53 public slots:
54 void update_preview();
55 void change_options();
56
57 void fgcolor_clicked();
58 void bgcolor_clicked();
59 void fgcolor_changed(const QColor& color);
60 void bgcolor_changed(const QColor& color);
61 void fgcolor_edited();
62 void bgcolor_edited();
63
64 void data_ui_set();
65 void composite_ui_set();
66 void composite_ean_check();
67 void maxi_scm_ui_set();
68 void msi_plessey_ui_set();
69 void change_cmyk();
70 void autoheight_ui_set();
71 void HRTShow_ui_set();
72 void text_gap_ui_set();
73 void dotty_ui_set();
74 void codeone_ui_set();
75 void upcean_no_quiet_zones_ui_set();
76 void upcae_no_quiet_zones_ui_set();
77 void structapp_ui_set();
78 void clear_text_gap();
79 void on_encoded();
80 void on_errored();
81 void on_dataChanged(const QString& text, bool escaped, int seg_no);
82 void on_scaleChanged(double scale);
83 void filter_symbologies();
84
85 bool save();
86 void factory_reset();
87 void about();
88 void help();
89 void preview_bg();
90 void previewbgcolor_changed(const QColor& color);
91 void quit_now();
92 void menu();
93
94 void reset_colours();
95 void reverse_colours();
96 void open_data_dialog();
97 void open_data_dialog_seg1();
98 void open_data_dialog_seg2();
99 void open_data_dialog_seg3();
100 void open_sequence_dialog();
101 void clear_data();
102 void clear_data_seg1();
103 void clear_data_seg2();
104 void clear_data_seg3();
105 void clear_composite();
106 void zap();
107 void open_cli_dialog();
108 void open_scale_dialog();
109
110 void copy_to_clipboard_bmp();
111 void copy_to_clipboard_emf();
112 void copy_to_clipboard_eps();
113 void copy_to_clipboard_gif();
114 void copy_to_clipboard_png();
115 void copy_to_clipboard_pcx();
116 void copy_to_clipboard_svg();
117 void copy_to_clipboard_tif();
118
119 void copy_to_clipboard_errtxt();
120
121 void height_per_row_disable();
122 void height_per_row_default();
123
124 void guard_default_upcean();
125 void guard_default_upca();
126
127 void daft_ui_set();
128 void daft_tracker_default();
129
130 void view_context_menu(const QPoint &pos);
131 void errtxtBar_context_menu(const QPoint &pos);
132
133 protected:
134 void load_settings(QSettings &settings);
135
136 bool clear_data_eci_seg(int seg_no);
137
138 void color_clicked(QString &colorStr, QLineEdit *txt, QToolButton *btn, const QString& title,
139 QByteArray& geometry, const char *color_changed);
140 void color_edited(QString &colorStr, QLineEdit *txt, QToolButton *btn);
141 void setColorTxtBtn(const QString &colorStr, QLineEdit *txt, QToolButton* btn);
142
143 virtual void resizeEvent(QResizeEvent *event) override;
144 virtual bool event(QEvent *event) override;
145 virtual bool eventFilter(QObject *watched, QEvent *event) override;
146
147 void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled);
148 bool upcean_addon_gap(const QString &comboBoxName, const QString &labelName, int base);
149 void upcean_guard_descent(const QString &spnBoxName, const QString &labelName, const QString &btnDefaultName,
150 bool enabled = true);
151 void guard_default(const QString &spnBoxName);
152 double get_height_per_row_default();
153 bool have_addon();
154 void set_gs1_mode(bool gs1_mode);
155 void set_smaller_font(const QString &labelName);
156
157 void open_data_dialog_seg(const int seg_no);
158
159 void createActions();
160 void createMenu();
161 void enableActions();
162
163 void copy_to_clipboard(const QString &filename, const QString &name, const char *mimeType = nullptr);
164
165 void errtxtBar_clear();
166 void errtxtBar_set();
167
168 void automatic_info_set();
169
170 QLineEdit *get_seg_textbox(int seg_no);
171 QComboBox *get_seg_eci(int seg_no);
172
173 QPoint get_context_menu_pos(const QPoint &pos, QWidget *widget);
174
175 QWidget *get_widget(const QString &name);
176
177 static QString get_setting_name(int symbology);
178
179 int get_rad_grp_index(const QStringList &names);
180 void set_rad_from_setting(QSettings &settings, const QString &setting, const QStringList &names,
181 int default_val = 0);
182 bool get_rad_val(const QString &name);
183
184 int get_cmb_index(const QString &name);
185 void set_cmb_from_setting(QSettings &settings, const QString &setting, const QString &name, int default_val = 0);
186
187 int get_chk_val(const QString &name);
188 void set_chk_from_setting(QSettings &settings, const QString &setting, const QString &name, int default_val = 0);
189
190 double get_dspn_val(const QString &name);
191 void set_dspn_from_setting(QSettings &settings, const QString &setting, const QString &name,
192 float default_val = 0.0f);
193
194 QString get_txt_val(const QString &name);
195 void set_txt_from_setting(QSettings &settings, const QString &setting, const QString &name,
196 const QString &default_val);
197
198 int get_spn_val(const QString &name);
199 void set_spn_from_setting(QSettings &settings, const QString &setting, const QString &name, int default_val = 0);
200
201 void save_sub_settings(QSettings &settings, int symbology);
202 void load_sub_settings(QSettings &settings, int symbology);
203
204 void size_msg_ui_set();
205
206 float get_dpmm(const struct Zint::QZintXdimDpVars *vars) const;
207 const char *getFileType(const struct Zint::QZintXdimDpVars *vars, bool msg = false) const;
208
209 private:
210 QString m_fgstr, m_bgstr;
211 QByteArray m_fgcolor_geometry, m_bgcolor_geometry, m_previewbgcolor_geometry;
212 BarcodeItem m_bc;
213 QColor m_previewBgColor;
214 QWidget *m_optionWidget;
215 QGraphicsScene *scene;
216 int m_symbology;
217 QMenu *m_menu;
218 QShortcut *m_saveAsShortcut;
219 QShortcut *m_factoryResetShortcut;
220 QShortcut *m_openCLIShortcut;
221 QShortcut *m_copyBMPShortcut;
222 QShortcut *m_copyEMFShortcut;
223 QShortcut *m_copyGIFShortcut;
224 QShortcut *m_copyPNGShortcut;
225 QShortcut *m_copySVGShortcut;
226 QShortcut *m_copyTIFShortcut;
227 QAction *m_copyBMPAct;
228 QAction *m_copyEMFAct;
229 QAction *m_copyEPSAct;
230 QAction *m_copyGIFAct;
231 QAction *m_copyPCXAct;
232 QAction *m_copyPNGAct;
233 QAction *m_copySVGAct;
234 QAction *m_copyTIFAct;
235 QAction *m_openCLIAct;
236 QAction *m_saveAsAct;
237 QAction *m_previewBgColorAct;
238 QAction *m_factoryResetAct;
239 QAction *m_aboutAct;
240 QAction *m_helpAct;
241 QAction *m_quitAct;
242 QAction *m_copyErrtxtAct;
243 QLabel *m_lblHeightPerRow;
244 QDoubleSpinBox *m_spnHeightPerRow;
245 QPushButton *m_btnHeightPerRowDisable;
246 QPushButton *m_btnHeightPerRowDefault;
247 struct Zint::QZintXdimDpVars m_xdimdpVars;
248 ScaleWindow *m_scaleWindow;
249 };
250
251 /* vim: set ts=4 sw=4 et : */
252 #endif