From: konrad Date: Tue, 25 Mar 2008 21:20:04 +0000 (+0000) Subject: first draft of label selection dialog X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=65c568e3720d6153e46217918248a2d313d7af0f;p=web%2Fkonrad%2Fsmoke.git first draft of label selection dialog git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@142 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/arrowdiag.png b/src/arrowdiag.png new file mode 100644 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 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 index 0000000..8a62bf7 Binary files /dev/null and b/src/arrowright.png differ diff --git a/src/files.qrc b/src/files.qrc index 93605ce..4462340 100644 --- a/src/files.qrc +++ b/src/files.qrc @@ -2,5 +2,8 @@ icon.png + arrowright.png + arrowdown.png + arrowdiag.png diff --git a/src/labeldlg.cpp b/src/labeldlg.cpp new file mode 100644 index 0000000..a97dc20 --- /dev/null +++ b/src/labeldlg.cpp @@ -0,0 +1,91 @@ +// +// C++ Implementation: labeldlg +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2008 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#include "labeldlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 index 0000000..e734362 --- /dev/null +++ b/src/labeldlg.h @@ -0,0 +1,45 @@ +// +// C++ Interface: labeldlg +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2008 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#ifndef MAGICSMOKE_LABELDLG_H +#define MAGICSMOKE_LABELDLG_H + +#include +#include +#include + +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; + QListchecks; + QList >checked; + QString printername; + int numlabels; +}; + +#endif diff --git a/src/orderwin.cpp b/src/orderwin.cpp index 7e4b6ec..bab6c8d 100644 --- a/src/orderwin.cpp +++ b/src/orderwin.cpp @@ -14,6 +14,7 @@ #include "event.h" #include "webrequest.h" #include "ticketrender.h" +#include "labeldlg.h" #include #include @@ -172,6 +173,9 @@ void MOrderWindow::printTickets(QList 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); diff --git a/src/smoke.pro b/src/smoke.pro index 14e9cae..6427df9 100644 --- a/src/smoke.pro +++ b/src/smoke.pro @@ -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 \