Merge branch 'qt5'

This commit is contained in:
Robin Stuart 2017-04-11 07:54:28 +01:00
commit ff6995070b
58 changed files with 2869 additions and 196 deletions

View File

@ -62,21 +62,28 @@ ENDIF(APPLE)
add_subdirectory(backend) add_subdirectory(backend)
add_subdirectory(frontend) add_subdirectory(frontend)
find_package(Qt4) find_package(Qt5Widgets)
find_package(Qt5Gui)
find_package(Qt5UiTools)
if (QT4_FOUND) if (Qt5Widgets_FOUND)
if (Qt5Gui_FOUND)
if (Qt5UiTools_FOUND)
set( QT_USE_QTGUI TRUE ) set( QT_USE_QTGUI TRUE )
set( QT_USE_QTUITOOLS TRUE ) set( QT_USE_QTUITOOLS TRUE )
set( QT_USE_QTXML TRUE ) set( QT_USE_QTXML TRUE )
include( ${QT_USE_FILE} )
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${QT_INCLUDE_DIR} ${Qt5Widgets_INCLUDES}
${Qt5Gui_INCLUDES}
${Qt5UiTools_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
add_subdirectory(backend_qt4) add_subdirectory(backend_qt)
add_subdirectory(frontend_qt4) add_subdirectory(frontend_qt)
endif(QT4_FOUND) endif(Qt5UiTools_FOUND)
endif(Qt5Gui_FOUND)
endif(Qt5Widgets_FOUND)
CONFIGURE_FILE( CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"

View File

@ -15,8 +15,7 @@ add_dependencies(QZint zint)
link_directories( "${CMAKE_BINARY_DIR}/backend" ) link_directories( "${CMAKE_BINARY_DIR}/backend" )
target_link_libraries(QZint zint ${QT_QTGUI_LIBRARY} target_link_libraries(QZint zint Qt5::Widgets Qt5::Gui )
${QT_QTCORE_LIBRARY} )
install(TARGETS QZint ${INSTALL_TARGETS_DEFAULT_ARGS} ) install(TARGETS QZint ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(FILES qzint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) install(FILES qzint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)

View File

@ -19,7 +19,7 @@ TARGET = QtZint
INCLUDEPATH += ../backend INCLUDEPATH += ../backend
#EDIT THIS !!!! #EDIT THIS !!!!
DEFINES += ZINT_VERSION="\\\"2.5.0\\\"" DEFINES += ZINT_VERSION="\\\"2.5.1\\\""
!contains(DEFINES, NO_PNG) { !contains(DEFINES, NO_PNG) {
INCLUDEPATH += ../../lpng INCLUDEPATH += ../../lpng

View File

@ -40,8 +40,10 @@ namespace Zint {
m_input_mode = UNICODE_MODE; m_input_mode = UNICODE_MODE;
m_scale = 1.0; m_scale = 1.0;
m_option_3 = 0; m_option_3 = 0;
m_hidetext = FALSE; m_hidetext = 0;
m_dot_size = 4.0 / 5.0; m_dot_size = 4.0 / 5.0;
target_size_horiz = 0;
target_size_vert = 0;
} }
QZint::~QZint() { QZint::~QZint() {
@ -75,7 +77,7 @@ namespace Zint {
m_zintSymbol->option_3 = m_option_3; m_zintSymbol->option_3 = m_option_3;
} }
QByteArray bstr = m_text.toUtf8(); QByteArray bstr = m_text.toUtf8();
QByteArray pstr = m_primaryMessage.left(99).toAscii(); QByteArray pstr = m_primaryMessage.left(99).toLatin1();
strcpy(m_zintSymbol->primary, pstr.data()); strcpy(m_zintSymbol->primary, pstr.data());
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length()); int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length());
if (error > ZINT_WARN_INVALID_OPTION) if (error > ZINT_WARN_INVALID_OPTION)
@ -116,6 +118,11 @@ namespace Zint {
m_text = text; m_text = text;
} }
void QZint::setTargetSize(int width, int height) {
target_size_horiz = width;
target_size_vert = height;
}
QString QZint::primaryMessage() { QString QZint::primaryMessage() {
return m_primaryMessage; return m_primaryMessage;
} }
@ -258,12 +265,12 @@ namespace Zint {
} }
m_zintSymbol->scale = m_scale; m_zintSymbol->scale = m_scale;
QByteArray bstr = m_text.toUtf8(); QByteArray bstr = m_text.toUtf8();
QByteArray pstr = m_primaryMessage.left(99).toAscii(); QByteArray pstr = m_primaryMessage.left(99).toLatin1();
QByteArray fstr = filename.left(255).toAscii(); QByteArray fstr = filename.left(255).toLatin1();
strcpy(m_zintSymbol->primary, pstr.data()); strcpy(m_zintSymbol->primary, pstr.data());
strcpy(m_zintSymbol->outfile, fstr.data()); strcpy(m_zintSymbol->outfile, fstr.data());
QByteArray fgcol = fg_colour_hash.right(6).toAscii(); QByteArray fgcol = fg_colour_hash.right(6).toLatin1();
QByteArray bgcol = bg_colour_hash.right(6).toAscii(); QByteArray bgcol = bg_colour_hash.right(6).toLatin1();
strcpy(m_zintSymbol->fgcolour, fgcol.data()); strcpy(m_zintSymbol->fgcolour, fgcol.data());
strcpy(m_zintSymbol->bgcolour, bgcol.data()); strcpy(m_zintSymbol->bgcolour, bgcol.data());
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length()); int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length());
@ -294,10 +301,14 @@ namespace Zint {
} }
void QZint::render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode) { void QZint::render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode) {
encode();
bool textdone; bool textdone;
int comp_offset = 0, xoffset = m_whitespace, j, main_width = 0, addon_text_height = 0; int comp_offset = 0;
int xoffset = m_whitespace;
int j, main_width = 0, addon_text_height = 0;
int yoffset = 0; int yoffset = 0;
encode();
QString caption = QString::fromUtf8((const char *) m_zintSymbol->text, -1); QString caption = QString::fromUtf8((const char *) m_zintSymbol->text, -1);
QFont fontSmall(fontstyle); QFont fontSmall(fontstyle);
fontSmall.setPixelSize(fontPixelSizeSmall); fontSmall.setPixelSize(fontPixelSizeSmall);
@ -305,6 +316,7 @@ namespace Zint {
fontLarge.setPixelSize(fontPixelSizeLarge); fontLarge.setPixelSize(fontPixelSizeLarge);
if (m_lastError.length()) { if (m_lastError.length()) {
fontLarge.setPointSize(14);
painter.setFont(fontLarge); painter.setFont(fontLarge);
painter.drawText(paintRect, Qt::AlignCenter, m_lastError); painter.drawText(paintRect, Qt::AlignCenter, m_lastError);
return; return;
@ -312,6 +324,7 @@ namespace Zint {
painter.save(); painter.save();
painter.setClipRect(paintRect, Qt::IntersectClip); painter.setClipRect(paintRect, Qt::IntersectClip);
qreal xtr = paintRect.x(); qreal xtr = paintRect.x();
qreal ytr = paintRect.y(); qreal ytr = paintRect.y();
@ -334,10 +347,8 @@ namespace Zint {
qreal gwidth = m_zintSymbol->width; qreal gwidth = m_zintSymbol->width;
qreal gheight = m_zintSymbol->height; qreal gheight = m_zintSymbol->height;
if (m_zintSymbol->symbology == BARCODE_MAXICODE) { if (m_zintSymbol->symbology == BARCODE_MAXICODE) {
// gheight *= (maxi_width); gwidth = (33.0 * maxi_width) + xoffset + xoffset;
// gwidth *= (maxi_width + 1); gheight = (32.0 * maxi_width) + yoffset + yoffset;
gwidth *= 2.0;
gheight *= 2.0;
} }
if (m_zintSymbol->output_options & BARCODE_DOTTY_MODE) { if (m_zintSymbol->output_options & BARCODE_DOTTY_MODE) {
@ -358,13 +369,7 @@ namespace Zint {
textoffset = 0; textoffset = 0;
} }
gwidth += m_zintSymbol->whitespace_width * 2; gwidth += m_zintSymbol->whitespace_width * 2;
// switch (mode) {
// case IgnoreAspectRatio:
// xsf = (qreal) paintRect.width() / gwidth;
// ysf = (qreal) paintRect.height() / gheight;
// break;
//
// case KeepAspectRatio:
if (paintRect.width() / gwidth < paintRect.height() / gheight) { if (paintRect.width() / gwidth < paintRect.height() / gheight) {
ysf = xsf = (qreal) paintRect.width() / gwidth; ysf = xsf = (qreal) paintRect.width() / gwidth;
ytr += (qreal) (paintRect.height() - gheight * ysf) / 2; ytr += (qreal) (paintRect.height() - gheight * ysf) / 2;
@ -372,13 +377,6 @@ namespace Zint {
ysf = xsf = (qreal) paintRect.height() / gheight; ysf = xsf = (qreal) paintRect.height() / gheight;
xtr += (qreal) (paintRect.width() - gwidth * xsf) / 2; xtr += (qreal) (paintRect.width() - gwidth * xsf) / 2;
} }
// break;
// case CenterBarCode:
// xtr += ((qreal) paintRect.width() - gwidth * xsf) / 2;
// ytr += ((qreal) paintRect.height() - gheight * ysf) / 2;
// break;
// }
painter.setBackground(QBrush(m_bgColor)); painter.setBackground(QBrush(m_bgColor));
painter.fillRect(paintRect, QBrush(m_bgColor)); painter.fillRect(paintRect, QBrush(m_bgColor));
@ -386,11 +384,11 @@ namespace Zint {
painter.scale(xsf, ysf); painter.scale(xsf, ysf);
QPen p; QPen p;
p.setColor(m_fgColor); p.setColor(m_fgColor);
p.setWidth(m_borderWidth); p.setWidth(m_borderWidth);
painter.setPen(p); painter.setPen(p);
QPainterPath pt;
if (m_zintSymbol->symbology != BARCODE_MAXICODE) { if (m_zintSymbol->symbology != BARCODE_MAXICODE) {
/* Draw boundary bars or boxes around the symbol */ /* Draw boundary bars or boxes around the symbol */
switch (m_border) { switch (m_border) {

View File

@ -94,6 +94,8 @@ public:
void setHideText(bool hide); void setHideText(bool hide);
void setTargetSize(int width, int height);
private: private:
void encode(); void encode();
int module_set(int y_coord, int x_coord); int module_set(int y_coord, int x_coord);
@ -119,6 +121,8 @@ private:
int m_option_3; int m_option_3;
bool m_hidetext; bool m_hidetext;
float m_dot_size; float m_dot_size;
int target_size_horiz;
int target_size_vert;
}; };
} }
#endif #endif

View File

@ -2,25 +2,24 @@
project(zint-qt) project(zint-qt)
include_directories(BEFORE "${CMAKE_SOURCE_DIR}/backend" "${CMAKE_SOURCE_DIR}/backend_qt4") include_directories(BEFORE "${CMAKE_SOURCE_DIR}/backend" "${CMAKE_SOURCE_DIR}/backend_qt")
set(zint-qt_SRCS barcodeitem.cpp main.cpp mainwindow.cpp datawindow.cpp sequencewindow.cpp exportwindow.cpp) set(zint-qt_SRCS barcodeitem.cpp main.cpp mainwindow.cpp datawindow.cpp sequencewindow.cpp exportwindow.cpp)
QT4_WRAP_CPP(zint-qt_SRCS mainwindow.h datawindow.h sequencewindow.h exportwindow.h) QT5_WRAP_CPP(zint-qt_SRCS mainwindow.h datawindow.h sequencewindow.h exportwindow.h)
QT4_WRAP_UI(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui) QT5_WRAP_UI(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui)
# grpAztec.ui grpC39.ui grpDM.ui grpMSICheck.ui # grpAztec.ui grpC39.ui grpDM.ui grpMSICheck.ui
# grpC128.ui grpChannel.ui grpMicroPDF.ui grpPDF417.ui # grpC128.ui grpChannel.ui grpMicroPDF.ui grpPDF417.ui
# grpC16k.ui grpCodablock.ui grpMQR.ui grpQR.ui # grpC16k.ui grpCodablock.ui grpMQR.ui grpQR.ui
# grpMaxicode.ui) # grpMaxicode.ui)
QT4_ADD_RESOURCES(zint-qt_SRCS resources.qrc) QT5_ADD_RESOURCES(zint-qt_SRCS resources.qrc)
add_executable(zint-qt ${zint-qt_SRCS}) add_executable(zint-qt ${zint-qt_SRCS})
add_dependencies(zint-qt QZint zint) add_dependencies(zint-qt QZint zint)
link_directories( "${CMAKE_BINARY_DIR}/backend" "${CMAKE_BINARY_DIR}/backend_qt4" ) link_directories( "${CMAKE_BINARY_DIR}/backend" "${CMAKE_BINARY_DIR}/backend_qt" )
target_link_libraries(zint-qt zint QZint ${QT_QTUITOOLS_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTGUI_LIBRARY} target_link_libraries(zint-qt zint QZint Qt5::UiTools ${QT_QTXML_LIBRARY} Qt5::Gui Qt5::Core )
${QT_QTCORE_LIBRARY} )
install(TARGETS zint-qt DESTINATION "${BIN_INSTALL_DIR}" RUNTIME) install(TARGETS zint-qt DESTINATION "${BIN_INSTALL_DIR}" RUNTIME)

View File

@ -0,0 +1,51 @@
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "qtZint"
#define MyAppVersion "2.5.1"
#define MyAppPublisher "Robin Stuart"
#define MyAppURL "http://zint.org.uk/"
#define MyAppExeName "qtZint.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{51A55206-3370-498A-9DFC-0FCAEA98278D}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=..\COPYING
OutputDir=.
OutputBaseFilename=zint{#MyAppVersion}_win_setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "release\qtZint.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "release\Qt5Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "release\Qt5Gui.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "release\Qt5Widgets.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

2590
frontend_qt/Makefile.Debug Normal file

File diff suppressed because one or more lines are too long

View File

@ -20,15 +20,19 @@
BarcodeItem::BarcodeItem() BarcodeItem::BarcodeItem()
: QGraphicsItem() : QGraphicsItem()
{ {
w=550; w=693;
h=230; h=378; // Default widget size when created
} }
BarcodeItem::~BarcodeItem() BarcodeItem::~BarcodeItem()
{ {
} }
void BarcodeItem::setSize(int width, int height) {
w = width;
h = height;
}
QRectF BarcodeItem::boundingRect() const QRectF BarcodeItem::boundingRect() const
{ {
return QRectF(0, 0, w, h); return QRectF(0, 0, w, h);

View File

@ -29,12 +29,15 @@ class BarcodeItem : public QGraphicsItem
public: public:
BarcodeItem(); BarcodeItem();
~BarcodeItem(); ~BarcodeItem();
void setSize(int width, int height);
QRectF boundingRect() const; QRectF boundingRect() const;
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
private:
int w, h;
public: public:
mutable Zint::QZint bc; mutable Zint::QZint bc;
int w,h;
Zint::QZint::AspectRatioMode ar; Zint::QZint::AspectRatioMode ar;
}; };

View File

@ -107,7 +107,7 @@ void ExportWindow::process()
for(m = 0; m < dataString.length(); m++) { for(m = 0; m < dataString.length(); m++) {
name_qchar = dataString[m]; name_qchar = dataString[m];
name_char = name_qchar.toAscii(); name_char = name_qchar.toLatin1();
switch(name_char) { switch(name_char) {
case '\\': url_escaped += "%5C"; break; case '\\': url_escaped += "%5C"; break;
@ -145,8 +145,8 @@ void ExportWindow::process()
} }
break; break;
} }
barcode->bc.setText(dataString.toAscii().data()); barcode->bc.setText(dataString.toLatin1().data());
barcode->bc.save_to_file(fileName.toAscii().data()); barcode->bc.save_to_file(fileName.toLatin1().data());
inputpos += datalen + 1; inputpos += datalen + 1;
} }
close(); close();

View File

@ -1,12 +1,11 @@
######################################################################
# Automatically generated by qmake (2.01a) sub 29. kol 22:15:57 2009
######################################################################
TEMPLATE = app TEMPLATE = app
TARGET = qtZint TARGET = qtZint
DEPENDPATH += . debug release DEPENDPATH += . debug release
INCLUDEPATH += . INCLUDEPATH += .
QT += gui
QT += uitools
QT += widgets
QT += uitools
# Input # Input
HEADERS += barcodeitem.h \ HEADERS += barcodeitem.h \
@ -53,16 +52,18 @@ RESOURCES += resources.qrc
# Static target following http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows # Static target following http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows
CONFIG += static CONFIG += static
CONFIG += warn_on thread qt uitools CONFIG += warn_on thread qt
INCLUDEPATH += ../backend_qt4 ../backend INCLUDEPATH += ../backend_qt ../backend
LIBS += -lqtzint -lQtCore LIBS += -lQtZint -lQt5Core
QMAKE_LIBDIR += ../backend_qt4/release QMAKE_LIBDIR += ../backend_qt/release
!contains(DEFINES, NO_PNG) { !contains(DEFINES, NO_PNG) {
LIBS += -llibpng -lzlib # Win
QMAKE_LIBDIR+=../../lpng\projects\visualc71_converted_to_9\Win32_LIB_Release ../../lpng\projects\visualc71_converted_to_9\Win32_LIB_Release\zlib win32:LIBS += -llibpng16 -lzlib
# LIBS += -llibpng16 -lzlib1 win32:QMAKE_LIBDIR+="../../lpng/projects/vstudio/Release Library"
# QMAKE_LIBDIR+=../../lpng\projects\visualc71_converted_to_9\Win32_DLL_Release ../../lpng\projects\visualc71_converted_to_9\Win32_DLL_Release\zlib # Unix
#unix:LIBS += -lpng -zlib
#unix:QMAKE_LIBDIR += /usr/local/lib /usr/lib/x86_64-linux-gnu/
} }

View File

@ -0,0 +1,60 @@
Harald Oehlmann
2017-03-29
How to build qzint.exe using:
- QT 5.7 installed in C:\qt\Qt5.7.1
32 bit (use the offline installer and the 32 bit package)
- MS Visual Studio 2015 (VC12)
Build static Qt:
---------------
- Download: qt-opensource-windows-x86-msvc2015-5.7.1.exe
- Klick option "source" and deselect all other special modules.
- Install to C:\qt\5.7.1 (or another folder, then change the folders in the following)
- Install Python (ActivePython-2.7.13.2713-win64-x64-401787.exe)
- Start the VS2015 x86 native console by the start menu entry:
Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts\VS2015 x86 Native Tools-Eingabeaufforderung
- cd C:\Qt\5.7.1\5.7\Src
- set QMAKESPEC=win32-msvc2015
- configure.bat -static -release -prefix c:\qt\5.7.1static -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -mp
One may set another destination folder after the -prefix option.
Attention, the upper command is one long line.
- nmake
- nmake install
The last 3 commands run around 3 hours
Zint Folder structure:
----------------------
- zint source files in $ZH
-> this file is in $ZH\frontend_qt
- png1620.zip unzipped in $ZH\..\lpng
-> $ZH\..\lpng\png.h exists
- zlib128.zip unzipped in folder $ZH\..\zlib
-> $ZH\..\zlib\zlib.h exists
Build libpng:
-------------
Open $ZH\..\lpng\projects\vstudio with VS2015 gui and convert the project
Set Project settings->C++->Code Generation->Library: Multi-Threadded DLL /MD
Copy the zlib source as required by the make file (in my case: zlib-1.2.8)
Build targets "Release Library" for zlib and libpng.
Build zint:
-----------
- Start in the start menu: "VS2015 x86 Native Tools-Eingabeaufforderung"
- set QTDIR=C:\Qt\5.7.1static
- set PATH=C:\Qt\5.7.1static\bin;%PATH%
- set QMAKESPEC=win32-msvc2015
- cd $ZH
- cd backend_qt
- qmake backend_qt.pro
- nmake clean
- nmake release
- cd ..\frontend_qt
- qmake frontend_qt.pro
- nmake clean
- nmake release
-> qzint.exe is in the release folder

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 458 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -5,22 +5,24 @@
<property name="windowModality"> <property name="windowModality">
<enum>Qt::NonModal</enum> <enum>Qt::NonModal</enum>
</property> </property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>701</width>
<height>724</height>
</rect>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>590</width> <width>420</width>
<height>600</height> <height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>590</width>
<height>600</height>
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -41,32 +43,7 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<widget class="QGraphicsView" name="view"> <widget class="QGraphicsView" name="view"/>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>1000</height>
</size>
</property>
<property name="toolTip">
<string>Resulting barcode shown here</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
@ -331,8 +308,8 @@ Remember to place [square brackets] around AI data</string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans [monotype]'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Your Data Here!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Your Data Here!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="acceptRichText"> <property name="acceptRichText">
<bool>false</bool> <bool>false</bool>

View File

@ -20,16 +20,26 @@
#include <QColorDialog> #include <QColorDialog>
#include <QUiLoader> #include <QUiLoader>
#include <QFile> #include <QFile>
#include <QRadioButton>
#include <QFileDialog>
#include <QMessageBox>
#include <QSettings>
#include "mainwindow.h" #include "mainwindow.h"
#include "datawindow.h" #include "datawindow.h"
#include "sequencewindow.h" #include "sequencewindow.h"
#include <stdio.h> #include <stdio.h>
MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl) MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
: QWidget(parent, fl),m_optionWidget(0) : QWidget(parent, fl),m_optionWidget(0)
{ {
QCoreApplication::setOrganizationName("Zint");
QCoreApplication::setOrganizationDomain("zint.org.uk");
QCoreApplication::setApplicationName("Barcode Studio");
QSettings settings;
char bstyle_text[][50] = { char bstyle_text[][50] = {
"Australia Post Redirect Code", "Australia Post Redirect Code",
"Australia Post Reply-Paid", "Australia Post Reply-Paid",
@ -100,19 +110,25 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
/* createActions(); /* createActions();
createMenus(); */ createMenus(); */
setupUi(this); scene = new QGraphicsScene(this);
view->setScene(new QGraphicsScene);
m_fgcolor=qRgb(0,0,0); setupUi(this);
m_bgcolor=qRgb(0xff,0xff,0xff); view->setScene(scene);
m_fgcolor=qRgb(settings.value("studio/ink/red", 0).toInt(),
settings.value("studio/ink/green", 0).toInt(),
settings.value("studio/ink/blue", 0).toInt());
m_bgcolor=qRgb(settings.value("studio/paper/red", 0xff).toInt(),
settings.value("studio/paper/green", 0xff).toInt(),
settings.value("studio/paper/blue", 0xff).toInt());
for (int i=0;i<metaObject()->enumerator(0).keyCount();i++) { for (int i=0;i<metaObject()->enumerator(0).keyCount();i++) {
bstyle->addItem(metaObject()->enumerator(0).key(i)); bstyle->addItem(metaObject()->enumerator(0).key(i));
bstyle->setItemText(i,bstyle_text[i]); bstyle->setItemText(i,bstyle_text[i]);
} }
bstyle->setCurrentIndex(10); bstyle->setCurrentIndex(settings.value("studio/symbology", 10).toInt());
change_options(); change_options();
scene->addItem(&m_bc);
update_preview(); update_preview();
view->scene()->addItem(&m_bc);
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(heightb, SIGNAL(valueChanged( int )), SLOT(update_preview())); connect(heightb, SIGNAL(valueChanged( int )), SLOT(update_preview()));
@ -136,6 +152,21 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
QSettings settings;
settings.setValue("studio/symbology", bstyle->currentIndex());
settings.setValue("studio/ink/red", m_fgcolor.red());
settings.setValue("studio/ink/green", m_fgcolor.green());
settings.setValue("studio/ink/blue", m_fgcolor.blue());
settings.setValue("studio/paper/red", m_bgcolor.red());
settings.setValue("studio/paper/green", m_bgcolor.green());
settings.setValue("studio/paper/blue", m_bgcolor.blue());
}
void MainWindow::resizeEvent(QResizeEvent* event)
{
QWidget::resizeEvent(event);
update_preview();
} }
void MainWindow::reset_view() void MainWindow::reset_view()
@ -177,8 +208,9 @@ void MainWindow::about()
"<p>Instruction manual is available from Sourceforge:" "<p>Instruction manual is available from Sourceforge:"
"<p>http://www.sourceforge.net/projects/zint" "<p>http://www.sourceforge.net/projects/zint"
"<p>Copyright &copy; 2006-2016 Robin Stuart.<br>" "<p>Copyright &copy; 2006-2016 Robin Stuart.<br>"
"Qt4 code by BogDan Vatra, MS Windows port by \"tgotic\".<br>" "Qt back end by BogDan Vatra, MS Windows port by \"tgotic\"."
"With thanks to Norbert Szab&oacute;, Robert Elliott," "<p>Qt version " QT_VERSION_STR
"<p>With thanks to Norbert Szab&oacute;, Robert Elliott, "
"Harald Oehlmann and many others at Sourceforge." "Harald Oehlmann and many others at Sourceforge."
"<p>Released under the GNU General Public License ver. 3 or later.<br>" "<p>Released under the GNU General Public License ver. 3 or later.<br>"
"\"QR Code\" is a Registered Trademark of Denso Corp.<br>" "\"QR Code\" is a Registered Trademark of Denso Corp.<br>"
@ -190,6 +222,7 @@ void MainWindow::about()
"ISO/IEC 24724:2011, ISO/IEC 24728:2006, ISO/IEC 24778:2008,<br>" "ISO/IEC 24724:2011, ISO/IEC 24728:2006, ISO/IEC 24778:2008,<br>"
"ANSI-HIBC 2.3-2009, ANSI/AIM BC6-2000, ANSI/AIM BC12-1998,<br>" "ANSI-HIBC 2.3-2009, ANSI/AIM BC6-2000, ANSI/AIM BC12-1998,<br>"
"AIMD014 (v 1.63), USPS-B-3200</small></td></tr></table>" "AIMD014 (v 1.63), USPS-B-3200</small></td></tr></table>"
)); ));
} }
@ -583,8 +616,10 @@ void MainWindow::maxi_primary()
void MainWindow::update_preview() void MainWindow::update_preview()
{ {
QString error; int width = view->geometry().width();
m_bc.ar=(Zint::QZint::AspectRatioMode)1; int height = view->geometry().height();
//m_bc.ar=(Zint::QZint::AspectRatioMode)1;
if(chkComposite->isChecked() == true) { if(chkComposite->isChecked() == true) {
m_bc.bc.setPrimaryMessage(txtData->text()); m_bc.bc.setPrimaryMessage(txtData->text());
m_bc.bc.setText(txtComposite->toPlainText()); m_bc.bc.setText(txtComposite->toPlainText());
@ -595,9 +630,9 @@ void MainWindow::update_preview()
m_bc.bc.setSecurityLevel(0); m_bc.bc.setSecurityLevel(0);
m_bc.bc.setWidth(0); m_bc.bc.setWidth(0);
m_bc.bc.setInputMode(UNICODE_MODE); m_bc.bc.setInputMode(UNICODE_MODE);
m_bc.bc.setHideText(FALSE); m_bc.bc.setHideText(0);
if(chkHRTHide->isChecked() == false) { if(chkHRTHide->isChecked() == false) {
m_bc.bc.setHideText(TRUE); m_bc.bc.setHideText(1);
} }
switch(metaObject()->enumerator(0).value(bstyle->currentIndex())) switch(metaObject()->enumerator(0).value(bstyle->currentIndex()))
{ {
@ -880,7 +915,8 @@ void MainWindow::update_preview()
m_bc.bc.setWhitespace(spnWhitespace->value()); m_bc.bc.setWhitespace(spnWhitespace->value());
m_bc.bc.setFgColor(m_fgcolor); m_bc.bc.setFgColor(m_fgcolor);
m_bc.bc.setBgColor(m_bgcolor); m_bc.bc.setBgColor(m_bgcolor);
m_bc.setSize(width - 10, height - 10);
m_bc.update(); m_bc.update();
view->scene()->update(); scene->setSceneRect(0, 0, width - 10, height - 10);
scene->update();
} }

View File

@ -20,6 +20,7 @@
#include <QtGui> #include <QtGui>
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QMainWindow> #include <QMainWindow>
#include <QGraphicsScene>
#include "ui_mainWindow.h" #include "ui_mainWindow.h"
#include "barcodeitem.h" #include "barcodeitem.h"
@ -105,7 +106,7 @@ public:
}; };
public: public:
MainWindow(QWidget* parent = 0, Qt::WFlags fl = 0); MainWindow(QWidget* parent = 0, Qt::WindowFlags fl = 0);
~MainWindow(); ~MainWindow();
@ -119,6 +120,9 @@ public slots:
void maxi_primary(); void maxi_primary();
void change_print_scale(); void change_print_scale();
protected:
void resizeEvent(QResizeEvent *event);
private slots: private slots:
bool save(); bool save();
void about(); void about();
@ -134,6 +138,7 @@ private:
QColor m_fgcolor,m_bgcolor; QColor m_fgcolor,m_bgcolor;
BarcodeItem m_bc; BarcodeItem m_bc;
QWidget *m_optionWidget; QWidget *m_optionWidget;
QGraphicsScene *scene;
/* QMenu *fileMenu; /* QMenu *fileMenu;
QMenu *helpMenu; QMenu *helpMenu;
QAction *saveAct; QAction *saveAct;

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -73,7 +73,7 @@ QString SequenceWindow::apply_format(QString raw_number)
for(i = format_len; i > 0; i--) { for(i = format_len; i > 0; i--) {
format_qchar = format[i - 1]; format_qchar = format[i - 1];
format_char = format_qchar.toAscii(); format_char = format_qchar.toLatin1();
switch(format_char) { switch(format_char) {
case '#': case '#':
if (inpos > 0) { if (inpos > 0) {

View File

@ -1,55 +0,0 @@
Harald Oehlmann
2016-02-28
How to build qzint.exe using:
- QT 4
- MS Visual Studio 2008 (VC9)
Folder structure:
- zint source files in $ZH
-> this file is in $ZH\frontend_qt4
- png1620.zip unzipped in $ZH\..\lpng
-> $ZH\..\lpng\png.h exists
- zlib128.zip inzipped in folder $ZH\..\zlib
-> $ZH\..\zlib\zlib.h exists
Prepare qt for static build
- Start "Visual Studio 2008 Command Line" (or execute "%VS90COMNTOOLS%vsvars32.bat" )
- cd c:\qt\4.8.6
- configure -static -release -qt-zlib -qt-libpng -qt-libjpeg
- nmake
-> took around 2 hours for me
Build pnglib and zlib
- cd $ZH\..\lpng\projects
- copy visual71 visual71_converted_to_9
- Start Visual Studio 2..8 (CV9)
- open Project: $ZH\..\lpng\projects\visualc71_converted_to_9\libpng.sln
- convert it as proposed by the IDE (no backup, we have made a copy before)
- select "LIB Release" configuration
- go to project "libpng" and open project options (ALT-F7)
- On the left, select "C/C++->Code generation"
- On the right change "Run time library" from "Multi-Treaded (/MT)" to "Multithread-DLL (/MD)"
- also do the upper steps for the project "zlib" (change /MT to /MD)
- Build libpng and zlib project using the Buildall menu entry
-> this compiles png in the static lib:
lpng\projects\visualc71_converted_to_9\Win32_LIB_Release\libpng.lib
and zlib into the static lib
lpng\projects\visualc71_converted_to_9\Win32_LIB_Release\zlib\zlib.lib
Build zint
- Start "Visual Studio 2008 Command Line" (or execute "%VS90COMNTOOLS%vsvars32.bat" )
- C:\Qt\4.8.6\bin\qtvars.bat
- cd $ZH
- cd backend_qt4
- qmake backend_qt4.pro
- nmake clean
- nmake release
- cd ..\frontend_qt4
- qmake frontend_qt4.pro
- nmake clean
- nmake release
-> qzint.exe is in the release folder

View File

@ -1,3 +0,0 @@
[Dolphin]
ShowPreview=true
Timestamp=2010,5,29,7,36,6

View File

@ -1,3 +0,0 @@
[Dolphin]
ShowPreview=true
Timestamp=2010,5,29,7,59,30