2
* Copyright (C) 2010 Canonical, Ltd.
5
* Olivier Tilloy <olivier.tilloy@canonical.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 3.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include <QApplication>
22
#include <QDesktopWidget>
23
#include <QDeclarativeEngine>
24
#include <QDeclarativeContext>
27
#include "launcherview.h"
29
int main(int argc, char *argv[])
31
/* UnityApplications plugin uses GTK APIs to retrieve theme icons
32
(gtk_icon_theme_get_default) and requires a call to gtk_init */
33
gtk_init(&argc, &argv);
35
QApplication application(argc, argv);
38
view.setAttribute(Qt::WA_X11NetWmWindowTypeDock);
39
/* FIXME: possible optimisations */
40
// view.setAttribute(Qt::WA_OpaquePaintEvent);
41
// view.setAttribute(Qt::WA_NoSystemBackground);
42
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
45
if (QCoreApplication::applicationDirPath() == INSTALL_PREFIX "/bin")
47
/* Running installed */
48
view.engine()->addImportPath(QString(INSTALL_PREFIX "/lib/qt4/imports"));
49
/* Note: baseUrl seems to be picky: if it does not end with a slash,
50
setSource() will fail */
51
view.engine()->setBaseUrl(QUrl::fromLocalFile(INSTALL_PREFIX "/" UNITY_QT_DIR "/launcher/"));
55
/* Uninstalled: make sure local plugins such as UnityApplications are
57
view.engine()->addImportPath(QString("."));
60
view.rootContext()->setContextProperty("launcherView", &view);
61
view.setSource(QUrl("./Launcher.qml"));
64
QDesktopWidget* desktop = QApplication::desktop();
65
view.workAreaResized(desktop->screenNumber(&view));
66
QObject::connect(desktop, SIGNAL(workAreaResized(int)), &view, SLOT(workAreaResized(int)));
68
return application.exec();