X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=HomeScreen%2Fsrc%2Fapplauncherwidget.cpp;h=26b80a0a0ab08b5ee91433bd317ad157f08bd78b;hb=43c6b242b71a35a164b8e14a54c99f2bf667b37b;hp=18c373bc83cbded390d74cdddb8d2319f45259b7;hpb=5a040cf1e77872dd567f6ffba50ed79fc27d5822;p=staging%2FHomeScreen.git diff --git a/HomeScreen/src/applauncherwidget.cpp b/HomeScreen/src/applauncherwidget.cpp index 18c373b..26b80a0 100644 --- a/HomeScreen/src/applauncherwidget.cpp +++ b/HomeScreen/src/applauncherwidget.cpp @@ -27,21 +27,21 @@ AppLauncherWidget::AppLauncherWidget(QWidget *parent) : QWidget(parent), mp_ui(new Ui::AppLauncherWidget), - mp_appList(new QList()), + m_appList(), mp_appTable(0), mp_dBusAppFrameworkProxy() { mp_ui->setupUi(this); - AppInfo ai; + /*AppInfo ai; for (int i = 0; i < 100; ++i) { ai.setName("test" + QString::number(i)); mp_appList->append(ai); - } + }*/ - qDebug("D-Bus: connect to org.agl.homescreenappframeworkbindertizen /AppFramework"); - mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbindertizen", + qDebug("D-Bus: connect to org.agl.homescreenappframeworkbinder /AppFramework"); + mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbinder", "/AppFramework", QDBusConnection::sessionBus(), 0); @@ -54,7 +54,6 @@ AppLauncherWidget::~AppLauncherWidget() { delete mp_appTable; } - delete mp_appList; delete mp_ui; } @@ -65,23 +64,24 @@ void AppLauncherWidget::updateColorScheme() "/colorschemes/" + settings.value("systemsettings/colorscheme", "default").toString() + "/" + + QString::number(settings.value("systemsettings/proximityobjectdetected", false).toBool()) + + "/" + QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) + ".ini", QSettings::IniFormat); - mp_ui->widget_Background->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Background").toString()); - mp_ui->widget_Home_Icon->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Home_Icon").toString()); + mp_ui->widget_background->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Background").toString()); + mp_ui->widget_homeIcon->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Home_Icon").toString()); + + setStyleSheet(settings_cs.value("AppLauncherWidget/common_css").toString()); } void AppLauncherWidget::populateAppList() { - setStyleSheet("QTableWidget {background-color: transparent;}" - "QTableCornerButton::section {background-color: transparent;}"); - if (0 == mp_appTable) { mp_appTable = new QTableWidget(this); - QObject::connect(mp_appTable, SIGNAL(cellClicked(int, int)), this, SLOT(on_tableView_clicked(int, int))); + QObject::connect(mp_appTable, SIGNAL(cellClicked(int,int)), this, SLOT(on_tableView_clicked(int,int))); } else { @@ -100,18 +100,11 @@ void AppLauncherWidget::populateAppList() int i; -#ifdef __arm__ - QStringList apps = mp_dBusAppFrameworkProxy->getAvailableAppNames(); -#endif -#ifdef __i386__ - QStringList apps; - apps.append(QString("/usr/bin/gnome-terminal")); -#endif - mp_appList->clear(); + m_appList = mp_dBusAppFrameworkProxy->getAvailableApps(); - mp_appTable->setRowCount((apps.size() + (APP_LIST_COLUMN_COUNT - 1)) / APP_LIST_COLUMN_COUNT); + mp_appTable->setRowCount((m_appList.size() + (APP_LIST_COLUMN_COUNT - 1)) / APP_LIST_COLUMN_COUNT); - if (apps.size() >= (9 * APP_LIST_COLUMN_COUNT)) + if (m_appList.size() >= (9 * APP_LIST_COLUMN_COUNT)) { mp_appTable->resize(1000, 1920 - 40 - 40 - 60 - 60); } @@ -121,25 +114,17 @@ void AppLauncherWidget::populateAppList() } - for (i = 0; i < (mp_appTable->rowCount() * APP_LIST_COLUMN_COUNT); i++) + /*for (i = 0; i < (mp_appTable->rowCount() * APP_LIST_COLUMN_COUNT); i++) { mp_appTable->verticalHeader()->resizeSection(i, 190); mp_appTable->horizontalHeader()->resizeSection(i, 190); - } + }*/ - AppInfo ai; - for (i = 0; i < apps.size(); ++i) - { - qDebug("new app: %s", apps.at(i).toStdString().c_str()); - ai.setName(apps.at(i)); - mp_appList->append(ai); - } - - for (i = 0; i < mp_appList->size(); i++) + for (i = 0; i < m_appList.size(); i++) { mp_appTable->setItem(i / APP_LIST_COLUMN_COUNT, i % APP_LIST_COLUMN_COUNT, - new QTableWidgetItem(mp_appList->at(i).getName())); + new QTableWidgetItem(m_appList.at(i).name())); mp_appTable->item(i / APP_LIST_COLUMN_COUNT, i % APP_LIST_COLUMN_COUNT)->setFlags(Qt::ItemIsEnabled); mp_appTable->item(i / APP_LIST_COLUMN_COUNT, @@ -149,20 +134,15 @@ void AppLauncherWidget::populateAppList() void AppLauncherWidget::on_tableView_clicked(int row, int col) { - if (mp_appList->size() > row * APP_LIST_COLUMN_COUNT + col) + if (m_appList.size() > row * APP_LIST_COLUMN_COUNT + col) { -#ifdef __arm__ - int pid = mp_dBusAppFrameworkProxy->launchApp(mp_appList->at(row * APP_LIST_COLUMN_COUNT + col).getName()); -#endif -#ifdef __i386__ - QProcess *myProcess = new QProcess(); - myProcess->start(mp_appList->at(row * APP_LIST_COLUMN_COUNT + col).getName(), NULL); - int pid = myProcess->pid(); -#endif - qDebug("%d, %d: start app %s", row, col, mp_appList->at(row * APP_LIST_COLUMN_COUNT + col).getName().toStdString().c_str()); + int pid = mp_dBusAppFrameworkProxy->launchApp(m_appList.at(row * APP_LIST_COLUMN_COUNT + col).id()); + qDebug("%d, %d: start app %s", row, col, m_appList.at(row * APP_LIST_COLUMN_COUNT + col).id().toStdString().c_str()); qDebug("pid: %d", pid); // the new app wants to be visible by default - newRequestsToBeVisibleApp(pid); + emit newRequestsToBeVisibleApp(pid); + + emit showAppLayer(); } }