2 * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "applauncher.h"
18 #include <include/daynightmode.hpp>
20 #include <QApplication>
25 AppLauncher::AppLauncher(QObject *parent) :
28 mp_dBusAppFrameworkProxy()
31 for (int i = 0; i < 100; ++i)
33 ai.setName("test" + QString::number(i));
34 mp_appList->append(ai);
37 qDebug("D-Bus: connect to org.agl.homescreenappframeworkbinder /AppFramework");
38 mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbinder",
40 QDBusConnection::sessionBus(),
44 AppLauncher::~AppLauncher()
46 delete mp_dBusAppFrameworkProxy;
49 void AppLauncher::updateColorScheme()
52 QSettings settings_cs(QApplication::applicationDirPath() +
54 settings.value("systemsettings/colorscheme", "default").toString() +
56 QString::number(settings.value("systemsettings/proximityobjectdetected", false).toBool()) +
58 QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) +
60 QSettings::IniFormat);
62 //mp_ui->widget_background->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Background").toString());
63 //mp_ui->widget_homeIcon->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Home_Icon").toString());
65 //setStyleSheet(settings_cs.value("AppLauncherWidget/common_css").toString());
68 void AppLauncher::populateAppList()
72 m_appList = mp_dBusAppFrameworkProxy->getAvailableApps();
75 void AppLauncher::on_tableView_clicked(int row, int col)
77 /* if (m_appList.size() > row * APP_LIST_COLUMN_COUNT + col)
79 int pid = mp_dBusAppFrameworkProxy->launchApp(m_appList.at(row * APP_LIST_COLUMN_COUNT + col).id());
80 qDebug("%d, %d: start app %s", row, col, m_appList.at(row * APP_LIST_COLUMN_COUNT + col).id().toStdString().c_str());
81 qDebug("pid: %d", pid);
83 // the new app wants to be visible by default
84 emit newRequestsToBeVisibleApp(pid);