forked from openkylin/quarkai
Add mythread
This commit is contained in:
parent
d230c24648
commit
cf24b5949c
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "mythread.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QEventLoop>
|
||||
#include <QDebug>
|
||||
|
||||
MyThread::MyThread(QWidget *parent, QString command)
|
||||
{
|
||||
this->m_command = command;
|
||||
}
|
||||
|
||||
void MyThread::run()
|
||||
{
|
||||
QEventLoop eventloop;
|
||||
QProcess process;
|
||||
connect(&process, SIGNAL(finished(int)), &eventloop, SLOT(quit()));
|
||||
process.start(this->m_command);
|
||||
eventloop.exec();
|
||||
|
||||
QString re = process.readAll();
|
||||
if (!re.contains("Failure")) {
|
||||
this->m_result = true;
|
||||
}
|
||||
else {
|
||||
this->m_result = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool MyThread::getCommandRunResult()
|
||||
{
|
||||
return this->m_result;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
#include <QThread>
|
||||
|
||||
class MyThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyThread(QWidget *parent = 0, QString command = "");
|
||||
|
||||
void run();
|
||||
bool getCommandRunResult();
|
||||
|
||||
private:
|
||||
QString m_command;
|
||||
bool m_result;
|
||||
};
|
|
@ -40,10 +40,12 @@ SessionDispatcher::SessionDispatcher(QObject *parent)
|
|||
|
||||
// thread = new KThread(this);
|
||||
|
||||
/*
|
||||
//kobe
|
||||
check_thread = new KThread(this);
|
||||
scan_thread = new KThread(this);
|
||||
onekey_scan_thread = new KThread(this);
|
||||
*/
|
||||
|
||||
QObject::connect(sessioniface, SIGNAL(display_scan_process(QString)), this, SLOT(handler_scan_process(QString)));
|
||||
QObject::connect(sessioniface, SIGNAL(scan_complete(QString)), this, SLOT(handler_scan_complete(QString)));
|
||||
|
@ -65,7 +67,7 @@ SessionDispatcher::SessionDispatcher(QObject *parent)
|
|||
}
|
||||
|
||||
SessionDispatcher::~SessionDispatcher() {
|
||||
check_thread->terminate();
|
||||
/*check_thread->terminate();
|
||||
check_thread->wait();
|
||||
if(check_thread != NULL) {
|
||||
delete check_thread;
|
||||
|
@ -82,7 +84,7 @@ SessionDispatcher::~SessionDispatcher() {
|
|||
if(onekey_scan_thread != NULL) {
|
||||
delete onekey_scan_thread;
|
||||
onekey_scan_thread = NULL;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// thread->terminate();
|
||||
|
@ -99,7 +101,8 @@ SessionDispatcher::~SessionDispatcher() {
|
|||
}
|
||||
|
||||
//dbus服务退出
|
||||
void SessionDispatcher::exit_qt() {
|
||||
void SessionDispatcher::exit_qt()
|
||||
{
|
||||
sessioniface->call("exit");
|
||||
}
|
||||
|
||||
|
@ -109,7 +112,8 @@ QString SessionDispatcher::get_os_release_qt()
|
|||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::submit_uk_pingback() {
|
||||
bool SessionDispatcher::submit_uk_pingback()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("submit_uk_pingback", qApp->applicationVersion());
|
||||
return reply.value();
|
||||
}
|
||||
|
@ -120,11 +124,11 @@ QStringList SessionDispatcher::checkNewVersion()
|
|||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::start_check_source_useable_qt()
|
||||
void SessionDispatcher::start_check_source_useable_qt()
|
||||
{
|
||||
// QDBusReply<bool> reply = sessioniface->call("start_check_source_useable");
|
||||
// return reply.value();
|
||||
if (check_thread->isRunning()) {
|
||||
sessioniface->call("start_check_source_useable");
|
||||
|
||||
/*if (check_thread->isRunning()) {
|
||||
qDebug() << "check_thread is running......";
|
||||
}
|
||||
else {
|
||||
|
@ -134,7 +138,7 @@ bool SessionDispatcher::start_check_source_useable_qt()
|
|||
check_thread->start();
|
||||
// qDebug() << "check_thread is ready to run......";
|
||||
}
|
||||
return true;
|
||||
return true;*/
|
||||
}
|
||||
|
||||
void SessionDispatcher::runApp(QString pkgname)
|
||||
|
@ -209,7 +213,8 @@ void SessionDispatcher::handlerScanCleanerError(QString status)
|
|||
//// }
|
||||
//}
|
||||
|
||||
bool SessionDispatcher::judge_power_is_exists_qt() {
|
||||
bool SessionDispatcher::judge_power_is_exists_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("judge_power_is_exists");
|
||||
return reply.value();
|
||||
}
|
||||
|
@ -242,52 +247,63 @@ QMap<QString, QVariant> SessionDispatcher::read_battery_info_qt()
|
|||
}
|
||||
}
|
||||
|
||||
void SessionDispatcher::open_folder_qt(QString path) {
|
||||
void SessionDispatcher::open_folder_qt(QString path)
|
||||
{
|
||||
sessioniface->call("open_folder", path);
|
||||
}
|
||||
|
||||
void SessionDispatcher::check_user_qt() {
|
||||
void SessionDispatcher::check_user_qt()
|
||||
{
|
||||
// sessioniface->call("check_user");
|
||||
}
|
||||
|
||||
//弹出登录框
|
||||
void SessionDispatcher::popup_login_dialog() {
|
||||
void SessionDispatcher::popup_login_dialog()
|
||||
{
|
||||
//add ubuntukylin sso
|
||||
// sessioniface->call("slot_do_login_account");
|
||||
}
|
||||
|
||||
void SessionDispatcher::popup_register_dialog() {
|
||||
void SessionDispatcher::popup_register_dialog()
|
||||
{
|
||||
//add ubuntukylin sso
|
||||
// sessioniface->call("slot_do_register");
|
||||
}
|
||||
|
||||
//退出登录
|
||||
void SessionDispatcher::logout_ubuntukylin_account() {
|
||||
void SessionDispatcher::logout_ubuntukylin_account()
|
||||
{
|
||||
//add ubuntukylin sso
|
||||
// sessioniface->call("slot_do_logout");
|
||||
}
|
||||
|
||||
void SessionDispatcher::handlerYoukerID(QString displayName, QString emailAddress) {
|
||||
void SessionDispatcher::handlerYoukerID(QString displayName, QString emailAddress)
|
||||
{
|
||||
emit this->ssoSuccessSignal(displayName, emailAddress);
|
||||
}
|
||||
|
||||
void SessionDispatcher::handlerLogoutSuccess() {
|
||||
void SessionDispatcher::handlerLogoutSuccess()
|
||||
{
|
||||
emit this->ssoLoginLogoutSignal(true);
|
||||
}
|
||||
|
||||
void SessionDispatcher::handlerLoginFail() {
|
||||
void SessionDispatcher::handlerLoginFail()
|
||||
{
|
||||
emit this->ssoLoginLogoutSignal(false);
|
||||
}
|
||||
|
||||
void SessionDispatcher::handler_scan_complete(QString msg) {
|
||||
void SessionDispatcher::handler_scan_complete(QString msg)
|
||||
{
|
||||
emit finishScanWork(msg);
|
||||
}
|
||||
|
||||
void SessionDispatcher::handler_scan_process(QString msg) {
|
||||
void SessionDispatcher::handler_scan_process(QString msg)
|
||||
{
|
||||
emit isScanning(msg);
|
||||
}
|
||||
|
||||
void SessionDispatcher::handler_total_data_transmit(QString flag, QString msg) {
|
||||
void SessionDispatcher::handler_total_data_transmit(QString flag, QString msg)
|
||||
{
|
||||
emit tellScanResult(flag, msg);
|
||||
}
|
||||
|
||||
|
@ -296,12 +312,17 @@ void SessionDispatcher::handler_total_data_transmit(QString flag, QString msg) {
|
|||
// return locale;
|
||||
//}
|
||||
|
||||
void SessionDispatcher::onekey_scan_function_qt(QStringList selectedList) {
|
||||
void SessionDispatcher::onekey_scan_function_qt(QStringList selectedList)
|
||||
{
|
||||
// QMap<QString, QVariant> data;
|
||||
// thread->initValues(data, selectedList, sessioniface, "onekey_scan_function");
|
||||
// thread->start();
|
||||
|
||||
if (scan_thread->isRunning()) {
|
||||
|
||||
sessioniface->call("onekey_scan_function", selectedList);
|
||||
|
||||
|
||||
/*if (scan_thread->isRunning()) {
|
||||
qDebug() << "onekey_scan_thread is running......";
|
||||
}
|
||||
else {
|
||||
|
@ -309,15 +330,14 @@ void SessionDispatcher::onekey_scan_function_qt(QStringList selectedList) {
|
|||
QMap<QString, QVariant> data;
|
||||
onekey_scan_thread->initValues(data, selectedList, sessioniface, "onekey_scan_function");
|
||||
onekey_scan_thread->start();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void SessionDispatcher::scanSystemCleanerItems(QMap<QString, QVariant> data)
|
||||
{
|
||||
// QStringList tmp;
|
||||
// thread->initValues(data, tmp, sessioniface, "get_scan_result");
|
||||
// thread->start();
|
||||
if (scan_thread->isRunning()) {
|
||||
sessioniface->call("get_scan_result", data);
|
||||
|
||||
/*if (scan_thread->isRunning()) {
|
||||
qDebug() << "scan_thread is running......";
|
||||
}
|
||||
else {
|
||||
|
@ -332,10 +352,11 @@ void SessionDispatcher::scanSystemCleanerItems(QMap<QString, QVariant> data)
|
|||
// et.start();
|
||||
// while(et.elapsed()<300)
|
||||
// QCoreApplication::processEvents();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
QString SessionDispatcher::getHomePath() {
|
||||
QString SessionDispatcher::getHomePath()
|
||||
{
|
||||
QString homepath = QDir::homePath();
|
||||
return homepath;
|
||||
}
|
||||
|
@ -369,62 +390,74 @@ QMap<QString, QVariant> SessionDispatcher::get_system_message_qt()
|
|||
}
|
||||
|
||||
/*-----------------------------desktop of beauty-----------------------------*/
|
||||
bool SessionDispatcher::set_show_desktop_icons_qt(bool flag) {
|
||||
bool SessionDispatcher::set_show_desktop_icons_qt(bool flag)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_show_desktop_icons", flag);
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::get_show_desktop_icons_qt() {
|
||||
bool SessionDispatcher::get_show_desktop_icons_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("get_show_desktop_icons");
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::set_show_computer_qt(bool flag) {
|
||||
bool SessionDispatcher::set_show_computer_qt(bool flag)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_show_computer", flag);
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::get_show_computer_qt() {
|
||||
bool SessionDispatcher::get_show_computer_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("get_show_computer");
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::set_show_homefolder_qt(bool flag) {
|
||||
bool SessionDispatcher::set_show_homefolder_qt(bool flag)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_show_homefolder", flag);
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::get_show_homefolder_qt() {
|
||||
bool SessionDispatcher::get_show_homefolder_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("get_show_homefolder");
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::set_show_network_qt(bool flag) {
|
||||
bool SessionDispatcher::set_show_network_qt(bool flag)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_show_network", flag);
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::get_show_network_qt() {
|
||||
bool SessionDispatcher::get_show_network_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("get_show_network");
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::set_show_trash_qt(bool flag) {
|
||||
bool SessionDispatcher::set_show_trash_qt(bool flag)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_show_trash", flag);
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::get_show_trash_qt() {
|
||||
bool SessionDispatcher::get_show_trash_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("get_show_trash");
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::set_show_devices_qt(bool flag) {
|
||||
bool SessionDispatcher::set_show_devices_qt(bool flag)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_show_devices", flag);
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
bool SessionDispatcher::get_show_devices_qt() {
|
||||
bool SessionDispatcher::get_show_devices_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("get_show_devices");
|
||||
return reply.value();
|
||||
}
|
||||
|
@ -493,35 +526,41 @@ bool SessionDispatcher::get_show_devices_qt() {
|
|||
// sessioniface->call("set_default_launcher_have_showdesktopicon");
|
||||
//}
|
||||
|
||||
bool SessionDispatcher::set_launcher_autohide_qt(bool flag) {
|
||||
bool SessionDispatcher::set_launcher_autohide_qt(bool flag)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_launcher_autohide", flag);
|
||||
return reply.value();
|
||||
// return true;
|
||||
}
|
||||
|
||||
bool SessionDispatcher::get_launcher_autohide_qt() {
|
||||
bool SessionDispatcher::get_launcher_autohide_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("get_launcher_autohide");
|
||||
return reply.value();
|
||||
// return true;
|
||||
}
|
||||
|
||||
bool SessionDispatcher::set_launcher_icon_size_qt(int num) {
|
||||
bool SessionDispatcher::set_launcher_icon_size_qt(int num)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_launcher_icon_size", num);
|
||||
return reply.value();
|
||||
}
|
||||
|
||||
int SessionDispatcher::get_launcher_icon_size_qt() {
|
||||
int SessionDispatcher::get_launcher_icon_size_qt()
|
||||
{
|
||||
QDBusReply<int> reply = sessioniface->call("get_launcher_icon_size");
|
||||
return reply.value();
|
||||
// return 32;
|
||||
}
|
||||
bool SessionDispatcher::set_launcher_have_showdesktopicon_qt(bool flag) {
|
||||
bool SessionDispatcher::set_launcher_have_showdesktopicon_qt(bool flag)
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("set_launcher_have_showdesktopicon", flag);
|
||||
return reply.value();
|
||||
// return true;
|
||||
}
|
||||
|
||||
bool SessionDispatcher::get_launcher_have_showdesktopicon_qt() {
|
||||
bool SessionDispatcher::get_launcher_have_showdesktopicon_qt()
|
||||
{
|
||||
QDBusReply<bool> reply = sessioniface->call("get_launcher_have_showdesktopicon");
|
||||
return reply.value();
|
||||
// return true;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <QtDBus>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusConnection>
|
||||
#include "kthread.h"
|
||||
//#include "kthread.h"
|
||||
|
||||
class SessionDispatcher : public QObject
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
bool set_show_devices_qt(bool flag);
|
||||
bool get_show_devices_qt();
|
||||
|
||||
bool start_check_source_useable_qt();
|
||||
void start_check_source_useable_qt();
|
||||
// Q_INVOKABLE bool get_show_cinnamon_desktop_icons_qt();
|
||||
// Q_INVOKABLE bool set_show_cinnamon_desktop_icons_qt(bool flag);
|
||||
// Q_INVOKABLE bool get_show_cinnamon_computer_qt();
|
||||
|
@ -354,9 +354,9 @@ public slots:
|
|||
|
||||
private:
|
||||
QDBusInterface *sessioniface;
|
||||
KThread *check_thread;
|
||||
/*KThread *check_thread;
|
||||
KThread *scan_thread;
|
||||
KThread *onekey_scan_thread;
|
||||
KThread *onekey_scan_thread;*/
|
||||
};
|
||||
|
||||
#endif // SESSIONDISPATCHER_H
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
|
||||
#include "youkersystemdbus.h"
|
||||
#include <QDebug>
|
||||
#include <QDBusReply>
|
||||
#include <QMap>
|
||||
#include <QDir>
|
||||
|
||||
SystemDispatcher::SystemDispatcher(QObject *parent)
|
||||
: QObject(parent)
|
||||
|
@ -48,13 +50,12 @@ SystemDispatcher::SystemDispatcher(QObject *parent)
|
|||
|
||||
// emit this->dbusInitFinished();
|
||||
|
||||
thread = new KThread(this);
|
||||
|
||||
clean_thread = new KThread(this);
|
||||
/*thread = new KThread(this);
|
||||
clean_thread = new KThread(this);*/
|
||||
}
|
||||
|
||||
SystemDispatcher::~SystemDispatcher() {
|
||||
thread->terminate();
|
||||
/*thread->terminate();
|
||||
thread->wait();
|
||||
if(thread != NULL) {
|
||||
delete thread;
|
||||
|
@ -66,7 +67,7 @@ SystemDispatcher::~SystemDispatcher() {
|
|||
if(clean_thread != NULL) {
|
||||
delete clean_thread;
|
||||
clean_thread = NULL;
|
||||
}
|
||||
}*/
|
||||
|
||||
this->exit_qt();
|
||||
if (systemiface != NULL) {
|
||||
|
@ -112,7 +113,7 @@ QString SystemDispatcher::get_current_cpufreq_scaling_governer_qt()
|
|||
|
||||
bool SystemDispatcher::update_myself()
|
||||
{
|
||||
QStringList tmp;
|
||||
/*QStringList tmp;
|
||||
QMap<QString, QVariant> data;
|
||||
QEventLoop q;
|
||||
KThread *apt_thread = new KThread(this);
|
||||
|
@ -122,7 +123,7 @@ bool SystemDispatcher::update_myself()
|
|||
q.exec();
|
||||
if(apt_thread->isFinished()){
|
||||
q.quit();
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
// QDBusReply<bool> reply = systemiface->call("install", "kylin-assistant");
|
||||
// return reply.value();
|
||||
|
@ -130,7 +131,7 @@ bool SystemDispatcher::update_myself()
|
|||
|
||||
bool SystemDispatcher::update_source()
|
||||
{
|
||||
QStringList tmp;
|
||||
/*QStringList tmp;
|
||||
QMap<QString, QVariant> data;
|
||||
QEventLoop q;
|
||||
KThread *source_thread = new KThread(this);
|
||||
|
@ -140,7 +141,7 @@ bool SystemDispatcher::update_source()
|
|||
q.exec();
|
||||
if(source_thread->isFinished()){
|
||||
q.quit();
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -158,7 +159,10 @@ bool SystemDispatcher::delete_file_qt(QString filename)
|
|||
|
||||
void SystemDispatcher::cleanAllSelectItems(QMap<QString, QVariant> selectMap)
|
||||
{
|
||||
if (clean_thread->isRunning()) {
|
||||
systemiface->call("remove_select_items", selectMap);
|
||||
|
||||
|
||||
/*if (clean_thread->isRunning()) {
|
||||
qDebug() << "clean_thread is running......";
|
||||
}
|
||||
else {
|
||||
|
@ -179,7 +183,7 @@ void SystemDispatcher::cleanAllSelectItems(QMap<QString, QVariant> selectMap)
|
|||
// QElapsedTimer et;
|
||||
// et.start();
|
||||
// while(et.elapsed()<300)
|
||||
// QCoreApplication::processEvents();
|
||||
// QCoreApplication::processEvents();*/
|
||||
}
|
||||
|
||||
//void SystemDispatcher::kill_root_process_qt(QString pid) {
|
||||
|
@ -491,8 +495,13 @@ QString SystemDispatcher::delete_plymouth_qt(QString plymouthName) {
|
|||
return reply.value();
|
||||
}
|
||||
|
||||
void SystemDispatcher::clean_by_main_one_key_qt() {
|
||||
if (thread->isRunning()) {
|
||||
void SystemDispatcher::clean_by_main_one_key_qt()
|
||||
{
|
||||
QStringList argList;
|
||||
argList << "1" << "1" << "1";
|
||||
systemiface->call("onekey_clean_crufts_function", argList);
|
||||
|
||||
/*if (thread->isRunning()) {
|
||||
qDebug() << "onekey_clean_thread is running......";
|
||||
}
|
||||
else {
|
||||
|
@ -502,5 +511,5 @@ void SystemDispatcher::clean_by_main_one_key_qt() {
|
|||
QMap<QString, QVariant> data;
|
||||
thread->initValues(data, argList, systemiface, "onekey_clean_crufts_function");
|
||||
thread->start();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <QObject>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusConnection>
|
||||
#include "kthread.h"
|
||||
//#include "kthread.h"
|
||||
|
||||
class SystemDispatcher : public QObject
|
||||
{
|
||||
|
@ -117,8 +117,8 @@ public slots:
|
|||
|
||||
private:
|
||||
QDBusInterface *systemiface;
|
||||
KThread *thread;
|
||||
KThread *clean_thread;
|
||||
// KThread *thread;
|
||||
// KThread *clean_thread;
|
||||
};
|
||||
|
||||
#endif // YOUKERSYSTEMDBUS_H
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
ShredDialog::ShredDialog(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
// setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
setWindowFlags(Qt::FramelessWindowHint);
|
||||
// this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}");
|
||||
this->setWindowIcon(QIcon(":/res/kylin-assistant.png"));
|
||||
this->setFixedSize(500, 471);
|
||||
|
|
|
@ -62,10 +62,10 @@ StartupWidget::StartupWidget(QWidget *parent)
|
|||
qRegisterMetaType<StartupDataPtrList>();
|
||||
qRegisterMetaType<QList<StartupData>>();
|
||||
|
||||
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
// this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
this->setAutoFillBackground(true);
|
||||
this->setMouseTracking(true);
|
||||
// this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);//去掉边框
|
||||
this->setWindowFlags(/*this->windowFlags() | */Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);//去掉边框
|
||||
// this->setAttribute(Qt::WA_TranslucentBackground);//背景透明
|
||||
// this->setAutoFillBackground(true);
|
||||
// this->setMouseTracking(true);
|
||||
|
|
|
@ -39,8 +39,8 @@ const int spacing = 8;
|
|||
PropertiesDialog::PropertiesDialog(QWidget *parent, pid_t processId) : QDialog(parent)
|
||||
, mousePressed(false)
|
||||
{
|
||||
// this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint/* | Qt::WindowCloseButtonHint*/| Qt::WindowStaysOnTopHint);
|
||||
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint/* | Qt::WindowCloseButtonHint*/| Qt::WindowStaysOnTopHint);
|
||||
// this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setAttribute(Qt::WA_Resized, false);
|
||||
|
|
|
@ -39,8 +39,8 @@ SystemMonitor::SystemMonitor(QWidget *parent)
|
|||
// this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);//去掉边框
|
||||
// this->setAttribute(Qt::WA_TranslucentBackground);//背景透明
|
||||
|
||||
// this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
// this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
|
||||
this->setAutoFillBackground(true);
|
||||
this->setMouseTracking(true);
|
||||
|
|
|
@ -16,8 +16,8 @@ MyDialog::MyDialog(const QString &title, const QString &message, QWidget *parent
|
|||
QDialog(parent)
|
||||
, mousePressed(false)
|
||||
{
|
||||
// this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint/* | Qt::WindowCloseButtonHint*/);
|
||||
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint/* | Qt::WindowCloseButtonHint*/);
|
||||
// this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
// this->setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QDebug>
|
||||
#include "../component/utils.h"
|
||||
#include "../dbusproxy/youkersessiondbus.h"
|
||||
|
||||
CleanerWidget::CleanerWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
|
@ -36,8 +35,6 @@ CleanerWidget::CleanerWidget(QWidget *parent) :
|
|||
|
||||
statked_widget = new QStackedWidget(this);
|
||||
p_mainwindow = NULL;
|
||||
// systemProxy = NULL;
|
||||
// sessionProxy = NULL;
|
||||
main_widget = NULL;
|
||||
detail_widget = NULL;
|
||||
}
|
||||
|
@ -50,8 +47,8 @@ CleanerWidget::~CleanerWidget()
|
|||
void CleanerWidget::initUI(QString skin)
|
||||
{
|
||||
//20180101
|
||||
main_widget = new CleanerMainWidget(this, /*sessionProxy, */p_mainwindow, toolKits, skin);
|
||||
detail_widget = new CleanerDetailWidget(this, /*sessionProxy, systemProxy, */p_mainwindow, toolKits ,skin);
|
||||
main_widget = new CleanerMainWidget(this, p_mainwindow, toolKits, skin);
|
||||
detail_widget = new CleanerDetailWidget(this, p_mainwindow, toolKits ,skin);
|
||||
connect(this, SIGNAL(transCleanSignal()), detail_widget, SLOT(receiveCleanSignal()));
|
||||
|
||||
connect(this, SIGNAL(transScanSignal()), main_widget, SLOT(receiveScanSignal()));
|
||||
|
@ -60,10 +57,6 @@ void CleanerWidget::initUI(QString skin)
|
|||
connect(detail_widget, SIGNAL(sendScanOverStatus(bool)), this, SIGNAL(tranScanOverSignal(bool)));
|
||||
|
||||
connect(this, SIGNAL(clearDetailPage()), detail_widget, SLOT(CleanUIAndData()));
|
||||
//20180101
|
||||
// connect(sessionProxy, SIGNAL(tellCleanerDetailData(QStringList)), detail_widget, SLOT(showReciveData(QStringList)));
|
||||
// connect(sessionProxy, SIGNAL(tellCleanerDetailStatus(QString)), detail_widget, SLOT(showReciveStatus(QString)));
|
||||
|
||||
|
||||
statked_widget->addWidget(main_widget);
|
||||
statked_widget->addWidget(detail_widget);
|
||||
|
@ -83,7 +76,6 @@ void CleanerWidget::initUI(QString skin)
|
|||
|
||||
void CleanerWidget::resetSkin(QString skin)
|
||||
{
|
||||
//20180101
|
||||
if(main_widget != NULL)
|
||||
main_widget->resetCurrentSkin(skin);
|
||||
if(detail_widget != NULL)
|
||||
|
|
|
@ -144,6 +144,7 @@ bool DataWorker::copyAppointedFile(QString filename)
|
|||
void DataWorker::onStartOneKeyScan(const QStringList &categorys)
|
||||
{
|
||||
m_sessionInterface->onekey_scan_function_qt(categorys);
|
||||
// QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
//---------------clean on homepage
|
||||
|
@ -157,6 +158,23 @@ void DataWorker::onStartOneKeyClean()
|
|||
void DataWorker::onStartScanSystem(QMap<QString, QVariant> itemsMap)
|
||||
{
|
||||
m_sessionInterface->scanSystemCleanerItems(itemsMap);
|
||||
|
||||
|
||||
|
||||
// QEventLoop loop;
|
||||
// MyThread *t = new MyThread(0,QString("aaa"));
|
||||
// connect(t, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
// t->start();
|
||||
// loop.exec();
|
||||
// int i = t->getMyThreadResult();
|
||||
// if(i == 0)//success
|
||||
// {
|
||||
// return true;
|
||||
// }else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// delete t;
|
||||
}
|
||||
|
||||
//-------------clean
|
||||
|
|
|
@ -298,16 +298,16 @@ void MainTopWidget::initActionRightContent()
|
|||
scan_button->setFixedSize(182, 58);
|
||||
clean_button->setFixedSize(182, 58);
|
||||
}
|
||||
scan_button->show();
|
||||
scan_button->setVisible(true);
|
||||
clean_button->setFocusPolicy(Qt::NoFocus);
|
||||
clean_button->setObjectName("greenButton");
|
||||
clean_button->hide();
|
||||
clean_button->setVisible(false);
|
||||
|
||||
back_button->setFocusPolicy(Qt::NoFocus);
|
||||
back_button->setFixedSize(50, 30);
|
||||
// back_button->setObjectName("backButton");
|
||||
back_button->setObjectName("underlineButton");
|
||||
back_button->hide();//setVisible(false)
|
||||
back_button->setVisible(false);
|
||||
|
||||
m_toolRightLayout->addWidget(scan_button);
|
||||
m_toolRightLayout->addWidget(clean_button);
|
||||
|
@ -372,11 +372,11 @@ void MainTopWidget::setLanguage()
|
|||
void MainTopWidget::showCleanOverStatus()
|
||||
{
|
||||
loading_label->stopLoading();
|
||||
scan_button->show();
|
||||
scan_button->setVisible(true);
|
||||
scan_button->setEnabled(true);
|
||||
clean_button->hide();
|
||||
clean_button->setVisible(false);
|
||||
clean_button->setEnabled(true);
|
||||
back_button->hide();
|
||||
back_button->setVisible(false);
|
||||
doing_label->setText(tr("Clean OK"));
|
||||
}
|
||||
|
||||
|
@ -475,25 +475,25 @@ void MainTopWidget::accordScanOverStatusToChange(bool status)
|
|||
{
|
||||
if (status) {
|
||||
doing_label->setText(tr("Scaning......"));
|
||||
doing_label->hide();
|
||||
doing_label->setVisible(false);
|
||||
loading_label->stopLoading();
|
||||
scan_button->hide();
|
||||
scan_button->setVisible(false);
|
||||
scan_button->setEnabled(true);
|
||||
clean_button->show();
|
||||
clean_button->setVisible(true);
|
||||
clean_button->setEnabled(true);
|
||||
suggest_label->show();
|
||||
back_button->show();
|
||||
suggest_label->setVisible(true);
|
||||
back_button->setVisible(true);
|
||||
}
|
||||
else {
|
||||
doing_label->setText(tr("Scaning......"));
|
||||
doing_label->hide();
|
||||
doing_label->setVisible(false);
|
||||
loading_label->stopLoading();
|
||||
scan_button->hide();
|
||||
scan_button->setVisible(false);
|
||||
scan_button->setEnabled(true);
|
||||
clean_button->hide();
|
||||
clean_button->setVisible(false);
|
||||
clean_button->setEnabled(true);
|
||||
suggest_label->show();
|
||||
back_button->show();
|
||||
suggest_label->setVisible(true);
|
||||
back_button->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -521,10 +521,10 @@ void MainTopWidget::showCleanReciveError(const QString &status)
|
|||
|
||||
void MainTopWidget::displayAnimation()
|
||||
{
|
||||
scan_button->setEnabled(false);
|
||||
// scan_button->setEnabled(false);
|
||||
loading_label->startLoading();
|
||||
suggest_label->hide();
|
||||
doing_label->show();
|
||||
suggest_label->setVisible(false);
|
||||
doing_label->setVisible(true);
|
||||
emit this->showDetailData();
|
||||
}
|
||||
|
||||
|
@ -593,19 +593,19 @@ void MainTopWidget::finishScanResult(QString msg)
|
|||
if (msg.isEmpty()) {
|
||||
result_label->setText(tr("No garbage."));
|
||||
scan_button->setEnabled(true);
|
||||
clean_button->hide();
|
||||
clean_button->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
result_label->setText(msg);
|
||||
clean_button->show();
|
||||
clean_button->setVisible(true);
|
||||
clean_button->setEnabled(true);
|
||||
}
|
||||
scanFinishTime = this->getCurrentDateTime();
|
||||
// result_label->setText(tr("The lastest scan time is ") + this->getCurrentDateTime());
|
||||
this->writeSafeScanDate();
|
||||
scan_button->hide();
|
||||
back_button->show();
|
||||
scan_button->setVisible(false);
|
||||
back_button->setVisible(true);
|
||||
loading_label->stopLoading();
|
||||
}
|
||||
}
|
||||
|
@ -627,15 +627,15 @@ void MainTopWidget::getCleanResult(QString msg/*, QString flag*/)
|
|||
// if(flag == "onekey") {
|
||||
if (msg == "yes") {//在弹出输入密码验证时,点击了取消按钮
|
||||
loading_label->stopLoading();
|
||||
clean_button->show();
|
||||
clean_button->setVisible(true);
|
||||
clean_button->setEnabled(true);
|
||||
back_button->show();
|
||||
back_button->setVisible(true);
|
||||
}
|
||||
else if (msg == "no") {//在弹出输入密码验证时,输入密码,验证通过,此时让动态图片开始显示
|
||||
//show dynamic image
|
||||
clean_button->show();
|
||||
clean_button->setVisible(true);
|
||||
clean_button->setEnabled(false);
|
||||
back_button->hide();
|
||||
back_button->setVisible(false);
|
||||
doing_label->setText(tr("Cleaning......"));//正在清理......
|
||||
loading_label->startLoading();
|
||||
}
|
||||
|
@ -657,11 +657,11 @@ void MainTopWidget::getCleanResult(QString msg/*, QString flag*/)
|
|||
cookies.clear();
|
||||
garbage.clear();
|
||||
loading_label->stopLoading();
|
||||
scan_button->show();
|
||||
scan_button->setVisible(true);
|
||||
scan_button->setEnabled(true);
|
||||
clean_button->hide();
|
||||
clean_button->setVisible(false);
|
||||
clean_button->setEnabled(true);
|
||||
back_button->hide();
|
||||
back_button->setVisible(false);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
@ -733,31 +733,33 @@ void MainTopWidget::getCleaningMessage(QString type, QString status)
|
|||
|
||||
void MainTopWidget::displayOrgPage()
|
||||
{
|
||||
doing_label->hide();
|
||||
back_button->hide();
|
||||
doing_label->setVisible(false);
|
||||
back_button->setVisible(false);
|
||||
// loading_label->stopLoading();
|
||||
scan_button->show();
|
||||
scan_button->setVisible(true);
|
||||
scan_button->setEnabled(true);
|
||||
clean_button->hide();
|
||||
suggest_label->show();
|
||||
clean_button->setVisible(false);
|
||||
suggest_label->setVisible(true);
|
||||
}
|
||||
|
||||
void MainTopWidget::onStartButtonClicked()
|
||||
{
|
||||
doing_label->setText(tr("Scanning......"));//正在扫描......
|
||||
if (m_isMain) {
|
||||
scan_button->setEnabled(false);
|
||||
scan_button->setVisible(false);
|
||||
// scan_button->setEnabled(false);
|
||||
loading_label->startLoading();
|
||||
suggest_label->hide();
|
||||
scan_result_label->hide();
|
||||
result_label->hide();
|
||||
doing_label->show();
|
||||
suggest_label->setVisible(false);
|
||||
scan_result_label->setVisible(false);
|
||||
result_label->setVisible(false);
|
||||
doing_label->setVisible(true);
|
||||
QStringList args;
|
||||
args << "cache" << "history" << "cookies";
|
||||
|
||||
emit this->startOneKeyScan(args);
|
||||
}
|
||||
else {
|
||||
scan_button->setVisible(false);
|
||||
emit this->sendScanSignal();
|
||||
}
|
||||
}
|
||||
|
@ -765,20 +767,20 @@ void MainTopWidget::onStartButtonClicked()
|
|||
void MainTopWidget::onCleanButtonClicked()
|
||||
{
|
||||
if (m_isMain) {
|
||||
clean_button->hide();
|
||||
back_button->hide();
|
||||
clean_button->setVisible(false);
|
||||
back_button->setVisible(false);
|
||||
loading_label->startLoading();
|
||||
suggest_label->hide();
|
||||
scan_result_label->hide();
|
||||
result_label->hide();
|
||||
suggest_label->setVisible(false);
|
||||
scan_result_label->setVisible(false);
|
||||
result_label->setVisible(false);
|
||||
doing_label->setText(tr("Ready to Cleanup......"));//准备清理......
|
||||
doing_label->show();
|
||||
doing_label->setVisible(true);
|
||||
|
||||
emit this->startOneKeyClean();
|
||||
}
|
||||
else {
|
||||
clean_button->hide();
|
||||
back_button->hide();
|
||||
clean_button->setVisible(false);
|
||||
back_button->setVisible(false);
|
||||
emit this->sendCleanSignal();
|
||||
}
|
||||
}
|
||||
|
@ -788,24 +790,24 @@ void MainTopWidget::onEndButtonClicked()
|
|||
if (m_isMain) {
|
||||
result_label->setText(tr("The lastest scan time is ") + scanFinishTime);
|
||||
loading_label->stopLoading();
|
||||
scan_button->show();
|
||||
scan_button->setVisible(true);
|
||||
scan_button->setEnabled(true);
|
||||
clean_button->hide();
|
||||
back_button->hide();
|
||||
suggest_label->show();
|
||||
scan_result_label->hide();
|
||||
result_label->show();
|
||||
doing_label->hide();
|
||||
clean_button->setVisible(false);
|
||||
back_button->setVisible(false);
|
||||
suggest_label->setVisible(true);
|
||||
scan_result_label->setVisible(false);
|
||||
result_label->setVisible(true);
|
||||
doing_label->setVisible(false);
|
||||
}
|
||||
else {
|
||||
doing_label->hide();
|
||||
back_button->hide();
|
||||
doing_label->setVisible(false);
|
||||
back_button->setVisible(false);
|
||||
loading_label->stopLoading();
|
||||
scan_button->show();
|
||||
scan_button->setVisible(true);
|
||||
scan_button->setEnabled(true);
|
||||
clean_button->hide();
|
||||
clean_button->setVisible(false);
|
||||
// back_button->hide();
|
||||
suggest_label->show();
|
||||
suggest_label->setVisible(true);
|
||||
// result_label->show();
|
||||
emit this->showMainData();
|
||||
}
|
||||
|
@ -819,18 +821,18 @@ void MainTopWidget::receivePolicyKitSignal(bool status)
|
|||
*/
|
||||
if(status)//ok
|
||||
{
|
||||
clean_button->show();
|
||||
clean_button->setVisible(true);
|
||||
clean_button->setEnabled(false);
|
||||
back_button->hide();//0713
|
||||
scan_button->hide();
|
||||
back_button->setVisible(false);
|
||||
scan_button->setVisible(false);
|
||||
loading_label->startLoading();
|
||||
suggest_label->hide();
|
||||
suggest_label->setVisible(false);
|
||||
doing_label->setText(tr("Ready to Cleanup......"));//准备清理......
|
||||
doing_label->show();
|
||||
doing_label->setVisible(true);
|
||||
}
|
||||
else {
|
||||
clean_button->show();
|
||||
back_button->show();
|
||||
clean_button->setVisible(true);
|
||||
back_button->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,8 +69,11 @@ MainWindow::MainWindow(QString cur_arch, int d_count, QWidget* parent/*, Qt::Win
|
|||
if(this->desktop.isEmpty())
|
||||
this->desktop = qgetenv("XDG_SESSION_DESKTOP");
|
||||
|
||||
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
// this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);
|
||||
//For Unity
|
||||
// this->setWindowFlags(/*Qt::Window | */Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
|
||||
|
||||
//For UKUI and Mate
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setAutoFillBackground(true);
|
||||
this->setMouseTracking(true);
|
||||
|
@ -277,32 +280,39 @@ void MainWindow::onInitDataFinished()
|
|||
this->m_cpulist = m_dataWorker->cpuModeList();
|
||||
this->m_currentCpuMode = m_dataWorker->cpuCurrentMode();
|
||||
|
||||
connect(m_mainTopWidget, SIGNAL(startOneKeyScan(QStringList)), m_dataWorker, SLOT(onStartOneKeyScan(QStringList)));//Qt::QueuedConnection
|
||||
connect(m_mainTopWidget, SIGNAL(startOneKeyClean()), m_dataWorker, SLOT(onStartOneKeyClean()));
|
||||
connect(m_dataWorker, SIGNAL(isScanning(QString)), m_mainTopWidget, SLOT(getScanResult(QString))/*, Qt::BlockingQueuedConnection*/);
|
||||
connect(m_dataWorker, SIGNAL(finishScanWork(QString)), m_mainTopWidget, SLOT(finishScanResult(QString))/*, Qt::BlockingQueuedConnection*/);
|
||||
connect(m_dataWorker, SIGNAL(tellScanResult(QString,QString)) ,m_mainTopWidget, SLOT(getScanAllResult(QString,QString))/*, Qt::BlockingQueuedConnection*/);
|
||||
connect(m_dataWorker, SIGNAL(finishCleanWorkMain(QString)), m_mainTopWidget, SLOT(getCleanResult(QString))/*, Qt::BlockingQueuedConnection*/);
|
||||
connect(m_dataWorker, SIGNAL(finishCleanWorkMainError(QString)), m_mainTopWidget, SLOT(finishCleanError(QString))/*, Qt::BlockingQueuedConnection*/);
|
||||
connect(m_dataWorker, SIGNAL(quickCleanProcess(QString,QString)), m_mainTopWidget, SLOT(getCleaningMessage(QString,QString))/*, Qt::QueuedConnection*/);
|
||||
/*
|
||||
Qt::AutoConnection 自动连接:(默认值)如果信号在接收者所依附的线程内发射,则等同于直接连接。如果发射信号的线程和接受者所依附的线程不同,则等同于队列连接。
|
||||
Qt::DirectConnection 直接连接:当信号发射时,槽函数将直接被调用。无论槽函数所属对象在哪个线程,槽函数都在发射信号的线程内执行。
|
||||
Qt::QueuedConnection 队列连接:当控制权回到接受者所依附线程的事件循环时,槽函数被调用。槽函数在接收者所依附线程执行。也就是说:这种方式既可以在线程内传递消息,也可以跨线程传递消息
|
||||
Qt::BlockingQueuedConnection 与Qt::QueuedConnection类似,但是会阻塞等到关联的slot都被执行。这里出现了阻塞这个词,说明它是专门用来多线程间传递消息的。
|
||||
*/
|
||||
//kobe: why does ui died ??????????????????????
|
||||
connect(m_mainTopWidget, SIGNAL(startOneKeyScan(QStringList)), m_dataWorker, SLOT(onStartOneKeyScan(QStringList))/*, Qt::QueuedConnection*/);//Qt::QueuedConnection
|
||||
connect(m_mainTopWidget, SIGNAL(startOneKeyClean()), m_dataWorker, SLOT(onStartOneKeyClean())/*, Qt::BlockingQueuedConnection*/);
|
||||
connect(m_dataWorker, SIGNAL(isScanning(QString)), m_mainTopWidget, SLOT(getScanResult(QString)), Qt::BlockingQueuedConnection);//Qt::BlockingQueuedConnection
|
||||
connect(m_dataWorker, SIGNAL(finishScanWork(QString)), m_mainTopWidget, SLOT(finishScanResult(QString)), Qt::BlockingQueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(tellScanResult(QString,QString)) ,m_mainTopWidget, SLOT(getScanAllResult(QString,QString)), Qt::BlockingQueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(finishCleanWorkMain(QString)), m_mainTopWidget, SLOT(getCleanResult(QString)), Qt::BlockingQueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(finishCleanWorkMainError(QString)), m_mainTopWidget, SLOT(finishCleanError(QString)), Qt::BlockingQueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(quickCleanProcess(QString,QString)), m_mainTopWidget, SLOT(getCleaningMessage(QString,QString)), Qt::BlockingQueuedConnection);
|
||||
|
||||
connect(cleaner_action_widget, SIGNAL(showDetailData()),cleaner_widget, SLOT(displayDetailPage()));
|
||||
connect(cleaner_action_widget, SIGNAL(showMainData()),cleaner_widget, SLOT(displayMainPage()));
|
||||
connect(cleaner_action_widget, SIGNAL(sendCleanSignal()),cleaner_widget, SIGNAL(transCleanSignal()));
|
||||
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerDetailData(QStringList)), cleaner_widget, SIGNAL(tellCleanerDetailData(QStringList)));
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerDetailStatus(QString)), cleaner_widget, SIGNAL(tellCleanerDetailStatus(QString)));
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerDetailData(QStringList)), cleaner_widget, SIGNAL(tellCleanerDetailData(QStringList)), Qt::BlockingQueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerDetailStatus(QString)), cleaner_widget, SIGNAL(tellCleanerDetailStatus(QString)), Qt::BlockingQueuedConnection);
|
||||
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerDetailStatus(QString)), cleaner_action_widget, SLOT(showCleanReciveStatus(QString)));
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerDetailError(QString)), cleaner_action_widget, SLOT(showCleanReciveError(QString)));
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerDetailStatus(QString)), cleaner_action_widget, SLOT(showCleanReciveStatus(QString)), Qt::BlockingQueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerDetailError(QString)), cleaner_action_widget, SLOT(showCleanReciveError(QString)), Qt::BlockingQueuedConnection);
|
||||
|
||||
connect(m_dataWorker, SIGNAL(sendCleanOverSignal()), cleaner_widget, SLOT(displayMainPage()));
|
||||
connect(m_dataWorker, SIGNAL(sendCleanOverSignal()), cleaner_action_widget, SLOT(displayOrgPage()));
|
||||
connect(m_dataWorker, SIGNAL(sendCleanOverSignal()), cleaner_action_widget, SLOT(showCleanOverStatus()));
|
||||
connect(m_dataWorker, SIGNAL(policykitCleanSignal(bool)), cleaner_action_widget, SLOT(receivePolicyKitSignal(bool)));
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerMainData(QStringList)), cleaner_action_widget, SLOT(showCleanerData(QStringList)));
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerMainStatus(QString, QString)), cleaner_action_widget, SLOT(showCleanerStatus(QString, QString)));
|
||||
connect(m_dataWorker, SIGNAL(sendCleanErrorSignal(QString)), cleaner_action_widget, SLOT(showCleanerError(QString)));
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerMainData(QStringList)), cleaner_action_widget, SLOT(showCleanerData(QStringList)), Qt::BlockingQueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(tellCleanerMainStatus(QString, QString)), cleaner_action_widget, SLOT(showCleanerStatus(QString, QString)), Qt::BlockingQueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(sendCleanErrorSignal(QString)), cleaner_action_widget, SLOT(showCleanerError(QString)), Qt::BlockingQueuedConnection);
|
||||
|
||||
connect(cleaner_widget, SIGNAL(startScanSystem(QMap<QString,QVariant>)), m_dataWorker, SLOT(onStartScanSystem(QMap<QString,QVariant>)));
|
||||
connect(cleaner_widget, SIGNAL(startCleanSystem(QMap<QString,QVariant>)), m_dataWorker, SLOT(onStartCleanSystem(QMap<QString,QVariant>)));
|
||||
|
@ -737,13 +747,24 @@ void MainWindow::startDbusDaemon()
|
|||
{
|
||||
// qDebug() << "mainwindow thread id=" << QThread::currentThreadId();
|
||||
m_dataWorker = new DataWorker(this->desktop);
|
||||
|
||||
/*QThread *thread = new QThread;
|
||||
m_dataWorker->moveToThread(thread);
|
||||
thread->start();
|
||||
connect(thread, SIGNAL(started()), m_dataWorker, SLOT(doWork()), Qt::QueuedConnection);
|
||||
connect(m_dataWorker, SIGNAL(dataLoadFinished()), this, SLOT(onInitDataFinished()), Qt::QueuedConnection);
|
||||
connect(thread, &QThread::finished, this, [=] {
|
||||
thread->deleteLater();
|
||||
qDebug() << "DataWorker thread finished......";
|
||||
});*/
|
||||
|
||||
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()));
|
||||
// connect(w_thread, &QThread::finished, w_thread, &QThread::deleteLater, Qt::QueuedConnection);
|
||||
connect(w_thread, &QThread::started, m_dataWorker, &DataWorker::doWork/*, Qt::QueuedConnection*/);
|
||||
connect(m_dataWorker, &DataWorker::dataLoadFinished, this, &MainWindow::onInitDataFinished, Qt::QueuedConnection);
|
||||
connect(m_dataWorker, &DataWorker::dataLoadFinished, this, &MainWindow::onInitDataFinished/*, Qt::BlockingQueuedConnection*/);
|
||||
connect(w_thread, &QThread::finished, this, [=] {
|
||||
w_thread->deleteLater();
|
||||
qDebug() << "DataWorker thread finished......";
|
||||
|
|
|
@ -161,7 +161,8 @@ QPushButton#blackButton:pressed{
|
|||
|
||||
QPushButton#underlineButton{
|
||||
/*background:transparent;*/
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
/*background-color: rgba(0, 0, 0, 0);*/
|
||||
border:none;
|
||||
text-decoration:underline;
|
||||
color:#cfd8dc;
|
||||
font-family: "方正黑体_GBK";
|
||||
|
@ -170,24 +171,26 @@ QPushButton#underlineButton{
|
|||
}
|
||||
|
||||
QPushButton#underlineButton:hover{
|
||||
color:#ffffff;
|
||||
text-decoration:underline;
|
||||
color:#ffffff;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
QPushButton#whiteButton{
|
||||
color:#ffffff;
|
||||
font-family: "方正黑体_GBK";
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
background:transparent;
|
||||
border:none;
|
||||
color:#ffffff;
|
||||
font-family: "方正黑体_GBK";
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
/*background:transparent;*/
|
||||
}
|
||||
|
||||
QPushButton#checkButton{
|
||||
border:none;
|
||||
color:#3f96e4;
|
||||
font-family: "方正黑体_GBK";
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
background:transparent;
|
||||
/*background:transparent;*/
|
||||
}
|
||||
|
||||
QPushButton#checkButton:hover{
|
||||
|
@ -195,7 +198,7 @@ QPushButton#checkButton:hover{
|
|||
font-family: "方正黑体_GBK";
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
background:transparent;
|
||||
/*background:transparent;*/
|
||||
}
|
||||
|
||||
QPushButton#checkButton:pressed{
|
||||
|
@ -203,7 +206,7 @@ QPushButton#checkButton:pressed{
|
|||
font-family: "方正黑体_GBK";
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
background:transparent;
|
||||
/*background:transparent;*/
|
||||
}
|
||||
|
||||
QPushButton#greenButton{
|
||||
|
@ -236,7 +239,7 @@ QPushButton#backButton:pressed{
|
|||
|
||||
QPushButton#bottomButton{
|
||||
color:rgb(0, 120, 230);
|
||||
background:transparent;
|
||||
/*background:transparent;*/
|
||||
}
|
||||
|
||||
QPushButton#bottomButton:hover{
|
||||
|
|
|
@ -67,6 +67,7 @@ SOURCES += main.cpp\
|
|||
../component/systembutton.cpp \
|
||||
../component/kylintitlebar.cpp \
|
||||
../component/threadpool.cpp \
|
||||
../component/mythread.cpp \
|
||||
../info/infounitwidget.cpp \
|
||||
../info/infogui.cpp \
|
||||
../info/infoitemline.cpp \
|
||||
|
@ -102,7 +103,6 @@ SOURCES += main.cpp\
|
|||
../dbusproxy/youkersystemdbus.cpp \
|
||||
../dbusproxy/youkersessiondbus.cpp \
|
||||
../info/devicemanager.cpp \
|
||||
kthread.cpp \
|
||||
aboutdialog.cpp \
|
||||
../cleaner/cleanlistwidget.cpp \
|
||||
../component/tipdialog.cpp \
|
||||
|
@ -133,7 +133,6 @@ HEADERS += mainwindow.h \
|
|||
settingwidget.h \
|
||||
boxwidget.h \
|
||||
pluginmanager.h \
|
||||
../component/workthread.h \
|
||||
../component/plugininterface.h \
|
||||
../component/kylinlistmodel.h \
|
||||
../component/utils.h \
|
||||
|
@ -144,6 +143,7 @@ HEADERS += mainwindow.h \
|
|||
../component/systembutton.h \
|
||||
../component/kylintitlebar.h \
|
||||
../component/threadpool.h \
|
||||
../component/mythread.h \
|
||||
../info/infounitwidget.h \
|
||||
../info/infogui.h \
|
||||
../info/infoitemline.h \
|
||||
|
@ -180,7 +180,6 @@ HEADERS += mainwindow.h \
|
|||
../dbusproxy/youkersystemdbus.h \
|
||||
../dbusproxy/youkersessiondbus.h \
|
||||
../info/devicemanager.h \
|
||||
kthread.h \
|
||||
aboutdialog.h \
|
||||
../cleaner/cleanlistwidget.h \
|
||||
../component/tipdialog.h \
|
||||
|
|
Loading…
Reference in New Issue