File indexing completed on 2024-04-28 15:39:41
0001 /* SPDX-FileCopyrightText: 2014 Jesper K. Pedersen <blackie@kde.org> 0002 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #include <QApplication> 0007 #include <QQmlContext> 0008 #include <QQmlEngine> 0009 #include <QQuickView> 0010 0011 #include "ImageDetails.h" 0012 #include "ImageStore.h" 0013 #include "MyImage.h" 0014 #include "PositionObserver.h" 0015 #include "RemoteImage.h" 0016 #include "RemoteInterface.h" 0017 #include "ScreenInfo.h" 0018 #include "Settings.h" 0019 0020 using namespace RemoteControl; 0021 0022 int main(int argc, char *argv[]) 0023 { 0024 QApplication app(argc, argv); 0025 QCoreApplication::setOrganizationName("KDE"); 0026 QCoreApplication::setOrganizationDomain("kde.org"); 0027 QCoreApplication::setApplicationName("KPhotoAlbum"); 0028 0029 QQuickView viewer; 0030 PositionObserver::setView(&viewer); 0031 0032 ScreenInfo::instance().setScreen(viewer.screen()); 0033 QObject::connect(viewer.engine(), SIGNAL(quit()), &app, SLOT(quit())); 0034 0035 qmlRegisterType<RemoteImage>("KPhotoAlbum", 1, 0, "RemoteImage"); 0036 qmlRegisterType<MyImage>("KPhotoAlbum", 1, 0, "MyImage"); 0037 qmlRegisterUncreatableType<Types>("KPhotoAlbum", 1, 0, "Enums", "Don't create instances of this class"); 0038 0039 QQmlContext *rootContext = viewer.engine()->rootContext(); 0040 rootContext->setContextProperty(QStringLiteral("_remoteInterface"), &RemoteInterface::instance()); 0041 rootContext->setContextProperty(QStringLiteral("_settings"), &Settings::instance()); 0042 rootContext->setContextProperty(QStringLiteral("_screenInfo"), &ScreenInfo::instance()); 0043 rootContext->setContextProperty(QStringLiteral("_imageDetails"), &ImageDetails::instance()); 0044 0045 viewer.setSource(QStringLiteral("qrc:/qml/main.qml")); 0046 viewer.setResizeMode(QQuickView::SizeRootObjectToView); 0047 0048 viewer.resize(1024, 768); 0049 viewer.show(); 0050 0051 // Create the store on the GUI thread 0052 (void)ImageStore::instance(); 0053 0054 return app.exec(); 0055 }