harbour-seaprint/src/harbour-seaprint.cpp

60 lines
2.2 KiB
C++
Raw Normal View History

2019-12-01 17:40:10 +03:00
#include <QtQuick>
#include <sailfishapp.h>
2019-12-01 17:55:55 +03:00
#include <src/ippdiscovery.h>
#include <src/ippprinter.h>
#include <src/imageitem.h>
#include <src/mimer.h>
2020-05-11 21:44:53 +03:00
#include <src/convertchecker.h>
#include <src/settings.h>
#include <src/rangelistchecker.h>
2019-12-01 17:40:10 +03:00
Q_DECLARE_METATYPE(CURLcode)
Q_DECLARE_METATYPE(Bytestream)
Q_DECLARE_METATYPE(PrintParameters)
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[])
{
qRegisterMetaType<CURLcode>();
qRegisterMetaType<Bytestream>();
qRegisterMetaType<PrintParameters>();
2022-01-19 22:03:19 +03:00
// Turn on/off logging according to setting
QLoggingCategory::defaultCategory()->setEnabled(QtMsgType::QtDebugMsg, Settings::instance()->debugLog());
QGuiApplication* app = SailfishApp::application(argc, argv);
app->setOrganizationName(QStringLiteral("net.attah"));
app->setApplicationName(QStringLiteral("seaprint"));
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>);
qmlRegisterSingletonType<Settings>("seaprint.settings", 1, 0, "SeaPrintSettings", singletontype_provider<Settings>);
qmlRegisterSingletonType<RangeListChecker>("seaprint.rangelistchecker", 1, 0, "RangeListChecker", singletontype_provider<RangeListChecker>);
2019-12-01 17:55:55 +03:00
qmlRegisterType<IppPrinter>("seaprint.ippprinter", 1, 0, "IppPrinter");
qmlRegisterType<ImageItem>("seaprint.imageitem", 1, 0, "ImageItem");
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
QQuickView* view = SailfishApp::createView();
view->engine()->addImportPath(SailfishApp::pathTo("qml/pages").toString());
view->setSource(SailfishApp::pathToMainQml());
view->show();
return app->exec();
2019-12-01 17:40:10 +03:00
}