From 0bce27959fb99f985c68d707ebd9ca83d09af2c2 Mon Sep 17 00:00:00 2001 From: hooper114 Date: Thu, 17 Sep 2009 08:01:49 +0000 Subject: [PATCH] Expand GUI for sequencing and input from file --- frontend_qt4/CMakeLists.txt | 6 +- frontend_qt4/datawindow.cpp | 79 ++ frontend_qt4/datawindow.h | 24 + frontend_qt4/extData.ui | 98 +++ frontend_qt4/extExport.ui | 173 ++++ frontend_qt4/extSequence.ui | 269 +++++++ frontend_qt4/mainWindow.ui | 1299 ++++++++++++++++--------------- frontend_qt4/mainwindow.cpp | 20 + frontend_qt4/mainwindow.h | 2 + frontend_qt4/sequencewindow.cpp | 28 + frontend_qt4/sequencewindow.h | 19 + 11 files changed, 1375 insertions(+), 642 deletions(-) create mode 100644 frontend_qt4/datawindow.cpp create mode 100644 frontend_qt4/datawindow.h create mode 100644 frontend_qt4/extData.ui create mode 100644 frontend_qt4/extExport.ui create mode 100644 frontend_qt4/extSequence.ui create mode 100644 frontend_qt4/sequencewindow.cpp create mode 100644 frontend_qt4/sequencewindow.h diff --git a/frontend_qt4/CMakeLists.txt b/frontend_qt4/CMakeLists.txt index 2fdcac73..3f8bd752 100644 --- a/frontend_qt4/CMakeLists.txt +++ b/frontend_qt4/CMakeLists.txt @@ -4,10 +4,10 @@ project(zint-qt) include_directories(BEFORE "${CMAKE_SOURCE_DIR}/backend" "${CMAKE_SOURCE_DIR}/backend_qt4") -set(zint-qt_SRCS barcodeitem.cpp main.cpp mainwindow.cpp) -QT4_WRAP_CPP(zint-qt_SRCS mainwindow.h) +set(zint-qt_SRCS barcodeitem.cpp main.cpp mainwindow.cpp datawindow.cpp sequencewindow.cpp) +QT4_WRAP_CPP(zint-qt_SRCS mainwindow.h datawindow.h sequencewindow.h) -QT4_WRAP_UI(zint-qt_SRCS mainWindow.ui ) +QT4_WRAP_UI(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui) # grpAztec.ui grpC39.ui grpDM.ui grpMSICheck.ui # grpC128.ui grpChannel.ui grpMicroPDF.ui grpPDF417.ui # grpC16k.ui grpCodablock.ui grpMQR.ui grpQR.ui diff --git a/frontend_qt4/datawindow.cpp b/frontend_qt4/datawindow.cpp new file mode 100644 index 00000000..58b23465 --- /dev/null +++ b/frontend_qt4/datawindow.cpp @@ -0,0 +1,79 @@ +#include +#include +#include +#include + +#include "datawindow.h" +#include + +DataWindow::DataWindow() +{ + setupUi(this); + + connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now())); + connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data())); + connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay())); +} + +DataWindow::DataWindow(QString input) +{ + setupUi(this); + txtDataInput->setPlainText(input); + txtDataInput->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); + + connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now())); + connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data())); + connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay())); + connect(btnFromFile, SIGNAL( clicked( bool )), SLOT(from_file())); +} + +DataWindow::~DataWindow() +{ +} + +void DataWindow::quit_now() +{ + Valid = 0; + close(); +} + +void DataWindow::clear_data() +{ + txtDataInput->clear(); +} + +void DataWindow::okay() +{ + Valid = 1; + DataOutput = txtDataInput->toPlainText(); + close(); +} + +void DataWindow::from_file() +{ + QString fileName; + QFileDialog fdialog; + QFile file; + char *streamdata; + int streamlen; + QString utfstream; + + fdialog.setFileMode(QFileDialog::ExistingFile); + + if(fdialog.exec()) { + fileName = fdialog.selectedFiles().at(0); + } else { + return; + } + + file.setFileName(fileName); + if(!file.open(QIODevice::ReadOnly)) { + return; + } + + QDataStream input(&file); + streamlen = input.readRawData(streamdata, 7095); + utfstream = streamdata; /* FIXME: Does not take account of encoding scheme of input data */ + txtDataInput->setPlainText(utfstream); + file.close(); +} \ No newline at end of file diff --git a/frontend_qt4/datawindow.h b/frontend_qt4/datawindow.h new file mode 100644 index 00000000..2af2bce4 --- /dev/null +++ b/frontend_qt4/datawindow.h @@ -0,0 +1,24 @@ +#ifndef DATAWINDOW_H +#define DATAWINDOW_H + +#include "ui_extData.h" + +class DataWindow : public QDialog, private Ui::DataDialog +{ + Q_OBJECT + +public: + DataWindow(); + DataWindow(QString input); + ~DataWindow(); + int Valid; + QString DataOutput; + +private slots: + void quit_now(); + void clear_data(); + void okay(); + void from_file(); +}; + +#endif diff --git a/frontend_qt4/extData.ui b/frontend_qt4/extData.ui new file mode 100644 index 00000000..a218b731 --- /dev/null +++ b/frontend_qt4/extData.ui @@ -0,0 +1,98 @@ + + + DataDialog + + + + 0 + 0 + 400 + 300 + + + + Input Data + + + true + + + + + 10 + 20 + 381 + 221 + + + + + + + 10 + 250 + 381 + 41 + + + + + + + From File... + + + + + + + Reset + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + 10 + 0 + 56 + 16 + + + + Data + + + + + + diff --git a/frontend_qt4/extExport.ui b/frontend_qt4/extExport.ui new file mode 100644 index 00000000..f8019f44 --- /dev/null +++ b/frontend_qt4/extExport.ui @@ -0,0 +1,173 @@ + + + ExportDialog + + + + 0 + 0 + 450 + 170 + + + + Export Barcodes + + + + + 10 + 130 + 431 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 140 + 10 + 261 + 22 + + + + + + + 140 + 40 + 301 + 22 + + + + + + + 140 + 70 + 301 + 22 + + + + + + + 140 + 100 + 301 + 22 + + + + + + + 410 + 10 + 30 + 25 + + + + ... + + + + + + 10 + 10 + 121 + 16 + + + + Destination Path: + + + + + + 10 + 40 + 111 + 16 + + + + File Name Prefix: + + + + + + 10 + 80 + 111 + 16 + + + + File Name: + + + + + + 10 + 110 + 111 + 16 + + + + File Format: + + + + + + + buttonBox + accepted() + ExportDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ExportDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/frontend_qt4/extSequence.ui b/frontend_qt4/extSequence.ui new file mode 100644 index 00000000..092be416 --- /dev/null +++ b/frontend_qt4/extSequence.ui @@ -0,0 +1,269 @@ + + + SequenceDialog + + + + 0 + 0 + 530 + 300 + + + + Sequence Export + + + true + + + + + 10 + 10 + 261 + 241 + + + + Create Sequence + + + + false + + + + 140 + 200 + 111 + 26 + + + + Export... + + + + + + 140 + 140 + 111 + 26 + + + + Create + + + + + + 140 + 20 + 111 + 22 + + + + 1 + + + + + + 139 + 80 + 111 + 20 + + + + 1 + + + + + + 140 + 110 + 111 + 22 + + + + $$$$$$ + + + + + + 140 + 50 + 111 + 22 + + + + 10 + + + + + + 140 + 170 + 111 + 26 + + + + Import... + + + + + + 10 + 20 + 151 + 20 + + + + Start Value: + + + + + + 10 + 50 + 171 + 16 + + + + End Value: + + + + + + 10 + 80 + 171 + 16 + + + + Increment By: + + + + + + 10 + 110 + 171 + 16 + + + + Format: + + + + + + 10 + 140 + 161 + 16 + + + + Sequence: + + + + + + 10 + 170 + 161 + 16 + + + + Sequence File: + + + + + + 10 + 200 + 161 + 16 + + + + Generate Bar Codes: + + + + + + + 280 + 10 + 241 + 241 + + + + Sequence Preview + + + + + 10 + 20 + 221 + 171 + + + + + + + 150 + 200 + 80 + 26 + + + + Reset + + + + + + + 440 + 260 + 80 + 26 + + + + Close + + + + + + diff --git a/frontend_qt4/mainWindow.ui b/frontend_qt4/mainWindow.ui index bc149aae..bfb16159 100644 --- a/frontend_qt4/mainWindow.ui +++ b/frontend_qt4/mainWindow.ui @@ -1,675 +1,696 @@ - + + mainWindow - - + + 0 0 749 - 747 + 650 - + 800 800 - + Zint Barcode Studio - - + + :/zico.png:/zico.png - - background-image: url(:/blueback.png); + + background-image: url(:/blueback.png); - - - - - false - - - Preview - - - - - - - 0 - 300 - - - - false - - - - - - - Zoom out - - - ... - - - - :/zoomout.png:/zoomout.png - - - - 22 - 22 - - - - - - - - Adjust zoom - - - 50 - - - 400 - - - 100 - - - Qt::Vertical - - - true - - - false - - - - - - - Zoom in - - - - :/zoomin.png:/zoomin.png - - - - 22 - 22 - - - - - - - - Rotate anti-clockwise - - - - :/rotateleft.png:/rotateleft.png - - - - 22 - 22 - - - - - - - - Adjust Rotation - - - 360 - - - Qt::Horizontal - - - - - - - Rotate clockwise - - - - :/rotateright.png:/rotateright.png - - - - 22 - 22 - - - - - - - - - - - - - S&ymbology: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - bstyle - - - - - - - - 0 - 0 - - - - Select type of barcode to generate. - - - - - - - - - - 0 - 0 - - - - - 16777215 - 350 - - - - false - - - - - - 0 - - - - - 0 - 0 - 727 - 243 - + + + + 9 + 9 + 731 + 312 + + + + false + + + Preview + + + + + + + 0 + 0 + - - General - - - - - - - 0 - 0 - - - - &Data to Encode - - + + false + + + + + + + Zoom out + + + ... + + + + :/zoomout.png:/zoomout.png + + + + 22 + 22 + + + + + + + + Adjust zoom + + + 50 + + + 400 + + + 100 + + + Qt::Vertical + + + true + + + false + + + + + + + Zoom in + + + + :/zoomin.png:/zoomin.png + + + + 22 + 22 + + + + + + + + Rotate anti-clockwise + + + + :/rotateleft.png:/rotateleft.png + + + + 22 + 22 + + + + + + + + Adjust Rotation + + + 360 + + + Qt::Horizontal + + + + + + + Rotate clockwise + + + + :/rotateright.png:/rotateright.png + + + + 22 + 22 + + + + + + + + + + 10 + 340 + 731 + 299 + + + + + QLayout::SetMaximumSize + + + + + + + + + S&ymbology: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + bstyle + + + + + + + + 0 + 0 + + + + Select type of barcode to generate. + + + + + + + + + + 0 + 0 + + + + + 16777215 + 350 + + + + false + + + + + + 0 + + + + General + + - - - Enter data to be encoded. + + + + 0 + 0 + - - Your Data Here! + + &Data to Encode + + + + + Enter data to be encoded. + + + Your Data Here! + + + + + + + ... + + + + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 400 + + + + Composite Code + + + + + + + + Create a composite symbol. + + + Add &2D Component + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + Component &Type: + + + cmbCompType + + + + + + + false + + + + Automatic + + + + + CC-A + + + + + CC-B + + + + + CC-C + + + + + + + + + + + + false + + + 2D Component Data: + + + txtComposite + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 60 + + + + + + + <!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:'DejaVu Sans'; font-size:9pt; 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;"><span style=" font-family:'Sans Serif';">Your Data Here!</span></p></body></html> + + + false + + + + + + - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 400 - - - - Composite Code - - + + + Appearance + + - + - - - Create a composite symbol. - - - Add &2D Component - - + + + + + &Height: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + heightb + + + + + + + B&order Width: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + bwidth + + + + + + + Adjust width of boundary bars or border. + + + X + + + 0 + + + 16 + + + 0 + + + + + + + &Whitespace: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnWhitespace + + + + + + + Adjust whitespace to left and right of barcode. + + + X + + + + + + + &Printing Scale: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnScale + + + + + + + Adjust image size when output to file. + + + + + + 2 + + + 0.500000000000000 + + + 99.500000000000000 + + + 0.500000000000000 + + + 1.000000000000000 + + + + + + + Adjust overall symbol height. + + + X + + + + + + 300 + + + 50 + + + + - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - Component &Type: - - - cmbCompType - - - - - - - false - - - - Automatic - + + + + + Border Ty&pe: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + btype + + - - - CC-A - + + + + + No border + + + + + Bind + + + + + Box + + + - - - CC-B - + + + + + + + &Backgound Colour + + - - - CC-C - + + + + &Foreground Colour + + - + - - - - - false - - - 2D Component Data: - - - txtComposite - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 60 - - - - - - - <!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; font-family:'DejaVu Sans'; font-size:9pt;"><span style=" font-family:'Sans Serif';">Your Data Here!</span></p></body></html> - - - false - - - - + + + Qt::Vertical + + + + 20 + 228 + + + - - - - - - - 0 - 0 - 727 - 243 - - - - Appearance - - - - - - - - - - &Height: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - heightb - - - - - - - B&order Width: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - bwidth - - - - - - - Adjust width of boundary bars or border. - - - X - - - 0 - - - 16 - - - 0 - - - - - - - &Whitespace: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - spnWhitespace - - - - - - - Adjust whitespace to left and right of barcode. - - - X - - - - - - - &Printing Scale: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - spnScale - - - - - - - Adjust image size when output to file. - - - - - - 2 - - - 0.500000000000000 - - - 99.500000000000000 - - - 0.500000000000000 - - - 1.000000000000000 - - - - - - - Adjust overall symbol height. - - - X - - - - - - 300 - - - 50 - - - - - - - - - - - Border Ty&pe: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - btype - - - - - - - - No border - - - - - Bind - - - - - Box - - - - - - - - - - - &Backgound Colour - - - - - - - &Foreground Colour - - - - - - - - - - - Qt::Vertical - - - - 20 - 228 - - - - - - - - - - - - - - &About Zint - - - - - - - Reset zoom, rotation and colour. - - - &Reset Preview - - - - - - - Qt::Horizontal - - - - 288 - 20 - - - - - - - - Save barcode image to file. - - - &Save - - - - - - - E&xit - - - - - - + + + + + + + + + + &About Zint + + + + + + + Reset zoom, rotation and colour. + + + &Reset Preview + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Se&quence + + + + + + + Save barcode image to file. + + + &Save + + + + + + + E&xit + + + + + + + - bstyle tabMain txtData chkComposite @@ -695,7 +716,7 @@ p, li { white-space: pre-wrap; } toolButton_2 - + @@ -704,11 +725,11 @@ p, li { white-space: pre-wrap; } rotateSlider subtractStep() - + 29 265 - + 76 265 @@ -720,11 +741,11 @@ p, li { white-space: pre-wrap; } rotateSlider addStep() - + 491 260 - + 431 260 @@ -736,11 +757,11 @@ p, li { white-space: pre-wrap; } scaleSlider addStep() - + 532 231 - + 528 191 @@ -752,11 +773,11 @@ p, li { white-space: pre-wrap; } scaleSlider subtractStep() - + 530 56 - + 530 94 diff --git a/frontend_qt4/mainwindow.cpp b/frontend_qt4/mainwindow.cpp index c004f919..ebf5962a 100644 --- a/frontend_qt4/mainwindow.cpp +++ b/frontend_qt4/mainwindow.cpp @@ -22,6 +22,8 @@ #include #include "mainwindow.h" +#include "datawindow.h" +#include "sequencewindow.h" #include MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl) @@ -126,6 +128,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl) connect(spnScale, SIGNAL(valueChanged( double )), SLOT(change_print_scale())); connect(btnExit, SIGNAL(clicked( bool )), SLOT(quit_now())); connect(btnReset, SIGNAL(clicked( bool )), SLOT(reset_view())); + connect(btnMoreData, SIGNAL(clicked( bool )), SLOT(open_data_dialog())); + connect(btnSequence, SIGNAL(clicked( bool )), SLOT(open_sequence_dialog())); } MainWindow::~MainWindow() @@ -181,6 +185,22 @@ void MainWindow::about() )); } +int MainWindow::open_data_dialog() +{ + int retval; + DataWindow dlg(txtData->text()); + retval = dlg.exec(); + if (dlg.Valid == 1) + txtData->setText(dlg.DataOutput); + return retval; +} + +int MainWindow::open_sequence_dialog() +{ + SequenceWindow dlg; + return dlg.exec(); +} + void MainWindow::on_fgcolor_clicked() { m_fgcolor=QColorDialog::getColor(m_fgcolor,this); diff --git a/frontend_qt4/mainwindow.h b/frontend_qt4/mainwindow.h index c08d11a5..b25557dc 100644 --- a/frontend_qt4/mainwindow.h +++ b/frontend_qt4/mainwindow.h @@ -123,6 +123,8 @@ private slots: void about(); void quit_now(); void reset_view(); + int open_data_dialog(); + int open_sequence_dialog(); private: /* void createActions(); diff --git a/frontend_qt4/sequencewindow.cpp b/frontend_qt4/sequencewindow.cpp new file mode 100644 index 00000000..be4e8b2c --- /dev/null +++ b/frontend_qt4/sequencewindow.cpp @@ -0,0 +1,28 @@ +#include +#include +#include + +#include "sequencewindow.h" +#include + +SequenceWindow::SequenceWindow() +{ + setupUi(this); + + connect(btnClose, SIGNAL( clicked( bool )), SLOT(quit_now())); + connect(btnReset, SIGNAL( clicked( bool )), SLOT(reset_preview())); +} + +SequenceWindow::~SequenceWindow() +{ +} + +void SequenceWindow::quit_now() +{ + close(); +} + +void SequenceWindow::reset_preview() +{ + txtPreview->clear(); +} diff --git a/frontend_qt4/sequencewindow.h b/frontend_qt4/sequencewindow.h new file mode 100644 index 00000000..eb5f8a20 --- /dev/null +++ b/frontend_qt4/sequencewindow.h @@ -0,0 +1,19 @@ +#ifndef SEQUENCEWINDOW_H +#define SEQUENCEWINDOW_H + +#include "ui_extSequence.h" + +class SequenceWindow : public QDialog, private Ui::SequenceDialog +{ + Q_OBJECT + +public: + SequenceWindow(); + ~SequenceWindow(); + +private slots: + void quit_now(); + void reset_preview(); +}; + +#endif \ No newline at end of file