first draft of label selection dialog
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Tue, 25 Mar 2008 21:20:04 +0000 (21:20 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Tue, 25 Mar 2008 21:20:04 +0000 (21:20 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@142 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

src/arrowdiag.png [new file with mode: 0644]
src/arrowdown.png [new file with mode: 0644]
src/arrowright.png [new file with mode: 0644]
src/files.qrc
src/labeldlg.cpp [new file with mode: 0644]
src/labeldlg.h [new file with mode: 0644]
src/orderwin.cpp
src/smoke.pro

diff --git a/src/arrowdiag.png b/src/arrowdiag.png
new file mode 100644 (file)
index 0000000..8844a7f
Binary files /dev/null and b/src/arrowdiag.png differ
diff --git a/src/arrowdown.png b/src/arrowdown.png
new file mode 100644 (file)
index 0000000..683c465
Binary files /dev/null and b/src/arrowdown.png differ
diff --git a/src/arrowright.png b/src/arrowright.png
new file mode 100644 (file)
index 0000000..8a62bf7
Binary files /dev/null and b/src/arrowright.png differ
index 93605ce..4462340 100644 (file)
@@ -2,5 +2,8 @@
 <RCC version="1.0">
     <qresource>
         <file>icon.png</file>
+        <file>arrowright.png</file>
+        <file>arrowdown.png</file>
+        <file>arrowdiag.png</file>
     </qresource>
 </RCC>
diff --git a/src/labeldlg.cpp b/src/labeldlg.cpp
new file mode 100644 (file)
index 0000000..a97dc20
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// C++ Implementation: labeldlg
+//
+// Description: 
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#include "labeldlg.h"
+
+#include <QComboBox>
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QGridLayout>
+#include <QBoxLayout>
+#include <QPushButton>
+#include <QLabel>
+#include <QToolButton>
+#include <QScrollArea>
+
+#define ROWS 20
+#define COLS 20
+
+MLabelDialog::MLabelDialog(QWidget*par,QString pn,int nl)
+       :QDialog(par)
+{
+       printername=pn;
+       numlabels=nl;
+       
+       setWindowTitle(tr("Label Printing Setup"));
+       
+       QVBoxLayout*vl;
+       QGridLayout*gl;
+       setLayout(vl=new QVBoxLayout);
+       vl->addLayout(gl=new QGridLayout,0);
+       
+       gl->addWidget(new QLabel(tr("Label offset:")),0,0);
+       gl->addWidget(offx=new QLineEdit,0,1);
+       gl->addWidget(new QLabel("x"),0,2);
+       gl->addWidget(offy=new QLineEdit,0,3);
+       gl->addWidget(new QLabel(tr("Label size:")),1,0);
+       gl->addWidget(sizex=new QLineEdit,1,1);
+       gl->addWidget(new QLabel("x"),1,2);
+       gl->addWidget(sizey=new QLineEdit,1,3);
+       gl->addWidget(new QLabel(tr("Unit:")),2,0);
+       gl->addWidget(metric=new QComboBox,2,1,1,3);
+       gl->setColumnStretch(4,10);
+       
+       vl->addSpacing(10);
+       vl->addWidget(new QLabel(tr("Page usage:")),0);
+       vl->addWidget(page=new QComboBox,0);
+       
+       QScrollArea *sa;
+       QWidget*w=new QWidget;
+       vl->addWidget(sa=new QScrollArea,10);
+       w->setLayout(gl=new QGridLayout);
+       QToolButton*t;
+       gl->addWidget(t=new QToolButton,0,0);
+       t->setIcon(QIcon(":/arrowdiag.png"));
+       for(int i=1;i<=COLS;i++){
+               gl->addWidget(t=new QToolButton,0,i);
+               t->setIcon(QIcon(":/arrowdown.png"));
+       }
+       for(int i=1;i<=ROWS;i++){
+               gl->addWidget(t=new QToolButton,i,0);
+               t->setIcon(QIcon(":/arrowright.png"));
+               for(int j=1;j<=COLS;j++){
+                       QCheckBox*b;
+                       gl->addWidget(b=new QCheckBox,i,j);
+                       checks.append(b);
+               }
+       }
+       sa->setWidget(w);
+       
+       vl->addSpacing(15);
+       QHBoxLayout*hl;
+       vl->addLayout(hl=new QHBoxLayout);
+       hl->addStretch(10);
+       QPushButton*p;
+       hl->addWidget(p=new QPushButton(tr("Ok")),0);
+       connect(p,SIGNAL(clicked()),this,SLOT(accept()));
+       hl->addWidget(p=new QPushButton(tr("Cancel")),0);
+       connect(p,SIGNAL(clicked()),this,SLOT(reject()));
+}
+
+MLabelDialog::~MLabelDialog(){}
+QPointF MLabelDialog::labelOffset(int n,QPaintDevice*){}
diff --git a/src/labeldlg.h b/src/labeldlg.h
new file mode 100644 (file)
index 0000000..e734362
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// C++ Interface: labeldlg
+//
+// Description: 
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#ifndef MAGICSMOKE_LABELDLG_H
+#define MAGICSMOKE_LABELDLG_H
+
+#include <QDialog>
+#include <QPointF>
+#include <QList>
+
+class QPaintDevice;
+class QCheckBox;
+class QComboBox;
+class QLineEdit;
+
+class MLabelDialog:public QDialog
+{
+       Q_OBJECT
+       public:
+               /**creates a label dialog*/
+               MLabelDialog(QWidget*parent,QString printername,int numlabels);
+               /**deletes the label dialog and stores its current settings*/
+               ~MLabelDialog();
+               
+               /**returns the offset of label number n; relative to the coordinate system of the given paint device*/
+               QPointF labelOffset(int n,QPaintDevice*);
+       private:
+               QLineEdit *offx,*offy,*sizex,*sizey;
+               QComboBox *metric,*page;
+               QList<QCheckBox*>checks;
+               QList<QList<bool> >checked;
+               QString printername;
+               int numlabels;
+};
+
+#endif
index 7e4b6ec..bab6c8d 100644 (file)
@@ -14,6 +14,7 @@
 #include "event.h"
 #include "webrequest.h"
 #include "ticketrender.h"
+#include "labeldlg.h"
 
 #include <QBoxLayout>
 #include <QGridLayout>
@@ -172,6 +173,9 @@ void MOrderWindow::printTickets(QList<MTicket> tickets)
        QPrintDialog pd(&printer,this);
        if(pd.exec()!=QDialog::Accepted)return;
        //TODO: insert label arrangement
+       MLabelDialog ld(this,printer.printerName(),tickets.size());
+       if(ld.exec()!=QDialog::Accepted)
+               return;
        //TODO: fix to use correct template
        MTicketRenderer render(tf);
        QPainter painter(&printer);
index 14e9cae..6427df9 100644 (file)
@@ -40,7 +40,8 @@ SOURCES = \
        eventsummary.cpp \
        odtrender.cpp \
        ticketrender.cpp \
-       orderwin.cpp
+       orderwin.cpp \
+       labeldlg.cpp
 
 #some PHP files are listed below to scan them for translatable items:
 HEADERS = \
@@ -61,6 +62,7 @@ HEADERS = \
        odtrender.h \
        ticketrender.h \
        orderwin.h \
+       labeldlg.h \
        ../www/machine.php \
        ../www/inc/machine/session.php \
        ../www/inc/machine/host.php \