harbour-seaprint/src/harbour-seaprint.cpp

51 lines
1.5 KiB
C++
Raw Normal View History

2019-12-01 17:40:10 +03:00
#include <QtQuick>
#include <sailfishapp.h>
#include <seaprint_version.h>
2019-12-01 17:55:55 +03:00
#include <src/ippdiscovery.h>
#include <src/ippprinter.h>
#include <src/mimer.h>
2020-05-11 21:44:53 +03:00
#include <src/convertchecker.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>
template <class T>
static QObject* singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
T *inst = T::instance();
return inst;
}
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]));
}
QGuiApplication* app = SailfishApp::application(argc, argv);
app->setApplicationVersion(QStringLiteral(SEAPRINT_VERSION));
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");
QQuickView* view = SailfishApp::createView();
view->engine()->addImportPath(SailfishApp::pathTo("qml/pages").toString());
view->engine()->addImageProvider(QLatin1String("ippdiscovery"), IppDiscovery::instance());
view->setSource(SailfishApp::pathToMainQml());
view->show();
return app->exec();
2019-12-01 17:40:10 +03:00
}