fuzz.h: fix upper/lowercase flags

GUI: suppress clazy warnings
This commit is contained in:
gitlost 2024-01-05 22:55:57 +00:00
parent d42eb13841
commit f3a982c1dd
18 changed files with 450 additions and 446 deletions

View File

@ -1,7 +1,7 @@
/* aztec.h - Handles Aztec 2D Symbols */ /* aztec.h - Handles Aztec 2D Symbols */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -95,7 +95,8 @@ static const char AztecSymbolChar[128] = {
25, 26, 27, 29, 25, 30, 26, 27 25, 26, 27, 29, 25, 30, 26, 27
}; };
static const char AztecModes[129] = "BMMMMMMMMMMMMXBBBBBBBBBBBBBMMMMMXPPPPPPPPPPPXPXPDDDDDDDDDDPPPPPPMUUUUUUUUUUUUUUUUUUUUUUUUUUPMPMMMLLLLLLLLLLLLLLLLLLLLLLLLLLPMPMM"; static const char AztecModes[129] = "BMMMMMMMMMMMMXBBBBBBBBBBBBBMMMMMXPPPPPPPPPPPXPXPDDDDDDDDDDPPPPPP"
"MUUUUUUUUUUUUUUUUUUUUUUUUUUPMPMMMLLLLLLLLLLLLLLLLLLLLLLLLLLPMPMM";
static const short AztecSizes[32] = { static const short AztecSizes[32] = {
/* Codewords per symbol */ /* Codewords per symbol */

View File

@ -166,7 +166,8 @@ static int pdf_quelmode(const unsigned char codeascii) {
} }
/* Helper to switch TEX mode sub-mode */ /* Helper to switch TEX mode sub-mode */
static int pdf_textprocess_switch(const int curtable, const int newtable, unsigned char chainet[PDF_MAX_STREAM_LEN], int wnet) { static int pdf_textprocess_switch(const int curtable, const int newtable, unsigned char chainet[PDF_MAX_STREAM_LEN],
int wnet) {
switch (curtable) { switch (curtable) {
case T_ALPHA: case T_ALPHA:
switch (newtable) { switch (newtable) {

View File

@ -1,7 +1,7 @@
/* postal.c - Handles POSTNET, PLANET, CEPNet, FIM. RM4SCC and Flattermarken */ /* postal.c - Handles POSTNET, PLANET, CEPNet, FIM. RM4SCC and Flattermarken */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Including bug fixes by Bryan Hatton Including bug fixes by Bryan Hatton
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -135,7 +135,8 @@ static int usps_set_height(struct zint_symbol *symbol, const int no_errtxt) {
/* Handles the POSTNET system used for Zip codes in the US */ /* Handles the POSTNET system used for Zip codes in the US */
/* Also handles Brazilian CEPNet - more information CEPNet e Código Bidimensional Datamatrix 2D (26/05/2021) at /* Also handles Brazilian CEPNet - more information CEPNet e Código Bidimensional Datamatrix 2D (26/05/2021) at
* https://www.correios.com.br/enviar/correspondencia/arquivos/nacional/guia-tecnico-cepnet-e-2d-triagem-enderecamento-27-04-2021.pdf/view https://www.correios.com.br/enviar/correspondencia/arquivos/nacional/
guia-tecnico-cepnet-e-2d-triagem-enderecamento-27-04-2021.pdf/view
*/ */
static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[], char *d, const int length) { static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[], char *d, const int length) {
int i, sum, check_digit; int i, sum, check_digit;

View File

@ -81,8 +81,8 @@
#define IS_UHX_F (IS_UAD_F | IS_UBC_F | IS_UE__F | IS_UF__F) /* Uppercase hex */ #define IS_UHX_F (IS_UAD_F | IS_UBC_F | IS_UE__F | IS_UF__F) /* Uppercase hex */
#define IS_LHX_F (IS_LAD_F | IS_LBC_F | IS_LE__F | IS_LF__F) /* Lowercase hex */ #define IS_LHX_F (IS_LAD_F | IS_LBC_F | IS_LE__F | IS_LF__F) /* Lowercase hex */
#define IS_UPR_F (IS_UPO_F | IS_UHX_F) /* Uppercase letters */ #define IS_UPR_F (IS_UPO_F | IS_UHX_F | IS_UT__F | IS_UX__F) /* Uppercase letters */
#define IS_LWR_F (IS_LWO_F | IS_LHX_F) /* Lowercase letters */ #define IS_LWR_F (IS_LWO_F | IS_LHX_F | IS_LT__F | IS_LX__F) /* Lowercase letters */
/* Flag table for `is_chr()` and `is_sane()` (taken from "backend/common.c") */ /* Flag table for `is_chr()` and `is_sane()` (taken from "backend/common.c") */
#define IS_CLS_F (IS_CLI_F | IS_SIL_F) #define IS_CLS_F (IS_CLI_F | IS_SIL_F)

View File

@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2008 by BogDan Vatra * * Copyright (C) 2008 by BogDan Vatra *
* bogdan@licentia.eu * * bogdan@licentia.eu *
* Copyright (C) 2010-2023 Robin Stuart * * Copyright (C) 2010-2024 Robin Stuart *
* * * *
* This program is free software: you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
@ -23,27 +23,30 @@
#endif #endif
//#include <QDebug> //#include <QDebug>
#include "qzint.h"
#include <math.h>
#include <stdio.h>
#include <QFontDatabase> #include <QFontDatabase>
#include <QFontMetrics> #include <QFontMetrics>
/* The following include is necessary to compile with Qt 5.15 on Windows; Qt 5.7 did not require it */ /* The following include is necessary to compile with Qt 5.15 on Windows; Qt 5.7 did not require it */
#include <QPainterPath> #include <QPainterPath>
#include <QRegularExpression> #include <QRegularExpression>
#include <math.h>
#include <stdio.h>
#include "qzint.h"
#include "../backend/fonts/normal_ttf.h" /* Arimo */ #include "../backend/fonts/normal_ttf.h" /* Arimo */
#include "../backend/fonts/upcean_ttf.h" /* OCR-B subset (digits, "<", ">") */ #include "../backend/fonts/upcean_ttf.h" /* OCR-B subset (digits, "<", ">") */
// Shorthand // Shorthand
#define QSL QStringLiteral #define QSL QStringLiteral
#define QSEmpty QLatin1String("")
namespace Zint { namespace Zint {
static const int maxSegs = 256; static const int maxSegs = 256;
static const int maxCLISegs = 10; /* CLI restricted to 10 segments (including main data) */ static const int maxCLISegs = 10; /* CLI restricted to 10 segments (including main data) */
/* Matches RGB(A) hex string or CMYK decimal "C,M,Y,K" percentage string */ /* Matches RGB(A) hex string or CMYK decimal "C,M,Y,K" percentage string */
static const QRegularExpression colorRE( static const QString colorREstr(
QSL("^([0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?)|(((100|[0-9]{0,2}),){3}(100|[0-9]{0,2}))$")); QSL("^([0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?)|(((100|[0-9]{0,2}),){3}(100|[0-9]{0,2}))$"));
Q_GLOBAL_STATIC_WITH_ARGS(QRegularExpression, colorRE, (colorREstr));
static const QString normalFontFamily = QSL("Arimo"); /* Sans-serif metrically compatible with Arial */ static const QString normalFontFamily = QSL("Arimo"); /* Sans-serif metrically compatible with Arial */
static const QString upceanFontFamily = QSL("OCRB"); /* Monospace OCR-B */ static const QString upceanFontFamily = QSL("OCRB"); /* Monospace OCR-B */
@ -88,19 +91,19 @@ namespace Zint {
int comma1 = text.indexOf(','); int comma1 = text.indexOf(',');
int comma2 = text.indexOf(',', comma1 + 1); int comma2 = text.indexOf(',', comma1 + 1);
int comma3 = text.indexOf(',', comma2 + 1); int comma3 = text.indexOf(',', comma2 + 1);
int black = 100 - text.mid(comma3 + 1).toInt(); int black = 100 - text.midRef(comma3 + 1).toInt();
int val = 100 - text.mid(0, comma1).toInt(); int val = 100 - text.midRef(0, comma1).toInt();
r = (int) roundf((0xFF * val * black) / 10000.0f); r = (int) roundf((0xFF * val * black) / 10000.0f);
val = 100 - text.mid(comma1 + 1, comma2 - comma1 - 1).toInt(); val = 100 - text.midRef(comma1 + 1, comma2 - comma1 - 1).toInt();
g = (int) roundf((0xFF * val * black) / 10000.0f); g = (int) roundf((0xFF * val * black) / 10000.0f);
val = 100 - text.mid(comma2 + 1, comma3 - comma2 - 1).toInt(); val = 100 - text.midRef(comma2 + 1, comma3 - comma2 - 1).toInt();
b = (int) roundf((0xFF * val * black) / 10000.0f); b = (int) roundf((0xFF * val * black) / 10000.0f);
a = 0xFF; a = 0xFF;
} else { } else {
r = text.mid(0, 2).toInt(nullptr, 16); r = text.midRef(0, 2).toInt(nullptr, 16);
g = text.mid(2, 2).toInt(nullptr, 16); g = text.midRef(2, 2).toInt(nullptr, 16);
b = text.mid(4, 2).toInt(nullptr, 16); b = text.midRef(4, 2).toInt(nullptr, 16);
a = text.length() == 8 ? text.mid(6, 2).toInt(nullptr, 16) : 0xFF; a = text.length() == 8 ? text.midRef(6, 2).toInt(nullptr, 16) : 0xFF;
} }
color.setRgb(r, g, b, a); color.setRgb(r, g, b, a);
return color; return color;
@ -488,7 +491,7 @@ namespace Zint {
} }
bool QZint::setFgStr(const QString& fgStr) { bool QZint::setFgStr(const QString& fgStr) {
if (fgStr.indexOf(colorRE) == 0) { if (fgStr.indexOf(*colorRE) == 0) {
m_fgStr = fgStr; m_fgStr = fgStr;
return true; return true;
} }
@ -510,7 +513,7 @@ namespace Zint {
} }
bool QZint::setBgStr(const QString& bgStr) { bool QZint::setBgStr(const QString& bgStr) {
if (bgStr.indexOf(colorRE) == 0) { if (bgStr.indexOf(*colorRE) == 0) {
m_bgStr = bgStr; m_bgStr = bgStr;
return true; return true;
} }
@ -1195,7 +1198,7 @@ namespace Zint {
if (ZBarcode_BarcodeName(symbology, buf) == 0) { if (ZBarcode_BarcodeName(symbology, buf) == 0) {
return QString(buf); return QString(buf);
} }
return QSL(""); return QSEmpty;
} }
/* Whether Zint library "libzint" built with PNG support or not */ /* Whether Zint library "libzint" built with PNG support or not */

View File

@ -24,7 +24,6 @@
#ifndef QZINT_H #ifndef QZINT_H
#define QZINT_H #define QZINT_H
#include <QObject>
#include <QColor> #include <QColor>
#include <QPainter> #include <QPainter>
#include "zint.h" #include "zint.h"

View File

@ -14,7 +14,8 @@
***************************************************************************/ ***************************************************************************/
/* SPDX-License-Identifier: GPL-3.0-or-later */ /* SPDX-License-Identifier: GPL-3.0-or-later */
#include <QtTest/QtTest> #include <QtTest/QSignalSpy>
#include <QtTest/QTest>
#include "../qzint.h" /* Don't use <qzint.h> in case it's been changed */ #include "../qzint.h" /* Don't use <qzint.h> in case it's been changed */
#ifndef ARRAY_SIZE #ifndef ARRAY_SIZE

View File

@ -1,5 +1,6 @@
# Makefile for generating "manual.txt" and "manual.pdf" from "manual.pmd" and "zint.1" from "zint.1.pmd" using pandoc # Makefile for generating "manual.txt" and "manual.pdf" from "manual.pmd" and "zint.1" from "zint.1.pmd" using pandoc
# Copyright (C) 2022-2023 <rstuart114@gmail.com> # Copyright (C) 2022-2024 <rstuart114@gmail.com>
# vim: set ts=4 sw=4 noet :
# #
# Requires a recent version of pandoc, plus pandoc-tablenos, xelatex and various other packages - see "README" # Requires a recent version of pandoc, plus pandoc-tablenos, xelatex and various other packages - see "README"
# .svg images generated by "zint_images.sh" # .svg images generated by "zint_images.sh"

View File

@ -1,6 +1,6 @@
/* /*
Zint Barcode Generator - the open source barcode generator Zint Barcode Generator - the open source barcode generator
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2021-2024 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -19,14 +19,15 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */ /* SPDX-License-Identifier: GPL-3.0-or-later */
//#include <QDebug> //#include <QDebug>
#include <QSettings>
#include <QClipboard> #include <QClipboard>
#include <QMimeData> #include <QMimeData>
#include <QSettings>
#include "cliwindow.h" #include "cliwindow.h"
// Shorthand // Shorthand
#define QSL QStringLiteral #define QSL QStringLiteral
#define QSEmpty QLatin1String("")
static const int tempMessageTimeout = 2000; static const int tempMessageTimeout = 2000;
@ -107,7 +108,7 @@ void CLIWindow::generate_cli()
chkCLINoEXE->setEnabled(false); chkCLINoEXE->setEnabled(false);
} }
QString cmd = m_bc->bc.getAsCLI(radCLIWin->isChecked(), chkCLILongOpts->isChecked(), QString cmd = m_bc->bc.getAsCLI(radCLIWin->isChecked(), chkCLILongOpts->isChecked(),
chkCLIBarcodeName->isChecked(), noEXE, m_autoHeight, m_heightPerRow, QSL("") /*outfile*/, chkCLIBarcodeName->isChecked(), noEXE, m_autoHeight, m_heightPerRow, QSEmpty /*outfile*/,
m_xdimdpVars); m_xdimdpVars);
txtCLICmd->setPlainText(cmd); txtCLICmd->setPlainText(cmd);

View File

@ -1,6 +1,6 @@
/* /*
Zint Barcode Generator - the open source barcode generator Zint Barcode Generator - the open source barcode generator
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -20,11 +20,11 @@
//#include <QDebug> //#include <QDebug>
#include <QFileDialog> #include <QFileDialog>
#include <QUiLoader>
#include <QStringList>
#include <QMessageBox> #include <QMessageBox>
#include <QSettings>
#include <QRegularExpression> #include <QRegularExpression>
#include <QSettings>
#include <QStringList>
#include <QUiLoader>
#include "datawindow.h" #include "datawindow.h"
@ -67,7 +67,7 @@ DataWindow::DataWindow(const QString &input, bool isEscaped, int seg_no) : Valid
lastPosn = match.capturedEnd(0); lastPosn = match.capturedEnd(0);
} }
} }
out += input.mid(lastPosn); out += input.midRef(lastPosn);
txtDataInput->setPlainText(out); txtDataInput->setPlainText(out);
statusBarData->showMessage(tr("Converted LFs"), tempMessageTimeout); statusBarData->showMessage(tr("Converted LFs"), tempMessageTimeout);
} else { } else {

View File

@ -1,6 +1,6 @@
/* /*
Zint Barcode Generator - the open source barcode generator Zint Barcode Generator - the open source barcode generator
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -19,16 +19,17 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */ /* SPDX-License-Identifier: GPL-3.0-or-later */
//#include <QDebug> //#include <QDebug>
#include <QUiLoader>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QSettings> #include <QSettings>
#include <QStringBuilder> #include <QStringBuilder>
#include <QUiLoader>
#include "exportwindow.h" #include "exportwindow.h"
// Shorthand // Shorthand
#define QSL QStringLiteral #define QSL QStringLiteral
#define QSEmpty QLatin1String("")
ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data) ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data)
: m_bc(bc), m_output_data(output_data), m_lines(0) : m_bc(bc), m_output_data(output_data), m_lines(0)
@ -50,7 +51,7 @@ ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data)
linDestPath->setText(settings.value(QSL("studio/export/destination"), linDestPath->setText(settings.value(QSL("studio/export/destination"),
QDir::toNativeSeparators(QDir::homePath())).toString()); QDir::toNativeSeparators(QDir::homePath())).toString());
linPrefix->setText(settings.value(QSL("studio/export/file_prefix"), QSL("bcs_")).toString()); linPrefix->setText(settings.value(QSL("studio/export/file_prefix"), QSL("bcs_")).toString());
linPostfix->setText(settings.value(QSL("studio/export/file_postfix"), QSL("")).toString()); linPostfix->setText(settings.value(QSL("studio/export/file_postfix"), QSEmpty).toString());
cmbFileName->setCurrentIndex(settings.value(QSL("studio/export/name_format"), 0).toInt()); cmbFileName->setCurrentIndex(settings.value(QSL("studio/export/name_format"), 0).toInt());
cmbFileType->setCurrentIndex(std::min(settings.value(QSL("studio/export/filetype"), 0).toInt(), cmbFileType->setCurrentIndex(std::min(settings.value(QSL("studio/export/filetype"), 0).toInt(),
cmbFileType->count() - 1)); cmbFileType->count() - 1));

View File

@ -16,23 +16,28 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */ /* SPDX-License-Identifier: GPL-3.0-or-later */
//#include <QDebug> //#include <QDebug>
#include <QAction>
#include <QClipboard>
#include <QColor>
#include <QColorDialog>
#include <QDesktopServices>
#include <QFile>
#include <QFileDialog>
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QImage> #include <QImage>
#include <QColorDialog>
#include <QUiLoader>
#include <QFile>
#include <QRadioButton>
#include <QFileDialog>
#include <QMessageBox>
#include <QSettings>
#include <QClipboard>
#include <QMimeData>
#include <QColor>
#include <QListView> #include <QListView>
#include <QShortcut>
#include <QMenu> #include <QMenu>
#include <QAction> #include <QMessageBox>
#include <QMimeData>
#include <QRadioButton>
#include <QScreen>
#include <QSettings>
#include <QShortcut>
#include <QStandardItemModel>
#include <QTextStream>
#include <QUiLoader>
#include <math.h>
#include "mainwindow.h" #include "mainwindow.h"
#include "cliwindow.h" #include "cliwindow.h"
#include "datawindow.h" #include "datawindow.h"
@ -41,25 +46,27 @@
// Shorthand // Shorthand
#define QSL QStringLiteral #define QSL QStringLiteral
#define QSEmpty QLatin1String("")
static const int tempMessageTimeout = 2000; static const int tempMessageTimeout = 2000;
static const QKeySequence quitKeySeq(Qt::CTRL | Qt::Key_Q); // Use on Windows also (i.e. not using QKeySequence::Quit) // Use on Windows also (i.e. not using QKeySequence::Quit)
Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, quitKeySeq, (Qt::CTRL | Qt::Key_Q));
static const QKeySequence openCLISeq(Qt::SHIFT | Qt::CTRL | Qt::Key_C); Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, openCLISeq, (Qt::SHIFT | Qt::CTRL | Qt::Key_C));
static const QKeySequence copyBMPSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_B); Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, copyBMPSeq, (Qt::SHIFT | Qt::CTRL | Qt::Key_B));
static const QKeySequence copyEMFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_E); Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, copyEMFSeq, (Qt::SHIFT | Qt::CTRL | Qt::Key_E));
static const QKeySequence copyGIFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_G); Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, copyGIFSeq, (Qt::SHIFT | Qt::CTRL | Qt::Key_G));
static const QKeySequence copyPNGSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_P); Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, copyPNGSeq, (Qt::SHIFT | Qt::CTRL | Qt::Key_P));
static const QKeySequence copySVGSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_S); Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, copySVGSeq, (Qt::SHIFT | Qt::CTRL | Qt::Key_S));
static const QKeySequence copyTIFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_T); Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, copyTIFSeq, (Qt::SHIFT | Qt::CTRL | Qt::Key_T));
static const QKeySequence factoryResetSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_R); Q_GLOBAL_STATIC_WITH_ARGS(QKeySequence, factoryResetSeq, (Qt::SHIFT | Qt::CTRL | Qt::Key_R));
// RGB hexadecimal 6 or 8 in length or CMYK comma-separated decimal percentages "C,M,Y,K" // RGB hexadecimal 6 or 8 in length or CMYK comma-separated decimal percentages "C,M,Y,K"
static const QRegularExpression colorRE( static const QString colorREstr(QSL("^([0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?)|(((100|[0-9]{0,2}),){3}(100|[0-9]{0,2}))$"));
QSL("^([0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?)|(((100|[0-9]{0,2}),){3}(100|[0-9]{0,2}))$")); Q_GLOBAL_STATIC_WITH_ARGS(QRegularExpression, colorRE, (colorREstr));
static const QString fgDefault(QSL("000000")); static const QString fgDefault(QSL("000000"));
static const QString bgDefault(QSL("FFFFFF")); static const QString bgDefault(QSL("FFFFFF"));
@ -82,19 +89,19 @@ static QColor str_to_qcolor(const QString &str)
int comma1 = str.indexOf(','); int comma1 = str.indexOf(',');
int comma2 = str.indexOf(',', comma1 + 1); int comma2 = str.indexOf(',', comma1 + 1);
int comma3 = str.indexOf(',', comma2 + 1); int comma3 = str.indexOf(',', comma2 + 1);
int black = 100 - str.mid(comma3 + 1).toInt(); int black = 100 - str.midRef(comma3 + 1).toInt();
int val = 100 - str.mid(0, comma1).toInt(); int val = 100 - str.midRef(0, comma1).toInt();
r = (int) roundf((0xFF * val * black) / 10000.0f); r = (int) roundf((0xFF * val * black) / 10000.0f);
val = 100 - str.mid(comma1 + 1, comma2 - comma1 - 1).toInt(); val = 100 - str.midRef(comma1 + 1, comma2 - comma1 - 1).toInt();
g = (int) roundf((0xFF * val * black) / 10000.0f); g = (int) roundf((0xFF * val * black) / 10000.0f);
val = 100 - str.mid(comma2 + 1, comma3 - comma2 - 1).toInt(); val = 100 - str.midRef(comma2 + 1, comma3 - comma2 - 1).toInt();
b = (int) roundf((0xFF * val * black) / 10000.0f); b = (int) roundf((0xFF * val * black) / 10000.0f);
a = 0xFF; a = 0xFF;
} else { } else {
r = str.mid(0, 2).toInt(nullptr, 16); r = str.midRef(0, 2).toInt(nullptr, 16);
g = str.mid(2, 2).toInt(nullptr, 16); g = str.midRef(2, 2).toInt(nullptr, 16);
b = str.mid(4, 2).toInt(nullptr, 16); b = str.midRef(4, 2).toInt(nullptr, 16);
a = str.length() == 8 ? str.mid(6, 2).toInt(nullptr, 16) : 0xFF; a = str.length() == 8 ? str.midRef(6, 2).toInt(nullptr, 16) : 0xFF;
} }
color.setRgb(r, g, b, a); color.setRgb(r, g, b, a);
return color; return color;
@ -270,7 +277,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
bgcolor->setIcon(QIcon(QSL(":res/white-eye.svg"))); bgcolor->setIcon(QIcon(QSL(":res/white-eye.svg")));
btnReverse->setIcon(QIcon(QSL(":res/shuffle.svg"))); btnReverse->setIcon(QIcon(QSL(":res/shuffle.svg")));
QRegularExpressionValidator *colorValidator = new QRegularExpressionValidator(colorRE, this); QRegularExpressionValidator *colorValidator = new QRegularExpressionValidator(*colorRE, this);
txt_fgcolor->setValidator(colorValidator); txt_fgcolor->setValidator(colorValidator);
txt_bgcolor->setValidator(colorValidator); txt_bgcolor->setValidator(colorValidator);
@ -311,7 +318,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
connect(bstyle, SIGNAL(currentIndexChanged(int)), SLOT(change_options())); connect(bstyle, SIGNAL(currentIndexChanged(int)), SLOT(change_options()));
connect(bstyle, SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(bstyle, SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(filter_bstyle, SIGNAL(textChanged( const QString& )), SLOT(filter_symbologies())); connect(filter_bstyle, SIGNAL(textChanged(QString)), SLOT(filter_symbologies()));
connect(heightb, SIGNAL(valueChanged(double)), SLOT(update_preview())); connect(heightb, SIGNAL(valueChanged(double)), SLOT(update_preview()));
connect(bwidth, SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(bwidth, SIGNAL(valueChanged(int)), SLOT(update_preview()));
connect(btype, SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(btype, SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
@ -319,15 +326,15 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
connect(spnTextGap, SIGNAL(valueChanged(double)), SLOT(text_gap_ui_set())); connect(spnTextGap, SIGNAL(valueChanged(double)), SLOT(text_gap_ui_set()));
connect(spnTextGap, SIGNAL(valueChanged(double)), SLOT(update_preview())); connect(spnTextGap, SIGNAL(valueChanged(double)), SLOT(update_preview()));
connect(btnClearTextGap, SIGNAL(clicked(bool)), SLOT(clear_text_gap())); connect(btnClearTextGap, SIGNAL(clicked(bool)), SLOT(clear_text_gap()));
connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(data_ui_set())); connect(txtData, SIGNAL(textChanged(QString)), SLOT(data_ui_set()));
connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(upcae_no_quiet_zones_ui_set())); connect(txtData, SIGNAL(textChanged(QString)), SLOT(upcae_no_quiet_zones_ui_set()));
connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(update_preview())); connect(txtData, SIGNAL(textChanged(QString)), SLOT(update_preview()));
connect(txtDataSeg1, SIGNAL(textChanged( const QString& )), SLOT(data_ui_set())); connect(txtDataSeg1, SIGNAL(textChanged(QString)), SLOT(data_ui_set()));
connect(txtDataSeg1, SIGNAL(textChanged( const QString& )), SLOT(update_preview())); connect(txtDataSeg1, SIGNAL(textChanged(QString)), SLOT(update_preview()));
connect(txtDataSeg2, SIGNAL(textChanged( const QString& )), SLOT(data_ui_set())); connect(txtDataSeg2, SIGNAL(textChanged(QString)), SLOT(data_ui_set()));
connect(txtDataSeg2, SIGNAL(textChanged( const QString& )), SLOT(update_preview())); connect(txtDataSeg2, SIGNAL(textChanged(QString)), SLOT(update_preview()));
connect(txtDataSeg3, SIGNAL(textChanged( const QString& )), SLOT(data_ui_set())); connect(txtDataSeg3, SIGNAL(textChanged(QString)), SLOT(data_ui_set()));
connect(txtDataSeg3, SIGNAL(textChanged( const QString& )), SLOT(update_preview())); connect(txtDataSeg3, SIGNAL(textChanged(QString)), SLOT(update_preview()));
connect(txtComposite, SIGNAL(textChanged()), SLOT(update_preview())); connect(txtComposite, SIGNAL(textChanged()), SLOT(update_preview()));
connect(chkComposite, SIGNAL(toggled(bool)), SLOT(composite_ui_set())); connect(chkComposite, SIGNAL(toggled(bool)), SLOT(composite_ui_set()));
connect(chkComposite, SIGNAL(toggled(bool)), SLOT(update_preview())); connect(chkComposite, SIGNAL(toggled(bool)), SLOT(update_preview()));
@ -378,36 +385,35 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
connect(&m_bc.bc, SIGNAL(encoded()), SLOT(on_encoded())); connect(&m_bc.bc, SIGNAL(encoded()), SLOT(on_encoded()));
connect(&m_bc.bc, SIGNAL(errored()), SLOT(on_errored())); connect(&m_bc.bc, SIGNAL(errored()), SLOT(on_errored()));
connect(view, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(view_context_menu(const QPoint &))); connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(view_context_menu(QPoint)));
connect(errtxtBar, SIGNAL(customContextMenuRequested(const QPoint &)), this, connect(errtxtBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(errtxtBar_context_menu(QPoint)));
SLOT(errtxtBar_context_menu(const QPoint &)));
// Will enable/disable these on error // Will enable/disable these on error
m_saveAsShortcut = new QShortcut(QKeySequence::Save, this); m_saveAsShortcut = new QShortcut(QKeySequence::Save, this);
connect(m_saveAsShortcut, SIGNAL(activated()), SLOT(save())); connect(m_saveAsShortcut, SIGNAL(activated()), SLOT(save()));
m_openCLIShortcut = new QShortcut(openCLISeq, this); m_openCLIShortcut = new QShortcut(*openCLISeq, this);
connect(m_openCLIShortcut, SIGNAL(activated()), SLOT(open_cli_dialog())); connect(m_openCLIShortcut, SIGNAL(activated()), SLOT(open_cli_dialog()));
m_copyBMPShortcut = new QShortcut(copyBMPSeq, this); m_copyBMPShortcut = new QShortcut(*copyBMPSeq, this);
connect(m_copyBMPShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_bmp())); connect(m_copyBMPShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_bmp()));
m_copyEMFShortcut = new QShortcut(copyEMFSeq, this); m_copyEMFShortcut = new QShortcut(*copyEMFSeq, this);
connect(m_copyEMFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_emf())); connect(m_copyEMFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_emf()));
m_copyGIFShortcut = new QShortcut(copyGIFSeq, this); m_copyGIFShortcut = new QShortcut(*copyGIFSeq, this);
connect(m_copyGIFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_gif())); connect(m_copyGIFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_gif()));
if (!m_bc.bc.noPng()) { if (!m_bc.bc.noPng()) {
m_copyPNGShortcut = new QShortcut(copyPNGSeq, this); m_copyPNGShortcut = new QShortcut(*copyPNGSeq, this);
connect(m_copyPNGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_png())); connect(m_copyPNGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_png()));
} }
m_copySVGShortcut = new QShortcut(copySVGSeq, this); m_copySVGShortcut = new QShortcut(*copySVGSeq, this);
connect(m_copySVGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_svg())); connect(m_copySVGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_svg()));
m_copyTIFShortcut = new QShortcut(copyTIFSeq, this); m_copyTIFShortcut = new QShortcut(*copyTIFSeq, this);
connect(m_copyTIFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_tif())); connect(m_copyTIFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_tif()));
m_factoryResetShortcut = new QShortcut(factoryResetSeq, this); m_factoryResetShortcut = new QShortcut(*factoryResetSeq, this);
connect(m_factoryResetShortcut, SIGNAL(activated()), SLOT(factory_reset())); connect(m_factoryResetShortcut, SIGNAL(activated()), SLOT(factory_reset()));
QShortcut *helpShortcut = new QShortcut(QKeySequence::HelpContents, this); QShortcut *helpShortcut = new QShortcut(QKeySequence::HelpContents, this);
connect(helpShortcut, SIGNAL(activated()), SLOT(help())); connect(helpShortcut, SIGNAL(activated()), SLOT(help()));
QShortcut *quitShortcut = new QShortcut(quitKeySeq, this); QShortcut *quitShortcut = new QShortcut(*quitKeySeq, this);
connect(quitShortcut, SIGNAL(activated()), SLOT(quit_now())); connect(quitShortcut, SIGNAL(activated()), SLOT(quit_now()));
createActions(); createActions();
@ -480,7 +486,7 @@ void MainWindow::load_settings(QSettings &settings)
bool initial_load = m_symbology == 0; bool initial_load = m_symbology == 0;
QString initialData(initial_load ? tr("Your Data Here!") : ""); QString initialData(initial_load ? tr("Your Data Here!") : "");
m_fgstr = settings.value(QSL("studio/ink/text"), QSL("")).toString(); m_fgstr = settings.value(QSL("studio/ink/text"), QSEmpty).toString();
if (m_fgstr.isEmpty()) { if (m_fgstr.isEmpty()) {
QColor color(settings.value(QSL("studio/ink/red"), 0).toInt(), QColor color(settings.value(QSL("studio/ink/red"), 0).toInt(),
settings.value(QSL("studio/ink/green"), 0).toInt(), settings.value(QSL("studio/ink/green"), 0).toInt(),
@ -488,10 +494,10 @@ void MainWindow::load_settings(QSettings &settings)
settings.value(QSL("studio/ink/alpha"), 0xff).toInt()); settings.value(QSL("studio/ink/alpha"), 0xff).toInt());
m_fgstr = qcolor_to_str(color); m_fgstr = qcolor_to_str(color);
} }
if (m_fgstr.indexOf(colorRE) != 0) { if (m_fgstr.indexOf(*colorRE) != 0) {
m_fgstr = fgDefault; m_fgstr = fgDefault;
} }
m_bgstr = settings.value(QSL("studio/paper/text"), QSL("")).toString(); m_bgstr = settings.value(QSL("studio/paper/text"), QSEmpty).toString();
if (m_bgstr.isEmpty()) { if (m_bgstr.isEmpty()) {
QColor color(settings.value(QSL("studio/paper/red"), 0).toInt(), QColor color(settings.value(QSL("studio/paper/red"), 0).toInt(),
settings.value(QSL("studio/paper/green"), 0).toInt(), settings.value(QSL("studio/paper/green"), 0).toInt(),
@ -499,7 +505,7 @@ void MainWindow::load_settings(QSettings &settings)
settings.value(QSL("studio/paper/alpha"), 0xff).toInt()); settings.value(QSL("studio/paper/alpha"), 0xff).toInt());
m_bgstr = qcolor_to_str(color); m_bgstr = qcolor_to_str(color);
} }
if (m_bgstr.indexOf(colorRE) != 0) { if (m_bgstr.indexOf(*colorRE) != 0) {
m_bgstr = bgDefault; m_bgstr = bgDefault;
} }
@ -730,7 +736,7 @@ bool MainWindow::save()
} else { } else {
QString filename = nativePathname.right(nativePathname.length() - (lastSeparator + 1)); QString filename = nativePathname.right(nativePathname.length() - (lastSeparator + 1));
/*: %1 is base filename saved to, %2 is directory saved in */ /*: %1 is base filename saved to, %2 is directory saved in */
statusBar->showMessage(tr("Saved as \"%1\" in \"%2\"").arg(filename).arg(dirname), 0 /*No timeout*/); statusBar->showMessage(tr("Saved as \"%1\" in \"%2\"").arg(filename, dirname), 0 /*No timeout*/);
} }
settings.setValue(QSL("studio/default_dir"), dirname); settings.setValue(QSL("studio/default_dir"), dirname);
@ -794,7 +800,7 @@ void MainWindow::about()
"<p>With thanks to Harald Oehlmann, Norbert Szab&oacute;, Robert Elliott, Milton Neal, " "<p>With thanks to Harald Oehlmann, Norbert Szab&oacute;, Robert Elliott, Milton Neal, "
"Git Lost, Alonso Schaich, Andre Maute and many others at " "Git Lost, Alonso Schaich, Andre Maute and many others at "
"<a href=\"https://sourceforge.net/projects/zint/\">SourceForge</a>.</p>" "<a href=\"https://sourceforge.net/projects/zint/\">SourceForge</a>.</p>"
).arg(zint_version).arg(QT_VERSION_STR)); ).arg(zint_version, QT_VERSION_STR));
} }
void MainWindow::help() void MainWindow::help()
@ -809,14 +815,12 @@ void MainWindow::preview_bg()
color_dialog.setOptions(QColorDialog::DontUseNativeDialog); color_dialog.setOptions(QColorDialog::DontUseNativeDialog);
color_dialog.setCurrentColor(m_previewBgColor); color_dialog.setCurrentColor(m_previewBgColor);
color_dialog.restoreGeometry(m_previewbgcolor_geometry); color_dialog.restoreGeometry(m_previewbgcolor_geometry);
connect(&color_dialog, SIGNAL(currentColorChanged(const QColor &)), this, connect(&color_dialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(previewbgcolor_changed(QColor)));
SLOT(previewbgcolor_changed(const QColor&)));
if (color_dialog.exec() && color_dialog.selectedColor().isValid()) { if (color_dialog.exec() && color_dialog.selectedColor().isValid()) {
m_previewBgColor = color_dialog.selectedColor(); m_previewBgColor = color_dialog.selectedColor();
} }
m_previewbgcolor_geometry = color_dialog.saveGeometry(); m_previewbgcolor_geometry = color_dialog.saveGeometry();
disconnect(&color_dialog, SIGNAL(currentColorChanged(const QColor &)), this, disconnect(&color_dialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(previewbgcolor_changed(QColor)));
SLOT(previewbgcolor_changed(const QColor&)));
m_bc.setColor(m_previewBgColor); m_bc.setColor(m_previewBgColor);
update_preview(); update_preview();
@ -909,8 +913,7 @@ void MainWindow::open_data_dialog_seg(const int seg_no)
mac_hack_statusBars(&dlg); mac_hack_statusBars(&dlg);
#endif #endif
connect(&dlg, SIGNAL(dataChanged(const QString&, bool, int)), this, connect(&dlg, SIGNAL(dataChanged(QString,bool,int)), this, SLOT(on_dataChanged(QString,bool,int)));
SLOT(on_dataChanged(const QString&, bool, int)));
(void) dlg.exec(); (void) dlg.exec();
if (dlg.Valid) { if (dlg.Valid) {
const bool updated = originalText != dlg.DataOutput; const bool updated = originalText != dlg.DataOutput;
@ -940,8 +943,7 @@ void MainWindow::open_data_dialog_seg(const int seg_no)
seg_textbox->setText(originalText); // Restore seg_textbox->setText(originalText); // Restore
chkEscape->setChecked(originalChkEscape); chkEscape->setChecked(originalChkEscape);
} }
disconnect(&dlg, SIGNAL(dataChanged(const QString&, bool, int)), this, disconnect(&dlg, SIGNAL(dataChanged(QString,bool,int)), this, SLOT(on_dataChanged(QString,bool,int)));
SLOT(on_dataChanged(const QString&, bool, int)));
} }
void MainWindow::open_data_dialog() void MainWindow::open_data_dialog()
@ -1049,13 +1051,13 @@ void MainWindow::open_scale_dialog()
m_scaleWindow = nullptr; m_scaleWindow = nullptr;
} }
void MainWindow::on_fgcolor_clicked() void MainWindow::fgcolor_clicked()
{ {
color_clicked(m_fgstr, txt_fgcolor, fgcolor, tr("Set foreground colour"), m_fgcolor_geometry, color_clicked(m_fgstr, txt_fgcolor, fgcolor, tr("Set foreground colour"), m_fgcolor_geometry,
SLOT(fgcolor_changed(const QColor&))); SLOT(fgcolor_changed(const QColor&)));
} }
void MainWindow::on_bgcolor_clicked() void MainWindow::bgcolor_clicked()
{ {
color_clicked(m_bgstr, txt_bgcolor, bgcolor, tr("Set background colour"), m_bgcolor_geometry, color_clicked(m_bgstr, txt_bgcolor, bgcolor, tr("Set background colour"), m_bgcolor_geometry,
SLOT(bgcolor_changed(const QColor&))); SLOT(bgcolor_changed(const QColor&)));
@ -1071,7 +1073,7 @@ void MainWindow::color_clicked(QString &colorStr, QLineEdit *txt, QToolButton *b
color_dialog.setOptions(QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel); color_dialog.setOptions(QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel);
color_dialog.setCurrentColor(str_to_qcolor(colorStr)); color_dialog.setCurrentColor(str_to_qcolor(colorStr));
color_dialog.restoreGeometry(geometry); color_dialog.restoreGeometry(geometry);
connect(&color_dialog, SIGNAL(currentColorChanged(const QColor &)), this, color_changed); connect(&color_dialog, SIGNAL(currentColorChanged(QColor)), this, color_changed);
if (color_dialog.exec() && color_dialog.selectedColor().isValid()) { if (color_dialog.exec() && color_dialog.selectedColor().isValid()) {
colorStr = qcolor_to_str(color_dialog.selectedColor()); colorStr = qcolor_to_str(color_dialog.selectedColor());
@ -1079,7 +1081,7 @@ void MainWindow::color_clicked(QString &colorStr, QLineEdit *txt, QToolButton *b
colorStr = original; colorStr = original;
} }
geometry = color_dialog.saveGeometry(); geometry = color_dialog.saveGeometry();
disconnect(&color_dialog, SIGNAL(currentColorChanged(const QColor &)), this, color_changed); disconnect(&color_dialog, SIGNAL(currentColorChanged(QColor)), this, color_changed);
setColorTxtBtn(colorStr, txt, btn); setColorTxtBtn(colorStr, txt, btn);
update_preview(); update_preview();
@ -1116,7 +1118,7 @@ void MainWindow::bgcolor_edited()
void MainWindow::color_edited(QString &colorStr, QLineEdit *txt, QToolButton *btn) void MainWindow::color_edited(QString &colorStr, QLineEdit *txt, QToolButton *btn)
{ {
QString new_str = txt->text().trimmed(); QString new_str = txt->text().trimmed();
if (new_str.indexOf(colorRE) != 0) { if (new_str.indexOf(*colorRE) != 0) {
return; return;
} }
colorStr = new_str; colorStr = new_str;
@ -1721,7 +1723,7 @@ void MainWindow::change_options()
connect(get_widget(QSL("spnPDFStructAppCount")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnPDFStructAppCount")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("spnPDFStructAppCount")), SIGNAL(valueChanged(int)), SLOT(structapp_ui_set())); connect(get_widget(QSL("spnPDFStructAppCount")), SIGNAL(valueChanged(int)), SLOT(structapp_ui_set()));
connect(get_widget(QSL("spnPDFStructAppIndex")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnPDFStructAppIndex")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("txtPDFStructAppID")), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); connect(get_widget(QSL("txtPDFStructAppID")), SIGNAL(textChanged(QString)), SLOT(update_preview()));
} else if (symbology == BARCODE_MICROPDF417) { } else if (symbology == BARCODE_MICROPDF417) {
QFile file(QSL(":/grpMicroPDF.ui")); QFile file(QSL(":/grpMicroPDF.ui"));
@ -1746,7 +1748,7 @@ void MainWindow::change_options()
connect(get_widget(QSL("spnMPDFStructAppCount")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnMPDFStructAppCount")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("spnMPDFStructAppCount")), SIGNAL(valueChanged(int)), SLOT(structapp_ui_set())); connect(get_widget(QSL("spnMPDFStructAppCount")), SIGNAL(valueChanged(int)), SLOT(structapp_ui_set()));
connect(get_widget(QSL("spnMPDFStructAppIndex")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnMPDFStructAppIndex")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("txtMPDFStructAppID")), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); connect(get_widget(QSL("txtMPDFStructAppID")), SIGNAL(textChanged(QString)), SLOT(update_preview()));
} else if (symbology == BARCODE_DOTCODE) { } else if (symbology == BARCODE_DOTCODE) {
QFile file(QSL(":/grpDotCode.ui")); QFile file(QSL(":/grpDotCode.ui"));
@ -1762,8 +1764,7 @@ void MainWindow::change_options()
connect(get_widget(QSL("radDotStand")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("radDotStand")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radDotGS1")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("radDotGS1")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("cmbDotStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbDotStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("cmbDotStructAppCount")), SIGNAL(currentIndexChanged( int )), connect(get_widget(QSL("cmbDotStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(structapp_ui_set()));
SLOT(structapp_ui_set()));
connect(get_widget(QSL("cmbDotStructAppIndex")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbDotStructAppIndex")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
} else if (symbology == BARCODE_AZTEC) { } else if (symbology == BARCODE_AZTEC) {
@ -1783,14 +1784,11 @@ void MainWindow::change_options()
connect(get_widget(QSL("radAztecStand")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("radAztecStand")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radAztecGS1")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("radAztecGS1")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radAztecHIBC")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("radAztecHIBC")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("cmbAztecStructAppCount")), SIGNAL(currentIndexChanged( int )), connect(get_widget(QSL("cmbAztecStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
SLOT(update_preview()));
connect(get_widget(QSL("cmbAztecStructAppCount")), SIGNAL(currentIndexChanged(int)), connect(get_widget(QSL("cmbAztecStructAppCount")), SIGNAL(currentIndexChanged(int)),
SLOT(structapp_ui_set())); SLOT(structapp_ui_set()));
connect(get_widget(QSL("cmbAztecStructAppIndex")), SIGNAL(currentIndexChanged( int )), connect(get_widget(QSL("cmbAztecStructAppIndex")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
SLOT(update_preview())); connect(get_widget(QSL("txtAztecStructAppID")), SIGNAL(textChanged(QString)), SLOT(update_preview()));
connect(get_widget(QSL("txtAztecStructAppID")), SIGNAL(textChanged( const QString& )),
SLOT(update_preview()));
} else if (symbology == BARCODE_MSI_PLESSEY) { } else if (symbology == BARCODE_MSI_PLESSEY) {
QFile file(QSL(":/grpMSICheck.ui")); QFile file(QSL(":/grpMSICheck.ui"));
@ -2091,8 +2089,7 @@ void MainWindow::change_options()
connect(get_widget(QSL("cmbGridECC")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbGridECC")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("chkGridFullMultibyte")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("chkGridFullMultibyte")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("cmbGridStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbGridStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("cmbGridStructAppCount")), SIGNAL(currentIndexChanged( int )), connect(get_widget(QSL("cmbGridStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(structapp_ui_set()));
SLOT(structapp_ui_set()));
connect(get_widget(QSL("cmbGridStructAppIndex")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbGridStructAppIndex")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("spnGridStructAppID")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnGridStructAppID")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
@ -2107,15 +2104,14 @@ void MainWindow::change_options()
tabMain->insertTab(1, m_optionWidget, tr("MaxiCod&e")); tabMain->insertTab(1, m_optionWidget, tr("MaxiCod&e"));
connect(get_widget(QSL("cmbMaxiMode")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbMaxiMode")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("cmbMaxiMode")), SIGNAL(currentIndexChanged(int)), SLOT(maxi_scm_ui_set())); connect(get_widget(QSL("cmbMaxiMode")), SIGNAL(currentIndexChanged(int)), SLOT(maxi_scm_ui_set()));
connect(get_widget(QSL("txtMaxiSCMPostcode")), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); connect(get_widget(QSL("txtMaxiSCMPostcode")), SIGNAL(textChanged(QString)), SLOT(update_preview()));
connect(get_widget(QSL("spnMaxiSCMCountry")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnMaxiSCMCountry")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("spnMaxiSCMService")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnMaxiSCMService")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("chkMaxiSCMVV")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("chkMaxiSCMVV")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("chkMaxiSCMVV")), SIGNAL(toggled(bool)), SLOT(maxi_scm_ui_set())); connect(get_widget(QSL("chkMaxiSCMVV")), SIGNAL(toggled(bool)), SLOT(maxi_scm_ui_set()));
connect(get_widget(QSL("spnMaxiSCMVV")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnMaxiSCMVV")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("cmbMaxiStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbMaxiStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("cmbMaxiStructAppCount")), SIGNAL(currentIndexChanged( int )), connect(get_widget(QSL("cmbMaxiStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(structapp_ui_set()));
SLOT(structapp_ui_set()));
connect(get_widget(QSL("cmbMaxiStructAppIndex")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbMaxiStructAppIndex")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
maxi_scm_ui_set(); maxi_scm_ui_set();
@ -2216,12 +2212,10 @@ void MainWindow::change_options()
connect(get_widget(QSL("cmbUltraRevision")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbUltraRevision")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("radUltraStand")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("radUltraStand")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radUltraGS1")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("radUltraGS1")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("cmbUltraStructAppCount")), SIGNAL(currentIndexChanged( int )), connect(get_widget(QSL("cmbUltraStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
SLOT(update_preview()));
connect(get_widget(QSL("cmbUltraStructAppCount")), SIGNAL(currentIndexChanged(int)), connect(get_widget(QSL("cmbUltraStructAppCount")), SIGNAL(currentIndexChanged(int)),
SLOT(structapp_ui_set())); SLOT(structapp_ui_set()));
connect(get_widget(QSL("cmbUltraStructAppIndex")), SIGNAL(currentIndexChanged( int )), connect(get_widget(QSL("cmbUltraStructAppIndex")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
SLOT(update_preview()));
connect(get_widget(QSL("spnUltraStructAppID")), SIGNAL(valueChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("spnUltraStructAppID")), SIGNAL(valueChanged(int)), SLOT(update_preview()));
} else if (symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC) { } else if (symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC) {
@ -3342,12 +3336,12 @@ void MainWindow::createActions()
m_copyBMPAct = new QAction(copyIcon, tr("Copy as &BMP"), this); m_copyBMPAct = new QAction(copyIcon, tr("Copy as &BMP"), this);
m_copyBMPAct->setStatusTip(tr("Copy to clipboard as BMP")); m_copyBMPAct->setStatusTip(tr("Copy to clipboard as BMP"));
m_copyBMPAct->setShortcut(copyBMPSeq); m_copyBMPAct->setShortcut(*copyBMPSeq);
connect(m_copyBMPAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_bmp())); connect(m_copyBMPAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_bmp()));
m_copyEMFAct = new QAction(copyIcon, tr("Copy as E&MF"), this); m_copyEMFAct = new QAction(copyIcon, tr("Copy as E&MF"), this);
m_copyEMFAct->setStatusTip(tr("Copy to clipboard as EMF")); m_copyEMFAct->setStatusTip(tr("Copy to clipboard as EMF"));
m_copyEMFAct->setShortcut(copyEMFSeq); m_copyEMFAct->setShortcut(*copyEMFSeq);
connect(m_copyEMFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_emf())); connect(m_copyEMFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_emf()));
#ifdef MAINWINDOW_COPY_EPS /* TODO: see if can get this to work */ #ifdef MAINWINDOW_COPY_EPS /* TODO: see if can get this to work */
@ -3358,7 +3352,7 @@ void MainWindow::createActions()
m_copyGIFAct = new QAction(copyIcon, tr("Copy as &GIF"), this); m_copyGIFAct = new QAction(copyIcon, tr("Copy as &GIF"), this);
m_copyGIFAct->setStatusTip(tr("Copy to clipboard as GIF")); m_copyGIFAct->setStatusTip(tr("Copy to clipboard as GIF"));
m_copyGIFAct->setShortcut(copyGIFSeq); m_copyGIFAct->setShortcut(*copyGIFSeq);
connect(m_copyGIFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_gif())); connect(m_copyGIFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_gif()));
#ifdef MAINWINDOW_COPY_PCX /* TODO: see if can get this to work */ #ifdef MAINWINDOW_COPY_PCX /* TODO: see if can get this to work */
@ -3370,23 +3364,23 @@ void MainWindow::createActions()
if (!m_bc.bc.noPng()) { if (!m_bc.bc.noPng()) {
m_copyPNGAct = new QAction(copyIcon, tr("Copy as &PNG"), this); m_copyPNGAct = new QAction(copyIcon, tr("Copy as &PNG"), this);
m_copyPNGAct->setStatusTip(tr("Copy to clipboard as PNG")); m_copyPNGAct->setStatusTip(tr("Copy to clipboard as PNG"));
m_copyPNGAct->setShortcut(copyPNGSeq); m_copyPNGAct->setShortcut(*copyPNGSeq);
connect(m_copyPNGAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_png())); connect(m_copyPNGAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_png()));
} }
m_copySVGAct = new QAction(copyIcon, tr("Copy as S&VG"), this); m_copySVGAct = new QAction(copyIcon, tr("Copy as S&VG"), this);
m_copySVGAct->setStatusTip(tr("Copy to clipboard as SVG")); m_copySVGAct->setStatusTip(tr("Copy to clipboard as SVG"));
m_copySVGAct->setShortcut(copySVGSeq); m_copySVGAct->setShortcut(*copySVGSeq);
connect(m_copySVGAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_svg())); connect(m_copySVGAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_svg()));
m_copyTIFAct = new QAction(copyIcon, tr("Copy as &TIF"), this); m_copyTIFAct = new QAction(copyIcon, tr("Copy as &TIF"), this);
m_copyTIFAct->setStatusTip(tr("Copy to clipboard as TIF")); m_copyTIFAct->setStatusTip(tr("Copy to clipboard as TIF"));
m_copyTIFAct->setShortcut(copyTIFSeq); m_copyTIFAct->setShortcut(*copyTIFSeq);
connect(m_copyTIFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_tif())); connect(m_copyTIFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_tif()));
m_openCLIAct = new QAction(cliIcon, tr("C&LI Equivalent..."), this); m_openCLIAct = new QAction(cliIcon, tr("C&LI Equivalent..."), this);
m_openCLIAct->setStatusTip(tr("Generate CLI equivalent")); m_openCLIAct->setStatusTip(tr("Generate CLI equivalent"));
m_openCLIAct->setShortcut(openCLISeq); m_openCLIAct->setShortcut(*openCLISeq);
connect(m_openCLIAct, SIGNAL(triggered()), this, SLOT(open_cli_dialog())); connect(m_openCLIAct, SIGNAL(triggered()), this, SLOT(open_cli_dialog()));
m_saveAsAct = new QAction(saveIcon, tr("&Save As..."), this); m_saveAsAct = new QAction(saveIcon, tr("&Save As..."), this);
@ -3396,7 +3390,7 @@ void MainWindow::createActions()
m_factoryResetAct = new QAction(zapIcon, tr("Factory &Reset..."), this); m_factoryResetAct = new QAction(zapIcon, tr("Factory &Reset..."), this);
m_factoryResetAct->setStatusTip(tr("Clear all data & settings")); m_factoryResetAct->setStatusTip(tr("Clear all data & settings"));
m_factoryResetAct->setShortcut(factoryResetSeq); m_factoryResetAct->setShortcut(*factoryResetSeq);
connect(m_factoryResetAct, SIGNAL(triggered()), this, SLOT(factory_reset())); connect(m_factoryResetAct, SIGNAL(triggered()), this, SLOT(factory_reset()));
m_helpAct = new QAction(helpIcon, tr("&Help (online)"), this); m_helpAct = new QAction(helpIcon, tr("&Help (online)"), this);
@ -3414,7 +3408,7 @@ void MainWindow::createActions()
m_quitAct = new QAction(quitIcon, tr("&Quit"), this); m_quitAct = new QAction(quitIcon, tr("&Quit"), this);
m_quitAct->setStatusTip(tr("Exit Zint Barcode Studio")); m_quitAct->setStatusTip(tr("Exit Zint Barcode Studio"));
m_quitAct->setShortcut(quitKeySeq); m_quitAct->setShortcut(*quitKeySeq);
connect(m_quitAct, SIGNAL(triggered()), this, SLOT(quit_now())); connect(m_quitAct, SIGNAL(triggered()), this, SLOT(quit_now()));
m_copyErrtxtAct = new QAction(copyIcon, tr("&Copy"), this); m_copyErrtxtAct = new QAction(copyIcon, tr("&Copy"), this);
@ -3576,7 +3570,7 @@ void MainWindow::automatic_info_set()
txt->setText(QString::asprintf("(%d X %d (%d Layers))", w, w, layers)); txt->setText(QString::asprintf("(%d X %d (%d Layers))", w, w, layers));
} }
} else { } else {
txt->setText(QSL("")); txt->setText(QSEmpty);
} }
} }
@ -3829,7 +3823,7 @@ void MainWindow::automatic_info_set()
const int r = m_bc.bc.encodedRows(); const int r = m_bc.bc.encodedRows();
txt->setText(QString::asprintf("(%d X %d)", w, r)); txt->setText(QString::asprintf("(%d X %d)", w, r));
} else { } else {
txt->setText(QSL("")); txt->setText(QSEmpty);
} }
} }
} }
@ -4015,7 +4009,7 @@ void MainWindow::set_dspn_from_setting(QSettings &settings, const QString &setti
QString MainWindow::get_txt_val(const QString &name) QString MainWindow::get_txt_val(const QString &name)
{ {
QLineEdit *lineEdit = m_optionWidget ? m_optionWidget->findChild<QLineEdit*>(name) : nullptr; QLineEdit *lineEdit = m_optionWidget ? m_optionWidget->findChild<QLineEdit*>(name) : nullptr;
return lineEdit ? lineEdit->text() : QSL(""); return lineEdit ? lineEdit->text() : QSEmpty;
} }
/* Helper to set line edit from settings, checking for NULL */ /* Helper to set line edit from settings, checking for NULL */
@ -4446,18 +4440,18 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
{ {
QString name = get_setting_name(symbology); QString name = get_setting_name(symbology);
if (!name.isEmpty()) { // Should never be empty if (!name.isEmpty()) { // Should never be empty
const QString &tdata = settings.value(QSL("studio/bc/%1/data").arg(name), QSL("")).toString(); const QString &tdata = settings.value(QSL("studio/bc/%1/data").arg(name), QSEmpty).toString();
if (!tdata.isEmpty()) { if (!tdata.isEmpty()) {
txtData->setText(tdata); txtData->setText(tdata);
} }
if (!grpSegs->isHidden()) { if (!grpSegs->isHidden()) {
txtDataSeg1->setText(settings.value(QSL("studio/bc/%1/data_seg1").arg(name), QSL("")).toString()); txtDataSeg1->setText(settings.value(QSL("studio/bc/%1/data_seg1").arg(name), QSEmpty).toString());
txtDataSeg2->setText(settings.value(QSL("studio/bc/%1/data_seg2").arg(name), QSL("")).toString()); txtDataSeg2->setText(settings.value(QSL("studio/bc/%1/data_seg2").arg(name), QSEmpty).toString());
txtDataSeg3->setText(settings.value(QSL("studio/bc/%1/data_seg3").arg(name), QSL("")).toString()); txtDataSeg3->setText(settings.value(QSL("studio/bc/%1/data_seg3").arg(name), QSEmpty).toString());
} }
if (!grpComposite->isHidden()) { if (!grpComposite->isHidden()) {
const QString &composite_text = settings.value( const QString &composite_text = settings.value(
QSL("studio/bc/%1/composite_text").arg(name), QSL("")).toString(); QSL("studio/bc/%1/composite_text").arg(name), QSEmpty).toString();
if (!composite_text.isEmpty()) { if (!composite_text.isEmpty()) {
txtComposite->setText(composite_text); txtComposite->setText(composite_text);
} }
@ -4513,7 +4507,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
spnDotSize->setValue(settings.value( spnDotSize->setValue(settings.value(
QSL("studio/bc/%1/appearance/dot_size").arg(name), 0.4f / 0.5f).toFloat()); QSL("studio/bc/%1/appearance/dot_size").arg(name), 0.4f / 0.5f).toFloat());
} }
m_fgstr = settings.value(QSL("studio/bc/%1/ink/text").arg(name), QSL("")).toString(); m_fgstr = settings.value(QSL("studio/bc/%1/ink/text").arg(name), QSEmpty).toString();
if (m_fgstr.isEmpty()) { if (m_fgstr.isEmpty()) {
QColor color(settings.value(QSL("studio/bc/%1/ink/red").arg(name), 0).toInt(), QColor color(settings.value(QSL("studio/bc/%1/ink/red").arg(name), 0).toInt(),
settings.value(QSL("studio/bc/%1/ink/green").arg(name), 0).toInt(), settings.value(QSL("studio/bc/%1/ink/green").arg(name), 0).toInt(),
@ -4521,10 +4515,10 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
settings.value(QSL("studio/bc/%1/ink/alpha").arg(name), 0xff).toInt()); settings.value(QSL("studio/bc/%1/ink/alpha").arg(name), 0xff).toInt());
m_fgstr = qcolor_to_str(color); m_fgstr = qcolor_to_str(color);
} }
if (m_fgstr.indexOf(colorRE) != 0) { if (m_fgstr.indexOf(*colorRE) != 0) {
m_fgstr = fgDefault; m_fgstr = fgDefault;
} }
m_bgstr = settings.value(QSL("studio/bc/%1/paper/text").arg(name), QSL("")).toString(); m_bgstr = settings.value(QSL("studio/bc/%1/paper/text").arg(name), QSEmpty).toString();
if (m_bgstr.isEmpty()) { if (m_bgstr.isEmpty()) {
QColor color(settings.value(QSL("studio/bc/%1/paper/red").arg(name), 0xff).toInt(), QColor color(settings.value(QSL("studio/bc/%1/paper/red").arg(name), 0xff).toInt(),
settings.value(QSL("studio/bc/%1/paper/green").arg(name), 0xff).toInt(), settings.value(QSL("studio/bc/%1/paper/green").arg(name), 0xff).toInt(),
@ -4532,7 +4526,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
settings.value(QSL("studio/bc/%1/paper/alpha").arg(name), 0xff).toInt()); settings.value(QSL("studio/bc/%1/paper/alpha").arg(name), 0xff).toInt());
m_bgstr = qcolor_to_str(color); m_bgstr = qcolor_to_str(color);
} }
if (m_bgstr.indexOf(colorRE) != 0) { if (m_bgstr.indexOf(*colorRE) != 0) {
m_bgstr = bgDefault; m_bgstr = bgDefault;
} }
m_xdimdpVars.x_dim = settings.value(QSL("studio/bc/%1/xdimdpvars/x_dim").arg(name), 0.0).toFloat(); m_xdimdpVars.x_dim = settings.value(QSL("studio/bc/%1/xdimdpvars/x_dim").arg(name), 0.0).toFloat();
@ -4567,7 +4561,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
set_chk_from_setting(settings, QSL("studio/bc/pdf417/chk_fast"), QSL("chkPDFFast")); set_chk_from_setting(settings, QSL("studio/bc/pdf417/chk_fast"), QSL("chkPDFFast"));
set_spn_from_setting(settings, QSL("studio/bc/pdf417/structapp_count"), QSL("spnPDFStructAppCount"), 1); set_spn_from_setting(settings, QSL("studio/bc/pdf417/structapp_count"), QSL("spnPDFStructAppCount"), 1);
set_spn_from_setting(settings, QSL("studio/bc/pdf417/structapp_index"), QSL("spnPDFStructAppIndex"), 0); set_spn_from_setting(settings, QSL("studio/bc/pdf417/structapp_index"), QSL("spnPDFStructAppIndex"), 0);
set_txt_from_setting(settings, QSL("studio/bc/pdf417/structapp_id"), QSL("txtPDFStructAppID"), QSL("")); set_txt_from_setting(settings, QSL("studio/bc/pdf417/structapp_id"), QSL("txtPDFStructAppID"), QSEmpty);
break; break;
case BARCODE_MICROPDF417: case BARCODE_MICROPDF417:
@ -4583,7 +4577,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
set_spn_from_setting(settings, QSL("studio/bc/micropdf417/structapp_index"), set_spn_from_setting(settings, QSL("studio/bc/micropdf417/structapp_index"),
QSL("spnMPDFStructAppIndex"), 0); QSL("spnMPDFStructAppIndex"), 0);
set_txt_from_setting(settings, QSL("studio/bc/micropdf417/structapp_id"), QSL("txtMPDFStructAppID"), set_txt_from_setting(settings, QSL("studio/bc/micropdf417/structapp_id"), QSL("txtMPDFStructAppID"),
QSL("")); QSEmpty);
break; break;
case BARCODE_DOTCODE: case BARCODE_DOTCODE:
@ -4605,7 +4599,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
QStringList() << QSL("radAztecStand") << QSL("radAztecGS1") << QSL("radAztecHIBC")); QStringList() << QSL("radAztecStand") << QSL("radAztecGS1") << QSL("radAztecHIBC"));
set_cmb_from_setting(settings, QSL("studio/bc/aztec/structapp_count"), QSL("cmbAztecStructAppCount")); set_cmb_from_setting(settings, QSL("studio/bc/aztec/structapp_count"), QSL("cmbAztecStructAppCount"));
set_cmb_from_setting(settings, QSL("studio/bc/aztec/structapp_index"), QSL("cmbAztecStructAppIndex")); set_cmb_from_setting(settings, QSL("studio/bc/aztec/structapp_index"), QSL("cmbAztecStructAppIndex"));
set_txt_from_setting(settings, QSL("studio/bc/aztec/structapp_id"), QSL("txtAztecStructAppID"), QSL("")); set_txt_from_setting(settings, QSL("studio/bc/aztec/structapp_id"), QSL("txtAztecStructAppID"), QSEmpty);
break; break;
case BARCODE_MSI_PLESSEY: case BARCODE_MSI_PLESSEY:
@ -4777,7 +4771,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
case BARCODE_MAXICODE: case BARCODE_MAXICODE:
set_cmb_from_setting(settings, QSL("studio/bc/maxicode/mode"), QSL("cmbMaxiMode"), 1); set_cmb_from_setting(settings, QSL("studio/bc/maxicode/mode"), QSL("cmbMaxiMode"), 1);
set_txt_from_setting(settings, QSL("studio/bc/maxicode/scm_postcode"), QSL("txtMaxiSCMPostcode"), set_txt_from_setting(settings, QSL("studio/bc/maxicode/scm_postcode"), QSL("txtMaxiSCMPostcode"),
QSL("")); QSEmpty);
set_spn_from_setting(settings, QSL("studio/bc/maxicode/scm_country"), QSL("spnMaxiSCMCountry"), 0); set_spn_from_setting(settings, QSL("studio/bc/maxicode/scm_country"), QSL("spnMaxiSCMCountry"), 0);
set_spn_from_setting(settings, QSL("studio/bc/maxicode/scm_service"), QSL("spnMaxiSCMService"), 0); set_spn_from_setting(settings, QSL("studio/bc/maxicode/scm_service"), QSL("spnMaxiSCMService"), 0);
set_chk_from_setting(settings, QSL("studio/bc/maxicode/chk_scm_vv"), QSL("chkMaxiSCMVV")); set_chk_from_setting(settings, QSL("studio/bc/maxicode/chk_scm_vv"), QSL("chkMaxiSCMVV"));

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> * * Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
* Copyright (C) 2009-2023 by Robin Stuart <rstuart114@gmail.com> * * Copyright (C) 2009-2024 by Robin Stuart <rstuart114@gmail.com> *
* * * *
* This program is free software: you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
@ -18,11 +18,11 @@
#ifndef Z_MAINWINDOW_H #ifndef Z_MAINWINDOW_H
#define Z_MAINWINDOW_H #define Z_MAINWINDOW_H
#include <QtGui>
#include <QGraphicsItem>
#include <QMainWindow>
#include <QGraphicsScene>
#include <QButtonGroup> #include <QButtonGroup>
#include <QMainWindow>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QSettings>
class QLabel; class QLabel;
class QShortcut; class QShortcut;
@ -54,8 +54,8 @@ public slots:
void update_preview(); void update_preview();
void change_options(); void change_options();
void on_fgcolor_clicked(); void fgcolor_clicked();
void on_bgcolor_clicked(); void bgcolor_clicked();
void fgcolor_changed(const QColor& color); void fgcolor_changed(const QColor& color);
void bgcolor_changed(const QColor& color); void bgcolor_changed(const QColor& color);
void fgcolor_edited(); void fgcolor_edited();

View File

@ -1,6 +1,6 @@
/* /*
Zint Barcode Generator - the open source barcode generator Zint Barcode Generator - the open source barcode generator
Copyright (C) 2022-2023 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2022-2024 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -19,8 +19,8 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */ /* SPDX-License-Identifier: GPL-3.0-or-later */
//#include <QDebug> //#include <QDebug>
#include <QUiLoader>
#include <QSettings> #include <QSettings>
#include <QUiLoader>
#include <math.h> #include <math.h>
#include "scalewindow.h" #include "scalewindow.h"

View File

@ -1,6 +1,6 @@
/* /*
Zint Barcode Generator - the open source barcode generator Zint Barcode Generator - the open source barcode generator
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -20,16 +20,17 @@
//#include <QDebug> //#include <QDebug>
#include <QFile> #include <QFile>
#include <QUiLoader>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QSettings> #include <QSettings>
#include <QUiLoader>
#include "sequencewindow.h" #include "sequencewindow.h"
#include "exportwindow.h" #include "exportwindow.h"
// Shorthand // Shorthand
#define QSL QStringLiteral #define QSL QStringLiteral
#define QSEmpty QLatin1String("")
SequenceWindow::SequenceWindow(BarcodeItem *bc) : m_bc(bc) SequenceWindow::SequenceWindow(BarcodeItem *bc) : m_bc(bc)
{ {
@ -46,7 +47,7 @@ SequenceWindow::SequenceWindow(BarcodeItem *bc) : m_bc(bc)
spnSeqEndVal->setValue(settings.value(QSL("studio/sequence/end_value"), 10).toInt()); spnSeqEndVal->setValue(settings.value(QSL("studio/sequence/end_value"), 10).toInt());
spnSeqIncVal->setValue(settings.value(QSL("studio/sequence/increment"), 1).toInt()); spnSeqIncVal->setValue(settings.value(QSL("studio/sequence/increment"), 1).toInt());
linSeqFormat->setText(settings.value(QSL("studio/sequence/format"), QSL("$$$$$$")).toString()); linSeqFormat->setText(settings.value(QSL("studio/sequence/format"), QSL("$$$$$$")).toString());
txtSeqPreview->setPlainText(settings.value(QSL("studio/sequence/preview"), QSL("")).toString()); txtSeqPreview->setPlainText(settings.value(QSL("studio/sequence/preview"), QSEmpty).toString());
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg")))); QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
QIcon clearIcon(QSL(":res/delete.svg")); QIcon clearIcon(QSL(":res/delete.svg"));

View File

@ -178,7 +178,7 @@ using it install the packages:
(This should include mingw32-libz-dll) (This should include mingw32-libz-dll)
Any reasonably modern version of Qt can be used. The following uses Qt 5.14.2. Any reasonably modern version of Qt can be used. The following uses Qt 5.14.2.
Using the Qt Maintenance Tool (see the Visual Studio 2017 instructions above) Using the Qt Maintenance Tool (see the Visual Studio 2022 instructions above)
install the "MinGW 7.3.0 32-bit" component. install the "MinGW 7.3.0 32-bit" component.
(Note the Qt MinGW versions actually refer to Mingw-w64, the 64-bit fork of (Note the Qt MinGW versions actually refer to Mingw-w64, the 64-bit fork of