From fac7c6d530500c4e5e48b0c9495fc2dea6a823d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=20=E7=BF=94?= Date: Sun, 4 Feb 2018 21:25:17 +0800 Subject: [PATCH] Make all dbus modules quit when the app quit --- component/threadpool.cpp | 17 +- component/threadpool.h | 8 +- dbusproxy/youkersystemdbus.cpp | 1 - debian/changelog | 1 + plugins/startupmanager/startupworker.cpp | 137 ++-- plugins/systemmonitor/filesystemwatcher.cpp | 1 + qdbusservice/sessiondbus/sessionservice.cpp | 1 - .../systemdbus/data/systemdbusproxy.cpp | 1 + qdbusservice/systemdbus/systemservice.cpp | 1 + src/dataworker.cpp | 590 +++++++++--------- src/dataworker.h | 11 +- src/mainwindow.cpp | 16 +- src/mainwindow.h | 4 - 13 files changed, 358 insertions(+), 431 deletions(-) diff --git a/component/threadpool.cpp b/component/threadpool.cpp index 635a3be..de31ca4 100644 --- a/component/threadpool.cpp +++ b/component/threadpool.cpp @@ -36,30 +36,23 @@ ThreadPool *ThreadPool::Instance() return &threadPool; } -QThread *ThreadPool::newThread() +QThread *ThreadPool::createNewThread() { QThread *thread = new QThread; - thread_pool.push_back(thread); + m_threadPool.push_back(thread); return thread; } -void ThreadPool::moveToNewThread(QObject *obj) +void ThreadPool::moveObjectToThread(QObject *obj) { - QThread *work = newThread(); + QThread *work = createNewThread(); obj->moveToThread(work); work->start(); } -//QThread *ThreadPool::createNewThread() -//{ -// QThread *thread = new QThread; -// thread_pool.push_back(thread); -// return thread; -//} - void ThreadPool::exitAllThreads() { - foreach (QThread *thread, thread_pool) { + foreach (QThread *thread, m_threadPool) { thread->quit(); thread->wait(2000); } diff --git a/component/threadpool.h b/component/threadpool.h index b241260..60d31f2 100644 --- a/component/threadpool.h +++ b/component/threadpool.h @@ -29,14 +29,12 @@ public: ~ThreadPool(); static ThreadPool *Instance(); -// QThread *createNewThread(); - QThread *newThread(); - void moveToNewThread(QObject *obj); - + QThread *createNewThread(); + void moveObjectToThread(QObject *obj); void exitAllThreads(); private: - QList thread_pool; + QList m_threadPool; }; #endif // THREADPOOL_H diff --git a/dbusproxy/youkersystemdbus.cpp b/dbusproxy/youkersystemdbus.cpp index 99d9d4d..084d1ff 100644 --- a/dbusproxy/youkersystemdbus.cpp +++ b/dbusproxy/youkersystemdbus.cpp @@ -48,7 +48,6 @@ SystemDispatcher::~SystemDispatcher() { clean_thread = NULL; } - qDebug() << "system dbus destroy.............."; this->exit_qt(); if (systemiface != NULL) { delete systemiface; diff --git a/debian/changelog b/debian/changelog index 1d72239..7f4d531 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,5 +17,6 @@ kylin-assistant (1.0.0-0ubuntu1) bionic; urgency=low * Add monitor for auto startup manager. * Add monitor for file system. * Add QDbus module(system dbus and session dbus). + * Make all dbus modules quit when the app quit. -- lixiang Mon, 29 Jan 2018 17:54:44 +0800 diff --git a/plugins/startupmanager/startupworker.cpp b/plugins/startupmanager/startupworker.cpp index 3290a36..cd4a1b3 100644 --- a/plugins/startupmanager/startupworker.cpp +++ b/plugins/startupmanager/startupworker.cpp @@ -33,107 +33,13 @@ #include #include #include +#include #include #include #include #include "util.h" - - - - - -//#include -//static gboolean -//gsp_app_manager_xdg_dir_monitor (GFileMonitor *monitor, -// GFile *child, -// GFile *other_file, -// GFileMonitorEvent flags, -// gpointer data) -//{ -//// GspAppManager *manager; -//// GspApp *old_app; -//// GspApp *app; -// GFile *parent; -// char *basename; -// char *dir; -// char *path; -// int index; - -// manager = GSP_APP_MANAGER (data); - -// basename = g_file_get_basename (child); -// if (!g_str_has_suffix (basename, ".desktop")) { -// /* not a desktop file, we can ignore */ -// g_free (basename); -// return TRUE; -// } -// old_app = getAppStartupDataAccrodDesktopFileName (manager, basename); - -// parent = g_file_get_parent (child); -// dir = g_file_get_path (parent); -// g_object_unref (parent); - -// index = gsp_app_manager_get_dir_index (manager, dir); -// if (index < 0) { -// /* not a directory we know; should never happen, though */ -// g_free (dir); -// return TRUE; -// } - -// path = g_file_get_path (child); -// switch (flags) { -// case G_FILE_MONITOR_EVENT_CHANGED: -// case G_FILE_MONITOR_EVENT_CREATED: -// /* we just do as if it was a new file: GspApp is clever enough -// * to do the right thing */ -// app = gsp_app_new (path, (unsigned int) index); - -// /* we didn't have this app before, so add it */ -// if (old_app == NULL && app != NULL) { -// gsp_app_manager_add (manager, app); -// g_object_unref (app); -// } -// /* else: it was just updated, GspApp took care of -// * sending the event */ -// break; -// case G_FILE_MONITOR_EVENT_DELETED: -// if (!old_app) { -// /* it got deleted, but we don't know about it, so -// * nothing to do */ -// break; -// } - -// _gsp_app_manager_handle_delete (manager, old_app, -// basename, index); -// break; -// default: -// break; -// } - -// g_free (path); -// g_free (dir); -// g_free (basename); - -// return TRUE; -//} - -//GFile *file; -//GDir *dir; -//const char *name; -//file = g_file_new_for_path (xdgdir->dir); -//GFileMonitor *monitor; -//monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL); -//g_object_unref (file); -//if (monitor) { -// g_signal_connect (monitor, "changed", G_CALLBACK (gsp_app_manager_xdg_dir_monitor), manager); -//} -//g_file_monitor_cancel (monitor); -//g_object_unref (monitor); -//monitor = NULL; - - void ensureCKeyInDesktopFil (GKeyFile *keyfile, const char *key) { char *C_value; @@ -143,15 +49,15 @@ void ensureCKeyInDesktopFil (GKeyFile *keyfile, const char *key) * This is so that if the user logs into another locale they get their * own description there rather then empty. It is not the C locale * however, but the user created this entry herself so it's OK */ - C_value = kylin_start_manager_key_file_get_string (keyfile, key); + C_value = kylin_start_manager_key_file_get_string(keyfile, key); if (C_value == NULL || C_value [0] == '\0') { - buffer = kylin_start_manager_key_file_get_locale_string (keyfile, key); - if (buffer) { - kylin_start_manager_key_file_set_string (keyfile, key, buffer); - g_free (buffer); - } + buffer = kylin_start_manager_key_file_get_locale_string(keyfile, key); + if (buffer) { + kylin_start_manager_key_file_set_string(keyfile, key, buffer); + g_free(buffer); + } } - g_free (C_value); + g_free(C_value); } inline QString getCurrentDesktopEnvironment() @@ -320,12 +226,37 @@ StartupData StartupWorker::getAppStartupDataAccrodDesktopFileName(QString &basen return StartupData(); } +/* + * dir:被监控的目录 fileList:被监控目录下的文件列表 +*/ void StartupWorker::updateGspXdgDir(const QString &dir, QStringList fileList) { if (this->m_xdgMap.keys().contains(dir)) { + QSet nowAutoStartSet = QSet::fromList(fileList); + //canel auto start, add the desktop file to user config dir + for(const QString &startupItem: nowAutoStartSet - QSet::fromList(this->m_xdgMap.value(dir).fileList)) { + //qDebug() << "Add startupItem===="<newStartupInfo(startupItem, this->m_xdgMap.value(dir).index); + } + + //start auto start, remove the desktop file which in user config dir + for(const QString &startupItem: QSet::fromList(this->m_xdgMap.value(dir).fileList) - nowAutoStartSet) { + //qDebug() << "Removed startupItem===="<updateEnable(info.exec, info.enabled); + this->updateSaveMask(info.exec, info.save_mask); + this->readySaveDesktopInfo(info); + } + + /* //start auto start, remove the desktop file which in user config dir foreach (QString orgFileAbsPath, this->m_xdgMap.value(dir).fileList) { if (!fileList.contains(orgFileAbsPath)) { + qDebug() << "had removed orgFileAbsPath="<m_xdgMap[dir].fileList.contains(nowFileAbsPath)) { //new added + qDebug() << "add new nowFileAbsPath="<newStartupInfo(nowFileAbsPath, this->m_xdgMap.value(dir).index); } } + */ this->m_xdgMap[dir].fileList.clear(); this->m_xdgMap[dir].fileList = fileList; diff --git a/plugins/systemmonitor/filesystemwatcher.cpp b/plugins/systemmonitor/filesystemwatcher.cpp index f6185ee..d2e5ac6 100644 --- a/plugins/systemmonitor/filesystemwatcher.cpp +++ b/plugins/systemmonitor/filesystemwatcher.cpp @@ -66,6 +66,7 @@ bool FileSystemWatcher::clearWatcher() return false; } } + void FileSystemWatcher::onMountDeviceFileContentsChanged() { QSet nowFileSet = getFileContentsLineByLine(DEVICE_MOUNT_PONINT_RECORD_FILE); diff --git a/qdbusservice/sessiondbus/sessionservice.cpp b/qdbusservice/sessiondbus/sessionservice.cpp index 43dffa1..2692773 100644 --- a/qdbusservice/sessiondbus/sessionservice.cpp +++ b/qdbusservice/sessiondbus/sessionservice.cpp @@ -36,7 +36,6 @@ SessionService::~SessionService() this->exitService(); } - QString SessionService::demoInfo() { return "QtSessionDbus"; diff --git a/qdbusservice/systemdbus/data/systemdbusproxy.cpp b/qdbusservice/systemdbus/data/systemdbusproxy.cpp index c9b159d..4638a20 100644 --- a/qdbusservice/systemdbus/data/systemdbusproxy.cpp +++ b/qdbusservice/systemdbus/data/systemdbusproxy.cpp @@ -18,6 +18,7 @@ SystemDbusProxy::SystemDbusProxy(QObject *parent) : SystemDbusProxy::~SystemDbusProxy() { + this->exitService(); m_handler->deleteLater(); } diff --git a/qdbusservice/systemdbus/systemservice.cpp b/qdbusservice/systemdbus/systemservice.cpp index 202a2fc..8c8f673 100644 --- a/qdbusservice/systemdbus/systemservice.cpp +++ b/qdbusservice/systemdbus/systemservice.cpp @@ -69,5 +69,6 @@ void SystemService::sendCustomData(const CustomData &message) void SystemService::exitService() { + qDebug() << "ready to exit service"; qApp->exit(0); } diff --git a/src/dataworker.cpp b/src/dataworker.cpp index a3d58bd..bf58228 100644 --- a/src/dataworker.cpp +++ b/src/dataworker.cpp @@ -46,58 +46,70 @@ DataWorker::~DataWorker() m_sensorTimer = nullptr; } - if (iface) {//iface->deleteLater() - delete iface; - iface = nullptr; + m_sessionInterface->deleteLater(); + m_systemInterface->deleteLater(); + m_qSystemDbus->deleteLater(); + + if (m_powerIface) {//m_powerIface->deleteLater() + delete m_powerIface; + m_powerIface = nullptr; } } void DataWorker::initDataWorker() { //power dbus - iface = new QDBusInterface("org.gnome.SettingsDaemon", + m_powerIface = new QDBusInterface("org.gnome.SettingsDaemon", "/org/gnome/SettingsDaemon/Power", "org.gnome.SettingsDaemon.Power.Screen", QDBusConnection::sessionBus()); //session dbus - sessioninterface = new SessionDispatcher; - ThreadPool::Instance()->moveToNewThread(sessioninterface); - this->m_existBattery = sessioninterface->judge_power_is_exists_qt(); + m_sessionInterface = new SessionDispatcher; + ThreadPool::Instance()->moveObjectToThread(m_sessionInterface); + this->m_existBattery = m_sessionInterface->judge_power_is_exists_qt(); - connect(sessioninterface, SIGNAL(string_value_notify(QString,QString)), this, SIGNAL(string_value_notify(QString,QString))); - connect(sessioninterface, SIGNAL(bool_value_notify(QString,bool)), this, SIGNAL(bool_value_notify(QString,bool))); - connect(sessioninterface, SIGNAL(int_value_notify(QString,int)), this, SIGNAL(int_value_notify(QString,int))); - connect(sessioninterface, SIGNAL(double_value_notify(QString, double)), this, SIGNAL(double_value_notify(QString, double))); + connect(m_sessionInterface, SIGNAL(string_value_notify(QString,QString)), this, SIGNAL(string_value_notify(QString,QString))); + connect(m_sessionInterface, SIGNAL(bool_value_notify(QString,bool)), this, SIGNAL(bool_value_notify(QString,bool))); + connect(m_sessionInterface, SIGNAL(int_value_notify(QString,int)), this, SIGNAL(int_value_notify(QString,int))); + connect(m_sessionInterface, SIGNAL(double_value_notify(QString, double)), this, SIGNAL(double_value_notify(QString, double))); - connect(sessioninterface, SIGNAL(isScanning(QString)), this, SIGNAL(isScanning(QString))); - connect(sessioninterface, SIGNAL(finishScanWork(QString)), this, SIGNAL(finishScanWork(QString))); - connect(sessioninterface, SIGNAL(tellScanResult(QString,QString)), this, SIGNAL(tellScanResult(QString,QString))); + connect(m_sessionInterface, SIGNAL(isScanning(QString)), this, SIGNAL(isScanning(QString))); + connect(m_sessionInterface, SIGNAL(finishScanWork(QString)), this, SIGNAL(finishScanWork(QString))); + connect(m_sessionInterface, SIGNAL(tellScanResult(QString,QString)), this, SIGNAL(tellScanResult(QString,QString))); - connect(sessioninterface, SIGNAL(tellCleanerDetailStatus(QString)), this, SIGNAL(tellCleanerDetailStatus(QString))); - connect(sessioninterface, SIGNAL(tellCleanerDetailError(QString)), this, SIGNAL(tellCleanerDetailError(QString))); - connect(sessioninterface, SIGNAL(tellCleanerDetailData(QStringList)), this, SIGNAL(tellCleanerDetailData(QStringList))); + connect(m_sessionInterface, SIGNAL(tellCleanerDetailStatus(QString)), this, SIGNAL(tellCleanerDetailStatus(QString))); + connect(m_sessionInterface, SIGNAL(tellCleanerDetailError(QString)), this, SIGNAL(tellCleanerDetailError(QString))); + connect(m_sessionInterface, SIGNAL(tellCleanerDetailData(QStringList)), this, SIGNAL(tellCleanerDetailData(QStringList))); //system dbus - systeminterface = new SystemDispatcher; - ThreadPool::Instance()->moveToNewThread(systeminterface); - /*QThread *systemThread = ThreadPool::Instance()->newThread(); - systeminterface->moveToThread(systemThread); + m_systemInterface = new SystemDispatcher; + ThreadPool::Instance()->moveObjectToThread(m_systemInterface); + /*QThread *systemThread = ThreadPool::Instance()->createNewThread(); + m_systemInterface->moveToThread(systemThread); systemThread->start();*/ - this->m_existSensor = systeminterface->judge_sensors_exists_qt(); - this->m_cpulist = systeminterface->get_cpufreq_scaling_governer_list_qt(); - this->m_currentCpuMode = systeminterface->get_current_cpufreq_scaling_governer_qt(); + this->m_existSensor = m_systemInterface->judge_sensors_exists_qt(); + this->m_cpulist = m_systemInterface->get_cpufreq_scaling_governer_list_qt(); + this->m_currentCpuMode = m_systemInterface->get_current_cpufreq_scaling_governer_qt(); - connect(systeminterface, SIGNAL(finishCleanWorkMain(QString)), this, SIGNAL(finishCleanWorkMain(QString))); - connect(systeminterface, SIGNAL(finishCleanWorkMainError(QString)), this, SIGNAL(finishCleanWorkMainError(QString))); - connect(systeminterface, SIGNAL(quickCleanProcess(QString,QString)), this, SIGNAL(quickCleanProcess(QString,QString))); + connect(m_systemInterface, SIGNAL(finishCleanWorkMain(QString)), this, SIGNAL(finishCleanWorkMain(QString))); + connect(m_systemInterface, SIGNAL(finishCleanWorkMainError(QString)), this, SIGNAL(finishCleanWorkMainError(QString))); + connect(m_systemInterface, SIGNAL(quickCleanProcess(QString,QString)), this, SIGNAL(quickCleanProcess(QString,QString))); - connect(systeminterface, SIGNAL(sendCleanOverSignal()), this, SIGNAL(sendCleanOverSignal())); - connect(systeminterface, SIGNAL(policykitCleanSignal(bool)), this, SIGNAL(policykitCleanSignal(bool))); - connect(systeminterface, SIGNAL(tellCleanerMainData(QStringList)), this, SIGNAL(tellCleanerMainData(QStringList))); - connect(systeminterface, SIGNAL(tellCleanerMainStatus(QString,QString)), this, SIGNAL(tellCleanerMainStatus(QString,QString))); - connect(systeminterface, SIGNAL(sendCleanErrorSignal(QString)), this, SIGNAL(sendCleanErrorSignal(QString))); + connect(m_systemInterface, SIGNAL(sendCleanOverSignal()), this, SIGNAL(sendCleanOverSignal())); + connect(m_systemInterface, SIGNAL(policykitCleanSignal(bool)), this, SIGNAL(policykitCleanSignal(bool))); + connect(m_systemInterface, SIGNAL(tellCleanerMainData(QStringList)), this, SIGNAL(tellCleanerMainData(QStringList))); + connect(m_systemInterface, SIGNAL(tellCleanerMainStatus(QString,QString)), this, SIGNAL(tellCleanerMainStatus(QString,QString))); + connect(m_systemInterface, SIGNAL(sendCleanErrorSignal(QString)), this, SIGNAL(sendCleanErrorSignal(QString))); + + m_qSystemDbus = new SystemDbusProxy; + ThreadPool::Instance()->moveObjectToThread(m_qSystemDbus); + connect(m_qSystemDbus, &SystemDbusProxy::reportAlert, this, [ = ](int ret, const QString &description) { + qDebug() <<"ret="<demoInfo()===="<demoInfo(); + qDebug() << m_qSystemDbus->getCustomData().hash; } void DataWorker::doWork() @@ -118,39 +130,39 @@ const QString DataWorker::cpuCurrentMode() const bool DataWorker::deleteAppointedFile(QString filename) { - bool result = systeminterface->delete_file_qt(filename); + bool result = m_systemInterface->delete_file_qt(filename); return result; } bool DataWorker::copyAppointedFile(QString filename) { - bool result = systeminterface->copy_file_qt(filename); + bool result = m_systemInterface->copy_file_qt(filename); return result; } //---------------scan void DataWorker::onStartScanSystem(QMap itemsMap) { - sessioninterface->scanSystemCleanerItems(itemsMap); + m_sessionInterface->scanSystemCleanerItems(itemsMap); } //-------------clean void DataWorker::onStartCleanSystem(QMap itemsMap) { - systeminterface->set_user_homedir_qt(); - systeminterface->cleanAllSelectItems(itemsMap); + m_systemInterface->set_user_homedir_qt(); + m_systemInterface->cleanAllSelectItems(itemsMap); } //system info void DataWorker::onUpdateSystemRunnedTime() { - int time_value = systeminterface->get_time_value_qt().toInt(); + int time_value = m_systemInterface->get_time_value_qt().toInt(); emit sendSystemRunnedTime(time_value); } void DataWorker::onRequestRefreshSystemInfo() { - QMap tmpMap = systeminterface->get_computer_info_qt(); + QMap tmpMap = m_systemInterface->get_computer_info_qt(); // qDebug() << "==================sys tmpMap="< tmpMap = sessioninterface->get_system_message_qt(); + QMap tmpMap = m_sessionInterface->get_system_message_qt(); emit sendDesktopInfo(tmpMap); } //cpu info void DataWorker::onRequestCpuInfo() { - QMap tmpMap = systeminterface->get_cpu_info_qt(); + QMap tmpMap = m_systemInterface->get_cpu_info_qt(); emit sendCpuInfo(tmpMap); } //memory info void DataWorker::onRequestMemoryInfo() { - QMap tmpMap = systeminterface->get_memory_info_qt(); + QMap tmpMap = m_systemInterface->get_memory_info_qt(); emit sendMemoryInfo(tmpMap); } //board info void DataWorker::onRequestBoardInfo() { - QMap tmpMap = systeminterface->get_board_info_qt(); + QMap tmpMap = m_systemInterface->get_board_info_qt(); emit sendBoardInfo(tmpMap); } //hd info void DataWorker::onRequestHDInfo() { - QMap tmpMap = systeminterface->get_harddisk_info_qt(); + QMap tmpMap = m_systemInterface->get_harddisk_info_qt(); emit sendHDInfo(tmpMap); } //nic info void DataWorker::onRequestNicInfo() { - QMap tmpMap = systeminterface->get_networkcard_info_qt(); + QMap tmpMap = m_systemInterface->get_networkcard_info_qt(); emit sendNicInfo(tmpMap); } //monitor info void DataWorker::onRequestMonitorInfo() { - QMap tmpMap = systeminterface->get_monitor_info_qt(); + QMap tmpMap = m_systemInterface->get_monitor_info_qt(); emit sendMonitorInfo(tmpMap); } //audio info void DataWorker::onRequestAudioInfo() { - QMap tmpMap = systeminterface->get_audiocard_info_qt(); + QMap tmpMap = m_systemInterface->get_audiocard_info_qt(); emit sendAudioInfo(tmpMap); } //battery info void DataWorker::onRequestBatteryInfo() { - QMap tmpMap = sessioninterface->read_battery_info_qt(); + QMap tmpMap = m_sessionInterface->read_battery_info_qt(); emit sendBatteryInfo(tmpMap); } //sensor info void DataWorker::onRequestSensorInfo() { - QMap tmpMap = systeminterface->get_sensor_info_qt(); + QMap tmpMap = m_systemInterface->get_sensor_info_qt(); emit sendSensorInfo(tmpMap); if (m_sensorTimer && !m_sensorTimer->isActive()) m_sensorTimer->start(1000*4); @@ -230,7 +242,7 @@ void DataWorker::onRequestSensorInfo() void DataWorker::updateSensorValue() { - QMap tmpMap = systeminterface->get_sensor_info_qt(); + QMap tmpMap = m_systemInterface->get_sensor_info_qt(); emit sendSensorInfo(tmpMap); } @@ -238,118 +250,118 @@ void DataWorker::updateSensorValue() //--------------------theme void DataWorker::onRequestThemeData() { - QString currentTheme = sessioninterface->get_theme_qt(); - QStringList themeList = sessioninterface->get_themes_qt(); + QString currentTheme = m_sessionInterface->get_theme_qt(); + QStringList themeList = m_sessionInterface->get_themes_qt(); emit this->sendThemeList(currentTheme, themeList); } void DataWorker::onChangeSystemTheme(const QString &theme) { - sessioninterface->set_theme_qt(theme); + m_sessionInterface->set_theme_qt(theme); } //---------------------icon void DataWorker::onRequestIconData() { - QString current_icon_theme = sessioninterface->get_icon_theme_qt(); - QStringList iconlist = sessioninterface->get_icon_themes_qt(); + QString current_icon_theme = m_sessionInterface->get_icon_theme_qt(); + QStringList iconlist = m_sessionInterface->get_icon_themes_qt(); emit this->sendIconThemeList(current_icon_theme, iconlist); - bool computer = sessioninterface->get_show_computer_qt(); - bool folder = sessioninterface->get_show_homefolder_qt(); - bool network = sessioninterface->get_show_network_qt(); - bool recycle = sessioninterface->get_show_trash_qt(); - bool disk = sessioninterface->get_show_devices_qt(); + bool computer = m_sessionInterface->get_show_computer_qt(); + bool folder = m_sessionInterface->get_show_homefolder_qt(); + bool network = m_sessionInterface->get_show_network_qt(); + bool recycle = m_sessionInterface->get_show_trash_qt(); + bool disk = m_sessionInterface->get_show_devices_qt(); emit this->sendDisplayIconValue(computer, folder, network, recycle, disk); } void DataWorker::onResetIconTheme(const QString &theme) { - sessioninterface->set_icon_theme_qt(theme); + m_sessionInterface->set_icon_theme_qt(theme); } void DataWorker::onDisplayComputerIcon(bool b) { - sessioninterface->set_show_computer_qt(b); + m_sessionInterface->set_show_computer_qt(b); } void DataWorker::onDisplayFolderIcon(bool b) { - sessioninterface->set_show_homefolder_qt(b); + m_sessionInterface->set_show_homefolder_qt(b); } void DataWorker::onDisplayNetworkIcon(bool b) { - sessioninterface->set_show_network_qt(b); + m_sessionInterface->set_show_network_qt(b); } void DataWorker::onDisplayRecycleBinIcon(bool b) { - sessioninterface->set_show_trash_qt(b); + m_sessionInterface->set_show_trash_qt(b); } void DataWorker::onDisplayDiskIcon(bool b) { - sessioninterface->set_show_devices_qt(b); + m_sessionInterface->set_show_devices_qt(b); } //---------------mouse void DataWorker::onRequestMouseData() { - QString current_cursor_theme = sessioninterface->get_cursor_theme_qt(); - int default_cursor_value = sessioninterface->get_cursor_size_qt(); - QStringList themeList = sessioninterface->get_cursor_themes_qt(); + QString current_cursor_theme = m_sessionInterface->get_cursor_theme_qt(); + int default_cursor_value = m_sessionInterface->get_cursor_size_qt(); + QStringList themeList = m_sessionInterface->get_cursor_themes_qt(); emit this->sendMouseThemeAndCusorSize(current_cursor_theme, themeList, default_cursor_value); } void DataWorker::onResetMouseCursorTheme(const QString &theme) { - sessioninterface->set_cursor_theme_qt(theme); - systeminterface->set_cursor_theme_with_root_qt(theme); + m_sessionInterface->set_cursor_theme_qt(theme); + m_systemInterface->set_cursor_theme_with_root_qt(theme); } void DataWorker::onResetMouseCursorSize(int cursorSize) { - sessioninterface->set_cursor_size_qt(cursorSize); + m_sessionInterface->set_cursor_size_qt(cursorSize); } //---------------voice void DataWorker::onRequestSoundData() { - QString current_sound = sessioninterface->get_sound_theme_qt(); - QStringList soundlist = systeminterface->get_sound_themes_qt(); + QString current_sound = m_sessionInterface->get_sound_theme_qt(); + QStringList soundlist = m_systemInterface->get_sound_themes_qt(); emit this->sendSoundList(current_sound, soundlist); - bool login_music = sessioninterface->get_login_music_enable_qt(); - bool sound_event = sessioninterface->get_sound_event_enable_qt(); - bool input_sound = sessioninterface->get_input_feedback_sounds_enable_qt(); + bool login_music = m_sessionInterface->get_login_music_enable_qt(); + bool sound_event = m_sessionInterface->get_sound_event_enable_qt(); + bool input_sound = m_sessionInterface->get_input_feedback_sounds_enable_qt(); emit this->sendEnableSoundValue(login_music, sound_event, input_sound); } void DataWorker::onResetVoiceTheme(QString selectTheme) { - sessioninterface->set_sound_theme_qt(selectTheme); + m_sessionInterface->set_sound_theme_qt(selectTheme); } void DataWorker::onResetLoginTipVoice(bool b) { - sessioninterface->set_login_music_enable_qt(b); + m_sessionInterface->set_login_music_enable_qt(b); } void DataWorker::onResetEventVoice(bool b) { - sessioninterface->set_sound_event_enable_qt(b); + m_sessionInterface->set_sound_event_enable_qt(b); } void DataWorker::onResetInputFeedbackVoice(bool b) { - sessioninterface->set_input_feedback_sounds_enable_qt(b); + m_sessionInterface->set_input_feedback_sounds_enable_qt(b); } @@ -357,119 +369,119 @@ void DataWorker::onResetInputFeedbackVoice(bool b) void DataWorker::onRequestMateOrUnityPanelData(bool isMate) { if (isMate) { - bool app = sessioninterface->get_show_apps_qt(); - bool showDesktop = sessioninterface->get_show_desktop_qt(); - bool icon = sessioninterface->get_show_icon_qt(); - bool places = sessioninterface->get_show_places_qt(); + bool app = m_sessionInterface->get_show_apps_qt(); + bool showDesktop = m_sessionInterface->get_show_desktop_qt(); + bool icon = m_sessionInterface->get_show_icon_qt(); + bool places = m_sessionInterface->get_show_places_qt(); emit this->sendMatePanelValue(app, showDesktop, icon, places); } else { - int blur = sessioninterface->get_dash_blur_experimental_qt(); - double transparent = sessioninterface->get_panel_transparency_qt(); + int blur = m_sessionInterface->get_dash_blur_experimental_qt(); + double transparent = m_sessionInterface->get_panel_transparency_qt(); emit this->sendUnityBlurAndTransparencyValue(blur, transparent); - QString time_format = sessioninterface->get_time_format_qt(); - QStringList timelist = sessioninterface->get_all_time_format_qt(); - bool showSecond = sessioninterface->get_show_seconds_qt(); - bool showWeek = sessioninterface->get_show_week_qt(); - bool showDate = sessioninterface->get_show_date_qt(); + QString time_format = m_sessionInterface->get_time_format_qt(); + QStringList timelist = m_sessionInterface->get_all_time_format_qt(); + bool showSecond = m_sessionInterface->get_show_seconds_qt(); + bool showWeek = m_sessionInterface->get_show_week_qt(); + bool showDate = m_sessionInterface->get_show_date_qt(); emit this->sendUnityTimeValue(time_format, timelist, showSecond, showWeek, showDate); - QString cur_power = sessioninterface->get_power_icon_policy_qt(); - QStringList powerlist = sessioninterface->get_all_power_icon_policy_qt(); - bool showPower = sessioninterface->get_show_power_percentage_qt(); - bool showBatteryTime = sessioninterface->get_show_power_time_qt(); + QString cur_power = m_sessionInterface->get_power_icon_policy_qt(); + QStringList powerlist = m_sessionInterface->get_all_power_icon_policy_qt(); + bool showPower = m_sessionInterface->get_show_power_percentage_qt(); + bool showBatteryTime = m_sessionInterface->get_show_power_time_qt(); emit this->sendUnityPanelPowerValue(cur_power, powerlist, showPower, showBatteryTime); } } void DataWorker::onResetPanelTransparencyValue(double value) { - sessioninterface->set_panel_transparency_qt(value); + m_sessionInterface->set_panel_transparency_qt(value); } void DataWorker::onResetDateFormat(const QString &selected) { - sessioninterface->set_time_format_qt(selected); + m_sessionInterface->set_time_format_qt(selected); } void DataWorker::onResetShowBatteryIcon(const QString &selected) { - sessioninterface->set_power_icon_policy_qt(selected); + m_sessionInterface->set_power_icon_policy_qt(selected); } void DataWorker::onResetDashBlurExperimental(int value) { - sessioninterface->set_dash_blur_experimental_qt(value); + m_sessionInterface->set_dash_blur_experimental_qt(value); } void DataWorker::onResetDisplaySeconds(bool b) { - sessioninterface->set_show_seconds_qt(b); + m_sessionInterface->set_show_seconds_qt(b); } void DataWorker::onResetDisplayWeek(bool b) { - sessioninterface->set_show_week_qt(b); + m_sessionInterface->set_show_week_qt(b); } void DataWorker::onResetDisplayDate(bool b) { - sessioninterface->set_show_date_qt(b); + m_sessionInterface->set_show_date_qt(b); } void DataWorker::onResetDisplayBatteryPercentage(bool b) { - sessioninterface->set_show_power_percentage_qt(b); + m_sessionInterface->set_show_power_percentage_qt(b); } void DataWorker::onResetDisplayBatteryTime(bool b) { - sessioninterface->set_show_power_time_qt(b); + m_sessionInterface->set_show_power_time_qt(b); } void DataWorker::onResetShowApplications(bool b) { - sessioninterface->set_show_apps_qt(b); + m_sessionInterface->set_show_apps_qt(b); } void DataWorker::onResetShowDesktop(bool b) { - sessioninterface->set_show_desktop_qt(b); + m_sessionInterface->set_show_desktop_qt(b); } void DataWorker::onResetShowIcon(bool b) { - sessioninterface->set_show_icon_qt(b); + m_sessionInterface->set_show_icon_qt(b); } void DataWorker::onResetShowPlaces(bool b) { - sessioninterface->set_show_places_qt(b); + m_sessionInterface->set_show_places_qt(b); } //--------------------launcher menu void DataWorker::onRequestMateOrUnityMenuData(bool isMate) { if (isMate) { - int topIconSize = sessioninterface->get_mate_panel_icon_size_qt("top"); - int bottomIconSize = sessioninterface->get_mate_panel_icon_size_qt("bottom"); - bool topIconHide = sessioninterface->get_mate_panel_autohide_qt("top"); - bool bottomIconHide = sessioninterface->get_mate_panel_autohide_qt("bottom"); + int topIconSize = m_sessionInterface->get_mate_panel_icon_size_qt("top"); + int bottomIconSize = m_sessionInterface->get_mate_panel_icon_size_qt("bottom"); + bool topIconHide = m_sessionInterface->get_mate_panel_autohide_qt("top"); + bool bottomIconHide = m_sessionInterface->get_mate_panel_autohide_qt("bottom"); emit this->sendMatePanelIconValue(topIconSize, bottomIconSize, topIconHide, bottomIconHide); } else { - int iconSize = sessioninterface->get_launcher_icon_size_qt(); - bool iconHide = sessioninterface->get_launcher_autohide_qt(); - bool desktopIconShowed = sessioninterface->get_launcher_have_showdesktopicon_qt(); - double launcherTransparency = sessioninterface->get_launcher_transparency_qt();//TODO:WTF is 0???? - int iconColourIndex = sessioninterface->get_launcher_icon_colouring_qt(); - QStringList colourlist = sessioninterface->get_all_launcher_icon_colourings_qt(); + int iconSize = m_sessionInterface->get_launcher_icon_size_qt(); + bool iconHide = m_sessionInterface->get_launcher_autohide_qt(); + bool desktopIconShowed = m_sessionInterface->get_launcher_have_showdesktopicon_qt(); + double launcherTransparency = m_sessionInterface->get_launcher_transparency_qt();//TODO:WTF is 0???? + int iconColourIndex = m_sessionInterface->get_launcher_icon_colouring_qt(); + QStringList colourlist = m_sessionInterface->get_all_launcher_icon_colourings_qt(); emit this->sendUnityIconValue(iconSize, iconHide, desktopIconShowed, launcherTransparency, iconColourIndex, colourlist); - QString current_position = sessioninterface->get_current_launcher_position_qt(); - QStringList positionlist = sessioninterface->get_all_launcher_position_qt(); + QString current_position = m_sessionInterface->get_current_launcher_position_qt(); + QStringList positionlist = m_sessionInterface->get_all_launcher_position_qt(); // qDebug() <<"positionlist="<sendUnityLauncherPosition(current_position, positionlist); } @@ -477,110 +489,110 @@ void DataWorker::onRequestMateOrUnityMenuData(bool isMate) void DataWorker::onResetIconSizeValue(int value) { - sessioninterface->set_launcher_icon_size_qt(value); + m_sessionInterface->set_launcher_icon_size_qt(value); } void DataWorker::onResetTransparencyValue(int value) { - sessioninterface->set_launcher_transparency_qt(value); + m_sessionInterface->set_launcher_transparency_qt(value); } void DataWorker::onResetIconColouring(int value) { - sessioninterface->set_launcher_icon_colouring_qt(value); + m_sessionInterface->set_launcher_icon_colouring_qt(value); } void DataWorker::onResetAutoHide(bool b) { - sessioninterface->set_launcher_autohide_qt(b); + m_sessionInterface->set_launcher_autohide_qt(b); } void DataWorker::onResetDisplayDesktopIcon(bool b) { - sessioninterface->set_launcher_have_showdesktopicon_qt(b); + m_sessionInterface->set_launcher_have_showdesktopicon_qt(b); } void DataWorker::onResetTopIconSizeValue(int value) { - sessioninterface->set_mate_panel_icon_size_qt("top", value); + m_sessionInterface->set_mate_panel_icon_size_qt("top", value); } void DataWorker::onResetBottomIconSizeValue(int value) { - sessioninterface->set_mate_panel_icon_size_qt("bottom", value); + m_sessionInterface->set_mate_panel_icon_size_qt("bottom", value); } void DataWorker::onResetTopAutoHide(bool b) { - sessioninterface->set_mate_panel_autohide_qt("top", b); + m_sessionInterface->set_mate_panel_autohide_qt("top", b); } void DataWorker::onResetBottomAutoHide(bool b) { - sessioninterface->set_mate_panel_autohide_qt("bottom", b); + m_sessionInterface->set_mate_panel_autohide_qt("bottom", b); } void DataWorker::onResetLauncherPosition(const QString &position) { - sessioninterface->set_launcher_position_qt(position); + m_sessionInterface->set_launcher_position_qt(position); } //-----------------window void DataWorker::onRequesetWindowButtonAlign() { - QString current_value = sessioninterface->get_window_button_align_qt(); + QString current_value = m_sessionInterface->get_window_button_align_qt(); emit this->sendWindowButtonAlign(current_value); } void DataWorker::onRequesetMenusHaveIcons() { - bool menuHaveIcons = sessioninterface->get_menus_have_icons_qt(); + bool menuHaveIcons = m_sessionInterface->get_menus_have_icons_qt(); emit this->sendMenusHaveIcons(menuHaveIcons); } void DataWorker::onRequesetWindowTitileTags() { - QString current_wheel_type = sessioninterface->get_current_titlebar_wheel_qt(); - QStringList wheellist = sessioninterface->get_titlebar_wheel_qt(); - QString current_double_type = sessioninterface->get_current_titlebar_double_qt(); - QStringList titlebarOptions = sessioninterface->get_titlebar_options_qt(); - QString current_middle_type = sessioninterface->get_current_titlebar_middle_qt(); - QString current_right_type = sessioninterface->get_current_titlebar_right_qt(); + QString current_wheel_type = m_sessionInterface->get_current_titlebar_wheel_qt(); + QStringList wheellist = m_sessionInterface->get_titlebar_wheel_qt(); + QString current_double_type = m_sessionInterface->get_current_titlebar_double_qt(); + QStringList titlebarOptions = m_sessionInterface->get_titlebar_options_qt(); + QString current_middle_type = m_sessionInterface->get_current_titlebar_middle_qt(); + QString current_right_type = m_sessionInterface->get_current_titlebar_right_qt(); emit this->sendWindowTitileTags(current_wheel_type, wheellist, titlebarOptions, current_double_type, current_middle_type, current_right_type); } void DataWorker::onResetMenusHaveIcon(bool b) { - sessioninterface->set_menus_have_icons_qt(b); + m_sessionInterface->set_menus_have_icons_qt(b); } void DataWorker::onResetTitlebarWheel(const QString &selected) { - sessioninterface->set_titlebar_wheel_qt(selected); + m_sessionInterface->set_titlebar_wheel_qt(selected); } void DataWorker::onResetTitlebarDoubleClick(const QString &selected) { - sessioninterface->set_titlebar_double_qt(selected); + m_sessionInterface->set_titlebar_double_qt(selected); } void DataWorker::onResetMouseMiddleClick(const QString &selected) { - sessioninterface->set_titlebar_middle_qt(selected); + m_sessionInterface->set_titlebar_middle_qt(selected); } void DataWorker::onResetMouseRightClick(const QString &selected) { - sessioninterface->set_titlebar_right_qt(selected); + m_sessionInterface->set_titlebar_right_qt(selected); } void DataWorker::onResetWindowButtonLeftOrRightAlign(bool isLeft) { if (isLeft) - sessioninterface->set_window_button_align_left_qt(); + m_sessionInterface->set_window_button_align_left_qt(); else - sessioninterface->set_window_button_align_right_qt(); + m_sessionInterface->set_window_button_align_right_qt(); } @@ -588,10 +600,10 @@ void DataWorker::onResetWindowButtonLeftOrRightAlign(bool isLeft) //-----------------------font void DataWorker::onRequestFontData() { - QString current_font = sessioninterface->get_font_qt(); + QString current_font = m_sessionInterface->get_font_qt(); emit sendFontValue(current_font); - QString desktop_font = sessioninterface->get_desktop_font_qt(); + QString desktop_font = m_sessionInterface->get_desktop_font_qt(); if(desktop_font.isEmpty()) { // sessionproxy->set_desktop_font_qt_default(); @@ -599,129 +611,129 @@ void DataWorker::onRequestFontData() desktop_font = "Sans 10"; else desktop_font = "Ubuntu 11"; - sessioninterface->set_desktop_font_qt(desktop_font); + m_sessionInterface->set_desktop_font_qt(desktop_font); } - desktop_font = sessioninterface->get_desktop_font_qt(); + desktop_font = m_sessionInterface->get_desktop_font_qt(); emit sendDesktopFontValue(desktop_font); - QString monospace_font = sessioninterface->get_monospace_font_qt(); + QString monospace_font = m_sessionInterface->get_monospace_font_qt(); emit sendMonospaceFontValue(monospace_font); - QString document_font = sessioninterface->get_document_font_qt(); + QString document_font = m_sessionInterface->get_document_font_qt(); emit sendDocumentFontValue(document_font); - QString titlebar_font = sessioninterface->get_window_title_font_qt(); + QString titlebar_font = m_sessionInterface->get_window_title_font_qt(); emit sendTitlebarFontValue(titlebar_font); double fontZoom = 0.0; if (this->desktop != "mate" || this->desktop == "MATE") { - fontZoom = sessioninterface->get_font_zoom_qt(); + fontZoom = m_sessionInterface->get_font_zoom_qt(); } - QString current_smooth = sessioninterface->get_smooth_style_qt(); - QStringList smoothlist = sessioninterface->get_smooth_style_list_qt(); - QString current_antialiasing = sessioninterface->get_antialiasing_style_qt(); - QStringList antialiasinglist = sessioninterface->get_antialiasing_style_list_qt(); + QString current_smooth = m_sessionInterface->get_smooth_style_qt(); + QStringList smoothlist = m_sessionInterface->get_smooth_style_list_qt(); + QString current_antialiasing = m_sessionInterface->get_antialiasing_style_qt(); + QStringList antialiasinglist = m_sessionInterface->get_antialiasing_style_list_qt(); emit sendFontSmoothAndAntialiasingValue(fontZoom, current_smooth, smoothlist, current_antialiasing, antialiasinglist); } void DataWorker::onSetDefaultFontByName(const QString &cur_font) { - sessioninterface->set_font_qt(cur_font); + m_sessionInterface->set_font_qt(cur_font); } void DataWorker::onSetDesktopFontByName(const QString &cur_font) { - sessioninterface->set_desktop_font_qt(cur_font); + m_sessionInterface->set_desktop_font_qt(cur_font); } void DataWorker::onSetMonospaceFontByName(const QString &cur_font) { - sessioninterface->set_monospace_font_qt(cur_font); + m_sessionInterface->set_monospace_font_qt(cur_font); } void DataWorker::onSetDocumentFontByName(const QString &cur_font) { - sessioninterface->set_document_font_qt(cur_font); + m_sessionInterface->set_document_font_qt(cur_font); } void DataWorker::onSetTitlebarFontByName(const QString &cur_font) { - sessioninterface->set_window_title_font_qt(cur_font); + m_sessionInterface->set_window_title_font_qt(cur_font); } void DataWorker::onResetFontZoomScalingValue(double value) { - sessioninterface->set_font_zoom_qt(value); + m_sessionInterface->set_font_zoom_qt(value); } void DataWorker::onResetFontHinting(const QString &selected) { - sessioninterface->set_smooth_style_qt(selected); + m_sessionInterface->set_smooth_style_qt(selected); } void DataWorker::onResetFontAntialiasing(const QString &selected) { - sessioninterface->set_antialiasing_style_qt(selected); + m_sessionInterface->set_antialiasing_style_qt(selected); } void DataWorker::onRestoreDefaultFont(bool isMate) { if (isMate) { - sessioninterface->set_default_font_string_qt("org.mate.interface", "font-name", "string"); - emit sendDesktopFontValue(sessioninterface->get_default_font_string_qt("org.mate.interface", "font-name")); + m_sessionInterface->set_default_font_string_qt("org.mate.interface", "font-name", "string"); + emit sendDesktopFontValue(m_sessionInterface->get_default_font_string_qt("org.mate.interface", "font-name")); } else { - sessioninterface->set_default_font_string_qt("org.gnome.desktop.interface", "font-name", "string"); - emit sendDesktopFontValue(sessioninterface->get_default_font_string_qt("org.gnome.desktop.interface", "font-name")); + m_sessionInterface->set_default_font_string_qt("org.gnome.desktop.interface", "font-name", "string"); + emit sendDesktopFontValue(m_sessionInterface->get_default_font_string_qt("org.gnome.desktop.interface", "font-name")); } } void DataWorker::onRestoreDesktopDefaultFont(bool isMate) { if (isMate) { - sessioninterface->set_default_font_string_qt("org.mate.caja.desktop", "font", "string"); - emit sendDesktopFontValue(sessioninterface->get_default_font_string_qt("org.mate.caja.desktop", "font")); + m_sessionInterface->set_default_font_string_qt("org.mate.caja.desktop", "font", "string"); + emit sendDesktopFontValue(m_sessionInterface->get_default_font_string_qt("org.mate.caja.desktop", "font")); } else { - sessioninterface->set_default_font_string_qt("org.gnome.nautilus.desktop", "font", "string"); - emit sendDesktopFontValue(sessioninterface->get_default_font_string_qt("org.gnome.nautilus.desktop", "font")); + m_sessionInterface->set_default_font_string_qt("org.gnome.nautilus.desktop", "font", "string"); + emit sendDesktopFontValue(m_sessionInterface->get_default_font_string_qt("org.gnome.nautilus.desktop", "font")); } } void DataWorker::onRestoreMonospaceDefaultFont(bool isMate) { if (isMate) { - sessioninterface->set_default_font_string_qt("org.mate.interface", "monospace-font-name", "string"); - emit sendMonospaceFontValue(sessioninterface->get_default_font_string_qt("org.mate.interface", "monospace-font-name")); + m_sessionInterface->set_default_font_string_qt("org.mate.interface", "monospace-font-name", "string"); + emit sendMonospaceFontValue(m_sessionInterface->get_default_font_string_qt("org.mate.interface", "monospace-font-name")); } else { - sessioninterface->set_default_font_string_qt("org.gnome.desktop.interface", "monospace-font-name", "string"); - emit sendMonospaceFontValue(sessioninterface->get_default_font_string_qt("org.gnome.desktop.interface", "monospace-font-name")); + m_sessionInterface->set_default_font_string_qt("org.gnome.desktop.interface", "monospace-font-name", "string"); + emit sendMonospaceFontValue(m_sessionInterface->get_default_font_string_qt("org.gnome.desktop.interface", "monospace-font-name")); } } void DataWorker::onRestoreDocumentDefaultFont(bool isMate) { if (isMate) { - sessioninterface->set_default_font_string_qt("org.mate.interface", "document-font-name", "string"); - emit sendDocumentFontValue(sessioninterface->get_default_font_string_qt("org.mate.interface", "document-font-name")); + m_sessionInterface->set_default_font_string_qt("org.mate.interface", "document-font-name", "string"); + emit sendDocumentFontValue(m_sessionInterface->get_default_font_string_qt("org.mate.interface", "document-font-name")); } else { - sessioninterface->set_default_font_string_qt("org.gnome.desktop.interface", "document-font-name", "string"); - emit sendDocumentFontValue(sessioninterface->get_default_font_string_qt("org.gnome.desktop.interface", "document-font-name")); + m_sessionInterface->set_default_font_string_qt("org.gnome.desktop.interface", "document-font-name", "string"); + emit sendDocumentFontValue(m_sessionInterface->get_default_font_string_qt("org.gnome.desktop.interface", "document-font-name")); } } void DataWorker::onRestoreTitlebarDefaultFont(bool isMate) { if (isMate) { - sessioninterface->set_default_font_string_qt("org.gnome.desktop.wm.preferences", "titlebar-font", "string"); - emit sendTitlebarFontValue(sessioninterface->get_default_font_string_qt("org.gnome.desktop.wm.preferences", "titlebar-font")); + m_sessionInterface->set_default_font_string_qt("org.gnome.desktop.wm.preferences", "titlebar-font", "string"); + emit sendTitlebarFontValue(m_sessionInterface->get_default_font_string_qt("org.gnome.desktop.wm.preferences", "titlebar-font")); } else { - sessioninterface->set_default_font_string_qt("org.gnome.desktop.wm.preferences", "titlebar-font", "string"); - emit sendTitlebarFontValue(sessioninterface->get_default_font_string_qt("org.gnome.desktop.wm.preferences", "titlebar-font")); + m_sessionInterface->set_default_font_string_qt("org.gnome.desktop.wm.preferences", "titlebar-font", "string"); + emit sendTitlebarFontValue(m_sessionInterface->get_default_font_string_qt("org.gnome.desktop.wm.preferences", "titlebar-font")); } } @@ -730,54 +742,54 @@ void DataWorker::onRestoreTitlebarDefaultFont(bool isMate) //-------------------touchpad void DataWorker::onRequestMateOrUnityTouchpadData(bool isMate) { - bool touchpadEnable = sessioninterface->get_touchpad_enable_qt(); - bool touchscrollingHorizontal = sessioninterface->get_touchscrolling_use_horizontal_qt(); - QString mode_value = sessioninterface->get_scrollbars_mode_qt(); + bool touchpadEnable = m_sessionInterface->get_touchpad_enable_qt(); + bool touchscrollingHorizontal = m_sessionInterface->get_touchscrolling_use_horizontal_qt(); + QString mode_value = m_sessionInterface->get_scrollbars_mode_qt(); int scroll_int_value = 0; QString scroll_string_value = ""; if (isMate) - scroll_int_value = sessioninterface->get_mate_touchscrolling_mode_qt(); + scroll_int_value = m_sessionInterface->get_mate_touchscrolling_mode_qt(); else - scroll_string_value = sessioninterface->get_touchscrolling_mode_qt(); + scroll_string_value = m_sessionInterface->get_touchscrolling_mode_qt(); emit sendTouchPadValue(touchpadEnable, touchscrollingHorizontal, mode_value, scroll_int_value, scroll_string_value); } void DataWorker::onResetTouchpad(bool b) { - sessioninterface->set_touchpad_enable_qt(b); + m_sessionInterface->set_touchpad_enable_qt(b); } void DataWorker::onResetHorizontalScrolling(bool b) { - sessioninterface->set_touchscrolling_use_horizontal_qt(b); + m_sessionInterface->set_touchscrolling_use_horizontal_qt(b); } void DataWorker::onSetScrollbarOverlayOrLegacyMode(bool b) { if (b) { - sessioninterface->set_scrollbars_mode_overlay_qt(); + m_sessionInterface->set_scrollbars_mode_overlay_qt(); } else { - sessioninterface->set_scrollbars_mode_legacy_qt(); + m_sessionInterface->set_scrollbars_mode_legacy_qt(); } } void DataWorker::onSetMateTouchscrollingMode(int flag) { - sessioninterface->set_mate_touchscrolling_mode_qt(flag); + m_sessionInterface->set_mate_touchscrolling_mode_qt(flag); } void DataWorker::onSetUnityTouchscrollingMode(int flag) { if (flag == 0) { - sessioninterface->set_touchscrolling_mode_disabled_qt(); + m_sessionInterface->set_touchscrolling_mode_disabled_qt(); } else if (flag == 1) { - sessioninterface->set_touchscrolling_mode_edge_qt(); + m_sessionInterface->set_touchscrolling_mode_edge_qt(); } else if (flag == 2) { - sessioninterface->set_touchscrolling_mode_twofinger_qt(); + m_sessionInterface->set_touchscrolling_mode_twofinger_qt(); } } @@ -785,186 +797,186 @@ void DataWorker::onSetUnityTouchscrollingMode(int flag) //---------------------ac and battery void DataWorker::onRequestPowerAndBatteryData() { - double gamma = sessioninterface->get_screen_gamma_qt(); - QStringList aclist = sessioninterface->get_sleep_timeout_list_qt(); + double gamma = m_sessionInterface->get_screen_gamma_qt(); + QStringList aclist = m_sessionInterface->get_sleep_timeout_list_qt(); int brightnessValue = -1; QString sleep_timeout_display_battery = ""; QString sleep_timeout_display_ac = ""; if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui") { - sleep_timeout_display_battery = sessioninterface->get_current_sleep_timeout_display_battery_qt(); - sleep_timeout_display_ac = sessioninterface->get_current_sleep_timeout_display_ac_qt(); + sleep_timeout_display_battery = m_sessionInterface->get_current_sleep_timeout_display_battery_qt(); + sleep_timeout_display_ac = m_sessionInterface->get_current_sleep_timeout_display_ac_qt(); } else { - QDBusReply reply = iface->call("GetPercentage"); + QDBusReply reply = m_powerIface->call("GetPercentage"); if (reply.isValid()) { brightnessValue = reply.value(); } } - QString idle_delay = sessioninterface->get_current_idle_delay_qt(); - QStringList idledelaylist = sessioninterface->get_idle_delay_list_qt(); + QString idle_delay = m_sessionInterface->get_current_idle_delay_qt(); + QStringList idledelaylist = m_sessionInterface->get_idle_delay_list_qt(); emit sendIdleAndGammaData(gamma, aclist, brightnessValue, sleep_timeout_display_battery, sleep_timeout_display_ac, idle_delay, idledelaylist); - bool lockEnabled = sessioninterface->get_lock_enabled_qt(); - QString lock_delay = sessioninterface->get_current_lock_delay_qt(); - QStringList lockdelaylist = sessioninterface->get_lock_delay_list_qt(); - QString critical_low = sessioninterface->get_current_critical_low_qt(); - QString laptop_battery = sessioninterface->get_current_lid_battery_qt(); - QString laptop_ac = sessioninterface->get_current_lid_ac_qt(); - QString sleep_timeout_battery = sessioninterface->get_current_sleep_timeout_battery_qt(); - QStringList batterylist = sessioninterface->get_sleep_timeout_list_qt(); - QString sleep_timeout_ac = sessioninterface->get_current_sleep_timeout_ac_qt(); + bool lockEnabled = m_sessionInterface->get_lock_enabled_qt(); + QString lock_delay = m_sessionInterface->get_current_lock_delay_qt(); + QStringList lockdelaylist = m_sessionInterface->get_lock_delay_list_qt(); + QString critical_low = m_sessionInterface->get_current_critical_low_qt(); + QString laptop_battery = m_sessionInterface->get_current_lid_battery_qt(); + QString laptop_ac = m_sessionInterface->get_current_lid_ac_qt(); + QString sleep_timeout_battery = m_sessionInterface->get_current_sleep_timeout_battery_qt(); + QStringList batterylist = m_sessionInterface->get_sleep_timeout_list_qt(); + QString sleep_timeout_ac = m_sessionInterface->get_current_sleep_timeout_ac_qt(); emit sendLockAndSleepData(lockEnabled, lock_delay, lockdelaylist, critical_low, laptop_battery, laptop_ac, sleep_timeout_battery, batterylist, sleep_timeout_ac); } void DataWorker::onResetScreenGammaValue(double value) { - sessioninterface->adjust_screen_gamma_qt(value); + m_sessionInterface->adjust_screen_gamma_qt(value); } void DataWorker::onResetBrightnessValue(int value) { - iface->call("setPercentage", value); + m_powerIface->call("setPercentage", value); } void DataWorker::onResetIdleDelay(int index, int curValue) { if (index == 0) { - sessioninterface->set_current_idle_delay_qt(60); + m_sessionInterface->set_current_idle_delay_qt(60); } else if (index == 1) { - sessioninterface->set_current_idle_delay_qt(120); + m_sessionInterface->set_current_idle_delay_qt(120); } else if (index == 2) { - sessioninterface->set_current_idle_delay_qt(180); + m_sessionInterface->set_current_idle_delay_qt(180); } else if (index == 3) { - sessioninterface->set_current_idle_delay_qt(300); + m_sessionInterface->set_current_idle_delay_qt(300); } else if (index == 4) { - sessioninterface->set_current_idle_delay_qt(600); + m_sessionInterface->set_current_idle_delay_qt(600); } else if (index == 5) { - sessioninterface->set_current_idle_delay_qt(1800); + m_sessionInterface->set_current_idle_delay_qt(1800); } else if (index == 6) { - sessioninterface->set_current_idle_delay_qt(3600); + m_sessionInterface->set_current_idle_delay_qt(3600); } else if (index == 7) { - sessioninterface->set_current_idle_delay_qt(0); + m_sessionInterface->set_current_idle_delay_qt(0); } else if (index == 8) { - sessioninterface->set_current_idle_delay_qt(curValue); + m_sessionInterface->set_current_idle_delay_qt(curValue); } } void DataWorker::onResetLockEnabled(bool b) { - sessioninterface->set_lock_enabled_qt(b); + m_sessionInterface->set_lock_enabled_qt(b); } void DataWorker::onResetLockDelay(int index, int curValue) { if (index == 0) { - sessioninterface->set_current_lock_delay_qt(30); + m_sessionInterface->set_current_lock_delay_qt(30); } else if (index == 1) { - sessioninterface->set_current_lock_delay_qt(60); + m_sessionInterface->set_current_lock_delay_qt(60); } else if (index == 2) { - sessioninterface->set_current_lock_delay_qt(120); + m_sessionInterface->set_current_lock_delay_qt(120); } else if (index == 3) { - sessioninterface->set_current_lock_delay_qt(180); + m_sessionInterface->set_current_lock_delay_qt(180); } else if (index == 4) { - sessioninterface->set_current_lock_delay_qt(300); + m_sessionInterface->set_current_lock_delay_qt(300); } else if (index == 5) { - sessioninterface->set_current_lock_delay_qt(600); + m_sessionInterface->set_current_lock_delay_qt(600); } else if (index == 6) { - sessioninterface->set_current_lock_delay_qt(1800); + m_sessionInterface->set_current_lock_delay_qt(1800); } else if (index == 7) { - sessioninterface->set_current_lock_delay_qt(3600); + m_sessionInterface->set_current_lock_delay_qt(3600); } else if (index == 8) { - sessioninterface->set_current_lock_delay_qt(0); + m_sessionInterface->set_current_lock_delay_qt(0); } else if (index == 9) { - sessioninterface->set_current_lock_delay_qt(curValue); + m_sessionInterface->set_current_lock_delay_qt(curValue); } } void DataWorker::onSetCurrentCriticalLow(const QString &value) { - sessioninterface->set_current_critical_low_qt(value); + m_sessionInterface->set_current_critical_low_qt(value); } void DataWorker::onSetCurrentLidBattery(const QString &value) { - sessioninterface->set_current_lid_battery_qt(value); + m_sessionInterface->set_current_lid_battery_qt(value); } void DataWorker::onSetCurrentLidAC(const QString &value) { - sessioninterface->set_current_lid_ac_qt(value); + m_sessionInterface->set_current_lid_ac_qt(value); } void DataWorker::onResetSleepTimeoutBattery(int index, int value) { if (index == 0) { - sessioninterface->set_current_sleep_timeout_battery_qt(300); + m_sessionInterface->set_current_sleep_timeout_battery_qt(300); } else if (index == 1) { - sessioninterface->set_current_sleep_timeout_battery_qt(600); + m_sessionInterface->set_current_sleep_timeout_battery_qt(600); } else if (index == 2) { - sessioninterface->set_current_sleep_timeout_battery_qt(1200); + m_sessionInterface->set_current_sleep_timeout_battery_qt(1200); } else if (index == 3) { - sessioninterface->set_current_sleep_timeout_battery_qt(1800); + m_sessionInterface->set_current_sleep_timeout_battery_qt(1800); } else if (index == 4) { - sessioninterface->set_current_sleep_timeout_battery_qt(3600); + m_sessionInterface->set_current_sleep_timeout_battery_qt(3600); } else if (index == 5) { - sessioninterface->set_current_sleep_timeout_battery_qt(7200); + m_sessionInterface->set_current_sleep_timeout_battery_qt(7200); } else if (index == 6) { - sessioninterface->set_current_sleep_timeout_battery_qt(0); + m_sessionInterface->set_current_sleep_timeout_battery_qt(0); } else if (index == 7) { - sessioninterface->set_current_sleep_timeout_battery_qt(value); + m_sessionInterface->set_current_sleep_timeout_battery_qt(value); } } @@ -972,35 +984,35 @@ void DataWorker::onResetSleepTimeoutAC(int index, int value) { if (index == 0) { - sessioninterface->set_current_sleep_timeout_ac_qt(300); + m_sessionInterface->set_current_sleep_timeout_ac_qt(300); } else if (index == 1) { - sessioninterface->set_current_sleep_timeout_ac_qt(600); + m_sessionInterface->set_current_sleep_timeout_ac_qt(600); } else if (index == 2) { - sessioninterface->set_current_sleep_timeout_ac_qt(1200); + m_sessionInterface->set_current_sleep_timeout_ac_qt(1200); } else if (index == 3) { - sessioninterface->set_current_sleep_timeout_ac_qt(1800); + m_sessionInterface->set_current_sleep_timeout_ac_qt(1800); } else if (index == 4) { - sessioninterface->set_current_sleep_timeout_ac_qt(3600); + m_sessionInterface->set_current_sleep_timeout_ac_qt(3600); } else if (index == 5) { - sessioninterface->set_current_sleep_timeout_ac_qt(7200); + m_sessionInterface->set_current_sleep_timeout_ac_qt(7200); } else if (index == 6) { - sessioninterface->set_current_sleep_timeout_ac_qt(0); + m_sessionInterface->set_current_sleep_timeout_ac_qt(0); } else if (index == 7) { - sessioninterface->set_current_sleep_timeout_ac_qt(value); + m_sessionInterface->set_current_sleep_timeout_ac_qt(value); } } @@ -1008,35 +1020,35 @@ void DataWorker::onResetSleepTimeoutDisplayBattery(int index, int value) { if (index == 0) { - sessioninterface->set_current_sleep_timeout_display_battery_qt(300); + m_sessionInterface->set_current_sleep_timeout_display_battery_qt(300); } else if (index == 1) { - sessioninterface->set_current_sleep_timeout_display_battery_qt(600); + m_sessionInterface->set_current_sleep_timeout_display_battery_qt(600); } else if (index == 2) { - sessioninterface->set_current_sleep_timeout_display_battery_qt(1200); + m_sessionInterface->set_current_sleep_timeout_display_battery_qt(1200); } else if (index == 3) { - sessioninterface->set_current_sleep_timeout_display_battery_qt(1800); + m_sessionInterface->set_current_sleep_timeout_display_battery_qt(1800); } else if (index == 4) { - sessioninterface->set_current_sleep_timeout_display_battery_qt(3600); + m_sessionInterface->set_current_sleep_timeout_display_battery_qt(3600); } else if (index == 5) { - sessioninterface->set_current_sleep_timeout_display_battery_qt(7200); + m_sessionInterface->set_current_sleep_timeout_display_battery_qt(7200); } else if (index == 6) { - sessioninterface->set_current_sleep_timeout_display_battery_qt(0); + m_sessionInterface->set_current_sleep_timeout_display_battery_qt(0); } else if (index == 7) { - sessioninterface->set_current_sleep_timeout_display_battery_qt(value); + m_sessionInterface->set_current_sleep_timeout_display_battery_qt(value); } } @@ -1044,35 +1056,35 @@ void DataWorker::onResetSleepTimeoutDisplayAC(int index, int value) { if (index == 0) { - sessioninterface->set_current_sleep_timeout_display_ac_qt(300); + m_sessionInterface->set_current_sleep_timeout_display_ac_qt(300); } else if (index == 1) { - sessioninterface->set_current_sleep_timeout_display_ac_qt(600); + m_sessionInterface->set_current_sleep_timeout_display_ac_qt(600); } else if (index == 2) { - sessioninterface->set_current_sleep_timeout_display_ac_qt(1200); + m_sessionInterface->set_current_sleep_timeout_display_ac_qt(1200); } else if (index == 3) { - sessioninterface->set_current_sleep_timeout_display_ac_qt(1800); + m_sessionInterface->set_current_sleep_timeout_display_ac_qt(1800); } else if (index == 4) { - sessioninterface->set_current_sleep_timeout_display_ac_qt(3600); + m_sessionInterface->set_current_sleep_timeout_display_ac_qt(3600); } else if (index == 5) { - sessioninterface->set_current_sleep_timeout_display_ac_qt(7200); + m_sessionInterface->set_current_sleep_timeout_display_ac_qt(7200); } else if (index == 6) { - sessioninterface->set_current_sleep_timeout_display_ac_qt(0); + m_sessionInterface->set_current_sleep_timeout_display_ac_qt(0); } else if (index == 7) { - sessioninterface->set_current_sleep_timeout_display_ac_qt(value); + m_sessionInterface->set_current_sleep_timeout_display_ac_qt(value); } } @@ -1080,13 +1092,13 @@ void DataWorker::onSetCurrentCpuMode(const QString &mode) { // qDebug() << "set cpu mode="<adjust_cpufreq_scaling_governer_qt("ondemand"); + m_systemInterface->adjust_cpufreq_scaling_governer_qt("ondemand"); } else if(mode == "powersaveradio") { - systeminterface->adjust_cpufreq_scaling_governer_qt("powersave"); + m_systemInterface->adjust_cpufreq_scaling_governer_qt("powersave"); } else if(mode == "performanceradio") { - systeminterface->adjust_cpufreq_scaling_governer_qt("performance"); + m_systemInterface->adjust_cpufreq_scaling_governer_qt("performance"); } } @@ -1094,48 +1106,48 @@ void DataWorker::onSetCurrentCpuMode(const QString &mode) //-------------------file manager void DataWorker::onRequestFileManagerData() { - bool locationReplacePathbar = sessioninterface->get_location_replace_pathbar_qt(); - bool autoMountMedia = sessioninterface->get_auto_mount_media_qt(); - bool autoOpenFolder = sessioninterface->get_auto_open_folder_qt(); - bool promptAutorunPrograms = sessioninterface->get_prompt_autorun_programs_qt(); - int thumbnailIconSize = sessioninterface->get_thumbnail_icon_size_qt(); - int thumbnailCacheTime = sessioninterface->get_thumbnail_cache_time_qt(); - int thumbnailCacheSize = sessioninterface->get_thumbnail_cache_size_qt(); + bool locationReplacePathbar = m_sessionInterface->get_location_replace_pathbar_qt(); + bool autoMountMedia = m_sessionInterface->get_auto_mount_media_qt(); + bool autoOpenFolder = m_sessionInterface->get_auto_open_folder_qt(); + bool promptAutorunPrograms = m_sessionInterface->get_prompt_autorun_programs_qt(); + int thumbnailIconSize = m_sessionInterface->get_thumbnail_icon_size_qt(); + int thumbnailCacheTime = m_sessionInterface->get_thumbnail_cache_time_qt(); + int thumbnailCacheSize = m_sessionInterface->get_thumbnail_cache_size_qt(); emit sendFileManagerData(locationReplacePathbar, autoMountMedia, autoOpenFolder, promptAutorunPrograms, thumbnailIconSize, thumbnailCacheTime, thumbnailCacheSize); } void DataWorker::onResetLocationReplacePathbar(bool b) { - sessioninterface->set_location_replace_pathbar_qt(b); + m_sessionInterface->set_location_replace_pathbar_qt(b); } void DataWorker::onResetAutoMountMedia(bool b) { - sessioninterface->set_auto_mount_media_qt(b); + m_sessionInterface->set_auto_mount_media_qt(b); } void DataWorker::onResetAutoOpenFolder(bool b) { - sessioninterface->set_auto_open_folder_qt(b); + m_sessionInterface->set_auto_open_folder_qt(b); } void DataWorker::onResetPromptAutorunPrograms(bool b) { - sessioninterface->set_prompt_autorun_programs_qt(b); + m_sessionInterface->set_prompt_autorun_programs_qt(b); } void DataWorker::onResetThumbnailIconSize(int value) { - sessioninterface->set_thumbnail_icon_size_qt(value); + m_sessionInterface->set_thumbnail_icon_size_qt(value); } void DataWorker::onResetThumbnailCacheTime(int value) { - sessioninterface->set_thumbnail_cache_time_qt(value); + m_sessionInterface->set_thumbnail_cache_time_qt(value); } void DataWorker::onResetThumbnailCacheSize(int value) { - sessioninterface->set_thumbnail_cache_size_qt(value); + m_sessionInterface->set_thumbnail_cache_size_qt(value); } diff --git a/src/dataworker.h b/src/dataworker.h index e1ad0b7..3f0a177 100644 --- a/src/dataworker.h +++ b/src/dataworker.h @@ -23,6 +23,10 @@ #include #include +#include "../qdbusservice/systemdbus/data/systemdbusproxy.h" +#include "../qdbusservice/systemdbus/customdata.h" +#include "../qdbusservice/systemdbus/customdatalist.h" + class QTimer; class SessionDispatcher; class SystemDispatcher; @@ -328,9 +332,10 @@ signals: void sendFileManagerData(bool locationReplacePathbar, bool autoMountMedia, bool autoOpenFolder, bool promptAutorunPrograms, int thumbnailIconSize, int thumbnailCacheTime, int thumbnailCacheSize); private: - QDBusInterface *iface = nullptr; - SessionDispatcher *sessioninterface = nullptr; - SystemDispatcher *systeminterface = nullptr; + QDBusInterface *m_powerIface = nullptr; + SessionDispatcher *m_sessionInterface = nullptr; + SystemDispatcher *m_systemInterface = nullptr; + SystemDbusProxy *m_qSystemDbus = nullptr; QString desktop; bool m_existBattery; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index aff5733..d7a1a36 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -28,10 +28,6 @@ //#include "cameramanager.h" #include "../component/threadpool.h" #include "dataworker.h" -#include "../qdbusservice/systemdbus/data/systemdbusproxy.h" -#include "../qdbusservice/systemdbus/customdata.h" -#include "../qdbusservice/systemdbus/customdatalist.h" - //QDBusPendingCallWatcher *m_getAllPendingCallWatcher; // QDBusError m_lastExtendedError; @@ -254,11 +250,6 @@ MainWindow::MainWindow(QString cur_arch, int d_count, QWidget* parent, Qt::Windo this->initAnimation(); this->hide(); - m_qSystemDbus = new SystemDbusProxy; - connect(m_qSystemDbus, &SystemDbusProxy::reportAlert, this, [ = ](int ret, const QString &description) { - qDebug() <<"ret="<startDbusDaemon(); // 添加阴影 @@ -271,7 +262,7 @@ MainWindow::MainWindow(QString cur_arch, int d_count, QWidget* parent, Qt::Windo MainWindow::~MainWindow() { - delete m_qSystemDbus; +// delete m_qSystemDbus; if (m_dataWorker) { m_dataWorker->deleteLater(); @@ -374,9 +365,6 @@ void MainWindow::onInitDataFinished() this->displayMainWindow(); - qDebug() << "m_qSystemDbus->demoInfo()===="<demoInfo(); - - qDebug() << m_qSystemDbus->getCustomData().hash; //bind setting notify signal // connect(m_dataWorker, SIGNAL(string_value_notify(QString,QString)), setting_widget, SIGNAL(string_value_notify(QString,QString))); // connect(m_dataWorker, SIGNAL(bool_value_notify(QString,bool)), setting_widget, SIGNAL(bool_value_notify(QString,bool))); @@ -960,7 +948,7 @@ void MainWindow::startDbusDaemon() // systeminterface = new SystemDispatcher; m_dataWorker = new DataWorker(this->desktop); - QThread *w_thread = ThreadPool::Instance()->newThread(); + QThread *w_thread = ThreadPool::Instance()->createNewThread(); m_dataWorker->moveToThread(w_thread); connect(w_thread, SIGNAL(started()), m_dataWorker, SLOT(doWork())); connect(m_dataWorker, SIGNAL(dataLoadFinished()), this, SLOT(onInitDataFinished())); diff --git a/src/mainwindow.h b/src/mainwindow.h index c63d7c0..e74026a 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -173,11 +173,7 @@ private: // QStringList skinlist; ShadowWidget *shadow_widget; int display_count; - - - DataWorker *m_dataWorker = nullptr; - SystemDbusProxy *m_qSystemDbus = nullptr; }; class GlobalData // define by hebing,just for transmit var