mirror of
https://git.code.sf.net/p/zint/code
synced 2026-01-24 04:15:57 +00: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
This commit is contained in:
@@ -8,14 +8,14 @@ project(zint-qt)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(${PROJECT_NAME}_SRCS barcodeitem.cpp main.cpp mainwindow.cpp
|
||||
cliwindow.cpp datawindow.cpp sequencewindow.cpp exportwindow.cpp)
|
||||
cliwindow.cpp datawindow.cpp scalewindow.cpp sequencewindow.cpp exportwindow.cpp)
|
||||
|
||||
if(USE_QT6)
|
||||
qt6_wrap_cpp(zint-qt_SRCS mainwindow.h cliwindow.h datawindow.h sequencewindow.h exportwindow.h)
|
||||
qt6_wrap_ui(zint-qt_SRCS mainWindow.ui extCLI.ui extData.ui extSequence.ui extExport.ui)
|
||||
qt6_wrap_cpp(zint-qt_SRCS mainwindow.h cliwindow.h datawindow.h scalewindow.h sequencewindow.h exportwindow.h)
|
||||
qt6_wrap_ui(zint-qt_SRCS mainWindow.ui extCLI.ui extData.ui extScale.ui extSequence.ui extExport.ui)
|
||||
else()
|
||||
qt5_wrap_cpp(zint-qt_SRCS mainwindow.h cliwindow.h datawindow.h sequencewindow.h exportwindow.h)
|
||||
qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extCLI.ui extData.ui extSequence.ui extExport.ui)
|
||||
qt5_wrap_cpp(zint-qt_SRCS mainwindow.h cliwindow.h datawindow.h scalewindow.h sequencewindow.h exportwindow.h)
|
||||
qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extCLI.ui extData.ui extScale.ui extSequence.ui extExport.ui)
|
||||
endif()
|
||||
|
||||
# grpAztec.ui grpC39.ui grpCodablockF.ui grpDotCode.ui grpMaxicode.ui grpQR.ui grpUPNQR.ui
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
//#include <QDebug>
|
||||
#include <QSettings>
|
||||
@@ -23,15 +24,15 @@
|
||||
#include <QMimeData>
|
||||
|
||||
#include "cliwindow.h"
|
||||
#include "barcodeitem.h"
|
||||
|
||||
// Shorthand
|
||||
#define QSL QStringLiteral
|
||||
|
||||
static const int tempMessageTimeout = 2000;
|
||||
|
||||
CLIWindow::CLIWindow(BarcodeItem *bc, const bool autoHeight, const double heightPerRow)
|
||||
: m_bc(bc), m_autoHeight(autoHeight), m_heightPerRow(heightPerRow)
|
||||
CLIWindow::CLIWindow(BarcodeItem *bc, const bool autoHeight, const double heightPerRow,
|
||||
const struct Zint::QZintXdimDpVars* xdimdpVars)
|
||||
: m_bc(bc), m_autoHeight(autoHeight), m_heightPerRow(heightPerRow), m_xdimdpVars(xdimdpVars)
|
||||
{
|
||||
setupUi(this);
|
||||
QSettings settings;
|
||||
@@ -106,7 +107,8 @@ void CLIWindow::generate_cli()
|
||||
chkCLINoEXE->setEnabled(false);
|
||||
}
|
||||
QString cmd = m_bc->bc.getAsCLI(radCLIWin->isChecked(), chkCLILongOpts->isChecked(),
|
||||
chkCLIBarcodeName->isChecked(), noEXE, m_autoHeight, m_heightPerRow);
|
||||
chkCLIBarcodeName->isChecked(), noEXE, m_autoHeight, m_heightPerRow, QSL("") /*outfile*/,
|
||||
m_xdimdpVars);
|
||||
|
||||
txtCLICmd->setPlainText(cmd);
|
||||
statusBarCLI->clearMessage();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
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
|
||||
@@ -16,21 +16,21 @@
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#ifndef CLIWINDOW_H
|
||||
#define CLIWINDOW_H
|
||||
|
||||
#include "ui_extCLI.h"
|
||||
|
||||
class BarcodeItem;
|
||||
#include "barcodeitem.h"
|
||||
|
||||
class CLIWindow : public QDialog, private Ui::CLIDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CLIWindow(BarcodeItem *bc, const bool autoHeight, const double heightPerRow);
|
||||
CLIWindow(BarcodeItem *bc, const bool autoHeight, const double heightPerRow,
|
||||
const struct Zint::QZintXdimDpVars* xdimdpVars);
|
||||
virtual ~CLIWindow();
|
||||
|
||||
private slots:
|
||||
@@ -41,6 +41,8 @@ protected:
|
||||
BarcodeItem *m_bc;
|
||||
bool m_autoHeight;
|
||||
double m_heightPerRow;
|
||||
const Zint::QZintXdimDpVars *m_xdimdpVars;
|
||||
};
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif
|
||||
|
||||
@@ -51,6 +51,9 @@
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnFromFile">
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&From File...</string>
|
||||
</property>
|
||||
@@ -75,6 +78,9 @@ Note that Line Feeds (0x0A) are not included,<br/> but any present will be
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnDataClear">
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> C&lear</string>
|
||||
</property>
|
||||
@@ -98,6 +104,9 @@ Note that Line Feeds (0x0A) are not included,<br/> but any present will be
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOK">
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> &OK</string>
|
||||
</property>
|
||||
@@ -109,6 +118,9 @@ Line Feeds (0xA0) will be escaped as "\n"</string>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
|
||||
@@ -135,9 +135,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblFileFormat">
|
||||
<widget class="QLabel" name="lblFileType">
|
||||
<property name="text">
|
||||
<string>File &Format:</string>
|
||||
<string>File &Type:</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The type of file which you want to create</string>
|
||||
|
||||
350
frontend_qt/extScale.ui
Normal file
350
frontend_qt/extScale.ui
Normal file
@@ -0,0 +1,350 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScaleDialog</class>
|
||||
<widget class="QDialog" name="ScaleDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>250</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Set Printing Scale</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:res/zint-qt.ico</normaloff>:res/zint-qt.ico</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutScale">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayoutScale">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblXdim">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>X-dimension in selected units</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&X-dimension:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spnXdim</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="spnXdim">
|
||||
<property name="toolTip">
|
||||
<string>X-dimension in selected units</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.001000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="cmbXdimUnits">
|
||||
<property name="toolTip">
|
||||
<string>X-dimension units (millimetres or inches)</string>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>mm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>in</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="btnXdimDefault">
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset X-dimension to default (symbology specific)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>De&fault</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblResolution">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Resolution (dot density) in selected units</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Resolution:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spnResolution</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spnResolution">
|
||||
<property name="toolTip">
|
||||
<string>Resolution (dot density) in selected units</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>12</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="cmbResolutionUnits">
|
||||
<property name="toolTip">
|
||||
<string>Resolution units (dots per mm or dots per inch)</string>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>dpmm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>dpi</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="btnResolutionDefault">
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset resolution to default (12 dpmm or 300 dpi)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Defau&lt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblFileType">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The type of file which will be outputted to</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File &Type:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cmbFileType</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="cmbFileType">
|
||||
<property name="toolTip">
|
||||
<string>The type of file which will be outputted to</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Raster (BMP/GIF/PCX/PNG/TIF)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vector (excluding EMF)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Extended Metafile (EMF)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblPrintingScale">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Calculated scale</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Printing Scale:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QLabel" name="msgPrintingScale">
|
||||
<property name="toolTip">
|
||||
<string>Calculated scale</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblWidthHeight">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Image size (width x height) of barcode</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QLabel" name="msgWidthHeight">
|
||||
<property name="toolTip">
|
||||
<string>Image size (width x height) of barcode</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacerScale">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horzLayoutScaleBtns">
|
||||
<item>
|
||||
<spacer name="horzSpacerScaleBtns">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOK">
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Close the window and update the Printing Scale</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Close window without updating the Printing Scale</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -18,11 +18,13 @@ HEADERS += barcodeitem.h \
|
||||
datawindow.h \
|
||||
exportwindow.h \
|
||||
mainwindow.h \
|
||||
scalewindow.h \
|
||||
sequencewindow.h
|
||||
|
||||
FORMS += extCLI.ui \
|
||||
extData.ui \
|
||||
extExport.ui \
|
||||
extScale.ui \
|
||||
extSequence.ui \
|
||||
grpAztec.ui \
|
||||
grpC11.ui \
|
||||
@@ -64,6 +66,7 @@ SOURCES += barcodeitem.cpp \
|
||||
exportwindow.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
scalewindow.cpp \
|
||||
sequencewindow.cpp
|
||||
|
||||
TRANSLATIONS = frontend_de.ts
|
||||
|
||||
@@ -10,12 +10,14 @@ HEADERS += barcodeitem.h \
|
||||
datawindow.h \
|
||||
exportwindow.h \
|
||||
mainwindow.h \
|
||||
scalewindow.h \
|
||||
sequencewindow.h
|
||||
|
||||
FORMS += extCLI.ui \
|
||||
extData.ui \
|
||||
extExport.ui \
|
||||
extSequence.ui \
|
||||
extScale.ui \
|
||||
grpAztec.ui \
|
||||
grpC11.ui \
|
||||
grpC128.ui \
|
||||
@@ -56,6 +58,7 @@ SOURCES += barcodeitem.cpp \
|
||||
exportwindow.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
scalewindow.cpp \
|
||||
sequencewindow.cpp
|
||||
|
||||
RESOURCES += resources.qrc
|
||||
|
||||
@@ -7,6 +7,7 @@ CONFIG += warn_on \
|
||||
|
||||
FORMS = mainWindow.ui \
|
||||
extCLI.ui \
|
||||
extScale.ui \
|
||||
extSequence.ui \
|
||||
extExport.ui \
|
||||
extData.ui
|
||||
@@ -16,6 +17,7 @@ HEADERS = mainwindow.h \
|
||||
cliwindow.h \
|
||||
datawindow.h \
|
||||
exportwindow.h \
|
||||
scalewindow.h \
|
||||
sequencewindow.h \
|
||||
qzint.h
|
||||
|
||||
@@ -25,7 +27,8 @@ SOURCES = main.cpp \
|
||||
cliwindow.cpp \
|
||||
datawindow.cpp \
|
||||
exportwindow.cpp \
|
||||
sequencewindow.cpp
|
||||
scalewindow.cpp \
|
||||
sequencewindow.cpp \
|
||||
qzint.cpp
|
||||
|
||||
RESOURCES = resources.qrc
|
||||
|
||||
@@ -66,6 +66,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnDAFTTrackerDefault">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset tracker ratio to default 25%</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>De&fault</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblUPCAAddonGap">
|
||||
<property name="text">
|
||||
<string>A&dd-on Gap:</string>
|
||||
<string>Add-o&n Gap:</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Horizontal space in X-dimensions between
|
||||
@@ -129,13 +129,13 @@ descend below the main bars (default 5X)
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnUPCAGuardReset">
|
||||
<widget class="QPushButton" name="btnUPCAGuardDefault">
|
||||
<property name="toolTip">
|
||||
<string>Reset guard bars descent height
|
||||
to default 5X</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Reset</string>
|
||||
<string>De&fault</string>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblUPCEANAddonGap">
|
||||
<property name="text">
|
||||
<string>A&dd-on Gap:</string>
|
||||
<string>Add-o&n Gap:</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Horizontal space in X-dimensions between
|
||||
@@ -139,13 +139,13 @@ descend below the main bars (default 5X)
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnUPCEANGuardReset">
|
||||
<widget class="QPushButton" name="btnUPCEANGuardDefault">
|
||||
<property name="toolTip">
|
||||
<string>Reset guard bars descent height
|
||||
to default 5X</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Reset</string>
|
||||
<string>De&fault</string>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
|
||||
@@ -1603,7 +1603,7 @@ as delimiters for GS1 Application Identifiers
|
||||
<layout class="QVBoxLayout" name="vLayoutAppearance">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="hLayoutAutoHeight">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkAutoHeight">
|
||||
@@ -1656,7 +1656,7 @@ and use standard height (if any) for default
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="heightb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -1707,7 +1707,7 @@ and use standard height (if any) for default
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="bwidth">
|
||||
<property name="toolTip">
|
||||
<string>Width of boundary bars or border in X-dimensions</string>
|
||||
@@ -1742,7 +1742,7 @@ and use standard height (if any) for default
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="btype">
|
||||
<property name="toolTip">
|
||||
<string>Add border or box</string>
|
||||
@@ -1788,7 +1788,7 @@ and use standard height (if any) for default
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="4" column="1" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayoutWhitespace">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spnWhitespace">
|
||||
@@ -1863,7 +1863,46 @@ in X-dimensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="btnScale">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set Printing Scale by X-dimension and resolution</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblSize">
|
||||
<property name="toolTip">
|
||||
<string>Image size (width x height) of barcode at given dot density</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print Size:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="5">
|
||||
<widget class="QLabel" name="lblSizeMsg">
|
||||
<property name="toolTip">
|
||||
<string>Image size (width x height) of barcode at given dot density</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lblFontSetting">
|
||||
<property name="toolTip">
|
||||
<string>Set font characteristics
|
||||
@@ -1880,7 +1919,7 @@ in X-dimensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbFontSetting">
|
||||
<property name="toolTip">
|
||||
<string>Set font characteristics
|
||||
@@ -1908,7 +1947,7 @@ in X-dimensions</string>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkHRTShow">
|
||||
<property name="toolTip">
|
||||
<string>Show Human Readable Text in image
|
||||
@@ -1922,7 +1961,7 @@ in X-dimensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_fgcolor">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@@ -1941,7 +1980,7 @@ in X-dimensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="4">
|
||||
<widget class="QLineEdit" name="txt_fgcolor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -1959,7 +1998,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<item row="0" column="5">
|
||||
<widget class="QPushButton" name="fgcolor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -1975,7 +2014,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_bgcolor">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@@ -1994,7 +2033,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<item row="1" column="4">
|
||||
<widget class="QLineEdit" name="txt_bgcolor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -2012,7 +2051,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<item row="1" column="5">
|
||||
<widget class="QPushButton" name="bgcolor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -2028,7 +2067,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="label_colours">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@@ -2047,7 +2086,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<item row="2" column="4">
|
||||
<widget class="QPushButton" name="btnReset">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -2063,7 +2102,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<item row="2" column="5">
|
||||
<widget class="QPushButton" name="btnReverse">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -2080,7 +2119,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3" colspan="2">
|
||||
<item row="3" column="4" colspan="2">
|
||||
<widget class="QCheckBox" name="chkCMYK">
|
||||
<property name="toolTip">
|
||||
<string>Use CMYK colour space in EPS/TIF output</string>
|
||||
@@ -2093,7 +2132,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3" colspan="2">
|
||||
<item row="4" column="4" colspan="2">
|
||||
<widget class="QCheckBox" name="chkQuietZones">
|
||||
<property name="toolTip">
|
||||
<string>Add compliant quiet zones (if any) to whitespace
|
||||
@@ -2107,7 +2146,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="lblRotate">
|
||||
<property name="toolTip">
|
||||
<string>Rotate symbol by degrees</string>
|
||||
@@ -2123,7 +2162,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3" colspan="2">
|
||||
<item row="5" column="4" colspan="2">
|
||||
<widget class="QComboBox" name="cmbRotate">
|
||||
<property name="toolTip">
|
||||
<string>Rotate symbol by degrees</string>
|
||||
@@ -2150,7 +2189,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3" colspan="2">
|
||||
<item row="7" column="4" colspan="2">
|
||||
<widget class="QCheckBox" name="chkDotty">
|
||||
<property name="toolTip">
|
||||
<string>Use dots instead of squares for matrix symbols
|
||||
@@ -2164,7 +2203,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<item row="8" column="3">
|
||||
<widget class="QLabel" name="lblDotSize">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -2184,7 +2223,7 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3" colspan="2">
|
||||
<item row="8" column="4" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="spnDotSize">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -2215,6 +2254,19 @@ or "RRGGBBAA" (alpha)</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vSpacerAppearance">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "cliwindow.h"
|
||||
#include "datawindow.h"
|
||||
#include "scalewindow.h"
|
||||
#include "sequencewindow.h"
|
||||
|
||||
// Shorthand
|
||||
@@ -190,7 +191,8 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
: QWidget(parent, fl), m_optionWidget(nullptr), m_symbology(0),
|
||||
m_menu(nullptr),
|
||||
m_lblHeightPerRow(nullptr), m_spnHeightPerRow(nullptr),
|
||||
m_btnHeightPerRowDisable(nullptr), m_btnHeightPerRowDefault(nullptr)
|
||||
m_btnHeightPerRowDisable(nullptr), m_btnHeightPerRowDefault(nullptr),
|
||||
m_scaleWindow(nullptr)
|
||||
{
|
||||
// Undocumented command line debug flag
|
||||
m_bc.bc.setDebug(QCoreApplication::arguments().contains(QSL("--verbose")));
|
||||
@@ -224,6 +226,8 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
mac_hack_vLayouts(this);
|
||||
mac_hack_statusBars(this, "statusBar");
|
||||
vLayoutTabData->setContentsMargins(QMargins(20, 0, 20, 0));
|
||||
tabMain->setMinimumSize(QSize(0, 380));
|
||||
tabMain->setMaximumSize(QSize(16777215, 380));
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
tabMain->setMinimumSize(QSize(0, 316));
|
||||
@@ -235,6 +239,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
m_fgcolor_geometry = settings.value(QSL("studio/fgcolor_geometry")).toByteArray();
|
||||
m_bgcolor_geometry = settings.value(QSL("studio/bgcolor_geometry")).toByteArray();
|
||||
|
||||
btnScale->setIcon(QIcon(QSL(":res/scaling.svg")));
|
||||
fgcolor->setIcon(QIcon(QSL(":res/black-eye.svg")));
|
||||
bgcolor->setIcon(QIcon(QSL(":res/white-eye.svg")));
|
||||
btnReverse->setIcon(QIcon(QSL(":res/shuffle.svg")));
|
||||
@@ -307,7 +312,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
connect(spnVWhitespace, SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
connect(btnMenu, SIGNAL(clicked( bool )), SLOT(menu()));
|
||||
connect(btnSave, SIGNAL(clicked( bool )), SLOT(save()));
|
||||
connect(spnScale, SIGNAL(valueChanged( double )), SLOT(change_print_scale()));
|
||||
connect(spnScale, SIGNAL(valueChanged( double )), SLOT(update_preview()));
|
||||
connect(btnExit, SIGNAL(clicked( bool )), SLOT(quit_now()));
|
||||
connect(btnReset, SIGNAL(clicked( bool )), SLOT(reset_colours()));
|
||||
connect(btnReverse, SIGNAL(clicked( bool )), SLOT(reverse_colours()));
|
||||
@@ -324,6 +329,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
connect(chkAutoHeight, SIGNAL(toggled( bool )), SLOT(autoheight_ui_set()));
|
||||
connect(chkAutoHeight, SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(chkCompliantHeight, SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(btnScale, SIGNAL(clicked( bool )), SLOT(open_scale_dialog()));
|
||||
connect(chkHRTShow, SIGNAL(toggled( bool )), SLOT(HRTShow_ui_set()));
|
||||
connect(chkHRTShow, SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(chkCMYK, SIGNAL(toggled( bool )), SLOT(change_cmyk()));
|
||||
@@ -426,6 +432,11 @@ MainWindow::~MainWindow()
|
||||
settings.setValue(QSL("studio/appearance/rotate"), cmbRotate->currentIndex());
|
||||
settings.setValue(QSL("studio/appearance/chk_dotty"), chkDotty->isChecked() ? 1 : 0);
|
||||
settings.setValue(QSL("studio/appearance/dot_size"), spnDotSize->value());
|
||||
// These are "system-wide"
|
||||
settings.setValue(QSL("studio/xdimdpvars/resolution"), m_xdimdpVars.resolution);
|
||||
settings.setValue(QSL("studio/xdimdpvars/resolution_units"), m_xdimdpVars.resolution_units);
|
||||
settings.setValue(QSL("studio/xdimdpvars/filetype"), m_xdimdpVars.filetype);
|
||||
settings.setValue(QSL("studio/xdimdpvars/filetype_maxicode"), m_xdimdpVars.filetype_maxicode);
|
||||
|
||||
save_sub_settings(settings, m_bc.bc.symbol());
|
||||
}
|
||||
@@ -472,13 +483,20 @@ void MainWindow::load_settings(QSettings &settings)
|
||||
cmbRotate->setCurrentIndex(settings.value(QSL("studio/appearance/rotate"), 0).toInt());
|
||||
chkDotty->setChecked(settings.value(QSL("studio/appearance/chk_dotty"), 0).toInt() ? true : false);
|
||||
spnDotSize->setValue(settings.value(QSL("studio/appearance/dot_size"), 4.0 / 5.0).toFloat());
|
||||
// These are "system-wide"
|
||||
m_xdimdpVars.resolution_units = settings.value(QSL("studio/xdimdpvars/resolution_units"), 0).toInt();
|
||||
const int defaultResolution = m_xdimdpVars.resolution_units == 1 ? 300 : 12; // 300dpi or 12dpmm
|
||||
m_xdimdpVars.resolution = settings.value(QSL("studio/xdimdpvars/resolution"), defaultResolution).toInt();
|
||||
m_xdimdpVars.filetype = std::max(std::min(settings.value(QSL("studio/xdimdpvars/filetype"), 0).toInt(), 1), 0);
|
||||
m_xdimdpVars.filetype_maxicode
|
||||
= std::max(std::min(settings.value(QSL("studio/xdimdpvars/filetype_maxicode"), 0).toInt(), 2), 0);
|
||||
}
|
||||
|
||||
QString MainWindow::get_zint_version(void)
|
||||
{
|
||||
QString zint_version;
|
||||
|
||||
int lib_version = ZBarcode_Version();
|
||||
int lib_version = Zint::QZint::getVersion();
|
||||
int version_major = lib_version / 10000;
|
||||
int version_minor = (lib_version % 10000) / 100;
|
||||
int version_release = lib_version % 100;
|
||||
@@ -721,7 +739,8 @@ void MainWindow::about()
|
||||
"\"Telepen\" is a Registered Trademark of SB Electronics.<br>"
|
||||
"\"Mailmark\" is a Registered Trademark of Royal Mail.</p>"
|
||||
"<p>With thanks to Harald Oehlmann, Norbert Szabó, Robert Elliott, Milton Neal, "
|
||||
"Git Lost, Alonso Schaich, Andre Maute and many others at SourceForge.</p>"
|
||||
"Git Lost, Alonso Schaich, Andre Maute and many others at "
|
||||
"<a href=\"https://sourceforge.net/projects/zint/\">SourceForge</a>.</p>"
|
||||
"<p><table border=1><tr><td>"
|
||||
#ifndef Q_OS_MACOS
|
||||
"<small>"
|
||||
@@ -859,7 +878,6 @@ void MainWindow::open_data_dialog_seg(const int seg_no)
|
||||
}
|
||||
disconnect(&dlg, SIGNAL(dataChanged(const QString&, bool, int)), this,
|
||||
SLOT(on_dataChanged(const QString&, bool, int)));
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::open_data_dialog()
|
||||
@@ -898,14 +916,22 @@ void MainWindow::zap()
|
||||
#if QT_VERSION < 0x60000
|
||||
settings.setIniCodec("UTF-8");
|
||||
#endif
|
||||
settings.clear();
|
||||
|
||||
int symbology = bstyle_items[bstyle->currentIndex()].symbology;
|
||||
QString name = get_setting_name(symbology);
|
||||
settings.remove(QSL("studio/bc/%1").arg(name));
|
||||
settings.remove(QSL("studio/data"));
|
||||
settings.remove(QSL("studio/eci"));
|
||||
|
||||
load_settings(settings);
|
||||
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
|
||||
m_xdimdpVars.x_dim = 0.0f;
|
||||
m_xdimdpVars.x_dim_units = 0;
|
||||
m_xdimdpVars.set = 0;
|
||||
|
||||
load_sub_settings(settings, symbology);
|
||||
|
||||
txtData->setFocus(Qt::OtherFocusReason);
|
||||
@@ -921,10 +947,17 @@ void MainWindow::on_dataChanged(const QString& text, bool escaped, int seg_no)
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::on_scaleChanged(double scale)
|
||||
{
|
||||
spnScale->setValue(scale);
|
||||
size_msg_ui_set();
|
||||
}
|
||||
|
||||
void MainWindow::open_cli_dialog()
|
||||
{
|
||||
CLIWindow dlg(&m_bc, chkAutoHeight->isEnabled() && chkAutoHeight->isChecked(),
|
||||
m_spnHeightPerRow && m_spnHeightPerRow->isEnabled() ? m_spnHeightPerRow->value() : 0.0);
|
||||
m_spnHeightPerRow && m_spnHeightPerRow->isEnabled() ? m_spnHeightPerRow->value() : 0.0,
|
||||
&m_xdimdpVars);
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
mac_hack_statusBars(&dlg);
|
||||
@@ -933,6 +966,25 @@ void MainWindow::open_cli_dialog()
|
||||
(void) dlg.exec();
|
||||
}
|
||||
|
||||
void MainWindow::open_scale_dialog()
|
||||
{
|
||||
double originalScale = spnScale->value();
|
||||
QString originalSizeMsg = lblSizeMsg->text();
|
||||
ScaleWindow dlg(&m_bc, &m_xdimdpVars);
|
||||
m_scaleWindow = &dlg;
|
||||
connect(&dlg, SIGNAL(scaleChanged(double)), this, SLOT(on_scaleChanged(double)));
|
||||
(void) dlg.exec();
|
||||
disconnect(&dlg, SIGNAL(scaleChanged(double)), this, SLOT(on_scaleChanged(double)));
|
||||
if (dlg.Valid) {
|
||||
m_xdimdpVars = dlg.m_vars;
|
||||
update_preview();
|
||||
} else { // Restore
|
||||
spnScale->setValue(originalScale);
|
||||
lblSizeMsg->setText(originalSizeMsg);
|
||||
}
|
||||
m_scaleWindow = nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::on_fgcolor_clicked()
|
||||
{
|
||||
color_clicked(m_fgcolor, txt_fgcolor, fgcolor, tr("Set foreground colour"), m_fgcolor_geometry,
|
||||
@@ -1037,6 +1089,9 @@ void MainWindow::autoheight_ui_set()
|
||||
m_btnHeightPerRowDisable->setEnabled(enabled && m_spnHeightPerRow->value());
|
||||
}
|
||||
if (m_btnHeightPerRowDefault) {
|
||||
if (enabled && m_spnHeightPerRow->value() == get_height_per_row_default()) {
|
||||
enabled = false;
|
||||
}
|
||||
m_btnHeightPerRowDefault->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
@@ -1163,8 +1218,9 @@ void MainWindow::on_encoded()
|
||||
if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked() || !heightb->isEnabled()) {
|
||||
/* setValue() rounds up/down to precision (decimals 3), we want round up only */
|
||||
float height = (float) (ceil(m_bc.bc.height() * 1000.0f) / 1000.0f);
|
||||
heightb->setValue(height);
|
||||
heightb->setValue(height); // This can cause a double-encode unfortunately
|
||||
}
|
||||
size_msg_ui_set();
|
||||
|
||||
if (m_optionWidget) {
|
||||
automatic_info_set();
|
||||
@@ -1180,6 +1236,7 @@ void MainWindow::on_errored()
|
||||
}
|
||||
enableActions();
|
||||
errtxtBar_set();
|
||||
size_msg_ui_set();
|
||||
if (m_optionWidget) {
|
||||
automatic_info_set();
|
||||
}
|
||||
@@ -1238,10 +1295,37 @@ void MainWindow::filter_symbologies()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::change_print_scale()
|
||||
void MainWindow::size_msg_ui_set()
|
||||
{
|
||||
/* This value is only used when printing (saving) to file */
|
||||
m_bc.bc.setScale((float) spnScale->value());
|
||||
if (m_bc.bc.getError() < ZINT_ERROR) {
|
||||
float scale = (float) spnScale->value();
|
||||
struct Zint::QZintXdimDpVars *vars = m_scaleWindow ? &m_scaleWindow->m_vars : &m_xdimdpVars;
|
||||
if (vars->x_dim == 0.0) {
|
||||
vars->x_dim_units = 0;
|
||||
vars->x_dim = m_bc.bc.getXdimDpFromScale(scale, get_dpmm(vars), getFileType(vars));
|
||||
} else {
|
||||
// Scale trumps stored X-dimension
|
||||
double x_dim_mm = vars->x_dim_units == 1 ? vars->x_dim * 25.4 : vars->x_dim;
|
||||
if (m_bc.bc.getScaleFromXdimDp((float) x_dim_mm, get_dpmm(vars), getFileType(vars)) != scale) {
|
||||
x_dim_mm = std::min(m_bc.bc.getXdimDpFromScale(scale, get_dpmm(vars), getFileType(vars)), 10.0f);
|
||||
vars->x_dim = vars->x_dim_units == 1 ? x_dim_mm / 25.4 : x_dim_mm;
|
||||
}
|
||||
}
|
||||
float width_x_dim, height_x_dim;
|
||||
if (m_bc.bc.getWidthHeightXdim((float) vars->x_dim, width_x_dim, height_x_dim)) {
|
||||
const char *fmt = vars->x_dim_units == 1 ? "%.3f x %.3f in @ %d %s (%s)" : "%.2f x %.2f mm @ %d %s (%s)";
|
||||
const char *resolution_units_str = vars->resolution_units == 1 ? "dpi" : "dpmm";
|
||||
lblSizeMsg->setText(QString::asprintf(fmt, width_x_dim, height_x_dim, vars->resolution,
|
||||
resolution_units_str, getFileType(vars, true /*msg*/)));
|
||||
} else {
|
||||
lblSizeMsg->clear();
|
||||
}
|
||||
} else {
|
||||
lblSizeMsg->clear();
|
||||
}
|
||||
if (m_scaleWindow) {
|
||||
m_scaleWindow->size_msg_ui_set();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::change_cmyk()
|
||||
@@ -1323,53 +1407,59 @@ void MainWindow::height_per_row_disable()
|
||||
}
|
||||
}
|
||||
|
||||
double MainWindow::get_height_per_row_default()
|
||||
{
|
||||
const QString &name = m_btnHeightPerRowDefault->objectName();
|
||||
double val = 0.0;
|
||||
if (name == QSL("btnPDFHeightPerRowDefault")) {
|
||||
val = 3.0;
|
||||
} else if (name == QSL("btnMPDFHeightPerRowDefault")) {
|
||||
val = 2.0;
|
||||
} else if (name == QSL("btnC16kHeightPerRowDefault")) {
|
||||
if (chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked()) {
|
||||
const int rows = m_bc.bc.encodedRows();
|
||||
val = 10.0 + (double)((rows - 1) * (get_cmb_index(QSL("cmbC16kRowSepHeight")) + 1)) / rows;
|
||||
} else {
|
||||
val = 10.0;
|
||||
}
|
||||
} else if (name == QSL("btnCbfHeightPerRowDefault")) {
|
||||
// Depends on no. of data cols
|
||||
const int cols = (m_bc.bc.encodedWidth() - 57) / 11; // 57 = 4 * 11 (start/subset/checks) + 13 (stop char)
|
||||
val = 0.55 * cols + 3;
|
||||
if (val < 10.0) {
|
||||
val = 10.0;
|
||||
}
|
||||
} else if (name == QSL("btnC49HeightPerRowDefault")) {
|
||||
if (chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked()) {
|
||||
const int rows = m_bc.bc.encodedRows();
|
||||
val = 10.0 + (double)((rows - 1) * (get_cmb_index(QSL("cmbC49RowSepHeight")) + 1)) / rows;
|
||||
} else {
|
||||
val = 10.0;
|
||||
}
|
||||
} else if (name == QSL("btnDBESHeightPerRowDefault")) {
|
||||
val = 34.0;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
void MainWindow::height_per_row_default()
|
||||
{
|
||||
if (m_spnHeightPerRow && m_btnHeightPerRowDefault) {
|
||||
const QString &name = m_btnHeightPerRowDefault->objectName();
|
||||
double val = 0.0;
|
||||
if (name == QSL("btnPDFHeightPerRowDefault")) {
|
||||
val = 3.0;
|
||||
} else if (name == QSL("btnMPDFHeightPerRowDefault")) {
|
||||
val = 2.0;
|
||||
} else if (name == QSL("btnC16kHeightPerRowDefault")) {
|
||||
if (chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked()) {
|
||||
const int rows = m_bc.bc.encodedRows();
|
||||
val = 10.0 + (double)((rows - 1) * (get_cmb_index(QSL("cmbC16kRowSepHeight")) + 1)) / rows;
|
||||
} else {
|
||||
val = 10.0;
|
||||
}
|
||||
} else if (name == QSL("btnCbfHeightPerRowDefault")) {
|
||||
// Depends on no. of data cols
|
||||
const int cols = (m_bc.bc.encodedWidth() - 57) / 11; // 57 = 4 * 11 (start/subset/checks) + 13 (stop char)
|
||||
val = 0.55 * cols + 3;
|
||||
if (val < 10.0) {
|
||||
val = 10.0;
|
||||
}
|
||||
} else if (name == QSL("btnC49HeightPerRowDefault")) {
|
||||
if (chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked()) {
|
||||
const int rows = m_bc.bc.encodedRows();
|
||||
val = 10.0 + (double)((rows - 1) * (get_cmb_index(QSL("cmbC49RowSepHeight")) + 1)) / rows;
|
||||
} else {
|
||||
val = 10.0;
|
||||
}
|
||||
} else if (name == QSL("btnDBESHeightPerRowDefault")) {
|
||||
val = 34.0;
|
||||
}
|
||||
double val = get_height_per_row_default();
|
||||
if (val) {
|
||||
m_spnHeightPerRow->setValue(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::guard_reset_upcean()
|
||||
void MainWindow::guard_default_upcean()
|
||||
{
|
||||
guard_reset(QSL("spnUPCEANGuardDescent"));
|
||||
guard_default(QSL("spnUPCEANGuardDescent"));
|
||||
}
|
||||
|
||||
void MainWindow::guard_reset_upca()
|
||||
void MainWindow::guard_default_upca()
|
||||
{
|
||||
guard_reset(QSL("spnUPCAGuardDescent"));
|
||||
guard_default(QSL("spnUPCAGuardDescent"));
|
||||
}
|
||||
|
||||
void MainWindow::view_context_menu(const QPoint &pos)
|
||||
@@ -1446,6 +1536,10 @@ void MainWindow::change_options()
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
|
||||
m_xdimdpVars.x_dim = 0.0f;
|
||||
m_xdimdpVars.x_dim_units = 0;
|
||||
m_xdimdpVars.set = 0;
|
||||
|
||||
if (symbology == BARCODE_CODE128) {
|
||||
QFile file(QSL(":/grpC128.ui"));
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
@@ -1695,9 +1789,12 @@ void MainWindow::change_options()
|
||||
m_optionWidget = uiload.load(&file);
|
||||
file.close();
|
||||
load_sub_settings(settings, symbology);
|
||||
tabMain->insertTab(1, m_optionWidget, tr("DAFT"));
|
||||
tabMain->insertTab(1, m_optionWidget, tr("D&AFT"));
|
||||
set_smaller_font(QSL("noteTrackerRatios"));
|
||||
connect(get_widget(QSL("spnDAFTTrackerRatio")), SIGNAL(valueChanged( double )), SLOT(daft_ui_set()));
|
||||
connect(get_widget(QSL("spnDAFTTrackerRatio")), SIGNAL(valueChanged( double )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("btnDAFTTrackerDefault")), SIGNAL(clicked( bool )), SLOT(daft_tracker_default()));
|
||||
daft_ui_set();
|
||||
}
|
||||
|
||||
} else if (symbology == BARCODE_DPD) {
|
||||
@@ -1975,7 +2072,7 @@ void MainWindow::change_options()
|
||||
}
|
||||
connect(get_widget(QSL("cmbUPCAAddonGap")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("spnUPCAGuardDescent")), SIGNAL(valueChanged( double )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("btnUPCAGuardReset")), SIGNAL(clicked( bool )), SLOT(guard_reset_upca()));
|
||||
connect(get_widget(QSL("btnUPCAGuardDefault")), SIGNAL(clicked( bool )), SLOT(guard_default_upca()));
|
||||
connect(get_widget(QSL("chkUPCANoQuietZones")), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
|
||||
} else if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK || symbology == BARCODE_EANX_CC
|
||||
@@ -2000,7 +2097,7 @@ void MainWindow::change_options()
|
||||
}
|
||||
connect(get_widget(QSL("cmbUPCEANAddonGap")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("spnUPCEANGuardDescent")), SIGNAL(valueChanged( double )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("btnUPCEANGuardReset")), SIGNAL(clicked( bool )), SLOT(guard_reset_upcean()));
|
||||
connect(get_widget(QSL("btnUPCEANGuardDefault")), SIGNAL(clicked( bool )), SLOT(guard_default_upcean()));
|
||||
connect(get_widget(QSL("chkUPCEANNoQuietZones")), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
|
||||
} else if (symbology == BARCODE_VIN) {
|
||||
@@ -2232,7 +2329,7 @@ void MainWindow::combobox_item_enabled(QComboBox *comboBox, int index, bool enab
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::upcean_addon_gap(const QString &comboBoxName, const QString &labelName, int base)
|
||||
bool MainWindow::upcean_addon_gap(const QString &comboBoxName, const QString &labelName, int base)
|
||||
{
|
||||
QComboBox *comboBox = m_optionWidget->findChild<QComboBox*>(comboBoxName);
|
||||
QLabel *label = m_optionWidget->findChild<QLabel*>(labelName);
|
||||
@@ -2251,26 +2348,38 @@ void MainWindow::upcean_addon_gap(const QString &comboBoxName, const QString &la
|
||||
m_bc.bc.setOption2(item_val + base);
|
||||
}
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void MainWindow::upcean_guard_descent(const QString &spnBoxName, const QString &labelName)
|
||||
void MainWindow::upcean_guard_descent(const QString &spnBoxName, const QString &labelName,
|
||||
const QString &btnDefaultName, bool enabled)
|
||||
{
|
||||
QDoubleSpinBox *spnBox = m_optionWidget->findChild<QDoubleSpinBox*>(spnBoxName);
|
||||
QLabel *label = m_optionWidget->findChild<QLabel*>(labelName);
|
||||
QPushButton *btnDefault = m_optionWidget->findChild<QPushButton*>(btnDefaultName);
|
||||
|
||||
bool enabled = txtData->text().length() > 5;
|
||||
if (spnBox) {
|
||||
spnBox->setEnabled(enabled);
|
||||
}
|
||||
if (label) {
|
||||
label->setEnabled(enabled);
|
||||
}
|
||||
if (btnDefault) {
|
||||
btnDefault->setEnabled(enabled);
|
||||
}
|
||||
if (enabled && spnBox) {
|
||||
m_bc.bc.setGuardDescent(spnBox->value());
|
||||
if (btnDefault && spnBox->value() == 5.0) {
|
||||
QWidget *focus = QApplication::focusWidget();
|
||||
btnDefault->setEnabled(false);
|
||||
if (focus == btnDefault) {
|
||||
spnBox->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::guard_reset(const QString &spnBoxName)
|
||||
void MainWindow::guard_default(const QString &spnBoxName)
|
||||
{
|
||||
QDoubleSpinBox *spnBox = m_optionWidget->findChild<QDoubleSpinBox*>(spnBoxName);
|
||||
if (spnBox && spnBox->value() != 5.0) {
|
||||
@@ -2279,6 +2388,32 @@ void MainWindow::guard_reset(const QString &spnBoxName)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::daft_ui_set()
|
||||
{
|
||||
QDoubleSpinBox *spnBox = m_optionWidget->findChild<QDoubleSpinBox*>(QSL("spnDAFTTrackerRatio"));
|
||||
QPushButton *btnDefault = m_optionWidget->findChild<QPushButton*>(QSL("btnDAFTTrackerDefault"));
|
||||
if (spnBox && spnBox->value() == 25.0) {
|
||||
if (btnDefault) {
|
||||
QWidget *focus = QApplication::focusWidget();
|
||||
btnDefault->setEnabled(false);
|
||||
if (focus == btnDefault) {
|
||||
spnBox->setFocus();
|
||||
}
|
||||
}
|
||||
} else if (btnDefault && !btnDefault->isEnabled()) {
|
||||
btnDefault->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::daft_tracker_default()
|
||||
{
|
||||
QDoubleSpinBox *spnBox = m_optionWidget->findChild<QDoubleSpinBox*>(QSL("spnDAFTTrackerRatio"));
|
||||
if (spnBox && spnBox->value() != 25.0) {
|
||||
spnBox->setValue(25.0);
|
||||
update_preview();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::set_gs1_mode(bool gs1_mode)
|
||||
{
|
||||
if (gs1_mode) {
|
||||
@@ -2344,6 +2479,7 @@ void MainWindow::update_preview()
|
||||
m_bc.bc.setOption1(-1);
|
||||
m_bc.bc.setOption2(0);
|
||||
m_bc.bc.setOption3(0);
|
||||
m_bc.bc.setDPMM(m_xdimdpVars.set ? get_dpmm(&m_xdimdpVars) : 0.0f);
|
||||
chkData->setEnabled(true);
|
||||
if (chkData->isChecked()) {
|
||||
m_bc.bc.setInputMode(DATA_MODE);
|
||||
@@ -2363,7 +2499,7 @@ void MainWindow::update_preview()
|
||||
|
||||
case BARCODE_CODE128:
|
||||
if (get_rad_val(QSL("radC128CSup")))
|
||||
m_bc.bc.setSymbol(BARCODE_CODE128B);
|
||||
m_bc.bc.setSymbol(BARCODE_CODE128AB);
|
||||
else if (get_rad_val(QSL("radC128EAN")))
|
||||
m_bc.bc.setSymbol(chkComposite->isChecked() ? BARCODE_GS1_128_CC : BARCODE_GS1_128);
|
||||
else if (get_rad_val(QSL("radC128HIBC")))
|
||||
@@ -2374,8 +2510,12 @@ void MainWindow::update_preview()
|
||||
|
||||
case BARCODE_EANX:
|
||||
m_bc.bc.setSymbol(chkComposite->isChecked() ? BARCODE_EANX_CC : BARCODE_EANX);
|
||||
upcean_addon_gap(QSL("cmbUPCEANAddonGap"), QSL("lblUPCEANAddonGap"), 7 /*base*/);
|
||||
upcean_guard_descent(QSL("spnUPCEANGuardDescent"), QSL("lblUPCEANGuardDescent"));
|
||||
{
|
||||
bool have_addon = upcean_addon_gap(QSL("cmbUPCEANAddonGap"), QSL("lblUPCEANAddonGap"), 7 /*base*/);
|
||||
bool enable_guard = have_addon || txtData->text().length() > 5;
|
||||
upcean_guard_descent(QSL("spnUPCEANGuardDescent"), QSL("lblUPCEANGuardDescent"),
|
||||
QSL("btnUPCEANGuardDefault"), enable_guard);
|
||||
}
|
||||
if (get_chk_val(QSL("chkUPCEANNoQuietZones"))) {
|
||||
m_bc.bc.setNoQuietZones(true);
|
||||
}
|
||||
@@ -2384,7 +2524,8 @@ void MainWindow::update_preview()
|
||||
case BARCODE_ISBNX:
|
||||
m_bc.bc.setSymbol(symbology);
|
||||
upcean_addon_gap(QSL("cmbUPCEANAddonGap"), QSL("lblUPCEANAddonGap"), 7 /*base*/);
|
||||
upcean_guard_descent(QSL("spnUPCEANGuardDescent"), QSL("lblUPCEANGuardDescent"));
|
||||
upcean_guard_descent(QSL("spnUPCEANGuardDescent"), QSL("lblUPCEANGuardDescent"),
|
||||
QSL("btnUPCEANGuardDefault"));
|
||||
if (get_chk_val(QSL("chkUPCEANNoQuietZones"))) {
|
||||
m_bc.bc.setNoQuietZones(true);
|
||||
}
|
||||
@@ -2393,7 +2534,7 @@ void MainWindow::update_preview()
|
||||
case BARCODE_UPCA:
|
||||
m_bc.bc.setSymbol(chkComposite->isChecked() ? BARCODE_UPCA_CC : BARCODE_UPCA);
|
||||
upcean_addon_gap(QSL("cmbUPCAAddonGap"), QSL("lblUPCAAddonGap"), 9 /*base*/);
|
||||
upcean_guard_descent(QSL("spnUPCAGuardDescent"), QSL("lblUPCAGuardDescent"));
|
||||
upcean_guard_descent(QSL("spnUPCAGuardDescent"), QSL("lblUPCAGuardDescent"), QSL("btnUPCAGuardDefault"));
|
||||
if (get_chk_val(QSL("chkUPCANoQuietZones"))) {
|
||||
m_bc.bc.setNoQuietZones(true);
|
||||
}
|
||||
@@ -2402,7 +2543,8 @@ void MainWindow::update_preview()
|
||||
case BARCODE_UPCE:
|
||||
m_bc.bc.setSymbol(chkComposite->isChecked() ? BARCODE_UPCE_CC : BARCODE_UPCE);
|
||||
upcean_addon_gap(QSL("cmbUPCEANAddonGap"), QSL("lblUPCEANAddonGap"), 7 /*base*/);
|
||||
upcean_guard_descent(QSL("spnUPCEANGuardDescent"), QSL("lblUPCEANGuardDescent"));
|
||||
upcean_guard_descent(QSL("spnUPCEANGuardDescent"), QSL("lblUPCEANGuardDescent"),
|
||||
QSL("btnUPCEANGuardDefault"));
|
||||
if (get_chk_val(QSL("chkUPCEANNoQuietZones"))) {
|
||||
m_bc.bc.setNoQuietZones(true);
|
||||
}
|
||||
@@ -2888,8 +3030,8 @@ void MainWindow::update_preview()
|
||||
lblECI->setEnabled(cmbECI->isEnabled());
|
||||
}
|
||||
btnClearData->setEnabled(!txtData->text().isEmpty());
|
||||
chkGS1Parens->setEnabled(m_bc.bc.supportsGS1());
|
||||
chkGS1NoCheck->setEnabled(m_bc.bc.supportsGS1());
|
||||
chkGS1Parens->setEnabled(m_bc.bc.takesGS1AIData(m_symbology) || (m_bc.bc.inputMode() & 0x07) == GS1_MODE);
|
||||
chkGS1NoCheck->setEnabled(chkGS1Parens->isEnabled());
|
||||
chkRInit->setEnabled(m_bc.bc.supportsReaderInit() && (m_bc.bc.inputMode() & 0x07) != GS1_MODE);
|
||||
chkCompliantHeight->setEnabled(m_bc.bc.hasCompliantHeight());
|
||||
|
||||
@@ -2926,7 +3068,7 @@ void MainWindow::update_preview()
|
||||
}
|
||||
m_bc.bc.setFgColor(m_fgcolor);
|
||||
m_bc.bc.setBgColor(m_bgcolor);
|
||||
change_print_scale();
|
||||
m_bc.bc.setScale((float) spnScale->value());
|
||||
change_cmyk();
|
||||
m_bc.setSize(width - 10, height - 10);
|
||||
m_bc.update();
|
||||
@@ -2942,7 +3084,7 @@ void MainWindow::createActions()
|
||||
QIcon copyIcon(QIcon::fromTheme(QSL("edit-copy"), QIcon(QSL(":res/copy.svg"))));
|
||||
QIcon cliIcon(QSL(":res/zint_black.ico"));
|
||||
QIcon saveIcon(QIcon::fromTheme(QSL("document-save"), QIcon(QSL(":res/download.svg"))));
|
||||
QIcon zapIcon(QIcon(QSL(":res/zap.svg")));
|
||||
QIcon zapIcon(QSL(":res/zap.svg"));
|
||||
QIcon aboutIcon(QSL(":res/zint-qt.ico"));
|
||||
QIcon helpIcon(QIcon::fromTheme(QSL("help-contents"), QIcon(QSL(":res/help-circle.svg"))));
|
||||
QIcon quitIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
|
||||
@@ -3135,7 +3277,7 @@ void MainWindow::errtxtBar_clear()
|
||||
if (!errtxtBarContainer->isHidden()) {
|
||||
errtxtBarContainer->hide();
|
||||
errtxtBarContainer->update();
|
||||
update_preview();
|
||||
update_preview(); // This causes a double-encode unfortunately
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3154,7 +3296,7 @@ void MainWindow::errtxtBar_set()
|
||||
if (errtxtBarContainer->isHidden()) {
|
||||
errtxtBarContainer->show();
|
||||
errtxtBarContainer->update();
|
||||
update_preview();
|
||||
update_preview(); // This causes a double-encode unfortunately
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3442,9 +3584,8 @@ QWidget *MainWindow::get_widget(const QString &name)
|
||||
/* Return settings subsection name for a symbol */
|
||||
QString MainWindow::get_setting_name(int symbology)
|
||||
{
|
||||
char name_buf[32];
|
||||
switch (symbology) {
|
||||
case BARCODE_CODE128B:
|
||||
case BARCODE_CODE128AB:
|
||||
case BARCODE_GS1_128:
|
||||
case BARCODE_GS1_128_CC:
|
||||
case BARCODE_HIBC_128:
|
||||
@@ -3472,6 +3613,21 @@ QString MainWindow::get_setting_name(int symbology)
|
||||
case BARCODE_HIBC_QR:
|
||||
symbology = BARCODE_QRCODE;
|
||||
break;
|
||||
case BARCODE_DBAR_OMN_CC:
|
||||
symbology = BARCODE_DBAR_OMN;
|
||||
break;
|
||||
case BARCODE_DBAR_OMNSTK_CC:
|
||||
symbology = BARCODE_DBAR_OMNSTK;
|
||||
break;
|
||||
case BARCODE_DBAR_LTD_CC:
|
||||
symbology = BARCODE_DBAR_LTD;
|
||||
break;
|
||||
case BARCODE_DBAR_STK_CC:
|
||||
symbology = BARCODE_DBAR_STK;
|
||||
break;
|
||||
case BARCODE_DBAR_EXP_CC:
|
||||
symbology = BARCODE_DBAR_EXP;
|
||||
break;
|
||||
case BARCODE_DBAR_EXPSTK_CC:
|
||||
symbology = BARCODE_DBAR_EXPSTK;
|
||||
break;
|
||||
@@ -3488,11 +3644,7 @@ QString MainWindow::get_setting_name(int symbology)
|
||||
symbology = BARCODE_UPCE;
|
||||
break;
|
||||
}
|
||||
if (ZBarcode_BarcodeName(symbology, name_buf) != 0) {
|
||||
return QSL("");
|
||||
}
|
||||
QString name(name_buf + 8); // Strip "BARCODE_" prefix
|
||||
return name.toLower();
|
||||
return Zint::QZint::barcodeName(symbology).mid(8).toLower(); // Strip "BARCODE_" prefix
|
||||
}
|
||||
|
||||
/* Helper to return index of selected radio button in group, checking for NULL */
|
||||
@@ -3624,7 +3776,7 @@ void MainWindow::set_spn_from_setting(QSettings &settings, const QString &settin
|
||||
void MainWindow::save_sub_settings(QSettings &settings, int symbology)
|
||||
{
|
||||
QString name = get_setting_name(symbology);
|
||||
if (!name.isEmpty()) {
|
||||
if (!name.isEmpty()) { // Should never be empty
|
||||
settings.setValue(QSL("studio/bc/%1/data").arg(name), txtData->text());
|
||||
if (!grpSegs->isHidden()) {
|
||||
settings.setValue(QSL("studio/bc/%1/data_seg1").arg(name), txtDataSeg1->text());
|
||||
@@ -3683,11 +3835,14 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
|
||||
settings.setValue(QSL("studio/bc/%1/paper/green").arg(name), m_bgcolor.green());
|
||||
settings.setValue(QSL("studio/bc/%1/paper/blue").arg(name), m_bgcolor.blue());
|
||||
settings.setValue(QSL("studio/bc/%1/paper/alpha").arg(name), m_bgcolor.alpha());
|
||||
settings.setValue(QSL("studio/bc/%1/xdimdpvars/x_dim").arg(name), m_xdimdpVars.x_dim);
|
||||
settings.setValue(QSL("studio/bc/%1/xdimdpvars/x_dim_units").arg(name), m_xdimdpVars.x_dim_units);
|
||||
settings.setValue(QSL("studio/bc/%1/xdimdpvars/set").arg(name), m_xdimdpVars.set);
|
||||
}
|
||||
|
||||
switch (symbology) {
|
||||
case BARCODE_CODE128:
|
||||
case BARCODE_CODE128B:
|
||||
case BARCODE_CODE128AB:
|
||||
case BARCODE_GS1_128:
|
||||
case BARCODE_GS1_128_CC:
|
||||
case BARCODE_HIBC_128:
|
||||
@@ -3999,7 +4154,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
|
||||
void MainWindow::load_sub_settings(QSettings &settings, int symbology)
|
||||
{
|
||||
QString name = get_setting_name(symbology);
|
||||
if (!name.isEmpty()) {
|
||||
if (!name.isEmpty()) { // Should never be empty
|
||||
const QString &tdata = settings.value(QSL("studio/bc/%1/data").arg(name), QSL("")).toString();
|
||||
if (!tdata.isEmpty()) {
|
||||
txtData->setText(tdata);
|
||||
@@ -4071,11 +4226,19 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
|
||||
settings.value(QSL("studio/bc/%1/paper/green").arg(name), 0xff).toInt(),
|
||||
settings.value(QSL("studio/bc/%1/paper/blue").arg(name), 0xff).toInt(),
|
||||
settings.value(QSL("studio/bc/%1/paper/alpha").arg(name), 0xff).toInt());
|
||||
|
||||
m_xdimdpVars.x_dim = settings.value(QSL("studio/bc/%1/xdimdpvars/x_dim").arg(name), 0.0).toFloat();
|
||||
m_xdimdpVars.x_dim_units = settings.value(QSL("studio/bc/%1/xdimdpvars/x_dim_units").arg(name), 0).toInt();
|
||||
m_xdimdpVars.set = settings.value(QSL("studio/bc/%1/xdimdpvars/set").arg(name), 0).toInt();
|
||||
} else {
|
||||
m_xdimdpVars.x_dim = 0.0;
|
||||
m_xdimdpVars.x_dim_units = 0;
|
||||
m_xdimdpVars.set = 0;
|
||||
}
|
||||
|
||||
switch (symbology) {
|
||||
case BARCODE_CODE128:
|
||||
case BARCODE_CODE128B:
|
||||
case BARCODE_CODE128AB:
|
||||
case BARCODE_GS1_128:
|
||||
case BARCODE_GS1_128_CC:
|
||||
case BARCODE_HIBC_128:
|
||||
@@ -4384,4 +4547,14 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
|
||||
}
|
||||
}
|
||||
|
||||
float MainWindow::get_dpmm(const struct Zint::QZintXdimDpVars* vars) const
|
||||
{
|
||||
return (float) (vars->resolution_units == 1 ? vars->resolution / 25.4 : vars->resolution);
|
||||
}
|
||||
|
||||
const char *MainWindow::getFileType(const struct Zint::QZintXdimDpVars* vars, bool msg) const
|
||||
{
|
||||
return Zint::QZintXdimDpVars::getFileType(m_bc.bc.symbol(), vars, msg);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
@@ -24,14 +24,16 @@
|
||||
#include <QGraphicsScene>
|
||||
#include <QButtonGroup>
|
||||
|
||||
#include "ui_mainWindow.h"
|
||||
#include "barcodeitem.h"
|
||||
|
||||
class QLabel;
|
||||
class QShortcut;
|
||||
class QDoubleSpinBox;
|
||||
class QPushButton;
|
||||
|
||||
#include "ui_mainWindow.h"
|
||||
#include "barcodeitem.h"
|
||||
|
||||
class ScaleWindow;
|
||||
|
||||
class MainWindow : public QWidget, private Ui::mainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -64,7 +66,6 @@ public slots:
|
||||
void composite_ean_check();
|
||||
void maxi_scm_ui_set();
|
||||
void msi_plessey_ui_set();
|
||||
void change_print_scale();
|
||||
void change_cmyk();
|
||||
void autoheight_ui_set();
|
||||
void HRTShow_ui_set();
|
||||
@@ -74,6 +75,7 @@ public slots:
|
||||
void on_encoded();
|
||||
void on_errored();
|
||||
void on_dataChanged(const QString& text, bool escaped, int seg_no);
|
||||
void on_scaleChanged(double scale);
|
||||
void filter_symbologies();
|
||||
|
||||
bool save();
|
||||
@@ -97,6 +99,7 @@ public slots:
|
||||
void clear_composite();
|
||||
void zap();
|
||||
void open_cli_dialog();
|
||||
void open_scale_dialog();
|
||||
|
||||
void copy_to_clipboard_bmp();
|
||||
void copy_to_clipboard_emf();
|
||||
@@ -112,8 +115,11 @@ public slots:
|
||||
void height_per_row_disable();
|
||||
void height_per_row_default();
|
||||
|
||||
void guard_reset_upcean();
|
||||
void guard_reset_upca();
|
||||
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);
|
||||
@@ -134,9 +140,11 @@ protected:
|
||||
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled);
|
||||
void upcean_addon_gap(const QString &comboBoxName, const QString &labelName, int base);
|
||||
void upcean_guard_descent(const QString &spnBoxName, const QString &labelName);
|
||||
void guard_reset(const QString &spnBoxName);
|
||||
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);
|
||||
|
||||
@@ -187,6 +195,11 @@ protected:
|
||||
void save_sub_settings(QSettings &settings, int symbology);
|
||||
void load_sub_settings(QSettings &settings, int symbology);
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
QColor m_fgcolor, m_bgcolor;
|
||||
QByteArray m_fgcolor_geometry, m_bgcolor_geometry;
|
||||
@@ -223,6 +236,8 @@ private:
|
||||
QDoubleSpinBox *m_spnHeightPerRow;
|
||||
QPushButton *m_btnHeightPerRowDisable;
|
||||
QPushButton *m_btnHeightPerRowDefault;
|
||||
struct Zint::QZintXdimDpVars m_xdimdpVars;
|
||||
ScaleWindow *m_scaleWindow;
|
||||
};
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
15
frontend_qt/res/LICENSE_lucide
Normal file
15
frontend_qt/res/LICENSE_lucide
Normal file
@@ -0,0 +1,15 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
7
frontend_qt/res/scaling.svg
Normal file
7
frontend_qt/res/scaling.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M21 3 9 15"></path>
|
||||
<path d="M12 3H3v18h18v-9"></path>
|
||||
<path d="M16 3h5v5"></path>
|
||||
<path d="M14 15H9v-5"></path>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 319 B |
@@ -41,6 +41,7 @@
|
||||
<file>res/download.svg</file>
|
||||
<file>res/help-circle.svg</file>
|
||||
<file>res/menu.svg</file>
|
||||
<file>res/scaling.svg</file>
|
||||
<file>res/shuffle.svg</file>
|
||||
<file>res/white-eye.svg</file>
|
||||
<file>res/x.svg</file>
|
||||
|
||||
248
frontend_qt/scalewindow.cpp
Normal file
248
frontend_qt/scalewindow.cpp
Normal file
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
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 3 of the License, or
|
||||
(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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
//#include <QDebug>
|
||||
#include <QUiLoader>
|
||||
#include <QSettings>
|
||||
|
||||
#include <math.h>
|
||||
#include "scalewindow.h"
|
||||
|
||||
// Shorthand
|
||||
#define QSL QStringLiteral
|
||||
|
||||
/* "Standard" dpmm/dpi equivalents */
|
||||
static int resolution_standard(int inch, int val)
|
||||
{
|
||||
/* Note toss-up between rounding 2400 dpi to 94 or 95 (~94.48818897637795275591) */
|
||||
static int standards[9][2] = {
|
||||
{ 4, 100 }, { 6, 150 }, { 8, 200 }, { 12, 300 }, { 16, 400 },
|
||||
{ 24, 600 }, { 47, 1200 }, { 94, 2400 }, { 189, 4800 },
|
||||
};
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (standards[i][inch] == val) {
|
||||
return standards[i][inch ? 0 : 1];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ScaleWindow::ScaleWindow(BarcodeItem *bc, Zint::QZintXdimDpVars *vars)
|
||||
: m_bc(bc), Valid(false), m_vars(*vars)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
if (m_bc->bc.noPng()) {
|
||||
cmbFileType->setItemText(0, QSL("Raster (BMP/GIF/PCX/TIF)"));
|
||||
}
|
||||
if (m_bc->bc.symbol() != BARCODE_MAXICODE) {
|
||||
cmbFileType->setItemText(1, QSL("Vector (EMF/EPS/SVG)"));
|
||||
cmbFileType->removeItem(2); // EMF
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
#if QT_VERSION < 0x60000
|
||||
settings.setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
QByteArray geometry = settings.value(QSL("studio/scale/window_geometry")).toByteArray();
|
||||
restoreGeometry(geometry);
|
||||
|
||||
spnXdim->setValue(m_vars.x_dim);
|
||||
cmbXdimUnits->setCurrentIndex(m_vars.x_dim_units);
|
||||
spnResolution->setValue(m_vars.resolution);
|
||||
cmbResolutionUnits->setCurrentIndex(m_vars.resolution_units);
|
||||
|
||||
if (m_bc->bc.symbol() == BARCODE_MAXICODE) {
|
||||
cmbFileType->setCurrentIndex(std::min(m_vars.filetype_maxicode, cmbFileType->count() - 1));
|
||||
} else {
|
||||
cmbFileType->setCurrentIndex(std::min(m_vars.filetype, cmbFileType->count() - 1));
|
||||
}
|
||||
|
||||
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
||||
spnXdim->setSingleStep(0.001);
|
||||
} else {
|
||||
spnXdim->setSingleStep(0.01);
|
||||
}
|
||||
if (cmbResolutionUnits->currentIndex() == 1) { // Inches
|
||||
spnResolution->setSingleStep(50);
|
||||
} else {
|
||||
spnResolution->setSingleStep(1);
|
||||
}
|
||||
|
||||
size_msg_ui_set();
|
||||
|
||||
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
|
||||
QIcon okIcon(QIcon(QSL(":res/check.svg")));
|
||||
btnCancel->setIcon(closeIcon);
|
||||
btnOK->setIcon(okIcon);
|
||||
|
||||
connect(btnCancel, SIGNAL(clicked( bool )), SLOT(close()));
|
||||
connect(btnOK, SIGNAL(clicked( bool )), SLOT(okay()));
|
||||
connect(spnXdim, SIGNAL(valueChanged( double )), SLOT(update_scale()));
|
||||
connect(cmbXdimUnits, SIGNAL(currentIndexChanged( int )), SLOT(x_dim_units_change()));
|
||||
connect(btnXdimDefault, SIGNAL(clicked( bool )), SLOT(x_dim_default()));
|
||||
connect(spnResolution, SIGNAL(valueChanged( int )), SLOT(update_scale()));
|
||||
connect(cmbResolutionUnits, SIGNAL(currentIndexChanged( int )), SLOT(resolution_units_change()));
|
||||
connect(btnResolutionDefault, SIGNAL(clicked( bool )), SLOT(resolution_default()));
|
||||
connect(cmbFileType, SIGNAL(currentIndexChanged( int )), SLOT(update_scale()));
|
||||
}
|
||||
|
||||
ScaleWindow::~ScaleWindow()
|
||||
{
|
||||
QSettings settings;
|
||||
#if QT_VERSION < 0x60000
|
||||
settings.setIniCodec("UTF-8");
|
||||
#endif
|
||||
settings.setValue(QSL("studio/scale/window_geometry"), saveGeometry());
|
||||
}
|
||||
|
||||
void ScaleWindow::size_msg_ui_set()
|
||||
{
|
||||
msgPrintingScale->setText(QString::asprintf("%.2f", m_bc->bc.scale()));
|
||||
float width_x_dim, height_x_dim;
|
||||
if (m_bc->bc.getWidthHeightXdim((float) m_vars.x_dim, width_x_dim, height_x_dim)) {
|
||||
const char *fmt = cmbXdimUnits->currentIndex() == 1 ? "%.3f x %.3f in" : "%.2f x %.2f mm";
|
||||
msgWidthHeight->setText(QString::asprintf(fmt, width_x_dim, height_x_dim));
|
||||
} else {
|
||||
msgWidthHeight->clear();
|
||||
}
|
||||
|
||||
bool defaultDisable;
|
||||
QWidget *focus = QApplication::focusWidget();
|
||||
|
||||
// This doesn't work well due to rounding errors TODO: fix
|
||||
defaultDisable = m_bc->bc.defaultXdim() == (float) get_x_dim_mm();
|
||||
btnXdimDefault->setEnabled(!defaultDisable);
|
||||
if (focus == btnXdimDefault && defaultDisable) {
|
||||
spnXdim->setFocus();
|
||||
}
|
||||
|
||||
defaultDisable = (cmbResolutionUnits->currentIndex() == 0 && spnResolution->value() == 12)
|
||||
|| (cmbResolutionUnits->currentIndex() == 1 && spnResolution->value() == 300);
|
||||
btnResolutionDefault->setEnabled(!defaultDisable);
|
||||
if (focus == btnResolutionDefault && defaultDisable) {
|
||||
spnResolution->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleWindow::okay()
|
||||
{
|
||||
if (update_vars()) {
|
||||
Valid = true;
|
||||
m_vars.set = 1;
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
void ScaleWindow::update_scale()
|
||||
{
|
||||
float scale = update_vars();
|
||||
if (scale) {
|
||||
// Need up-to-date `vectorWidth()` and `vectorHeight()` to estimate size including borders, whitespace & text,
|
||||
// so tell main window to encode and it will update UI here via `size_msg_ui_set()`
|
||||
emit scaleChanged(scale);
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleWindow::x_dim_units_change()
|
||||
{
|
||||
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
||||
spnXdim->setValue(spnXdim->value() / 25.4);
|
||||
spnXdim->setSingleStep(0.001);
|
||||
} else {
|
||||
spnXdim->setValue(spnXdim->value() * 25.4);
|
||||
spnXdim->setSingleStep(0.01);
|
||||
}
|
||||
update_scale();
|
||||
}
|
||||
|
||||
void ScaleWindow::x_dim_default()
|
||||
{
|
||||
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
||||
spnXdim->setValue(m_bc->bc.defaultXdim() / 25.4);
|
||||
} else {
|
||||
spnXdim->setValue(m_bc->bc.defaultXdim());
|
||||
}
|
||||
update_scale();
|
||||
}
|
||||
|
||||
void ScaleWindow::resolution_units_change()
|
||||
{
|
||||
int value;
|
||||
if (cmbResolutionUnits->currentIndex() == 1) { // Inches
|
||||
if ((value = resolution_standard(0, spnResolution->value()))) {
|
||||
spnResolution->setValue(value);
|
||||
} else {
|
||||
spnResolution->setValue((int) roundf(spnResolution->value() * 25.4f));
|
||||
}
|
||||
spnResolution->setSingleStep(50);
|
||||
} else {
|
||||
if ((value = resolution_standard(1, spnResolution->value()))) {
|
||||
spnResolution->setValue(value);
|
||||
} else {
|
||||
spnResolution->setValue((int) roundf(spnResolution->value() / 25.4f));
|
||||
}
|
||||
spnResolution->setSingleStep(1);
|
||||
}
|
||||
update_scale();
|
||||
}
|
||||
|
||||
void ScaleWindow::resolution_default()
|
||||
{
|
||||
spnResolution->setValue(cmbResolutionUnits->currentIndex() == 1 ? 300 : 12);
|
||||
update_scale();
|
||||
}
|
||||
|
||||
float ScaleWindow::get_x_dim_mm() const
|
||||
{
|
||||
return (float) (cmbXdimUnits->currentIndex() == 1 ? spnXdim->value() * 25.4 : spnXdim->value());
|
||||
|
||||
}
|
||||
|
||||
float ScaleWindow::get_dpmm() const
|
||||
{
|
||||
return (float) (cmbResolutionUnits->currentIndex() == 1 ? spnResolution->value() / 25.4 : spnResolution->value());
|
||||
}
|
||||
|
||||
const char *ScaleWindow::getFileType() const
|
||||
{
|
||||
static const char *filetypes[3] = { "GIF", "SVG", "EMF" };
|
||||
return filetypes[std::max(std::min(cmbFileType->currentIndex(), 2), 0)];
|
||||
}
|
||||
|
||||
double ScaleWindow::update_vars()
|
||||
{
|
||||
double scale = (double) m_bc->bc.getScaleFromXdimDp(get_x_dim_mm(), get_dpmm(), getFileType());
|
||||
if (scale != 0.0) {
|
||||
m_vars.x_dim = spnXdim->value();
|
||||
m_vars.x_dim_units = cmbXdimUnits->currentIndex();
|
||||
m_vars.resolution = spnResolution->value();
|
||||
m_vars.resolution_units = cmbResolutionUnits->currentIndex();
|
||||
if (m_bc->bc.symbol() == BARCODE_MAXICODE) {
|
||||
m_vars.filetype_maxicode = cmbFileType->currentIndex();
|
||||
} else {
|
||||
m_vars.filetype = cmbFileType->currentIndex();
|
||||
}
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
63
frontend_qt/scalewindow.h
Normal file
63
frontend_qt/scalewindow.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
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 3 of the License, or
|
||||
(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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#ifndef SCALEWINDOW_H
|
||||
#define SCALEWINDOW_H
|
||||
|
||||
#include "ui_extScale.h"
|
||||
#include "barcodeitem.h"
|
||||
|
||||
class ScaleWindow : public QDialog, private Ui::ScaleDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
BarcodeItem *m_bc;
|
||||
|
||||
public:
|
||||
ScaleWindow(BarcodeItem *bc, struct Zint::QZintXdimDpVars *vars);
|
||||
~ScaleWindow();
|
||||
|
||||
bool Valid;
|
||||
|
||||
struct Zint::QZintXdimDpVars m_vars;
|
||||
|
||||
signals:
|
||||
void scaleChanged(double scale);
|
||||
|
||||
public slots:
|
||||
void size_msg_ui_set();
|
||||
private slots:
|
||||
void okay();
|
||||
void update_scale();
|
||||
void x_dim_units_change();
|
||||
void x_dim_default();
|
||||
void resolution_units_change();
|
||||
void resolution_default();
|
||||
|
||||
private:
|
||||
float get_x_dim_mm() const;
|
||||
float get_dpmm() const;
|
||||
const char *getFileType() const;
|
||||
double update_vars();
|
||||
};
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif
|
||||
Reference in New Issue
Block a user