move more stuff to commonlib and make session manager more powerful
authorKonrad Rosenbaum <konrad@silmor.de>
Sat, 9 Jul 2016 22:55:55 +0000 (00:55 +0200)
committerKonrad Rosenbaum <konrad@silmor.de>
Sat, 9 Jul 2016 22:55:55 +0000 (00:55 +0200)
63 files changed:
Makefile
commonlib/commonexport.h [new file with mode: 0644]
commonlib/commonlib.pri [new file with mode: 0644]
commonlib/commonlib.pro [new file with mode: 0644]
commonlib/configdialog.cpp [moved from src/dialogs/configdialog.cpp with 99% similarity]
commonlib/configdialog.h [moved from src/dialogs/configdialog.h with 92% similarity]
commonlib/crypto/crypto.pri [moved from src/crypto/crypto.pri with 100% similarity]
commonlib/crypto/hmac.cpp [moved from src/crypto/hmac.cpp with 100% similarity]
commonlib/crypto/hmac.h [moved from src/crypto/hmac.h with 96% similarity]
commonlib/crypto/keygen.cpp [moved from src/crypto/keygen.cpp with 100% similarity]
commonlib/crypto/keygen.h [moved from src/crypto/keygen.h with 79% similarity]
commonlib/mapplication.cpp [new file with mode: 0644]
commonlib/mapplication.h [new file with mode: 0644]
commonlib/misc/barcode-plugin.cpp [moved from src/misc/barcode-plugin.cpp with 100% similarity]
commonlib/misc/barcode-plugin.h [moved from src/misc/barcode-plugin.h with 91% similarity]
commonlib/misc/code39.cpp [moved from src/misc/code39.cpp with 100% similarity]
commonlib/misc/code39.h [moved from src/misc/code39.h with 88% similarity]
commonlib/misc/debug.cpp [moved from src/misc/debug.cpp with 95% similarity]
commonlib/misc/debug.h [moved from src/misc/debug.h with 74% similarity]
commonlib/misc/domiterator.h [moved from src/misc/domiterator.h with 94% similarity]
commonlib/misc/dommodel.cpp [moved from src/misc/dommodel.cpp with 100% similarity]
commonlib/misc/dommodel.h [moved from src/misc/dommodel.h with 98% similarity]
commonlib/misc/misc.pri [moved from src/misc/misc.pri with 100% similarity]
commonlib/misc/sclock.cpp [moved from src/misc/sclock.cpp with 100% similarity]
commonlib/misc/sclock.h [moved from src/misc/sclock.h with 87% similarity]
commonlib/misc/waitcursor.cpp [moved from src/misc/waitcursor.cpp with 100% similarity]
commonlib/misc/waitcursor.h [moved from src/misc/waitcursor.h with 87% similarity]
commonlib/templates/labeldlg.cpp [moved from src/templates/labeldlg.cpp with 100% similarity]
commonlib/templates/labeldlg.h [moved from src/templates/labeldlg.h with 95% similarity]
commonlib/templates/odtrender.cpp [moved from src/templates/odtrender.cpp with 100% similarity]
commonlib/templates/odtrender.h [moved from src/templates/odtrender.h with 91% similarity]
commonlib/templates/office.cpp [moved from src/templates/office.cpp with 100% similarity]
commonlib/templates/office.h [moved from src/templates/office.h with 90% similarity]
commonlib/templates/templates.pri [new file with mode: 0644]
commonlib/templates/ticketrender.cpp [moved from src/templates/ticketrender.cpp with 100% similarity]
commonlib/templates/ticketrender.h [moved from src/templates/ticketrender.h with 87% similarity]
commonlib/widgets/barcodeline.cpp [moved from src/widgets/barcodeline.cpp with 100% similarity]
commonlib/widgets/barcodeline.h [moved from src/widgets/barcodeline.h with 89% similarity]
commonlib/widgets/centbox.cpp [moved from src/widgets/centbox.cpp with 100% similarity]
commonlib/widgets/centbox.h [moved from src/widgets/centbox.h with 88% similarity]
commonlib/widgets/eventview.cpp [moved from src/widgets/eventview.cpp with 100% similarity]
commonlib/widgets/eventview.h [moved from src/widgets/eventview.h with 90% similarity]
commonlib/widgets/listview.cpp [moved from src/widgets/listview.cpp with 100% similarity]
commonlib/widgets/listview.h [moved from src/widgets/listview.h with 85% similarity]
commonlib/widgets/treeview.cpp [moved from src/widgets/treeview.cpp with 100% similarity]
commonlib/widgets/treeview.h [moved from src/widgets/treeview.h with 85% similarity]
commonlib/widgets/widgets.pri [moved from src/widgets/widgets.pri with 100% similarity]
mainapp/main.cpp
sessman/login.cpp
sessman/login.h
sessman/sessman.pro
src/dialogs/dialogs.pri
src/dialogs/orderauditdlg.cpp
src/libs.pri
src/main.cpp
src/main.h
src/mwin/overview.cpp
src/mwin/overview.h
src/mwin/tabwin.cpp
src/script/jsengine.cpp
src/smoke.pri
src/smoke.pro
src/templates/templates.pri

index 784629c..1168e00 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -101,7 +101,7 @@ server: wob
 
 client: wob taurus tzone wbase
        cd iface && $(QMAKE) $(QMAKEFLAGS) && $(MAKE)
-       cd cfglib && $(QMAKE) $(QMAKEFLAGS) && $(MAKE)
+       cd commonlib && $(QMAKE) $(QMAKEFLAGS) && $(MAKE)
        cd sesscli && $(QMAKE) $(QMAKEFLAGS) && $(MAKE)
        cd src && $(QMAKE) $(QMAKEFLAGS) && $(MAKE)
        cd mainapp && $(QMAKE) $(QMAKEFLAGS) && $(MAKE)
diff --git a/commonlib/commonexport.h b/commonlib/commonexport.h
new file mode 100644 (file)
index 0000000..921f2ca
--- /dev/null
@@ -0,0 +1,8 @@
+
+#include <QtCore/QtGlobal>
+
+#ifndef MAGICSMOKE_COMMON_LIB_BUILD
+#define MAGICSMOKE_COMMON_EXPORT Q_DECL_EXPORT
+#else
+#define MAGICSMOKE_COMMON_EXPORT Q_DECL_IMPORT
+#endif
diff --git a/commonlib/commonlib.pri b/commonlib/commonlib.pri
new file mode 100644 (file)
index 0000000..8b3f2c5
--- /dev/null
@@ -0,0 +1,10 @@
+#Include PRI for the config library
+
+LIBS += -lmagicsmoke-common
+INCLUDEPATH += $$PWD/../commonlib $$PWD/../commonlib/crypto $$PWD/../commonlib/widgets $$PWD/../commonlib/misc $$PWD/../commonlib/templates
+QT += gui widgets
+
+include($$PWD/../iface/iface.pri)
+include($$PWD/../taurus/zip.pri)
+include($$PWD/../taurus/elam.pri)
+include($$PWD/../taurus/aurora.pri)
diff --git a/commonlib/commonlib.pro b/commonlib/commonlib.pro
new file mode 100644 (file)
index 0000000..b739fe9
--- /dev/null
@@ -0,0 +1,36 @@
+#Project File for MagicSmoke Config Classes
+# (c) Konrad Rosenbaum, 2016
+
+#basics
+TEMPLATE = lib
+VERSION = 0.1
+TARGET = magicsmoke-common
+
+include(../basics.pri)
+include(../iface/iface.pri)
+include(../taurus/zip.pri)
+include(../taurus/elam.pri)
+include(../taurus/aurora.pri)
+
+#Localization
+TRANSLATIONS = \
+       smoke-common_de.ts \
+       smoke-common_en.ts
+
+#main source files
+HEADERS += configdialog.h mapplication.h
+SOURCES += configdialog.cpp mapplication.cpp
+INCLUDEPATH += .
+DEPENDPATH += $$INCLUDEPATH
+
+include(crypto/crypto.pri)
+include(widgets/widgets.pri)
+include(misc/misc.pri)
+include(templates/templates.pri)
+
+
+#make sure exports are ok
+DEFINES += MAGICSMOKE_COMMON_LIB_BUILD=1
+
+#make sure the correct Qt DLLs are used
+QT += gui widgets network printsupport
similarity index 99%
rename from src/dialogs/configdialog.cpp
rename to commonlib/configdialog.cpp
index 6b03e50..d4aab14 100644 (file)
@@ -1,5 +1,5 @@
 //
-// C++ Implementation: mainwindow
+// C++ Implementation: config dialog
 //
 // Description: 
 //
@@ -11,7 +11,7 @@
 //
 
 #include "keygen.h"
-#include "main.h"
+#include "mapplication.h"
 #include "configdialog.h"
 #include "office.h"
 #include "listview.h"
@@ -410,7 +410,7 @@ void MConfigDialog::defaultProfile()
 
 void MConfigDialog::changeLang()
 {
-       choseLanguage();
+       MApplication::choseLanguage();
 }
 
 void MConfigDialog::exportKey()
@@ -553,7 +553,7 @@ void MConfigDialog::serverProbe()
        QNetworkAccessManager man;
        connect(&man,SIGNAL(finished(QNetworkReply*)),&loop,SLOT(quit()));
        QTimer::singleShot(30000,&loop,SLOT(quit()));
-    connect(&man,SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError>&)), this,SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
+       connect(&man,SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError>&)), this,SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
        if(useproxy->isChecked())
                man.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy,proxyname->text(),proxyport->value(),proxyuser->text(),proxypass->text()));
        //query server
similarity index 92%
rename from src/dialogs/configdialog.h
rename to commonlib/configdialog.h
index 6200948..5a75635 100644 (file)
@@ -27,8 +27,10 @@ class QTableView;
 
 class MSslExceptions;
 
+#include "commonexport.h"
+
 /**login and profile configuration window*/
-class MConfigDialog:public QDialog
+class MAGICSMOKE_COMMON_EXPORT MConfigDialog:public QDialog
 {
        Q_OBJECT
        public:
@@ -79,7 +81,7 @@ class MConfigDialog:public QDialog
 class QComboBox;
 class QLineEdit;
 
-class MAppStyleDialog:public QDialog
+class MAGICSMOKE_COMMON_EXPORT MAppStyleDialog:public QDialog
 {
        Q_OBJECT
        public:
similarity index 96%
rename from src/crypto/hmac.h
rename to commonlib/crypto/hmac.h
index fc177c7..f2c8ddd 100644 (file)
 
 #include <QCryptographicHash>
 
+#include "commonexport.h"
+
 /**Calculate a cryptographic HMAC (used by authentication algorithm)*/
-class SMHmac
+class MAGICSMOKE_COMMON_EXPORT SMHmac
 {
        public:
                /**constructs an object that calculates HMACs*/
similarity index 79%
rename from src/crypto/keygen.h
rename to commonlib/crypto/keygen.h
index b822974..92df7eb 100644 (file)
@@ -19,7 +19,9 @@
 class QLabel;
 class QPushButton;
 
-class MKeyGen:public QDialog
+#include "commonexport.h"
+
+class MAGICSMOKE_COMMON_EXPORT MKeyGen:public QDialog
 {
        Q_OBJECT
        public:
@@ -38,7 +40,7 @@ class MKeyGen:public QDialog
                void updateProps();
 };
 
-class EFilter:public QObject
+class MAGICSMOKE_COMMON_EXPORT EFilter:public QObject
 {
        Q_OBJECT
        public:
@@ -60,7 +62,7 @@ class EFilter:public QObject
 };
 
 //shortcut:
-QByteArray getRandom(int);
-int getEntropy();
+MAGICSMOKE_COMMON_EXPORT QByteArray getRandom(int);
+MAGICSMOKE_COMMON_EXPORT int getEntropy();
 
 #endif
diff --git a/commonlib/mapplication.cpp b/commonlib/mapplication.cpp
new file mode 100644 (file)
index 0000000..e82efc5
--- /dev/null
@@ -0,0 +1,466 @@
+//
+// C++ Implementation: main
+//
+// Description: Main Program
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2016
+//
+// Copyright: See README/COPYING.GPL files that come with this distribution
+//
+//
+
+#include <QDesktopServices>
+#include <QDebug>
+#include <QDir>
+#include <QDomDocument>
+#include <QDomElement>
+#include <QHostInfo>
+#include <QIcon>
+#include <QInputDialog>
+#include <QLibraryInfo>
+#include <QLocale>
+#include <QMenu>
+#include <QMessageBox>
+#include <QProgressDialog>
+#include <QSettings>
+#include <QSignalMapper>
+#include <QStringList>
+#include <QTranslator>
+#include <QUrl>
+
+#include <TimeStamp>
+#include <TZFile>
+
+#include "configdialog.h"
+#include "debug.h"
+#include "barcode-plugin.h"
+#include "hmac.h"
+#include "keygen.h"
+#include "mapplication.h"
+// #include "login.h"
+#include "msinterface.h"
+#include <ELAM/Engine>
+#include "misc.h"
+#include <Aurora>
+#include "boxwrapper.h"
+
+QString MApplication::choseLanguage(bool warn)
+{
+       QString lang=QSettings().value("lang","--").toString();
+       if(lang=="--"){
+               lang=QLocale::system().name();
+       }
+       int cur=0;
+       QStringList langs;
+       langs<<"C - default";
+       QStringList files=QDir(QApplication::applicationDirPath()).entryList(QStringList()<<"smoke_*.qm", QDir::Files, QDir::Name);
+       for(int i=0;i<files.size();i++){
+               QString l=files[i].mid(6);
+               l.chop(3);
+               langs<<l;
+               if(l==lang)cur=langs.size()-1;
+       }
+       bool ok;
+       QString lc;
+       lc=QInputDialog::getItem(0,QApplication::translate("lang","Chose Language"),QApplication::translate("lang","Language:"),langs,cur,false,&ok);
+       if(ok){
+               lang=lc.split(' ').at(0);
+               QSettings().setValue("lang",lang);
+               if(warn)
+                       QMessageBox::information(0,QApplication::translate("lang","Information"), QApplication::translate("lang","The changed language setting will only be active after restarting the application."));
+       }
+       return lang;
+}
+
+class MProgressWrapperGui:public MProgressWrapper
+{
+        QProgressDialog*pd;
+        public:
+                MProgressWrapperGui(QString label,QString button)
+                {
+                        pd=new QProgressDialog(label,button,0,0);
+                        pd->setMinimumDuration(0);
+                        pd->show();
+                }
+                ~MProgressWrapperGui()
+                {
+                        if(pd)pd->deleteLater();
+                        pd=0;
+                }
+                virtual void setLabelText(QString l)
+                {
+                        pd->setLabelText(l);
+                }
+                virtual void setCancelButtonText(QString t)
+                {
+                        pd->setCancelButtonText(t);
+                }
+                virtual void cancel()
+                {
+                        pd->cancel();
+                }
+                virtual void setRange(int mi,int ma)
+                {
+                        pd->setRange(mi,ma);
+                }
+                virtual void setValue(int v)
+                {
+                        pd->setValue(v);
+                }
+};
+
+#ifndef HOMEPAGE_BASEURL
+#define HOMEPAGE_BASEURL "http://smoke.silmor.de"
+#endif
+
+void MApplication::aboutMS()
+{
+       QMessageBox mb;
+       mb.setIconPixmap(QPixmap(":/icon.png"));
+       mb.setWindowTitle(tr("About MagicSmoke"));
+       MSInterface*ifc=MSInterface::instance();
+       mb.setText(tr(  "<h3>MagicSmoke v. %1</h3>"
+                       "&copy; Konrad Rosenbaum, 2007-2013<br>"
+                       "&copy; Peter Keller, 2007-2008<br>"
+                       "protected under the GNU GPL v.3 or at your option any newer<p>"
+                       "See also the <a href=\"%2\">MagicSmoke Homepage</a>.<p>"
+                       "This version was compiled from repository '%3' revision '%4'.<p>"
+                       "The current application data base path is '%5'.")
+                       .arg(MSInterface::staticVersionInfo(WOb::VersionHR)) //%1
+                       .arg(HOMEPAGE_BASEURL) //%2
+                       .arg(MSInterface::staticVersionInfo(WOb::VersionRootURL)) //%3
+                       .arg(MSInterface::staticVersionInfo(WOb::VersionNumber)) //%4
+                       .arg(ifc?ifc->dataDir(): dataDir())
+               );
+       mb.setStandardButtons(QMessageBox::Ok);
+       mb.exec();
+}
+
+void MApplication::versionDlg()
+{
+       QMessageBox mb;
+       mb.setIconPixmap(QPixmap(":/icon.png"));
+       mb.setWindowTitle(tr("MagicSmoke Version Information"));
+       TimeZoneLib::TZFile tzf=TimeStamp::defaultZoneFile();
+       auto unknown=[](const QString&s)->QString{if(s.isEmpty())return "(unknown)";else return "'"+s+"'";};
+       mb.setText(tr(  "<h3>MagicSmoke Version %3</h3>"
+                       "<table border='1' style='border-style: solid; border-color: #888;'>"
+                       "<tr><td>Repository:<td>%1</tr>"
+                       "<tr><td>Revision:<td>%2</tr>"
+                       "<tr><td>Modification&nbsp;State:<td>%4</tr>"
+                       "<tr><td>Commit Time:<td>%5</tr>"
+                       "<tr><td>Committer:<td>%6</tr>"
+                       "</table><p>\n"
+                       "<h3>Libraries</h3>\n<table border='1' style='border-style: solid; border-color: #888;'>"
+                       "<tr><td>WOC:<td>%7<br/>%8</tr>"
+                       "<tr><td>PACK&nbsp;Library:<td>%9<br/>%10</tr>"
+                       "<tr><td>Qt:<td>%11</tr>"
+                       "<tr><td>ELAM:<td>%12</tr>"
+                       "<tr><td>Time&nbsp;Zone&nbsp;Default:<td>%13 in directory %14<br/>version %15</tr>"
+                       "<tr><td>Time&nbsp;Zone&nbsp;Built-In:<td>%16 (library: %17)</tr>"
+                       "</table>"
+                       )
+                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionRootURL))) // %1
+                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionNumber))) //%2
+                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionHR))) //%3
+                       .arg(MSInterface::staticVersionInfo(WOb::VersionLocallyModified)) //%4
+                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionTime))) //%5
+                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionAuthor))) //&6
+                       .arg(htmlize(MSInterface::staticWocVersionInfo(WOb::VersionRootURL))) //%7
+                       .arg(htmlize(MSInterface::staticWocVersionInfo(WOb::VersionNumber)))
+                       .arg(htmlize(WInterface::staticLibraryVersionInfo(WOb::VersionRootURL))) //%9
+                       .arg(htmlize(WInterface::staticLibraryVersionInfo(WOb::VersionNumber)))
+                       .arg(htmlize(QT_VERSION_STR)) //%11
+                       .arg(htmlize(ELAM::versionInfo())) //%12
+                       .arg(unknown(tzf.name())) //%13
+                       .arg(unknown(tzf.dirName()))
+                       .arg(unknown(tzf.version()))
+                       .arg(TimeZoneLib::TZFile::builtinVersion()) //%16
+                       .arg(TimeZoneLib::TZFile::libraryVersion()) //%17
+               );
+       mb.setStandardButtons(QMessageBox::Ok);
+       mb.exec();
+}
+
+
+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){}
+};
+static QList<HelpUrl> helpUrl;
+
+static void loadHelpUrlFile(const QString&fname)
+{
+        QFile fd(fname);
+        QList<HelpUrl > urls;
+        //try to open
+        if(fd.open(QIODevice::ReadOnly)){
+                //read config
+                QDomDocument doc;
+                doc.setContent(&fd);
+                QDomNodeList nl=doc.documentElement().childNodes();
+                for(int i=0;i<nl.size();i++){
+                        QDomElement el=nl.at(i).toElement();
+                        if(!el.isElement())continue;
+                        if(el.tagName()=="Item")
+                                urls.append(HelpUrl(HelpUrl::Item, el.attribute("label").trimmed(), el.text().trimmed()));
+                        else if(el.tagName()=="Separator")
+                                urls.append(HelpUrl(HelpUrl::Separator, el.attribute("label").trimmed()));
+                }
+        }
+        //append to url list
+        if(helpUrl.size()>0 && urls.size()>0)helpUrl.append(HelpUrl(HelpUrl::Separator,""));
+        helpUrl.append(urls);
+}
+
+void MApplication::initHelpUrl()
+{
+       //check file exists, if not initialize it
+       loadHelpUrlFile(dataDir()+"/helpMenu.xml");
+        loadHelpUrlFile(applicationDirPath()+"/helpMenu.xml");
+       //fallback
+       if(helpUrl.size()<1)
+               helpUrl<<HelpUrl(HelpUrl::Item,tr("&Help"),tr("default:/index.html","default help URL, if you translate the index.html file, then change this as well"));
+}
+
+QMenu* MApplication::helpMenu()
+{
+       QMenu*m=new QMenu(tr("&Help"));
+       QSignalMapper *map=new QSignalMapper(m);
+       connect(map,SIGNAL(mapped(int)),qApp,SLOT(help(int)));
+       for(int i=0;i<helpUrl.size();i++){
+                if(helpUrl[i].type==HelpUrl::Separator){
+                        m->addSeparator()->setText(helpUrl[i].label);
+                }else{
+                        QAction*a=m->addAction(helpUrl[i].label,map,SLOT(map()));
+                        map->setMapping(a,i);
+                }
+       }
+       m->addSeparator();
+       m->addAction("About &MagicSmoke",qApp,SLOT(aboutMS()));
+       m->addAction("About &Qt",qApp,SLOT(aboutQt()));
+       m->addAction("&Version Info",qApp,SLOT(versionDlg()));
+       return m;
+}
+
+static inline QUrl convHelpUrl(QUrl s)
+{
+        if(s.scheme()=="default"){
+                static const QString ad=QApplication::applicationDirPath()+"/doc/";
+                if(QFile(ad+"index.html").exists())
+                        return QUrl::fromLocalFile(ad+s.path());
+                else
+                        //TODO: allow different versions?
+                        return HOMEPAGE_BASEURL "/doc/" + s.path();
+        }
+        else return s;
+}
+
+
+
+void MApplication::help()
+{
+        qDebug()<<"Opening default help...";
+       QDesktopServices::openUrl(convHelpUrl(QUrl("default:/index.html")));
+}
+
+void MApplication::help(int idx)
+{
+       if(idx<0 || idx>=helpUrl.size()){
+               help();
+               return;
+       }
+       QUrl u=convHelpUrl(helpUrl[idx].url);
+        qDebug()<<"Opening help:"<<u;
+       QDesktopServices::openUrl(u);
+}
+
+MApplication::MApplication(int&ac,char**av)
+:QApplication(ac,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 parameters
+//         qDebug()<<"arguments"<<arguments();
+        for(const QString& param:arguments()){
+                if(param.startsWith("-confdir=")){
+                        setConfigDir(param.mid(9));
+                }else if(param.startsWith("-datadir=")){
+                        setDataDir(param.mid(9));
+                }
+        }
+        
+        //data directory
+        if(dataDir().isEmpty())
+                setDataDir("$BASE/.magicSmoke2");
+}
+
+void MApplication::setConfigDir(QString d)
+{
+        QSettings::setDefaultFormat(QSettings::IniFormat);
+        const QString cdir=MSInterface::resolveDir(d);
+        QSettings::setPath(QSettings::IniFormat,QSettings::UserScope,cdir);
+        qDebug()<<"Setting the config directory to"<<cdir<<"from"<<d;
+}
+
+void MApplication::setDataDir(QString d)
+{
+        MSInterface::setAppDataDir(d);
+}
+
+
+void MApplication::setMyStyle()
+{
+       QSettings set;
+       if(set.contains("appstyle"))
+               setStyle(set.value("appstyle").toString());
+       if(set.contains("appstylesheet")){
+               QFile fd(set.value("appstylesheet").toString());
+               if(fd.open(QIODevice::ReadOnly)){
+                       setStyleSheet(QString::fromLocal8Bit(fd.readAll()));
+                       fd.close();
+               }
+       }
+}
+
+static inline void loadTranslation(QTranslator*trans,const QString&lang,const QString&prog)
+{
+       QStringList lpath;
+       lpath <<QApplication::applicationDirPath() <<QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+       for(int i=0;i<lpath.size();i++){
+               bool ok=trans->load(prog+"_"+lang,lpath[i]);
+               QString msg=QString("...loading %1_%2 from %3 ...%4")
+                        .arg(prog).arg(lang)
+                        .arg(lpath[i])
+                        .arg(ok?"ok":"failed");
+               qDebug("%s",msg.toLatin1().data());
+               if(ok)return;
+       }
+}
+
+void MApplication::initLanguage()
+{
+       //try to find appropriate locale
+       QString lang=QSettings().value("lang","--").toString();
+       if(lang=="--"){
+               lang=choseLanguage(false);
+       }
+       qDebug("Loading language %s",lang.toLatin1().data());
+       //load Qt translation
+       loadTranslation(qttrans=new QTranslator(this),lang,"qt");
+       installTranslator(qttrans);
+       //load magicSmoke translation
+       loadTranslation(mstrans=new QTranslator(this),lang,"smoke");
+       installTranslator(mstrans);
+       //load Pack translation
+       QTranslator*xtrans;
+       loadTranslation(xtrans=new QTranslator(this),lang,"qwbase");
+       installTranslator(xtrans);
+       //detect and load remaining modules
+       QStringList files=QDir(applicationDirPath()).entryList(QStringList()<<"smoke-*.qm",QDir::Files|QDir::Readable,QDir::Name);
+       QStringList loaded, modules;
+       // --> stage 1: find modules
+       for(auto file:files){
+               QString m=file.split('_').value(0);
+               if(!m.isEmpty() && !modules.contains(m))
+                       modules.append(m);
+       }
+       // --> stage 2: go through modules and load
+       for(auto mod:modules){
+               loadTranslation(xtrans=new QTranslator(this),lang,mod);
+               installTranslator(xtrans);
+       }
+       //defaults
+       if(lang!="--"&&lang!=""){
+               QLocale::setDefault(lang);
+#ifndef Q_OS_WIN
+               setenv("LANG",lang.toLatin1().data(),1);
+       }else{
+               setenv("LANG","C",1);
+#endif
+       }
+}
+
+void MApplication::initialize()
+{
+        //load the correct style
+        setMyStyle();
+        //initialize log file
+        initDebug(dataDir());
+        //init localization and profiles
+        initLanguage();
+        initProfile();
+        //init help menu layout
+        initHelpUrl();
+        //init updater
+        initUpdater();
+        //init plugins
+        MBarcodeHub::instance()->initialize();
+}
+
+void MApplication::initUpdater()
+{
+        updater=new Aurora(applicationDirPath()+"/magicsmoke.xml",this);
+        connect(updater,SIGNAL(newVersionAvailable(QString)),this,SLOT(updateReadyDownload(QString)));
+        connect(updater,SIGNAL(readyForInstallation()),this,SLOT(updaterReadyInstall()));
+        connect(updater,SIGNAL(installationFinished()),this,SLOT(updaterCompleted()));
+        connect(updater,SIGNAL(downloadFailed()),this,SLOT(updaterFailed()));
+        connect(updater,SIGNAL(installationFailed()),this,SLOT(updaterFailed()));
+        //we ignore all errors that happen prior to successful verification, since they
+        //would create too much noise
+}
+
+void MApplication::updateReadyDownload(const QString& v)
+{
+        qDebug()<<"Asking for Download permission";
+        QMessageBox::StandardButton r=QMessageBox::question(0,tr("New Update"),tr("A new version of MagicSmoke is available. Do you want to download the new version %1?").arg(v),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes);
+        if(r==QMessageBox::Yes)
+                updater->startDownload();
+}
+
+void MApplication::updaterReadyInstall()
+{
+        QMessageBox::Button r=QMessageBox::question(0,tr("New Update"),tr("A new version of MagicSmoke is ready for installation. Do you want to install?"),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes);
+        if(r==QMessageBox::Yes)
+                updater->startInstallation();
+}
+
+void MApplication::updaterCompleted()
+{
+        QMessageBox::information(0,tr("Update Complete"),tr("A new version of MagicSmoke has been installed. It will be used the next time you start MagicSmoke."));
+}
+
+void MApplication::updaterFailed()
+{
+        QMessageBox::warning(0,tr("Update Failed"),tr("An update of MagicSmoke failed."));
+}
+
+QString MApplication::dataDir()
+{
+        return MSInterface::appDataDir();
+}
+
+void MApplication::initProfile()
+{
+        //check/generate profile
+        if(!QSettings().childGroups().contains("profiles")){
+                QMessageBox::warning(0,translate("initprofile","Initial Profile Warning"), translate("initprofile","You need a profile to work with Magic Smoke. Please create one now."));
+                MConfigDialog().exec();
+        }
+}
diff --git a/commonlib/mapplication.h b/commonlib/mapplication.h
new file mode 100644 (file)
index 0000000..eb17647
--- /dev/null
@@ -0,0 +1,94 @@
+//
+// C++ Interface: main
+//
+// Description: 
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2014
+//
+// Copyright: See README/COPYING.GPL files that come with this distribution
+//
+//
+
+#ifndef MAGICSMOKE_MAPP_H
+#define MAGICSMOKE_MAPP_H
+
+#include <QString>
+#include <QApplication>
+
+#include "commonexport.h"
+
+class QMenu;
+class EFilter;
+namespace AuroraUpdater{class Aurora;};
+///Main application object of MagicSmoke
+class MAGICSMOKE_COMMON_EXPORT MApplication:public QApplication
+{
+       Q_OBJECT
+       public:
+                ///create MagicSmoke application
+               MApplication(int&ac,char**av);
+               
+                ///return the standard help menu
+               static QMenu*helpMenu();
+                
+                ///shortcut: the main function
+                static int realmain(int,char**);
+                /**contains the directory that is used for external data storage*/
+                static QString dataDir();
+               /**show a dialog to change the language*/
+               static QString choseLanguage(bool warn=true);
+
+                ///override the data directory
+                ///- call it before any of the init functions
+                ///- never call this while a session is active!
+                static void setDataDir(QString);
+                ///override the configuration directory
+                ///- call this before initialize
+                ///- on Windows and MacOS, this also switches the settings mode to ini-files
+                static void setConfigDir(QString);
+       public slots:
+                ///complete initialization: style, language, data dir
+                void initialize();
+                ///set the configured application style
+                void setMyStyle();
+                ///initialize the localization
+                void initLanguage();
+                ///initialize the profiles
+                void initProfile();
+                
+               ///show about dialog
+               void aboutMS();
+                ///show version info
+               void versionDlg();
+                ///start a browser with the help page
+               void help();
+        private slots:
+                ///jump to a specific help page
+               void help(int);
+                
+                ///initialize the help menu from config files
+                void initHelpUrl();
+                
+                ///initialize the updater
+                void initUpdater();
+                
+                ///updater is ready for download
+                void updateReadyDownload(const QString&);
+                ///updater is ready for install
+                void updaterReadyInstall();
+                ///update complete
+                void updaterCompleted();
+                ///something failed for the updater
+                void updaterFailed();
+                
+        private:
+                EFilter *ef=nullptr;
+                QTranslator*qttrans=nullptr,*mstrans=nullptr;
+                AuroraUpdater::Aurora*updater=nullptr;
+};
+
+///return the instance of the MApplication 
+#define mApp (qobject_cast<MApplication*>(qApp))
+
+#endif
similarity index 91%
rename from src/misc/barcode-plugin.h
rename to commonlib/misc/barcode-plugin.h
index dbeb6b3..ee6034f 100644 (file)
 #ifndef MAGICSMOKE_BARCODE_PLUGIN_H
 #define MAGICSMOKE_BARCODE_PLUGIN_H
 
-#ifdef MAGICSMOKE_LIB_BUILD
-#define MAGICSMOKE_EXPORT Q_DECL_EXPORT
-#else
-#define MAGICSMOKE_EXPORT Q_DECL_IMPORT
-#endif
+#include "commonexport.h"
 
 #include <QtPlugin>
 #include <QStringList>
@@ -27,7 +23,7 @@
 class QTabWidget;
 
 ///Scanner Configuration Dialog
-class MAGICSMOKE_EXPORT MBarcodeConfiguration:public QDialog
+class MAGICSMOKE_COMMON_EXPORT MBarcodeConfiguration:public QDialog
 {
         Q_OBJECT
         public:
@@ -43,7 +39,7 @@ class MAGICSMOKE_EXPORT MBarcodeConfiguration:public QDialog
 };
 
 ///base class of actual scanner implementations
-class MAGICSMOKE_EXPORT MBarcodeScanner:public QObject
+class MAGICSMOKE_COMMON_EXPORT MBarcodeScanner:public QObject
 {
         Q_OBJECT
         public:
@@ -70,7 +66,7 @@ class MAGICSMOKE_EXPORT MBarcodeScanner:public QObject
 };
 
 ///base class of barcode scanner plugins
-class MAGICSMOKE_EXPORT MBarcodePlugin
+class MAGICSMOKE_COMMON_EXPORT MBarcodePlugin
 {
         public:
                 virtual ~MBarcodePlugin();
@@ -84,7 +80,7 @@ class MAGICSMOKE_EXPORT MBarcodePlugin
 
 ///central barcode scanner hub, this is used by widgets that require barcodes,
 ///plugins report (indirectly) to the hub
-class MAGICSMOKE_EXPORT MBarcodeHub:public QObject
+class MAGICSMOKE_COMMON_EXPORT MBarcodeHub:public QObject
 {
         Q_OBJECT
         public:
similarity index 88%
rename from src/misc/code39.h
rename to commonlib/misc/code39.h
index 7d515f9..8a4a6d7 100644 (file)
@@ -13,7 +13,9 @@
 #include <QImage>
 #include <QString>
 
+#include "commonexport.h"
+
 /**Takes a string and converts it into a code-39 bar code.
 Code-39 allows letters (case-insensitive), digits, spaces and the special chars "-.$/+%".
 The bar code pixmap will be 1 pixel high and 16 pixels wide for each character (plus start/stop character and checksum character) - it needs to be scaled up to fit the intended size.*/
-QImage code39(QString);
+MAGICSMOKE_COMMON_EXPORT QImage code39(QString);
similarity index 95%
rename from src/misc/debug.cpp
rename to commonlib/misc/debug.cpp
index f2f92a8..986074f 100644 (file)
@@ -11,7 +11,7 @@
 //
 
 #include "debug.h"
-#include "main.h"
+// #include "main.h"
 
 #include <QCoreApplication>
 #include <QDateTime>
@@ -33,13 +33,12 @@ static void mymsghandler(QtMsgType,const QMessageLogContext&, const QString&msg)
 #endif
 }
 
-void initDebug()
+void initDebug(const QString&dataDir)
 {
     if(QCoreApplication::instance()->arguments().contains("-nolog")){
         qDebug()<<"-nolog argument was given, will not create a log file";
     }
        //create new log file
-       const QString&dataDir=MApplication::dataDir();
        QDir(dataDir).mkpath("debuglog");
         mylogFile=new QFile(dataDir+"/debuglog/log-"+QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss.zzz")+".txt");
         //...open it
similarity index 74%
rename from src/misc/debug.h
rename to commonlib/misc/debug.h
index a95db1e..cff5546 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef MAGICSMOKE_DEBUG_H
 #define MAGICSMOKE_DEBUG_H
 
-void initDebug();
+#include "commonexport.h"
+
+MAGICSMOKE_COMMON_EXPORT void initDebug(const QString&dataDir);
 
 #endif
similarity index 94%
rename from src/misc/domiterator.h
rename to commonlib/misc/domiterator.h
index 5161c53..15759e7 100644 (file)
@@ -11,7 +11,9 @@
 #ifndef SMOKE_DOM_ITERATOR_H
 #define SMOKE_DOM_ITERATOR_H
 
-class QDomNodeIterator
+#include "commonexport.h"
+
+class MAGICSMOKE_COMMON_EXPORT QDomNodeIterator
 {
         int pos;
         const QDomNodeList&container;
similarity index 98%
rename from src/misc/dommodel.h
rename to commonlib/misc/dommodel.h
index 6086fe7..6b37a03 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <functional>
 
+#include "commonexport.h"
+
 class QDomNode;
 class QDomDocument;
 
@@ -30,7 +32,7 @@ typedef std::function<QVariant(const QDomNode&)> MDomModelFunctor;
 The model holds a copy of the DOM tree, so the original is not changed even if the model changes.
 You can retrieve a current copy of the model's DOM tree by calling domDocument().
 This model can not carry application specific user data. It is only editable through its specialized node methods.*/
-class MDomItemModel:public QAbstractItemModel
+class MAGICSMOKE_COMMON_EXPORT MDomItemModel:public QAbstractItemModel
 {
        Q_OBJECT
        DECLARE_DPTR(d);
similarity index 100%
rename from src/misc/misc.pri
rename to commonlib/misc/misc.pri
similarity index 87%
rename from src/misc/sclock.h
rename to commonlib/misc/sclock.h
index 6fbb7de..6e80b8a 100644 (file)
 
 #include <QLabel>
 
+#include "commonexport.h"
 
 class QMenu;
 class QAction;
 
 
-class MServerClock:public QLabel
+class MAGICSMOKE_COMMON_EXPORT MServerClock:public QLabel
 {
        Q_OBJECT
        public:
similarity index 87%
rename from src/misc/waitcursor.h
rename to commonlib/misc/waitcursor.h
index f1082cf..29aecdb 100644 (file)
 #ifndef MAGICSMOKE_WAITCURSOR_H
 #define MAGICSMOKE_WAITCURSOR_H
 
+#include "commonexport.h"
+
 /**simple class to show a busy-cursor while an instance of it exists*/
-class WaitCursor
+class MAGICSMOKE_COMMON_EXPORT WaitCursor
 {
        public:
                /**displays a wait cursor (Qt::WaitCursor)*/
similarity index 95%
rename from src/templates/labeldlg.h
rename to commonlib/templates/labeldlg.h
index 5bd0e4b..e3c18f5 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef MAGICSMOKE_LABELDLG_H
 #define MAGICSMOKE_LABELDLG_H
 
+#include "commonexport.h"
+
 #include <QDialog>
 #include <QPointF>
 #include <QList>
@@ -26,7 +28,7 @@ class QPrinter;
 class QLabel;
 
 ///access to the label specific configuration
-class MLabelConfig
+class MAGICSMOKE_COMMON_EXPORT MLabelConfig
 {
        public:
                ///shows the configuration dialog
@@ -130,13 +132,13 @@ class MLabelConfig
                 friend QDataStream&operator<<(QDataStream&,const MLabelConfig&);
                 friend QDataStream&operator>>(QDataStream&,MLabelConfig&);
 };
-QDataStream &operator<<(QDataStream &out, const MLabelConfig &myObj);
-QDataStream &operator>>(QDataStream &in, MLabelConfig &myObj);
+MAGICSMOKE_COMMON_EXPORT QDataStream &operator<<(QDataStream &out, const MLabelConfig &myObj);
+MAGICSMOKE_COMMON_EXPORT QDataStream &operator>>(QDataStream &in, MLabelConfig &myObj);
 
 Q_DECLARE_METATYPE(MLabelConfig);
 
 ///dialog that allows to select which labels on a sheet of paper are used
-class MLabelDialog:public QDialog
+class MAGICSMOKE_COMMON_EXPORT MLabelDialog:public QDialog
 {
        Q_OBJECT
        public:
@@ -199,7 +201,7 @@ class MLabelDialog:public QDialog
 
 
 ///Dialog that allows to configure details on how to print a label.
-class MLabelPrintDialog:public QDialog
+class MAGICSMOKE_COMMON_EXPORT MLabelPrintDialog:public QDialog
 {
         Q_OBJECT
         public:
similarity index 91%
rename from src/templates/odtrender.h
rename to commonlib/templates/odtrender.h
index cf99d14..25ba593 100644 (file)
 #include <QString>
 
 #include "templates.h"
+#include "commonexport.h"
 
 class MOdtRendererPrivate;
 class QFile;
 
-extern const QString OdfTemplateNS;
-extern const QString OdfTemplatePrefix;
+MAGICSMOKE_COMMON_EXPORT extern const QString OdfTemplateNS;
+MAGICSMOKE_COMMON_EXPORT extern const QString OdfTemplatePrefix;
 
 /**abstract base class for all ODT rendering classes*/
-class MOdtRenderer
+class MAGICSMOKE_COMMON_EXPORT MOdtRenderer
 {
        public:
                /**instantiates a renderer loaded from template file*/
@@ -74,7 +75,7 @@ class MOdtRenderer
 };
 
 /**generic class that implements MOdtRenderer by calling signals; the signals must be connected using a direct or blocking connection; if any of them is not used it will behave as if the variable/loop did not exist*/
-class MOdtSignalRenderer:public QObject,public MOdtRenderer
+class MAGICSMOKE_COMMON_EXPORT MOdtSignalRenderer:public QObject,public MOdtRenderer
 {
        Q_OBJECT
        public:
similarity index 90%
rename from src/templates/office.h
rename to commonlib/templates/office.h
index 6c7286b..3af1de7 100644 (file)
@@ -23,12 +23,14 @@ void printOfficeFile(QString fname);
 
 #include <QDialog>
 
+#include "commonexport.h"
+
 class QComboBox;
 class QCheckBox;
 class QLineEdit;
 
 /**configuration dialog for OpenOffice access*/
-class MOfficeConfig:public QDialog
+class MAGICSMOKE_COMMON_EXPORT MOfficeConfig:public QDialog
 {
        Q_OBJECT
        public:
diff --git a/commonlib/templates/templates.pri b/commonlib/templates/templates.pri
new file mode 100644 (file)
index 0000000..6cc1d4f
--- /dev/null
@@ -0,0 +1,13 @@
+HEADERS += \
+       $$PWD/odtrender.h \
+       $$PWD/ticketrender.h \
+       $$PWD/office.h \
+       $$PWD/labeldlg.h
+
+SOURCES += \
+       $$PWD/odtrender.cpp \
+       $$PWD/ticketrender.cpp \
+       $$PWD/office.cpp \
+       $$PWD/labeldlg.cpp
+
+INCLUDEPATH += $$PWD
similarity index 87%
rename from src/templates/ticketrender.h
rename to commonlib/templates/ticketrender.h
index 10e2023..5e2a408 100644 (file)
@@ -25,8 +25,10 @@ class MOVoucher;
 class QPaintDevice;
 class QPainter;
 
+#include "commonexport.h"
+
 /**base class that describes labels*/
-class MLabel
+class MAGICSMOKE_COMMON_EXPORT MLabel
 {
        public:
                /**constructs the label*/
@@ -39,7 +41,7 @@ class MLabel
 };
 
 /**base class for all label rendering classes*/
-class MLabelRenderer
+class MAGICSMOKE_COMMON_EXPORT MLabelRenderer
 {
        public:
                /**instantiates a renderer loaded from template file*/
@@ -61,7 +63,7 @@ class MLabelRenderer
 };
 
 /**convenience class: renders vouchers directly*/
-class MVoucherRenderer:public MLabelRenderer
+class MAGICSMOKE_COMMON_EXPORT MVoucherRenderer:public MLabelRenderer
 {
        public:
                MVoucherRenderer(MTemplate f);
@@ -69,7 +71,7 @@ class MVoucherRenderer:public MLabelRenderer
 };
 
 /**convenience class: renders vouchers directly*/
-class MTicketRenderer:public MLabelRenderer
+class MAGICSMOKE_COMMON_EXPORT MTicketRenderer:public MLabelRenderer
 {
        public:
                MTicketRenderer(MTemplate f);
similarity index 89%
rename from src/widgets/barcodeline.h
rename to commonlib/widgets/barcodeline.h
index dccda13..dcabc8c 100644 (file)
@@ -15,7 +15,9 @@
 
 #include <QLineEdit>
 
-class MBarcodeLine:public QLineEdit
+#include "commonexport.h"
+
+class MAGICSMOKE_COMMON_EXPORT MBarcodeLine:public QLineEdit
 {
        Q_OBJECT
        public:
similarity index 88%
rename from src/widgets/centbox.h
rename to commonlib/widgets/centbox.h
index 80a42dd..80e9c23 100644 (file)
@@ -17,7 +17,9 @@
 #include <QDialog>
 #include <QRegExpValidator>
 
-class MCentSpinBox:public QAbstractSpinBox
+#include "commonexport.h"
+
+class MAGICSMOKE_COMMON_EXPORT MCentSpinBox:public QAbstractSpinBox
 {
        Q_OBJECT
        public:
@@ -44,7 +46,7 @@ class MCentSpinBox:public QAbstractSpinBox
                QRegExpValidator mvalid;
 };
 
-class MCentDialog:public QDialog
+class MAGICSMOKE_COMMON_EXPORT MCentDialog:public QDialog
 {
        Q_OBJECT
        public:
similarity index 90%
rename from src/widgets/eventview.h
rename to commonlib/widgets/eventview.h
index 6fa58e5..d336860 100644 (file)
 
 #include <MOEvent>
 
+#include "commonexport.h"
+
 ///Event Viewer
-class MEventView:public QTextBrowser
+class MAGICSMOKE_COMMON_EXPORT MEventView:public QTextBrowser
 {
        Q_OBJECT
 public:
similarity index 85%
rename from src/widgets/listview.h
rename to commonlib/widgets/listview.h
index c66c465..a4ce6b6 100644 (file)
 
 #include <QListView>
 
+#include "commonexport.h"
+
 /**enhances QTreeView to react a bit friendlier on clicks*/
-class MListView:public QListView
+class MAGICSMOKE_COMMON_EXPORT MListView:public QListView
 {
         public:
                 MListView(QWidget*w=0):QListView(w){}
similarity index 85%
rename from src/widgets/treeview.h
rename to commonlib/widgets/treeview.h
index b79f952..06eb373 100644 (file)
 
 #include <QTreeView>
 
+#include "commonexport.h"
+
 /**enhances QTreeView to react a bit friendlier on clicks*/
-class MTreeView:public QTreeView
+class MAGICSMOKE_COMMON_EXPORT MTreeView:public QTreeView
 {
         public:
                 MTreeView(QWidget*w=0):QTreeView(w){}
index 6c02f95..404121e 100644 (file)
@@ -2,5 +2,5 @@
 
 int main(int ac,char**av)
 {
-        return MApplication::realmain(ac,av);
-}
\ No newline at end of file
+        return MagicSmokeMain::realmain(ac,av);
+}
index 1566497..1233c66 100644 (file)
@@ -4,17 +4,15 @@
 // Description: 
 //
 //
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2016
 //
 // Copyright: See README/COPYING.GPL files that come with this distribution
 //
 //
 
-// #include "main.h"
 #include "login.h"
 #include "msinterface.h"
-// #include "overview.h"
-// #include "configdialog.h"
+#include "configdialog.h"
 
 #include <QApplication>
 #include <QByteArray>
@@ -157,10 +155,10 @@ void MLogin::startLogin()
 
 void MLogin::configwin()
 {
-//     MConfigDialog cd;
-//     cd.exec();
-//     initProfiles();
-//     loadProfile();
+       MConfigDialog cd;
+       cd.exec();
+       initProfiles();
+       loadProfile();
 }
 
 void MLogin::resizeEvent(QResizeEvent* )
index 1035fa2..2bb39c4 100644 (file)
@@ -4,7 +4,7 @@
 // Description: 
 //
 //
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2016
 //
 // Copyright: See README/COPYING.GPL files that come with this distribution
 //
index 6b628ce..7733749 100644 (file)
@@ -9,6 +9,7 @@ TARGET = magicsmoke-sessman
 include(../basics.pri)
 include(../sesscli/scrand.pri)
 include(../iface/iface.pri)
+include(../commonlib/commonlib.pri)
 
 #Localization
 TRANSLATIONS = \
index ff60fff..597979a 100644 (file)
@@ -1,5 +1,4 @@
 HEADERS += \
-       dialogs/configdialog.h \
        dialogs/eventedit.h \
        dialogs/eventsummary.h \
        dialogs/orderwin.h \
@@ -16,7 +15,6 @@ HEADERS += \
        dialogs/payedit.h
 
 SOURCES += \
-       dialogs/configdialog.cpp \
        dialogs/eventedit.cpp \
        dialogs/eventsummary.cpp \
        dialogs/orderwin.cpp \
index ed864bf..ecedb1d 100644 (file)
@@ -14,7 +14,7 @@
 #include "orderwin.h"
 
 #include "formula.h"
-#include "main.h"
+#include "mapplication.h"
 
 #include "msinterface.h"
 #include "MTGetTicketAudit"
index 09bd6b8..196e9d9 100644 (file)
@@ -12,6 +12,9 @@ include($$PWD/../taurus/aurora.pri)
 # Session Client library
 include($$PWD/../sesscli/sesscli.pri)
 
+# Common classes
+include($$PWD/../commonlib/commonlib.pri)
+
 #make sure the correct Qt DLLs are used
 QT += xml network script scripttools
 QT += widgets printsupport
index eb272f8..db3d7bf 100644 (file)
 // Description: Main Program
 //
 //
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2014
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2016
 //
 // Copyright: See README/COPYING.GPL files that come with this distribution
 //
 //
 
-#include <QDesktopServices>
-#include <QDebug>
-#include <QDir>
-#include <QDomDocument>
-#include <QDomElement>
-#include <QHostInfo>
-#include <QIcon>
-#include <QInputDialog>
-#include <QLibraryInfo>
-#include <QLocale>
-#include <QMenu>
-#include <QMessageBox>
-#include <QProgressDialog>
-#include <QSettings>
-#include <QSignalMapper>
-#include <QStringList>
-#include <QTranslator>
-#include <QUrl>
 
-#include <TimeStamp>
-#include <TZFile>
-
-#include "configdialog.h"
-#include "debug.h"
-#include "barcode-plugin.h"
-#include "hmac.h"
-#include "keygen.h"
-#include "main.h"
-// #include "login.h"
-#include "msinterface.h"
-#include <ELAM/Engine>
-#include "misc.h"
-#include <Aurora>
-#include "boxwrapper.h"
 #include "overview.h"
 
 #include <scli.h>
+#include <mapplication.h>
+#include "msinterface.h"
 
-QString choseLanguage(bool warn)
-{
-       QString lang=QSettings().value("lang","--").toString();
-       if(lang=="--"){
-               lang=QLocale::system().name();
-       }
-       int cur=0;
-       QStringList langs;
-       langs<<"C - default";
-       QStringList files=QDir(QApplication::applicationDirPath()).entryList(QStringList()<<"smoke_*.qm", QDir::Files, QDir::Name);
-       for(int i=0;i<files.size();i++){
-               QString l=files[i].mid(6);
-               l.chop(3);
-               langs<<l;
-               if(l==lang)cur=langs.size()-1;
-       }
-       bool ok;
-       QString lc;
-       lc=QInputDialog::getItem(0,QApplication::translate("lang","Chose Language"),QApplication::translate("lang","Language:"),langs,cur,false,&ok);
-       if(ok){
-               lang=lc.split(' ').at(0);
-               QSettings().setValue("lang",lang);
-               if(warn)
-                       QMessageBox::information(0,QApplication::translate("lang","Information"), QApplication::translate("lang","The changed language setting will only be active after restarting the application."));
-       }
-       return lang;
-}
-
-class MProgressWrapperGui:public MProgressWrapper
-{
-        QProgressDialog*pd;
-        public:
-                MProgressWrapperGui(QString label,QString button)
-                {
-                        pd=new QProgressDialog(label,button,0,0);
-                        pd->setMinimumDuration(0);
-                        pd->show();
-                }
-                ~MProgressWrapperGui()
-                {
-                        if(pd)pd->deleteLater();
-                        pd=0;
-                }
-                virtual void setLabelText(QString l)
-                {
-                        pd->setLabelText(l);
-                }
-                virtual void setCancelButtonText(QString t)
-                {
-                        pd->setCancelButtonText(t);
-                }
-                virtual void cancel()
-                {
-                        pd->cancel();
-                }
-                virtual void setRange(int mi,int ma)
-                {
-                        pd->setRange(mi,ma);
-                }
-                virtual void setValue(int v)
-                {
-                        pd->setValue(v);
-                }
-};
-
-#ifndef HOMEPAGE_BASEURL
-#define HOMEPAGE_BASEURL "http://smoke.silmor.de"
-#endif
-
-void MApplication::aboutMS()
-{
-       QMessageBox mb;
-       mb.setIconPixmap(QPixmap(":/icon.png"));
-       mb.setWindowTitle(tr("About MagicSmoke"));
-       MSInterface*ifc=MSInterface::instance();
-       mb.setText(tr(  "<h3>MagicSmoke v. %1</h3>"
-                       "&copy; Konrad Rosenbaum, 2007-2013<br>"
-                       "&copy; Peter Keller, 2007-2008<br>"
-                       "protected under the GNU GPL v.3 or at your option any newer<p>"
-                       "See also the <a href=\"%2\">MagicSmoke Homepage</a>.<p>"
-                       "This version was compiled from repository '%3' revision '%4'.<p>"
-                       "The current application data base path is '%5'.")
-                       .arg(MSInterface::staticVersionInfo(WOb::VersionHR)) //%1
-                       .arg(HOMEPAGE_BASEURL) //%2
-                       .arg(MSInterface::staticVersionInfo(WOb::VersionRootURL)) //%3
-                       .arg(MSInterface::staticVersionInfo(WOb::VersionNumber)) //%4
-                       .arg(ifc?ifc->dataDir(): dataDir())
-               );
-       mb.setStandardButtons(QMessageBox::Ok);
-       mb.exec();
-}
-
-void MApplication::versionDlg()
-{
-       QMessageBox mb;
-       mb.setIconPixmap(QPixmap(":/icon.png"));
-       mb.setWindowTitle(tr("MagicSmoke Version Information"));
-       TimeZoneLib::TZFile tzf=TimeStamp::defaultZoneFile();
-       auto unknown=[](const QString&s)->QString{if(s.isEmpty())return "(unknown)";else return "'"+s+"'";};
-       mb.setText(tr(  "<h3>MagicSmoke Version %3</h3>"
-                       "<table border='1' style='border-style: solid; border-color: #888;'>"
-                       "<tr><td>Repository:<td>%1</tr>"
-                       "<tr><td>Revision:<td>%2</tr>"
-                       "<tr><td>Modification&nbsp;State:<td>%4</tr>"
-                       "<tr><td>Commit Time:<td>%5</tr>"
-                       "<tr><td>Committer:<td>%6</tr>"
-                       "</table><p>\n"
-                       "<h3>Libraries</h3>\n<table border='1' style='border-style: solid; border-color: #888;'>"
-                       "<tr><td>WOC:<td>%7<br/>%8</tr>"
-                       "<tr><td>PACK&nbsp;Library:<td>%9<br/>%10</tr>"
-                       "<tr><td>Qt:<td>%11</tr>"
-                       "<tr><td>ELAM:<td>%12</tr>"
-                       "<tr><td>Time&nbsp;Zone&nbsp;Default:<td>%13 in directory %14<br/>version %15</tr>"
-                       "<tr><td>Time&nbsp;Zone&nbsp;Built-In:<td>%16 (library: %17)</tr>"
-                       "</table>"
-                       )
-                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionRootURL))) // %1
-                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionNumber))) //%2
-                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionHR))) //%3
-                       .arg(MSInterface::staticVersionInfo(WOb::VersionLocallyModified)) //%4
-                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionTime))) //%5
-                       .arg(htmlize(MSInterface::staticVersionInfo(WOb::VersionAuthor))) //&6
-                       .arg(htmlize(MSInterface::staticWocVersionInfo(WOb::VersionRootURL))) //%7
-                       .arg(htmlize(MSInterface::staticWocVersionInfo(WOb::VersionNumber)))
-                       .arg(htmlize(WInterface::staticLibraryVersionInfo(WOb::VersionRootURL))) //%9
-                       .arg(htmlize(WInterface::staticLibraryVersionInfo(WOb::VersionNumber)))
-                       .arg(htmlize(QT_VERSION_STR)) //%11
-                       .arg(htmlize(ELAM::versionInfo())) //%12
-                       .arg(unknown(tzf.name())) //%13
-                       .arg(unknown(tzf.dirName()))
-                       .arg(unknown(tzf.version()))
-                       .arg(TimeZoneLib::TZFile::builtinVersion()) //%16
-                       .arg(TimeZoneLib::TZFile::libraryVersion()) //%17
-               );
-       mb.setStandardButtons(QMessageBox::Ok);
-       mb.exec();
-}
-
-
-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){}
-};
-static QList<HelpUrl> helpUrl;
-
-static void loadHelpUrlFile(const QString&fname)
-{
-        QFile fd(fname);
-        QList<HelpUrl > urls;
-        //try to open
-        if(fd.open(QIODevice::ReadOnly)){
-                //read config
-                QDomDocument doc;
-                doc.setContent(&fd);
-                QDomNodeList nl=doc.documentElement().childNodes();
-                for(int i=0;i<nl.size();i++){
-                        QDomElement el=nl.at(i).toElement();
-                        if(!el.isElement())continue;
-                        if(el.tagName()=="Item")
-                                urls.append(HelpUrl(HelpUrl::Item, el.attribute("label").trimmed(), el.text().trimmed()));
-                        else if(el.tagName()=="Separator")
-                                urls.append(HelpUrl(HelpUrl::Separator, el.attribute("label").trimmed()));
-                }
-        }
-        //append to url list
-        if(helpUrl.size()>0 && urls.size()>0)helpUrl.append(HelpUrl(HelpUrl::Separator,""));
-        helpUrl.append(urls);
-}
-
-void MApplication::initHelpUrl()
-{
-       //check file exists, if not initialize it
-       loadHelpUrlFile(dataDir()+"/helpMenu.xml");
-        loadHelpUrlFile(applicationDirPath()+"/helpMenu.xml");
-       //fallback
-       if(helpUrl.size()<1)
-               helpUrl<<HelpUrl(HelpUrl::Item,tr("&Help"),tr("default:/index.html","default help URL, if you translate the index.html file, then change this as well"));
-}
-
-QMenu* MApplication::helpMenu()
-{
-       QMenu*m=new QMenu(tr("&Help"));
-       QSignalMapper *map=new QSignalMapper(m);
-       connect(map,SIGNAL(mapped(int)),qApp,SLOT(help(int)));
-       for(int i=0;i<helpUrl.size();i++){
-                if(helpUrl[i].type==HelpUrl::Separator){
-                        m->addSeparator()->setText(helpUrl[i].label);
-                }else{
-                        QAction*a=m->addAction(helpUrl[i].label,map,SLOT(map()));
-                        map->setMapping(a,i);
-                }
-       }
-       m->addSeparator();
-       m->addAction("About &MagicSmoke",qApp,SLOT(aboutMS()));
-       m->addAction("About &Qt",qApp,SLOT(aboutQt()));
-       m->addAction("&Version Info",qApp,SLOT(versionDlg()));
-       return m;
-}
-
-static inline QUrl convHelpUrl(QUrl s)
-{
-        if(s.scheme()=="default"){
-                static const QString ad=QApplication::applicationDirPath()+"/doc/";
-                if(QFile(ad+"index.html").exists())
-                        return QUrl::fromLocalFile(ad+s.path());
-                else
-                        //TODO: allow different versions?
-                        return HOMEPAGE_BASEURL "/doc/" + s.path();
-        }
-        else return s;
-}
-
-
-
-void MApplication::help()
-{
-        qDebug()<<"Opening default help...";
-       QDesktopServices::openUrl(convHelpUrl(QUrl("default:/index.html")));
-}
-
-void MApplication::help(int idx)
-{
-       if(idx<0 || idx>=helpUrl.size()){
-               help();
-               return;
-       }
-       QUrl u=convHelpUrl(helpUrl[idx].url);
-        qDebug()<<"Opening help:"<<u;
-       QDesktopServices::openUrl(u);
-}
-
-MApplication::MApplication(int&ac,char**av)
-:QApplication(ac,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 parameters
-//         qDebug()<<"arguments"<<arguments();
-        for(const QString& param:arguments()){
-                if(param.startsWith("-confdir=")){
-                        setConfigDir(param.mid(9));
-                }else if(param.startsWith("-datadir=")){
-                        setDataDir(param.mid(9));
-                }
-        }
-        
-        //data directory
-        if(dataDir().isEmpty())
-                setDataDir("$BASE/.magicSmoke2");
-}
-
-void MApplication::setConfigDir(QString d)
-{
-        QSettings::setDefaultFormat(QSettings::IniFormat);
-        const QString cdir=MSInterface::resolveDir(d);
-        QSettings::setPath(QSettings::IniFormat,QSettings::UserScope,cdir);
-        qDebug()<<"Setting the config directory to"<<cdir<<"from"<<d;
-}
-
-void MApplication::setDataDir(QString d)
-{
-        MSInterface::setAppDataDir(d);
-}
-
-
-void MApplication::setMyStyle()
-{
-       QSettings set;
-       if(set.contains("appstyle"))
-               setStyle(set.value("appstyle").toString());
-       if(set.contains("appstylesheet")){
-               QFile fd(set.value("appstylesheet").toString());
-               if(fd.open(QIODevice::ReadOnly)){
-                       setStyleSheet(QString::fromLocal8Bit(fd.readAll()));
-                       fd.close();
-               }
-       }
-}
-
-static inline void loadTranslation(QTranslator*trans,const QString&lang,const QString&prog)
-{
-       QStringList lpath;
-       lpath <<QApplication::applicationDirPath() <<QLibraryInfo::location(QLibraryInfo::TranslationsPath);
-       for(int i=0;i<lpath.size();i++){
-               bool ok=trans->load(prog+"_"+lang,lpath[i]);
-               QString msg=QString("...loading %1_%2 from %3 ...%4")
-                        .arg(prog).arg(lang)
-                        .arg(lpath[i])
-                        .arg(ok?"ok":"failed");
-               qDebug("%s",msg.toLatin1().data());
-               if(ok)return;
-       }
-}
-
-void MApplication::initLanguage()
-{
-       //try to find appropriate locale
-       QString lang=QSettings().value("lang","--").toString();
-       if(lang=="--"){
-               lang=choseLanguage(false);
-       }
-       qDebug("Loading language %s",lang.toLatin1().data());
-       //load Qt translation
-       loadTranslation(qttrans=new QTranslator(this),lang,"qt");
-       installTranslator(qttrans);
-       //load magicSmoke translation
-       loadTranslation(mstrans=new QTranslator(this),lang,"smoke");
-       installTranslator(mstrans);
-       //load Pack translation
-       QTranslator*xtrans;
-       loadTranslation(xtrans=new QTranslator(this),lang,"qwbase");
-       installTranslator(xtrans);
-       //detect and load remaining modules
-       QStringList files=QDir(applicationDirPath()).entryList(QStringList()<<"smoke-*.qm",QDir::Files|QDir::Readable,QDir::Name);
-       QStringList loaded, modules;
-       // --> stage 1: find modules
-       for(auto file:files){
-               QString m=file.split('_').value(0);
-               if(!m.isEmpty() && !modules.contains(m))
-                       modules.append(m);
-       }
-       // --> stage 2: go through modules and load
-       for(auto mod:modules){
-               loadTranslation(xtrans=new QTranslator(this),lang,mod);
-               installTranslator(xtrans);
-       }
-       //defaults
-       if(lang!="--"&&lang!=""){
-               QLocale::setDefault(lang);
-#ifndef Q_OS_WIN
-               setenv("LANG",lang.toLatin1().data(),1);
-       }else{
-               setenv("LANG","C",1);
-#endif
-       }
-}
-
-void MApplication::initialize()
-{
-        //load the correct style
-        setMyStyle();
-        //initialize log file
-        initDebug();
-        //init localization and profiles
-        initLanguage();
-        initProfile();
-        //init help menu layout
-        initHelpUrl();
-        //init updater
-        initUpdater();
-        //init plugins
-        MBarcodeHub::instance()->initialize();
-}
-
-void MApplication::initUpdater()
-{
-        updater=new Aurora(applicationDirPath()+"/magicsmoke.xml",this);
-        connect(updater,SIGNAL(newVersionAvailable(QString)),this,SLOT(updateReadyDownload(QString)));
-        connect(updater,SIGNAL(readyForInstallation()),this,SLOT(updaterReadyInstall()));
-        connect(updater,SIGNAL(installationFinished()),this,SLOT(updaterCompleted()));
-        connect(updater,SIGNAL(downloadFailed()),this,SLOT(updaterFailed()));
-        connect(updater,SIGNAL(installationFailed()),this,SLOT(updaterFailed()));
-        //we ignore all errors that happen prior to successful verification, since they
-        //would create too much noise
-}
-
-void MApplication::updateReadyDownload(const QString& v)
-{
-        qDebug()<<"Asking for Download permission";
-        QMessageBox::StandardButton r=QMessageBox::question(0,tr("New Update"),tr("A new version of MagicSmoke is available. Do you want to download the new version %1?").arg(v),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes);
-        if(r==QMessageBox::Yes)
-                updater->startDownload();
-}
-
-void MApplication::updaterReadyInstall()
-{
-        QMessageBox::Button r=QMessageBox::question(0,tr("New Update"),tr("A new version of MagicSmoke is ready for installation. Do you want to install?"),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes);
-        if(r==QMessageBox::Yes)
-                updater->startInstallation();
-}
-
-void MApplication::updaterCompleted()
-{
-        QMessageBox::information(0,tr("Update Complete"),tr("A new version of MagicSmoke has been installed. It will be used the next time you start MagicSmoke."));
-}
-
-void MApplication::updaterFailed()
-{
-        QMessageBox::warning(0,tr("Update Failed"),tr("An update of MagicSmoke failed."));
-}
-
-QString MApplication::dataDir()
-{
-        return MSInterface::appDataDir();
-}
-
-void MApplication::initProfile()
-{
-        //check/generate profile
-        if(!QSettings().childGroups().contains("profiles")){
-                QMessageBox::warning(0,translate("initprofile","Initial Profile Warning"), translate("initprofile","You need a profile to work with Magic Smoke. Please create one now."));
-                MConfigDialog().exec();
-        }
-}
-
+#include "main.h"
 
 
-int MApplication::realmain(int argc,char**argv)
+int MagicSmokeMain::realmain(int argc,char**argv)
 {
        //create global app
        MApplication app(argc,argv);
index 020a189..49d34de 100644 (file)
@@ -4,7 +4,7 @@
 // Description: 
 //
 //
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2014
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2016
 //
 // Copyright: See README/COPYING.GPL files that come with this distribution
 //
 #ifndef MAGICSMOKE_MAIN_H
 #define MAGICSMOKE_MAIN_H
 
-#include <QString>
-#include <QApplication>
-
-/**show a dialog to change the language*/
-QString choseLanguage(bool warn=true);
+#include <QtCore/QtGlobal>
 
 #ifdef MAGICSMOKE_LIB_BUILD
 #define MAGICSMOKE_EXPORT Q_DECL_EXPORT
@@ -25,75 +21,11 @@ QString choseLanguage(bool warn=true);
 #define MAGICSMOKE_EXPORT Q_DECL_IMPORT
 #endif
 
-class QMenu;
-class EFilter;
-namespace AuroraUpdater{class Aurora;};
-///Main application object of MagicSmoke
-class MAGICSMOKE_EXPORT MApplication:public QApplication
+///shortcut: the main function
+class MAGICSMOKE_EXPORT MagicSmokeMain
 {
-       Q_OBJECT
-       public:
-                ///create MagicSmoke application
-               MApplication(int&ac,char**av);
-               
-                ///return the standard help menu
-               static QMenu*helpMenu();
-                
-                ///shortcut: the main function
-                static int realmain(int,char**);
-                /**contains the directory that is used for external data storage*/
-                static QString dataDir();
-                
-                ///override the data directory
-                ///- call it before any of the init functions
-                ///- never call this while a session is active!
-                static void setDataDir(QString);
-                ///override the configuration directory
-                ///- call this before initialize
-                ///- on Windows and MacOS, this also switches the settings mode to ini-files
-                static void setConfigDir(QString);
-       public slots:
-                ///complete initialization: style, language, data dir
-                void initialize();
-                ///set the configured application style
-                void setMyStyle();
-                ///initialize the localization
-                void initLanguage();
-                ///initialize the profiles
-                void initProfile();
-                
-               ///show about dialog
-               void aboutMS();
-                ///show version info
-               void versionDlg();
-                ///start a browser with the help page
-               void help();
-        private slots:
-                ///jump to a specific help page
-               void help(int);
-                
-                ///initialize the help menu from config files
-                void initHelpUrl();
-                
-                ///initialize the updater
-                void initUpdater();
-                
-                ///updater is ready for download
-                void updateReadyDownload(const QString&);
-                ///updater is ready for install
-                void updaterReadyInstall();
-                ///update complete
-                void updaterCompleted();
-                ///something failed for the updater
-                void updaterFailed();
-                
-        private:
-                EFilter *ef=nullptr;
-                QTranslator*qttrans=nullptr,*mstrans=nullptr;
-                AuroraUpdater::Aurora*updater=nullptr;
+public:
+       static int realmain(int,char**);
 };
 
-///return the instance of the MApplication 
-#define mApp (qobject_cast<MApplication*>(qApp))
-
 #endif
index 237b672..23c6632 100644 (file)
@@ -4,14 +4,14 @@
 // Description: 
 //
 //
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2016
 //
 // Copyright: See README/COPYING.GPL files that come with this distribution
 //
 //
 
 #include "customerdlg.h"
-#include "main.h"
+#include "mapplication.h"
 #include "msinterface.h"
 #include "passwdchg.h"
 #include "shipping.h"
@@ -590,7 +590,7 @@ void MOverview::displaySettings()
 
 void MOverview::changeLang()
 {
-    choseLanguage();
+       MApplication::choseLanguage();
 }
 
 
index 512504b..8d4abd7 100644 (file)
@@ -4,7 +4,7 @@
 // Description: 
 //
 //
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2016
 //
 // Copyright: See README/COPYING.GPL files that come with this distribution
 //
index bb22acb..267ba6d 100644 (file)
@@ -11,7 +11,7 @@
 //
 
 #include "customerdlg.h"
-#include "main.h"
+#include "mapplication.h"
 #include "msinterface.h"
 #include "passwdchg.h"
 #include "shipping.h"
index e229e1a..b3a8372 100644 (file)
@@ -13,7 +13,7 @@
 #include "jsengine.h"
 #include "overview.h"
 #include "msinterface.h"
-#include "main.h"
+#include "mapplication.h"
 #include "templates.h"
 
 #include <QAction>
index 08bfa38..829c8b2 100644 (file)
@@ -7,11 +7,8 @@ include (libs.pri)
 LIBS += -lmagicsmoke
 INCLUDEPATH += \
         $$PWD \
-        $$PWD/crypto \
         $$PWD/dialogs \
-        $$PWD/misc \
         $$PWD/mwin \
         $$PWD/script \
-        $$PWD/templates \
-        $$PWD/widgets
+        $$PWD/templates
 
index 6e91bc0..17bd52d 100644 (file)
@@ -29,10 +29,7 @@ DEFINES += HOMEPAGE_BASEURL=\\\"http://smoke.silmor.de\\\"
 RESOURCES += images/files.qrc
 
 #libraries, modules, stuff...
-include(widgets/widgets.pri)
 include(templates/templates.pri)
-include(misc/misc.pri)
-include(crypto/crypto.pri)
 include(dialogs/dialogs.pri)
 include(mwin/mwin.pri)
 include(script/script.pri)
index cb72c6f..b66ec54 100644 (file)
@@ -1,19 +1,11 @@
 HEADERS += \
-       $$PWD/odtrender.h \
-       $$PWD/ticketrender.h \
-       $$PWD/office.h \
-       $$PWD/labeldlg.h \
-       $$PWD/templatedlg.h \
        $$PWD/ticketedit.h \
-       $$PWD/odfedit.h
+       $$PWD/odfedit.h \
+       $$PWD/templatedlg.h
 
 SOURCES += \
-       $$PWD/odtrender.cpp \
-       $$PWD/ticketrender.cpp \
-       $$PWD/office.cpp \
-       $$PWD/labeldlg.cpp \
-       $$PWD/templatedlg.cpp \
        $$PWD/ticketedit.cpp \
-       $$PWD/odfedit.cpp
+       $$PWD/odfedit.cpp \
+       $$PWD/templatedlg.cpp
 
-INCLUDEPATH += $$PWD
\ No newline at end of file
+INCLUDEPATH += $$PWD