2019-12-01 17:40:10 +03:00
|
|
|
#include <QtQuick>
|
|
|
|
|
|
|
|
#include <sailfishapp.h>
|
2019-12-20 00:59:56 +03:00
|
|
|
#include <seaprint_version.h>
|
2019-12-01 17:55:55 +03:00
|
|
|
#include <src/ippdiscovery.h>
|
|
|
|
#include <src/ippprinter.h>
|
2020-02-18 22:40:31 +03:00
|
|
|
#include <src/mimer.h>
|
2020-05-11 21:44:53 +03:00
|
|
|
#include <src/convertchecker.h>
|
2021-05-18 22:04:52 +03:00
|
|
|
#include <src/svgprovider.h>
|
2019-12-01 17:40:10 +03:00
|
|
|
|
2020-05-05 21:07:21 +03:00
|
|
|
#define PPM2PWG_MAIN ppm2pwg_main
|
|
|
|
#include <ppm2pwg/ppm2pwg.cpp>
|
|
|
|
|
2020-02-18 22:40:31 +03:00
|
|
|
template <class T>
|
|
|
|
static QObject* singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
2020-01-05 20:41:24 +03:00
|
|
|
{
|
|
|
|
Q_UNUSED(engine)
|
|
|
|
Q_UNUSED(scriptEngine)
|
|
|
|
|
2020-02-18 22:40:31 +03:00
|
|
|
T *inst = T::instance();
|
|
|
|
return inst;
|
2020-01-05 20:41:24 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-12-01 17:40:10 +03:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2020-05-05 21:07:21 +03:00
|
|
|
if(argc >= 1 && QString("ppm2pwg") == argv[1])
|
|
|
|
{
|
|
|
|
return ppm2pwg_main(argc-1, &(argv[1]));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-12-20 00:59:56 +03:00
|
|
|
QGuiApplication* app = SailfishApp::application(argc, argv);
|
|
|
|
|
2021-05-25 20:38:35 +03:00
|
|
|
// app->setOrganizationName(QStringLiteral("net.attah"));
|
|
|
|
// app->setApplicationName(QStringLiteral("seaprint"));
|
2019-12-20 00:59:56 +03:00
|
|
|
app->setApplicationVersion(QStringLiteral(SEAPRINT_VERSION));
|
|
|
|
|
2020-02-18 22:40:31 +03:00
|
|
|
qmlRegisterSingletonType<IppDiscovery>("seaprint.ippdiscovery", 1, 0, "IppDiscovery", singletontype_provider<IppDiscovery>);
|
|
|
|
qmlRegisterSingletonType<Mimer>("seaprint.mimer", 1, 0, "Mimer", singletontype_provider<Mimer>);
|
2020-05-11 21:44:53 +03:00
|
|
|
qmlRegisterSingletonType<ConvertChecker>("seaprint.convertchecker", 1, 0, "ConvertChecker", singletontype_provider<ConvertChecker>);
|
2019-12-01 17:55:55 +03:00
|
|
|
qmlRegisterType<IppPrinter>("seaprint.ippprinter", 1, 0, "IppPrinter");
|
2020-06-06 18:20:30 +03:00
|
|
|
qmlRegisterUncreatableType<IppMsg>("seaprint.ippmsg", 1, 0, "IppMsg", "Only used to supply an enum type");
|
2019-12-01 17:55:55 +03:00
|
|
|
|
2020-01-05 20:41:24 +03:00
|
|
|
QQuickView* view = SailfishApp::createView();
|
|
|
|
|
|
|
|
view->engine()->addImportPath(SailfishApp::pathTo("qml/pages").toString());
|
|
|
|
view->engine()->addImageProvider(QLatin1String("ippdiscovery"), IppDiscovery::instance());
|
2021-05-18 22:04:52 +03:00
|
|
|
view->engine()->addImageProvider(QLatin1String("svg"), SvgProvider::instance());
|
2020-01-05 20:41:24 +03:00
|
|
|
|
|
|
|
view->setSource(SailfishApp::pathToMainQml());
|
|
|
|
view->show();
|
|
|
|
return app->exec();
|
|
|
|
|
2019-12-01 17:40:10 +03:00
|
|
|
}
|