enumerator(0).keyCount();i++) {
@@ -166,11 +171,68 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
connect(txtMaxiPrimary, SIGNAL(textChanged( const QString& )), SLOT(update_preview()));
connect(spnWhitespace, SIGNAL(valueChanged( int )), SLOT(update_preview()));
connect(cmbChannel, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
+ connect(btnAbout, SIGNAL(clicked( bool )), SLOT(about()));
+ connect(btnSave, SIGNAL(clicked( bool )), SLOT(save()));
+ connect(spnScale, SIGNAL(valueChanged( double )), SLOT(change_print_scale()));
+ connect(btnExit, SIGNAL(clicked( bool )), SLOT(quit_now()));
}
MainWindow::~MainWindow()
{
}
+/*
+void MainWindow::createActions()
+{
+ saveAct = new QAction(tr("&Save"), this);
+ saveAct->setShortcut(tr("Ctrl+S"));
+ saveAct->setStatusTip(tr("Save the document to disk"));
+ connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
+ aboutQtAct = new QAction(tr("About &Qt"), this);
+ aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
+ connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+}
+
+ void MainWindow::createMenus()
+{
+ fileMenu = menuBar()->addMenu(tr("&File"));
+ fileMenu->addAction(saveAct);
+ fileMenu->addAction(exitAction);
+ helpMenu = menuBar()->addMenu(tr("&Help"));
+ helpMenu->addAction(aboutQtAct);
+} */
+
+bool MainWindow::save()
+{
+ bool status;
+
+ /* Does nothing yet! */
+ QString fileName = QFileDialog::getSaveFileName(this,
+ tr("Save Barcode Image"), ".",
+ tr("Barcode Images (*.png *.eps *.svg)"));
+
+ if (fileName.isEmpty())
+ return false;
+
+ status = m_bc.bc.save_to_file(fileName);
+ if(status == false) {
+ QMessageBox::critical(this,tr("Save Error"),m_bc.bc.error_message());
+ }
+ return status;
+}
+
+void MainWindow::about()
+{
+ QMessageBox::about(this, tr("About Zint"),
+ tr("Zint Barcode Studio 0.2
"
+ "A simple barcode generator"
+ "
Requires libzint 2.1.3 or greater."
+ "
Visit the Zint Project Homepage for more information."
+ "
Copyright © 2009 Robin Stuart & Bogdan Vatra.
"
+ "QR Code support by Kentaro Fukuchi.
"
+ "Released under the GNU General Public License ver. 3"
+ "
\"QR Code\" is a Registered Trademark of Denso Corp."
+ ));
+}
void MainWindow::on_fgcolor_clicked()
{
@@ -184,6 +246,17 @@ void MainWindow::on_bgcolor_clicked()
update_preview();
}
+void MainWindow::change_print_scale()
+{
+ /* This value is only used when printing (saving) to file */
+ m_bc.bc.setScale((float)spnScale->value());
+}
+
+void MainWindow::quit_now()
+{
+ this->close();
+}
+
void MainWindow::change_options()
{
bool options;
diff --git a/frontend_qt4/mainwindow.h b/frontend_qt4/mainwindow.h
index 63d30b18..ca078640 100644
--- a/frontend_qt4/mainwindow.h
+++ b/frontend_qt4/mainwindow.h
@@ -19,10 +19,16 @@
#include
#include
+ #include
#include "ui_mainWindow.h"
#include "barcodeitem.h"
+ class QAction;
+ class QActionGroup;
+ class QLabel;
+ class QMenu;
+
class MainWindow : public QWidget, private Ui::mainWindow
{
Q_OBJECT
@@ -113,11 +119,24 @@ public slots:
void mqr_size();
void mqr_errorcorrect();
void maxi_primary();
+ void change_print_scale();
+
+private slots:
+ bool save();
+ void about();
+ void quit_now();
+ /* void about(); */
private:
+/* void createActions();
+ void createMenus(); */
+
QColor m_fgcolor,m_bgcolor;
BarcodeItem m_bc;
-
+/* QMenu *fileMenu;
+ QMenu *helpMenu;
+ QAction *saveAct;
+ QAction *aboutQtAct; */
};
#endif