HomeApplication::HomeApplication(int &argc, char **argv, const QString& appIdentifier) : MApplication(argc, argv, appIdentifier), upstartMode(false), lockedOrientation_(QVariant::Invalid), homeScreenService(new HomeScreenService), xEventListeners(), iteratorActiveForEventListenerContainer(false), toBeRemovedEventListeners() { parseArguments(argc, argv); // Enable prestart mode MApplication::setPrestartMode(M::TerminateOnClose); // launch a timer for sending a dbus-signal upstart when home is ready // and on screen connect(&startupNotificationTimer, SIGNAL(timeout()), this, SLOT(sendStartupNotifications())); startupNotificationTimer.setSingleShot(true); startupNotificationTimer.setInterval(0); startupNotificationTimer.start(); new HomeScreenAdaptor(homeScreenService); QDBusConnection connection = QDBusConnection::sessionBus(); connection.registerService(MEEGO_CORE_HOME_SCREEN_SERVICE_NAME); connection.registerObject(MEEGO_CORE_HOME_SCREEN_OBJECT_PATH, homeScreenService); connect(homeScreenService, SIGNAL(focusToLauncherApp(const QString&)), this, SIGNAL(focusToLauncherAppRequested(const QString &))); // Initialize the X11 atoms used in the UI components WindowInfo::initializeAtoms(); }
HomeApplication::HomeApplication(int &argc, char **argv, const QString &qmlPath) : QGuiApplication(argc, argv) , _mainWindowInstance(0) , _qmlPath(qmlPath) , originalSigIntHandler(signal(SIGINT, quitSignalHandler)) , originalSigTermHandler(signal(SIGTERM, quitSignalHandler)) { setApplicationName("Lipstick"); // TODO: autogenerate this from tags setApplicationVersion(VERSION); QTranslator *engineeringEnglish = new QTranslator(this); engineeringEnglish->load("lipstick_eng_en", "/usr/share/translations"); installTranslator(engineeringEnglish); QTranslator *translator = new QTranslator(this); translator->load(QLocale(), "lipstick", "-", "/usr/share/translations"); installTranslator(translator); // launch a timer for sending a dbus-signal upstart when basic construct is done QTimer::singleShot(0, this, SLOT(sendStartupNotifications())); // Initialize the QML engine qmlEngine = new QQmlEngine(this); // Initialize the notification manager NotificationManager::instance(); new NotificationPreviewPresenter(this); new NotificationFeedbackPlayer(this); // Create screen lock logic - not parented to "this" since destruction happens too late in that case screenLock = new ScreenLock; LipstickSettings::instance()->setScreenLock(screenLock); new ScreenLockAdaptor(screenLock); volumeControl = new VolumeControl; batteryNotifier = new BatteryNotifier(this); usbModeSelector = new USBModeSelector(this); connect(usbModeSelector, SIGNAL(dialogShown()), screenLock, SLOT(unlockScreen())); shutdownScreen = new ShutdownScreen(this); connectionSelector = new ConnectionSelector(this); // MCE expects the service to be registered on the system bus static const char *SCREENLOCK_DBUS_SERVICE = "org.nemomobile.lipstick"; static const char *SCREENLOCK_DBUS_PATH = "/screenlock"; QDBusConnection systemBus = QDBusConnection::systemBus(); if (!systemBus.registerService(SCREENLOCK_DBUS_SERVICE)) { qWarning("Unable to register screen lock D-Bus service %s: %s", SCREENLOCK_DBUS_SERVICE, systemBus.lastError().message().toUtf8().constData()); } if (!systemBus.registerObject(SCREENLOCK_DBUS_PATH, screenLock)) { qWarning("Unable to register screen lock object at path %s: %s", SCREENLOCK_DBUS_PATH, systemBus.lastError().message().toUtf8().constData()); } }
HomeApplication::HomeApplication(int &argc, char **argv, const QString &qmlPath) : QGuiApplication(argc, argv) , _mainWindowInstance(0) , _qmlPath(qmlPath) , originalSigIntHandler(signal(SIGINT, quitSignalHandler)) , originalSigTermHandler(signal(SIGTERM, quitSignalHandler)) , updatesEnabled(true) , homeReadySent(false) , onUpdatesDisabledUnfocusedWindowId(0) { setApplicationName("Lipstick"); // TODO: autogenerate this from tags setApplicationVersion(VERSION); QTranslator *engineeringEnglish = new QTranslator(this); engineeringEnglish->load("lipstick_eng_en", "/usr/share/translations"); installTranslator(engineeringEnglish); QTranslator *translator = new QTranslator(this); translator->load(QLocale(), "lipstick", "-", "/usr/share/translations"); installTranslator(translator); // Initialize the QML engine qmlEngine = new QQmlEngine(this); // Initialize the notification manager NotificationManager::instance(); new NotificationPreviewPresenter(this); // Create screen lock logic - not parented to "this" since destruction happens too late in that case screenLock = new ScreenLock; LipstickSettings::instance()->setScreenLock(screenLock); new ScreenLockAdaptor(screenLock); deviceLock = new DeviceLock(this); new DeviceLockAdaptor(deviceLock); volumeControl = new VolumeControl; new BatteryNotifier(this); new DiskSpaceNotifier(this); new ThermalNotifier(this); usbModeSelector = new USBModeSelector(this); connect(usbModeSelector, SIGNAL(dialogShown()), screenLock, SLOT(unlockScreen())); shutdownScreen = new ShutdownScreen(this); new ShutdownScreenAdaptor(shutdownScreen); connectionSelector = new ConnectionSelector(this); // MCE and usb-moded expect services to be registered on the system bus QDBusConnection systemBus = QDBusConnection::systemBus(); if (!systemBus.registerService(LIPSTICK_DBUS_SERVICE_NAME)) { qWarning("Unable to register D-Bus service %s: %s", LIPSTICK_DBUS_SERVICE_NAME, systemBus.lastError().message().toUtf8().constData()); } new HomeApplicationAdaptor(this); registerDBusObject(systemBus, LIPSTICK_DBUS_PATH, this); registerDBusObject(systemBus, LIPSTICK_DBUS_SCREENLOCK_PATH, screenLock); registerDBusObject(systemBus, LIPSTICK_DBUS_DEVICELOCK_PATH, deviceLock); registerDBusObject(systemBus, LIPSTICK_DBUS_SHUTDOWN_PATH, shutdownScreen); ScreenshotService *screenshotService = new ScreenshotService(this); new ScreenshotServiceAdaptor(screenshotService); QDBusConnection sessionBus = QDBusConnection::sessionBus(); registerDBusObject(sessionBus, LIPSTICK_DBUS_SCREENSHOT_PATH, screenshotService); connect(this, SIGNAL(homeReady()), this, SLOT(sendStartupNotifications())); }