1
0
mirror of https://github.com/woo-j/zint.git synced 2024-12-23 01:33:55 +03:00

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;
@ -64,13 +65,13 @@ CLIWindow::CLIWindow(BarcodeItem *bc, const bool autoHeight, const double height
btnCLICopy->setIcon(copyIcon); btnCLICopy->setIcon(copyIcon);
btnCLIClose->setIcon(closeIcon); btnCLIClose->setIcon(closeIcon);
connect(btnCLIClose, SIGNAL( clicked( bool )), SLOT(close())); connect(btnCLIClose, SIGNAL(clicked(bool)), SLOT(close()));
connect(btnCLICopy, SIGNAL( clicked( bool )), SLOT(copy_to_clipboard())); connect(btnCLICopy, SIGNAL(clicked(bool)), SLOT(copy_to_clipboard()));
connect(radCLIUnix, SIGNAL(toggled( bool )), SLOT(generate_cli())); connect(radCLIUnix, SIGNAL(toggled(bool)), SLOT(generate_cli()));
connect(radCLIWin, SIGNAL(toggled( bool )), SLOT(generate_cli())); connect(radCLIWin, SIGNAL(toggled(bool)), SLOT(generate_cli()));
connect(chkCLILongOpts, SIGNAL(toggled( bool )), SLOT(generate_cli())); connect(chkCLILongOpts, SIGNAL(toggled(bool)), SLOT(generate_cli()));
connect(chkCLIBarcodeName, SIGNAL(toggled( bool )), SLOT(generate_cli())); connect(chkCLIBarcodeName, SIGNAL(toggled(bool)), SLOT(generate_cli()));
connect(chkCLINoEXE, SIGNAL(toggled( bool )), SLOT(generate_cli())); connect(chkCLINoEXE, SIGNAL(toggled(bool)), SLOT(generate_cli()));
generate_cli(); generate_cli();
} }
@ -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 {
@ -75,11 +75,11 @@ DataWindow::DataWindow(const QString &input, bool isEscaped, int seg_no) : Valid
} }
txtDataInput->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); txtDataInput->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(close())); connect(btnCancel, SIGNAL(clicked(bool)), SLOT(close()));
connect(btnDataClear, SIGNAL( clicked( bool )), SLOT(clear_data())); connect(btnDataClear, SIGNAL(clicked(bool)), SLOT(clear_data()));
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay())); connect(btnOK, SIGNAL(clicked(bool)), SLOT(okay()));
connect(btnFromFile, SIGNAL( clicked( bool )), SLOT(from_file())); connect(btnFromFile, SIGNAL(clicked(bool)), SLOT(from_file()));
connect(txtDataInput, SIGNAL( textChanged() ), this, SLOT(text_changed())); connect(txtDataInput, SIGNAL(textChanged()), this, SLOT(text_changed()));
btnDataClear->setEnabled(!txtDataInput->toPlainText().isEmpty()); btnDataClear->setEnabled(!txtDataInput->toPlainText().isEmpty());
} }

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));
@ -60,9 +61,9 @@ ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data)
QIcon folderIcon(QIcon::fromTheme(QSL("folder"), QIcon(QSL(":res/folder.svg")))); QIcon folderIcon(QIcon::fromTheme(QSL("folder"), QIcon(QSL(":res/folder.svg"))));
btnDestPath->setIcon(folderIcon); btnDestPath->setIcon(folderIcon);
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(close())); connect(btnCancel, SIGNAL(clicked(bool)), SLOT(close()));
connect(btnOK, SIGNAL( clicked( bool )), SLOT(process())); connect(btnOK, SIGNAL(clicked(bool)), SLOT(process()));
connect(btnDestPath, SIGNAL( clicked( bool )), SLOT(get_directory())); connect(btnDestPath, SIGNAL(clicked(bool)), SLOT(get_directory()));
m_dataList = m_output_data.split('\n'); m_dataList = m_output_data.split('\n');
m_lines = m_dataList.size(); m_lines = m_dataList.size();

File diff suppressed because it is too large Load Diff

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"
@ -98,16 +98,16 @@ ScaleWindow::ScaleWindow(BarcodeItem *bc, Zint::QZintXdimDpVars *vars, double or
btnScaleUnset->setEnabled(m_vars.set); btnScaleUnset->setEnabled(m_vars.set);
btnOK->setIcon(okIcon); btnOK->setIcon(okIcon);
connect(btnCancel, SIGNAL(clicked( bool )), SLOT(close())); connect(btnCancel, SIGNAL(clicked(bool)), SLOT(close()));
connect(btnScaleUnset, SIGNAL( clicked( bool )), SLOT(unset_scale())); connect(btnScaleUnset, SIGNAL(clicked(bool)), SLOT(unset_scale()));
connect(btnOK, SIGNAL(clicked( bool )), SLOT(okay())); connect(btnOK, SIGNAL(clicked(bool)), SLOT(okay()));
connect(spnXdim, SIGNAL(valueChanged( double )), SLOT(update_scale())); connect(spnXdim, SIGNAL(valueChanged(double)), SLOT(update_scale()));
connect(cmbXdimUnits, SIGNAL(currentIndexChanged( int )), SLOT(x_dim_units_change())); connect(cmbXdimUnits, SIGNAL(currentIndexChanged(int)), SLOT(x_dim_units_change()));
connect(btnXdimDefault, SIGNAL(clicked( bool )), SLOT(x_dim_default())); connect(btnXdimDefault, SIGNAL(clicked(bool)), SLOT(x_dim_default()));
connect(spnResolution, SIGNAL(valueChanged( int )), SLOT(update_scale())); connect(spnResolution, SIGNAL(valueChanged(int)), SLOT(update_scale()));
connect(cmbResolutionUnits, SIGNAL(currentIndexChanged( int )), SLOT(resolution_units_change())); connect(cmbResolutionUnits, SIGNAL(currentIndexChanged(int)), SLOT(resolution_units_change()));
connect(btnResolutionDefault, SIGNAL(clicked( bool )), SLOT(resolution_default())); connect(btnResolutionDefault, SIGNAL(clicked(bool)), SLOT(resolution_default()));
connect(cmbFileType, SIGNAL(currentIndexChanged( int )), SLOT(update_scale())); connect(cmbFileType, SIGNAL(currentIndexChanged(int)), SLOT(update_scale()));
} }
ScaleWindow::~ScaleWindow() ScaleWindow::~ScaleWindow()

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"));
@ -54,12 +55,12 @@ SequenceWindow::SequenceWindow(BarcodeItem *bc) : m_bc(bc)
btnSeqClear->setIcon(clearIcon); btnSeqClear->setIcon(clearIcon);
check_generate(); check_generate();
connect(btnSeqClose, SIGNAL( clicked( bool )), SLOT(close())); connect(btnSeqClose, SIGNAL(clicked(bool)), SLOT(close()));
connect(btnSeqClear, SIGNAL( clicked( bool )), SLOT(clear_preview())); connect(btnSeqClear, SIGNAL(clicked(bool)), SLOT(clear_preview()));
connect(btnSeqCreate, SIGNAL( clicked( bool )), SLOT(create_sequence())); connect(btnSeqCreate, SIGNAL(clicked(bool)), SLOT(create_sequence()));
connect(txtSeqPreview, SIGNAL( textChanged()), SLOT(check_generate())); connect(txtSeqPreview, SIGNAL(textChanged()), SLOT(check_generate()));
connect(btnSeqFromFile, SIGNAL( clicked( bool )), SLOT(from_file())); connect(btnSeqFromFile, SIGNAL(clicked(bool)), SLOT(from_file()));
connect(btnSeqExport, SIGNAL( clicked( bool )), SLOT(generate_sequence())); connect(btnSeqExport, SIGNAL(clicked(bool)), SLOT(generate_sequence()));
} }
SequenceWindow::~SequenceWindow() SequenceWindow::~SequenceWindow()

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