compat with Qt5.15, more steps towards Qt6 master
authorKonrad Rosenbaum <konrad@silmor.de>
Mon, 26 Jul 2021 16:51:20 +0000 (18:51 +0200)
committerKonrad Rosenbaum <konrad@silmor.de>
Mon, 26 Jul 2021 16:51:20 +0000 (18:51 +0200)
21 files changed:
Makefile
basics.pri
commonlib/configdialog.cpp
commonlib/mapplication.cpp
commonlib/misc/code39.cpp
commonlib/templates/labeldlg.cpp
commonlib/templates/labeldlg.h
commonlib/templates/odtrender.cpp
commonlib/widgets/centbox.h
commonlib/widgets/seatplanview.cpp
iface/iface.pro
iface/misc/misc.cpp
iface/misc/misc.h
iface/msinterface.cpp
iface/templates/templates.cpp
iface/wext/event.cpp
iface/wext/event.h
iface/wext/seatplanobj.cpp
pack
src/mwin/carttab.cpp
taurus

index b11bea6..f9abb5f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,8 @@
 #global configuration
 
 #change this if the correct Qt is not in your PATH
-QMAKE = qmake
+#QMAKE = qmake
+QMAKE = /usr/lib/x86_64-linux-gnu/qt5/bin/qmake
 #QMAKE = /usr/local/Qt-5.6.0/bin/qmake
 
 #set this if you want additional arguments to qmake
index ea115eb..645e54e 100644 (file)
@@ -13,6 +13,9 @@ CONFIG += separate_debug_info
 #enable C++-11 features
 CONFIG += c++11
 
+#FIXME: compat
+equals(QT_MAJOR_VERSION, 6): QT += core5compat
+
 #compilation output:
 OBJECTS_DIR = .ctmp
 MOC_DIR = .ctmp
@@ -25,7 +28,7 @@ LIBS += -L$$PWD/bin
 QMAKE_CFLAGS += -fstack-protector-all -Wstack-protector
 QMAKE_CXXFLAGS += -fstack-protector-all -Wstack-protector
 
-#ASLR for windows  
+#ASLR for windows
 win32 {
   QMAKE_LFLAGS +=  -Wl,--nxcompat -Wl,--dynamicbase
   LIBS += -lssp
index d4aab14..160bea0 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: config dialog
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
@@ -37,6 +37,7 @@
 #include <QNetworkProxy>
 #include <QNetworkReply>
 #include <QPushButton>
+#include <QRegExp>
 #include <QSettings>
 #include <QSpinBox>
 #include <QStandardItemModel>
@@ -48,7 +49,7 @@
 MConfigDialog::MConfigDialog()
 {
        setWindowTitle(tr("Magic Smoke Configuration"));
-       
+
        oldrow=-1;
        sslexcept=0;
        //main layout
@@ -76,7 +77,7 @@ MConfigDialog::MConfigDialog()
        m->addAction(tr("Set &Default Label Font..."),this,SLOT(setDefaultFont()));
        m->addAction(tr("Set &Application Style..."),this,SLOT(setAppStyle()));
        mb->addMenu(MApplication::helpMenu());
-       
+
        //create list view
        hl->addWidget(profiles=new MListView);
        profilemodel=new QStandardItemModel(this);
@@ -116,7 +117,7 @@ MConfigDialog::MConfigDialog()
        connect(useproxy,SIGNAL(toggled(bool)),proxyuser,SLOT(setEnabled(bool)));
        connect(useproxy,SIGNAL(toggled(bool)),proxypass,SLOT(setEnabled(bool)));
        gl->setRowStretch(++lctr,10);
-       
+
        tab->addTab(w=new QWidget,tr("Authentication"));
        w->setLayout(gl=new QGridLayout);
        lctr=0;
@@ -134,7 +135,7 @@ MConfigDialog::MConfigDialog()
         gl->addWidget(userhint=new QLineEdit,lctr,1);
        gl->setRowStretch(++lctr,10);
        gl->addLayout(hl=new QHBoxLayout,++lctr,0,1,2);
-       
+
        tab->addTab(w=new QWidget,tr("SSL Exceptions"));
        w->setLayout(vl=new QVBoxLayout);
        vl->addWidget(new QLabel(tr("List of non-fatal SSL exceptions:")),0);
@@ -149,7 +150,7 @@ MConfigDialog::MConfigDialog()
        connect(pb,SIGNAL(clicked()),this,SLOT(clearSslExceptions()));
        hl->addWidget(pb=new QPushButton(tr("Probe Server")));
        connect(pb,SIGNAL(clicked()),this,SLOT(serverProbe()));
-       
+
        tab->addTab(w=new QWidget,tr("Scripting"));
        w->setLayout(gl=new QGridLayout);
        gl->setColumnStretch(4,1);
@@ -178,9 +179,9 @@ MConfigDialog::MConfigDialog()
        lab->setAlignment(Qt::AlignRight);
        gl->addWidget(usrscript=new QLineEdit,lctr,1,1,4);
        gl->setRowStretch(++lctr,1);
-       
+
        setSizeGripEnabled(true);
-       
+
        initProfiles();
        loadProfile();
 }
@@ -469,7 +470,7 @@ void MConfigDialog::importKey()
        QModelIndex idx=profiles->currentIndex();
        if(!idx.isValid())return;
        QString profkey=profilemodel->data(idx,Qt::UserRole).toString();
-       
+
        if(QMessageBox::warning(this,tr("Warning"),tr("Importing a key overwrites the host key that is currently used by this profile. This may disable your accounts. Do you still want to continue?"),QMessageBox::Yes|QMessageBox::Abort,QMessageBox::Abort)!=QMessageBox::Yes)
                return;
        QStringList fn;
@@ -488,7 +489,7 @@ void MConfigDialog::importKey()
                return;
        }
        //read content (max: 10k to limit potential damage)
-       QStringList fc=QString::fromLatin1(fd.read(10240)).split("\n",QString::SkipEmptyParts);
+       QStringList fc=QString::fromLatin1(fd.read(10240)).split("\n",Qt::SkipEmptyParts);
        fd.close();
        //check content
        if(fc.size()<3){
@@ -641,14 +642,14 @@ MAppStyleDialog::MAppStyleDialog(QWidget*par)
        style->addItems(k);
        if(k.contains(cs))
                style->setCurrentIndex(k.indexOf(cs)+1);
-       
+
        gl->addWidget(new QLabel(tr("Stylesheet:")),1,0);
        gl->addWidget(css=new QLineEdit,1,1);
        css->setText(QSettings().value("appstylesheet").toString());
        QPushButton*p;
        gl->addWidget(p=new QPushButton("..."),1,2);
        connect(p,SIGNAL(clicked()),this,SLOT(selectCSS()));
-       
+
        gl->setRowMinimumHeight(2,15);
        QHBoxLayout*hl;
        gl->addLayout(hl=new QHBoxLayout,3,0,1,3);
index 176f215..e709b50 100644 (file)
@@ -194,7 +194,7 @@ void MApplication::versionDlg()
 }
 
 
-struct HelpUrl { 
+struct HelpUrl {
         enum Type {None, Item, Separator} type=None;
         QString label,url;
         HelpUrl(Type t,QString l,QString u=QString()):type(t),label(l),url(u){}
@@ -296,19 +296,19 @@ MApplication::MApplication(int&ac,char**av)
         //locate settings
         setOrganizationName("MagicSmoke");
         setApplicationName("MagicSmoke2");
-        
+
         //set icon
         setWindowIcon(QIcon(":/icon.png"));
 
         //install event filter for random generator
         installEventFilter(ef=new EFilter);
-        
+
         //init GUI wrappers
         MBoxWrapper::setWarning([](QString title,QString text){QMessageBox::warning(nullptr,title,text);});
         MProgressWrapper::setFactory([](QString label,QString button)->MProgressWrapper*{
                 return new MProgressWrapperGui(label,button);
         });
-        
+
         //check environment
        if(qEnvironmentVariableIsSet(ENV_DATADIR))
                setDataDir(QString::fromLocal8Bit(qgetenv(ENV_DATADIR)));
@@ -410,7 +410,7 @@ void MApplication::initLanguage()
        }
        //defaults
        if(lang!="--"&&lang!=""){
-               QLocale::setDefault(lang);
+               QLocale::setDefault(QLocale(lang));
 #ifndef Q_OS_WIN
                setenv("LANG",lang.toLatin1().data(),1);
        }else{
index d559742..8a237a8 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: code39
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
@@ -100,7 +100,7 @@ QImage code39(QString str)
 //     qDebug("Code-39, encoding: %s -> %c",str.toLatin1().data(),code39mod(str));
        //define xpm
        const char *xpm[4];
-       QByteArray xpmsz=QString().sprintf("%i 1 2 1",rstr.size()).toLatin1();
+    QByteArray xpmsz=QString("%1 1 2 1").arg(rstr.size()).toLatin1();
        xpm[0]=xpmsz.data();
        xpm[1]="0\tg #000000";
        xpm[2]="1\tg #FFFFFF";
index b24ffca..932f68e 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: labeldlg
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2016
@@ -25,6 +25,7 @@
 #include <QLabel>
 #include <QLineEdit>
 // #include <QPrintDialog>
+#include <QPageLayout>
 #include <QPrinter>
 #include <QPrinterInfo>
 #include <QPushButton>
 #define COLS 20
 
 MLabelDialog::MLabelDialog(QWidget*par,QPrinter* pn,int nl,QSizeF ls)
-       :QDialog(par)
-{
-       printer=pn;
-       numlabels=nl;
-       labelsize=ls;
-       maxrows=ROWS;
-       maxcols=COLS;
-       
-       setWindowTitle(tr("Label Printing Setup"));
-       
-       //get settings
-       QSettings set;
-       set.beginGroup("printer/"+printer->printerName());
-       double ox=set.value("offsetx",0.0).toDouble();
-       double oy=set.value("offsety",0.0).toDouble();
-       double lsx=set.value("sizex",0.0).toDouble();
-       double lsy=set.value("sizey",0.0).toDouble();
-       QString mtrc=set.value("metric",tr("mm","defaultmetric: mm, in, cm")).toString();
-       if(lsx==0.0 || lsy==0.0){
-               //convert ticket template size
-               double dx=printer->logicalDpiX();
-               double dy=printer->logicalDpiY();
-               if(mtrc=="in"){
-                       lsx=ls.width()/dx;
-                       lsy=ls.height()/dy;
-               }else
-               if(mtrc=="cm"){
-                       lsx=ls.width()/dx*2.54;
-                       lsy=ls.height()/dy*2.54;
-               }else{//mm
-                       lsx=ls.width()/dx*25.4;
-                       lsy=ls.height()/dy*25.4;
-               }
-       }
-       
-       //display
-       
-       QVBoxLayout*vl;
-       QGridLayout*gl;
-       setLayout(vl=new QVBoxLayout);
-       vl->addLayout(gl=new QGridLayout,0);
-       
-       int ln=0;
-       gl->addWidget(new QLabel(tr("Label offset:")),ln,0);
-       gl->addWidget(offx=new QLineEdit(QString::number(ox)),ln,1);
-       offx->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
-       gl->addWidget(new QLabel("x"),ln,2);
-       gl->addWidget(offy=new QLineEdit(QString::number(oy)),ln,3);
-       offy->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
-       gl->addWidget(new QLabel(tr("Label size:")),++ln,0);
-       gl->addWidget(sizex=new QLineEdit(QString::number(lsx)),ln,1);
-       sizex->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
-       gl->addWidget(new QLabel("x"),ln,2);
-       gl->addWidget(sizey=new QLineEdit(QString::number(lsy)),ln,3);
-       sizey->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
-       gl->addWidget(new QLabel(tr("Unit:")),++ln,0);
-       gl->addWidget(metric=new QComboBox,ln,1,1,3);
-       metric->addItem(tr("Millimeter"),"mm");
-       metric->addItem(tr("Centimeter"),"cm");
-       metric->addItem(tr("Inch"),"in");
-       gl->addWidget(warning=new QLabel(""),++ln,0,1,4);
-       QPalette pal=warning->palette();
-       pal.setColor(QPalette::WindowText,Qt::red);
-       warning->setPalette(pal);
-       gl->setColumnStretch(++ln,10);
-       
-       vl->addSpacing(10);
-       vl->addWidget(new QLabel(tr("Page usage:")),0);
-       vl->addWidget(page=new QComboBox,0);
-       for(int i=0;i<nl;i++)
-               page->addItem(tr("Page %1").arg(i+1),i);
-       oldpage=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"));
-       connect(t,SIGNAL(clicked()),this,SLOT(toggleAll()));
-       QSignalMapper *cmap=new QSignalMapper(this);
-       connect(cmap,SIGNAL(mapped(int)),this,SLOT(toggleColumn(int)));
-       for(int i=1;i<=COLS;i++){
-               gl->addWidget(t=new QToolButton,0,i);
-               t->setIcon(QIcon(":/arrowdown.png"));
-               connect(t,SIGNAL(clicked()),cmap,SLOT(map()));
-               cmap->setMapping(t,i-1);
-       }
-       QSignalMapper *rmap=new QSignalMapper(this);
-       connect(rmap,SIGNAL(mapped(int)),this,SLOT(toggleRow(int)));
-       for(int i=1;i<=ROWS;i++){
-               gl->addWidget(t=new QToolButton,i,0);
-               t->setIcon(QIcon(":/arrowright.png"));
-               connect(t,SIGNAL(clicked()),rmap,SLOT(map()));
-               rmap->setMapping(t,i-1);
-               for(int j=1;j<=COLS;j++){
-                       QCheckBox*b;
-                       gl->addWidget(b=new QCheckBox,i,j);
-                       checks.append(b);
-                       connect(b,SIGNAL(clicked()),this,SLOT(savePage()));
-               }
-       }
-       sa->setWidget(w);
-       connect(page,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePage()));
-       connect(sizex,SIGNAL(textChanged(const QString&)),this,SLOT(updatePage()));
-       connect(sizey,SIGNAL(textChanged(const QString&)),this,SLOT(updatePage()));
-       connect(metric,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePage()));
-       
-       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()));
-       connect(p,SIGNAL(clicked()),this,SLOT(saveSettings()));
-       p->setDefault(true);
-       hl->addWidget(p=new QPushButton(tr("Cancel")),0);
-       connect(p,SIGNAL(clicked()),this,SLOT(reject()));
-       
-       //initialize
-       QList<bool>tpl;
-       for(int i=0;i<(ROWS*COLS);i++)tpl.append(true);
-       for(int i=0;i<nl;i++)checked.append(tpl);
-       updatePage();
+    :QDialog(par)
+{
+    printer=pn;
+    numlabels=nl;
+    labelsize=ls;
+    maxrows=ROWS;
+    maxcols=COLS;
+
+    setWindowTitle(tr("Label Printing Setup"));
+
+    //get settings
+    QSettings set;
+    set.beginGroup("printer/"+printer->printerName());
+    double ox=set.value("offsetx",0.0).toDouble();
+    double oy=set.value("offsety",0.0).toDouble();
+    double lsx=set.value("sizex",0.0).toDouble();
+    double lsy=set.value("sizey",0.0).toDouble();
+    QString mtrc=set.value("metric",tr("mm","defaultmetric: mm, in, cm")).toString();
+    if(lsx==0.0 || lsy==0.0){
+        //convert ticket template size
+        double dx=printer->logicalDpiX();
+        double dy=printer->logicalDpiY();
+        if(mtrc=="in"){
+            lsx=ls.width()/dx;
+            lsy=ls.height()/dy;
+        }else
+        if(mtrc=="cm"){
+            lsx=ls.width()/dx*2.54;
+            lsy=ls.height()/dy*2.54;
+        }else{//mm
+            lsx=ls.width()/dx*25.4;
+            lsy=ls.height()/dy*25.4;
+        }
+    }
+
+    //display
+
+    QVBoxLayout*vl;
+    QGridLayout*gl;
+    setLayout(vl=new QVBoxLayout);
+    vl->addLayout(gl=new QGridLayout,0);
+
+    int ln=0;
+    gl->addWidget(new QLabel(tr("Label offset:")),ln,0);
+    gl->addWidget(offx=new QLineEdit(QString::number(ox)),ln,1);
+    offx->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
+    gl->addWidget(new QLabel("x"),ln,2);
+    gl->addWidget(offy=new QLineEdit(QString::number(oy)),ln,3);
+    offy->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
+    gl->addWidget(new QLabel(tr("Label size:")),++ln,0);
+    gl->addWidget(sizex=new QLineEdit(QString::number(lsx)),ln,1);
+    sizex->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
+    gl->addWidget(new QLabel("x"),ln,2);
+    gl->addWidget(sizey=new QLineEdit(QString::number(lsy)),ln,3);
+    sizey->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
+    gl->addWidget(new QLabel(tr("Unit:")),++ln,0);
+    gl->addWidget(metric=new QComboBox,ln,1,1,3);
+    metric->addItem(tr("Millimeter"),"mm");
+    metric->addItem(tr("Centimeter"),"cm");
+    metric->addItem(tr("Inch"),"in");
+    gl->addWidget(warning=new QLabel(""),++ln,0,1,4);
+    QPalette pal=warning->palette();
+    pal.setColor(QPalette::WindowText,Qt::red);
+    warning->setPalette(pal);
+    gl->setColumnStretch(++ln,10);
+
+    vl->addSpacing(10);
+    vl->addWidget(new QLabel(tr("Page usage:")),0);
+    vl->addWidget(page=new QComboBox,0);
+    for(int i=0;i<nl;i++)
+        page->addItem(tr("Page %1").arg(i+1),i);
+    oldpage=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"));
+    connect(t,SIGNAL(clicked()),this,SLOT(toggleAll()));
+    QSignalMapper *cmap=new QSignalMapper(this);
+    connect(cmap,SIGNAL(mapped(int)),this,SLOT(toggleColumn(int)));
+    for(int i=1;i<=COLS;i++){
+        gl->addWidget(t=new QToolButton,0,i);
+        t->setIcon(QIcon(":/arrowdown.png"));
+        connect(t,SIGNAL(clicked()),cmap,SLOT(map()));
+        cmap->setMapping(t,i-1);
+    }
+    QSignalMapper *rmap=new QSignalMapper(this);
+    connect(rmap,SIGNAL(mapped(int)),this,SLOT(toggleRow(int)));
+    for(int i=1;i<=ROWS;i++){
+        gl->addWidget(t=new QToolButton,i,0);
+        t->setIcon(QIcon(":/arrowright.png"));
+        connect(t,SIGNAL(clicked()),rmap,SLOT(map()));
+        rmap->setMapping(t,i-1);
+        for(int j=1;j<=COLS;j++){
+            QCheckBox*b;
+            gl->addWidget(b=new QCheckBox,i,j);
+            checks.append(b);
+            connect(b,SIGNAL(clicked()),this,SLOT(savePage()));
+        }
+    }
+    sa->setWidget(w);
+    connect(page,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePage()));
+    connect(sizex,SIGNAL(textChanged(const QString&)),this,SLOT(updatePage()));
+    connect(sizey,SIGNAL(textChanged(const QString&)),this,SLOT(updatePage()));
+    connect(metric,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePage()));
+
+    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()));
+    connect(p,SIGNAL(clicked()),this,SLOT(saveSettings()));
+    p->setDefault(true);
+    hl->addWidget(p=new QPushButton(tr("Cancel")),0);
+    connect(p,SIGNAL(clicked()),this,SLOT(reject()));
+
+    //initialize
+    QList<bool>tpl;
+    for(int i=0;i<(ROWS*COLS);i++)tpl.append(true);
+    for(int i=0;i<nl;i++)checked.append(tpl);
+    updatePage();
 }
 
 QDataStream &operator<<(QDataStream &out, const MLabelConfig &myObj)
@@ -187,187 +188,189 @@ void MLabelConfig::initMeta()
         static int mt=-1;
         if(mt>=0)return;
         mt=qRegisterMetaType<MLabelConfig>();
+#if QT_VERSION < 0x060000
         qRegisterMetaTypeStreamOperators<MLabelConfig>();
+#endif
 }
 
 MLabelDialog::~MLabelDialog(){}
 
 int MLabelDialog::findLabel(int n,int&row,int&col)const
 {
-       //search allowed labels
-       int ctr=-1;
-       for(int p=0;p<numlabels;p++)
-               for(int r=maxrows-1;r>=0;r--)
-                       for(int c=0;c<maxcols;c++){
-                               if(checked[p][r*COLS+c])ctr++;
-                               if(ctr==n){
-                                       row=r;
-                                       col=c;
-                                       return p;
-                               }
-                       }
-       //fail
-       return -1;
+    //search allowed labels
+    int ctr=-1;
+    for(int p=0;p<numlabels;p++)
+        for(int r=maxrows-1;r>=0;r--)
+            for(int c=0;c<maxcols;c++){
+                if(checked[p][r*COLS+c])ctr++;
+                if(ctr==n){
+                    row=r;
+                    col=c;
+                    return p;
+                }
+            }
+    //fail
+    return -1;
 }
 
 QPointF MLabelDialog::labelOffset(int n)const
 {
-       //find it
-       int row=0,col=0;
-       findLabel(n,row,col);
-       //get offset
-       double px=offx->text().toDouble();
-       double py=offy->text().toDouble();
-       //add rows/cols
-       px+=col*sizex->text().toDouble();
-       py+=row*sizey->text().toDouble();
-       //correct to DPI
-       QString mtrc=metric->itemData(metric->currentIndex()).toString();
-       if(mtrc=="in"){
-               px*=printer->logicalDpiX();
-               py*=printer->logicalDpiY();
-       }else
-       if(mtrc=="cm"){
-               px*=printer->logicalDpiX()/2.54;
-               py*=printer->logicalDpiY()/2.54;
-       }else{
-               px*=printer->logicalDpiX()/25.4;
-               py*=printer->logicalDpiY()/25.4;
-       }
-       //return
-       return QPointF(px,py);
+    //find it
+    int row=0,col=0;
+    findLabel(n,row,col);
+    //get offset
+    double px=offx->text().toDouble();
+    double py=offy->text().toDouble();
+    //add rows/cols
+    px+=col*sizex->text().toDouble();
+    py+=row*sizey->text().toDouble();
+    //correct to DPI
+    QString mtrc=metric->itemData(metric->currentIndex()).toString();
+    if(mtrc=="in"){
+        px*=printer->logicalDpiX();
+        py*=printer->logicalDpiY();
+    }else
+    if(mtrc=="cm"){
+        px*=printer->logicalDpiX()/2.54;
+        py*=printer->logicalDpiY()/2.54;
+    }else{
+        px*=printer->logicalDpiX()/25.4;
+        py*=printer->logicalDpiY()/25.4;
+    }
+    //return
+    return QPointF(px,py);
 }
 
 bool MLabelDialog::labelNeedsPageTurn(int n)const
 {
-       //find it
-       int pg,row=0,col=0;
-       pg=findLabel(n,row,col);
-       //page 0 needs no turn
-       if(pg<=0)return false;
-       //scan that page (all rows below label)
-       for(int r=maxrows-1;r>row;r--)
-               for(int c=0;c<maxcols;c++)
-                       if(checked[pg][r*COLS+c])return false;
-       //scan that page (all cols left of label)
-       for(int c=0;c<col;c++)
-               if(checked[pg][row*COLS+c])return false;
-       //none found, this is the first one: turn page
-       return true;
+    //find it
+    int pg,row=0,col=0;
+    pg=findLabel(n,row,col);
+    //page 0 needs no turn
+    if(pg<=0)return false;
+    //scan that page (all rows below label)
+    for(int r=maxrows-1;r>row;r--)
+        for(int c=0;c<maxcols;c++)
+            if(checked[pg][r*COLS+c])return false;
+    //scan that page (all cols left of label)
+    for(int c=0;c<col;c++)
+        if(checked[pg][row*COLS+c])return false;
+    //none found, this is the first one: turn page
+    return true;
 }
 
 bool MLabelDialog::oneLabelPerPage() const
 {
-       return maxrows<=1 && maxcols<=1;
+    return maxrows<=1 && maxcols<=1;
 }
 
 bool MLabelDialog::conditionalExec(MLabelConfig::LabelType lt)
 {
-       //check config
-       bool doexec=false;
-       switch(MLabelConfig(lt).pageAskMode()){
-               case MLabelConfig::PageAskAlways:doexec=true;break;
-               case MLabelConfig::PageAskIfNeeded:doexec=!oneLabelPerPage();break;
-               case MLabelConfig::PageAskNever:return true;
-       }
-       //execute, or not
-       if(doexec)
-               return exec()==Accepted;
-       else
-               return true;
+    //check config
+    bool doexec=false;
+    switch(MLabelConfig(lt).pageAskMode()){
+        case MLabelConfig::PageAskAlways:doexec=true;break;
+        case MLabelConfig::PageAskIfNeeded:doexec=!oneLabelPerPage();break;
+        case MLabelConfig::PageAskNever:return true;
+    }
+    //execute, or not
+    if(doexec)
+        return exec()==Accepted;
+    else
+        return true;
 }
 
 void MLabelDialog::toggleRow(int r)
 {
-       for(int i=r*COLS;i<(r*COLS+COLS);i++){
-               checked[oldpage][i]^=true;
-               checks[i]->setChecked(checked[oldpage][i]);
-       }
+    for(int i=r*COLS;i<(r*COLS+COLS);i++){
+        checked[oldpage][i]^=true;
+        checks[i]->setChecked(checked[oldpage][i]);
+    }
 }
 
 void MLabelDialog::toggleColumn(int c)
 {
-       for(int r=0;r<ROWS;r++){
-               int i=r*COLS+c;
-               checked[oldpage][i]^=true;
-               checks[i]->setChecked(checked[oldpage][i]);
-       }
+    for(int r=0;r<ROWS;r++){
+        int i=r*COLS+c;
+        checked[oldpage][i]^=true;
+        checks[i]->setChecked(checked[oldpage][i]);
+    }
 }
 
 void MLabelDialog::toggleAll()
 {
-       for(int i=0;i<(ROWS*COLS);i++){
-               checked[oldpage][i]^=true;
-               checks[i]->setChecked(checked[oldpage][i]);
-       }
+    for(int i=0;i<(ROWS*COLS);i++){
+        checked[oldpage][i]^=true;
+        checks[i]->setChecked(checked[oldpage][i]);
+    }
 }
 
 void MLabelDialog::savePage()
 {
-       for(int i=0;i<(ROWS*COLS);i++)
-               checked[oldpage][i]=checks[i]->isChecked();
+    for(int i=0;i<(ROWS*COLS);i++)
+        checked[oldpage][i]=checks[i]->isChecked();
 }
 
 void MLabelDialog::updatePage()
 {
-       //find how many rows/cols fit on the page
-       double lx=sizex->text().toDouble();
-       double ly=sizey->text().toDouble();
-       QRect pr=printer->pageRect();
-       QString mtrc=metric->itemData(metric->currentIndex()).toString();
-       if(mtrc=="in"){
-               lx*=printer->logicalDpiX();
-               ly*=printer->logicalDpiY();
-       }else
-       if(mtrc=="cm"){
-               lx*=printer->logicalDpiX()/2.54;
-               ly*=printer->logicalDpiY()/2.54;
-       }else{
-               lx*=printer->logicalDpiX()/25.4;
-               ly*=printer->logicalDpiY()/25.4;
-       }
-       
-       bool dowarn=false;
-       if(ly>0.0){
-               maxrows=pr.height()/ly;
-               if(maxrows>ROWS)maxrows=ROWS;
-               if(maxrows<1){
-                       maxrows=1;
-                       dowarn=true;
-               }
-       }else maxrows=ROWS;
-       if(lx>0.0){
-               maxcols=pr.width()/lx;
-               if(maxcols>COLS)maxcols=COLS;
-               if(maxcols<1){
-                       maxcols=1;
-                       dowarn=true;
-               }
-       }else maxcols=COLS;
-       //update
-       oldpage=page->itemData(page->currentIndex()).toInt();
-       for(int r=0;r<ROWS;r++)
-               for(int c=0;c<COLS;c++){
-                       int i=r*COLS+c;
-                       bool b=r<maxrows && c<maxcols;
-                       checks[i]->setChecked(b && checked[oldpage][i]);
-                       checks[i]->setEnabled(b);
-               }
-       if(dowarn)
-               warning->setText(tr("Warning: the label may not fit on the page!"));
-       else
-               warning->setText("");
+    //find how many rows/cols fit on the page
+    double lx=sizex->text().toDouble();
+    double ly=sizey->text().toDouble();
+    QRectF pr=printer->pageRect(QPrinter::DevicePixel);
+    QString mtrc=metric->itemData(metric->currentIndex()).toString();
+    if(mtrc=="in"){
+        lx*=printer->logicalDpiX();
+        ly*=printer->logicalDpiY();
+    }else
+    if(mtrc=="cm"){
+        lx*=printer->logicalDpiX()/2.54;
+        ly*=printer->logicalDpiY()/2.54;
+    }else{
+        lx*=printer->logicalDpiX()/25.4;
+        ly*=printer->logicalDpiY()/25.4;
+    }
+
+    bool dowarn=false;
+    if(ly>0.0){
+        maxrows=pr.height()/ly;
+        if(maxrows>ROWS)maxrows=ROWS;
+        if(maxrows<1){
+            maxrows=1;
+            dowarn=true;
+        }
+    }else maxrows=ROWS;
+    if(lx>0.0){
+        maxcols=pr.width()/lx;
+        if(maxcols>COLS)maxcols=COLS;
+        if(maxcols<1){
+            maxcols=1;
+            dowarn=true;
+        }
+    }else maxcols=COLS;
+    //update
+    oldpage=page->itemData(page->currentIndex()).toInt();
+    for(int r=0;r<ROWS;r++)
+        for(int c=0;c<COLS;c++){
+            int i=r*COLS+c;
+            bool b=r<maxrows && c<maxcols;
+            checks[i]->setChecked(b && checked[oldpage][i]);
+            checks[i]->setEnabled(b);
+        }
+    if(dowarn)
+        warning->setText(tr("Warning: the label may not fit on the page!"));
+    else
+        warning->setText("");
 }
 
 void MLabelDialog::saveSettings()
 {
-       QSettings set;
-       set.beginGroup("printer/"+printer->printerName());
-       set.setValue("offsetx",offx->text().toDouble());
-       set.setValue("offsety",offy->text().toDouble());
-       set.setValue("sizex",sizex->text().toDouble());
-       set.setValue("sizey",sizey->text().toDouble());
-       set.setValue("metric",metric->itemData(metric->currentIndex()).toString());
+    QSettings set;
+    set.beginGroup("printer/"+printer->printerName());
+    set.setValue("offsetx",offx->text().toDouble());
+    set.setValue("offsety",offy->text().toDouble());
+    set.setValue("sizex",sizex->text().toDouble());
+    set.setValue("sizey",sizey->text().toDouble());
+    set.setValue("metric",metric->itemData(metric->currentIndex()).toString());
 }
 
 
@@ -375,262 +378,265 @@ void MLabelDialog::saveSettings()
 
 void MLabelConfig::configDialog(QWidget* parent)
 {
-       QDialog d(parent);
-       MLabelConfig ticket(MLabelConfig::Ticket),voucher(MLabelConfig::Voucher);
-       d.setWindowTitle(tr("Label Configuration"));
-       QFormLayout*fl;
-       d.setLayout(fl=new QFormLayout);
-       fl->addRow(new QLabel(tr("Ticket Labels:")));
-       //each one: ask printer mode, ask label-page mode, printer/settings
-       QComboBox*t_prnmode,*t_pagmode,*t_prnbufmode;
-       fl->addRow(tr("Print Dialog:"),t_prnmode=new QComboBox);
-       t_prnmode->addItem(tr("Always ask for printer"),PrintAskAlways);
-       t_prnmode->addItem(tr("Ask if unknown or not present"),PrintAskIfUnknown);
-       t_prnmode->addItem(tr("Never ask for printer"),PrintAskNever);
-       t_prnmode->setCurrentIndex(ticket.printAskMode());
-       fl->addRow(tr("Page Dialog:"),t_pagmode=new QComboBox);
-       t_pagmode->addItem(tr("Always ask for page layout"),PageAskAlways);
-       t_pagmode->addItem(tr("Ask if more than one label per page"),PageAskIfNeeded);
-       t_pagmode->addItem(tr("Never ask for page layout"),PageAskNever);
-       t_pagmode->setCurrentIndex(ticket.pageAskMode());
-       QHBoxLayout*hl;
-       QLabel*t_prn;QMap<QString,QVariant>t_prnset;
-       QToolButton*p;
-       QPrinter t_printer;
-       ticket.configurePrinter(t_printer);
-       fl->addRow(tr("Printer:"),hl=new QHBoxLayout);
-       hl->addWidget(t_prn=new QLabel(ticket.printerName()),1);
-       hl->addWidget(p=new QToolButton);
-       p->setText("...");
-       auto settprn=[&]{
-               MLabelPrintDialog pd(&t_printer,&d);
+    QDialog d(parent);
+    MLabelConfig ticket(MLabelConfig::Ticket),voucher(MLabelConfig::Voucher);
+    d.setWindowTitle(tr("Label Configuration"));
+    QFormLayout*fl;
+    d.setLayout(fl=new QFormLayout);
+    fl->addRow(new QLabel(tr("Ticket Labels:")));
+    //each one: ask printer mode, ask label-page mode, printer/settings
+    QComboBox*t_prnmode,*t_pagmode,*t_prnbufmode;
+    fl->addRow(tr("Print Dialog:"),t_prnmode=new QComboBox);
+    t_prnmode->addItem(tr("Always ask for printer"),PrintAskAlways);
+    t_prnmode->addItem(tr("Ask if unknown or not present"),PrintAskIfUnknown);
+    t_prnmode->addItem(tr("Never ask for printer"),PrintAskNever);
+    t_prnmode->setCurrentIndex(ticket.printAskMode());
+    fl->addRow(tr("Page Dialog:"),t_pagmode=new QComboBox);
+    t_pagmode->addItem(tr("Always ask for page layout"),PageAskAlways);
+    t_pagmode->addItem(tr("Ask if more than one label per page"),PageAskIfNeeded);
+    t_pagmode->addItem(tr("Never ask for page layout"),PageAskNever);
+    t_pagmode->setCurrentIndex(ticket.pageAskMode());
+    QHBoxLayout*hl;
+    QLabel*t_prn;QMap<QString,QVariant>t_prnset;
+    QToolButton*p;
+    QPrinter t_printer;
+    ticket.configurePrinter(t_printer);
+    fl->addRow(tr("Printer:"),hl=new QHBoxLayout);
+    hl->addWidget(t_prn=new QLabel(ticket.printerName()),1);
+    hl->addWidget(p=new QToolButton);
+    p->setText("...");
+    auto settprn=[&]{
+        MLabelPrintDialog pd(&t_printer,&d);
                 pd.setWindowTitle(tr("Chose Printer for Tickets"));
                 pd.setButtonLabel(tr("Set Printer"));
 //                 pd.setOptions(QAbstractPrintDialog::PrintShowPageSize);
-               if(pd.exec()!=QDialog::Accepted)return;
-               t_prn->setText(t_printer.printerName());
-       };
-       d.connect(p,&QToolButton::clicked,settprn);
-       fl->addRow(tr("Print Mode:"),t_prnbufmode=new QComboBox);
-       t_prnbufmode->addItem(tr("Direct Print"));
-       t_prnbufmode->addItem(tr("Use Buffer Pixmap"));
-       t_prnbufmode->setCurrentIndex((int)ticket.printMode());
-       QFrame*frm;
-       fl->addRow(frm=new QFrame);
-       frm->setFrameStyle(QFrame::HLine|QFrame::Sunken);
-       //Vouchers...
-       fl->addRow(new QLabel(tr("Voucher Labels:")));
-       //each one: ask printer mode, ask label-page mode, printer/settings
-       QComboBox*v_prnmode,*v_pagmode,*v_prnbufmode;
-       fl->addRow(tr("Print Dialog:"),v_prnmode=new QComboBox);
-       v_prnmode->addItem(tr("Always ask for printer"),PrintAskAlways);
-       v_prnmode->addItem(tr("Ask if unknown or not present"),PrintAskIfUnknown);
-       v_prnmode->addItem(tr("Never ask for printer"),PrintAskNever);
-       v_prnmode->setCurrentIndex(voucher.printAskMode());
-       fl->addRow(tr("Page Dialog:"),v_pagmode=new QComboBox);
-       v_pagmode->addItem(tr("Always ask for page layout"),PageAskAlways);
-       v_pagmode->addItem(tr("Ask if more than one label per page"),PageAskIfNeeded);
-       v_pagmode->addItem(tr("Never ask for page layout"),PageAskNever);
-       v_pagmode->setCurrentIndex(voucher.pageAskMode());
-       QLabel*v_prn;QMap<QString,QVariant>v_prnset;
-       QPrinter v_printer;
-       voucher.configurePrinter(v_printer);
-       fl->addRow(tr("Printer:"),hl=new QHBoxLayout);
-       hl->addWidget(v_prn=new QLabel(voucher.printerName()),1);
-       hl->addWidget(p=new QToolButton);
-       p->setText("...");
-       auto setvprn=[&]{
-               MLabelPrintDialog pd(&v_printer,&d);
+        if(pd.exec()!=QDialog::Accepted)return;
+        t_prn->setText(t_printer.printerName());
+    };
+    d.connect(p,&QToolButton::clicked,settprn);
+    fl->addRow(tr("Print Mode:"),t_prnbufmode=new QComboBox);
+    t_prnbufmode->addItem(tr("Direct Print"));
+    t_prnbufmode->addItem(tr("Use Buffer Pixmap"));
+    t_prnbufmode->setCurrentIndex((int)ticket.printMode());
+    QFrame*frm;
+    fl->addRow(frm=new QFrame);
+    frm->setFrameStyle(QFrame::HLine|QFrame::Sunken);
+    //Vouchers...
+    fl->addRow(new QLabel(tr("Voucher Labels:")));
+    //each one: ask printer mode, ask label-page mode, printer/settings
+    QComboBox*v_prnmode,*v_pagmode,*v_prnbufmode;
+    fl->addRow(tr("Print Dialog:"),v_prnmode=new QComboBox);
+    v_prnmode->addItem(tr("Always ask for printer"),PrintAskAlways);
+    v_prnmode->addItem(tr("Ask if unknown or not present"),PrintAskIfUnknown);
+    v_prnmode->addItem(tr("Never ask for printer"),PrintAskNever);
+    v_prnmode->setCurrentIndex(voucher.printAskMode());
+    fl->addRow(tr("Page Dialog:"),v_pagmode=new QComboBox);
+    v_pagmode->addItem(tr("Always ask for page layout"),PageAskAlways);
+    v_pagmode->addItem(tr("Ask if more than one label per page"),PageAskIfNeeded);
+    v_pagmode->addItem(tr("Never ask for page layout"),PageAskNever);
+    v_pagmode->setCurrentIndex(voucher.pageAskMode());
+    QLabel*v_prn;QMap<QString,QVariant>v_prnset;
+    QPrinter v_printer;
+    voucher.configurePrinter(v_printer);
+    fl->addRow(tr("Printer:"),hl=new QHBoxLayout);
+    hl->addWidget(v_prn=new QLabel(voucher.printerName()),1);
+    hl->addWidget(p=new QToolButton);
+    p->setText("...");
+    auto setvprn=[&]{
+        MLabelPrintDialog pd(&v_printer,&d);
                 pd.setWindowTitle(tr("Chose Printer for Vouchers"));
                 pd.setButtonLabel(tr("Set Printer"));
 //                 pd.setOptions(QAbstractPrintDialog::PrintShowPageSize);
-               if(pd.exec()!=QDialog::Accepted)return;
-               v_prn->setText(v_printer.printerName());
-       };
-       d.connect(p,&QToolButton::clicked,setvprn);
-       fl->addRow(tr("Print Mode:"),v_prnbufmode=new QComboBox);
-       v_prnbufmode->addItem(tr("Direct Print"));
-       v_prnbufmode->addItem(tr("Use Buffer Pixmap"));
-       v_prnbufmode->setCurrentIndex((int)voucher.printMode());
-       //button...
-       fl->addRow(new QLabel(" "));
-       fl->addRow(hl=new QHBoxLayout);
-       hl->addStretch(1);
-       QPushButton*b;
-       hl->addWidget(b=new QPushButton(tr("Ok")));
-       d.connect(b,SIGNAL(clicked()),&d,SLOT(accept()));
-       hl->addWidget(b=new QPushButton(tr("Cancel")));
-       d.connect(b,SIGNAL(clicked()),&d,SLOT(reject()));
-       //show dialog
-       if(d.exec()!=QDialog::Accepted)return;
-       //save settings
-       ticket.storePrinter(t_printer);
-       ticket.storeAskModes(
-               (MLabelConfig::PrintAskMode)t_prnmode->currentIndex(),
-               (MLabelConfig::PageAskMode)t_pagmode->currentIndex()
-       );
-       ticket.storePrintMode((MLabelConfig::PrintMode)t_prnbufmode->currentIndex());
-       voucher.storePrinter(v_printer);
-       voucher.storeAskModes(
-               (MLabelConfig::PrintAskMode)v_prnmode->currentIndex(),
-               (MLabelConfig::PageAskMode)v_pagmode->currentIndex()
-       );
-       voucher.storePrintMode((MLabelConfig::PrintMode)v_prnbufmode->currentIndex());
+        if(pd.exec()!=QDialog::Accepted)return;
+        v_prn->setText(v_printer.printerName());
+    };
+    d.connect(p,&QToolButton::clicked,setvprn);
+    fl->addRow(tr("Print Mode:"),v_prnbufmode=new QComboBox);
+    v_prnbufmode->addItem(tr("Direct Print"));
+    v_prnbufmode->addItem(tr("Use Buffer Pixmap"));
+    v_prnbufmode->setCurrentIndex((int)voucher.printMode());
+    //button...
+    fl->addRow(new QLabel(" "));
+    fl->addRow(hl=new QHBoxLayout);
+    hl->addStretch(1);
+    QPushButton*b;
+    hl->addWidget(b=new QPushButton(tr("Ok")));
+    d.connect(b,SIGNAL(clicked()),&d,SLOT(accept()));
+    hl->addWidget(b=new QPushButton(tr("Cancel")));
+    d.connect(b,SIGNAL(clicked()),&d,SLOT(reject()));
+    //show dialog
+    if(d.exec()!=QDialog::Accepted)return;
+    //save settings
+    ticket.storePrinter(t_printer);
+    ticket.storeAskModes(
+        (MLabelConfig::PrintAskMode)t_prnmode->currentIndex(),
+        (MLabelConfig::PageAskMode)t_pagmode->currentIndex()
+    );
+    ticket.storePrintMode((MLabelConfig::PrintMode)t_prnbufmode->currentIndex());
+    voucher.storePrinter(v_printer);
+    voucher.storeAskModes(
+        (MLabelConfig::PrintAskMode)v_prnmode->currentIndex(),
+        (MLabelConfig::PageAskMode)v_pagmode->currentIndex()
+    );
+    voucher.storePrintMode((MLabelConfig::PrintMode)v_prnbufmode->currentIndex());
 }
 
 QString MLabelConfig::tr(const char* s, const char* c)
 {
-       return QCoreApplication::translate("MLabelConfig",s,c);
+    return QCoreApplication::translate("MLabelConfig",s,c);
 }
 
 QString MLabelConfig::printerName() const
 {
-       QString key=m_type==Ticket?"ticket":"voucher";
-       QSettings set;
-       set.beginGroup(req->settingsGroup()+"/"+key);
-       if(!set.contains("name"))return QString();
-       return set.value("name").toString();
+    QString key=m_type==Ticket?"ticket":"voucher";
+    QSettings set;
+    set.beginGroup(req->settingsGroup()+"/"+key);
+    if(!set.contains("name"))return QString();
+    return set.value("name").toString();
 }
 
 bool MLabelConfig::selectPrinter(QPrinter& printer, bool force)
 {
-       bool gotit=configurePrinter(printer);
-       if(!force)
-       switch(printAskMode()){
-               case PrintAskAlways:force=true;break;
-               case PrintAskIfUnknown:if(!gotit)force=true;break;
-               case PrintAskNever:/*do not override the force*/ break;
-       }
-       if(force){
-               MLabelPrintDialog pd(&printer);
-               return pd.exec()==QDialog::Accepted;
-       }else
-               return gotit;
+    bool gotit=configurePrinter(printer);
+    if(!force)
+    switch(printAskMode()){
+        case PrintAskAlways:force=true;break;
+        case PrintAskIfUnknown:if(!gotit)force=true;break;
+        case PrintAskNever:/*do not override the force*/ break;
+    }
+    if(force){
+        MLabelPrintDialog pd(&printer);
+        return pd.exec()==QDialog::Accepted;
+    }else
+        return gotit;
 }
 
 QString MLabelConfig::cgroup() const
 {
-       const QString key=m_type==Ticket?"ticket":"voucher";
-       return req->settingsGroup()+"/"+key;
+    const QString key=m_type==Ticket?"ticket":"voucher";
+    return req->settingsGroup()+"/"+key;
 }
 
 static inline void dumpPrn(QPrinter&p,QString s)
 {
         qDebug()<<"printer"<<p.printerName()<<s<<"valid?"<<p.isValid();
-        qDebug()<<"  page mm"<<p.pageSizeMM();
-        qreal ml,mr,mt,mb;
-        p.getPageMargins(&ml,&mr,&mb,&mt,QPrinter::Millimeter);
-        qDebug()<<"  margin"<<ml<<mr<<mb<<mt;
+        qDebug()<<"  page mm"<<p.pageLayout().pageSize().rect(QPageSize::Millimeter); //pageSizeMM();
+        //qreal ml,mr,mt,mb;
+        auto marg=p.pageLayout().margins(QPageLayout::Millimeter);
+        //p.getPageMargins(&ml,&mr,&mb,&mt,QPrinter::Millimeter);
+        qDebug()<<"  margin"<<marg;//<<ml<<mr<<mb<<mt;
         qDebug()<<"  duplex"<<p.duplex()
-        <<"orient"<<(p.orientation()==QPrinter::Portrait?"portrait":"landscape");
+        <<"orient"<<(p.pageLayout().orientation()==QPageLayout::Portrait?"portrait":"landscape");
         qDebug()<<"  resolution"<<p.resolution();
 }
 
 bool MLabelConfig::configurePrinter(QPrinter&prn ) const
 {
-       QSettings set;
-       set.beginGroup(cgroup());
-       if(!set.contains("name"))return false;
-       QString pname=set.value("name").toString();
-       bool found=false;
-       for(const QPrinterInfo &info : QPrinterInfo::availablePrinters()){
-               if(info.printerName()==pname){
-                       found=true;
-                       break;
-               }
-       }
-       if(!found){
+    QSettings set;
+    set.beginGroup(cgroup());
+    if(!set.contains("name"))return false;
+    QString pname=set.value("name").toString();
+    bool found=false;
+    for(const QPrinterInfo &info : QPrinterInfo::availablePrinters()){
+        if(info.printerName()==pname){
+            found=true;
+            break;
+        }
+    }
+    if(!found){
                 qDebug()<<"MLabelConfig::configurePrinter could not find printer"<<pname<<"falling back to system default printer";
                 return false;
         }
-       prn.setPrinterName(pname);
+    prn.setPrinterName(pname);
         dumpPrn(prn,"before setting printer object");
 #if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)
-       prn.setPrinterSelectionOption(set.value("soption","").toString());
+    prn.setPrinterSelectionOption(set.value("soption","").toString());
 #endif
-        QPrinter::PageSize pgsz=QPrinter::PageSize(set.value("paper",QPrinter::Custom).toInt());
-       prn.setPaperSize(pgsz);
-        if(pgsz==QPrinter::Custom)
-                prn.setPageSizeMM(set.value("papersizemm").toSizeF());
-       qreal ml,mr,mt,mb;
-       ml=set.value("marginLeft").toDouble();
-       mr=set.value("marginRight").toDouble();
-       mb=set.value("marginBottom").toDouble();
-       mt=set.value("marginTop").toDouble();
-       prn.setFullPage(set.value("fullPage",true).toBool());
-       prn.setPageMargins(QMarginsF(ml,mt,mr,mb),QPageLayout::Millimeter);
-       prn.setDuplex(QPrinter::DuplexMode(set.value("duplex",QPrinter::DuplexAuto).toInt()));
-       prn.setOrientation((set.value("orientation","portrait").toString()=="portrait")?QPrinter::Portrait:QPrinter::Landscape);
-        if(set.contains("resolution"))
-                prn.setResolution(set.value("resolution").toInt());
-        if(set.contains("papersource"))
-                prn.setPaperSource(QPrinter::PaperSource(set.value("papersource").toInt()));
-        dumpPrn(prn,"after setting printer object");
-       return true;
+    QPageSize::PageSizeId pgsz=QPageSize::PageSizeId(set.value("paper",QPageSize::Custom).toInt());
+    auto pglayout=prn.pageLayout();
+    pglayout.setPageSize(QPageSize(pgsz));
+    prn.setPageLayout(pglayout);
+    if(pgsz==QPageSize::Custom)
+        prn.setPageSize(QPageSize(set.value("papersizemm").toSizeF(),QPageSize::Millimeter));
+    qreal ml,mr,mt,mb;
+    ml=set.value("marginLeft").toDouble();
+    mr=set.value("marginRight").toDouble();
+    mb=set.value("marginBottom").toDouble();
+    mt=set.value("marginTop").toDouble();
+    prn.setFullPage(set.value("fullPage",true).toBool());
+    prn.setPageMargins(QMarginsF(ml,mt,mr,mb),QPageLayout::Millimeter);
+    prn.setDuplex(QPrinter::DuplexMode(set.value("duplex",QPrinter::DuplexAuto).toInt()));
+    prn.setPageOrientation((set.value("orientation","portrait").toString()=="portrait")?QPageLayout::Portrait:QPageLayout::Landscape);
+    if(set.contains("resolution"))
+        prn.setResolution(set.value("resolution").toInt());
+    if(set.contains("papersource"))
+        prn.setPaperSource(QPrinter::PaperSource(set.value("papersource").toInt()));
+    dumpPrn(prn,"after setting printer object");
+    return true;
 }
 
 void MLabelConfig::storePrinter(QPrinter& prn)
 {
-       QSettings set;
-       set.beginGroup(cgroup());
-       set.setValue("name",prn.printerName());
+    QSettings set;
+    set.beginGroup(cgroup());
+    set.setValue("name",prn.printerName());
 #if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)
-       set.setValue("soption",prn.printerSelectionOption());
+    set.setValue("soption",prn.printerSelectionOption());
 #endif
-       //qreal ml,mr,mt,mb;
-       //prn.getPageMargins(&ml,&mr,&mb,&mt,QPrinter::Millimeter);
-       QMarginsF marg=prn.pageLayout().margins(QPageLayout::Millimeter);
-       set.setValue("marginLeft",marg.left());
-       set.setValue("marginRight",marg.right());
-       set.setValue("marginBottom",marg.bottom());
-       set.setValue("marginTop",marg.top());
-       set.setValue("fullPage",prn.fullPage());
-       set.setValue("duplex",(int)prn.duplex());
-       set.setValue("orientation",prn.orientation()==QPrinter::Portrait?"portrait":"landscape");
-       set.setValue("paper",(int)prn.paperSize());
+    //qreal ml,mr,mt,mb;
+    //prn.getPageMargins(&ml,&mr,&mb,&mt,QPrinter::Millimeter);
+    QMarginsF marg=prn.pageLayout().margins(QPageLayout::Millimeter);
+    set.setValue("marginLeft",marg.left());
+    set.setValue("marginRight",marg.right());
+    set.setValue("marginBottom",marg.bottom());
+    set.setValue("marginTop",marg.top());
+    set.setValue("fullPage",prn.fullPage());
+    set.setValue("duplex",(int)prn.duplex());
+    set.setValue("orientation",prn.pageLayout().orientation()==QPageLayout::Portrait?"portrait":"landscape");
+    set.setValue("paper",(int)prn.paperSize());
 //         set.setValue("papersize",prn.paperSize(QPrinter::Point));
-        set.setValue("papersizemm",prn.pageSizeMM());
-       set.setValue("resolution",prn.resolution());
-        set.setValue("papersource",prn.paperSource());
-        set.setValue("settings",QVariant::fromValue(*this));
-        qDebug()<<"storing printer settings"<<cgroup()<<prn.printerName()<<prn.paperSize();
+    set.setValue("papersizemm",prn.pageSizeMM());
+    set.setValue("resolution",prn.resolution());
+    set.setValue("papersource",prn.paperSource());
+    set.setValue("settings",QVariant::fromValue(*this));
+    qDebug()<<"storing printer settings"<<cgroup()<<prn.printerName()<<prn.paperSize();
 }
 
 
 MLabelConfig::PageAskMode MLabelConfig::pageAskMode() const
 {
-       QSettings set;
-       set.beginGroup(cgroup());
-       return PageAskMode(set.value("pageAskMode",PageAskIfNeeded).toInt());
+    QSettings set;
+    set.beginGroup(cgroup());
+    return PageAskMode(set.value("pageAskMode",PageAskIfNeeded).toInt());
 }
 
 MLabelConfig::PrintAskMode MLabelConfig::printAskMode() const
 {
-       QSettings set;
-       set.beginGroup(cgroup());
-       return PrintAskMode(set.value("printAskMode",PrintAskIfUnknown).toInt());
+    QSettings set;
+    set.beginGroup(cgroup());
+    return PrintAskMode(set.value("printAskMode",PrintAskIfUnknown).toInt());
 }
 
 void MLabelConfig::storeAskModes(MLabelConfig::PrintAskMode prm, MLabelConfig::PageAskMode pgm)
 {
-       QSettings set;
-       set.beginGroup(cgroup());
-       set.setValue("printAskMode",(int)prm);
-       set.setValue("pageAskMode",(int)pgm);
+    QSettings set;
+    set.beginGroup(cgroup());
+    set.setValue("printAskMode",(int)prm);
+    set.setValue("pageAskMode",(int)pgm);
 }
 
 MLabelConfig::PrintMode MLabelConfig::printMode() const
 {
-       QSettings set;
-       set.beginGroup(cgroup());
-       return PrintMode(set.value("printBufMode",PrintDirect).toInt());
+    QSettings set;
+    set.beginGroup(cgroup());
+    return PrintMode(set.value("printBufMode",PrintDirect).toInt());
 }
 
 void MLabelConfig::storePrintMode ( MLabelConfig::PrintMode pm )
 {
-       QSettings set;
-       set.beginGroup(cgroup());
-       set.setValue("printBufMode",(int)pm);
+    QSettings set;
+    set.beginGroup(cgroup());
+    set.setValue("printBufMode",(int)pm);
 }
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -639,14 +645,14 @@ struct Paper_s {
         int ptype=0;
         QSizeF psize;
         QString pname;
-        
+
         Paper_s()=default;
         Paper_s(int t):ptype(t){}
         Paper_s(const Paper_s&)=default;
         Paper_s(const QString&n,int t,double x,double y):ptype(t),psize(x,y),pname(n){}
-        
+
         Paper_s&operator=(const Paper_s&)=default;
-        
+
         bool operator==(const Paper_s&t)const{return ptype==t.ptype;}
         bool operator==(int t)const{return ptype==t;}
 };
@@ -657,41 +663,41 @@ void MLabelPrintDialog::initPaper()
 {
         if(paperTypes.size())return;
         paperTypes=QList<Paper_s>()
-        << Paper_s(tr("Custom Size","paper type"),QPrinter::Custom,0,0)
-        << Paper_s(tr("A0","paper type"),QPrinter::A0,841,1189)
-        << Paper_s(tr("A1","paper type"),QPrinter::A1,594,841)
-        << Paper_s(tr("A2","paper type"),QPrinter::A2,420,594)
-        << Paper_s(tr("A3","paper type"),QPrinter::A3,297,420)
-        << Paper_s(tr("A4","paper type"),QPrinter::A4,210,297)
-        << Paper_s(tr("A5","paper type"),QPrinter::A5,148,210)
-        << Paper_s(tr("A6","paper type"),QPrinter::A6,105,148)
-        << Paper_s(tr("A7","paper type"),QPrinter::A7,74,105)
-        << Paper_s(tr("A8","paper type"),QPrinter::A8,52,74)
-        << Paper_s(tr("A9","paper type"),QPrinter::A9,37,52)
-        << Paper_s(tr("B0","paper type"),QPrinter::B0,1000,1414)
-        << Paper_s(tr("B1","paper type"),QPrinter::B1,707,1000)
-        << Paper_s(tr("B2","paper type"),QPrinter::B2,500,707)
-        << Paper_s(tr("B3","paper type"),QPrinter::B3,353,500)
-        << Paper_s(tr("B4","paper type"),QPrinter::B4,250,353)
-        << Paper_s(tr("B5","paper type"),QPrinter::B5,176,250)
-        << Paper_s(tr("B6","paper type"),QPrinter::B6,125,176)
-        << Paper_s(tr("B7","paper type"),QPrinter::B7,88,125)
-        << Paper_s(tr("B8","paper type"),QPrinter::B8,62,88)
-        << Paper_s(tr("B9","paper type"),QPrinter::B9,33,62)
-        << Paper_s(tr("B10","paper type"),QPrinter::B10,31,44)
-        << Paper_s(tr("C5E","paper type"),QPrinter::C5E,163,229)
-        << Paper_s(tr("U.S. Common 10 Envelope","paper type"),QPrinter::Comm10E,105,241)
-        << Paper_s(tr("DLE","paper type"),QPrinter::DLE,110,220)
-        << Paper_s(tr("Executive","paper type"),QPrinter::Executive,190.5,254)
-        << Paper_s(tr("Folio","paper type"),QPrinter::Folio,210,330)
-        << Paper_s(tr("Ledger","paper type"),QPrinter::Ledger,431.8,279.4)
-        << Paper_s(tr("Legal","paper type"),QPrinter::Legal,215.9,355.6)
-        << Paper_s(tr("Letter","paper type"),QPrinter::Letter,215.9,279.4)
-        << Paper_s(tr("Tabloid","paper type"),QPrinter::Tabloid,279.4,431.8)
+        << Paper_s(tr("Custom Size","paper type"),QPageSize::Custom,0,0)
+        << Paper_s(tr("A0","paper type"),QPageSize::A0,841,1189)
+        << Paper_s(tr("A1","paper type"),QPageSize::A1,594,841)
+        << Paper_s(tr("A2","paper type"),QPageSize::A2,420,594)
+        << Paper_s(tr("A3","paper type"),QPageSize::A3,297,420)
+        << Paper_s(tr("A4","paper type"),QPageSize::A4,210,297)
+        << Paper_s(tr("A5","paper type"),QPageSize::A5,148,210)
+        << Paper_s(tr("A6","paper type"),QPageSize::A6,105,148)
+        << Paper_s(tr("A7","paper type"),QPageSize::A7,74,105)
+        << Paper_s(tr("A8","paper type"),QPageSize::A8,52,74)
+        << Paper_s(tr("A9","paper type"),QPageSize::A9,37,52)
+        << Paper_s(tr("B0","paper type"),QPageSize::B0,1000,1414)
+        << Paper_s(tr("B1","paper type"),QPageSize::B1,707,1000)
+        << Paper_s(tr("B2","paper type"),QPageSize::B2,500,707)
+        << Paper_s(tr("B3","paper type"),QPageSize::B3,353,500)
+        << Paper_s(tr("B4","paper type"),QPageSize::B4,250,353)
+        << Paper_s(tr("B5","paper type"),QPageSize::B5,176,250)
+        << Paper_s(tr("B6","paper type"),QPageSize::B6,125,176)
+        << Paper_s(tr("B7","paper type"),QPageSize::B7,88,125)
+        << Paper_s(tr("B8","paper type"),QPageSize::B8,62,88)
+        << Paper_s(tr("B9","paper type"),QPageSize::B9,33,62)
+        << Paper_s(tr("B10","paper type"),QPageSize::B10,31,44)
+        << Paper_s(tr("C5E","paper type"),QPageSize::C5E,163,229)
+        << Paper_s(tr("U.S. Common 10 Envelope","paper type"),QPageSize::Comm10E,105,241)
+        << Paper_s(tr("DLE","paper type"),QPageSize::DLE,110,220)
+        << Paper_s(tr("Executive","paper type"),QPageSize::Executive,190.5,254)
+        << Paper_s(tr("Folio","paper type"),QPageSize::Folio,210,330)
+        << Paper_s(tr("Ledger","paper type"),QPageSize::Ledger,431.8,279.4)
+        << Paper_s(tr("Legal","paper type"),QPageSize::Legal,215.9,355.6)
+        << Paper_s(tr("Letter","paper type"),QPageSize::Letter,215.9,279.4)
+        << Paper_s(tr("Tabloid","paper type"),QPageSize::Tabloid,279.4,431.8)
         ;
 }
 
-        
+
 
 MLabelPrintDialog::MLabelPrintDialog(QPrinter* prn, QWidget* parent, Qt::WindowFlags f)
         : QDialog(parent, f)
@@ -701,8 +707,8 @@ MLabelPrintDialog::MLabelPrintDialog(QPrinter* prn, QWidget* parent, Qt::WindowF
         QFormLayout*fl;
         setLayout(fl=new QFormLayout);
         fl->addRow(tr("Printer:"),mprnselect=new QComboBox);
-       mprnselect->setMinimumContentsLength(10);
-       mprnselect->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
+    mprnselect->setMinimumContentsLength(10);
+    mprnselect->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
         int cur=-1,def=-1;
         for(const QPrinterInfo&info:QPrinterInfo::availablePrinters()){
                 if(info.printerName()==prn->printerName())cur=mprnselect->count();
@@ -740,10 +746,10 @@ MLabelPrintDialog::MLabelPrintDialog(QPrinter* prn, QWidget* parent, Qt::WindowF
         QGridLayout*gl;
         fl->addRow(tr("Margins:"),gl=new QGridLayout);
         //qreal ml,mr,mt,mb;
-       QMarginsF marg=mprinter->pageLayout().margins(QPageLayout::Millimeter);
+    QMarginsF marg=mprinter->pageLayout().margins(QPageLayout::Millimeter);
         //mprinter->getPageMargins(&ml,&mt,&mr,&mb,QPrinter::Millimeter);
-       gl->addWidget(mfullpage=new QCheckBox(tr("Use Full Page")),0,0,1,3);
-       mfullpage->setChecked(mprinter->fullPage());
+    gl->addWidget(mfullpage=new QCheckBox(tr("Use Full Page")),0,0,1,3);
+    mfullpage->setChecked(mprinter->fullPage());
         gl->addWidget(mmargtop=new QDoubleSpinBox,1,1);
         mmargtop->setValue(marg.top()/moldunit);
         gl->addWidget(mmargleft=new QDoubleSpinBox,2,0);
@@ -761,10 +767,10 @@ MLabelPrintDialog::MLabelPrintDialog(QPrinter* prn, QWidget* parent, Qt::WindowF
         QPushButton *cc;
         hl->addWidget(cc=new QPushButton(tr("Cancel")));
         connect(cc,SIGNAL(clicked(bool)),this,SLOT(reject()));
-        
+
         //make sure it is selected
         printerChanged(mprnselect->currentIndex());
-        
+
         //reset selected paper type and size from printer
         paperChanged(mpaper->currentIndex());
         //reset margins from printer
@@ -864,10 +870,10 @@ void MLabelPrintDialog::okBtnPressed()
         mprinter->setPaperSize(QPrinter::PaperSize(mpaper->itemData(mpaper->currentIndex()).toInt()));
         mprinter->setPageSizeMM(QSizeF(msizex->value()*moldunit,msizey->value()*moldunit));
         //mprinter->setPageMargins(mmargleft->value()*moldunit, mmargtop->value()*moldunit, mmargright->value()*moldunit, mmargbottom->value()*moldunit, QPrinter::Millimeter);
-       mprinter->setFullPage(mfullpage->isChecked());
+    mprinter->setFullPage(mfullpage->isChecked());
         mprinter->setPageMargins(QMarginsF(mmargleft->value()*moldunit, mmargtop->value()*moldunit, mmargright->value()*moldunit, mmargbottom->value()*moldunit), QPageLayout::Millimeter);
         mprinter->setResolution(mresolution->itemData(mresolution->currentIndex()).toInt());
-        
+
         //close the dialog
         accept();
 }
index 6870b0a..e79febd 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Interface: labeldlg
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2016
@@ -33,7 +33,7 @@ class MAGICSMOKE_COMMON_EXPORT MLabelConfig
        public:
                ///shows the configuration dialog
                static void configDialog(QWidget*parent=0);
-               
+
                ///the type of label whose configuration is being queried
                enum LabelType {
                         ///invalid config object
@@ -51,18 +51,18 @@ class MAGICSMOKE_COMMON_EXPORT MLabelConfig
                MLabelConfig(const MLabelConfig&lc):m_type(lc.m_type){initMeta();}
                ///copies the config object
                MLabelConfig& operator=(const MLabelConfig&lc){m_type=lc.m_type;return *this;}
-               
+
                ///returns the type represented by this config object
                LabelType labelType()const{return m_type;}
-               
+
                ///returns the configured printer name (even if not available on the local system)
                QString printerName()const;
-               
+
                ///configures the QPrinter object to the printer set for this label type;
                ///use selectPrinter if you want to fall back to a selection dialog
                /// \returns true if the printer was successfully configured
                bool configurePrinter(QPrinter&)const;
-               
+
                ///configures the printer for this particular label type;
                ///whether the dialog is shown depends on settings and printer availability;
                ///if the dialog is shown the function remembers the new printer settings
@@ -70,7 +70,7 @@ class MAGICSMOKE_COMMON_EXPORT MLabelConfig
                /// \param force if true: force showing the printer dialog
                /// \returns true if the selection was successful
                bool selectPrinter(QPrinter&printer,bool force=false);
-               
+
                ///whether to ask for a printer when printing labels
                enum PrintAskMode{
                        //do not change the order of these entries!
@@ -93,10 +93,10 @@ class MAGICSMOKE_COMMON_EXPORT MLabelConfig
                        ///never ask, just assume the whole page is available
                        PageAskNever=2,
                };
-               
+
                ///returns the policy for asking for a printer
                PrintAskMode printAskMode()const;
-               
+
                ///returns the policy for asking for page layout
                PageAskMode pageAskMode()const;
 
@@ -112,11 +112,11 @@ class MAGICSMOKE_COMMON_EXPORT MLabelConfig
 
                ///returns how to send data to the printer
                PrintMode printMode()const;
-               
+
        private:
                LabelType m_type;
                static QString tr(const char*,const char*c=0);
-               
+
                /// \internal helper to store printer settings for next time
                void storePrinter(QPrinter&);
                /// \internal helper to store ask modes
@@ -125,10 +125,10 @@ class MAGICSMOKE_COMMON_EXPORT MLabelConfig
                void storePrintMode(PrintMode);
                /// \internal return the config group
                QString cgroup()const;
-                
+
                 /// \internal initialize meta type info
                 void initMeta();
-                
+
                 friend QDataStream&operator<<(QDataStream&,const MLabelConfig&);
                 friend QDataStream&operator>>(QDataStream&,MLabelConfig&);
 };
@@ -146,14 +146,14 @@ class MAGICSMOKE_COMMON_EXPORT MLabelDialog:public QDialog
                MLabelDialog(QWidget*parent,QPrinter*printer,int numlabels,QSizeF labelsize);
                /**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; starts at the bottom left of the page*/
                QPointF labelOffset(int n)const;
                /**returns whether this label is on a new page*/
                bool labelNeedsPageTurn(int n)const;
                ///returns whether there is only one label per page
                bool oneLabelPerPage()const;
-               
+
                ///configures the printer for this particular label type
                ///whether the dialog is shown depends on settings and printer availability
                /// \param type type of label
@@ -162,14 +162,14 @@ class MAGICSMOKE_COMMON_EXPORT MLabelDialog:public QDialog
                /// \returns true if the selection was successful
                static inline bool selectPrinter(MLabelConfig::LabelType type, QPrinter&printer, bool force=false)
                {return MLabelConfig(type).selectPrinter(printer,force);}
-               
+
        public slots:
                ///shows the dialog if necessary - this depends on the local configuration for
                ///this label type
                ///if not shown it returns true (presuming the user would have wanted to print)
                ///if shown it returns true if the user clicked "Ok" and false otherwise
                bool conditionalExec(MLabelConfig::LabelType);
-               
+
        private slots:
                /**internal: toggle Row button clicked*/
                void toggleRow(int);
@@ -177,14 +177,14 @@ class MAGICSMOKE_COMMON_EXPORT MLabelDialog:public QDialog
                void toggleColumn(int);
                /**internal: toggle all button clicked*/
                void toggleAll();
-               
+
                /**internal: display correct page*/
                void updatePage();
                /**helper: save current/old page*/
                void savePage();
                /**internal: save settings for next time*/
                void saveSettings();
-               
+
        private:
                QLineEdit *offx,*offy,*sizex,*sizey;
                QLabel *warning;
@@ -194,7 +194,7 @@ class MAGICSMOKE_COMMON_EXPORT MLabelDialog:public QDialog
                QList<QList<bool> >checked;
                QPrinter* printer;
                int numlabels,oldpage,maxrows,maxcols;
-               
+
                /**internal helper: find coordinates of label n; returns page id; returns -1 on failure*/
                int findLabel(int n,int&row,int&col)const;
 };
@@ -205,14 +205,14 @@ class MAGICSMOKE_COMMON_EXPORT MLabelPrintDialog:public QDialog
 {
         Q_OBJECT
         public:
-                explicit MLabelPrintDialog(QPrinter*,QWidget* parent = 0, Qt::WindowFlags f = 0);
+                explicit MLabelPrintDialog(QPrinter*,QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
         public slots:
                 void setButtonLabel(const QString&);
         private slots:
                 void printerChanged(int);
                 void paperChanged(int);
                 void unitChanged(int);
-                
+
                 void okBtnPressed();
         private:
                 QPrinter*mprinter;
@@ -223,7 +223,7 @@ class MAGICSMOKE_COMMON_EXPORT MLabelPrintDialog:public QDialog
                 QPushButton*mokbtn;
                QCheckBox*mfullpage;
                 double moldunit=1.;
-                
+
                 //internal: initialize paper types
                 void initPaper();
 };
index a92d485..378e92b 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: odtrender
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2011
@@ -37,7 +37,7 @@ class MOdfEngine:public MElamEngine
                MOdfEngine(MOdtRenderer* pa):parent(pa)
                {
                        CharacterClassSettings cs=characterClasses();
-                       cs.setAssignmentChars(0,'=');
+                       cs.setAssignmentChars('\0','=');
                        cs.setOperatorClass(cs.operatorClass().remove(':'));
                        QPair<QString,QString>nc=cs.nameClass();
                        nc.second+=':';
@@ -64,32 +64,32 @@ class MOdtRendererPrivate
 {
        protected:
                friend class MOdtRenderer;
-               
+
                //methods that the parent uses
                MOdtRendererPrivate(QString file,MOdtRenderer*p);
                ~MOdtRendererPrivate();
-               
+
                bool renderToFile(QFile&);
-               
+
                //data the parent uses
                QString extension;
                MOdtRenderer::FileFormat fileformat;
-               
+
        private:
                //methods that the parent does not call
-               
+
                ///overall rendering: copies the templates content, calls render()
                void render(QIODevice*);
-               
+
                ///content.xml rendering
                QList<QDomNode> render(QDomNode node);
-               
+
                ///scan string and replace variable values
                QString renderString(QString);
-               
+
                ///gets a scalar variable
                QString getVariable(QString varname);
-               
+
                //data the parent does not access
                //parent
                MOdtRenderer*parent;
@@ -98,7 +98,7 @@ class MOdtRendererPrivate
                QFile tfile;
                //xml representation of the content.xml file in the template
                QDomDocument cdoc;
-               
+
                //local variables and calculation engine
                Engine *calc;
 };
index 80e9c23..64831fd 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Interface: centbox
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2011
@@ -15,7 +15,7 @@
 
 #include <QAbstractSpinBox>
 #include <QDialog>
-#include <QRegExpValidator>
+#include <QRegularExpressionValidator>
 
 #include "commonexport.h"
 
@@ -24,15 +24,15 @@ class MAGICSMOKE_COMMON_EXPORT MCentSpinBox:public QAbstractSpinBox
        Q_OBJECT
        public:
                MCentSpinBox(QWidget*parent=0,int value=0,int maxValue=2147483647);
-               
+
                virtual int value()const;
                virtual void setValue(int);
-               
+
                virtual void setRange(int,int);
-               
+
                virtual int minimumValue()const;
                virtual int maximumValue()const;
-               
+
                void stepBy(int);
        protected:
                virtual QValidator::State validate(QString &input, int &pos) const;
@@ -43,7 +43,7 @@ class MAGICSMOKE_COMMON_EXPORT MCentSpinBox:public QAbstractSpinBox
                void fixup();
        private:
                int mval,mmax,mmin;
-               QRegExpValidator mvalid;
+        QRegularExpressionValidator mvalid;
 };
 
 class MAGICSMOKE_COMMON_EXPORT MCentDialog:public QDialog
@@ -51,9 +51,9 @@ class MAGICSMOKE_COMMON_EXPORT MCentDialog:public QDialog
        Q_OBJECT
        public:
                MCentDialog(QWidget*parent=0,QString title=QString(),QString label=QString(),int value=0,int maxValue=2147483647);
-               
+
                virtual int value()const;
-               
+
                static int getCents(QWidget*parent=0,QString title=QString(),QString label=QString(),int value=0,int maxValue=2147483647,bool *ok=0);
        private:
                MCentSpinBox*box;
index 6b1b301..3150159 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: seatplan viewer
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2017
@@ -53,7 +53,7 @@ static inline QVector<QColor> getColors(const MOSeatPlan&plan,const MOSeatPlanGr
 void MSeatPlanView::resetPlan(const MOSeatPlan&p)
 {
         mplan=p;
-        
+
         //parse plan for seats
         mrows.clear();
         const QRect mr=QRect(QPoint(0,0),mplan.qSize());
@@ -112,7 +112,7 @@ void MSeatPlanView::resetPlan(const MOSeatPlan&p)
                                 qDebug()<<"WARNING: row"<<row.id().data()<<"is empty, ignoring it.";
                 }
         }
-        
+
         //repaint
         resizeEvent(nullptr);
         update();
@@ -130,7 +130,7 @@ static inline BgType bgType(const QString s)
         if(s=="text")return BgType::Text;
         if(s=="circle")return BgType::Circle;
         if(s=="image")return BgType::Image;
-        
+
         return BgType::Unknown;
 }
 
@@ -159,12 +159,12 @@ void MSeatPlanView::paintEvent(QPaintEvent*e)
 {
         QWidget::paintEvent(e);
         if(!mplan.isGraphical())return;
-        
+
         // painter and background color
         QPainter p(this);
         p.setClipRect(mclip);
         p.fillRect(mclip,QColor(mplan.bgcolor()));
-        
+
         // first paint background
         for(auto bg:mplan.Background()){
                 QRect geo=toGeo(bg.geo(),mscale,mclip);
@@ -196,7 +196,7 @@ void MSeatPlanView::paintEvent(QPaintEvent*e)
                                 break;
                 }
         }
-        
+
         // paint groups -> rows -> seats
         p.setPen(QColor(Qt::blue));
         p.setBrush(QColor(Qt::yellow));
@@ -305,3 +305,8 @@ QList<MSeatPlanView::SelectedSeat> MSeatPlanView::selection()const
                                 result<<SelectedSeat(row.gid,row.gname,row.id,row.name,seat.id);
         return result;
 }
+
+void MSeatPlanView::checkSelection(MSeatPlanView::SelectedSeat)
+{
+    //TODO
+}
index a595d9d..7c579c8 100644 (file)
@@ -3,6 +3,9 @@ TARGET = magicsmoke-iface
 VERSION =
 QT-=gui
 
+#FIXME:
+equals(QT_MAJOR_VERSION, 6): QT += core5compat
+
 #make sure exports are ok
 DEFINES += MSIFACE_EXPORT=Q_DECL_EXPORT
 
index a9de63c..9506510 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: misc
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2011
@@ -63,9 +63,9 @@ QByteArray xmlize(QByteArray str,QString newline)
                if(c=='<')out+="&lt;";else
                if(c=='>')out+="&gt;";else
                if(c=='&')out+="&amp;";else
-               if(c=='\n')out+=newline;else
+               if(c=='\n')out+=newline.toUtf8();else
                if(QChar(c).isSpace()||(c>=32 && static_cast<unsigned char>(c)<=0x7f))out+=c;
-               else out+="&#"+QString::number((unsigned char)c)+";";
+               else out+="&#"+QByteArray::number((unsigned char)c)+";";
        }
        return out;
 }
@@ -84,7 +84,7 @@ qint64 str2cent(QString s,bool localize)
        return mf.scanMoney(s);
 }
 
-QRegExp priceRegExp(bool localize)
+QRegularExpression priceRegExp(bool localize)
 {
        MLocalFormat mf;
        if(!localize)mf.setNonLocalized();
@@ -129,7 +129,7 @@ class MLocalFormat::Private:public SharedDPtr
 };
 DEFINE_SHARED_DPTR(MLocalFormat);
 
-//static 
+//static
 MLocalFormat MLocalFormat::defaultformat((int)1);
 
 MLocalFormat::MLocalFormat(int)
@@ -321,10 +321,10 @@ void MLocalFormat::setNumberFormat(QChar dec,QChar thou,int dig)
 
        if(dec.isNull())d->m_decimal=QCoreApplication::translate("MLocalFormat",".","decimal dot")[0];
        else d->m_decimal=dec;
-       
+
        if(thou.isNull())d->m_thousand=QCoreApplication::translate("MLocalFormat",",","thousand division character")[0];
        else d->m_thousand=thou;
-       
+
        if(dig<0)d->m_thousanddigits=QCoreApplication::translate("MLocalFormat","0","digits between thousand division chars, <=0 means none").toInt();
        else d->m_thousanddigits=dig;
 }
@@ -477,7 +477,7 @@ QString MLocalFormat::formatDateTime(const TimeStamp& ts, QString format) const
                                // % sign
                                case '%':out+="%";break;
                                //mistakes
-                               default:out+="%"+format[i];break;
+                               default:out+=QString("%")+format[i];break;
                        }
                        inp=false;
                }else{
@@ -685,13 +685,13 @@ double MLocalFormat::scanFloat(QString num)const
        return r;
 }
 
-QRegExp MLocalFormat::moneyRegExp(bool allownegative,bool allowcurrency)const
+QRegularExpression MLocalFormat::moneyRegExp(bool allownegative,bool allowcurrency)const
 {
        //main unit
-       QString r="[\\d"+QRegExp::escape(d->m_thousand)+"]+";
+       QString r="[\\d"+QRegularExpression::escape(d->m_thousand)+"]+";
        //fractions
        if(d->m_moneydecimals>0){
-               r+=QRegExp::escape(d->m_decimal);
+               r+=QRegularExpression::escape(d->m_decimal);
                r+="\\d{"+QString::number(d->m_moneydecimals)+"}";
        }
        //negative
@@ -700,18 +700,18 @@ QRegExp MLocalFormat::moneyRegExp(bool allownegative,bool allowcurrency)const
                QString f="[-";
                if(d->m_moneyneg.size()>0)
                        if(d->m_moneyneg[0]!='\n' && d->m_moneyneg[0]!='-')
-                               f+=QRegExp::escape(d->m_moneyneg[0]);
+                               f+=QRegularExpression::escape(d->m_moneyneg[0]);
                f+="]?";
                r=f+r;
                //back
                if(d->m_moneyneg.size()>1)
-                       r+=QRegExp::escape(d->m_moneyneg[1])+"?";
+                       r+=QRegularExpression::escape(d->m_moneyneg[1])+"?";
        }
        //currency
        if(allowcurrency && d->m_currency!="")
-               r+="("+QRegExp::escape(d->m_currency)+")?";
+               r+="("+QRegularExpression::escape(d->m_currency)+")?";
        //return
-       return QRegExp(r);
+       return QRegularExpression(r);
 }
 
 void MLocalFormat::setTimeZone(QString olsonname)
index ef0d06d..b4f453d 100644 (file)
@@ -16,7 +16,7 @@
 #include <QDateTime>
 #include <QString>
 #include <QStringList>
-#include <QRegExp>
+#include <QRegularExpression>
 
 class TimeStamp;
 #include <MOServerFormat>
@@ -50,7 +50,7 @@ QString MSIFACE_EXPORT unix2time(qint64,bool localize=true);
 QString MSIFACE_EXPORT unix2dateTime(qint64,bool localize=true);
 
 /**return a (localized) regular expression that validates prices*/
-QRegExp MSIFACE_EXPORT priceRegExp(bool localize=true);
+QRegularExpression MSIFACE_EXPORT priceRegExp(bool localize=true);
 
 ///returns the current directory (the one last used in a file dialog)
 QString MSIFACE_EXPORT currentDir();
@@ -111,23 +111,23 @@ class MSIFACE_EXPORT MLocalFormat
                MLocalFormat(const MOServerFormat&);
                /**deletes the formatter object*/
                virtual ~MLocalFormat();
-               
+
                /**sets a new default format*/
                static void setDefaultFormat(const MLocalFormat&);
-               
+
                /**copies a formatter object*/
                virtual MLocalFormat& operator=(const MLocalFormat&)=default;
-               
+
                /**overrides the full names of week days, an empty list resets to the local translation, otherwise the list must be exactly seven entries long and starts with Sunday*/
                virtual void setWeekDays(const QStringList&l=QStringList());
                /**overrides the short week day names, an empty list resets to the local translation, otherwise the list must be exactly seven entries long and starts with Sunday (Sun)*/
                virtual void setShortWeekDays(const QStringList&l=QStringList());
-               
+
                /**overrides the full names of months, an empty list resets to the local translation, otherwise the list must be exactly seven entries long and starts with January*/
                virtual void setMonths(const QStringList&l=QStringList());
                /**overrides the short names of months, an empty list resets to the local translation, otherwise the list must be exactly seven entries long and starts with January (Jan)*/
                virtual void setShortMonths(const QStringList&l=QStringList());
-               
+
                /**overrides the formatting of money - the settings of numbers are re-used
                \param digitsCents defines how many digits are used for sub-amounts (cents), if zero no cents are used, normal are the values 0, 2 and 3; the default is 2
                \param currency defines the symbol of the currency used, the default is an empty string
@@ -141,29 +141,29 @@ class MSIFACE_EXPORT MLocalFormat
                \param positivePos defines where the positive sign is printed
                */
                virtual void setMoneySign(QString negative="-",QString positive=QString(), MOServerFormat::MoneyPos negativePos=MOServerFormat::SignBeforeNum, MOServerFormat::MoneyPos positivePos=MOServerFormat::NoSign);
-               
+
                /**overrides the formatting of numbers and money;
                \param decimal defines the character used to separate decimals from the main body, if QChar() is used it returns to the translation default (a dot "." in default localization)
                \param thousandDiv defines the character used to separate blocks of digits, if QChar() is used it returns to the translation default (comma "," in default)
                \param digitsDiv defines the amount of digits in a block, eg. the value 3 will format 1000 as 1,000 (none per default)*/
                virtual void setNumberFormat(QChar decimal=QChar(),QChar thousandDiv=QChar(),int digitsDiv=-1);
-               
+
                /**overrides the formatting of the AM/PM part of time display, resets to the localization if none given*/
                virtual void setAP(QString am="--",QString pm="--");
-               
+
                /**overrides the local time zone
                \param olsonname the name of the local timezone in Olson notation, eg. "Europe/Berlin"*/
                virtual void setTimeZone(QString olsonname);
-               
+
                /**overrides the default formatting of date and time, if empty the translation default is used*/
                virtual void setDateTimeFormat(QString dateformat=QString(),QString timeformat=QString(),QString datetimeformat=QString());
-               
+
                /**returns the currently set time zone of this formatter*/
                virtual QString timeZone()const;
-               
+
                /**overrides the formatting to be non-localized, numbers use decimal dot and no thousand separator, no currency symbol and "-" as negative sign; otherwise things stay the same; this is a helper for the shortcut methods like cent2str*/
                virtual void setNonLocalized();
-               
+
                /**formats a date according to the given format, if none is given, the translation default is used
                \param date a QDate used as input, it is assumed to be local
                \param format a format string */
@@ -176,7 +176,7 @@ class MSIFACE_EXPORT MLocalFormat
                \param date a timestamp, it is converted to the local time of this local format object
                \param format a format string */
                virtual QString formatDate(const TimeStamp& date,QString format=QString())const;
-               
+
                /**formats a time according to the given format, if none is given, the translation default is used
                \param time a QTime used as input, it is assumed to be local
                \param format a format string */
@@ -189,7 +189,7 @@ class MSIFACE_EXPORT MLocalFormat
                \param time a timestamp, it is converted to the local time of this local format object
                \param format a format string */
                virtual QString formatTime(const TimeStamp& time,QString format=QString())const;
-               
+
                /**formats a date and time according to the given format, if none is given, the translation default is used
                \param time a QDateTime used as input, it is assumed to be local
                \param format a format string as specified by QDateTime::toString */
@@ -202,29 +202,29 @@ class MSIFACE_EXPORT MLocalFormat
                \param time a TimeStamp used as input, it is converted to the local time of this local format object
                \param format a format string as specified by QDateTime::toString */
                virtual QString formatDateTime(const TimeStamp&time,QString format=QString())const;
-               
-               
+
+
                /**formats an integer number*/
                virtual QString formatNumber(qint64)const;
                /**formats an integer number*/
                virtual QString formatNumber(int n)const{return formatNumber(qint64(n));}
                /**formats an integer number*/
                virtual QString formatNumber(uint n)const{return formatNumber(qint64(n));}
-               
+
                /**formats a floating point number, this version does not use exponential display, but adheres to the settings of local decimal dot and thousands block division
                \param num the number to be formatted
                \param decimals the maximum number of digits after the decimal dot*/
                virtual QString formatNumber(double num,uint decimals=4)const;
-               
+
                enum MoneyFlag {
                        PlainMoneyFormat=0,
                        UseThousand=1,
                        ShowCurrencySymbol=2,
-                       
+
                        DefaultFormat=UseThousand|ShowCurrencySymbol
                };
                Q_DECLARE_FLAGS(MoneyFlags,MoneyFlag);
-               
+
                /**formats a money value
                \param num the amount in cents
                \param flags determines how the string will be formatted */
@@ -233,62 +233,62 @@ class MSIFACE_EXPORT MLocalFormat
                \param num the amount in cents
                \param usethousand if true the thousand block division is inserted */
                virtual QString formatMoney(qint64 num,bool usethousand)const;
-               
+
                /**scans an integer number and returns the value, non-numerical chars are ignored*/
                virtual qint64 scanInt(QString)const;
-               
+
                /**scans a money value and returns it in cents, non-numerical chars are ignored*/
                virtual qint64 scanMoney(QString)const;
-               
+
                /**scans a floating point number and returns it, non-numerical chars are ignored*/
                virtual double scanFloat(QString)const;
-               
+
                /**returns the names used for week days*/
                QStringList weekDayNames()const;
                /**returns the abbreviations used for week days*/
                QStringList shortWeekDayNames()const;
-               
+
                /**returns the names used for months*/
                QStringList monthNames()const;
                /**returns the names used for months*/
                QStringList shortMonthNames()const;
-               
+
                /**returns the currency symbol*/
                QString currency()const;
-               
+
                /**returns the decimal dot symbol*/
                QChar decimalDot()const;
-               
+
                /**returns the thousand separator if used, otherwise an empty string*/
                QString thousandSeparator()const;
-               
+
                /**returns the amount of digits between thousand separators*/
                int thousandDigits()const;
-               
+
                /**returns the amount of decimals in a money value*/
                int moneyDecimals()const;
-               
+
                /**returns the text for AM in 12-hour clock format*/
                QString amText()const;
                /**returns the text for PM in 12-hour clock format*/
                QString pmText()const;
-               
+
                /**returns the negative sign for money values*/
                QString moneyNegativeSign()const;
                /**returns the positive sign for money values*/
                QString moneyPositiveSign()const;
-               
+
                /**returns a regular expression matching money values
                \param allownegative if given the resulting RegExp allows to use negative values
                \param allowcurrency if given the resulting RegExp allows to use the currency symbol */
-               QRegExp moneyRegExp(bool allownegative=false,bool allowcurrency=false)const;
-               
+               QRegularExpression moneyRegExp(bool allownegative=false,bool allowcurrency=false)const;
+
                /**returns the default format for dates*/
                QString dateFormat()const;
-               
+
                /**returns the default format for times*/
                QString timeFormat()const;
-               
+
                /**returns the default format for date/time*/
                QString dateTimeFormat()const;
        protected:
index d3da893..f7a0e7e 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: msinterface
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2009-2011
@@ -46,7 +46,7 @@ static QString dataDir;
 QString MSInterface::resolveDir(const QString &dirspec)
 {
         //resolve pattern
-        const QStringList dirspecl=dirspec.split('/',QString::KeepEmptyParts);
+        const QStringList dirspecl=dirspec.split('/',Qt::KeepEmptyParts);
         bool notfirst=false;
         QString rdir;
         for(QString dcom:dirspecl){
@@ -112,7 +112,7 @@ bool MSInterface::login(QString username,QString passwd)
        }
        if(lg.stage()!=lg.Success)return false;
        //schedule re-login before session times out
-       int msecs=QDateTime::currentDateTime().msecsTo(QDateTime::fromTime_t(lg.getvalidtill()));
+       int msecs=QDateTime::currentDateTime().msecsTo(QDateTime::fromSecsSinceEpoch(lg.getvalidtill()));
        msecs-=120000;//do it 2 min before session runs out
        if(msecs>100000)//but only if it does not become annoying...
                QTimer::singleShot(msecs,this,SIGNAL(needRelogin()));
index aa6222c..bb487bd 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: templates
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2011
@@ -129,9 +129,9 @@ void MTemplateStore::updateTemplates(bool force)
        //make sure directory exists
        QDir(req->dataDir()).mkpath("templates");
        //do we need an update yet?
-       QDateTime last=QDateTime::fromTime_t(set.value("lastupdate",0).toInt()+300);
+       QDateTime last=QDateTime::fromSecsSinceEpoch(set.value("lastupdate",0).toInt()+300);
        if(last>=QDateTime::currentDateTime() && !force)return;
-       
+
        //get local info
        QStringList files=set.childGroups();
        QMap<QString,MOTemplateInfo> fmap;
@@ -142,25 +142,25 @@ void MTemplateStore::updateTemplates(bool force)
                t.setflags(set.value(files[i]+"/flags").toString());
                fmap.insert(files[i],t);
        }
-       
+
        //display progress dialog
        MProgressWrapper *progress=MProgressWrapper::create(QCoreApplication::translate("MTemplateStore","Retrieving templates from server."));
         progress->setRange(0,1);
        progress->setValue(0);
         QObject progparent;progress->setParent(&progparent);
-       
+
        //get remote info, assume it is still valid if unable to retrieve it
        MTGetTemplateList gtl=req->queryGetTemplateList();
        if(gtl.hasError())return;
        //remember update time
-       set.setValue("lastupdate",QDateTime::currentDateTime().toTime_t());
+       set.setValue("lastupdate",QDateTime::currentDateTime().toSecsSinceEpoch());
        //scan and create new list
        QList<MOTemplateInfo>nf=gtl.gettemplates();
        QMap<QString,MOTemplateInfo>nfmap;
        for(int i=0;i<nf.size();i++){
                nfmap.insert(nf[i].filename(),nf[i]);
        }
-       
+
        //check old list for removed or changed entries; remove them
        for(int i=0;i<files.size();i++){
                if(!nfmap.contains(files[i]))
@@ -170,7 +170,7 @@ void MTemplateStore::updateTemplates(bool force)
                        fmap.remove(files[i]);
        }
        files=fmap.keys();
-       
+
        //retrieve new files from server
        QStringList nfiles=nfmap.keys();
        progress->setRange(0,nfiles.size());
@@ -187,14 +187,14 @@ void MTemplateStore::updateTemplates(bool force)
                }
        }
        files=fmap.keys();
-       
+
        //clean up directory
        QDir dir(dname);
        QStringList dfiles=dir.entryList(QDir::Files);
        for(int i=0;i<dfiles.size();i++)
                if(!files.contains(dfiles[i]))
                        dir.remove(dfiles[i]);
-       
+
        //settings: prune old stuff
        set.remove("");
        //settings: create new entries
@@ -398,7 +398,7 @@ QString MTemplate::description()const{return m_descr;}
 
 
 static QStringList tempBaseNames;
-//static 
+//static
 QStringList MTemplate::legalBaseNames()
 {
        if(tempBaseNames.size()==0){
@@ -407,7 +407,7 @@ QStringList MTemplate::legalBaseNames()
        return tempBaseNames;
 }
 
-//static 
+//static
 MTemplate::Types MTemplate::legalTypes(QString bn)
 {
        if(bn=="ticket" || bn=="voucher")
index 203bfdf..4dd3a55 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: event
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
@@ -37,7 +37,7 @@ MOEvent::MOEvent(qint64 i)
                operator=(ge.getevent().value());
 }
 
-QRegExp MOEvent::priceRegExp()const
+QRegularExpression MOEvent::priceRegExp()const
 {
        return ::priceRegExp();
 }
@@ -80,6 +80,6 @@ QList< MOEventPrice > MOEvent::priceFiltered() const
                        ret<<p;
        }
        //sort by priority
-       qSort(ret.begin(),ret.end(),[](const MOEventPrice&a,const MOEventPrice&b){return a.prio()<b.prio();});
+       std::sort(ret.begin(),ret.end(),[](const MOEventPrice&a,const MOEventPrice&b){return a.prio()<b.prio();});
        return ret;
 }
index 29018e9..00a147c 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Interface: event
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
@@ -15,6 +15,7 @@
 
 #include <QString>
 #include <MOEventAbstract>
+#include <QRegularExpression>
 
 #ifndef MSIFACE_EXPORT
 #define MSIFACE_EXPORT Q_DECL_IMPORT
@@ -31,31 +32,31 @@ class MSIFACE_EXPORT MOEvent:public MOEventAbstract
        Q_PROPERTY(QString startDateString READ startDateString)
        Q_PROPERTY(QString endTimeString READ endTimeString)
        Q_PROPERTY(QString priceString READ priceString)
-       Q_PROPERTY(QRegExp priceRegExp READ priceRegExp)
+       Q_PROPERTY(QRegularExpression priceRegExp READ priceRegExp)
        Q_PROPERTY(bool isValid READ isValid)
        Q_PROPERTY(QList<MOEventPrice> priceFiltered READ priceFiltered)
        public:
                /**get event directly from server*/
                MOEvent(qint64);
-               
+
                /**alias for id()*/
                inline Nullable<qint64> eventid()const{return id();}
-               
+
                /**returns the start time of the event as localized string*/
                QString startTimeString()const;
                /**returns the start date as localized string*/
                QString startDateString()const;
                /**returns the end time of the event as localized string*/
                QString endTimeString()const;
-               
+
                /**returns the price as a localized string*/
                QString priceString()const;
                /**returns the local regular expression for prices*/
-               QRegExp priceRegExp()const;
-               
+               QRegularExpression priceRegExp()const;
+
                /**returns whether the event is valid. an event can be invalid if it is uninitialized (negative ID) or the server request failed*/
                bool isValid()const{return !eventid().isNull() && eventid().value()>0;}
-               
+
                ///returns only the prices that this user can order for
                QList<MOEventPrice> priceFiltered()const;
 };
index b318a94..5e3b66f 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: MOOrder
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2009-2011
@@ -41,7 +41,7 @@ static bool mocv=
 static inline
 QList<MOEventPrice> getcategories(const MOEventSaleInfo&ei,QString spec)
 {
-       const QStringList specl=spec.split(' ',QString::SkipEmptyParts);
+       const QStringList specl=spec.split(' ',Qt::SkipEmptyParts);
        QList<MOEventPrice>prc;
        QList<int>ids;
        QStringList abbrs;
@@ -91,7 +91,7 @@ static inline
 QRect str2rect(QString s)
 {
        QList<int>il;
-       for(QString c:s.split(' ',QString::SkipEmptyParts))
+       for(QString c:s.split(' ',Qt::SkipEmptyParts))
                il<<c.toInt();
        if(il.size()!=4)return QRect();
        return QRect(il[0],il[1],il[2],il[3]);
diff --git a/pack b/pack
index 6ebf94b..5844823 160000 (submodule)
--- a/pack
+++ b/pack
@@ -1 +1 @@
-Subproject commit 6ebf94b64abaadbf653c6ddebc185ce3578d0a91
+Subproject commit 5844823b040e63bdb13a753a2c65a4ce196c9e5a
index 26e08e4..05d7778 100644 (file)
@@ -1,7 +1,7 @@
 //
 // C++ Implementation: overview
 //
-// Description: 
+// Description:
 //
 //
 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
@@ -53,12 +53,12 @@ MCartTab::MCartTab(QString pk)
 {
        profilekey=pk;
        deliveryaddrid=invoiceaddrid=-1;
-       
+
        QVBoxLayout*vl;QHBoxLayout*hl;
        QPushButton*p;
        QLabel*lab;
        QFrame*frm;
-       
+
        //Shopping Cart Tab
        setLayout(vl=new QVBoxLayout);
        vl->addLayout(hl=new QHBoxLayout);
@@ -104,7 +104,7 @@ MCartTab::MCartTab(QString pk)
        connect(vouchers,SIGNAL(linkActivated(const QString&)),this,SLOT(changeVoucher(QString)));
        fl->addRow(tr("Remaining Sum:"),priceremain=new QLabel("0.0"));
        //hl2->addStretch(1);
-       
+
        hl->addWidget(frm=new QFrame,0);
        frm->setFrameShape(QFrame::VLine);
        hl->addLayout(vl2=new QVBoxLayout,1);
@@ -152,7 +152,7 @@ MCartTab::MCartTab(QString pk)
        connect(p,SIGNAL(clicked()),this,SLOT(cartReserve()));
        hl->addWidget(p=new QPushButton(tr("Clear")));
        connect(p,SIGNAL(clicked()),this,SLOT(initCart()));
-       
+
        //fill tables
        if(!req->hasRight(req->RCreateOrder)&&!req->hasRight(req->RCreateReservation)){
                setEnabled(false);
@@ -429,7 +429,7 @@ void MCartTab::cartAddVoucher()
        QHBoxLayout*hl;
        QGridLayout*gl;
        QStandardItemModel mdl;
-       QRegExpValidator regv(priceRegExp(),this);
+       QRegularExpressionValidator regv(priceRegExp(),this);
        QList<qint64>prc=MTGetValidVoucherPrices::query().getprices();
        mdl.insertRows(0,prc.size());
        mdl.insertColumns(0,1);
@@ -1020,7 +1020,7 @@ QWidget *MCartTableDelegate::createEditor(QWidget *parent,
 {
        //base class
        if(index.column()!=0)return 0;
-       
+
        QSpinBox *editor = new QSpinBox(parent);
        editor->setRange(1,1000);
        editor->installEventFilter(const_cast<MCartTableDelegate*>(this));
diff --git a/taurus b/taurus
index 12f3c87..6de1146 160000 (submodule)
--- a/taurus
+++ b/taurus
@@ -1 +1 @@
-Subproject commit 12f3c8701cfc7a78be3f2ee2df46e7a11df3c00e
+Subproject commit 6de114674cc91776552ebf2e38b09e82628409cf