mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-27 21:44:13 -04:00
- cmake: remove zintconfig.h.in for now as incompatible with MSVC
project builds (will add back in future if go fully CMake) - NO_PNG -> ZINT_NO_PNG and new API function `Zint_NoPng()` to determine if no PNG support in libzint; replace use in GUI with backend_qt method `noPng()`
This commit is contained in:
parent
536a581d9e
commit
6393813cff
31 changed files with 138 additions and 156 deletions
|
@ -34,6 +34,11 @@ ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data)
|
|||
: m_bc(bc), m_output_data(output_data), m_lines(0)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
if (m_bc->bc.noPng()) {
|
||||
cmbFileType->removeItem(0); // PNG
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
#if QT_VERSION < 0x60000
|
||||
settings.setIniCodec("UTF-8");
|
||||
|
@ -47,7 +52,8 @@ ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data)
|
|||
linPrefix->setText(settings.value(QSL("studio/export/file_prefix"), QSL("bcs_")).toString());
|
||||
linPostfix->setText(settings.value(QSL("studio/export/file_postfix"), QSL("")).toString());
|
||||
cmbFileName->setCurrentIndex(settings.value(QSL("studio/export/name_format"), 0).toInt());
|
||||
cmbFileFormat->setCurrentIndex(settings.value(QSL("studio/export/filetype"), 0).toInt());
|
||||
cmbFileType->setCurrentIndex(std::min(settings.value(QSL("studio/export/filetype"), 0).toInt(),
|
||||
cmbFileType->count() - 1));
|
||||
|
||||
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
|
||||
btnCancel->setIcon(closeIcon);
|
||||
|
@ -77,7 +83,7 @@ ExportWindow::~ExportWindow()
|
|||
settings.setValue(QSL("studio/export/file_prefix"), linPrefix->text());
|
||||
settings.setValue(QSL("studio/export/file_postfix"), linPostfix->text());
|
||||
settings.setValue(QSL("studio/export/name_format"), cmbFileName->currentIndex());
|
||||
settings.setValue(QSL("studio/export/filetype"), cmbFileFormat->currentIndex());
|
||||
settings.setValue(QSL("studio/export/filetype"), cmbFileType->currentIndex());
|
||||
}
|
||||
|
||||
void ExportWindow::get_directory()
|
||||
|
@ -122,25 +128,11 @@ void ExportWindow::process()
|
|||
}
|
||||
|
||||
QString suffix;
|
||||
switch (cmbFileFormat->currentIndex()) {
|
||||
#ifdef NO_PNG
|
||||
case 0: suffix = QSL(".eps"); break;
|
||||
case 1: suffix = QSL(".gif"); break;
|
||||
case 2: suffix = QSL(".svg"); break;
|
||||
case 3: suffix = QSL(".bmp"); break;
|
||||
case 4: suffix = QSL(".pcx"); break;
|
||||
case 5: suffix = QSL(".emf"); break;
|
||||
case 6: suffix = QSL(".tif"); break;
|
||||
#else
|
||||
case 0: suffix = QSL(".png"); break;
|
||||
case 1: suffix = QSL(".eps"); break;
|
||||
case 2: suffix = QSL(".gif"); break;
|
||||
case 3: suffix = QSL(".svg"); break;
|
||||
case 4: suffix = QSL(".bmp"); break;
|
||||
case 5: suffix = QSL(".pcx"); break;
|
||||
case 6: suffix = QSL(".emf"); break;
|
||||
case 7: suffix = QSL(".tif"); break;
|
||||
#endif
|
||||
int suffixIdx = cmbFileType->currentText().lastIndexOf(QSL("(*."));
|
||||
if (suffixIdx == -1) {
|
||||
suffix = m_bc->bc.noPng() ? QSL(".gif") : QSL(".png");
|
||||
} else {
|
||||
suffix = cmbFileType->currentText().mid(suffixIdx + 2, 4);
|
||||
}
|
||||
|
||||
QString filePathPrefix = linDestPath->text() % QDir::separator() % linPrefix->text();
|
||||
|
|
|
@ -143,12 +143,12 @@
|
|||
<string>The type of file which you want to create</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cmbFileFormat</cstring>
|
||||
<cstring>cmbFileType</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbFileFormat">
|
||||
<widget class="QComboBox" name="cmbFileType">
|
||||
<property name="toolTip">
|
||||
<string>The type of file which you want to create</string>
|
||||
</property>
|
||||
|
|
|
@ -4,7 +4,7 @@ DEPENDPATH += . debug release
|
|||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../backend
|
||||
INCLUDEPATH += ../backend_qt
|
||||
!contains(DEFINES, NO_PNG) {
|
||||
!contains(DEFINES, ZINT_NO_PNG) {
|
||||
INCLUDEPATH += ../../lpng
|
||||
INCLUDEPATH += ../../zlib
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ QMAKE_LIBDIR += ../backend_qt/release
|
|||
LIBS += -lQt5Core
|
||||
QMAKE_LIBDIR += C:/qt/5.15.2static/lib
|
||||
|
||||
!contains(DEFINES, NO_PNG) {
|
||||
!contains(DEFINES, ZINT_NO_PNG) {
|
||||
# Win
|
||||
win32:LIBS += -llibpng16 -lzlib
|
||||
win32:QMAKE_LIBDIR+="../../lpng/projects/vstudio/Release Library"
|
||||
|
|
|
@ -50,9 +50,7 @@ static const QKeySequence openCLISeq(Qt::SHIFT | Qt::CTRL | Qt::Key_C);
|
|||
static const QKeySequence copyBMPSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_B);
|
||||
static const QKeySequence copyEMFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_E);
|
||||
static const QKeySequence copyGIFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_G);
|
||||
#ifndef NO_PNG
|
||||
static const QKeySequence copyPNGSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_P);
|
||||
#endif
|
||||
static const QKeySequence copySVGSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_S);
|
||||
static const QKeySequence copyTIFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_T);
|
||||
|
||||
|
@ -355,10 +353,10 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
|||
connect(m_copyEMFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_emf()));
|
||||
m_copyGIFShortcut = new QShortcut(copyGIFSeq, this);
|
||||
connect(m_copyGIFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_gif()));
|
||||
#ifndef NO_PNG
|
||||
m_copyPNGShortcut = new QShortcut(copyPNGSeq, this);
|
||||
connect(m_copyPNGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_png()));
|
||||
#endif
|
||||
if (!m_bc.bc.noPng()) {
|
||||
m_copyPNGShortcut = new QShortcut(copyPNGSeq, this);
|
||||
connect(m_copyPNGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_png()));
|
||||
}
|
||||
m_copySVGShortcut = new QShortcut(copySVGSeq, this);
|
||||
connect(m_copySVGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_svg()));
|
||||
m_copyTIFShortcut = new QShortcut(copyTIFSeq, this);
|
||||
|
@ -594,20 +592,20 @@ bool MainWindow::save()
|
|||
QDir::toNativeSeparators(QDir::homePath())).toString());
|
||||
|
||||
suffixes << QSL("eps") << QSL("gif") << QSL("svg") << QSL("bmp") << QSL("pcx") << QSL("emf") << QSL("tif");
|
||||
#ifdef NO_PNG
|
||||
suffix = settings.value(QSL("studio/default_suffix"), QSL("gif")).toString();
|
||||
save_dialog.setNameFilter(tr(
|
||||
"Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif)"
|
||||
";;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx)"
|
||||
";;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)"));
|
||||
#else
|
||||
suffix = settings.value(QSL("studio/default_suffix"), QSL("png")).toString();
|
||||
save_dialog.setNameFilter(tr(
|
||||
"Portable Network Graphic (*.png);;Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif)"
|
||||
";;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx)"
|
||||
";;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)"));
|
||||
suffixes << QSL("png");
|
||||
#endif
|
||||
if (m_bc.bc.noPng()) {
|
||||
suffix = settings.value(QSL("studio/default_suffix"), QSL("gif")).toString();
|
||||
save_dialog.setNameFilter(tr(
|
||||
"Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif)"
|
||||
";;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx)"
|
||||
";;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)"));
|
||||
} else {
|
||||
suffix = settings.value(QSL("studio/default_suffix"), QSL("png")).toString();
|
||||
save_dialog.setNameFilter(tr(
|
||||
"Portable Network Graphic (*.png);;Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif)"
|
||||
";;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx)"
|
||||
";;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)"));
|
||||
suffixes << QSL("png");
|
||||
}
|
||||
|
||||
if (QString::compare(suffix, QSL("png"), Qt::CaseInsensitive) == 0)
|
||||
save_dialog.selectNameFilter(tr("Portable Network Graphic (*.png)"));
|
||||
|
@ -1290,14 +1288,12 @@ void MainWindow::copy_to_clipboard_pcx()
|
|||
copy_to_clipboard(QSL(".zint.pcx"), QSL("PCX"), "image/x-pcx");
|
||||
}
|
||||
|
||||
#ifndef NO_PNG
|
||||
void MainWindow::copy_to_clipboard_png()
|
||||
{
|
||||
copy_to_clipboard(QSL(".zint.png"), QSL("PNG"));
|
||||
if (!m_bc.bc.noPng()) {
|
||||
copy_to_clipboard(QSL(".zint.png"), QSL("PNG"));
|
||||
}
|
||||
}
|
||||
#else
|
||||
void MainWindow::copy_to_clipboard_png() {} // Workaround Qt not parsing #ifndef NO_PNG in slots
|
||||
#endif
|
||||
|
||||
void MainWindow::copy_to_clipboard_svg()
|
||||
{
|
||||
|
@ -1394,9 +1390,9 @@ void MainWindow::view_context_menu(const QPoint &pos)
|
|||
#ifdef MAINWINDOW_COPY_PCX
|
||||
menu.addAction(m_copyPCXAct);
|
||||
#endif
|
||||
#ifndef NO_PNG
|
||||
menu.addAction(m_copyPNGAct);
|
||||
#endif
|
||||
if (!m_bc.bc.noPng()) {
|
||||
menu.addAction(m_copyPNGAct);
|
||||
}
|
||||
menu.addAction(m_copySVGAct);
|
||||
menu.addAction(m_copyTIFAct);
|
||||
menu.addSeparator();
|
||||
|
@ -2984,12 +2980,12 @@ void MainWindow::createActions()
|
|||
connect(m_copyPCXAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_pcx()));
|
||||
#endif
|
||||
|
||||
#ifndef NO_PNG
|
||||
m_copyPNGAct = new QAction(copyIcon, tr("Copy as &PNG"), this);
|
||||
m_copyPNGAct->setStatusTip(tr("Copy to clipboard as PNG"));
|
||||
m_copyPNGAct->setShortcut(copyPNGSeq);
|
||||
connect(m_copyPNGAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_png()));
|
||||
#endif
|
||||
if (!m_bc.bc.noPng()) {
|
||||
m_copyPNGAct = new QAction(copyIcon, tr("Copy as &PNG"), this);
|
||||
m_copyPNGAct->setStatusTip(tr("Copy to clipboard as PNG"));
|
||||
m_copyPNGAct->setShortcut(copyPNGSeq);
|
||||
connect(m_copyPNGAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_png()));
|
||||
}
|
||||
|
||||
m_copySVGAct = new QAction(copyIcon, tr("Copy as S&VG"), this);
|
||||
m_copySVGAct->setStatusTip(tr("Copy to clipboard as SVG"));
|
||||
|
@ -3048,9 +3044,9 @@ void MainWindow::createMenu()
|
|||
#ifdef MAINWINDOW_COPY_PCX
|
||||
m_menu->addAction(m_copyPCXAct);
|
||||
#endif
|
||||
#ifndef NO_PNG
|
||||
m_menu->addAction(m_copyPNGAct);
|
||||
#endif
|
||||
if (!m_bc.bc.noPng()) {
|
||||
m_menu->addAction(m_copyPNGAct);
|
||||
}
|
||||
m_menu->addAction(m_copySVGAct);
|
||||
m_menu->addAction(m_copyTIFAct);
|
||||
m_menu->addSeparator();
|
||||
|
@ -3083,9 +3079,9 @@ void MainWindow::enableActions()
|
|||
#ifdef MAINWINDOW_COPY_PCX
|
||||
m_copyPCXAct->setEnabled(enabled);
|
||||
#endif
|
||||
#ifndef NO_PNG
|
||||
m_copyPNGAct->setEnabled(enabled);
|
||||
#endif
|
||||
if (!m_bc.bc.noPng()) {
|
||||
m_copyPNGAct->setEnabled(enabled);
|
||||
}
|
||||
m_copySVGAct->setEnabled(enabled);
|
||||
m_copyTIFAct->setEnabled(enabled);
|
||||
m_openCLIAct->setEnabled(enabled);
|
||||
|
@ -3096,9 +3092,9 @@ void MainWindow::enableActions()
|
|||
m_copyBMPShortcut->setEnabled(enabled);
|
||||
m_copyEMFShortcut->setEnabled(enabled);
|
||||
m_copyGIFShortcut->setEnabled(enabled);
|
||||
#ifndef NO_PNG
|
||||
m_copyPNGShortcut->setEnabled(enabled);
|
||||
#endif
|
||||
if (!m_bc.bc.noPng()) {
|
||||
m_copyPNGShortcut->setEnabled(enabled);
|
||||
}
|
||||
m_copySVGShortcut->setEnabled(enabled);
|
||||
m_copyTIFShortcut->setEnabled(enabled);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public slots:
|
|||
void copy_to_clipboard_emf();
|
||||
void copy_to_clipboard_eps();
|
||||
void copy_to_clipboard_gif();
|
||||
void copy_to_clipboard_png(); // Note Qt can't handle #ifndef NO_PNG in slots
|
||||
void copy_to_clipboard_png();
|
||||
void copy_to_clipboard_pcx();
|
||||
void copy_to_clipboard_svg();
|
||||
void copy_to_clipboard_tif();
|
||||
|
@ -201,9 +201,7 @@ private:
|
|||
QShortcut *m_copyBMPShortcut;
|
||||
QShortcut *m_copyEMFShortcut;
|
||||
QShortcut *m_copyGIFShortcut;
|
||||
#ifndef NO_PNG
|
||||
QShortcut *m_copyPNGShortcut;
|
||||
#endif
|
||||
QShortcut *m_copySVGShortcut;
|
||||
QShortcut *m_copyTIFShortcut;
|
||||
QAction *m_copyBMPAct;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue