mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Initial transfer from CVS
Transfer of version 2.3.2 from CVS repository
This commit is contained in:
22
backend_qt4/CMakeLists.txt
Normal file
22
backend_qt4/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
||||
# (c) 2008 by BogDan Vatra < bogdan@licentia.eu >
|
||||
|
||||
project(QZint)
|
||||
|
||||
include_directories(BEFORE "${CMAKE_SOURCE_DIR}/backend" )
|
||||
|
||||
set(QZint_SRCS qzint.cpp)
|
||||
|
||||
add_library(QZint SHARED ${QZint_SRCS})
|
||||
|
||||
set_target_properties(QZint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
||||
VERSION ${ZINT_VERSION})
|
||||
|
||||
add_dependencies(QZint zint)
|
||||
|
||||
link_directories( "${CMAKE_BINARY_DIR}/backend" )
|
||||
|
||||
target_link_libraries(QZint zint ${QT_QTGUI_LIBRARY}
|
||||
${QT_QTCORE_LIBRARY} )
|
||||
|
||||
install(TARGETS QZint ${INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||
install(FILES qzint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
|
20
backend_qt4/QtZint2.sln
Normal file
20
backend_qt4/QtZint2.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QtZint2", "QtZint2.vcproj", "{54ADAB01-7047-3ED1-B8D2-7AC84B1C5090}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{54ADAB01-7047-3ED1-B8D2-7AC84B1C5090}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{54ADAB01-7047-3ED1-B8D2-7AC84B1C5090}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{54ADAB01-7047-3ED1-B8D2-7AC84B1C5090}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{54ADAB01-7047-3ED1-B8D2-7AC84B1C5090}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
411
backend_qt4/QtZint2.vcproj
Normal file
411
backend_qt4/QtZint2.vcproj
Normal file
@ -0,0 +1,411 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="QtZint2"
|
||||
ProjectGUID="{54ADAB01-7047-3ED1-B8D2-7AC84B1C5090}"
|
||||
Keyword="Qt4VSv1.0"
|
||||
TargetFrameworkVersion="0"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="."
|
||||
IntermediateDirectory="debug\"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
WarningLevel="0"
|
||||
DefaultCharType="0"
|
||||
EnableErrorChecks="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="-Zm200 -w34100 -w34189 -w34100 -w34189"
|
||||
Optimization="4"
|
||||
AdditionalIncludeDirectories=""d:\Prog\Qt\4.6.0-beta1\include\QtCore","d:\Prog\Qt\4.6.0-beta1\include\QtGui","d:\Prog\Qt\4.6.0-beta1\include","..\backend","d:\opt\include","d:\Prog\Qt\4.6.0-beta1\include\ActiveQt","debug",d:\Prog\Qt\4.6.0-beta1\mkspecs\default"
|
||||
PreprocessorDefinitions="UNICODE;WIN32;QT_LARGEFILE_SUPPORT;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION=\"2.3.0\";QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT"
|
||||
GeneratePreprocessedFile="0"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
RuntimeTypeInfo="true"
|
||||
AssemblerListingLocation="debug\"
|
||||
ObjectFile="debug\"
|
||||
ProgramDataBaseFileName=".\"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="2"
|
||||
DisableSpecificWarnings="4018,4244,4305"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,_CRT_SECURE_NO_WARNINGS,_CRT_NONSTDC_NO_WARNINGS,ZINT_VERSION=\"2.3.0\",QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,_DEBUG"
|
||||
ResourceOutputFileName="debug\/$(InputName).res"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="debug\QtZint2.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="."
|
||||
IntermediateDirectory="release\"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
WarningLevel="0"
|
||||
DefaultCharType="0"
|
||||
EnableErrorChecks="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="-Zm200 -w34100 -w34189 -w34100 -w34189"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""d:\Prog\Qt\4.6.0-beta1\include\QtCore","d:\Prog\Qt\4.6.0-beta1\include\QtGui","d:\Prog\Qt\4.6.0-beta1\include","..\backend","d:\opt\include","d:\Prog\Qt\4.6.0-beta1\include\ActiveQt","release",d:\Prog\Qt\4.6.0-beta1\mkspecs\default"
|
||||
PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,_CRT_SECURE_NO_WARNINGS,_CRT_NONSTDC_NO_WARNINGS,ZINT_VERSION=\"2.3.0\",QT_NO_DEBUG,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,NDEBUG"
|
||||
GeneratePreprocessedFile="0"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
RuntimeTypeInfo="true"
|
||||
AssemblerListingLocation="release\"
|
||||
ObjectFile="release\"
|
||||
ProgramDataBaseFileName=".\"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="2"
|
||||
DisableSpecificWarnings="4018,4244,4305"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,_CRT_SECURE_NO_WARNINGS,_CRT_NONSTDC_NO_WARNINGS,ZINT_VERSION=\"2.3.0\",QT_NO_DEBUG,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT"
|
||||
ResourceOutputFileName="release\/$(InputName).res"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="release\QtZint2.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\backend\2of5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\auspost.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\aztec.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\blockf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\code.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\code1.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\code128.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\code16k.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\code49.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\common.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\composite.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\dm200.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\dmatrix.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\gridmtx.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\gs1.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\imail.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\large.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\library.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\maxicode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\medical.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\pdf417.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\plessey.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\png.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\postal.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\ps.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\qr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="qzint.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\reedsol.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\rss.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\svg.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\telepen.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\upcean.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\backend\aztec.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\code1.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\code49.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\common.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\composite.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\dm200.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\dmatrix.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\font.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\gb2312.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\gridmtx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\gs1.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\large.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\maxicode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\maxipng.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\ms_stdint.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\pdf417.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\qr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="qzint.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\reedsol.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\rss.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\sjis.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\backend\zint.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
110
backend_qt4/backend_qt4.pro
Normal file
110
backend_qt4/backend_qt4.pro
Normal file
@ -0,0 +1,110 @@
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += dll
|
||||
|
||||
macx{
|
||||
CONFIG -= dll
|
||||
CONFIG += lib_bundle
|
||||
}
|
||||
|
||||
TARGET = QtZint
|
||||
|
||||
INCLUDEPATH += ../backend
|
||||
|
||||
#EDIT THIS !!!!
|
||||
DEFINES += NO_PNG NO_QR ZINT_VERSION="2.3.0"
|
||||
|
||||
!contains(DEFINES, NO_PNG) {
|
||||
SOURCES += ../backend/png.c
|
||||
LIBS += -lpng
|
||||
}
|
||||
|
||||
contains(DEFINES, QR_SYSTEM){
|
||||
LIBS += -lqrencode
|
||||
}
|
||||
|
||||
contains(DEFINES, QR){
|
||||
|
||||
INCLUDEPATH += qrencode
|
||||
|
||||
HEADERS += qrencode/bitstream.h \
|
||||
qrencode/mask.h \
|
||||
qrencode/qrencode.h \
|
||||
qrencode/qrencode_inner.h \
|
||||
qrencode/qrinput.h \
|
||||
qrencode/qrspec.h \
|
||||
qrencode/rscode.h \
|
||||
qrencode/split.h
|
||||
|
||||
SOURCES += qrencode/bitstream.c \
|
||||
qrencode/mask.c \
|
||||
qrencode/qrencode.c \
|
||||
qrencode/qrinput.c \
|
||||
qrencode/qrspec.c \
|
||||
qrencode/rscode.c \
|
||||
qrencode/split.c
|
||||
}
|
||||
|
||||
HEADERS += ../backend/aztec.h \
|
||||
../backend/code49.h \
|
||||
../backend/common.h \
|
||||
../backend/composite.h \
|
||||
../backend/dm200.h \
|
||||
../backend/dmatrix.h \
|
||||
../backend/font.h \
|
||||
../backend/gs1.h \
|
||||
../backend/large.h \
|
||||
../backend/maxicode.h \
|
||||
../backend/maxipng.h \
|
||||
../backend/micqr.h \
|
||||
../backend/pdf417.h \
|
||||
../backend/reedsol.h \
|
||||
../backend/rss.h \
|
||||
../backend/sjis.h \
|
||||
../backend/zint.h \
|
||||
qzint.h
|
||||
|
||||
SOURCES += ../backend/2of5.c \
|
||||
../backend/auspost.c \
|
||||
../backend/aztec.c \
|
||||
../backend/blockf.c \
|
||||
../backend/code.c \
|
||||
../backend/code128.c \
|
||||
../backend/code16k.c \
|
||||
../backend/code49.c \
|
||||
../backend/common.c \
|
||||
../backend/composite.c \
|
||||
../backend/dm200.c \
|
||||
../backend/dmatrix.c \
|
||||
../backend/gs1.c \
|
||||
../backend/imail.c \
|
||||
../backend/large.c \
|
||||
../backend/library.c \
|
||||
../backend/maxicode.c \
|
||||
../backend/medical.c \
|
||||
../backend/micqr.c \
|
||||
../backend/pdf417.c \
|
||||
../backend/plessey.c \
|
||||
../backend/postal.c \
|
||||
../backend/ps.c \
|
||||
../backend/reedsol.c \
|
||||
../backend/rss.c \
|
||||
../backend/svg.c \
|
||||
../backend/telepen.c \
|
||||
../backend/upcean.c \
|
||||
../backend/qr.c \
|
||||
../backend/dllversion.c \
|
||||
../backend/code1.c \
|
||||
qzint.cpp
|
||||
|
||||
VERSION = 2.3.0
|
||||
|
||||
#DESTDIR = .
|
||||
|
||||
include.path = $$[ZINT_INSTALL_HEADERS]
|
||||
include.files = ../backend/zint.h qzint.h
|
||||
|
||||
target.path = $$[ZINT_INSTALL_LIBS]
|
||||
|
||||
INSTALLS += target include
|
||||
|
74
backend_qt4/backend_vc8.pro
Normal file
74
backend_qt4/backend_vc8.pro
Normal file
@ -0,0 +1,74 @@
|
||||
win32 {
|
||||
TEMPLATE = vclib
|
||||
CONFIG += staticlib debug-and-release
|
||||
}
|
||||
|
||||
TARGET = QtZint2
|
||||
VERSION = 2.3.0
|
||||
|
||||
QMAKE_CFLAGS += /TP /wd4018 /wd4244 /wd4305
|
||||
QMAKE_CXXFLAGS += /TP /wd4018 /wd4244 /wd4305
|
||||
|
||||
INCLUDEPATH += ../backend d:\opt\include
|
||||
|
||||
DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\"
|
||||
|
||||
!contains(DEFINES, NO_PNG) {
|
||||
SOURCES += ../backend/png.c
|
||||
}
|
||||
|
||||
HEADERS += ../backend/aztec.h \
|
||||
../backend/code1.h \
|
||||
../backend/code49.h \
|
||||
../backend/common.h \
|
||||
../backend/composite.h \
|
||||
../backend/dm200.h \
|
||||
../backend/dmatrix.h \
|
||||
../backend/font.h \
|
||||
../backend/gb2312.h \
|
||||
../backend/gridmtx.h \
|
||||
../backend/gs1.h \
|
||||
../backend/large.h \
|
||||
../backend/maxicode.h \
|
||||
../backend/maxipng.h \
|
||||
../backend/ms_stdint.h \
|
||||
../backend/pdf417.h \
|
||||
../backend/qr.h \
|
||||
../backend/reedsol.h \
|
||||
../backend/rss.h \
|
||||
../backend/sjis.h \
|
||||
../backend/zint.h \
|
||||
qzint.h
|
||||
|
||||
SOURCES += ../backend/2of5.c \
|
||||
../backend/auspost.c \
|
||||
../backend/aztec.c \
|
||||
../backend/blockf.c \
|
||||
../backend/code.c \
|
||||
../backend/code1.c \
|
||||
../backend/code128.c \
|
||||
../backend/code16k.c \
|
||||
../backend/code49.c \
|
||||
../backend/common.c \
|
||||
../backend/composite.c \
|
||||
../backend/dm200.c \
|
||||
../backend/dmatrix.c \
|
||||
../backend/gridmtx.c \
|
||||
../backend/gs1.c \
|
||||
../backend/imail.c \
|
||||
../backend/large.c \
|
||||
../backend/library.c \
|
||||
../backend/maxicode.c \
|
||||
../backend/medical.c \
|
||||
../backend/pdf417.c \
|
||||
../backend/plessey.c \
|
||||
../backend/postal.c \
|
||||
../backend/ps.c \
|
||||
../backend/qr.c \
|
||||
../backend/reedsol.c \
|
||||
../backend/rss.c \
|
||||
../backend/svg.c \
|
||||
../backend/telepen.c \
|
||||
../backend/upcean.c \
|
||||
qzint.cpp
|
||||
|
717
backend_qt4/qzint.cpp
Normal file
717
backend_qt4/qzint.cpp
Normal file
@ -0,0 +1,717 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by BogDan Vatra *
|
||||
* bogdan@licentia.eu *
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qzint.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace Zint
|
||||
{
|
||||
|
||||
static const qreal maxi_diagonal=11;
|
||||
static const qreal maxi_width=1.73205807568877*maxi_diagonal/2;
|
||||
static const char* fontstyle="Arial";
|
||||
static const int fontPixelSizeSmall=6;
|
||||
static const int fontPixelSizeLarge=8;
|
||||
|
||||
QZint::QZint()
|
||||
{
|
||||
m_symbol=BARCODE_CODE128;
|
||||
m_height=50;
|
||||
m_border=NO_BORDER;
|
||||
m_borderWidth=1;
|
||||
m_securityLevel=-1;
|
||||
m_pdf417CodeWords=928;
|
||||
m_fgColor=Qt::black;
|
||||
m_bgColor=Qt::white;
|
||||
m_zintSymbol=0;
|
||||
m_error=0;
|
||||
m_input_mode = UNICODE_MODE;
|
||||
m_scale = 1.0;
|
||||
m_option_3 = 0;
|
||||
m_hidetext = FALSE;
|
||||
}
|
||||
|
||||
QZint::~QZint()
|
||||
{
|
||||
if (m_zintSymbol)
|
||||
ZBarcode_Delete(m_zintSymbol);
|
||||
}
|
||||
|
||||
void QZint::encode()
|
||||
{
|
||||
if (m_zintSymbol)
|
||||
ZBarcode_Delete(m_zintSymbol);
|
||||
|
||||
m_lastError.clear();
|
||||
m_zintSymbol = ZBarcode_Create();
|
||||
m_zintSymbol->output_options=m_border;
|
||||
m_zintSymbol->symbology=m_symbol;
|
||||
m_zintSymbol->height=m_height;
|
||||
m_zintSymbol->whitespace_width=m_whitespace;
|
||||
m_zintSymbol->border_width=m_borderWidth;
|
||||
m_zintSymbol->option_1=m_securityLevel;
|
||||
m_zintSymbol->input_mode = m_input_mode;
|
||||
m_zintSymbol->option_2=m_width;
|
||||
if(m_hidetext) {
|
||||
m_zintSymbol->show_hrt = 0;
|
||||
} else {
|
||||
m_zintSymbol->show_hrt = 1;
|
||||
}
|
||||
if(m_symbol == BARCODE_PDF417) {
|
||||
m_zintSymbol->option_3=m_pdf417CodeWords;
|
||||
} else {
|
||||
m_zintSymbol->option_3 = m_option_3;
|
||||
}
|
||||
QByteArray bstr=m_text.toUtf8();
|
||||
QByteArray pstr=m_primaryMessage.left(99).toAscii();
|
||||
strcpy(m_zintSymbol->primary,pstr.data());
|
||||
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data(), bstr.length());
|
||||
if (error > WARN_INVALID_OPTION)
|
||||
m_lastError=m_zintSymbol->errtxt;
|
||||
|
||||
if (m_zintSymbol->symbology == BARCODE_MAXICODE)
|
||||
m_zintSymbol->height = 33;
|
||||
|
||||
switch(m_zintSymbol->output_options) {
|
||||
case 0: m_border = NO_BORDER; break;
|
||||
case 2: m_border = BIND; break;
|
||||
case 4: m_border = BOX; break;
|
||||
}
|
||||
m_borderWidth = (BorderType)m_zintSymbol->border_width;
|
||||
m_whitespace = m_zintSymbol->whitespace_width;
|
||||
}
|
||||
|
||||
int QZint::symbol()
|
||||
{
|
||||
return m_symbol;
|
||||
}
|
||||
void QZint::setSymbol(int symbol)
|
||||
{
|
||||
m_symbol=symbol;
|
||||
}
|
||||
|
||||
void QZint::setInputMode(int input_mode)
|
||||
{
|
||||
m_input_mode = input_mode;
|
||||
}
|
||||
|
||||
QString QZint::text()
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
void QZint::setText(const QString & text)
|
||||
{
|
||||
m_text=text;
|
||||
}
|
||||
|
||||
QString QZint::primaryMessage()
|
||||
{
|
||||
return m_primaryMessage;
|
||||
}
|
||||
void QZint::setPrimaryMessage(const QString & primaryMessage)
|
||||
{
|
||||
m_primaryMessage=primaryMessage;
|
||||
}
|
||||
|
||||
int QZint::height()
|
||||
{
|
||||
encode();
|
||||
return (m_zintSymbol->height+(m_border!=NO_BORDER)?m_borderWidth*2:0)*(m_zintSymbol->symbology == BARCODE_MAXICODE?(maxi_width+1):1);
|
||||
}
|
||||
|
||||
void QZint::setHeight(int height)
|
||||
{
|
||||
m_height=height;
|
||||
}
|
||||
|
||||
void QZint::setWidth(int width)
|
||||
{
|
||||
m_width=width;
|
||||
}
|
||||
|
||||
void QZint::setOption3(int option)
|
||||
{
|
||||
m_option_3 = option;
|
||||
}
|
||||
|
||||
int QZint::width()
|
||||
{
|
||||
encode();
|
||||
return (m_zintSymbol->width+(m_border==BOX)?m_borderWidth*2:0)*(m_zintSymbol->symbology == BARCODE_MAXICODE?(maxi_width+1):1);
|
||||
}
|
||||
|
||||
float QZint::scale()
|
||||
{
|
||||
return m_scale;
|
||||
}
|
||||
|
||||
void QZint::setScale(float scale)
|
||||
{
|
||||
m_scale = scale;
|
||||
}
|
||||
|
||||
QColor QZint::fgColor()
|
||||
{
|
||||
return m_fgColor;
|
||||
}
|
||||
void QZint::setFgColor(const QColor & fgColor)
|
||||
{
|
||||
m_fgColor=fgColor;
|
||||
}
|
||||
|
||||
QColor QZint::bgColor()
|
||||
{
|
||||
return m_bgColor;
|
||||
}
|
||||
void QZint::setBgColor(const QColor & bgColor)
|
||||
{
|
||||
m_bgColor=bgColor;
|
||||
}
|
||||
|
||||
QZint::BorderType QZint::borderType()
|
||||
{
|
||||
return m_border;
|
||||
}
|
||||
void QZint::setBorderType(BorderType border)
|
||||
{
|
||||
m_border=border;
|
||||
}
|
||||
|
||||
int QZint::borderWidth()
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
void QZint::setBorderWidth(int boderWidth)
|
||||
{
|
||||
if (boderWidth<1 || boderWidth>16)
|
||||
boderWidth=1;
|
||||
m_borderWidth=boderWidth;
|
||||
}
|
||||
|
||||
void QZint::setWhitespace(int whitespace)
|
||||
{
|
||||
m_whitespace = whitespace;
|
||||
}
|
||||
|
||||
int QZint::pdf417CodeWords()
|
||||
{
|
||||
return m_pdf417CodeWords;
|
||||
}
|
||||
void QZint::setPdf417CodeWords(int pdf417CodeWords)
|
||||
{
|
||||
m_pdf417CodeWords=pdf417CodeWords;
|
||||
}
|
||||
|
||||
int QZint::securityLevel()
|
||||
{
|
||||
return m_securityLevel;
|
||||
}
|
||||
void QZint::setSecurityLevel(int securityLevel)
|
||||
{
|
||||
m_securityLevel=securityLevel;
|
||||
}
|
||||
|
||||
QString QZint::error_message()
|
||||
{
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
int QZint::mode()
|
||||
{
|
||||
return m_securityLevel;
|
||||
}
|
||||
void QZint::setMode(int securityLevel)
|
||||
{
|
||||
m_securityLevel=securityLevel;
|
||||
}
|
||||
|
||||
void QZint::setHideText(bool hide)
|
||||
{
|
||||
m_hidetext = hide;
|
||||
}
|
||||
|
||||
bool QZint::save_to_file(QString filename)
|
||||
{
|
||||
if (m_zintSymbol)
|
||||
ZBarcode_Delete(m_zintSymbol);
|
||||
|
||||
QString fg_colour_hash = m_fgColor.name();
|
||||
QString bg_colour_hash = m_bgColor.name();
|
||||
|
||||
m_lastError.clear();
|
||||
m_zintSymbol = ZBarcode_Create();
|
||||
m_zintSymbol->output_options=m_border;
|
||||
m_zintSymbol->symbology=m_symbol;
|
||||
m_zintSymbol->height=m_height;
|
||||
m_zintSymbol->whitespace_width=m_whitespace;
|
||||
m_zintSymbol->border_width=m_borderWidth;
|
||||
m_zintSymbol->option_1=m_securityLevel;
|
||||
m_zintSymbol->input_mode = m_input_mode;
|
||||
m_zintSymbol->option_2=m_width;
|
||||
if(m_hidetext) {
|
||||
m_zintSymbol->show_hrt = 0;
|
||||
} else {
|
||||
m_zintSymbol->show_hrt = 1;
|
||||
}
|
||||
if(m_symbol == BARCODE_PDF417) {
|
||||
m_zintSymbol->option_3=m_pdf417CodeWords;
|
||||
} else {
|
||||
m_zintSymbol->option_3 = m_option_3;
|
||||
}
|
||||
m_zintSymbol->scale=m_scale;
|
||||
QByteArray bstr=m_text.toUtf8();
|
||||
QByteArray pstr=m_primaryMessage.left(99).toAscii();
|
||||
QByteArray fstr=filename.left(255).toAscii();
|
||||
strcpy(m_zintSymbol->primary,pstr.data());
|
||||
strcpy(m_zintSymbol->outfile,fstr.data());
|
||||
QByteArray fgcol=fg_colour_hash.right(6).toAscii();
|
||||
QByteArray bgcol=bg_colour_hash.right(6).toAscii();
|
||||
strcpy(m_zintSymbol->fgcolour,fgcol.data());
|
||||
strcpy(m_zintSymbol->bgcolour,bgcol.data());
|
||||
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data(), bstr.length());
|
||||
if (error > WARN_INVALID_OPTION)
|
||||
m_lastError=m_zintSymbol->errtxt;
|
||||
error = ZBarcode_Print(m_zintSymbol, 0);
|
||||
if (error > WARN_INVALID_OPTION)
|
||||
m_lastError=m_zintSymbol->errtxt;
|
||||
if(error == 0) { return true; } else { return false; }
|
||||
}
|
||||
|
||||
int QZint::module_set(int y_coord, int x_coord)
|
||||
{
|
||||
int x_char, x_sub, result;
|
||||
|
||||
x_char = x_coord / 7;
|
||||
x_sub = x_coord % 7;
|
||||
result = 0;
|
||||
|
||||
switch(x_sub) {
|
||||
case 0: if((m_zintSymbol->encoded_data[y_coord][x_char] & 0x01) != 0) { result = 1; } break;
|
||||
case 1: if((m_zintSymbol->encoded_data[y_coord][x_char] & 0x02) != 0) { result = 1; } break;
|
||||
case 2: if((m_zintSymbol->encoded_data[y_coord][x_char] & 0x04) != 0) { result = 1; } break;
|
||||
case 3: if((m_zintSymbol->encoded_data[y_coord][x_char] & 0x08) != 0) { result = 1; } break;
|
||||
case 4: if((m_zintSymbol->encoded_data[y_coord][x_char] & 0x10) != 0) { result = 1; } break;
|
||||
case 5: if((m_zintSymbol->encoded_data[y_coord][x_char] & 0x20) != 0) { result = 1; } break;
|
||||
case 6: if((m_zintSymbol->encoded_data[y_coord][x_char] & 0x40) != 0) { result = 1; } break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void QZint::render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode)
|
||||
{
|
||||
encode();
|
||||
bool textdone;
|
||||
int comp_offset = 0, xoffset = m_whitespace, j, main_width = 0, addon_text_height = 0;
|
||||
int yoffset = 0;
|
||||
QString caption = QString::fromUtf8((const char *)m_zintSymbol->text, -1);
|
||||
QFont fontSmall(fontstyle);
|
||||
fontSmall.setPixelSize(fontPixelSizeSmall);
|
||||
QFont fontLarge(fontstyle);
|
||||
fontLarge.setPixelSize(fontPixelSizeLarge);
|
||||
|
||||
if (m_lastError.length())
|
||||
{
|
||||
painter.setFont(fontLarge);
|
||||
painter.drawText(paintRect,Qt::AlignCenter,m_lastError);
|
||||
return;
|
||||
}
|
||||
|
||||
painter.save();
|
||||
painter.setClipRect(paintRect,Qt::IntersectClip);
|
||||
qreal xtr=paintRect.x();
|
||||
qreal ytr=paintRect.y();
|
||||
|
||||
int zrow_height=m_zintSymbol->height;
|
||||
int zrows=0;
|
||||
for (int i=0;i<m_zintSymbol->rows;i++)
|
||||
{
|
||||
zrow_height-=m_zintSymbol->row_height[i];
|
||||
if (!m_zintSymbol->row_height[i])
|
||||
zrows++;
|
||||
}
|
||||
if (zrows)
|
||||
{
|
||||
zrow_height/=zrows;
|
||||
for (int i=0;i<m_zintSymbol->rows;i++)
|
||||
if (!m_zintSymbol->row_height[i])
|
||||
m_zintSymbol->row_height[i]=zrow_height;
|
||||
}
|
||||
else
|
||||
m_zintSymbol->height-=zrow_height;
|
||||
|
||||
|
||||
qreal gwidth=m_zintSymbol->width;
|
||||
qreal gheight=m_zintSymbol->height;
|
||||
if (m_zintSymbol->symbology == BARCODE_MAXICODE)
|
||||
{
|
||||
gheight*=(maxi_width);
|
||||
gwidth*=(maxi_width+1);
|
||||
}
|
||||
|
||||
qreal xsf=1;
|
||||
qreal ysf=1;
|
||||
qreal textoffset = 0;
|
||||
|
||||
gwidth+=((m_border==BOX)?m_borderWidth*2:0);
|
||||
gheight+=((m_border!=NO_BORDER)?m_borderWidth*2:0);
|
||||
if(QString((const char*)m_zintSymbol->text).isEmpty() == false) {
|
||||
textoffset = 9;
|
||||
gheight += textoffset;
|
||||
} else {
|
||||
textoffset = 0;
|
||||
}
|
||||
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)
|
||||
{
|
||||
ysf=xsf=(qreal)paintRect.width()/gwidth;
|
||||
ytr+=(qreal)(paintRect.height()-gheight*ysf)/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ysf=xsf=(qreal)paintRect.height()/gheight;
|
||||
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.fillRect(paintRect,QBrush(m_bgColor));
|
||||
painter.translate(xtr,ytr);
|
||||
painter.scale(xsf,ysf);
|
||||
|
||||
QPen p;
|
||||
p.setColor(m_fgColor);
|
||||
p.setWidth(m_borderWidth);
|
||||
painter.setPen(p);
|
||||
|
||||
QPainterPath pt;
|
||||
if(m_zintSymbol->symbology != BARCODE_MAXICODE) {
|
||||
/* Draw boundary bars or boxes around the symbol */
|
||||
switch(m_border)
|
||||
{
|
||||
case BOX:
|
||||
painter.fillRect(0,m_borderWidth,m_borderWidth,m_zintSymbol->height,QBrush(m_fgColor));
|
||||
painter.fillRect(m_zintSymbol->width + xoffset + xoffset + m_borderWidth,m_borderWidth,m_borderWidth,m_zintSymbol->height,QBrush(m_fgColor));
|
||||
painter.fillRect(0,0,m_zintSymbol->width + xoffset + xoffset + m_borderWidth + m_borderWidth,m_borderWidth,QBrush(m_fgColor));
|
||||
painter.fillRect(0,m_zintSymbol->height + m_borderWidth,m_zintSymbol->width + xoffset + xoffset + m_borderWidth + m_borderWidth, m_borderWidth,QBrush(m_fgColor));
|
||||
painter.translate(m_borderWidth+m_zintSymbol->whitespace_width,m_borderWidth);
|
||||
yoffset = m_borderWidth;
|
||||
break;
|
||||
case BIND:
|
||||
painter.fillRect(0,0,m_zintSymbol->width + xoffset + xoffset,m_borderWidth,QBrush(m_fgColor));
|
||||
painter.fillRect(0,m_zintSymbol->height + m_borderWidth,m_zintSymbol->width + xoffset + xoffset, m_borderWidth,QBrush(m_fgColor));
|
||||
painter.translate(m_zintSymbol->whitespace_width,m_borderWidth);
|
||||
yoffset = m_borderWidth;
|
||||
break;
|
||||
|
||||
default:
|
||||
painter.translate(m_zintSymbol->whitespace_width,0);
|
||||
break;;
|
||||
}
|
||||
}
|
||||
|
||||
while(!(module_set(m_zintSymbol->rows - 1, comp_offset))) {
|
||||
comp_offset++;
|
||||
}
|
||||
xoffset = comp_offset;
|
||||
|
||||
/* Set up some values for displaying EAN and UPC symbols correctly */
|
||||
main_width = m_zintSymbol->width;
|
||||
if ((((m_zintSymbol->symbology == BARCODE_EANX) && (m_zintSymbol->rows == 1)) || (m_zintSymbol->symbology == BARCODE_EANX_CC))
|
||||
|| (m_zintSymbol->symbology == BARCODE_ISBNX)) {
|
||||
switch(caption.size()) {
|
||||
case 13: /* EAN 13 */
|
||||
case 16:
|
||||
case 19:
|
||||
if(m_zintSymbol->whitespace_width == 0) {
|
||||
m_zintSymbol->whitespace_width = 10;
|
||||
}
|
||||
main_width = 96 + comp_offset;
|
||||
break;
|
||||
default:
|
||||
main_width = 68 + comp_offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (((m_zintSymbol->symbology == BARCODE_UPCA) && (m_zintSymbol->rows == 1)) || (m_zintSymbol->symbology == BARCODE_UPCA_CC)) {
|
||||
if(m_zintSymbol->whitespace_width == 0) {
|
||||
m_zintSymbol->whitespace_width = 10;
|
||||
}
|
||||
main_width = 96 + comp_offset;
|
||||
}
|
||||
|
||||
if (((m_zintSymbol->symbology == BARCODE_UPCE) && (m_zintSymbol->rows == 1)) || (m_zintSymbol->symbology == BARCODE_UPCE_CC)) {
|
||||
if(m_zintSymbol->whitespace_width == 0) {
|
||||
m_zintSymbol->whitespace_width = 10;
|
||||
}
|
||||
main_width = 51 + comp_offset;
|
||||
}
|
||||
|
||||
p.setWidth(1);
|
||||
painter.setPen(p);
|
||||
|
||||
if (m_zintSymbol->symbology == BARCODE_MAXICODE)
|
||||
{
|
||||
/* Draw Maxicode with hexagons */
|
||||
painter.save();
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
for (int r=0;r<m_zintSymbol->rows;r++)
|
||||
{
|
||||
for (int c=0;c<m_zintSymbol->width;c++)
|
||||
{
|
||||
if (module_set(r, c))
|
||||
{
|
||||
qreal col=(qreal)c*(maxi_width+1)+(r%2)*((maxi_width+1)/2);
|
||||
qreal row=(qreal)r*(maxi_width+1)*0.868;
|
||||
QPainterPath pt;
|
||||
pt.moveTo(col+maxi_width/2, row);
|
||||
pt.lineTo(col+maxi_width, row+maxi_diagonal/4);
|
||||
pt.lineTo(col+maxi_width, row+(maxi_diagonal-maxi_diagonal/4));
|
||||
pt.lineTo(col+maxi_width/2, row+maxi_diagonal);
|
||||
pt.lineTo(col, row+(maxi_diagonal-maxi_diagonal/4));
|
||||
pt.lineTo(col, row+maxi_diagonal/4);
|
||||
pt.lineTo(col+maxi_width/2, row);
|
||||
painter.fillPath(pt,QBrush(m_fgColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
p.setWidth(maxi_width);
|
||||
painter.setPen(p);
|
||||
const qreal w=maxi_width+1;
|
||||
painter.drawEllipse(QPointF(14.5*w,16.5*w*0.868),w,w);
|
||||
painter.drawEllipse(QPointF(14.5*w,16.5*w*0.868),w+w*1.5,w+w*1.5);
|
||||
painter.drawEllipse(QPointF(14.5*w,16.5*w*0.868),w+w*3,w+w*3);
|
||||
painter.restore();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Draw all other symbols with rectangles */
|
||||
int y=0;
|
||||
for (int row=0;row<m_zintSymbol->rows;row++)
|
||||
{
|
||||
for (int i=0;i<m_zintSymbol->width;i++) {
|
||||
if (module_set(row, i))
|
||||
{
|
||||
int ed = module_set(row, i);
|
||||
int linewidth=0;
|
||||
for (int j=i;j<m_zintSymbol->width;j++,linewidth++)
|
||||
if (ed != module_set(row, j))
|
||||
break;
|
||||
QColor color;
|
||||
/* switch(ed)
|
||||
{
|
||||
case 'R':
|
||||
color=qRgb(0xff,0x00,0x00);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
color=qRgb(0x00,0xff,0x00);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
color=qRgb(0x00,0x00,0xff);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
color=qRgb(0x00,0xff,0xff);
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
color=qRgb(0xff,0x00,0xff);
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
color=qRgb(0xff,0xff,0x00);
|
||||
break;
|
||||
|
||||
default: */
|
||||
color=m_fgColor;
|
||||
/* break;
|
||||
} */
|
||||
if(!((i > main_width) && (row == m_zintSymbol->rows - 1))) {
|
||||
painter.fillRect(i,y,linewidth,m_zintSymbol->row_height[row],QBrush(color));
|
||||
} else {
|
||||
painter.fillRect(i,y + 8,linewidth,m_zintSymbol->row_height[row] - 3,QBrush(color));
|
||||
addon_text_height = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Add row binding */
|
||||
if(((m_zintSymbol->symbology == BARCODE_CODE16K) || (m_zintSymbol->symbology == BARCODE_CODE49)) && (row != 0)) {
|
||||
painter.fillRect(0,y - 1,m_zintSymbol->width,2,QBrush(m_fgColor));
|
||||
}
|
||||
if(((m_zintSymbol->symbology == BARCODE_CODABLOCKF) || (m_zintSymbol->symbology == BARCODE_HIBC_BLOCKF)) && (row != 0)) {
|
||||
painter.fillRect(11,y - 1,m_zintSymbol->width - 24,2,QBrush(m_fgColor));
|
||||
}
|
||||
y+=m_zintSymbol->row_height[row];
|
||||
}
|
||||
}
|
||||
|
||||
textdone = false;
|
||||
|
||||
if(m_hidetext == false) {
|
||||
painter.setFont(fontSmall);
|
||||
if(((m_zintSymbol->symbology == BARCODE_EANX) || (m_zintSymbol->symbology == BARCODE_EANX_CC)) ||
|
||||
(m_zintSymbol->symbology == BARCODE_ISBNX)) {
|
||||
/* Add bridge and format text for EAN */
|
||||
switch(caption.size()) {
|
||||
case 8:
|
||||
case 11:
|
||||
case 14:
|
||||
painter.fillRect(0 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(2 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(32 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(34 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(64 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(66 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.setFont(fontLarge);
|
||||
painter.drawText(3 + xoffset, m_zintSymbol->height + yoffset, 29, 9,Qt::AlignCenter, caption.mid(0,4));
|
||||
painter.drawText(35 + xoffset, m_zintSymbol->height + yoffset, 29, 9,Qt::AlignCenter, caption.mid(4,4));
|
||||
if(caption.size() == 11) { /* EAN-2 */ painter.drawText(76 + xoffset, addon_text_height, 20, 9,Qt::AlignCenter, caption.mid(9,2)); };
|
||||
if(caption.size() == 14) { /* EAN-5 */ painter.drawText(76 + xoffset, addon_text_height, 47, 9,Qt::AlignCenter, caption.mid(9,5)); };
|
||||
painter.setFont(fontSmall);
|
||||
textdone = true;
|
||||
break;
|
||||
case 13:
|
||||
case 16:
|
||||
case 19:
|
||||
painter.fillRect(0 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(2 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(46 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(48 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(92 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(94 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.setFont(fontLarge);
|
||||
painter.drawText(xoffset - 7, m_zintSymbol->height + yoffset, 7, 9,Qt::AlignCenter, caption.mid(0,1));
|
||||
painter.drawText(3 + xoffset, m_zintSymbol->height + yoffset, 43, 9,Qt::AlignCenter, caption.mid(1,6));
|
||||
painter.drawText(49 + xoffset, m_zintSymbol->height + yoffset, 43, 9,Qt::AlignCenter, caption.mid(7,6));
|
||||
if(caption.size() == 16) { /* EAN-2 */ painter.drawText(104 + xoffset, addon_text_height, 20, 9,Qt::AlignCenter, caption.mid(14,2)); };
|
||||
if(caption.size() == 19) { /* EAN-5 */ painter.drawText(104 + xoffset, addon_text_height, 47, 9,Qt::AlignCenter, caption.mid(14,5)); };
|
||||
painter.setFont(fontSmall);
|
||||
textdone = true;
|
||||
break;
|
||||
}
|
||||
if(textdone == false) {
|
||||
painter.setFont(fontLarge);
|
||||
painter.drawText(0, m_zintSymbol->height, m_zintSymbol->width, 9,Qt::AlignCenter, caption);
|
||||
painter.setFont(fontSmall);
|
||||
textdone = true;
|
||||
}
|
||||
}
|
||||
|
||||
if((m_zintSymbol->symbology == BARCODE_UPCA) || (m_zintSymbol->symbology == BARCODE_UPCA_CC)) {
|
||||
/* Add bridge and format text for UPC-A */
|
||||
int block_width;
|
||||
bool latch = true;
|
||||
|
||||
j = 0 + comp_offset;
|
||||
do {
|
||||
block_width = 0;
|
||||
do {
|
||||
block_width++;
|
||||
} while (module_set(m_zintSymbol->rows - 1, j + block_width) == module_set(m_zintSymbol->rows - 1, j));
|
||||
if(latch == true) {
|
||||
/* a bar */
|
||||
painter.fillRect(j + xoffset - comp_offset,m_zintSymbol->height,block_width,5,QBrush(m_fgColor));
|
||||
latch = false;
|
||||
} else {
|
||||
/* a space */
|
||||
latch = true;
|
||||
}
|
||||
j += block_width;
|
||||
} while (j < 11 + comp_offset);
|
||||
painter.fillRect(46 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(48 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
latch = true;
|
||||
j = 85 + comp_offset;
|
||||
do {
|
||||
block_width = 0;
|
||||
do {
|
||||
block_width++;
|
||||
} while (module_set(m_zintSymbol->rows - 1, j + block_width) == module_set(m_zintSymbol->rows - 1, j));
|
||||
if(latch == true) {
|
||||
/* a bar */
|
||||
painter.fillRect(j + xoffset - comp_offset,m_zintSymbol->height,block_width,5,QBrush(m_fgColor));
|
||||
latch = false;
|
||||
} else {
|
||||
/* a space */
|
||||
latch = true;
|
||||
}
|
||||
j += block_width;
|
||||
} while (j < 96 + comp_offset);
|
||||
painter.drawText(xoffset - 7, m_zintSymbol->height + yoffset, 7, 7,Qt::AlignCenter, caption.mid(0,1));
|
||||
painter.drawText(96 + xoffset, m_zintSymbol->height + yoffset, 7, 7,Qt::AlignCenter, caption.mid(11,1));
|
||||
painter.setFont(fontLarge);
|
||||
painter.drawText(11 + xoffset, m_zintSymbol->height + yoffset, 35, 9,Qt::AlignCenter, caption.mid(1,5));
|
||||
painter.drawText(49 + xoffset, m_zintSymbol->height + yoffset, 35, 9,Qt::AlignCenter, caption.mid(6,5));
|
||||
if(caption.size() == 15) { /* EAN-2 */ painter.drawText(104 + xoffset, addon_text_height, 20, 9,Qt::AlignCenter, caption.mid(13,2)); };
|
||||
if(caption.size() == 18) { /* EAN-5 */ painter.drawText(104 + xoffset, addon_text_height, 47, 9,Qt::AlignCenter, caption.mid(13,5)); };
|
||||
painter.setFont(fontSmall);
|
||||
textdone = true;
|
||||
}
|
||||
|
||||
if((m_zintSymbol->symbology == BARCODE_UPCE) || (m_zintSymbol->symbology == BARCODE_UPCE_CC)) {
|
||||
/* Add bridge and format text for UPC-E */
|
||||
painter.fillRect(0 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(2 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(46 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(48 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.fillRect(50 + xoffset,m_zintSymbol->height,1,5,QBrush(m_fgColor));
|
||||
painter.drawText(xoffset - 7, m_zintSymbol->height + yoffset, 7, 7,Qt::AlignCenter, caption.mid(0,1));
|
||||
painter.drawText(51 + xoffset, m_zintSymbol->height + yoffset, 7, 7,Qt::AlignCenter, caption.mid(7,1));
|
||||
painter.setFont(fontLarge);
|
||||
painter.drawText(3 + xoffset, m_zintSymbol->height + yoffset, 43, 9,Qt::AlignCenter, caption.mid(1,6));
|
||||
if(caption.size() == 11) { /* EAN-2 */ painter.drawText(60 + xoffset, addon_text_height, 20, 9,Qt::AlignCenter, caption.mid(9,2)); };
|
||||
if(caption.size() == 14) { /* EAN-2 */ painter.drawText(60 + xoffset, addon_text_height, 47, 9,Qt::AlignCenter, caption.mid(9,5)); };
|
||||
painter.setFont(fontSmall);
|
||||
textdone = true;
|
||||
}
|
||||
} /* if (m_hidetext == false) */
|
||||
|
||||
if((m_hidetext == false) && (textdone == false)) {
|
||||
/* Add text to any other symbol */
|
||||
painter.drawText(0, m_zintSymbol->height + yoffset, m_zintSymbol->width, 7, Qt::AlignCenter, caption);
|
||||
}
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
const QString & QZint::lastError()
|
||||
{
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
bool QZint::hasErrors()
|
||||
{
|
||||
return m_lastError.length();
|
||||
}
|
||||
|
||||
}
|
||||
|
121
backend_qt4/qzint.h
Normal file
121
backend_qt4/qzint.h
Normal file
@ -0,0 +1,121 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by BogDan Vatra *
|
||||
* bogdan@licentia.eu *
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef BARCODERENDER_H
|
||||
#define BARCODERENDER_H
|
||||
#include <QColor>
|
||||
#include <QPainter>
|
||||
|
||||
#include "zint.h"
|
||||
|
||||
namespace Zint
|
||||
{
|
||||
|
||||
class QZint
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
enum BorderType{NO_BORDER=0, BIND=2, BOX=4};
|
||||
enum AspectRatioMode{IgnoreAspectRatio=0, KeepAspectRatio=1, CenterBarCode=2};
|
||||
|
||||
public:
|
||||
QZint();
|
||||
~QZint();
|
||||
|
||||
int symbol();
|
||||
void setSymbol(int symbol);
|
||||
|
||||
QString text();
|
||||
void setText(const QString & text);
|
||||
|
||||
QString primaryMessage();
|
||||
void setPrimaryMessage(const QString & primaryMessage);
|
||||
|
||||
void setHeight(int height);
|
||||
int height();
|
||||
|
||||
void setWidth(int width);
|
||||
int width();
|
||||
|
||||
void setOption3(int option);
|
||||
|
||||
QColor fgColor();
|
||||
void setFgColor(const QColor & fgColor);
|
||||
|
||||
QColor bgColor();
|
||||
void setBgColor(const QColor & bgColor);
|
||||
|
||||
BorderType borderType();
|
||||
void setBorderType(BorderType border);
|
||||
|
||||
int borderWidth();
|
||||
void setBorderWidth(int boderWidth);
|
||||
|
||||
int pdf417CodeWords();
|
||||
void setPdf417CodeWords(int pdf417CodeWords);
|
||||
|
||||
int securityLevel();
|
||||
void setSecurityLevel(int securityLevel);
|
||||
|
||||
float scale();
|
||||
void setScale(float scale);
|
||||
|
||||
int mode();
|
||||
void setMode(int securityLevel);
|
||||
|
||||
void setInputMode(int input_mode);
|
||||
|
||||
void setWhitespace(int whitespace);
|
||||
|
||||
QString error_message();
|
||||
|
||||
void render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode=IgnoreAspectRatio);
|
||||
|
||||
const QString & lastError();
|
||||
bool hasErrors();
|
||||
|
||||
bool save_to_file(QString filename);
|
||||
|
||||
void setHideText(bool hide);
|
||||
|
||||
private:
|
||||
void encode();
|
||||
int module_set(int y_coord, int x_coord);
|
||||
|
||||
private:
|
||||
int m_symbol;
|
||||
QString m_text;
|
||||
QString m_primaryMessage;
|
||||
int m_height;
|
||||
BorderType m_border;
|
||||
int m_borderWidth;
|
||||
int m_width;
|
||||
int m_securityLevel;
|
||||
int m_pdf417CodeWords;
|
||||
int m_input_mode;
|
||||
QColor m_fgColor;
|
||||
QColor m_bgColor;
|
||||
QString m_lastError;
|
||||
int m_error;
|
||||
int m_whitespace;
|
||||
zint_symbol * m_zintSymbol;
|
||||
float m_scale;
|
||||
int m_option_3;
|
||||
bool m_hidetext;
|
||||
};
|
||||
}
|
||||
#endif
|
9
backend_qt4/readme
Normal file
9
backend_qt4/readme
Normal file
@ -0,0 +1,9 @@
|
||||
Edit zint-1.6.pro and edit the 'DEFINES' section
|
||||
NO_PNG -> compile zint without png support
|
||||
NO_QR -> compile zint without QR support
|
||||
QR_SYSTEM -> if you have QT installed in your system, zint will be compiled with QT support
|
||||
QR -> compile zint with QR support static (you must have qrencode in the current folder)
|
||||
|
||||
Edit compile_n_config and set the paths.
|
||||
|
||||
Exec compile_n_config
|
Reference in New Issue
Block a user