zint-barcode-generator/frontend_qt/mainwindow.h

245 lines
8 KiB
C
Raw Normal View History

2008-07-18 10:49:14 -04:00
/***************************************************************************
2009-04-26 18:04:51 -04:00
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
* Copyright (C) 2009-2022 by Robin Stuart <rstuart114@gmail.com> *
2008-07-18 10:49:14 -04:00
* *
* This program is free software: you can redistribute it and/or modify *
2008-07-18 10:49:14 -04:00
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
2008-07-18 10:49:14 -04:00
* (at your option) any later version. *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
2008-07-18 10:49:14 -04:00
***************************************************************************/
/* SPDX-License-Identifier: GPL-3.0-or-later */
2008-07-18 10:49:14 -04:00
#ifndef Z_MAINWINDOW_H
#define Z_MAINWINDOW_H
2008-07-18 10:49:14 -04:00
#include <QtGui>
#include <QGraphicsItem>
2009-05-21 17:00:23 -04:00
#include <QMainWindow>
2016-12-14 18:33:17 -05:00
#include <QGraphicsScene>
#include <QButtonGroup>
2008-07-18 10:49:14 -04:00
2009-05-21 17:00:23 -04:00
class QLabel;
class QShortcut;
class QDoubleSpinBox;
class QPushButton;
2009-05-19 10:05:26 -04:00
- API: add new zint_symbol `dpmm` field for output resolution (BMP/ EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG) - Add support for specifying scale by X-dimension and resolution with new option `--scalexdimdp` for CLI/Tcl & new API function `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()` & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document - BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF following Inkscape) - backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`, `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff incl. new `QZintXdimDp` struct for passing around scale vars & use in `getAsCLI()`; add comments - Raise `scale` limit to 200 (from 100) to allow for large dpmm - output: create directories & subdirectories as necessary for output path using new function `out_fopen()` and use in BMP/EMF/ EPS/GIF/PCX/PNG/SVG/TIF - DPLEIT/DPIDENT: format HRT according to (incomplete) documentation, and set default height to 72X (from 50X) - CODE128B renamed to CODE128AB as can use subsets A and/or B - CODABAR: fix minimum height calc - EMF: fix indexing of handles (zero-based not 1-based) - GUI: fix symbology zap (previous technique of clearing and re-loading settings without doing a sync no longer works); fix UPCEAN guard descent enable - MAILMARK: better error message if input < 14 characters - GUI: add "Default" button for DAFT tracker ratio & enable/disable various default buttons; use new `takesGS1AIData()` to enable/disable GS1-specific checkboxes - CLI: use new `validate_float()` to parse float options (7 significant digits allowed only, no scientific notation) - DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp ID parse - library/CLI: fiddle with static asserts (make CHAR_BIT sensitive, supposedly) - win32/README: update building libpng (assembly removed) - README.linux: document incompatibility of Qt6 >= 6.3 - manual: expand Barcode Studio waffle - test suite: change range separator to hyphen and allow multiple excludes
2022-12-02 16:39:01 -05:00
#include "ui_mainWindow.h"
#include "barcodeitem.h"
class ScaleWindow;
2008-07-18 10:49:14 -04:00
class MainWindow : public QWidget, private Ui::mainWindow
{
Q_OBJECT
2008-07-18 10:49:14 -04:00
public:
MainWindow(QWidget *parent = 0, Qt::WindowFlags fl = Qt::WindowFlags());
~MainWindow();
2008-07-18 10:49:14 -04:00
static QString get_zint_version(void);
#ifdef Q_OS_MACOS
static void mac_hack(QWidget *win);
static void mac_hack_vLayouts(QWidget *win);
static void mac_hack_statusBars(QWidget *win, const char *name = nullptr);
#endif
2008-07-18 10:49:14 -04:00
public slots:
void update_preview();
void change_options();
void on_fgcolor_clicked();
void on_bgcolor_clicked();
void fgcolor_changed(const QColor& color);
void bgcolor_changed(const QColor& color);
void fgcolor_edited();
void bgcolor_edited();
void data_ui_set();
void composite_ui_set();
void composite_ean_check();
void maxi_scm_ui_set();
void msi_plessey_ui_set();
void change_cmyk();
void autoheight_ui_set();
void HRTShow_ui_set();
void dotty_ui_set();
void codeone_ui_set();
void structapp_ui_set();
void on_encoded();
void on_errored();
void on_dataChanged(const QString& text, bool escaped, int seg_no);
- API: add new zint_symbol `dpmm` field for output resolution (BMP/ EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG) - Add support for specifying scale by X-dimension and resolution with new option `--scalexdimdp` for CLI/Tcl & new API function `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()` & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document - BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF following Inkscape) - backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`, `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff incl. new `QZintXdimDp` struct for passing around scale vars & use in `getAsCLI()`; add comments - Raise `scale` limit to 200 (from 100) to allow for large dpmm - output: create directories & subdirectories as necessary for output path using new function `out_fopen()` and use in BMP/EMF/ EPS/GIF/PCX/PNG/SVG/TIF - DPLEIT/DPIDENT: format HRT according to (incomplete) documentation, and set default height to 72X (from 50X) - CODE128B renamed to CODE128AB as can use subsets A and/or B - CODABAR: fix minimum height calc - EMF: fix indexing of handles (zero-based not 1-based) - GUI: fix symbology zap (previous technique of clearing and re-loading settings without doing a sync no longer works); fix UPCEAN guard descent enable - MAILMARK: better error message if input < 14 characters - GUI: add "Default" button for DAFT tracker ratio & enable/disable various default buttons; use new `takesGS1AIData()` to enable/disable GS1-specific checkboxes - CLI: use new `validate_float()` to parse float options (7 significant digits allowed only, no scientific notation) - DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp ID parse - library/CLI: fiddle with static asserts (make CHAR_BIT sensitive, supposedly) - win32/README: update building libpng (assembly removed) - README.linux: document incompatibility of Qt6 >= 6.3 - manual: expand Barcode Studio waffle - test suite: change range separator to hyphen and allow multiple excludes
2022-12-02 16:39:01 -05:00
void on_scaleChanged(double scale);
void filter_symbologies();
bool save();
void factory_reset();
void about();
void help();
void quit_now();
void menu();
void reset_colours();
void reverse_colours();
void open_data_dialog();
void open_data_dialog_seg1();
void open_data_dialog_seg2();
void open_data_dialog_seg3();
void open_sequence_dialog();
void clear_data();
void clear_data_seg1();
void clear_data_seg2();
void clear_data_seg3();
void clear_composite();
void zap();
void open_cli_dialog();
- API: add new zint_symbol `dpmm` field for output resolution (BMP/ EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG) - Add support for specifying scale by X-dimension and resolution with new option `--scalexdimdp` for CLI/Tcl & new API function `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()` & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document - BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF following Inkscape) - backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`, `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff incl. new `QZintXdimDp` struct for passing around scale vars & use in `getAsCLI()`; add comments - Raise `scale` limit to 200 (from 100) to allow for large dpmm - output: create directories & subdirectories as necessary for output path using new function `out_fopen()` and use in BMP/EMF/ EPS/GIF/PCX/PNG/SVG/TIF - DPLEIT/DPIDENT: format HRT according to (incomplete) documentation, and set default height to 72X (from 50X) - CODE128B renamed to CODE128AB as can use subsets A and/or B - CODABAR: fix minimum height calc - EMF: fix indexing of handles (zero-based not 1-based) - GUI: fix symbology zap (previous technique of clearing and re-loading settings without doing a sync no longer works); fix UPCEAN guard descent enable - MAILMARK: better error message if input < 14 characters - GUI: add "Default" button for DAFT tracker ratio & enable/disable various default buttons; use new `takesGS1AIData()` to enable/disable GS1-specific checkboxes - CLI: use new `validate_float()` to parse float options (7 significant digits allowed only, no scientific notation) - DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp ID parse - library/CLI: fiddle with static asserts (make CHAR_BIT sensitive, supposedly) - win32/README: update building libpng (assembly removed) - README.linux: document incompatibility of Qt6 >= 6.3 - manual: expand Barcode Studio waffle - test suite: change range separator to hyphen and allow multiple excludes
2022-12-02 16:39:01 -05:00
void open_scale_dialog();
void copy_to_clipboard_bmp();
void copy_to_clipboard_emf();
void copy_to_clipboard_eps();
void copy_to_clipboard_gif();
void copy_to_clipboard_png();
void copy_to_clipboard_pcx();
void copy_to_clipboard_svg();
void copy_to_clipboard_tif();
void copy_to_clipboard_errtxt();
void height_per_row_disable();
void height_per_row_default();
- API: add new zint_symbol `dpmm` field for output resolution (BMP/ EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG) - Add support for specifying scale by X-dimension and resolution with new option `--scalexdimdp` for CLI/Tcl & new API function `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()` & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document - BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF following Inkscape) - backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`, `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff incl. new `QZintXdimDp` struct for passing around scale vars & use in `getAsCLI()`; add comments - Raise `scale` limit to 200 (from 100) to allow for large dpmm - output: create directories & subdirectories as necessary for output path using new function `out_fopen()` and use in BMP/EMF/ EPS/GIF/PCX/PNG/SVG/TIF - DPLEIT/DPIDENT: format HRT according to (incomplete) documentation, and set default height to 72X (from 50X) - CODE128B renamed to CODE128AB as can use subsets A and/or B - CODABAR: fix minimum height calc - EMF: fix indexing of handles (zero-based not 1-based) - GUI: fix symbology zap (previous technique of clearing and re-loading settings without doing a sync no longer works); fix UPCEAN guard descent enable - MAILMARK: better error message if input < 14 characters - GUI: add "Default" button for DAFT tracker ratio & enable/disable various default buttons; use new `takesGS1AIData()` to enable/disable GS1-specific checkboxes - CLI: use new `validate_float()` to parse float options (7 significant digits allowed only, no scientific notation) - DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp ID parse - library/CLI: fiddle with static asserts (make CHAR_BIT sensitive, supposedly) - win32/README: update building libpng (assembly removed) - README.linux: document incompatibility of Qt6 >= 6.3 - manual: expand Barcode Studio waffle - test suite: change range separator to hyphen and allow multiple excludes
2022-12-02 16:39:01 -05:00
void guard_default_upcean();
void guard_default_upca();
void daft_ui_set();
void daft_tracker_default();
void view_context_menu(const QPoint &pos);
void errtxtBar_context_menu(const QPoint &pos);
2009-05-19 10:05:26 -04:00
2016-12-14 18:33:17 -05:00
protected:
void load_settings(QSettings &settings);
bool clear_data_eci_seg(int seg_no);
void color_clicked(QColor &color, QLineEdit *txt, QPushButton *btn, const QString& title, QByteArray& geometry,
const char *color_changed);
void color_edited(QColor &color, QLineEdit *txt, QPushButton *btn);
QString getColorStr(const QColor color, bool alpha_always = false);
void setColorTxtBtn(const QColor color, QLineEdit *txt, QPushButton* btn);
virtual void resizeEvent(QResizeEvent *event) override;
virtual bool event(QEvent *event) override;
virtual bool eventFilter(QObject *watched, QEvent *event) override;
void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled);
- API: add new zint_symbol `dpmm` field for output resolution (BMP/ EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG) - Add support for specifying scale by X-dimension and resolution with new option `--scalexdimdp` for CLI/Tcl & new API function `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()` & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document - BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF following Inkscape) - backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`, `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff incl. new `QZintXdimDp` struct for passing around scale vars & use in `getAsCLI()`; add comments - Raise `scale` limit to 200 (from 100) to allow for large dpmm - output: create directories & subdirectories as necessary for output path using new function `out_fopen()` and use in BMP/EMF/ EPS/GIF/PCX/PNG/SVG/TIF - DPLEIT/DPIDENT: format HRT according to (incomplete) documentation, and set default height to 72X (from 50X) - CODE128B renamed to CODE128AB as can use subsets A and/or B - CODABAR: fix minimum height calc - EMF: fix indexing of handles (zero-based not 1-based) - GUI: fix symbology zap (previous technique of clearing and re-loading settings without doing a sync no longer works); fix UPCEAN guard descent enable - MAILMARK: better error message if input < 14 characters - GUI: add "Default" button for DAFT tracker ratio & enable/disable various default buttons; use new `takesGS1AIData()` to enable/disable GS1-specific checkboxes - CLI: use new `validate_float()` to parse float options (7 significant digits allowed only, no scientific notation) - DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp ID parse - library/CLI: fiddle with static asserts (make CHAR_BIT sensitive, supposedly) - win32/README: update building libpng (assembly removed) - README.linux: document incompatibility of Qt6 >= 6.3 - manual: expand Barcode Studio waffle - test suite: change range separator to hyphen and allow multiple excludes
2022-12-02 16:39:01 -05:00
bool upcean_addon_gap(const QString &comboBoxName, const QString &labelName, int base);
void upcean_guard_descent(const QString &spnBoxName, const QString &labelName, const QString &btnDefaultName,
bool enabled = true);
void guard_default(const QString &spnBoxName);
double get_height_per_row_default();
void set_gs1_mode(bool gs1_mode);
void set_smaller_font(const QString &labelName);
void open_data_dialog_seg(const int seg_no);
void createActions();
void createMenu();
void enableActions();
void copy_to_clipboard(const QString &filename, const QString &name, const char *mimeType = nullptr);
void errtxtBar_clear();
void errtxtBar_set();
void automatic_info_set();
QLineEdit *get_seg_textbox(int seg_no);
QComboBox *get_seg_eci(int seg_no);
QPoint get_context_menu_pos(const QPoint &pos, QWidget *widget);
QWidget *get_widget(const QString &name);
static QString get_setting_name(int symbology);
int get_rad_grp_index(const QStringList &names);
void set_rad_from_setting(QSettings &settings, const QString &setting, const QStringList &names,
int default_val = 0);
bool get_rad_val(const QString &name);
int get_cmb_index(const QString &name);
void set_cmb_from_setting(QSettings &settings, const QString &setting, const QString &name, int default_val = 0);
int get_chk_val(const QString &name);
void set_chk_from_setting(QSettings &settings, const QString &setting, const QString &name, int default_val = 0);
2017-10-23 15:37:52 -04:00
double get_dspn_val(const QString &name);
void set_dspn_from_setting(QSettings &settings, const QString &setting, const QString &name,
float default_val = 0.0f);
QString get_txt_val(const QString &name);
void set_txt_from_setting(QSettings &settings, const QString &setting, const QString &name,
const QString &default_val);
int get_spn_val(const QString &name);
void set_spn_from_setting(QSettings &settings, const QString &setting, const QString &name, int default_val = 0);
void save_sub_settings(QSettings &settings, int symbology);
void load_sub_settings(QSettings &settings, int symbology);
2008-07-18 10:49:14 -04:00
- API: add new zint_symbol `dpmm` field for output resolution (BMP/ EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG) - Add support for specifying scale by X-dimension and resolution with new option `--scalexdimdp` for CLI/Tcl & new API function `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()` & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document - BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF following Inkscape) - backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`, `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff incl. new `QZintXdimDp` struct for passing around scale vars & use in `getAsCLI()`; add comments - Raise `scale` limit to 200 (from 100) to allow for large dpmm - output: create directories & subdirectories as necessary for output path using new function `out_fopen()` and use in BMP/EMF/ EPS/GIF/PCX/PNG/SVG/TIF - DPLEIT/DPIDENT: format HRT according to (incomplete) documentation, and set default height to 72X (from 50X) - CODE128B renamed to CODE128AB as can use subsets A and/or B - CODABAR: fix minimum height calc - EMF: fix indexing of handles (zero-based not 1-based) - GUI: fix symbology zap (previous technique of clearing and re-loading settings without doing a sync no longer works); fix UPCEAN guard descent enable - MAILMARK: better error message if input < 14 characters - GUI: add "Default" button for DAFT tracker ratio & enable/disable various default buttons; use new `takesGS1AIData()` to enable/disable GS1-specific checkboxes - CLI: use new `validate_float()` to parse float options (7 significant digits allowed only, no scientific notation) - DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp ID parse - library/CLI: fiddle with static asserts (make CHAR_BIT sensitive, supposedly) - win32/README: update building libpng (assembly removed) - README.linux: document incompatibility of Qt6 >= 6.3 - manual: expand Barcode Studio waffle - test suite: change range separator to hyphen and allow multiple excludes
2022-12-02 16:39:01 -05:00
void size_msg_ui_set();
float get_dpmm(const struct Zint::QZintXdimDpVars *vars) const;
const char *getFileType(const struct Zint::QZintXdimDpVars *vars, bool msg = false) const;
2008-07-18 10:49:14 -04:00
private:
QColor m_fgcolor, m_bgcolor;
QByteArray m_fgcolor_geometry, m_bgcolor_geometry;
BarcodeItem m_bc;
QWidget *m_optionWidget;
QGraphicsScene *scene;
int m_symbology;
QMenu *m_menu;
QShortcut *m_saveAsShortcut;
QShortcut *m_factoryResetShortcut;
QShortcut *m_openCLIShortcut;
QShortcut *m_copyBMPShortcut;
QShortcut *m_copyEMFShortcut;
QShortcut *m_copyGIFShortcut;
QShortcut *m_copyPNGShortcut;
QShortcut *m_copySVGShortcut;
QShortcut *m_copyTIFShortcut;
QAction *m_copyBMPAct;
QAction *m_copyEMFAct;
QAction *m_copyEPSAct;
QAction *m_copyGIFAct;
QAction *m_copyPCXAct;
QAction *m_copyPNGAct;
QAction *m_copySVGAct;
QAction *m_copyTIFAct;
QAction *m_openCLIAct;
QAction *m_saveAsAct;
QAction *m_factoryResetAct;
QAction *m_aboutAct;
QAction *m_helpAct;
QAction *m_quitAct;
QAction *m_copyErrtxtAct;
QLabel *m_lblHeightPerRow;
QDoubleSpinBox *m_spnHeightPerRow;
QPushButton *m_btnHeightPerRowDisable;
QPushButton *m_btnHeightPerRowDefault;
- API: add new zint_symbol `dpmm` field for output resolution (BMP/ EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG) - Add support for specifying scale by X-dimension and resolution with new option `--scalexdimdp` for CLI/Tcl & new API function `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()` & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document - BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF following Inkscape) - backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`, `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff incl. new `QZintXdimDp` struct for passing around scale vars & use in `getAsCLI()`; add comments - Raise `scale` limit to 200 (from 100) to allow for large dpmm - output: create directories & subdirectories as necessary for output path using new function `out_fopen()` and use in BMP/EMF/ EPS/GIF/PCX/PNG/SVG/TIF - DPLEIT/DPIDENT: format HRT according to (incomplete) documentation, and set default height to 72X (from 50X) - CODE128B renamed to CODE128AB as can use subsets A and/or B - CODABAR: fix minimum height calc - EMF: fix indexing of handles (zero-based not 1-based) - GUI: fix symbology zap (previous technique of clearing and re-loading settings without doing a sync no longer works); fix UPCEAN guard descent enable - MAILMARK: better error message if input < 14 characters - GUI: add "Default" button for DAFT tracker ratio & enable/disable various default buttons; use new `takesGS1AIData()` to enable/disable GS1-specific checkboxes - CLI: use new `validate_float()` to parse float options (7 significant digits allowed only, no scientific notation) - DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp ID parse - library/CLI: fiddle with static asserts (make CHAR_BIT sensitive, supposedly) - win32/README: update building libpng (assembly removed) - README.linux: document incompatibility of Qt6 >= 6.3 - manual: expand Barcode Studio waffle - test suite: change range separator to hyphen and allow multiple excludes
2022-12-02 16:39:01 -05:00
struct Zint::QZintXdimDpVars m_xdimdpVars;
ScaleWindow *m_scaleWindow;
2008-07-18 10:49:14 -04:00
};
/* vim: set ts=4 sw=4 et : */
2008-07-18 10:49:14 -04:00
#endif