mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
qt frontend
This commit is contained in:
parent
9daffeb764
commit
e6aadd96f7
47
frontend_qt4/barcodeitem.cpp
Normal file
47
frontend_qt4/barcodeitem.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008 by BogDan Vatra *
|
||||||
|
* taipan@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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include "barcodeitem.h"
|
||||||
|
|
||||||
|
BarcodeItem::BarcodeItem()
|
||||||
|
: QGraphicsItem()
|
||||||
|
{
|
||||||
|
scaleFactor=1;
|
||||||
|
w=400;
|
||||||
|
h=400;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BarcodeItem::~BarcodeItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF BarcodeItem::boundingRect() const
|
||||||
|
{
|
||||||
|
return QRectF(0, 0, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarcodeItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||||
|
{
|
||||||
|
bc.render(*painter,boundingRect(),Zint::BareCode::IgnoreAspectRatio,scaleFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
45
frontend_qt4/barcodeitem.h
Normal file
45
frontend_qt4/barcodeitem.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008 by BogDan Vatra *
|
||||||
|
* taipan@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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef BARCODEITEM_H
|
||||||
|
#define BARCODEITEM_H
|
||||||
|
|
||||||
|
#include <QGraphicsItem>
|
||||||
|
#include <barcoderender.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@author BogDan Vatra <taipan@licentia.eu>
|
||||||
|
*/
|
||||||
|
|
||||||
|
class BarcodeItem : public QGraphicsItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BarcodeItem();
|
||||||
|
~BarcodeItem();
|
||||||
|
QRectF boundingRect() const;
|
||||||
|
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
|
||||||
|
|
||||||
|
public:
|
||||||
|
mutable Zint::BareCode bc;
|
||||||
|
int scaleFactor;
|
||||||
|
int w,h;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
18
frontend_qt4/fontend.pro
Normal file
18
frontend_qt4/fontend.pro
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
CONFIG += warn_on \
|
||||||
|
thread \
|
||||||
|
qt
|
||||||
|
|
||||||
|
TARGET = qtFontend
|
||||||
|
|
||||||
|
FORMS += mainWindow.ui
|
||||||
|
|
||||||
|
SOURCES += main.cpp \
|
||||||
|
mainwindow.cpp \
|
||||||
|
barcodeitem.cpp
|
||||||
|
|
||||||
|
HEADERS += mainwindow.h \
|
||||||
|
barcodeitem.h
|
||||||
|
|
||||||
|
LIBS += -lQtZint
|
32
frontend_qt4/main.cpp
Normal file
32
frontend_qt4/main.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008 by BogDan Vatra *
|
||||||
|
* taipan@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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication app(argc, argv);
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
|
410
frontend_qt4/mainWindow.ui
Normal file
410
frontend_qt4/mainWindow.ui
Normal file
@ -0,0 +1,410 @@
|
|||||||
|
<ui version="4.0" >
|
||||||
|
<class>mainWindow</class>
|
||||||
|
<widget class="QWidget" name="mainWindow" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>787</width>
|
||||||
|
<height>748</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>Zint Qt fontend</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout" >
|
||||||
|
<item row="0" column="0" colspan="2" >
|
||||||
|
<widget class="QGraphicsView" name="view" />
|
||||||
|
</item>
|
||||||
|
<item rowspan="2" row="1" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Type:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="stype" />
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_12" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_11" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Item Width:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="iwidth" >
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep" >
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>400</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item rowspan="2" row="2" column="1" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_13" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_12" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Item Height:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="iheight" >
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep" >
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>400</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item rowspan="2" row="3" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Height:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="heightb" >
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>300</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item rowspan="2" row="4" column="1" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Primary</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="primary" />
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item rowspan="2" row="5" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Width (pdf471):</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="widthb" >
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>300</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item rowspan="7" row="6" column="1" >
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Data</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="text" >
|
||||||
|
<property name="html" >
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">123456</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="acceptRichText" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Security level:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="security" >
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Scale factor:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="scaleFactor" >
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_8" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_8" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Border width:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="bwidth" >
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_10" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_9" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Border type:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="btype" >
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>No border</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Bind</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Box</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_11" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_10" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>PDF417 CODEWORDS:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="codewords" >
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>928</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>1800</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>928</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="0" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9" >
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="fgcolor" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Foreground color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="bgcolor" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Backgound color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="0" colspan="2" >
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0" >
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="generate" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Generate</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0" >
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>pushButton_2</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>mainWindow</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel" >
|
||||||
|
<x>585</x>
|
||||||
|
<y>544</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel" >
|
||||||
|
<x>554</x>
|
||||||
|
<y>310</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
93
frontend_qt4/mainwindow.cpp
Normal file
93
frontend_qt4/mainwindow.cpp
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008 by BogDan Vatra *
|
||||||
|
* taipan@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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QColorDialog>
|
||||||
|
|
||||||
|
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
||||||
|
: QWidget(parent, fl)
|
||||||
|
{
|
||||||
|
setupUi(this);
|
||||||
|
view->setScene(new QGraphicsScene);
|
||||||
|
m_fgcolor=qRgb(0,0,0);
|
||||||
|
m_bgcolor=qRgb(0xff,0xff,0xff);
|
||||||
|
for (int i=0;i<metaObject()->enumerator(0).keyCount();i++)
|
||||||
|
stype->addItem(metaObject()->enumerator(0).key(i));
|
||||||
|
on_generate_clicked();
|
||||||
|
view->scene()->addItem(&m_bc);
|
||||||
|
connect(stype, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(heightb, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(widthb, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(security, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(scaleFactor, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(bwidth, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(codewords, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(iwidth, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(iheight, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked()));
|
||||||
|
connect(primary, SIGNAL(textChanged( const QString& )), SLOT(on_generate_clicked()));
|
||||||
|
connect(text, SIGNAL(textChanged()), SLOT(on_generate_clicked()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_fgcolor_clicked()
|
||||||
|
{
|
||||||
|
m_fgcolor=QColorDialog::getColor(m_fgcolor,this);
|
||||||
|
on_generate_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_bgcolor_clicked()
|
||||||
|
{
|
||||||
|
m_bgcolor=QColorDialog::getColor(m_bgcolor,this);
|
||||||
|
on_generate_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_generate_clicked()
|
||||||
|
{
|
||||||
|
QString error;
|
||||||
|
m_bc.scaleFactor=scaleFactor->value();
|
||||||
|
m_bc.w=iwidth->value();
|
||||||
|
m_bc.h=iheight->value();
|
||||||
|
m_bc.bc.setText(text->toPlainText());
|
||||||
|
m_bc.bc.setPrimaryMessage(primary->text());
|
||||||
|
m_bc.bc.setSymbol(metaObject()->enumerator(0).value(stype->currentIndex()));
|
||||||
|
|
||||||
|
m_bc.bc.setBorder((Zint::BareCode::BorderType)btype->currentIndex());
|
||||||
|
m_bc.bc.setBorderWidth(bwidth->value());
|
||||||
|
m_bc.bc.setHeight(heightb->value());
|
||||||
|
m_bc.bc.setWidth(widthb->value());
|
||||||
|
m_bc.bc.setSecurityLevel(security->value());
|
||||||
|
m_bc.bc.setPdf417CodeWords(codewords->value());
|
||||||
|
m_bc.bc.setFgColor(m_fgcolor);
|
||||||
|
m_bc.bc.setBgColor(m_bgcolor);
|
||||||
|
m_bc.update();
|
||||||
|
view->scene()->update();
|
||||||
|
}
|
||||||
|
|
130
frontend_qt4/mainwindow.h
Normal file
130
frontend_qt4/mainwindow.h
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008 by BogDan Vatra *
|
||||||
|
* taipan@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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
#include <QGraphicsItem>
|
||||||
|
|
||||||
|
#include "ui_mainWindow.h"
|
||||||
|
#include "barcodeitem.h"
|
||||||
|
|
||||||
|
class MainWindow : public QWidget, private Ui::mainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_ENUMS(BarcodeTypes)
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum BarcodeTypes
|
||||||
|
{
|
||||||
|
CODE11 = 1,
|
||||||
|
C25MATRIX = 2,
|
||||||
|
C25INTER = 3,
|
||||||
|
C25IATA = 4,
|
||||||
|
C25LOGIC = 6,
|
||||||
|
C25IND = 7,
|
||||||
|
CODE39 = 8,
|
||||||
|
EXCODE39 = 9,
|
||||||
|
EANX = 13,
|
||||||
|
EAN128 = 16,
|
||||||
|
CODABAR = 18,
|
||||||
|
CODE128 = 20,
|
||||||
|
DPLEIT = 21,
|
||||||
|
DPIDENT = 22,
|
||||||
|
CODE16K = 23,
|
||||||
|
CODE93 = 25,
|
||||||
|
FLAT = 28,
|
||||||
|
RSS14 = 29,
|
||||||
|
RSS_LTD = 30,
|
||||||
|
RSS_EXP = 31,
|
||||||
|
TELEPEN = 32,
|
||||||
|
UPCA = 34,
|
||||||
|
UPCE = 37,
|
||||||
|
POSTNET = 40,
|
||||||
|
MSI_PLESSEY = 47,
|
||||||
|
FIM = 49,
|
||||||
|
LOGMARS = 50,
|
||||||
|
PHARMA = 51,
|
||||||
|
PZN = 52,
|
||||||
|
PHARMA_TWO = 53,
|
||||||
|
PDF417 = 55,
|
||||||
|
PDF417TRUNC = 56,
|
||||||
|
MAXICODE = 57,
|
||||||
|
QRCODE = 58,
|
||||||
|
CODE128B = 60,
|
||||||
|
AUSPOST = 63,
|
||||||
|
AUSREPLY = 66,
|
||||||
|
AUSROUTE = 67,
|
||||||
|
AUSREDIRECT = 68,
|
||||||
|
ISBNX = 69,
|
||||||
|
RM4SCC = 70,
|
||||||
|
DATAMATRIX = 71,
|
||||||
|
ITF14 = 72,
|
||||||
|
NVE18 = 75,
|
||||||
|
KOREAPOST = 77,
|
||||||
|
RSS14STACK = 79,
|
||||||
|
RSS14STACK_OMNI = 80,
|
||||||
|
RSS_EXPSTACK = 81,
|
||||||
|
PLANET = 82,
|
||||||
|
MICROPDF417 = 84,
|
||||||
|
ONECODE = 85,
|
||||||
|
PLESSEY = 86,
|
||||||
|
TELEPEN_NUM = 100,
|
||||||
|
MSI_10 = 101,
|
||||||
|
MSI_10_10 = 102,
|
||||||
|
MSI_11 = 103,
|
||||||
|
MSI_11_10 = 104,
|
||||||
|
CODE39_43 = 105,
|
||||||
|
EXCODE39_43 = 106,
|
||||||
|
AZTEC = 107,
|
||||||
|
SUPER = 108,
|
||||||
|
ULTRA = 109,
|
||||||
|
EANX_CC = 110,
|
||||||
|
EAN128_CC = 111,
|
||||||
|
RSS14_CC = 112,
|
||||||
|
RSS_LTD_CC = 113,
|
||||||
|
RSS_EXP_CC = 114,
|
||||||
|
UPCA_CC = 115,
|
||||||
|
UPCE_CC = 116,
|
||||||
|
RSS14STACK_CC = 117,
|
||||||
|
RSS14_OMNI_CC = 118,
|
||||||
|
RSS_EXPSTACK_CC = 119,
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
MainWindow(QWidget* parent = 0, Qt::WFlags fl = 0);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void on_generate_clicked();
|
||||||
|
void on_fgcolor_clicked();
|
||||||
|
void on_bgcolor_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QColor m_fgcolor,m_bgcolor;
|
||||||
|
BarcodeItem m_bc;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user