mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding certain trailing bytes libzint: fix some confusing error messages introduced by segment stuff general: new escape chars \U, \d and \o backend_qt: fudge rendering of border rectangles due to scaling/translation rounding errors TODO: better fudge GUI: foreground/background colours -> text boxes and icon buttons, add swap button, independently movable picker (NULL parent), preview colour changes, preview Data Window changes, add clear data (del) buttons, add zap button and Factory Reset menu option, various other fixes libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers CMake: add find package QtSvg, remove QtXml manual: split symbology and general specs and sort, move DAFT to 4-state, UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info, various other fiddlings man page: options or -> |, expand MSI Plessey check digit options README.linux: add packages info license: add SPDX-License-Identifier to touched files
This commit is contained in:
@ -32,7 +32,7 @@ endif()
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/backend" "${CMAKE_SOURCE_DIR}/backend_qt")
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} zint QZint
|
||||
Qt${QT_VERSION_MAJOR}::UiTools Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::UiTools Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Svg
|
||||
Qt${QT_VERSION_MAJOR}::Core)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2009 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009-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,7 +16,7 @@
|
||||
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 */
|
||||
|
||||
//#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
@ -33,7 +33,8 @@
|
||||
|
||||
static const int tempMessageTimeout = 2000;
|
||||
|
||||
DataWindow::DataWindow(const QString &input, bool isEscaped) : Valid(false), Escaped(false)
|
||||
DataWindow::DataWindow(const QString &input, bool isEscaped, int seg_no) : Valid(false), Escaped(false),
|
||||
m_isEscaped(isEscaped), m_seg_no(seg_no)
|
||||
{
|
||||
setupUi(this);
|
||||
QSettings settings;
|
||||
@ -45,7 +46,7 @@ DataWindow::DataWindow(const QString &input, bool isEscaped) : Valid(false), Esc
|
||||
restoreGeometry(geometry);
|
||||
|
||||
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
|
||||
QIcon clearIcon(QIcon::fromTheme(QSL("edit-clear"), QIcon(QSL(":res/delete.svg"))));
|
||||
QIcon clearIcon(QSL(":res/delete.svg"));
|
||||
QIcon okIcon(QIcon(QSL(":res/check.svg")));
|
||||
btnCancel->setIcon(closeIcon);
|
||||
btnDataClear->setIcon(clearIcon);
|
||||
@ -56,7 +57,8 @@ DataWindow::DataWindow(const QString &input, bool isEscaped) : Valid(false), Esc
|
||||
QString out;
|
||||
out.reserve(input.length());
|
||||
int lastPosn = 0;
|
||||
QRegularExpression escRE(QSL("\\\\(?:[0EabtnvfreGR\\\\]|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})"));
|
||||
QRegularExpression escRE(QSL("\\\\(?:[0EabtnvfreGR\\\\]|d[0-9]{3}|o[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}"
|
||||
"|U[0-9A-Fa-f]{6})"));
|
||||
QRegularExpressionMatchIterator matchI = escRE.globalMatch(input);
|
||||
while (matchI.hasNext()) {
|
||||
QRegularExpressionMatch match = matchI.next();
|
||||
@ -77,6 +79,9 @@ DataWindow::DataWindow(const QString &input, bool isEscaped) : Valid(false), Esc
|
||||
connect(btnDataClear, SIGNAL( clicked( bool )), SLOT(clear_data()));
|
||||
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
|
||||
connect(btnFromFile, SIGNAL( clicked( bool )), SLOT(from_file()));
|
||||
connect(txtDataInput, SIGNAL( textChanged() ), this, SLOT(text_changed()));
|
||||
|
||||
btnDataClear->setEnabled(!txtDataInput->toPlainText().isEmpty());
|
||||
}
|
||||
|
||||
DataWindow::~DataWindow()
|
||||
@ -93,18 +98,32 @@ void DataWindow::clear_data()
|
||||
txtDataInput->clear();
|
||||
}
|
||||
|
||||
void DataWindow::text_changed()
|
||||
{
|
||||
bool escaped = m_isEscaped;
|
||||
const QString &text = escapedData(escaped);
|
||||
btnDataClear->setEnabled(!text.isEmpty());
|
||||
emit dataChanged(text, escaped, m_seg_no);
|
||||
}
|
||||
|
||||
void DataWindow::okay()
|
||||
{
|
||||
Valid = true;
|
||||
DataOutput = txtDataInput->toPlainText();
|
||||
if (DataOutput.contains('\n')) {
|
||||
// Escape Line Feeds
|
||||
DataOutput.replace('\n', QSL("\\n"));
|
||||
Escaped = true;
|
||||
}
|
||||
DataOutput = escapedData(Escaped);
|
||||
close();
|
||||
}
|
||||
|
||||
QString DataWindow::escapedData(bool &escaped)
|
||||
{
|
||||
QString text = txtDataInput->toPlainText();
|
||||
if (text.contains('\n')) {
|
||||
// Escape Line Feeds
|
||||
text.replace('\n', QSL("\\n"));
|
||||
escaped = true;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
void DataWindow::from_file()
|
||||
{
|
||||
QSettings settings;
|
||||
@ -160,3 +179,5 @@ void DataWindow::from_file()
|
||||
|
||||
settings.setValue("studio/default_dir", filename.mid(0, filename.lastIndexOf(QDir::separator())));
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2009-2021 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009-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,7 +16,7 @@
|
||||
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 DATAWINDOW_H
|
||||
#define DATAWINDOW_H
|
||||
@ -28,17 +28,28 @@ class DataWindow : public QDialog, private Ui::DataDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DataWindow(const QString &input, bool isEscaped);
|
||||
DataWindow(const QString &input, bool isEscaped, int seg_no);
|
||||
~DataWindow();
|
||||
|
||||
bool Valid;
|
||||
bool Escaped;
|
||||
QString DataOutput;
|
||||
|
||||
signals:
|
||||
void dataChanged(const QString& text, bool escaped, int seg_no);
|
||||
|
||||
private slots:
|
||||
void clear_data();
|
||||
void text_changed();
|
||||
void okay();
|
||||
void from_file();
|
||||
|
||||
private:
|
||||
QString escapedData(bool &escaped);
|
||||
|
||||
bool m_isEscaped;
|
||||
int m_seg_no;
|
||||
};
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif
|
||||
|
@ -21,8 +21,8 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>435</height>
|
||||
<width>425</width>
|
||||
<height>440</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -47,7 +47,7 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>10</height>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
@ -57,6 +57,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="errtxtBarContainer">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
@ -66,9 +69,6 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QStatusBar" name="errtxtBar">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
@ -149,13 +149,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>325</height>
|
||||
<height>346</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>325</height>
|
||||
<height>346</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
@ -180,12 +180,12 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Data to Enc&ode</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Input data</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Data to Enc&ode</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutData">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutData">
|
||||
@ -217,19 +217,19 @@ or import from file</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSequence">
|
||||
<property name="toolTip">
|
||||
<string>Encode a sequence</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>123&4..</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="btnClearData">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear data and ECI (segment 0)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -267,13 +267,13 @@ or import from file</string>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>34</number>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set the ECI (Extended Channel Interpretation) code
|
||||
(ignored if disabled)</string>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>34</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
@ -473,6 +473,39 @@ or import from file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSequence">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Encode a sequence</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>123&4..</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnZap">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear all data and ECIs and reset all settings
|
||||
for this symbology to defaults</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -501,12 +534,12 @@ or import from file</string>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Composite Code</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>GS1 Composite symbol settings</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Composite Code</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@ -588,26 +621,49 @@ or import from file</string>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="vertLayoutComponentData">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblComposite">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Data to be encoded in 2D component
|
||||
<layout class="QHBoxLayout" name="horzLayoutComponentDataLabel">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblComposite">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Data to be encoded in 2D component
|
||||
Remember to place [square brackets] around AI identifiers</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2D Co&mponent Data:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>txtComposite</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2D Co&mponent Data</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>txtComposite</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnClearComposite">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear 2D Component data</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="txtComposite">
|
||||
@ -660,13 +716,13 @@ Remember to place [square brackets] around AI identifiers</string>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Additional ECI/Data Segments</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Additional data segments with their own
|
||||
Extended Channel Interpretation (ECI)</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Additional ECI/Data Segments</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutSegs">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutSeg1">
|
||||
@ -700,12 +756,12 @@ Extended Channel Interpretation (ECI)</string>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>34</number>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>ECI for segment 1</string>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>34</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
@ -890,7 +946,7 @@ Extended Channel Interpretation (ECI)</string>
|
||||
<string>Data for segment 1</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -911,6 +967,22 @@ or import from file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnClearDataSeg1">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear segment 1 data and ECI</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -945,12 +1017,12 @@ or import from file</string>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>34</number>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>ECI for segment 2</string>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>34</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
@ -1135,7 +1207,7 @@ or import from file</string>
|
||||
<string>Data for segment 2</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1156,6 +1228,22 @@ or import from file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnClearDataSeg2">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear segment 2 data and ECI</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -1190,12 +1278,12 @@ or import from file</string>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>34</number>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>ECI for segment 3</string>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>34</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
@ -1380,7 +1468,7 @@ or import from file</string>
|
||||
<string>Data for segment 3</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1401,6 +1489,22 @@ or import from file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnClearDataSeg3">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear segment 3 data and ECI</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -1451,8 +1555,10 @@ or import from file</string>
|
||||
<tr><td>\G&nbsp;</td><td>Group Separator (0x1D)</td></tr>
|
||||
<tr><td>\R&nbsp;</td><td>Record Separator (0x1E)</td></tr>
|
||||
<tr><td>\\&nbsp;</td><td>Backslash (0x5C)</td></tr>
|
||||
<tr><td>\dNNN&nbsp;</td><td>8-bit character (N decimal)</td></tr>
|
||||
<tr><td>\xNN&nbsp;</td><td>8-bit character (N hex)</td></tr>
|
||||
<tr><td>\uNNNN&nbsp;</td><td>16-bit Unicode (N hex)</td></tr>
|
||||
<tr><td>\uNNNN&nbsp;</td><td>16-bit Unicode BMP (N hex)</td></tr>
|
||||
<tr><td>\UNNNNNN&nbsp;</td><td>20-bit Unicode (N hex)</td></tr>
|
||||
</table></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -1841,60 +1947,159 @@ in X-dimensions</string>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Change colour of ink or paper</string>
|
||||
<string>Change colour of ink</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Colour:</string>
|
||||
<string>&Foreground:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fgcolor</cstring>
|
||||
<cstring>txt_fgcolor</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="fgcolor">
|
||||
<property name="toolTip">
|
||||
<string>Change ink colour</string>
|
||||
<widget class="QLineEdit" name="txt_fgcolor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Foreground</string>
|
||||
<property name="toolTip">
|
||||
<string>Change ink colour, format
|
||||
is hexadecimal "RRGGBB"
|
||||
or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" rowspan="3">
|
||||
<widget class="QLabel" name="label_dummyAppear12">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="fgcolor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Change ink colour using picker</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="bgcolor">
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_bgcolor">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Change paper colour</string>
|
||||
<string>Change colour of paper</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Back&ground</string>
|
||||
<string>Back&ground:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>txt_bgcolor</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="txt_bgcolor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Change paper colour, format
|
||||
is hexadecimal "RRGGBB"
|
||||
or "RRGGBBAA" (alpha)</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="bgcolor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Change paper colour using picker</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_colours">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset or reverse colours</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Colours:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>btnReset</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="btnReset">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset to black on white</string>
|
||||
<string>Reset colours to black on white</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<item row="2" column="4">
|
||||
<widget class="QPushButton" name="btnReverse">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Swap foreground and background colours
|
||||
(reflectance reversal)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3" colspan="2">
|
||||
<widget class="QCheckBox" name="chkCMYK">
|
||||
<property name="toolTip">
|
||||
<string>Use CMYK colour space in EPS/TIF output</string>
|
||||
@ -1907,7 +2112,7 @@ in X-dimensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<item row="4" column="3" colspan="2">
|
||||
<widget class="QCheckBox" name="chkQuietZones">
|
||||
<property name="toolTip">
|
||||
<string>Add compliant quiet zones to whitespace
|
||||
@ -1937,7 +2142,7 @@ in X-dimensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<item row="5" column="3" colspan="2">
|
||||
<widget class="QComboBox" name="cmbRotate">
|
||||
<property name="toolTip">
|
||||
<string>Rotate symbol by degrees</string>
|
||||
@ -1964,7 +2169,7 @@ in X-dimensions</string>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<item row="6" column="3" colspan="2">
|
||||
<widget class="QCheckBox" name="chkDotty">
|
||||
<property name="toolTip">
|
||||
<string>Use dots instead of squares for matrix symbols
|
||||
@ -1998,7 +2203,7 @@ in X-dimensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<item row="7" column="3" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="spnDotSize">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -2051,15 +2256,15 @@ in X-dimensions</string>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QStatusBar" name="statusBar">
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
<width>2</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
|
@ -13,6 +13,7 @@
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
//#include <QDebug>
|
||||
#include <QGraphicsScene>
|
||||
@ -55,6 +56,10 @@ static const QKeySequence copyPNGSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_P);
|
||||
static const QKeySequence copySVGSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_S);
|
||||
static const QKeySequence copyTIFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_T);
|
||||
|
||||
static const QKeySequence factoryResetSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_R);
|
||||
|
||||
static const QRegularExpression colorRE(QSL("^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$"));
|
||||
|
||||
struct bstyle_item {
|
||||
const QString text;
|
||||
int symbology;
|
||||
@ -159,14 +164,19 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
|
||||
restoreGeometry(settings.value(QSL("studio/window_geometry")).toByteArray());
|
||||
|
||||
m_fgcolor.setRgb(settings.value(QSL("studio/ink/red"), 0).toInt(),
|
||||
settings.value(QSL("studio/ink/green"), 0).toInt(),
|
||||
settings.value(QSL("studio/ink/blue"), 0).toInt(),
|
||||
settings.value(QSL("studio/ink/alpha"), 0xff).toInt());
|
||||
m_bgcolor.setRgb(settings.value(QSL("studio/paper/red"), 0xff).toInt(),
|
||||
settings.value(QSL("studio/paper/green"), 0xff).toInt(),
|
||||
settings.value(QSL("studio/paper/blue"), 0xff).toInt(),
|
||||
settings.value(QSL("studio/paper/alpha"), 0xff).toInt());
|
||||
m_fgcolor_geometry = settings.value(QSL("studio/fgcolor_geometry")).toByteArray();
|
||||
m_bgcolor_geometry = settings.value(QSL("studio/bgcolor_geometry")).toByteArray();
|
||||
|
||||
fgcolor->setIcon(QIcon(QSL(":res/black-eye.svg")));
|
||||
bgcolor->setIcon(QIcon(QSL(":res/white-eye.svg")));
|
||||
btnReverse->setIcon(QIcon(QSL(":res/shuffle.svg")));
|
||||
|
||||
QRegularExpressionValidator *colorValidator = new QRegularExpressionValidator(colorRE, this);
|
||||
txt_fgcolor->setValidator(colorValidator);
|
||||
txt_bgcolor->setValidator(colorValidator);
|
||||
|
||||
connect(txt_fgcolor, SIGNAL(textEdited(QString)), this, SLOT(fgcolor_edited()));
|
||||
connect(txt_bgcolor, SIGNAL(textEdited(QString)), this, SLOT(bgcolor_edited()));
|
||||
|
||||
const int cnt = (int) (sizeof(bstyle_items) / sizeof(bstyle_items[0]));
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
@ -182,34 +192,15 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
|
||||
bstyle->setCurrentIndex(settings.value(QSL("studio/symbology"), 10).toInt());
|
||||
|
||||
txtData->setText(settings.value(QSL("studio/data"), tr("Your Data Here!")).toString());
|
||||
/* Don't save seg data */
|
||||
txtComposite->setText(settings.value(QSL("studio/composite_text"), tr("Your Data Here!")).toString());
|
||||
chkComposite->setChecked(settings.value(QSL("studio/chk_composite")).toInt() ? true : false);
|
||||
cmbCompType->setCurrentIndex(settings.value(QSL("studio/comp_type"), 0).toInt());
|
||||
cmbECI->setCurrentIndex(settings.value(QSL("studio/eci"), 0).toInt());
|
||||
/* Don't save seg ECIs */
|
||||
chkEscape->setChecked(settings.value(QSL("studio/chk_escape")).toInt() ? true : false);
|
||||
chkData->setChecked(settings.value(QSL("studio/chk_data")).toInt() ? true : false);
|
||||
chkRInit->setChecked(settings.value(QSL("studio/chk_rinit")).toInt() ? true : false);
|
||||
chkGS1Parens->setChecked(settings.value(QSL("studio/chk_gs1parens")).toInt() ? true : false);
|
||||
chkGS1NoCheck->setChecked(settings.value(QSL("studio/chk_gs1nocheck")).toInt() ? true : false);
|
||||
chkAutoHeight->setChecked(settings.value(QSL("studio/appearance/autoheight"), 1).toInt() ? true : false);
|
||||
chkCompliantHeight->setChecked(
|
||||
settings.value(QSL("studio/appearance/compliantheight"), 1).toInt() ? true : false);
|
||||
heightb->setValue(settings.value(QSL("studio/appearance/height"), 50.0f).toFloat());
|
||||
bwidth->setValue(settings.value(QSL("studio/appearance/border"), 0).toInt());
|
||||
spnWhitespace->setValue(settings.value(QSL("studio/appearance/whitespace"), 0).toInt());
|
||||
spnVWhitespace->setValue(settings.value(QSL("studio/appearance/vwhitespace"), 0).toInt());
|
||||
spnScale->setValue(settings.value(QSL("studio/appearance/scale"), 1.0).toFloat());
|
||||
btype->setCurrentIndex(settings.value(QSL("studio/appearance/border_type"), 0).toInt());
|
||||
cmbFontSetting->setCurrentIndex(settings.value(QSL("studio/appearance/font_setting"), 0).toInt());
|
||||
chkHRTShow->setChecked(settings.value(QSL("studio/appearance/chk_hrt_show"), 1).toInt() ? true : false);
|
||||
chkCMYK->setChecked(settings.value(QSL("studio/appearance/chk_cmyk"), 0).toInt() ? true : false);
|
||||
chkQuietZones->setChecked(settings.value(QSL("studio/appearance/chk_quiet_zones"), 0).toInt() ? true : false);
|
||||
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());
|
||||
load_settings(settings);
|
||||
|
||||
QIcon clearIcon(QSL(":res/delete.svg"));
|
||||
btnClearData->setIcon(clearIcon);
|
||||
btnClearDataSeg1->setIcon(clearIcon);
|
||||
btnClearDataSeg2->setIcon(clearIcon);
|
||||
btnClearDataSeg3->setIcon(clearIcon);
|
||||
btnClearComposite->setIcon(clearIcon);
|
||||
btnZap->setIcon(QIcon(QSL(":res/zap.svg")));
|
||||
|
||||
change_options();
|
||||
|
||||
@ -222,6 +213,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
connect(bwidth, SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbFontSetting, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(data_ui_set()));
|
||||
connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(update_preview()));
|
||||
connect(txtDataSeg1, SIGNAL(textChanged( const QString& )), SLOT(data_ui_set()));
|
||||
connect(txtDataSeg1, SIGNAL(textChanged( const QString& )), SLOT(update_preview()));
|
||||
@ -233,6 +225,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
connect(chkComposite, SIGNAL(toggled( bool )), SLOT(composite_ui_set()));
|
||||
connect(chkComposite, SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(cmbCompType, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(btnClearComposite, SIGNAL(clicked( bool )), SLOT(clear_composite()));
|
||||
connect(cmbECI, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbECISeg1, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbECISeg2, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
@ -249,11 +242,17 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
connect(spnScale, SIGNAL(valueChanged( double )), SLOT(change_print_scale()));
|
||||
connect(btnExit, SIGNAL(clicked( bool )), SLOT(quit_now()));
|
||||
connect(btnReset, SIGNAL(clicked( bool )), SLOT(reset_colours()));
|
||||
connect(btnReverse, SIGNAL(clicked( bool )), SLOT(reverse_colours()));
|
||||
connect(btnMoreData, SIGNAL(clicked( bool )), SLOT(open_data_dialog()));
|
||||
connect(btnMoreDataSeg1, SIGNAL(clicked( bool )), SLOT(open_data_dialog_seg1()));
|
||||
connect(btnMoreDataSeg2, SIGNAL(clicked( bool )), SLOT(open_data_dialog_seg2()));
|
||||
connect(btnMoreDataSeg3, SIGNAL(clicked( bool )), SLOT(open_data_dialog_seg3()));
|
||||
connect(btnClearData, SIGNAL(clicked( bool )), SLOT(clear_data()));
|
||||
connect(btnClearDataSeg1, SIGNAL(clicked( bool )), SLOT(clear_data_seg1()));
|
||||
connect(btnClearDataSeg2, SIGNAL(clicked( bool )), SLOT(clear_data_seg2()));
|
||||
connect(btnClearDataSeg3, SIGNAL(clicked( bool )), SLOT(clear_data_seg3()));
|
||||
connect(btnSequence, SIGNAL(clicked( bool )), SLOT(open_sequence_dialog()));
|
||||
connect(btnZap, SIGNAL(clicked( bool )), SLOT(zap()));
|
||||
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()));
|
||||
@ -295,6 +294,9 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
m_copyTIFShortcut = new QShortcut(copyTIFSeq, this);
|
||||
connect(m_copyTIFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_tif()));
|
||||
|
||||
m_factoryResetShortcut = new QShortcut(factoryResetSeq, this);
|
||||
connect(m_factoryResetShortcut, SIGNAL(activated()), SLOT(factory_reset()));
|
||||
|
||||
QShortcut *helpShortcut = new QShortcut(QKeySequence::HelpContents, this);
|
||||
connect(helpShortcut, SIGNAL(activated()), SLOT(help()));
|
||||
QShortcut *quitShortcut = new QShortcut(quitKeySeq, this);
|
||||
@ -305,6 +307,8 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
bstyle->setFocus();
|
||||
|
||||
tabMain->installEventFilter(this);
|
||||
txt_fgcolor->installEventFilter(this);
|
||||
txt_bgcolor->installEventFilter(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -315,6 +319,8 @@ MainWindow::~MainWindow()
|
||||
#endif
|
||||
|
||||
settings.setValue(QSL("studio/window_geometry"), saveGeometry());
|
||||
settings.setValue(QSL("studio/fgcolor_geometry"), m_fgcolor_geometry);
|
||||
settings.setValue(QSL("studio/bgcolor_geometry"), m_bgcolor_geometry);
|
||||
settings.setValue(QSL("studio/tab_index"), tabMain->currentIndex());
|
||||
settings.setValue(QSL("studio/symbology"), bstyle->currentIndex());
|
||||
settings.setValue(QSL("studio/ink/red"), m_fgcolor.red());
|
||||
@ -356,6 +362,50 @@ MainWindow::~MainWindow()
|
||||
save_sub_settings(settings, m_bc.bc.symbol());
|
||||
}
|
||||
|
||||
void MainWindow::load_settings(QSettings &settings)
|
||||
{
|
||||
bool initial_load = m_symbology == 0;
|
||||
QString initialData(initial_load ? tr("Your Data Here!") : "");
|
||||
|
||||
m_fgcolor.setRgb(settings.value(QSL("studio/ink/red"), 0).toInt(),
|
||||
settings.value(QSL("studio/ink/green"), 0).toInt(),
|
||||
settings.value(QSL("studio/ink/blue"), 0).toInt(),
|
||||
settings.value(QSL("studio/ink/alpha"), 0xff).toInt());
|
||||
m_bgcolor.setRgb(settings.value(QSL("studio/paper/red"), 0xff).toInt(),
|
||||
settings.value(QSL("studio/paper/green"), 0xff).toInt(),
|
||||
settings.value(QSL("studio/paper/blue"), 0xff).toInt(),
|
||||
settings.value(QSL("studio/paper/alpha"), 0xff).toInt());
|
||||
|
||||
txtData->setText(settings.value(QSL("studio/data"), initialData).toString());
|
||||
/* Don't save seg data */
|
||||
txtComposite->setText(settings.value(QSL("studio/composite_text"), initialData).toString());
|
||||
chkComposite->setChecked(settings.value(QSL("studio/chk_composite")).toInt() ? true : false);
|
||||
cmbCompType->setCurrentIndex(settings.value(QSL("studio/comp_type"), 0).toInt());
|
||||
cmbECI->setCurrentIndex(settings.value(QSL("studio/eci"), 0).toInt());
|
||||
/* Don't save seg ECIs */
|
||||
chkEscape->setChecked(settings.value(QSL("studio/chk_escape")).toInt() ? true : false);
|
||||
chkData->setChecked(settings.value(QSL("studio/chk_data")).toInt() ? true : false);
|
||||
chkRInit->setChecked(settings.value(QSL("studio/chk_rinit")).toInt() ? true : false);
|
||||
chkGS1Parens->setChecked(settings.value(QSL("studio/chk_gs1parens")).toInt() ? true : false);
|
||||
chkGS1NoCheck->setChecked(settings.value(QSL("studio/chk_gs1nocheck")).toInt() ? true : false);
|
||||
chkAutoHeight->setChecked(settings.value(QSL("studio/appearance/autoheight"), 1).toInt() ? true : false);
|
||||
chkCompliantHeight->setChecked(
|
||||
settings.value(QSL("studio/appearance/compliantheight"), 1).toInt() ? true : false);
|
||||
heightb->setValue(settings.value(QSL("studio/appearance/height"), 50.0f).toFloat());
|
||||
bwidth->setValue(settings.value(QSL("studio/appearance/border"), 0).toInt());
|
||||
spnWhitespace->setValue(settings.value(QSL("studio/appearance/whitespace"), 0).toInt());
|
||||
spnVWhitespace->setValue(settings.value(QSL("studio/appearance/vwhitespace"), 0).toInt());
|
||||
spnScale->setValue(settings.value(QSL("studio/appearance/scale"), 1.0).toFloat());
|
||||
btype->setCurrentIndex(settings.value(QSL("studio/appearance/border_type"), 0).toInt());
|
||||
cmbFontSetting->setCurrentIndex(settings.value(QSL("studio/appearance/font_setting"), 0).toInt());
|
||||
chkHRTShow->setChecked(settings.value(QSL("studio/appearance/chk_hrt_show"), 1).toInt() ? true : false);
|
||||
chkCMYK->setChecked(settings.value(QSL("studio/appearance/chk_cmyk"), 0).toInt() ? true : false);
|
||||
chkQuietZones->setChecked(settings.value(QSL("studio/appearance/chk_quiet_zones"), 0).toInt() ? true : false);
|
||||
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());
|
||||
}
|
||||
|
||||
QString MainWindow::get_zint_version(void)
|
||||
{
|
||||
QString zint_version;
|
||||
@ -410,6 +460,14 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
if ((watched == txt_fgcolor || watched == txt_bgcolor) && event->type() == QEvent::FocusOut) {
|
||||
if (watched == txt_fgcolor) {
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
} else {
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
@ -417,9 +475,38 @@ void MainWindow::reset_colours()
|
||||
{
|
||||
m_fgcolor.setRgb(0, 0, 0, 0xff);
|
||||
m_bgcolor.setRgb(0xff, 0xff, 0xff, 0xff);
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::reverse_colours()
|
||||
{
|
||||
QColor temp = m_fgcolor;
|
||||
m_fgcolor = m_bgcolor;
|
||||
m_bgcolor = temp;
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
update_preview();
|
||||
}
|
||||
|
||||
QString MainWindow::getColorStr(const QColor color, bool alpha_always) {
|
||||
QString ret;
|
||||
if (color.alpha() != 0xFF || alpha_always) {
|
||||
ret = QString::asprintf("%02X%02X%02X%02X", color.red(), color.green(), color.blue(), color.alpha());
|
||||
} else {
|
||||
ret = QString::asprintf("%02X%02X%02X", color.red(), color.green(), color.blue());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MainWindow::setColorTxtBtn(const QColor color, QLineEdit *txt, QPushButton* btn) {
|
||||
int cursorPos = txt->cursorPosition();
|
||||
txt->setText(getColorStr(color));
|
||||
txt->setCursorPosition(cursorPos);
|
||||
btn->setStyleSheet(QSL("QPushButton {background-color:") + color.name() + QSL(";}"));
|
||||
}
|
||||
|
||||
bool MainWindow::save()
|
||||
{
|
||||
QSettings settings;
|
||||
@ -513,6 +600,37 @@ bool MainWindow::save()
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::factory_reset()
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Question, tr("Factory Reset"),
|
||||
tr("This will clear all saved data and reset all settings for all symbologies to defaults."),
|
||||
QMessageBox::Yes | QMessageBox::No, this);
|
||||
msgBox.setInformativeText(tr("Do you want to continue?"));
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
if (msgBox.exec() == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
#if QT_VERSION < 0x60000
|
||||
settings.setIniCodec("UTF-8");
|
||||
#endif
|
||||
settings.clear();
|
||||
|
||||
int symbology = bstyle_items[bstyle->currentIndex()].symbology;
|
||||
|
||||
load_settings(settings);
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
|
||||
load_sub_settings(settings, symbology);
|
||||
|
||||
settings.sync();
|
||||
|
||||
txtData->setFocus(Qt::OtherFocusReason);
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::about()
|
||||
{
|
||||
QString zint_version = get_zint_version();
|
||||
@ -522,24 +640,25 @@ void MainWindow::about()
|
||||
tr("<h2>Zint Barcode Studio %1</h2>"
|
||||
"<p>A free barcode generator</p>"
|
||||
"<p>Instruction manual is available at the project homepage:<br>"
|
||||
"<a href=\"http://www.zint.org.uk\">http://www.zint.org.uk</a>"
|
||||
"<a href=\"http://www.zint.org.uk\">http://www.zint.org.uk</a>.</p>"
|
||||
"<p>Copyright © 2006-2022 Robin Stuart and others.<br>"
|
||||
"Qt backend by BogDan Vatra</p>"
|
||||
"Qt backend by BogDan Vatra.<br>"
|
||||
"Released under GNU GPL 3.0 or later.</p>"
|
||||
"<p>Qt version %2</p>"
|
||||
"<p>\"QR Code\" is a Registered Trademark of Denso Corp.<br>"
|
||||
"\"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>"
|
||||
"<p>Released under the GNU General Public License ver. 3 or later.<br>"
|
||||
"\"QR Code\" is a Registered Trademark of Denso Corp.<br>"
|
||||
"\"Telepen\" is a Registered Trademark of SB Electronics.</p>"
|
||||
"<p><table border=1><tr><td><small>Currently supported standards include:<br>"
|
||||
"EN 798:1996, EN 12323:2005, ISO/IEC 15420:2009,<br>"
|
||||
"ISO/IEC 15417:2007, ISO/IEC 15438:2015, ISO/IEC 16022:2006,<br>"
|
||||
"ISO/IEC 16023:2000, ISO/IEC 16388:2007, ISO/IEC 18004:2015,<br>"
|
||||
"ISO/IEC 20830:2021, ISO/IEC 24723:2010, ISO/IEC 24724:2011,<br>"
|
||||
"ISO/IEC 24728:2006, ISO/IEC 24778:2008, ISO/IEC 16390:2007,<br>"
|
||||
"ISO/IEC 21471:2019, AIM USS Code One (1994), ANSI-HIBC 2.6-2016,<br>"
|
||||
"ANSI/AIM BC12-1998, ANSI/AIM BC6-2000, ANSI/AIM BC5-1995,<br>"
|
||||
"AIM ISS-X-24, AIMD014 (v 1.63), AIM ITS/04-023 (2022)"
|
||||
"ISO/IEC 24778:2008, ANSI/AIM BC12-1998, EN 798:1996,<br>"
|
||||
"AIM ISS-X-24 (1995), ISO/IEC 15417:2007, EN 12323:2005,<br>"
|
||||
"ISO/IEC 16388:2007, ANSI/AIM BC6-2000, ANSI/AIM BC5-1995,<br>"
|
||||
"AIM USS Code One (1994), ISO/IEC 16022:2006, ISO/IEC 21471:2019,<br>"
|
||||
"ISO/IEC 15420:2009, AIMD014 (v 1.63) (2008), ISO/IEC 24723:2010,<br>"
|
||||
"ISO/IEC 24724:2011, ISO/IEC 20830:2021, ISO/IEC 16390:2007,<br>"
|
||||
"ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC 15438:2015,<br>"
|
||||
"ISO/IEC 18004:2015, ISO/IEC 23941:2022, AIM ITS/04-023 (2022)"
|
||||
"</small></td></tr></table></p>").arg(zint_version).arg(QT_VERSION_STR));
|
||||
}
|
||||
|
||||
@ -548,19 +667,86 @@ void MainWindow::help()
|
||||
QDesktopServices::openUrl(QSL("https://zint.org.uk/manual")); // TODO: manual.md
|
||||
}
|
||||
|
||||
QLineEdit *MainWindow::get_seg_textbox(int seg_no)
|
||||
{
|
||||
static QLineEdit *textboxes[4] = {
|
||||
txtData, txtDataSeg1, txtDataSeg2, txtDataSeg3
|
||||
};
|
||||
return textboxes[seg_no];
|
||||
}
|
||||
|
||||
QComboBox *MainWindow::get_seg_eci(int seg_no)
|
||||
{
|
||||
static QComboBox *ecis[4] = {
|
||||
cmbECI, cmbECISeg1, cmbECISeg2, cmbECISeg3
|
||||
};
|
||||
return ecis[seg_no];
|
||||
}
|
||||
|
||||
void MainWindow::clear_data()
|
||||
{
|
||||
if (clear_data_eci_seg(0)) {
|
||||
update_preview();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::clear_data_seg1()
|
||||
{
|
||||
if (clear_data_eci_seg(1)) {
|
||||
update_preview();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::clear_data_seg2()
|
||||
{
|
||||
if (clear_data_eci_seg(2)) {
|
||||
update_preview();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::clear_data_seg3()
|
||||
{
|
||||
if (clear_data_eci_seg(3)) {
|
||||
update_preview();
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::clear_data_eci_seg(int seg_no)
|
||||
{
|
||||
QLineEdit *txt = get_seg_textbox(seg_no);
|
||||
QComboBox *cmb = get_seg_eci(seg_no);
|
||||
if (!txt->text().isEmpty() || cmb->currentIndex() != 0) {
|
||||
txt->clear();
|
||||
cmb->setCurrentIndex(0);
|
||||
txt->setFocus(Qt::OtherFocusReason);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::clear_composite()
|
||||
{
|
||||
if (!txtComposite->toPlainText().isEmpty()) {
|
||||
txtComposite->clear();
|
||||
update_preview();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::open_data_dialog_seg(const int seg_no)
|
||||
{
|
||||
if (seg_no < 0 || seg_no > 3) {
|
||||
return;
|
||||
}
|
||||
static QLineEdit *edits[4] = {
|
||||
txtData, txtDataSeg1, txtDataSeg2, txtDataSeg3
|
||||
};
|
||||
DataWindow dlg(edits[seg_no]->text(), chkEscape->isChecked());
|
||||
QLineEdit *seg_textbox = get_seg_textbox(seg_no);
|
||||
QString originalText = seg_textbox->text();
|
||||
bool originalChkEscape = chkEscape->isChecked();
|
||||
DataWindow dlg(originalText, originalChkEscape, seg_no);
|
||||
connect(&dlg, SIGNAL(dataChanged(const QString&, bool, int)), this,
|
||||
SLOT(on_dataChanged(const QString&, bool, int)));
|
||||
(void) dlg.exec();
|
||||
if (dlg.Valid) {
|
||||
const bool updated = edits[seg_no]->text() != dlg.DataOutput;
|
||||
edits[seg_no]->setText(dlg.DataOutput);
|
||||
const bool updated = originalText != dlg.DataOutput;
|
||||
seg_textbox->setText(dlg.DataOutput);
|
||||
if (updated) {
|
||||
static const QString updatedEscTxts[4] = {
|
||||
tr("Set \"Parse Escapes\", updated data"),
|
||||
@ -574,14 +760,20 @@ void MainWindow::open_data_dialog_seg(const int seg_no)
|
||||
tr("Updated segment 2 data"),
|
||||
tr("Updated segment 3 data"),
|
||||
};
|
||||
if (dlg.Escaped && !chkEscape->isChecked()) {
|
||||
if (dlg.Escaped && !originalChkEscape) {
|
||||
chkEscape->setChecked(true);
|
||||
statusBar->showMessage(updatedEscTxts[seg_no], tempMessageTimeout);
|
||||
} else {
|
||||
chkEscape->setChecked(originalChkEscape);
|
||||
statusBar->showMessage(updatedTxts[seg_no], tempMessageTimeout);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
seg_textbox->setText(originalText); // Restore
|
||||
chkEscape->setChecked(originalChkEscape);
|
||||
}
|
||||
disconnect(&dlg, SIGNAL(dataChanged(const QString&, bool, int)), this,
|
||||
SLOT(on_dataChanged(const QString&, bool, int)));
|
||||
}
|
||||
|
||||
void MainWindow::open_data_dialog()
|
||||
@ -614,6 +806,35 @@ void MainWindow::open_sequence_dialog()
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::zap()
|
||||
{
|
||||
QSettings settings;
|
||||
#if QT_VERSION < 0x60000
|
||||
settings.setIniCodec("UTF-8");
|
||||
#endif
|
||||
settings.clear();
|
||||
|
||||
int symbology = bstyle_items[bstyle->currentIndex()].symbology;
|
||||
|
||||
load_settings(settings);
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
|
||||
load_sub_settings(settings, symbology);
|
||||
|
||||
txtData->setFocus(Qt::OtherFocusReason);
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::on_dataChanged(const QString& text, bool escaped, int seg_no)
|
||||
{
|
||||
QLineEdit *seg_textbox = get_seg_textbox(seg_no);
|
||||
|
||||
chkEscape->setChecked(escaped);
|
||||
seg_textbox->setText(text);
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::open_cli_dialog()
|
||||
{
|
||||
CLIWindow dlg(&m_bc, chkAutoHeight->isEnabled() && chkAutoHeight->isChecked(),
|
||||
@ -624,26 +845,86 @@ void MainWindow::open_cli_dialog()
|
||||
|
||||
void MainWindow::on_fgcolor_clicked()
|
||||
{
|
||||
QColor temp = m_fgcolor;
|
||||
m_fgcolor = QColorDialog::getColor(m_fgcolor, this, tr("Set foreground colour"),
|
||||
QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel);
|
||||
if (m_fgcolor.isValid()) {
|
||||
update_preview();
|
||||
} else {
|
||||
m_fgcolor = temp;
|
||||
}
|
||||
color_clicked(m_fgcolor, txt_fgcolor, fgcolor, tr("Set foreground colour"), m_fgcolor_geometry,
|
||||
SLOT(fgcolor_changed(const QColor&)));
|
||||
}
|
||||
|
||||
void MainWindow::on_bgcolor_clicked()
|
||||
{
|
||||
QColor temp = m_bgcolor;
|
||||
m_bgcolor = QColorDialog::getColor(m_bgcolor, this, tr("Set background colour"),
|
||||
QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel);
|
||||
if (m_bgcolor.isValid()) {
|
||||
update_preview();
|
||||
color_clicked(m_bgcolor, txt_bgcolor, bgcolor, tr("Set background colour"), m_bgcolor_geometry,
|
||||
SLOT(bgcolor_changed(const QColor&)));
|
||||
}
|
||||
|
||||
void MainWindow::color_clicked(QColor &color, QLineEdit *txt, QPushButton *btn, const QString& title,
|
||||
QByteArray& geometry, const char *color_changed)
|
||||
{
|
||||
QColor original = color;
|
||||
|
||||
QColorDialog color_dialog(nullptr /*parent*/);
|
||||
color_dialog.setWindowTitle(title);
|
||||
color_dialog.setOptions(QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel);
|
||||
color_dialog.setCurrentColor(color);
|
||||
color_dialog.restoreGeometry(geometry);
|
||||
connect(&color_dialog, SIGNAL(currentColorChanged(const QColor &)), this, color_changed);
|
||||
|
||||
if (color_dialog.exec() && color_dialog.selectedColor().isValid()) {
|
||||
color = color_dialog.selectedColor();
|
||||
} else {
|
||||
m_bgcolor = temp;
|
||||
color = original;
|
||||
}
|
||||
geometry = color_dialog.saveGeometry();
|
||||
disconnect(&color_dialog, SIGNAL(currentColorChanged(const QColor &)), this, color_changed);
|
||||
|
||||
setColorTxtBtn(color, txt, btn);
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::fgcolor_changed(const QColor& color)
|
||||
{
|
||||
if (color.isValid()) {
|
||||
m_fgcolor = color;
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
update_preview();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::bgcolor_changed(const QColor& color)
|
||||
{
|
||||
if (color.isValid()) {
|
||||
m_bgcolor = color;
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
update_preview();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::fgcolor_edited()
|
||||
{
|
||||
color_edited(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
}
|
||||
|
||||
void MainWindow::bgcolor_edited()
|
||||
{
|
||||
color_edited(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
}
|
||||
|
||||
void MainWindow::color_edited(QColor &color, QLineEdit *txt, QPushButton *btn)
|
||||
{
|
||||
QColor new_color;
|
||||
QString new_text = txt->text().trimmed();
|
||||
if (new_text.indexOf(colorRE) != 0) {
|
||||
return;
|
||||
}
|
||||
int r = new_text.mid(0, 2).toInt(nullptr, 16);
|
||||
int g = new_text.mid(2, 2).toInt(nullptr, 16);
|
||||
int b = new_text.mid(4, 2).toInt(nullptr, 16);
|
||||
int a = new_text.length() == 8 ? new_text.mid(6, 2).toInt(nullptr, 16) : 0xFF;
|
||||
new_color.setRgb(r, g, b, a);
|
||||
if (!new_color.isValid()) {
|
||||
return;
|
||||
}
|
||||
color = new_color;
|
||||
setColorTxtBtn(color, txt, btn);
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::autoheight_ui_set()
|
||||
@ -1063,6 +1344,9 @@ void MainWindow::change_options()
|
||||
m_btnHeightPerRowDisable = nullptr;
|
||||
m_btnHeightPerRowDefault = nullptr;
|
||||
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
|
||||
if (symbology == BARCODE_CODE128) {
|
||||
QFile file(QSL(":/grpC128.ui"));
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
@ -1671,6 +1955,9 @@ void MainWindow::change_options()
|
||||
chkQuietZones->setEnabled(!m_bc.bc.hasDefaultQuietZones(symbology));
|
||||
chkDotty->setEnabled(m_bc.bc.isDotty(symbology));
|
||||
|
||||
setColorTxtBtn(m_fgcolor, txt_fgcolor, fgcolor);
|
||||
setColorTxtBtn(m_bgcolor, txt_bgcolor, bgcolor);
|
||||
|
||||
data_ui_set();
|
||||
composite_ui_set();
|
||||
autoheight_ui_set();
|
||||
@ -1693,37 +1980,72 @@ void MainWindow::data_ui_set()
|
||||
if (grpSegs->isHidden()) {
|
||||
return;
|
||||
}
|
||||
if (txtDataSeg1->text().isEmpty()) {
|
||||
|
||||
if (txtData->text().isEmpty()) {
|
||||
lblSeg1->setEnabled(false);
|
||||
cmbECISeg1->setEnabled(false);
|
||||
txtDataSeg1->setEnabled(false);
|
||||
btnMoreDataSeg1->setEnabled(false);
|
||||
btnClearDataSeg1->setEnabled(false);
|
||||
|
||||
lblSeg2->setEnabled(false);
|
||||
cmbECISeg2->setEnabled(false);
|
||||
txtDataSeg2->setEnabled(false);
|
||||
btnMoreDataSeg2->setEnabled(false);
|
||||
btnClearDataSeg2->setEnabled(false);
|
||||
|
||||
lblSeg3->setEnabled(false);
|
||||
cmbECISeg3->setEnabled(false);
|
||||
txtDataSeg3->setEnabled(false);
|
||||
btnMoreDataSeg3->setEnabled(false);
|
||||
btnClearDataSeg3->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
lblSeg1->setEnabled(true);
|
||||
txtDataSeg1->setEnabled(true);
|
||||
btnMoreDataSeg1->setEnabled(true);
|
||||
if (txtDataSeg1->text().isEmpty()) {
|
||||
cmbECISeg1->setEnabled(false);
|
||||
btnClearDataSeg1->setEnabled(false);
|
||||
|
||||
lblSeg2->setEnabled(false);
|
||||
cmbECISeg2->setEnabled(false);
|
||||
txtDataSeg2->setEnabled(false);
|
||||
btnMoreDataSeg2->setEnabled(false);
|
||||
btnClearDataSeg2->setEnabled(false);
|
||||
|
||||
lblSeg3->setEnabled(false);
|
||||
cmbECISeg3->setEnabled(false);
|
||||
txtDataSeg3->setEnabled(false);
|
||||
btnMoreDataSeg3->setEnabled(false);
|
||||
btnClearDataSeg3->setEnabled(false);
|
||||
} else {
|
||||
cmbECISeg1->setEnabled(true);
|
||||
btnClearDataSeg1->setEnabled(true);
|
||||
|
||||
lblSeg2->setEnabled(true);
|
||||
txtDataSeg2->setEnabled(true);
|
||||
btnMoreDataSeg2->setEnabled(true);
|
||||
if (txtDataSeg2->text().isEmpty()) {
|
||||
cmbECISeg2->setEnabled(false);
|
||||
btnClearDataSeg2->setEnabled(false);
|
||||
|
||||
lblSeg3->setEnabled(false);
|
||||
cmbECISeg3->setEnabled(false);
|
||||
txtDataSeg3->setEnabled(false);
|
||||
btnMoreDataSeg3->setEnabled(false);
|
||||
btnClearDataSeg3->setEnabled(false);
|
||||
} else {
|
||||
cmbECISeg2->setEnabled(true);
|
||||
btnClearDataSeg2->setEnabled(true);
|
||||
|
||||
bool data_seg3_empty = txtDataSeg3->text().isEmpty();
|
||||
lblSeg3->setEnabled(true);
|
||||
cmbECISeg3->setEnabled(!data_seg3_empty);
|
||||
txtDataSeg3->setEnabled(true);
|
||||
btnMoreDataSeg3->setEnabled(true);
|
||||
if (txtDataSeg3->text().isEmpty()) {
|
||||
cmbECISeg3->setEnabled(false);
|
||||
} else {
|
||||
cmbECISeg3->setEnabled(true);
|
||||
}
|
||||
btnClearDataSeg3->setEnabled(!data_seg3_empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1735,6 +2057,7 @@ void MainWindow::composite_ui_set()
|
||||
lblCompType->setEnabled(enabled);
|
||||
cmbCompType->setEnabled(enabled);
|
||||
lblComposite->setEnabled(enabled);
|
||||
btnClearComposite->setEnabled(enabled);
|
||||
txtComposite->setEnabled(enabled);
|
||||
|
||||
if (enabled) {
|
||||
@ -1890,7 +2213,9 @@ void MainWindow::update_preview()
|
||||
if (!grpComposite->isHidden() && chkComposite->isChecked()) {
|
||||
m_bc.bc.setPrimaryMessage(txtData->text());
|
||||
m_bc.bc.setText(txtComposite->toPlainText());
|
||||
btnClearComposite->setEnabled(!txtComposite->toPlainText().isEmpty());
|
||||
} else {
|
||||
btnClearComposite->setEnabled(false);
|
||||
if (!grpSegs->isHidden() && !txtDataSeg1->text().isEmpty()) {
|
||||
std::vector<Zint::QZintSeg> segs;
|
||||
segs.push_back(Zint::QZintSeg(txtData->text(), cmbECI->currentIndex()));
|
||||
@ -2437,6 +2762,7 @@ void MainWindow::update_preview()
|
||||
cmbECI->setEnabled(m_bc.bc.supportsECI());
|
||||
lblECI->setEnabled(cmbECI->isEnabled());
|
||||
}
|
||||
btnClearData->setEnabled(!txtData->text().isEmpty());
|
||||
chkGS1Parens->setEnabled(m_bc.bc.supportsGS1());
|
||||
chkGS1NoCheck->setEnabled(m_bc.bc.supportsGS1());
|
||||
chkRInit->setEnabled(m_bc.bc.supportsReaderInit() && (m_bc.bc.inputMode() & 0x07) != GS1_MODE);
|
||||
@ -2491,6 +2817,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 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"))));
|
||||
@ -2555,6 +2882,11 @@ void MainWindow::createActions()
|
||||
m_saveAsAct->setShortcut(QKeySequence::Save);
|
||||
connect(m_saveAsAct, SIGNAL(triggered()), this, SLOT(save()));
|
||||
|
||||
m_factoryResetAct = new QAction(zapIcon, tr("Factory &Reset..."), this);
|
||||
m_factoryResetAct->setStatusTip(tr("Clear all data & settings"));
|
||||
m_factoryResetAct->setShortcut(factoryResetSeq);
|
||||
connect(m_factoryResetAct, SIGNAL(triggered()), this, SLOT(factory_reset()));
|
||||
|
||||
m_helpAct = new QAction(helpIcon, tr("&Help (online)"), this);
|
||||
m_helpAct->setStatusTip(tr("Online manual"));
|
||||
m_helpAct->setShortcut(QKeySequence::HelpContents);
|
||||
@ -2598,6 +2930,8 @@ void MainWindow::createMenu()
|
||||
m_menu->addSeparator();
|
||||
m_menu->addAction(m_saveAsAct);
|
||||
m_menu->addSeparator();
|
||||
m_menu->addAction(m_factoryResetAct);
|
||||
m_menu->addSeparator();
|
||||
m_menu->addAction(m_helpAct);
|
||||
m_menu->addAction(m_aboutAct);
|
||||
m_menu->addSeparator();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
|
||||
* Copyright (C) 2009-2021 by Robin Stuart <rstuart114@gmail.com> *
|
||||
* Copyright (C) 2009-2022 by 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 *
|
||||
@ -13,7 +13,7 @@
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
@ -45,8 +45,14 @@ public:
|
||||
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();
|
||||
@ -61,20 +67,29 @@ public slots:
|
||||
void structapp_ui_set();
|
||||
void on_encoded();
|
||||
void on_errored();
|
||||
void on_dataChanged(const QString& text, bool escaped, int seg_no);
|
||||
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();
|
||||
|
||||
void copy_to_clipboard_bmp();
|
||||
@ -100,6 +115,16 @@ public slots:
|
||||
void errtxtBar_context_menu(const QPoint &pos);
|
||||
|
||||
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);
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
bool event(QEvent *event) override;
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
@ -122,6 +147,9 @@ protected:
|
||||
void errtxtBar_clear();
|
||||
void errtxtBar_set(bool isError);
|
||||
|
||||
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);
|
||||
@ -154,13 +182,15 @@ protected:
|
||||
void load_sub_settings(QSettings &settings, int symbology);
|
||||
|
||||
private:
|
||||
QColor m_fgcolor,m_bgcolor;
|
||||
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;
|
||||
@ -180,6 +210,7 @@ private:
|
||||
QAction *m_copyTIFAct;
|
||||
QAction *m_openCLIAct;
|
||||
QAction *m_saveAsAct;
|
||||
QAction *m_factoryResetAct;
|
||||
QAction *m_aboutAct;
|
||||
QAction *m_helpAct;
|
||||
QAction *m_quitAct;
|
||||
@ -190,4 +221,5 @@ private:
|
||||
QPushButton *m_btnHeightPerRowDefault;
|
||||
};
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif
|
||||
|
1
frontend_qt/res/black-eye.svg
Normal file
1
frontend_qt/res/black-eye.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="white" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3" fill="black"></circle></svg>
|
After Width: | Height: | Size: 324 B |
@ -1 +1 @@
|
||||
<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" class="feather feather-delete"><path d="M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"></path><line x1="18" y1="9" x2="12" y2="15"></line><line x1="12" y1="9" x2="18" y2="15"></line></svg>
|
||||
<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" class="feather feather-delete"><path d="M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"></path><line x1="18" y1="9" x2="12" y2="15"></line><line x1="12" y1="9" x2="18" y2="15"></line></svg>
|
||||
|
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 375 B |
1
frontend_qt/res/shuffle.svg
Normal file
1
frontend_qt/res/shuffle.svg
Normal file
@ -0,0 +1 @@
|
||||
<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" class="feather feather-shuffle"><polyline points="16 3 21 3 21 8"></polyline><line x1="4" y1="20" x2="21" y2="3"></line><polyline points="21 16 21 21 16 21"></polyline><line x1="15" y1="15" x2="21" y2="21"></line><line x1="4" y1="4" x2="9" y2="9"></line></svg>
|
After Width: | Height: | Size: 441 B |
1
frontend_qt/res/white-eye.svg
Normal file
1
frontend_qt/res/white-eye.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="white" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3" fill="white"></circle></svg>
|
After Width: | Height: | Size: 323 B |
1
frontend_qt/res/zap.svg
Normal file
1
frontend_qt/res/zap.svg
Normal file
@ -0,0 +1 @@
|
||||
<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" class="feather feather-zap"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>
|
After Width: | Height: | Size: 282 B |
@ -34,12 +34,16 @@
|
||||
<file>grpVIN.ui</file>
|
||||
<file>res/zint-qt.ico</file>
|
||||
<file>res/zint_black.ico</file>
|
||||
<file>res/black-eye.svg</file>
|
||||
<file>res/check.svg</file>
|
||||
<file>res/copy.svg</file>
|
||||
<file>res/delete.svg</file>
|
||||
<file>res/download.svg</file>
|
||||
<file>res/help-circle.svg</file>
|
||||
<file>res/menu.svg</file>
|
||||
<file>res/shuffle.svg</file>
|
||||
<file>res/white-eye.svg</file>
|
||||
<file>res/x.svg</file>
|
||||
<file>res/zap.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2009 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009-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,7 +16,7 @@
|
||||
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 */
|
||||
|
||||
//#include <QDebug>
|
||||
#include <QFile>
|
||||
@ -46,11 +46,13 @@ SequenceWindow::SequenceWindow(BarcodeItem *bc) : m_bc(bc)
|
||||
spnSeqEndVal->setValue(settings.value(QSL("studio/sequence/end_value"), 10).toInt());
|
||||
spnSeqIncVal->setValue(settings.value(QSL("studio/sequence/increment"), 1).toInt());
|
||||
linSeqFormat->setText(settings.value(QSL("studio/sequence/format"), QSL("$$$$$$")).toString());
|
||||
txtSeqPreview->setPlainText(settings.value(QSL("studio/sequence/preview"), QSL("")).toString());
|
||||
|
||||
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
|
||||
QIcon clearIcon(QIcon::fromTheme(QSL("edit-clear"), QIcon(QSL(":res/delete.svg"))));
|
||||
QIcon clearIcon(QSL(":res/delete.svg"));
|
||||
btnSeqClose->setIcon(closeIcon);
|
||||
btnSeqClear->setIcon(clearIcon);
|
||||
btnSeqClear->setEnabled(!txtSeqPreview->toPlainText().isEmpty());
|
||||
|
||||
connect(btnSeqClose, SIGNAL( clicked( bool )), SLOT(close()));
|
||||
connect(btnSeqClear, SIGNAL( clicked( bool )), SLOT(clear_preview()));
|
||||
@ -72,6 +74,7 @@ SequenceWindow::~SequenceWindow()
|
||||
settings.setValue(QSL("studio/sequence/end_value"), spnSeqEndVal->value());
|
||||
settings.setValue(QSL("studio/sequence/increment"), spnSeqIncVal->value());
|
||||
settings.setValue(QSL("studio/sequence/format"), linSeqFormat->text());
|
||||
settings.setValue(QSL("studio/sequence/preview"), txtSeqPreview->toPlainText());
|
||||
}
|
||||
|
||||
void SequenceWindow::clear_preview()
|
||||
@ -166,8 +169,10 @@ void SequenceWindow::check_generate()
|
||||
preview_copy = txtSeqPreview->toPlainText();
|
||||
if (preview_copy.isEmpty()) {
|
||||
btnSeqExport->setEnabled(false);
|
||||
btnSeqClear->setEnabled(false);
|
||||
} else {
|
||||
btnSeqExport->setEnabled(true);
|
||||
btnSeqClear->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,3 +216,5 @@ void SequenceWindow::generate_sequence()
|
||||
ExportWindow dlg(m_bc, txtSeqPreview->toPlainText());
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
Reference in New Issue
Block a user