youker-assistant/ 0000775 0001750 0001750 00000000000 13265005454 013031 5 ustar feng feng youker-assistant/.bzr-builddeb/ 0000775 0001750 0001750 00000000000 13265005754 015457 5 ustar feng feng youker-assistant/.bzr-builddeb/default.conf 0000664 0001750 0001750 00000000030 13260315532 017734 0 ustar feng feng [BUILDDEB]
split = True
youker-assistant/cleaner/ 0000775 0001750 0001750 00000000000 13260315532 014436 5 ustar feng feng youker-assistant/cleaner/cleanlistwidget.ui 0000664 0001750 0001750 00000002141 13260315532 020155 0 ustar feng feng
CleanListWidget
0
0
560
398
Dialog
0
65
560
331
true
0
0
558
329
0
32
560
33
youker-assistant/cleaner/cleanermainwidget.cpp 0000664 0001750 0001750 00000034571 13260315532 020636 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cleanermainwidget.h"
#include
#include "../src/mainwindow.h"
#include "../component/selectcategorywidget.h"
#include "../component/cleangroup.h"
CleanerMainWidget::CleanerMainWidget(QWidget *parent, MainWindow *window, Toolkits *kits, QString skin)
: QWidget(parent), parentWindow(window), toolKits(kits)
{
this->setFixedSize(900, 403);
this->setObjectName("transparentWidget");
// this->setAutoFillBackground(true);
// QPalette palette;
// palette.setBrush(QPalette::Window, QBrush(Qt::white));
// this->setPalette(palette);
tip_label = new QLabel(this);
tip_label->setGeometry(QRect(30, 10, 800, 30));
tip_label->setObjectName("tipLabel");
// QStringList cache_list, status_list;
// cache_list << tr("Cleanup Package Cache") << tr("Cleanup Software Center Cache") << tr("Cleanup Thumbnails Cache") << tr("Cleanup FireFox Cache") << tr("Cleanup Chromium Cache");
// status_list << "apt" << "software-center" << "thumbnails" << "firefox" << "chromium";
// cache_items = new CleanerItems(cache_list, status_list, skin, 280, tr("Cache Items"));
// cache_btn = new KylinCheckBox(0, "://res/cache.png");
cache_btn = new CleanGroup(this, "://res/cache");
cache_btn->setFocusPolicy(Qt::NoFocus);
// cache_btn->setGeometry(QRect(10, 50, 260, 150));
cache_btn->setGeometry(QRect(10, 150, 260, 150));
// cache_btn->setFixedSize(260, 130);
cache_btn->setStatusTip("cache");
cache_btn->setLabelText(tr("System Cache"), tr("Cleanup cache of system, software-center, thumbnails and browser"));//系统缓存垃圾 清除包、软件中心、缩略图和浏览器缓存
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(cache_items, SIGNAL(notifyMainCheckBox(int)), cache_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(cache_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
//20160711
/*QStringList package_list;
package_list << tr("Uninstall unnecessary procedures") << tr("Uninstall old kernel packages") << tr("Cleanup software configfile");
status_list.clear();
status_list << "unneed" << "oldkernel" << "configfile";
package_items = new CleanerItems(package_list, status_list, skin, 200, tr("Package Items"));
// package_btn = new KylinCheckBox(0, "://res/package.png");
package_btn = new CleanGroup(this, "://res/package");
package_btn->setFocusPolicy(Qt::NoFocus);
package_btn->setGeometry(QRect(320, 50, 260, 150));
// package_btn->setFixedSize(260, 130);
package_btn->setLabelText(tr("Packages and configfile"), tr("Cleaning up the software that installed by other software bundled, old kernel packages and configfile, to improve system performance"));//包垃圾 清除不必要的程序、旧内核包、配置文件
package_btn->setStatusTip("package");
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(package_items, SIGNAL(notifyMainCheckBox(int)), package_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(package_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));*/
// QStringList cookies_list;
// cookies_list << tr("Cleanup the Cookies saving in Firefox") << tr("Cleanup the Cookies saving in Chromium");
// status_list.clear();
// status_list << "firefox" << "chromium";
// cookies_items = new CleanerItems(cookies_list, status_list, skin, 170, tr("Cookies Items"));
// cookies_btn = new KylinCheckBox(0, "://res/cookie.png");
cookies_btn = new CleanGroup(this, "://res/cookie");
cookies_btn->setFocusPolicy(Qt::NoFocus);
cookies_btn->setGeometry(QRect(320, 150, 260, 150));
// cookies_btn->setGeometry(QRect(630, 50, 260, 150));
// cookies_btn->setFixedSize(260, 130);
cookies_btn->setLabelText(tr("Cookies"), tr("Clean up user login information, support Firefox and Chromium browser"));//清除上网、游戏、购物等记录
cookies_btn->setStatusTip("cookies");
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(cookies_items, SIGNAL(notifyMainCheckBox(int)), cookies_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(cookies_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
// QStringList trace_list;
// trace_list << tr("Clean up the Firefox Internet records") << tr("Clean up the Chromium Internet records") << tr("Clean up the recently opened documents records") << tr("Delete the command history") << tr("Delete the debug logs");
// status_list.clear();
// status_list << "firefox" << "chromium" << "system" << "bash" << "X11";
// trace_items = new CleanerItems(trace_list, status_list, skin, 280, tr("Trace Items"));
// trace_btn = new KylinCheckBox(0, "://res/trace.png");
trace_btn = new CleanGroup(this, "://res/trace");
trace_btn->setFocusPolicy(Qt::NoFocus);
// trace_btn->setGeometry(QRect(10, 240, 260, 150));
trace_btn->setGeometry(QRect(630, 150, 260, 150));
// trace_btn->setFixedSize(260, 130);
trace_btn->setLabelText(tr("History trace"), tr("Cleaning the internet and opened documents recently records"));//使用痕迹 清除浏览器和系统使用痕迹
trace_btn->setStatusTip("trace");
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(trace_items, SIGNAL(notifyMainCheckBox(int)), trace_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(trace_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
this->setLanguage();
cache_list << tr("Cleanup Package Cache") << tr("Cleanup Software Center Cache") << tr("Cleanup Thumbnails Cache") << tr("Cleanup FireFox Cache") << tr("Cleanup Chromium Cache");
cache_status_list << "apt" << "software-center" << "thumbnails" << "firefox" << "chromium";
cookies_list << tr("Cleanup the Cookies saving in Firefox") << tr("Cleanup the Cookies saving in Chromium");
cookies_status_list << "firefox" << "chromium";
trace_list << tr("Clean up the Firefox Internet records") << tr("Clean up the Chromium Internet records") << tr("Clean up the recently opened documents records") << tr("Delete the command history") << tr("Delete the debug logs");
trace_status_list << "firefox" << "chromium" << "system" << "bash" << "X11";
m_selectedCache = cache_status_list;
m_selectedCookie = cookies_status_list;
m_selectedTrace = trace_status_list;
}
CleanerMainWidget::~CleanerMainWidget()
{
argsMap.clear();
// if(cache_items != NULL) {
// delete cache_items;
// cache_items = NULL;
// }
// if(package_items != NULL) {
// delete package_items;
// package_items = NULL;
// }
// if(cookies_items != NULL) {
// delete cookies_items;
// cookies_items = NULL;
// }
// if(trace_items != NULL) {
// delete trace_items;
// trace_items = NULL;
// }
}
void CleanerMainWidget::setLanguage()
{
tip_label->setText(tr("Please select the items you want to clean"));
}
void CleanerMainWidget::resetCurrentSkin(QString skin)
{
// if(cache_items != NULL)
// cache_items->resetTitleSkin(skin);
// if(trace_items != NULL)
// trace_items->resetTitleSkin(skin);
// if(package_items != NULL)
// package_items->resetTitleSkin(skin);
// if(cookies_items != NULL)
// cookies_items->resetTitleSkin(skin);
}
void CleanerMainWidget::receiveScanSignal()
{
this->getAllScanSelectedItems();
if (argsMap.empty()) {
toolKits->alertMSG(parentWindow->geometry().topLeft().x(), parentWindow->geometry().topLeft().y(), tr("Scan args is empty!"));
}
else {
emit this->showActionAnimaiton();
emit this->startScanSystem(argsMap);
}
}
void CleanerMainWidget::getAllScanSelectedItems()
{
argsMap.clear();
if (!m_selectedCache.isEmpty())
argsMap.insert("Cache", m_selectedCache);
if (!m_selectedCookie.isEmpty())
argsMap.insert("Cookies", m_selectedCookie);
if (!m_selectedTrace.isEmpty())
argsMap.insert("History", m_selectedTrace);
// QStringList cacheTmp;
//// QStringList packageTmp;
// QStringList cookieTmp;
// QStringList historyTmp;
// if(cache_btn != NULL && cache_btn->getCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = package_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = cookies_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = trace_items->getSelectedItems();
// for(int i = 0; i 0)
// argsMap.insert("Cache", cacheTmp);
//// if(packageTmp.length() > 0)
//// argsMap.insert("Packages", packageTmp);
// if(cookieTmp.length() > 0)
// argsMap.insert("Cookies", cookieTmp);
// if(historyTmp.length() > 0)
// argsMap.insert("History", historyTmp);
}
void CleanerMainWidget::onRefreshSelectedItems(CleanerCategoryID id, const QStringList &infos)
{
qDebug() << "AAAA" << id;
qDebug() << infos;
switch (id) {
case CleanerCategoryID::CacheCategory:
m_selectedCache.clear();
m_selectedCache = infos;
break;
case CleanerCategoryID::CookieCategory:
m_selectedCookie.clear();
m_selectedCookie = infos;
break;
case CleanerCategoryID::TraceCategory:
m_selectedTrace.clear();
m_selectedTrace = infos;
break;
default:
break;
}
}
void CleanerMainWidget::resetDefaultStatus()
{
cache_btn->resetMainStatus(2);
cookies_btn->resetMainStatus(2);
trace_btn->resetMainStatus(2);
m_selectedCache = cache_status_list;
m_selectedCookie = cookies_status_list;
m_selectedTrace = trace_status_list;
}
void CleanerMainWidget::onButtonClicked()
{
QObject *object = QObject::sender();
// KylinCheckBox *checkbox = qobject_cast(object);
CleanGroup *checkbox = qobject_cast(object);
QString object_name = checkbox->statusTip();
if (object_name == "cache") {
// int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
// int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
// cache_items->move(w_x, w_y);
// cache_items->exec();
m_selectedCache.clear();
m_selectedCache = cache_status_list;
SelectCategoryWidget *w = new SelectCategoryWidget(CleanerCategoryID::CacheCategory, tr("Cache Items"));
w->loadData(cache_list, cache_status_list);
connect(w, SIGNAL(notifyMainCheckBox(int)), cache_btn, SLOT(resetMainStatus(int)));
connect(w, SIGNAL(refreshSelectedItems(CleanerCategoryID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerCategoryID,QStringList)));
w->exec();
delete w;
}
// if(object_name == "package")
// {
// int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
// int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (200 / 2);
// package_items->move(w_x, w_y);
// package_items->exec();
// }
if (object_name == "cookies") {
// int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
// int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (170 / 2);
// cookies_items->move(w_x, w_y);
// cookies_items->exec();
m_selectedCookie.clear();
m_selectedCookie = cookies_status_list;
SelectCategoryWidget *w = new SelectCategoryWidget(CleanerCategoryID::CookieCategory, tr("Cookies Items"));
w->loadData(cookies_list, cookies_status_list);
connect(w, SIGNAL(notifyMainCheckBox(int)), cookies_btn, SLOT(resetMainStatus(int)));
connect(w, SIGNAL(refreshSelectedItems(CleanerCategoryID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerCategoryID,QStringList)));
w->exec();
delete w;
}
if (object_name == "trace") {
// m_selectedTrace.clear();
// m_selectedTrace = status_list;
// int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
// int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
// trace_items->move(w_x, w_y);
// trace_items->exec();
m_selectedCookie.clear();
m_selectedCookie = trace_status_list;
SelectCategoryWidget *w = new SelectCategoryWidget(CleanerCategoryID::TraceCategory, tr("Trace Items"));
w->loadData(trace_list, trace_status_list);
connect(w, SIGNAL(notifyMainCheckBox(int)), trace_btn, SLOT(resetMainStatus(int)));
connect(w, SIGNAL(refreshSelectedItems(CleanerCategoryID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerCategoryID,QStringList)));
w->exec();
delete w;
}
}
youker-assistant/cleaner/cleaneritems.h 0000664 0001750 0001750 00000004201 13260315532 017257 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CLEANERITEMS_H
#define CLEANERITEMS_H
#include
#include
#include
#include
#include "../component/kylintitlebar.h"
class MainWindow;
class QCheckBox;
class QGroupBox;
//class CleanerItems : public QWidget
class CleanerItems : public QDialog
{
Q_OBJECT
public:
// explicit CleanerItems(QStringList &arglist, QStringList &statuslist, int height = 0, const QString title_text = "UbuntuKylin", QWidget *parent = 0);
explicit CleanerItems(QStringList &arglist, QStringList &statuslist, QString skin = ":/background/res/skin/1.png", int height = 0, const QString title_text = "UbuntuKylin", QDialog *parent = 0);
~CleanerItems();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void setLanguage();
void initConnect();
int getItemCount();
QStringList getSelectedItems();
void resetTitleSkin(QString skin);
public slots:
void resetSubCheckbox(int status);
void scanAllSubCheckbox();
void onCloseButtonClicked();
private:
void initTitleBar(QString skin);
signals:
void notifyMainCheckBox(int status);
private:
QList checkbox_list;
MainWindow *p_mainwindow;
KylinTitleBar *title_bar;
QString titleName;
QPushButton *okBtn;
QGroupBox *group_box;
};
#endif // CLEANERITEMS_H
youker-assistant/cleaner/cleanermainwidget-new.cpp 0000664 0001750 0001750 00000037311 13260315532 021420 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cleanermainwidget.h"
#include
#include "../mainui/mainwindow.h"
#include "../component/cleangroup.h"
#include
#include
CleanerMainWidget::CleanerMainWidget(QWidget *parent, SessionDispatcher *seroxy, MainWindow *window, Toolkits *kits, QString skin)
: QWidget(parent), sessionproxy(seroxy), parentWindow(window), toolKits(kits)
{
this->setFixedSize(900, 403);
this->setObjectName("transparentWidget");
scanWidgets = new QStackedWidget(this);
// scanWidgets->setGeometry(rect());
// scanWidgets->lower();
scanWidgets->setGeometry(QRect(900, 0, 900, 403));
// this->setAutoFillBackground(true);
// QPalette palette;
// palette.setBrush(QPalette::Window, QBrush(Qt::white));
// this->setPalette(palette);
baseWidget = new QWidget(this);
baseWidget->setGeometry(rect());
// baseWidget->setAutoFillBackground(true);
// QPalette palette;
// palette.setBrush(QPalette::Window, QBrush(Qt::blue));
// baseWidget->setPalette(palette);
tip_label = new QLabel(baseWidget);
tip_label->setObjectName("tipLabel");
tip_label->setGeometry(QRect(30, 10, 800, 30));
QStringList cache_list, status_list;
cache_list << tr("Cleanup Package Cache") << tr("Cleanup Software Center Cache") << tr("Cleanup Thumbnails Cache") << tr("Cleanup FireFox Cache") << tr("Cleanup Chromium Cache");
status_list << "apt" << "software-center" << "thumbnails" << "firefox" << "chromium";
cache_items = new CleanerItems(cache_list, status_list, skin, 280, tr("Cache Items"));
connect(cache_items, SIGNAL(sendoksignal()), this, SLOT(showCleanMainPage()));
cache_btn = new CleanGroup(baseWidget, "://res/cache");
cache_btn->setGeometry(QRect(10, 50, 260, 150));
cache_btn->setStatusTip("cache");
cache_btn->setLabelText(tr("System Cache"), tr("Cleanup cache of system, software-center, thumbnails and browser"));//系统缓存垃圾 清除包、软件中心、缩略图和浏览器缓存
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cache_items, SIGNAL(notifyMainCheckBox(int)), cache_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(cache_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
QStringList package_list;
package_list << tr("Uninstall unnecessary procedures") << tr("Uninstall old kernel packages") << tr("Cleanup software configfile");
status_list.clear();
status_list << "unneed" << "oldkernel" << "configfile";
package_items = new CleanerItems(package_list, status_list, skin, 200, tr("Package Items"));
connect(package_items, SIGNAL(sendoksignal()), this, SLOT(showCleanMainPage()));
package_btn = new CleanGroup(baseWidget, "://res/cache");
package_btn->setGeometry(QRect(310, 50, 260, 150));
package_btn->setLabelText(tr("Packages and configfile"), tr("Cleaning up the software that installed by other software bundled, old kernel packages and configfile, to improve system performance"));//包垃圾 清除不必要的程序、旧内核包、配置文件
package_btn->setStatusTip("package");
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(package_items, SIGNAL(notifyMainCheckBox(int)), package_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(package_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
QStringList cookies_list;
cookies_list << tr("Cleanup the Cookies saving in Firefox") << tr("Cleanup the Cookies saving in Chromium");
status_list.clear();
status_list << "firefox" << "chromium";
cookies_items = new CleanerItems(cookies_list, status_list, skin, 170, tr("Cookies Items"));
connect(cookies_items, SIGNAL(sendoksignal()), this, SLOT(showCleanMainPage()));
cookies_btn = new CleanGroup(baseWidget, "://res/cache");
cookies_btn->setGeometry(QRect(610, 50, 260, 150));
cookies_btn->setLabelText(tr("Cookies"), tr("Clean up user login information, support Firefox and Chromium browser"));//清除上网、游戏、购物等记录
cookies_btn->setStatusTip("cookies");
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cookies_items, SIGNAL(notifyMainCheckBox(int)), cookies_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(cookies_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
QStringList trace_list;
trace_list << tr("Clean up the Firefox Internet records") << tr("Clean up the Chromium Internet records") << tr("Clean up the recently opened documents records") << tr("Delete the command history") << tr("Delete the debug logs");
status_list.clear();
status_list << "firefox" << "chromium" << "system" << "bash" << "X11";
trace_items = new CleanerItems(trace_list, status_list, skin, 280, tr("Trace Items"));
connect(trace_items, SIGNAL(sendoksignal()), this, SLOT(showCleanMainPage()));
trace_btn = new CleanGroup(baseWidget, "://res/cache");
trace_btn->setGeometry(QRect(10, 240, 260, 150));
trace_btn->setLabelText(tr("History trace"), tr("Cleaning the internet and opened documents recently records"));//使用痕迹 清除浏览器和系统使用痕迹
trace_btn->setStatusTip("trace");
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(trace_items, SIGNAL(notifyMainCheckBox(int)), trace_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(trace_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
// QHBoxLayout *tip_layout = new QHBoxLayout();
// tip_layout->addWidget(tip_label);
// tip_layout->addStretch();
// tip_layout->setMargin(0);
// tip_layout->setContentsMargins(38,20,72,0);
// QHBoxLayout *layout1 = new QHBoxLayout;
// layout1->addWidget(cache_btn);
// layout1->addWidget(package_btn);
// layout1->addWidget(cookies_btn);
// layout1->setMargin(0);
// layout1->setContentsMargins(0,0,0,0);
// QHBoxLayout *layout2 = new QHBoxLayout;
// layout2->addWidget(trace_btn);
// layout2->addStretch();
// layout1->setMargin(0);
// layout2->setContentsMargins(20,0,0,0);
// QVBoxLayout *layoutbox = new QVBoxLayout;
// layoutbox->addLayout(layout1);
// layoutbox->addLayout(layout2);
// layoutbox->setSpacing(20);
// layoutbox->setMargin(0);
// layoutbox->setContentsMargins(0,0,0,0);
// QVBoxLayout *main_layout = new QVBoxLayout;
// main_layout->addLayout(tip_layout);
// main_layout->addLayout(layoutbox);
// main_layout->addStretch();
// main_layout->setSpacing(30);
// main_layout->setMargin(0);
// main_layout->setContentsMargins(0,0,0,0);
// setLayout(main_layout);
this->setLanguage();
scanWidgets->addWidget(cache_items);
scanWidgets->addWidget(package_items);
scanWidgets->addWidget(cookies_items);
scanWidgets->addWidget(trace_items);
this->initAnimation();
}
CleanerMainWidget::~CleanerMainWidget()
{
}
void CleanerMainWidget::initAnimation()
{
QPropertyAnimation *m_upMainAnimation = new QPropertyAnimation(baseWidget, "pos");
m_upMainAnimation->setDuration(200);
m_upMainAnimation->setStartValue(QPoint(0, 0));
m_upMainAnimation->setEndValue(QPoint(-900, 0));
QPropertyAnimation *m_downMainAnimation = new QPropertyAnimation(scanWidgets, "pos");
m_downMainAnimation->setDuration(200);
m_downMainAnimation->setStartValue(QPoint(900, 0));
m_downMainAnimation->setEndValue(QPoint(0, 0));
// QPropertyAnimation *m_toTrans = new QPropertyAnimation(m_grayWidget, "opacity");
// m_toTrans->setDuration(200);
// m_toTrans->setStartValue(1);
// m_toTrans->setEndValue(0);
m_upGroup = new QParallelAnimationGroup;
m_upGroup->addAnimation(m_upMainAnimation);
m_upGroup->addAnimation(m_downMainAnimation);
// m_upGroup->addAnimation(m_toTrans);
QPropertyAnimation *m_upGarAnimation = new QPropertyAnimation(baseWidget, "pos");
m_upGarAnimation->setDuration(200);
m_upGarAnimation->setStartValue(QPoint(-900, 0));
m_upGarAnimation->setEndValue(QPoint(0, 0));
QPropertyAnimation *m_downGarAnimation = new QPropertyAnimation(scanWidgets, "pos");
m_downGarAnimation->setDuration(200);
m_downGarAnimation->setStartValue(QPoint(0, 0));
m_downGarAnimation->setEndValue(QPoint(900, 0));
// QPropertyAnimation *m_toGray = new QPropertyAnimation(m_grayWidget, "opacity");
// m_toGray->setDuration(200);
// m_toGray->setStartValue(0);
// m_toGray->setEndValue(1);
m_downGroup = new QParallelAnimationGroup;
m_downGroup->addAnimation(m_upGarAnimation);
m_downGroup->addAnimation(m_downGarAnimation);
// m_downGroup->addAnimation(m_toGray);
connect(m_upGroup, SIGNAL(finished()), SLOT(onUpGroupFinished()));
}
void CleanerMainWidget::setLanguage()
{
tip_label->setText(tr("Please select the items you want to clean"));
}
void CleanerMainWidget::resetCurrentSkin(QString skin)
{
// if(cache_items != NULL)
// cache_items->resetTitleSkin(skin);
// if(trace_items != NULL)
// trace_items->resetTitleSkin(skin);
// if(package_items != NULL)
// package_items->resetTitleSkin(skin);
// if(cookies_items != NULL)
// cookies_items->resetTitleSkin(skin);
}
void CleanerMainWidget::showCleanMainPage()
{
m_downGroup->start();
qDebug() << "back to main.....";
}
void CleanerMainWidget::onUpGroupFinished()
{
scanWidgets->currentWidget()->show();
}
void CleanerMainWidget::receiveScanSignal()
{
this->getAllScanSelectedItems();
if(argsMap.empty())
{
toolKits->alertMSG(parentWindow->geometry().topLeft().x(), parentWindow->geometry().topLeft().y(), tr("Scan args is empty!"));
}
else
{
qDebug() << "args is.........." << argsMap;
// emit this->showActionAnimaiton();
// sessionproxy->scanSystemCleanerItems(argsMap);
}
}
void CleanerMainWidget::getAllScanSelectedItems()
{
argsMap.clear();
QStringList cacheTmp;
QStringList packageTmp;
QStringList cookieTmp;
QStringList historyTmp;
if(cache_btn != NULL && cache_btn->getCheckBoxStatus() != 0)
{
QStringList tmp = cache_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = package_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = cookies_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = trace_items->getSelectedItems();
for(int i = 0; i 0)
argsMap.insert("Cache", cacheTmp);
if(packageTmp.length() > 0)
argsMap.insert("Packages", packageTmp);
if(cookieTmp.length() > 0)
argsMap.insert("Cookies", cookieTmp);
if(historyTmp.length() > 0)
argsMap.insert("History", historyTmp);
}
void CleanerMainWidget::onButtonClicked()
{
QObject *object = QObject::sender();
// KylinCheckBox *checkbox = qobject_cast(object);
CleanGroup *checkbox = qobject_cast(object);
QString object_name = checkbox->statusTip();
if(object_name == "cache")
{
scanWidgets->setCurrentWidget(cache_items);
m_upGroup->start();
// if(cache_items->isHidden()) {
// int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
// int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
// cache_items->move(w_x, w_y);
// cache_items->show();
// }
// else
// {
// cache_items->hide();
// }
// if(!package_items->isHidden()) {
// package_items->hide();
// }
// if(!cookies_items->isHidden()) {
// cookies_items->hide();
// }
// if(!trace_items->isHidden()) {
// trace_items->hide();
// }
}
else if(object_name == "package")
{
scanWidgets->setCurrentWidget(package_items);
m_upGroup->start();
// if(package_items->isHidden()) {
// int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
// int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (200 / 2);
// package_items->move(w_x, w_y);
// package_items->show();
// }
// else
// {
// package_items->hide();
// }
// if(!cache_items->isHidden()) {
// cache_items->hide();
// }
// if(!cookies_items->isHidden()) {
// cookies_items->hide();
// }
// if(!trace_items->isHidden()) {
// trace_items->hide();
// }
}
if(object_name == "cookies")
{
scanWidgets->setCurrentWidget(cookies_items);
m_upGroup->start();
// if(cookies_items->isHidden()) {
// int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
// int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (170 / 2);
// cookies_items->move(w_x, w_y);
// cookies_items->show();
// }
// else
// {
// cookies_items->hide();
// }
// if(!cache_items->isHidden()) {
// cache_items->hide();
// }
// if(!package_items->isHidden()) {
// package_items->hide();
// }
// if(!trace_items->isHidden()) {
// trace_items->hide();
// }
}
if(object_name == "trace")
{
scanWidgets->setCurrentWidget(trace_items);
m_upGroup->start();
// if(trace_items->isHidden()) {
// int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
// int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (200 / 2);
// trace_items->move(w_x, w_y);
// trace_items->show();
// }
// else
// {
// trace_items->hide();
// }
// if(!cache_items->isHidden()) {
// cache_items->hide();
// }
// if(!package_items->isHidden()) {
// package_items->hide();
// }
// if(!cookies_items->isHidden()) {
// cookies_items->hide();
// }
}
}
youker-assistant/cleaner/cleanerdetailwidget.h 0000664 0001750 0001750 00000006512 13260315532 020613 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CLEANERDETAILWIDGET_H
#define CLEANERDETAILWIDGET_H
#include
#include
#include
#include
#include "../component/utils.h"
class QLabel;
class QBoxLayout;
class QHBoxLayout;
class QVBoxLayout;
class QGridLayout;
class Toolkits;
class MainWindow;
class CleanSubGroup;
class CleanerDetailWidget : public QWidget
{
Q_OBJECT
public:
explicit CleanerDetailWidget(QWidget *parent = 0, MainWindow *window = 0, Toolkits *kits = 0, QString skin = ":/background/res/skin/1.png");
~CleanerDetailWidget();
void setUIData();
void setLanguage();
void initConnect();
void getAllSelectedItems();
void resetCurrentSkin(QString skin);
void addItem(CleanSubGroup *item);
public slots:
void showCustomPage();
void showReciveData(const QStringList &data);
void receiveCleanSignal();
void showReciveStatus(const QString &status);
void CleanUIAndData();
// void receivePolicyKitSignal(bool status);
void onRefreshSelectedItems(CleanerModuleID id, const QStringList &infos);
void clearItems();
signals:
// void notifyMainCheckBox(int status);
// void showActionAnimaiton();
void sendScanOverStatus(bool status);
void startCleanSystem(QMap itemsMap);
private:
MainWindow *parentWindow;
Toolkits *toolKits;
QMap argsData;
QStringList cache_apt_list;
QStringList cache_software_list;
QStringList cache_thumbnails_list;
QStringList cache_firefox_list;
QStringList cache_chromium_list;
/*QStringList package_unneed_list;
QStringList package_oldkernel_list;
QStringList package_configfile_list;*/
QStringList cookies_firefox_list;
QStringList cookies_chromium_list;
QString trace_firefox_count;
QString trace_chromium_count;
QString trace_system_count;
QString trace_bash_size;
QString trace_bash_path;
QStringList trace_x11_list;
QStringList m_selectedAptList;
QStringList m_selectedSoftwareList;
QStringList m_selectedThumbnailsList;
QStringList m_selectedFirefoxCacheList;
QStringList m_selectedChromiumCacheList;
QStringList m_selectedFirefoxCookieList;
QStringList m_selectedChromiumCookieList;
QStringList m_selectedTraceX11List;
bool scanResult;
QString cur_skin;
QVBoxLayout *mainLayout = nullptr;
QLabel *m_emptyLabel = nullptr;
QScrollArea *m_scrollArea = nullptr;
QWidget *areaWidget = nullptr;
QGridLayout *areaWidgetLayout = nullptr;
QList m_cardlist;
int m_row;
int m_column;
};
#endif // CLEANERDETAILWIDGET_H
youker-assistant/cleaner/cacheactionwidget.h 0000664 0001750 0001750 00000002443 13260315532 020257 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CACHEACTIONWIDGET_H
#define CACHEACTIONWIDGET_H
#include
class MainWindow;
class QLabel;
class CacheActionWidget : public QWidget
{
Q_OBJECT
public:
explicit CacheActionWidget(QWidget *parent = 0);
~CacheActionWidget();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void setLanguage();
private:
QLabel *img_label;
QLabel *title_label;
QLabel *description_label;
MainWindow *p_mainwindow;
};
#endif // CACHEACTIONWIDGET_H
youker-assistant/cleaner/cleanerdetailwidget.cpp 0000664 0001750 0001750 00000211567 13260315532 021156 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cleanerdetailwidget.h"
#include "../src/mainwindow.h"
#include "../component/cleansubgroup.h"
#include "../component/selectwidget.h"
#include
#include
const int defaultColumn = 4;//5 items for one line
CleanerDetailWidget::CleanerDetailWidget(QWidget *parent, MainWindow *window, Toolkits *kits, QString skin)
: QWidget(parent), parentWindow(window), toolKits(kits),cur_skin(skin)
{
// this->setStyleSheet("QWidget{border: none}");
this->setFixedSize(900, 403);
this->setObjectName("transparentWidget");
this->setWindowIcon(QIcon(":/res/kylin-assistant.png"));
mainLayout = new QVBoxLayout(this);
m_emptyLabel = new QLabel(this);
m_emptyLabel->setText(tr("No garbage"));
m_emptyLabel->setVisible(false);
/*this->setAutoFillBackground(true);
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(Qt::white));
this->setPalette(palette);*/
// this->setObjectName("transparentWidget");
// this->setAutoFillBackground(true);
// QPalette palette;
// palette.setBrush(QPalette::Window, QBrush(Qt::white));
// this->setPalette(palette);
// this->number_per_row = -1;
// this->itemwidth = 160;
// this->itemheight = 110;
// this->cardspace = 10;
// subCount = 0;
scanResult = false;
m_row = 0;
m_column = 0;
m_scrollArea = new QScrollArea(this);
m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_scrollArea->setWidgetResizable(true);
m_scrollArea->setStyleSheet("QScrollArea{border: none;background-color: #ffffff;}");
areaWidget = new QWidget(/*this*/);
areaWidget->setObjectName("transparentWidget");
m_scrollArea->setWidget(areaWidget);
areaWidgetLayout = new QGridLayout(areaWidget);
areaWidgetLayout->setAlignment(Qt::AlignTop);
mainLayout->addWidget(m_emptyLabel);//QStackedLayout
mainLayout->addWidget(m_scrollArea);
/*ui->scrollAreaWidgetContents->setGeometry(0, 0, this->width(), this->height());
ui->scrollArea->setFixedSize(900, 403);
ui->scrollArea->setAutoFillBackground(true);
ui->scrollArea->setBackgroundRole(QPalette::Light);
ui->label->hide();*/
// grid_layout = new QGridLayout();
// rowIndex = columnIndex = 0;
// cache_apt_items = NULL;
// cache_apt_btn = NULL;
//// cache_software_items = NULL;
// cache_software_btn = NULL;
//// cache_thumbnails_items = NULL;
// cache_thumbnails_btn = NULL;
//// cache_firefox_items = NULL;
// cache_firefox_btn = NULL;
//// cache_chromium_items = NULL;
// cache_chromium_btn = NULL;
// package_unneed_items = NULL;
// package_unneed_btn = NULL;
// package_oldkernel_items = NULL;
// package_oldkernel_btn = NULL;
// package_configfile_items = NULL;
// package_configfile_btn = NULL;
// cookies_firefox_items = NULL;
// cookies_firefox_btn = NULL;
//// cookies_chromium_items = NULL;
// cookies_chromium_btn = NULL;
// trace_firefox_btn = NULL;
// trace_chromium_btn = NULL;
// trace_system_btn = NULL;
// trace_bash_btn = NULL;
// trace_x11_btn = NULL;
// trace_x11_items = NULL;
// ui->scrollAreaWidgetContents->setLayout(grid_layout);
// this->number_per_row = (this->width() + this->cardspace - 60) / (this->itemwidth + this->cardspace);
this->setLanguage();
/*
//test for adding a title
QLabel *titleLabel = new QLabel(tr("List"));
areaWidgetLayout->addWidget(titleLabel, m_row, m_column, 1, 4);
m_row ++;
*/
/*
//test for another module append to this page
m_column = 0;
m_row ++;
*/
}
CleanerDetailWidget::~CleanerDetailWidget()
{
this->CleanUIAndData();
// if(cache_apt_items != NULL)
// {
// delete cache_apt_items;
// cache_apt_items = NULL;
// }
// if(cache_software_items != NULL)
// {
// delete cache_software_items;
// cache_software_items = NULL;
// }
// if(cache_thumbnails_items != NULL)
// {
// delete cache_thumbnails_items;
// cache_thumbnails_items = NULL;
// }
// if(cache_firefox_items != NULL)
// {
// delete cache_firefox_items;
// cache_firefox_items = NULL;
// }
// if(cache_chromium_items != NULL)
// {
// delete cache_chromium_items;
// cache_chromium_items = NULL;
// }
/*if(package_unneed_items != NULL)
{
delete package_unneed_items;
package_unneed_items = NULL;
}
if(package_oldkernel_items != NULL)
{
delete package_oldkernel_items;
package_oldkernel_items = NULL;
}
if(package_configfile_items != NULL)
{
delete package_configfile_items;
package_configfile_items = NULL;
}*/
// if(cookies_firefox_items != NULL)
// {
// delete cookies_firefox_items;
// cookies_firefox_items = NULL;
// }
// if(cookies_chromium_items != NULL)
// {
// delete cookies_chromium_items;
// cookies_chromium_items = NULL;
// }
// if(trace_x11_items != NULL)
// {
// delete trace_x11_items;
// trace_x11_items = NULL;
// }
// if(grid_layout != NULL)
// {
// delete grid_layout;
// grid_layout = NULL;
// }
// delete ui;
}
void CleanerDetailWidget::onRefreshSelectedItems(CleanerModuleID id, const QStringList &infos)
{
switch (id) {
case CleanerModuleID::CacheApt:
m_selectedAptList.clear();
m_selectedAptList = infos;
break;
case CleanerModuleID::CacheSoftware:
m_selectedSoftwareList.clear();
m_selectedSoftwareList = infos;
break;
case CleanerModuleID::CacheThumbnail:
m_selectedThumbnailsList.clear();
m_selectedThumbnailsList = infos;
break;
case CleanerModuleID::CacheFirefox:
m_selectedFirefoxCacheList.clear();
m_selectedFirefoxCacheList = infos;
break;
case CleanerModuleID::CacheChromium:
m_selectedChromiumCacheList.clear();
m_selectedChromiumCacheList = infos;
break;
case CleanerModuleID::CookieFirefox:
m_selectedFirefoxCookieList.clear();
m_selectedFirefoxCookieList = infos;
break;
case CleanerModuleID::CookieChromium:
m_selectedChromiumCookieList.clear();
m_selectedChromiumCookieList = infos;
break;
case CleanerModuleID::TraceX11:
m_selectedTraceX11List.clear();
m_selectedTraceX11List = infos;
break;
default:
break;
}
}
void CleanerDetailWidget::CleanUIAndData()
{
this->m_emptyLabel->setVisible(false);
// if(!ui->label->isHidden())
// ui->label->hide();
scanResult = false;
// subCount = 0;
// rowIndex = columnIndex = 0;
cache_apt_list.clear();
cache_software_list.clear();
cache_thumbnails_list.clear();
cache_firefox_list.clear();
cache_chromium_list.clear();
/*package_unneed_list.clear();
package_oldkernel_list.clear();
package_configfile_list.clear();*/
cookies_firefox_list.clear();
cookies_chromium_list.clear();
trace_firefox_count.clear();
trace_chromium_count.clear();
trace_system_count.clear();
trace_bash_size.clear();
trace_bash_path.clear();
trace_x11_list.clear();
m_selectedAptList.clear();
m_selectedSoftwareList.clear();
m_selectedThumbnailsList.clear();
m_selectedFirefoxCacheList.clear();
m_selectedChromiumCacheList.clear();
m_selectedFirefoxCookieList.clear();
m_selectedChromiumCookieList.clear();
m_selectedTraceX11List.clear();
//clear ui
// foreach (QObject *child, ui->scrollAreaWidgetContents->children()) {
// QWidget *widget = static_cast(child);
// widget->deleteLater();
// }
/*for(int i=0; iclearItems();
// ui->scrollAreaWidgetContents->setGeometry(0, 0, this->width(), this->height());
// this->subCount = 0;
// while(grid_layout != NULL && grid_layout->count() > 0)
// {
// QWidget* widget = grid_layout->itemAt(0)->widget();
// grid_layout->removeWidget(widget);
// delete widget;
// }
}
void CleanerDetailWidget::addItem(CleanSubGroup *item)
{
this->m_cardlist.append(item);
areaWidgetLayout->addWidget(item, m_row, m_column, 1, 1);
if(m_column == defaultColumn) {
m_column = 0;
m_row++;
}
else {
m_column++;
}
}
void CleanerDetailWidget::showReciveData(const QStringList &data)
{
//----------------------------------------------------------------Cache---------------------------
if(data.at(0) == "Belong:Cache.apt" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
cache_apt_list.append(data.at(1).split(":").at(1));
}
}
else if(data.at(0) == "Belong:Cache.software-center" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
cache_software_list.append(data.at(1).split(":").at(1));
}
}
else if(data.at(0) == "Belong:Cache.thumbnails" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
cache_thumbnails_list.append(data.at(1).split(":").at(1));
}
}
else if(data.at(0) == "Belong:Cache.firefox" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
cache_firefox_list.append(data.at(1).split(":").at(1));
}
}
else if(data.at(0) == "Belong:Cache.chromium" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
cache_chromium_list.append(data.at(1).split(":").at(1));
}
}
//----------------------------------------------------------------Package---------------------------
/*else if(data.at(0) == "Belong:Packages.unneed" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
package_unneed_list.append(data.at(1).split(":").at(1));
}
}
else if(data.at(0) == "Belong:Packages.oldkernel" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
package_oldkernel_list.append(data.at(1).split(":").at(1));
}
}
else if(data.at(0) == "Belong:Packages.configfile" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
package_configfile_list.append(data.at(1).split(":").at(1));
}
}*/
//----------------------------------------------------------------Cookies---------------------------
else if(data.at(0) == "Belong:Cookies.firefox" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":") && !data.at(1).split(":").at(1).isEmpty())
{
if (scanResult == false)
scanResult = true;
cookies_firefox_list.append(data.at(1).split(":").at(1));
}
}
else if(data.at(0) == "Belong:Cookies.chromium" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":") && !data.at(1).split(":").at(1).isEmpty())
{
if (scanResult == false)
scanResult = true;
cookies_chromium_list.append(data.at(1).split(":").at(1));
}
}
//----------------------------------------------------------------History Trace---------------------------
else if(data.at(0) == "Belong:History.firefox" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if(data.at(1).split(":").at(1).toInt() != 0) {
if (scanResult == false)
scanResult = true;
trace_firefox_count = data.at(1).split(":").at(1);
}
}
}
else if(data.at(0) == "Belong:History.chromium" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if(data.at(1).split(":").at(1).toInt() != 0) {
if (scanResult == false)
scanResult = true;
trace_chromium_count = data.at(1).split(":").at(1);
}
}
}
else if(data.at(0) == "Belong:History.system" && !data.at(1).isEmpty())
{
if(data.at(1).contains(":"))
{
if(data.at(1).split(":").at(1).toInt() != 0) {
if (scanResult == false)
scanResult = true;
trace_system_count = data.at(1).split(":").at(1);
}
}
}
else if(data.at(0) == "Belong:History.bash" && !data.at(1).isEmpty() && !data.at(2).isEmpty())
{
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
trace_bash_size= data.at(1).split(":").at(1);
trace_bash_path= data.at(2).split(":").at(1);
}
// qDebug() << "bash------------";
// qDebug() << data.at(1);//"Size:55.67 KB"
// qDebug() << data.at(2);/"Path:/home/kobe/.bash_history"
}
else if(data.at(0) == "Belong:History.X11")// && !data.at(1).isEmpty() && !data.at(2).isEmpty()
{
// qDebug() << "x11------------";
// qDebug() << data.at(1);//Path:/home/kobe/.xsession-errors
// qDebug() << data.at(2);//Type:file
// qDebug() << data.at(3);//Size:0.98 KB
if(data.at(1).contains(":"))
{
if (scanResult == false)
scanResult = true;
trace_x11_list.append(data.at(1).split(":").at(1));
}
}
}
void CleanerDetailWidget::showReciveStatus(const QString &status)
{
if(status == "Complete:Cache") {
if(cache_apt_list.length() > 0) {
m_selectedAptList.clear();
m_selectedAptList = cache_apt_list;
// cache_apt_btn = new CommonCheckBox(0, "://res/cache");
CleanSubGroup *cache_apt_btn = new CleanSubGroup(this, "://res/janitor/apt");
cache_apt_btn->setFocusPolicy(Qt::NoFocus);
// cache_apt_btn->setFixedSize(160, 130);
// cache_apt_btn->setFixedSize(160, 200);
cache_apt_btn->setStatusTip("cache-apt");
cache_apt_btn->setLabelText(tr("Apt Cache count:"), cache_apt_list.length());
//点击自定义按钮后,显示自定义页面
connect(cache_apt_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
this->addItem(cache_apt_btn);
/*cache_apt_items = new CleanListWidget(cache_apt_list, this->cur_skin, tr("Apt Cache Clean Items"));
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cache_apt_items, SIGNAL(notifyMainCheckBox(int)), cache_apt_btn, SLOT(resetMainStatus(int)));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_apt_btn, SIGNAL(spreadStatus(int)), cache_apt_items, SLOT(resetSubCheckbox(int)));*/
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(cache_apt_btn, subCount/5, subCount%5);
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
cache_apt_btn->move(x, y);
cache_apt_btn->show();*/
// m_cardlist.append(cache_apt_btn);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(cache_apt_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(cache_apt_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(cache_software_list.length() > 0) {
m_selectedSoftwareList.clear();
m_selectedSoftwareList = cache_software_list;
// cache_software_btn = new CommonCheckBox(0, "://res/cache");
CleanSubGroup *cache_software_btn = new CleanSubGroup(this, "://res/janitor/software");
cache_software_btn->setFocusPolicy(Qt::NoFocus);
// cache_software_btn->setFixedSize(160, 130);
// cache_software_btn->setFixedSize(160, 200);
cache_software_btn->setStatusTip("cache-software");
cache_software_btn->setLabelText(tr("Software Cache count:"), cache_software_list.length());
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_software_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
this->addItem(cache_software_btn);
/*cache_software_items = new CleanListWidget(cache_software_list, this->cur_skin, tr("Software Cache Clean Items"));
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cache_software_items, SIGNAL(notifyMainCheckBox(int)), cache_software_btn, SLOT(resetMainStatus(int)));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_software_btn, SIGNAL(spreadStatus(int)), cache_software_items, SLOT(resetSubCheckbox(int)));*/
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
cache_software_btn->move(x, y);
cache_software_btn->show();*/
// m_cardlist.append(cache_software_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(cache_software_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(cache_software_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(cache_software_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if (cache_thumbnails_list.length() > 0) {
m_selectedThumbnailsList.clear();
m_selectedThumbnailsList = cache_thumbnails_list;
// cache_thumbnails_btn = new CommonCheckBox(0, "://res/cache");
CleanSubGroup *cache_thumbnails_btn = new CleanSubGroup(this, "://res/janitor/thumbnails");
cache_thumbnails_btn->setFocusPolicy(Qt::NoFocus);
// cache_thumbnails_btn->setFixedSize(160, 130);
// cache_thumbnails_btn->setFixedSize(160, 200);
cache_thumbnails_btn->setStatusTip("cache-thumbnails");
cache_thumbnails_btn->setLabelText(tr("Thumbnails Cache Count:"), cache_thumbnails_list.length());
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_thumbnails_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
this->addItem(cache_thumbnails_btn);
/*cache_thumbnails_items = new CleanListWidget(cache_thumbnails_list, this->cur_skin, tr("Thumbnails Cache Clean Items"));
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cache_thumbnails_items, SIGNAL(notifyMainCheckBox(int)), cache_thumbnails_btn, SLOT(resetMainStatus(int)));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_thumbnails_btn, SIGNAL(spreadStatus(int)), cache_thumbnails_items, SLOT(resetSubCheckbox(int)));*/
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
cache_thumbnails_btn->move(x, y);
cache_thumbnails_btn->show();*/
// m_cardlist.append(cache_thumbnails_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(cache_thumbnails_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(cache_thumbnails_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(cache_thumbnails_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(cache_firefox_list.length() > 0) {
m_selectedFirefoxCacheList.clear();
m_selectedFirefoxCacheList = cache_firefox_list;
// cache_firefox_btn = new CommonCheckBox(0, "://res/cache");
CleanSubGroup *cache_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox");
cache_firefox_btn->setFocusPolicy(Qt::NoFocus);
// cache_firefox_btn->setFixedSize(160, 130);
cache_firefox_btn->setStatusTip("cache-firefox");
cache_firefox_btn->setLabelText(tr("Firefox Cache Count:"), cache_firefox_list.length());
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_firefox_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
this->addItem(cache_firefox_btn);
/*cache_firefox_items = new CleanListWidget(cache_firefox_list, this->cur_skin, tr("Firefox Cache Clean Items"));
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cache_firefox_items, SIGNAL(notifyMainCheckBox(int)), cache_firefox_btn, SLOT(resetMainStatus(int)));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_firefox_btn, SIGNAL(spreadStatus(int)), cache_firefox_items, SLOT(resetSubCheckbox(int)));*/
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
cache_firefox_btn->move(x, y);
cache_firefox_btn->show();*/
// m_cardlist.append(cache_firefox_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(cache_firefox_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(cache_firefox_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(cache_firefox_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(cache_chromium_list.length() > 0) {
m_selectedChromiumCacheList.clear();
m_selectedChromiumCacheList = cache_chromium_list;
// cache_chromium_btn = new CommonCheckBox(0, "://res/cache");
CleanSubGroup *cache_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium");
cache_chromium_btn->setFocusPolicy(Qt::NoFocus);
// cache_chromium_btn->setFixedSize(160, 130);
cache_chromium_btn->setStatusTip("cache-chromium");
cache_chromium_btn->setLabelText(tr("Chromium Cache Count:"), cache_chromium_list.length());
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_chromium_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
this->addItem(cache_chromium_btn);
/*cache_chromium_items = new CleanListWidget(cache_chromium_list, this->cur_skin, tr("Thumbnails Cache Clean Items"));
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cache_chromium_items, SIGNAL(notifyMainCheckBox(int)), cache_chromium_btn, SLOT(resetMainStatus(int)));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cache_chromium_btn, SIGNAL(spreadStatus(int)), cache_chromium_items, SLOT(resetSubCheckbox(int)));*/
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
cache_chromium_btn->move(x, y);
cache_chromium_btn->show();*/
// m_cardlist.append(cache_chromium_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(cache_chromium_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(cache_chromium_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(cache_chromium_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
}
else if(status == "Complete:Cookies") {
// doing_label->setText(tr("Cookies Scan OK......"));
if(cookies_firefox_list.length() > 0) {
m_selectedFirefoxCookieList.clear();
m_selectedFirefoxCookieList = cookies_firefox_list;
// cookies_firefox_btn = new CommonCheckBox(0, "://res/cookie");
CleanSubGroup *cookies_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox");
cookies_firefox_btn->setFocusPolicy(Qt::NoFocus);
// cookies_firefox_btn->setFixedSize(160, 130);
cookies_firefox_btn->setStatusTip("cookes-firefox");
cookies_firefox_btn->setLabelText(tr("Firefox Cookies Count:"), cookies_firefox_list.length());
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cookies_firefox_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
this->addItem(cookies_firefox_btn);
/*cookies_firefox_items = new CleanListWidget(cookies_firefox_list, this->cur_skin, tr("Firefox Cookies Clean Items"));
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cookies_firefox_items, SIGNAL(notifyMainCheckBox(int)), cookies_firefox_btn, SLOT(resetMainStatus(int)));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cookies_firefox_btn, SIGNAL(spreadStatus(int)), cookies_firefox_items, SLOT(resetSubCheckbox(int)));*/
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
cookies_firefox_btn->move(x, y);
cookies_firefox_btn->show();*/
// m_cardlist.append(cookies_firefox_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(cookies_firefox_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(cookies_firefox_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(cookies_firefox_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(cookies_chromium_list.length() > 0) {
m_selectedChromiumCookieList.clear();
m_selectedChromiumCookieList = cookies_chromium_list;
// cookies_chromium_btn = new CommonCheckBox(0, "://res/cache");
CleanSubGroup *cookies_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium");
cookies_chromium_btn->setFocusPolicy(Qt::NoFocus);
// cookies_chromium_btn->setFixedSize(160, 130);
cookies_chromium_btn->setStatusTip("cookes-chromium");
cookies_chromium_btn->setLabelText(tr("Chromium Cookies Count:"), cookies_chromium_list.length());
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cookies_chromium_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
this->addItem(cookies_chromium_btn);
/*cookies_chromium_items = new CleanListWidget(cookies_chromium_list, this->cur_skin, tr("Chromium Cookies Clean Items"));
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cookies_chromium_items, SIGNAL(notifyMainCheckBox(int)), cookies_chromium_btn, SLOT(resetMainStatus(int)));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(cookies_chromium_btn, SIGNAL(spreadStatus(int)), cookies_chromium_items, SLOT(resetSubCheckbox(int)));*/
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
cookies_chromium_btn->move(x, y);
cookies_chromium_btn->show();*/
// m_cardlist.append(cookies_chromium_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(cookies_chromium_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(cookies_chromium_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(cookies_chromium_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
}
else if(status == "Complete:History") {
// doing_label->setText(tr("History Scan OK"));
if(trace_firefox_count.length() > 0) {
// trace_firefox_btn = new CommonCheckBox(0, "://res/cache");
CleanSubGroup *trace_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox");
trace_firefox_btn->setFocusPolicy(Qt::NoFocus);
// trace_firefox_btn->setFixedSize(160, 130);
trace_firefox_btn->hideCustomButton();
trace_firefox_btn->setStatusTip("history-firefox");
trace_firefox_btn->setLabelText(tr("Firefox History Count:"), trace_firefox_count.toInt());
this->addItem(trace_firefox_btn);
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
trace_firefox_btn->move(x, y);
trace_firefox_btn->show();*/
// m_cardlist.append(trace_firefox_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(trace_firefox_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(trace_firefox_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(trace_firefox_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(trace_chromium_count.length() > 0) {
CleanSubGroup *trace_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium");
trace_chromium_btn->setFocusPolicy(Qt::NoFocus);
trace_chromium_btn->hideCustomButton();
trace_chromium_btn->setStatusTip("history-chromium");
trace_chromium_btn->setLabelText(tr("Chromium History Count:"), trace_chromium_count.toInt());
this->addItem(trace_chromium_btn);
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
trace_chromium_btn->move(x, y);
trace_chromium_btn->show();*/
// m_cardlist.append(trace_chromium_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(trace_chromium_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(trace_chromium_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(trace_chromium_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(trace_system_count.length() > 0) {
CleanSubGroup *trace_system_btn = new CleanSubGroup(this, "://res/janitor/trace");
trace_system_btn->setFocusPolicy(Qt::NoFocus);
trace_system_btn->hideCustomButton();
trace_system_btn->setStatusTip("history-system");
trace_system_btn->setLabelText(tr("System History Count:"), trace_system_count.toInt());
this->addItem(trace_system_btn);
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
trace_system_btn->move(x, y);
trace_system_btn->show();*/
// m_cardlist.append(trace_system_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(trace_system_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(trace_system_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(trace_system_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
//kobe
if(!trace_bash_path.isEmpty()) {
CleanSubGroup *trace_bash_btn = new CleanSubGroup(this, "://res/janitor/trace");
trace_bash_btn->setFocusPolicy(Qt::NoFocus);
trace_bash_btn->hideCustomButton();
trace_bash_btn->setStatusTip("history-bash");
trace_bash_btn->setLabelStringText(tr("Command history size:"), trace_bash_size);
this->addItem(trace_bash_btn);
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
trace_bash_btn->move(x, y);
trace_bash_btn->show();*/
// m_cardlist.append(trace_bash_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(trace_bash_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(trace_bash_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(trace_bash_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(trace_x11_list.length() > 0) {
m_selectedTraceX11List.clear();
m_selectedTraceX11List = trace_x11_list;
CleanSubGroup *trace_x11_btn = new CleanSubGroup(this, "://res/janitor/debug");
trace_x11_btn->setFocusPolicy(Qt::NoFocus);
trace_x11_btn->setStatusTip("x11-history");
trace_x11_btn->setLabelText(tr("Debug log:"), trace_x11_list.length());
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(trace_x11_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
this->addItem(trace_x11_btn);
/*trace_x11_items = new CleanListWidget(trace_x11_list, this->cur_skin, tr("Debug log Items"));
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(trace_x11_items, SIGNAL(notifyMainCheckBox(int)), trace_x11_btn, SLOT(resetMainStatus(int)));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(trace_x11_btn, SIGNAL(spreadStatus(int)), trace_x11_items, SLOT(resetSubCheckbox(int)));*/
/*int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
trace_x11_btn->move(x, y);
trace_x11_btn->show();*/
// m_cardlist.append(trace_x11_btn);
// subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(trace_x11_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(trace_x11_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(trace_x11_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
}
/*else if(status == "Complete:Packages")
{
// doing_label->setText(tr("Packages Scan OK"));
if(package_unneed_list.length() > 0)
{
package_unneed_items = new CleanListWidget(package_unneed_list, this->cur_skin, tr("Thumbnails Cache Clean Items"));
// package_unneed_btn = new CommonCheckBox(0, "://res/cache");
package_unneed_btn = new CleanSubGroup(this, "://res/janitor/package");
package_unneed_btn->setFocusPolicy(Qt::NoFocus);
// package_unneed_btn->setFixedSize(160, 130);
package_unneed_btn->setStatusTip("package-unneed");
package_unneed_btn->setLabelText(tr("Package Unneed Count:"),package_unneed_list.length());
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(package_unneed_items, SIGNAL(notifyMainCheckBox(int)), package_unneed_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(package_unneed_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(package_unneed_btn, SIGNAL(spreadStatus(int)), package_unneed_items, SLOT(resetSubCheckbox(int)));
int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
package_unneed_btn->move(x, y);
package_unneed_btn->show();
m_cardlist.append(package_unneed_btn);
subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(package_unneed_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(package_unneed_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(package_unneed_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(package_oldkernel_list.length() > 0)
{
package_oldkernel_items = new CleanListWidget(package_oldkernel_list, this->cur_skin, tr("Thumbnails Cache Clean Items"));
// package_oldkernel_btn = new CommonCheckBox(0, "://res/cache");
package_oldkernel_btn = new CleanSubGroup(this, "://res/janitor/package");
package_oldkernel_btn->setFocusPolicy(Qt::NoFocus);
// package_oldkernel_btn->setFixedSize(160, 130);
package_oldkernel_btn->setStatusTip("package-oldkernel");
package_oldkernel_btn->setLabelText(tr("Package oldkernel Count:"), package_oldkernel_list.length());
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(package_oldkernel_items, SIGNAL(notifyMainCheckBox(int)), package_oldkernel_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(package_oldkernel_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(package_oldkernel_btn, SIGNAL(spreadStatus(int)), package_oldkernel_items, SLOT(resetSubCheckbox(int)));
int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
package_oldkernel_btn->move(x, y);
package_oldkernel_btn->show();
m_cardlist.append(package_oldkernel_btn);
subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(package_oldkernel_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(package_oldkernel_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(package_oldkernel_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
if(package_configfile_list.length() > 0)
{
package_configfile_items = new CleanListWidget(package_configfile_list, this->cur_skin, tr("Thumbnails Cache Clean Items"));
// package_configfile_btn = new CommonCheckBox(0, "://res/cache");
package_configfile_btn = new CleanSubGroup(this, "://res/janitor/package");
package_configfile_btn->setFocusPolicy(Qt::NoFocus);
// package_configfile_btn->setFixedSize(160, 130);
package_configfile_btn->setStatusTip("package-configfile");
package_configfile_btn->setLabelText(tr("Package configfile Count:"),package_configfile_list.length());
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(package_configfile_items, SIGNAL(notifyMainCheckBox(int)), package_configfile_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后,根据总按钮的状态去改变子checkbox的状态
connect(package_configfile_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
//点击总按钮后,根据总按钮的状态去改变子checkbox的状态
connect(package_configfile_btn, SIGNAL(spreadStatus(int)), package_configfile_items, SLOT(resetSubCheckbox(int)));
int x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
int y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
int nowHeight = y + this->itemheight;
if(nowHeight >= ui->scrollAreaWidgetContents->height())
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->width(), nowHeight);
package_configfile_btn->move(x, y);
package_configfile_btn->show();
m_cardlist.append(package_configfile_btn);
subCount += 1;
// if(grid_layout == NULL)
// {
// grid_layout = new QGridLayout();
// }
// grid_layout->addWidget(package_configfile_btn, subCount/5, subCount%5);
// subCount += 1;
// if(columnIndex < 5)
// {
// grid_layout->addWidget(package_configfile_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
// else {
// rowIndex += 1;
// columnIndex = 0;
// grid_layout->addWidget(package_configfile_btn, rowIndex, columnIndex);
// columnIndex += 1;
// }
}
}*/
else if(status == "Complete:All") {
if(!scanResult) {
this->m_emptyLabel->setVisible(true);
// ui->label->show();
}
emit this->sendScanOverStatus(scanResult);
}
}
void CleanerDetailWidget::showCustomPage()
{
QObject *object = QObject::sender();
// CommonCheckBox *checkbox = qobject_cast(object);
CleanSubGroup *checkbox = qobject_cast(object);
QString object_name = checkbox->statusTip();
if(object_name == "cache-apt") {
/*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_apt_items->move(w_x, w_y);
cache_apt_items->exec();*/
SelectWidget *w = new SelectWidget(CleanerModuleID::CacheApt, tr("Apt Cache Clean Items"));
w->loadData(tr("Apt Cache Clean Items"), cache_apt_list);
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(w, SIGNAL(notifyMainCheckBox(int)), cache_apt_btn, SLOT(resetMainStatus(int)));
connect(w, &SelectWidget::notifyMainCheckBox, [=] (int status) {
foreach (CleanSubGroup *item, m_cardlist) {
if (item->statusTip() == "cache-apt") {
item->resetMainStatus(status);
break;
}
}
});
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
}
else if(object_name == "cache-software") {
/*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_software_items->move(w_x, w_y);
cache_software_items->exec();*/
SelectWidget *w = new SelectWidget(CleanerModuleID::CacheSoftware, tr("Software Cache Clean Items"));
w->loadData(tr("Software Cache Clean Items"), cache_software_list);
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(w, SIGNAL(notifyMainCheckBox(int)), cache_software_btn, SLOT(resetMainStatus(int)));
connect(w, &SelectWidget::notifyMainCheckBox, [=] (int status) {
foreach (CleanSubGroup *item, m_cardlist) {
if (item->statusTip() == "cache-software") {
item->resetMainStatus(status);
break;
}
}
});
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
}
else if(object_name == "cache-thumbnails") {
/*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_thumbnails_items->move(w_x, w_y);
cache_thumbnails_items->exec();*/
SelectWidget *w = new SelectWidget(CleanerModuleID::CacheThumbnail, tr("Thumbnails Cache Clean Items"));
w->loadData(tr("Thumbnails Cache Clean Items"), cache_thumbnails_list);
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(w, SIGNAL(notifyMainCheckBox(int)), cache_thumbnails_btn, SLOT(resetMainStatus(int)));
connect(w, &SelectWidget::notifyMainCheckBox, [=] (int status) {
foreach (CleanSubGroup *item, m_cardlist) {
if (item->statusTip() == "cache-thumbnails") {
item->resetMainStatus(status);
break;
}
}
});
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
}
else if(object_name == "cache-firefox") {
/*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_firefox_items->move(w_x, w_y);
cache_firefox_items->exec();*/
SelectWidget *w = new SelectWidget(CleanerModuleID::CacheFirefox, tr("Firefox Cache Clean Items"));
w->loadData(tr("Firefox Cache Clean Items"), cache_firefox_list);
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(w, SIGNAL(notifyMainCheckBox(int)), cache_firefox_btn, SLOT(resetMainStatus(int)));
connect(w, &SelectWidget::notifyMainCheckBox, [=] (int status) {
foreach (CleanSubGroup *item, m_cardlist) {
if (item->statusTip() == "cache-firefox") {
item->resetMainStatus(status);
break;
}
}
});
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
}
else if(object_name == "cache-chromium") {
/*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_chromium_items->move(w_x, w_y);
cache_chromium_items->exec();*/
SelectWidget *w = new SelectWidget(CleanerModuleID::CacheChromium, tr("Chromium Cache Clean Items"));
w->loadData(tr("Chromium Cache Clean Items"), cache_chromium_list);
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(w, SIGNAL(notifyMainCheckBox(int)), cache_chromium_btn, SLOT(resetMainStatus(int)));
connect(w, &SelectWidget::notifyMainCheckBox, [=] (int status) {
foreach (CleanSubGroup *item, m_cardlist) {
if (item->statusTip() == "cache-chromium") {
item->resetMainStatus(status);
break;
}
}
});
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
}
else if(object_name == "cookes-firefox") {
/*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cookies_firefox_items->move(w_x, w_y);
cookies_firefox_items->exec();*/
SelectWidget *w = new SelectWidget(CleanerModuleID::CookieFirefox, tr("Firefox Cookies Clean Items"));
w->loadData(tr("Firefox Cookies Clean Items"), cookies_firefox_list);
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(w, SIGNAL(notifyMainCheckBox(int)), cookies_firefox_btn, SLOT(resetMainStatus(int)));
connect(w, &SelectWidget::notifyMainCheckBox, [=] (int status) {
foreach (CleanSubGroup *item, m_cardlist) {
if (item->statusTip() == "cookes-firefox") {
item->resetMainStatus(status);
break;
}
}
});
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
}
else if(object_name == "cookes-chromium") {
/*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cookies_chromium_items->move(w_x, w_y);
cookies_chromium_items->exec();*/
SelectWidget *w = new SelectWidget(CleanerModuleID::CookieChromium, tr("Chromium Cookies Clean Items"));
w->loadData(tr("Chromium Cookies Clean Items"), cookies_chromium_list);
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(w, SIGNAL(notifyMainCheckBox(int)), cookies_chromium_btn, SLOT(resetMainStatus(int)));
connect(w, &SelectWidget::notifyMainCheckBox, [=] (int status) {
foreach (CleanSubGroup *item, m_cardlist) {
if (item->statusTip() == "cookes-chromium") {
item->resetMainStatus(status);
break;
}
}
});
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
}
/*else if(object_name == "package-unneed")
{
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
package_unneed_items->move(w_x, w_y);
package_unneed_items->exec();
}
else if(object_name == "package-oldkernel")
{
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
package_oldkernel_items->move(w_x, w_y);
package_oldkernel_items->exec();
}
else if(object_name == "package-configfile")
{
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
package_configfile_items->move(w_x, w_y);
package_configfile_items->exec();
}*/
else if(object_name == "x11-history") {
/*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
trace_x11_items->move(w_x, w_y);
trace_x11_items->exec();*/
SelectWidget *w = new SelectWidget(CleanerModuleID::TraceX11, tr("Debug log Items"));
w->loadData(tr("Debug log Items"), trace_x11_list);
//子checkbox的状态被改变时,重新设置总按钮的状态
// connect(w, SIGNAL(notifyMainCheckBox(int)), trace_x11_btn, SLOT(resetMainStatus(int)));
connect(w, &SelectWidget::notifyMainCheckBox, [=] (int status) {
foreach (CleanSubGroup *item, m_cardlist) {
if (item->statusTip() == "x11-history") {
item->resetMainStatus(status);
break;
}
}
});
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
}
// else if(object_name == "history-firefox" || object_name == "history-chromium" || object_name == "history-system"|| object_name == "history-bash" ) {
// }
}
void CleanerDetailWidget::setLanguage()
{
// ui->label->setText(tr("No garbage "));
// title_label->setText(tr("Cleaning up the system cache"));
// description_label->setText(tr("Deep cleaning up the system cache, to save disk space"));
}
void CleanerDetailWidget::resetCurrentSkin(QString skin)
{
this->cur_skin = skin;
//can remove this code
// if(cache_apt_items != NULL)
// cache_apt_items->resetTitleSkin(skin);
// if(cache_software_items != NULL)
// cache_software_items->resetTitleSkin(skin);
// if(cache_thumbnails_items != NULL)
// cache_thumbnails_items->resetTitleSkin(skin);
// if(cache_firefox_items != NULL)
// cache_firefox_items->resetTitleSkin(skin);
// if(cache_chromium_items != NULL)
// cache_chromium_items->resetTitleSkin(skin);
// if(cookies_firefox_items != NULL)
// cookies_firefox_items->resetTitleSkin(skin);
// if(cookies_chromium_items != NULL)
// cookies_chromium_items->resetTitleSkin(skin);
/*if(package_unneed_items != NULL)
package_unneed_items->resetTitleSkin(skin);
if(package_oldkernel_items != NULL)
package_oldkernel_items->resetTitleSkin(skin);
if(package_configfile_items != NULL)
package_configfile_items->resetTitleSkin(skin);*/
// if(trace_x11_items != NULL)
// trace_x11_items->resetTitleSkin(skin);
}
void CleanerDetailWidget::receiveCleanSignal()
{
this->getAllSelectedItems();
if(argsData.empty()) {
toolKits->alertMSG(parentWindow->geometry().topLeft().x(), parentWindow->geometry().topLeft().y(), tr("Clean args is empty!"));
}
else {
emit this->startCleanSystem(argsData);
}
}
void CleanerDetailWidget::clearItems()
{
while(areaWidgetLayout->count() > 0) {
QWidget* widget = areaWidgetLayout->itemAt(0)->widget();
areaWidgetLayout->removeWidget(widget);
delete widget;
}
this->m_cardlist.clear();
m_row = 0;
m_column = 0;
}
//void CleanerDetailWidget::receivePolicyKitSignal(bool status)
//{
// //status = true:ok
// //status = false:cacel
// if(status)//ok
// {
// emit this->showActionAnimaiton();
// }
//}
void CleanerDetailWidget::getAllSelectedItems()
{
argsData.clear();
QStringList fileTmp;
// QStringList packageTmp;
// QStringList firefoxcookieTmp;
// QStringList chromiumcookieTmp;
// QStringList traceTmp;
foreach (QString info, m_selectedAptList) {
fileTmp.append(info);
}
foreach (QString info, m_selectedSoftwareList) {
fileTmp.append(info);
}
foreach (QString info, m_selectedThumbnailsList) {
fileTmp.append(info);
}
foreach (QString info, m_selectedFirefoxCacheList) {
fileTmp.append(info);
}
foreach (QString info, m_selectedChromiumCacheList) {
fileTmp.append(info);
}
foreach (CleanSubGroup *item, m_cardlist) {
if (item->getCheckBoxStatus() != 0) {
if (item->statusTip() == "history-firefox") {
argsData.insert("firefox-history", QStringList() << trace_firefox_count);
}
else if (item->statusTip() == "history-chromium") {
argsData.insert("chromium-history", QStringList() << trace_chromium_count);
}
else if (item->statusTip() == "history-system") {
argsData.insert("system-history", QStringList() << trace_system_count);
}
else if (item->statusTip() == "history-bash") {
argsData.insert("bash-history", QStringList() << trace_bash_path);
}
}
}
if(fileTmp.length() > 0)
argsData.insert("file", fileTmp);
if(m_selectedFirefoxCookieList.length() > 0)
argsData.insert("firefox-cookie", m_selectedFirefoxCookieList);
if(m_selectedChromiumCookieList.length() > 0)
argsData.insert("chromium-cookie", m_selectedChromiumCookieList);
if(m_selectedTraceX11List.length() > 0)
argsData.insert("x11-history", m_selectedTraceX11List);
// if(cache_apt_btn != NULL && cache_apt_btn->getCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_apt_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_software_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_thumbnails_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_firefox_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_chromium_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = package_unneed_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = package_oldkernel_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = package_configfile_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = cookies_firefox_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// QStringList tmp = cookies_chromium_items->getSelectedItems();
// for(int i = 0; igetCheckBoxStatus() != 0)
// {
// argsData.insert("firefox-history", QStringList() << trace_firefox_count);
// }
// if(trace_chromium_btn != NULL && trace_chromium_btn->getCheckBoxStatus() != 0)
// {
// argsData.insert("chromium-history", QStringList() << trace_chromium_count);
// }
// if(trace_system_btn != NULL && trace_system_btn->getCheckBoxStatus() != 0)
// {
// argsData.insert("system-history", QStringList() << trace_system_count);
// }
// //kobe
// if(trace_bash_btn != NULL && trace_bash_btn->getCheckBoxStatus() != 0)
// {
// argsData.insert("bash-history", QStringList() << trace_bash_path);
// }
//// if(trace_x11_btn != NULL && trace_x11_btn->getCheckBoxStatus() != 0)
//// {
//// QStringList tmp = trace_x11_items->getSelectedItems();
//// for(int i = 0; i 0)
// argsData.insert("file", fileTmp);
//// if(packageTmp.length() > 0)
//// argsData.insert("package", packageTmp);
// if(firefoxcookieTmp.length() > 0)
// argsData.insert("firefox-cookie", firefoxcookieTmp);
// if(chromiumcookieTmp.length() > 0)
// argsData.insert("chromium-cookie", chromiumcookieTmp);
// if(traceTmp.length() > 0)
// argsData.insert("x11-history", traceTmp);
}
youker-assistant/cleaner/cleanlistwidget.h 0000664 0001750 0001750 00000003645 13260315532 020001 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CLEANLISTWIDGET_H
#define CLEANLISTWIDGET_H
#include
#include
#include "../component/kylintitlebar.h"
class SessionDispatcher;
class QCheckBox;
namespace Ui {
class CleanListWidget;
}
class CleanListWidget : public QDialog
{
Q_OBJECT
public:
// explicit CleanListWidget(QStringList &arglist, const QString title_text = "UbuntuKylin", QWidget *parent = 0/*, SessionDispatcher *proxy = 0*/);
explicit CleanListWidget(QStringList &arglist, QString skin = ":/background/res/skin/1.png", const QString title_text = "UbuntuKylin", QDialog *parent = 0/*, SessionDispatcher *proxy = 0*/);
~CleanListWidget();
void setLanguage();
void initConnect();
QStringList getSelectedItems();
void resetTitleSkin(QString skin);
public slots:
void resetSubCheckbox(int status);
void scanAllSubCheckbox();
void onCloseButtonClicked();
signals:
void notifyMainCheckBox(int status);
private:
void initTitleBar(QString skin);
private:
Ui::CleanListWidget *ui;
QList checkbox_list;
KylinTitleBar *title_bar;
QString titleName;
QLabel *tip_label;
QLabel *num_label;
};
#endif // CLEANLISTWIDGET_H
youker-assistant/cleaner/cacheactionwidget.cpp 0000664 0001750 0001750 00000005237 13260315532 020616 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cacheactionwidget.h"
#include "mainwindow.h"
#include
CacheActionWidget::CacheActionWidget(QWidget *parent)
: QWidget(parent)
{
this->setFixedSize(900, 150);
this->setAutoFillBackground(true);
this->setObjectName("transparentWidget");
img_label = new QLabel();
title_label = new QLabel();
description_label = new QLabel();
img_label->setScaledContents(true);//自动缩放,显示图像大小自动调整为Qlabel大小
QPixmap label_pixmap("://res/cache.png");
img_label->setPixmap(label_pixmap);
img_label->setFixedSize(label_pixmap.size());
title_label->setObjectName("whiteLabel");
description_label->setWordWrap(true);//QLabel自动换行
description_label->setObjectName("tipLabel");
QVBoxLayout *layout1 = new QVBoxLayout();
layout1->addStretch();
layout1->addWidget(title_label);
layout1->addWidget(description_label);
layout1->addStretch();
layout1->setSpacing(15);
layout1->setMargin(0);
layout1->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->addWidget(img_label, 0, Qt::AlignVCenter);
layout2->addLayout(layout1);
layout2->setSpacing(20);
layout2->setMargin(0);
layout2->setContentsMargins(20, 20, 0, 0);
setLayout(layout2);
this->setLanguage();
}
CacheActionWidget::~CacheActionWidget()
{
if(img_label != NULL) {
delete img_label;
img_label = NULL;
}
if(title_label != NULL) {
delete title_label;
title_label = NULL;
}
if(description_label != NULL) {
delete description_label;
description_label = NULL;
}
}
void CacheActionWidget::setLanguage()
{
title_label->setText(tr("Cleaning up the system cache"));
description_label->setText(tr("Deep cleaning up the system cache, to save disk space"));
}
youker-assistant/cleaner/cleanermainwidget-new.h 0000664 0001750 0001750 00000004326 13260315532 021065 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CLEANERMAINWIDGET_H
#define CLEANERMAINWIDGET_H
#include
#include
#include
#include
#include "cleaneritems.h"
class MainWindow;
class CleanGroup;
class SessionDispatcher;
class Toolkits;
class QParallelAnimationGroup;
class CleanerMainWidget : public QWidget
{
Q_OBJECT
public:
explicit CleanerMainWidget(QWidget *parent = 0, SessionDispatcher *seroxy = 0, MainWindow *window = 0, Toolkits *kits = 0, QString skin = ":/background/res/skin/1.png");
~CleanerMainWidget();
void setLanguage();
void getAllScanSelectedItems();
void resetCurrentSkin(QString skin);
void initAnimation();
public slots:
void onButtonClicked();
void receiveScanSignal();
void showCleanMainPage();
void onUpGroupFinished();
signals:
void showActionAnimaiton();
private:
MainWindow *parentWindow;
QLabel *tip_label;
QWidget *baseWidget;
CleanGroup *cache_btn;
CleanerItems *cache_items;
CleanGroup *package_btn;
CleanerItems *package_items;
CleanGroup *cookies_btn;
CleanerItems *cookies_items;
CleanGroup *trace_btn;
CleanerItems *trace_items;
QMap argsMap;
SessionDispatcher *sessionproxy;
Toolkits *toolKits;
QStackedWidget *scanWidgets;
QParallelAnimationGroup *m_upGroup;
QParallelAnimationGroup *m_downGroup;
};
#endif // CLEANERMAINWIDGET_H
youker-assistant/cleaner/cleanermainwidget.h 0000664 0001750 0001750 00000004564 13260315532 020302 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CLEANERMAINWIDGET_H
#define CLEANERMAINWIDGET_H
#include
#include
#include
#include
#include "../component/utils.h"
class QLabel;
class MainWindow;
class CleanGroup;
class Toolkits;
class CleanerMainWidget : public QWidget
{
Q_OBJECT
public:
explicit CleanerMainWidget(QWidget *parent = 0, MainWindow *window = 0, Toolkits *kits = 0, QString skin = ":/background/res/skin/1.png");
~CleanerMainWidget();
void setLanguage();
void getAllScanSelectedItems();
void resetCurrentSkin(QString skin);
public slots:
void onButtonClicked();
void receiveScanSignal();
void onRefreshSelectedItems(CleanerCategoryID id, const QStringList &infos);
void resetDefaultStatus();
signals:
void showActionAnimaiton();
void startScanSystem(QMap itemsMap);
private:
MainWindow *parentWindow;
QLabel *tip_label;
CleanGroup *cache_btn;
// CleanerItems *cache_items;
// CleanGroup *package_btn;
// CleanerItems *package_items;
CleanGroup *cookies_btn;
// CleanerItems *cookies_items;
CleanGroup *trace_btn;
// CleanerItems *trace_items;
QMap argsMap;
Toolkits *toolKits;
QStringList cache_list;
QStringList cache_status_list;
QStringList cookies_list;
QStringList cookies_status_list;
QStringList trace_list;
QStringList trace_status_list;
QStringList m_selectedCache;
QStringList m_selectedCookie;
QStringList m_selectedTrace;
};
#endif // CLEANERMAINWIDGET_H
youker-assistant/cleaner/cleanermainwidget-org.h 0000664 0001750 0001750 00000003717 13260315532 021066 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CLEANERMAINWIDGET_H
#define CLEANERMAINWIDGET_H
#include
#include
#include "cleaneritems.h"
class MainWindow;
class CleanGroup;
class SessionDispatcher;
class Toolkits;
class CleanerMainWidget : public QWidget
{
Q_OBJECT
public:
explicit CleanerMainWidget(QWidget *parent = 0, SessionDispatcher *seroxy = 0, MainWindow *window = 0, Toolkits *kits = 0, QString skin = ":/background/res/skin/1.png");
~CleanerMainWidget();
void setLanguage();
void getAllScanSelectedItems();
void resetCurrentSkin(QString skin);
public slots:
void onButtonClicked();
void receiveScanSignal();
signals:
void showActionAnimaiton();
private:
MainWindow *parentWindow;
QLabel *tip_label;
CleanGroup *cache_btn;
CleanerItems *cache_items;
CleanGroup *package_btn;
CleanerItems *package_items;
CleanGroup *cookies_btn;
CleanerItems *cookies_items;
CleanGroup *trace_btn;
CleanerItems *trace_items;
QMap argsMap;
SessionDispatcher *sessionproxy;
Toolkits *toolKits;
// QStackedWidget *scanWidgets;
};
#endif // CLEANERMAINWIDGET_H
youker-assistant/cleaner/cleaneritems.cpp 0000664 0001750 0001750 00000015463 13260315532 017626 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cleaneritems.h"
#include "mainwindow.h"
#include
//CleanerItems::CleanerItems(QStringList &arglist, QStringList &statuslist, int height, const QString title_text, QWidget *parent)
// : QWidget(parent),titleName(title_text)/*, widgetHeight(height)*/
CleanerItems::CleanerItems(QStringList &arglist, QStringList &statuslist, QString skin, int height, const QString title_text, QDialog *parent)
:QDialog(parent),titleName(title_text)
{
setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}");
this->setWindowIcon(QIcon(":/res/kylin-assistant.png"));
this->setFixedSize(410, height);
// this->setObjectName("transparentWidget");
// this->setWindowFlags(Qt::FramelessWindowHint);
this->setAutoFillBackground(true);
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(Qt::white));
this->setPalette(palette);
title_bar = new KylinTitleBar();
initTitleBar(skin);
QVBoxLayout *button_layout = new QVBoxLayout;
int count = arglist.count();
// QSignalMapper *signal_mapper = new QSignalMapper(this);
for(int i=0; isetFocusPolicy(Qt::NoFocus);
checkbox->setCheckState(Qt::Checked);
checkbox->setStatusTip(statuslist.at(i));
checkbox_list.append(checkbox);
// connect(checkbox, SIGNAL(clicked()), signal_mapper, SLOT(map()));
connect(checkbox, SIGNAL(clicked()), this, SLOT(scanAllSubCheckbox()));
// signal_mapper->setMapping(checkbox, QString::number(i, 10));
button_layout->addWidget(checkbox);
}
button_layout->setSpacing(15);
button_layout->setMargin(0);
button_layout->setContentsMargins(0, 10, 0, 0);
// connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(switchPageIndex(QString)));
// setLayout(button_layout);
okBtn = new QPushButton();
okBtn->setFixedSize(91, 25);
okBtn->setObjectName("blackButton");
okBtn->setFocusPolicy(Qt::NoFocus);
QHBoxLayout *btn_layout = new QHBoxLayout();
btn_layout->addStretch();
btn_layout->addWidget(okBtn);
btn_layout->setMargin(0);
btn_layout->setContentsMargins(0, 0, 15, 10);
group_box = new QGroupBox();
group_box->setStyleSheet("QGroupBox{border: 1px solid #e0e0e0;border-radius: 2px;margin-top: 15px;font-size:14px;}QGroupBox:title{subcontrol-origin: margin;subcontrol-position: top left;padding: 6px 3px;color: #00609a;font-family: 方正黑体_GBK;font-weight:bold;}");
group_box->setTitle(titleName);
QFont group_box_font = group_box->font();
group_box_font.setBold(true);
group_box->setFont(group_box_font);
group_box->setFixedWidth(380);
group_box->setLayout(button_layout);
group_box->setContentsMargins(10, 10, 10, 10);
QHBoxLayout *group_layout = new QHBoxLayout();
group_layout->addWidget(group_box);
group_layout->setMargin(0);
group_layout->setContentsMargins(10, 10, 10, 0);
QVBoxLayout *main_layout = new QVBoxLayout();
main_layout->addWidget(title_bar);
main_layout->addLayout(group_layout);
// main_layout->addWidget(group_box);
main_layout->addStretch();
main_layout->addLayout(btn_layout);
main_layout->setSpacing(0);
main_layout->setMargin(0);
main_layout->setContentsMargins(0, 0, 0, 0);
setLayout(main_layout);
this->initConnect();
this->setLanguage();
}
CleanerItems::~CleanerItems()
{
for(int i=0; iclose();
}
void CleanerItems::initTitleBar(QString skin)
{
title_bar->setTitleWidth(410);
title_bar->setTitleName(titleName);
// title_bar->setTitleBackgound(":/background/res/skin/1.png");
title_bar->setTitleBackgound(skin);
}
void CleanerItems::resetTitleSkin(QString skin)
{
title_bar->resetBackground(skin);
}
int CleanerItems::getItemCount()
{
return checkbox_list.count();
}
QStringList CleanerItems::getSelectedItems()
{
QStringList text_list;
int count = checkbox_list.count();
for(int i=0; iisChecked()) {
// text_list.append(checkbox->text());
text_list.append(checkbox->statusTip());
}
}
return text_list;
}
void CleanerItems::setLanguage()
{
okBtn->setText(tr("OK"));
}
void CleanerItems::scanAllSubCheckbox() {
int count = checkbox_list.count();
int m = 0;
for(int i=0; iisChecked()) {
m +=1;
}
}
if (m == 0) {
emit this->notifyMainCheckBox(0);
}
else if (m == count) {
emit this->notifyMainCheckBox(2);
}
else {
emit this->notifyMainCheckBox(1);
}
}
void CleanerItems::resetSubCheckbox(int status) {
if(status == 0) {
for(int i=0; isetChecked(false);
}
}
else if(status == 2) {
for(int i=0; isetChecked(true);
}
}
}
youker-assistant/cleaner/cleanermainwidget-org.cpp 0000664 0001750 0001750 00000032257 13260315532 021422 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cleanermainwidget.h"
#include
#include "../mainui/mainwindow.h"
#include "../component/cleangroup.h"
CleanerMainWidget::CleanerMainWidget(QWidget *parent, SessionDispatcher *seroxy, MainWindow *window, Toolkits *kits, QString skin)
: QWidget(parent), sessionproxy(seroxy), parentWindow(window), toolKits(kits)
{
this->setFixedSize(900, 403);
this->setObjectName("transparentWidget");
// this->setAutoFillBackground(true);
// QPalette palette;
// palette.setBrush(QPalette::Window, QBrush(Qt::white));
// this->setPalette(palette);
tip_label = new QLabel();
tip_label->setObjectName("tipLabel");
QStringList cache_list, status_list;
cache_list << tr("Cleanup Package Cache") << tr("Cleanup Software Center Cache") << tr("Cleanup Thumbnails Cache") << tr("Cleanup FireFox Cache") << tr("Cleanup Chromium Cache");
status_list << "apt" << "software-center" << "thumbnails" << "firefox" << "chromium";
cache_items = new CleanerItems(cache_list, status_list, skin, 280, tr("Cache Items"));
// cache_btn = new KylinCheckBox(0, "://res/cache.png");
cache_btn = new CleanGroup(0, "://res/cache");
// cache_btn->setFixedSize(260, 130);
cache_btn->setStatusTip("cache");
cache_btn->setLabelText(tr("System Cache"), tr("Cleanup cache of system, software-center, thumbnails and browser"));//系统缓存垃圾 清除包、软件中心、缩略图和浏览器缓存
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cache_items, SIGNAL(notifyMainCheckBox(int)), cache_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(cache_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
QStringList package_list;
package_list << tr("Uninstall unnecessary procedures") << tr("Uninstall old kernel packages") << tr("Cleanup software configfile");
status_list.clear();
status_list << "unneed" << "oldkernel" << "configfile";
package_items = new CleanerItems(package_list, status_list, skin, 200, tr("Package Items"));
// package_btn = new KylinCheckBox(0, "://res/package.png");
package_btn = new CleanGroup(0, "://res/cache");
// package_btn->setFixedSize(260, 130);
package_btn->setLabelText(tr("Packages and configfile"), tr("Cleaning up the software that installed by other software bundled, old kernel packages and configfile, to improve system performance"));//包垃圾 清除不必要的程序、旧内核包、配置文件
package_btn->setStatusTip("package");
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(package_items, SIGNAL(notifyMainCheckBox(int)), package_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(package_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
QStringList cookies_list;
cookies_list << tr("Cleanup the Cookies saving in Firefox") << tr("Cleanup the Cookies saving in Chromium");
status_list.clear();
status_list << "firefox" << "chromium";
cookies_items = new CleanerItems(cookies_list, status_list, skin, 170, tr("Cookies Items"));
// cookies_btn = new KylinCheckBox(0, "://res/cookie.png");
cookies_btn = new CleanGroup(0, "://res/cache");
// cookies_btn->setFixedSize(260, 130);
cookies_btn->setLabelText(tr("Cookies"), tr("Clean up user login information, support Firefox and Chromium browser"));//清除上网、游戏、购物等记录
cookies_btn->setStatusTip("cookies");
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(cookies_items, SIGNAL(notifyMainCheckBox(int)), cookies_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(cookies_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
////Debug logs调试日志 command history 命令历史记录
QStringList trace_list;
trace_list << tr("Clean up the Firefox Internet records") << tr("Clean up the Chromium Internet records") << tr("Clean up the recently opened documents records") << tr("Delete the command history") << tr("Delete the debug logs");
status_list.clear();
status_list << "firefox" << "chromium" << "system" << "bash" << "X11";
trace_items = new CleanerItems(trace_list, status_list, skin, 280, tr("Trace Items"));
// trace_btn = new KylinCheckBox(0, "://res/trace.png");
trace_btn = new CleanGroup(0, "://res/cache");
// trace_btn->setFixedSize(260, 130);
trace_btn->setLabelText(tr("History trace"), tr("Cleaning the internet and opened documents recently records"));//使用痕迹 清除浏览器和系统使用痕迹
trace_btn->setStatusTip("trace");
//子checkbox的状态被改变时,重新设置总按钮的状态
connect(trace_items, SIGNAL(notifyMainCheckBox(int)), trace_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面
connect(trace_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
// main_checkbox = new QCheckBox("main");//三态复选框
// main_checkbox->setObjectName("mainCheckBox");
// main_checkbox->setTristate(true);
// main_checkbox->setEnabled(true);
// main_checkbox->setCheckState(Qt::Unchecked);
// connect(main_checkbox, SIGNAL(clicked()), this, SLOT(reset_sub_checkboxes()));
QHBoxLayout *tip_layout = new QHBoxLayout();
tip_layout->addWidget(tip_label);
tip_layout->addStretch();
// tip_layout->addWidget(main_checkbox);
// tip_layout->setSpacing(50);
tip_layout->setMargin(0);
tip_layout->setContentsMargins(38,20,72,0);
QHBoxLayout *layout1 = new QHBoxLayout;
layout1->addWidget(cache_btn);
layout1->addWidget(package_btn);
layout1->addWidget(cookies_btn);
layout1->setMargin(0);
layout1->setContentsMargins(0,0,0,0);
QHBoxLayout *layout2 = new QHBoxLayout;
// layout2->addWidget(browser_btn);
layout2->addWidget(trace_btn);
layout2->addStretch();
layout1->setMargin(0);
layout2->setContentsMargins(20,0,0,0);
QVBoxLayout *layoutbox = new QVBoxLayout;
layoutbox->addLayout(layout1);
layoutbox->addLayout(layout2);
layoutbox->setSpacing(20);
layoutbox->setMargin(0);
layoutbox->setContentsMargins(0,0,0,0);
QVBoxLayout *main_layout = new QVBoxLayout;
main_layout->addLayout(tip_layout);
main_layout->addLayout(layoutbox);
main_layout->addStretch();
main_layout->setSpacing(30);
main_layout->setMargin(0);
main_layout->setContentsMargins(0,0,0,0);
setLayout(main_layout);
this->setLanguage();
// main_checkbox = new QCheckBox();
// main_checkbox->setFocusPolicy(Qt::NoFocus);
// main_checkbox->setObjectName("mainCheckBox");
// main_checkbox->setTristate(true);
// main_checkbox->setEnabled(true);
// main_checkbox->setCheckState(Qt::Checked);
// cache_items = NULL;
// scanWidgets = new QStackedWidget(this);
// scanWidgets->setGeometry(rect());
// scanWidgets->lower();
}
CleanerMainWidget::~CleanerMainWidget()
{
}
void CleanerMainWidget::setLanguage()
{
tip_label->setText(tr("Please select the items you want to clean"));
// main_checkbox->setText(tr("All"));
}
void CleanerMainWidget::resetCurrentSkin(QString skin)
{
if(cache_items != NULL)
cache_items->resetTitleSkin(skin);
if(trace_items != NULL)
trace_items->resetTitleSkin(skin);
if(package_items != NULL)
package_items->resetTitleSkin(skin);
if(cookies_items != NULL)
cookies_items->resetTitleSkin(skin);
}
void CleanerMainWidget::receiveScanSignal()
{
this->getAllScanSelectedItems();
if(argsMap.empty())
{
toolKits->alertMSG(parentWindow->geometry().topLeft().x(), parentWindow->geometry().topLeft().y(), tr("Scan args is empty!"));
}
else
{
// qDebug() << "args is.........." << argsMap;
emit this->showActionAnimaiton();
sessionproxy->scanSystemCleanerItems(argsMap);
}
}
void CleanerMainWidget::getAllScanSelectedItems()
{
argsMap.clear();
QStringList cacheTmp;
QStringList packageTmp;
QStringList cookieTmp;
QStringList historyTmp;
if(cache_btn != NULL && cache_btn->getCheckBoxStatus() != 0)
{
QStringList tmp = cache_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = package_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = cookies_items->getSelectedItems();
for(int i = 0; igetCheckBoxStatus() != 0)
{
QStringList tmp = trace_items->getSelectedItems();
for(int i = 0; i 0)
argsMap.insert("Cache", cacheTmp);
if(packageTmp.length() > 0)
argsMap.insert("Packages", packageTmp);
if(cookieTmp.length() > 0)
argsMap.insert("Cookies", cookieTmp);
if(historyTmp.length() > 0)
argsMap.insert("History", historyTmp);
}
void CleanerMainWidget::onButtonClicked()
{
QObject *object = QObject::sender();
// KylinCheckBox *checkbox = qobject_cast(object);
CleanGroup *checkbox = qobject_cast(object);
QString object_name = checkbox->statusTip();
if(object_name == "cache")
{
if(cache_items->isHidden()) {
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_items->move(w_x, w_y);
cache_items->show();
}
else
{
cache_items->hide();
}
if(!package_items->isHidden()) {
package_items->hide();
}
if(!cookies_items->isHidden()) {
cookies_items->hide();
}
if(!trace_items->isHidden()) {
trace_items->hide();
}
}
else if(object_name == "package")
{
if(package_items->isHidden()) {
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (200 / 2);
package_items->move(w_x, w_y);
package_items->show();
}
else
{
package_items->hide();
}
if(!cache_items->isHidden()) {
cache_items->hide();
}
if(!cookies_items->isHidden()) {
cookies_items->hide();
}
if(!trace_items->isHidden()) {
trace_items->hide();
}
}
if(object_name == "cookies")
{
if(cookies_items->isHidden()) {
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (170 / 2);
cookies_items->move(w_x, w_y);
cookies_items->show();
}
else
{
cookies_items->hide();
}
if(!cache_items->isHidden()) {
cache_items->hide();
}
if(!package_items->isHidden()) {
package_items->hide();
}
if(!trace_items->isHidden()) {
trace_items->hide();
}
}
if(object_name == "trace")
{
if(trace_items->isHidden()) {
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (200 / 2);
trace_items->move(w_x, w_y);
trace_items->show();
}
else
{
trace_items->hide();
}
if(!cache_items->isHidden()) {
cache_items->hide();
}
if(!package_items->isHidden()) {
package_items->hide();
}
if(!cookies_items->isHidden()) {
cookies_items->hide();
}
}
}
youker-assistant/cleaner/cleanlistwidget.cpp 0000664 0001750 0001750 00000013734 13260315532 020334 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cleanlistwidget.h"
#include "ui_cleanlistwidget.h"
#include
#include
#include "../component/utils.h"
#include
//CleanListWidget::CleanListWidget(QStringList &arglist, const QString title_text, QWidget *parent) :
// QWidget(parent),titleName(title_text),
CleanListWidget::CleanListWidget(QStringList &arglist, QString skin, const QString title_text, QDialog *parent) :
QDialog(parent),titleName(title_text),
ui(new Ui::CleanListWidget)
{
ui->setupUi(this);
this->setFixedSize(560, 398);
setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}");
this->setWindowIcon(QIcon(":/res/kylin-assistant.png"));
tip_label = new QLabel();
num_label = new QLabel();
ui->widget_1->setAutoFillBackground(true);
QPalette palette;
palette.setColor(QPalette::Background, QColor(233,238,241));//#e9eef1
ui->widget_1->setPalette(palette);
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->scrollArea->setStyleSheet("QScrollArea{border: none}");
ui->scrollArea->setAutoFillBackground(true);
ui->scrollArea->setBackgroundRole(QPalette::Light);//QPalette::Dark
// palette.setBrush(QPalette::Window, QBrush(Qt::white));
// ui->scrollArea->setPalette(palette);
tip_label->setText(tr("Clean Items:"));
QHBoxLayout *tip_layout = new QHBoxLayout();
tip_layout->addWidget(tip_label);
tip_layout->addWidget(num_label);
tip_layout->addStretch();
tip_layout->setSpacing(0);
tip_layout->setMargin(0);
tip_layout->setContentsMargins(10, 0, 0, 0);
ui->widget_1->setLayout(tip_layout);
title_bar = new KylinTitleBar(this);
title_bar->move(0,0);
title_bar->show();
initTitleBar(skin);
ui->scrollArea->setFixedSize(556,331);
QVBoxLayout *button_layout = new QVBoxLayout;
int count = arglist.count();
num_label->setText(QString::number(count));
for(int i=0; isetFocusPolicy(Qt::NoFocus);
checkbox->setCheckState(Qt::Checked);
checkbox_list.append(checkbox);
connect(checkbox, SIGNAL(clicked()), this, SLOT(scanAllSubCheckbox()));
button_layout->addWidget(checkbox);
}
button_layout->setSpacing(5);
button_layout->setMargin(0);
button_layout->setContentsMargins(0, 0, 0, 0);
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(button_layout);
layout->addStretch();
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(10, 0, 10, 10);
ui->scrollAreaWidgetContents->setLayout(layout);
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
this->setLanguage();
this->initConnect();
}
CleanListWidget::~CleanListWidget()
{
if(tip_label != NULL) {
delete tip_label;
tip_label = NULL;
}
if(num_label != NULL) {
delete num_label;
num_label = NULL;
}
if(title_bar != NULL) {
delete title_bar;
title_bar = NULL;
}
for(int i=0; iisChecked()) {
text_list.append(checkbox->text());
}
}
return text_list;
}
void CleanListWidget::scanAllSubCheckbox() {
int count = checkbox_list.count();
int m = 0;
for(int i=0; iisChecked()) {
m +=1;
}
}
num_label->setText(QString::number(m));
if (m == 0) {
emit this->notifyMainCheckBox(0);
}
else if (m == count) {
emit this->notifyMainCheckBox(2);
}
else {
emit this->notifyMainCheckBox(1);
}
}
void CleanListWidget::resetSubCheckbox(int status) {
if(status == 0) {
for(int i=0; isetChecked(false);
}
num_label->setText("0");
}
else if(status == 2) {
for(int i=0; isetChecked(true);
}
int count = checkbox_list.count();
num_label->setText(QString::number(count));
}
}
void CleanListWidget::setLanguage()
{
}
void CleanListWidget::initConnect()
{
connect(title_bar,SIGNAL(closeDialog()), this, SLOT(onCloseButtonClicked()));
}
void CleanListWidget::initTitleBar(QString skin)
{
title_bar->setTitleWidth(560);
title_bar->setTitleName(titleName);
// title_bar->setTitleBackgound(":/background/res/skin/1.png");
title_bar->setTitleBackgound(skin);
}
void CleanListWidget::resetTitleSkin(QString skin)
{
title_bar->resetBackground(skin);
}
void CleanListWidget::onCloseButtonClicked()
{
this->close();
}
youker-assistant/src/ 0000775 0001750 0001750 00000000000 13265005454 013620 5 ustar feng feng youker-assistant/src/qtsingleapplication/ 0000775 0001750 0001750 00000000000 13260315533 017667 5 ustar feng feng youker-assistant/src/qtsingleapplication/qtlockedfile_win.cpp 0000664 0001750 0001750 00000014661 13260315532 023725 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtlockedfile.h"
#include
#include
#define MUTEX_PREFIX "QtLockedFile mutex "
// Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS
#define MAX_READERS MAXIMUM_WAIT_OBJECTS
#if QT_VERSION >= 0x050000
#define QT_WA(unicode, ansi) unicode
#endif
Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
{
if (mutexname.isEmpty()) {
QFileInfo fi(*this);
mutexname = QString::fromLatin1(MUTEX_PREFIX)
+ fi.absoluteFilePath().toLower();
}
QString mname(mutexname);
if (idx >= 0)
mname += QString::number(idx);
Qt::HANDLE mutex;
if (doCreate) {
QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); },
{ mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } );
if (!mutex) {
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
return 0;
}
}
else {
QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); },
{ mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
if (!mutex) {
if (GetLastError() != ERROR_FILE_NOT_FOUND)
qErrnoWarning("QtLockedFile::lock(): OpenMutex failed");
return 0;
}
}
return mutex;
}
bool QtLockedFile::waitMutex(Qt::HANDLE mutex, bool doBlock)
{
Q_ASSERT(mutex);
DWORD res = WaitForSingleObject(mutex, doBlock ? INFINITE : 0);
switch (res) {
case WAIT_OBJECT_0:
case WAIT_ABANDONED:
return true;
break;
case WAIT_TIMEOUT:
break;
default:
qErrnoWarning("QtLockedFile::lock(): WaitForSingleObject failed");
}
return false;
}
bool QtLockedFile::lock(LockMode mode, bool block)
{
if (!isOpen()) {
qWarning("QtLockedFile::lock(): file is not opened");
return false;
}
if (mode == NoLock)
return unlock();
if (mode == m_lock_mode)
return true;
if (m_lock_mode != NoLock)
unlock();
if (!wmutex && !(wmutex = getMutexHandle(-1, true)))
return false;
if (!waitMutex(wmutex, block))
return false;
if (mode == ReadLock) {
int idx = 0;
for (; idx < MAX_READERS; idx++) {
rmutex = getMutexHandle(idx, false);
if (!rmutex || waitMutex(rmutex, false))
break;
CloseHandle(rmutex);
}
bool ok = true;
if (idx >= MAX_READERS) {
qWarning("QtLockedFile::lock(): too many readers");
rmutex = 0;
ok = false;
}
else if (!rmutex) {
rmutex = getMutexHandle(idx, true);
if (!rmutex || !waitMutex(rmutex, false))
ok = false;
}
if (!ok && rmutex) {
CloseHandle(rmutex);
rmutex = 0;
}
ReleaseMutex(wmutex);
if (!ok)
return false;
}
else {
Q_ASSERT(rmutexes.isEmpty());
for (int i = 0; i < MAX_READERS; i++) {
Qt::HANDLE mutex = getMutexHandle(i, false);
if (mutex)
rmutexes.append(mutex);
}
if (rmutexes.size()) {
DWORD res = WaitForMultipleObjects(rmutexes.size(), rmutexes.constData(),
TRUE, block ? INFINITE : 0);
if (res != WAIT_OBJECT_0 && res != WAIT_ABANDONED) {
if (res != WAIT_TIMEOUT)
qErrnoWarning("QtLockedFile::lock(): WaitForMultipleObjects failed");
m_lock_mode = WriteLock; // trick unlock() to clean up - semiyucky
unlock();
return false;
}
}
}
m_lock_mode = mode;
return true;
}
bool QtLockedFile::unlock()
{
if (!isOpen()) {
qWarning("QtLockedFile::unlock(): file is not opened");
return false;
}
if (!isLocked())
return true;
if (m_lock_mode == ReadLock) {
ReleaseMutex(rmutex);
CloseHandle(rmutex);
rmutex = 0;
}
else {
foreach(Qt::HANDLE mutex, rmutexes) {
ReleaseMutex(mutex);
CloseHandle(mutex);
}
rmutexes.clear();
ReleaseMutex(wmutex);
}
m_lock_mode = QtLockedFile::NoLock;
return true;
}
QtLockedFile::~QtLockedFile()
{
if (isOpen())
unlock();
if (wmutex)
CloseHandle(wmutex);
}
youker-assistant/src/qtsingleapplication/qtlocalpeer.h 0000664 0001750 0001750 00000005205 13260315532 022354 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTLOCALPEER_H
#define QTLOCALPEER_H
#include
#include
#include
#include "qtlockedfile.h"
class QtLocalPeer : public QObject
{
Q_OBJECT
public:
QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
bool isClient();
bool sendMessage(const QString &message, int timeout);
QString applicationId() const
{ return id; }
Q_SIGNALS:
void messageReceived(const QString &message);
protected Q_SLOTS:
void receiveConnection();
protected:
QString id;
QString socketName;
QLocalServer* server;
QtLP_Private::QtLockedFile lockFile;
private:
static const char* ack;
};
#endif // QTLOCALPEER_H
youker-assistant/src/qtsingleapplication/qtlockedfile.cpp 0000664 0001750 0001750 00000013742 13260315532 023047 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtlockedfile.h"
/*!
\class QtLockedFile
\brief The QtLockedFile class extends QFile with advisory locking
functions.
A file may be locked in read or write mode. Multiple instances of
\e QtLockedFile, created in multiple processes running on the same
machine, may have a file locked in read mode. Exactly one instance
may have it locked in write mode. A read and a write lock cannot
exist simultaneously on the same file.
The file locks are advisory. This means that nothing prevents
another process from manipulating a locked file using QFile or
file system functions offered by the OS. Serialization is only
guaranteed if all processes that access the file use
QLockedFile. Also, while holding a lock on a file, a process
must not open the same file again (through any API), or locks
can be unexpectedly lost.
The lock provided by an instance of \e QtLockedFile is released
whenever the program terminates. This is true even when the
program crashes and no destructors are called.
*/
/*! \enum QtLockedFile::LockMode
This enum describes the available lock modes.
\value ReadLock A read lock.
\value WriteLock A write lock.
\value NoLock Neither a read lock nor a write lock.
*/
/*!
Constructs an unlocked \e QtLockedFile object. This constructor
behaves in the same way as \e QFile::QFile().
\sa QFile::QFile()
*/
QtLockedFile::QtLockedFile()
: QFile()
{
#ifdef Q_OS_WIN
wmutex = 0;
rmutex = 0;
#endif
m_lock_mode = NoLock;
}
/*!
Constructs an unlocked QtLockedFile object with file \a name. This
constructor behaves in the same way as \e QFile::QFile(const
QString&).
\sa QFile::QFile()
*/
QtLockedFile::QtLockedFile(const QString &name)
: QFile(name)
{
#ifdef Q_OS_WIN
wmutex = 0;
rmutex = 0;
#endif
m_lock_mode = NoLock;
}
/*!
Opens the file in OpenMode \a mode.
This is identical to QFile::open(), with the one exception that the
Truncate mode flag is disallowed. Truncation would conflict with the
advisory file locking, since the file would be modified before the
write lock is obtained. If truncation is required, use resize(0)
after obtaining the write lock.
Returns true if successful; otherwise false.
\sa QFile::open(), QFile::resize()
*/
bool QtLockedFile::open(OpenMode mode)
{
if (mode & QIODevice::Truncate) {
qWarning("QtLockedFile::open(): Truncate mode not allowed.");
return false;
}
return QFile::open(mode);
}
/*!
Returns \e true if this object has a in read or write lock;
otherwise returns \e false.
\sa lockMode()
*/
bool QtLockedFile::isLocked() const
{
return m_lock_mode != NoLock;
}
/*!
Returns the type of lock currently held by this object, or \e
QtLockedFile::NoLock.
\sa isLocked()
*/
QtLockedFile::LockMode QtLockedFile::lockMode() const
{
return m_lock_mode;
}
/*!
\fn bool QtLockedFile::lock(LockMode mode, bool block = true)
Obtains a lock of type \a mode. The file must be opened before it
can be locked.
If \a block is true, this function will block until the lock is
aquired. If \a block is false, this function returns \e false
immediately if the lock cannot be aquired.
If this object already has a lock of type \a mode, this function
returns \e true immediately. If this object has a lock of a
different type than \a mode, the lock is first released and then a
new lock is obtained.
This function returns \e true if, after it executes, the file is
locked by this object, and \e false otherwise.
\sa unlock(), isLocked(), lockMode()
*/
/*!
\fn bool QtLockedFile::unlock()
Releases a lock.
If the object has no lock, this function returns immediately.
This function returns \e true if, after it executes, the file is
not locked by this object, and \e false otherwise.
\sa lock(), isLocked(), lockMode()
*/
/*!
\fn QtLockedFile::~QtLockedFile()
Destroys the \e QtLockedFile object. If any locks were held, they
are released.
*/
youker-assistant/src/qtsingleapplication/qtlocalpeer.cpp 0000664 0001750 0001750 00000015070 13260315532 022710 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtlocalpeer.h"
#include
#include
#include
#if defined(Q_OS_WIN)
#include
#include
typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*);
static PProcessIdToSessionId pProcessIdToSessionId = 0;
#endif
#if defined(Q_OS_UNIX)
#include
#include
#include
#endif
namespace QtLP_Private {
#include "qtlockedfile.cpp"
#if defined(Q_OS_WIN)
#include "qtlockedfile_win.cpp"
#else
#include "qtlockedfile_unix.cpp"
#endif
}
const char* QtLocalPeer::ack = "ack";
QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
: QObject(parent), id(appId)
{
QString prefix = id;
if (id.isEmpty()) {
id = QCoreApplication::applicationFilePath();
#if defined(Q_OS_WIN)
id = id.toLower();
#endif
prefix = id.section(QLatin1Char('/'), -1);
}
prefix.remove(QRegExp("[^a-zA-Z]"));
prefix.truncate(6);
QByteArray idc = id.toUtf8();
quint16 idNum = qChecksum(idc.constData(), idc.size());
socketName = QLatin1String("qtsingleapp-") + prefix
+ QLatin1Char('-') + QString::number(idNum, 16);
#if defined(Q_OS_WIN)
if (!pProcessIdToSessionId) {
QLibrary lib("kernel32");
pProcessIdToSessionId = (PProcessIdToSessionId)lib.resolve("ProcessIdToSessionId");
}
if (pProcessIdToSessionId) {
DWORD sessionId = 0;
pProcessIdToSessionId(GetCurrentProcessId(), &sessionId);
socketName += QLatin1Char('-') + QString::number(sessionId, 16);
}
#else
socketName += QLatin1Char('-') + QString::number(::getuid(), 16);
#endif
server = new QLocalServer(this);
QString lockName = QDir(QDir::tempPath()).absolutePath()
+ QLatin1Char('/') + socketName
+ QLatin1String("-lockfile");
lockFile.setFileName(lockName);
lockFile.open(QIODevice::ReadWrite);
}
bool QtLocalPeer::isClient()
{
if (lockFile.isLocked())
return false;
if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false))
return true;
bool res = server->listen(socketName);
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0))
// ### Workaround
if (!res && server->serverError() == QAbstractSocket::AddressInUseError) {
QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName);
res = server->listen(socketName);
}
#endif
if (!res)
qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString()));
QObject::connect(server, SIGNAL(newConnection()), SLOT(receiveConnection()));
return false;
}
bool QtLocalPeer::sendMessage(const QString &message, int timeout)
{
if (!isClient())
return false;
QLocalSocket socket;
bool connOk = false;
for(int i = 0; i < 2; i++) {
// Try twice, in case the other instance is just starting up
socket.connectToServer(socketName);
connOk = socket.waitForConnected(timeout/2);
if (connOk || i)
break;
int ms = 250;
#if defined(Q_OS_WIN)
Sleep(DWORD(ms));
#else
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL);
#endif
}
if (!connOk)
return false;
QByteArray uMsg(message.toUtf8());
QDataStream ds(&socket);
ds.writeBytes(uMsg.constData(), uMsg.size());
bool res = socket.waitForBytesWritten(timeout);
if (res) {
res &= socket.waitForReadyRead(timeout); // wait for ack
if (res)
res &= (socket.read(qstrlen(ack)) == ack);
}
return res;
}
void QtLocalPeer::receiveConnection()
{
QLocalSocket* socket = server->nextPendingConnection();
if (!socket)
return;
while (socket->bytesAvailable() < (int)sizeof(quint32))
socket->waitForReadyRead();
QDataStream ds(socket);
QByteArray uMsg;
quint32 remaining;
ds >> remaining;
uMsg.resize(remaining);
int got = 0;
char* uMsgBuf = uMsg.data();
do {
got = ds.readRawData(uMsgBuf, remaining);
remaining -= got;
uMsgBuf += got;
} while (remaining && got >= 0 && socket->waitForReadyRead(2000));
if (got < 0) {
qWarning("QtLocalPeer: Message reception failed %s", socket->errorString().toLatin1().constData());
delete socket;
return;
}
QString message(QString::fromUtf8(uMsg));
socket->write(ack, qstrlen(ack));
socket->waitForBytesWritten(1000);
socket->waitForDisconnected(1000); // make sure client reads ack
delete socket;
emit messageReceived(message); //### (might take a long time to return)
}
youker-assistant/src/qtsingleapplication/QtSingleApplication 0000664 0001750 0001750 00000000041 13260315532 023516 0 ustar feng feng #include "qtsingleapplication.h"
youker-assistant/src/qtsingleapplication/qtsinglecoreapplication.pri 0000664 0001750 0001750 00000000504 13260315532 025324 0 ustar feng feng INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
HEADERS += $$PWD/qtsinglecoreapplication.h $$PWD/qtlocalpeer.h
SOURCES += $$PWD/qtsinglecoreapplication.cpp $$PWD/qtlocalpeer.cpp
QT *= network
win32:contains(TEMPLATE, lib):contains(CONFIG, shared) {
DEFINES += QT_QTSINGLECOREAPPLICATION_EXPORT=__declspec(dllexport)
}
youker-assistant/src/qtsingleapplication/qtsingleapplication.pri 0000664 0001750 0001750 00000001110 13260315532 024445 0 ustar feng feng include(../common.pri)
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
QT *= network
greaterThan(QT_MAJOR_VERSION, 4): QT *= widgets
qtsingleapplication-uselib:!qtsingleapplication-buildlib {
LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME
} else {
SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
}
win32 {
contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT
else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT
}
youker-assistant/src/qtsingleapplication/qtsingleapplication.h 0000664 0001750 0001750 00000007617 13260315532 024124 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTSINGLEAPPLICATION_H
#define QTSINGLEAPPLICATION_H
#include
class QtLocalPeer;
#if defined(Q_OS_WIN)
# if !defined(QT_QTSINGLEAPPLICATION_EXPORT) && !defined(QT_QTSINGLEAPPLICATION_IMPORT)
# define QT_QTSINGLEAPPLICATION_EXPORT
# elif defined(QT_QTSINGLEAPPLICATION_IMPORT)
# if defined(QT_QTSINGLEAPPLICATION_EXPORT)
# undef QT_QTSINGLEAPPLICATION_EXPORT
# endif
# define QT_QTSINGLEAPPLICATION_EXPORT __declspec(dllimport)
# elif defined(QT_QTSINGLEAPPLICATION_EXPORT)
# undef QT_QTSINGLEAPPLICATION_EXPORT
# define QT_QTSINGLEAPPLICATION_EXPORT __declspec(dllexport)
# endif
#else
# define QT_QTSINGLEAPPLICATION_EXPORT
#endif
class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication
{
Q_OBJECT
public:
QtSingleApplication(int &argc, char **argv, bool GUIenabled = true);
QtSingleApplication(const QString &id, int &argc, char **argv);
#if QT_VERSION < 0x050000
QtSingleApplication(int &argc, char **argv, Type type);
# if defined(Q_WS_X11)
QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
# endif // Q_WS_X11
#endif // QT_VERSION < 0x050000
bool isRunning();
QString id() const;
void setActivationWindow(QWidget* aw, bool activateOnMessage = true);
QWidget* activationWindow() const;
// Obsolete:
void initialize(bool dummy = true)
{ isRunning(); Q_UNUSED(dummy) }
public Q_SLOTS:
bool sendMessage(const QString &message, int timeout = 5000);
void activateWindow();
Q_SIGNALS:
void messageReceived(const QString &message);
private:
void sysInit(const QString &appId = QString());
QtLocalPeer *peer;
QWidget *actWin;
};
#endif // QTSINGLEAPPLICATION_H
youker-assistant/src/qtsingleapplication/qtsingleapplication.cpp 0000664 0001750 0001750 00000027010 13260315532 024444 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtsingleapplication.h"
#include "qtlocalpeer.h"
#include
/*!
\class QtSingleApplication qtsingleapplication.h
\brief The QtSingleApplication class provides an API to detect and
communicate with running instances of an application.
This class allows you to create applications where only one
instance should be running at a time. I.e., if the user tries to
launch another instance, the already running instance will be
activated instead. Another usecase is a client-server system,
where the first started instance will assume the role of server,
and the later instances will act as clients of that server.
By default, the full path of the executable file is used to
determine whether two processes are instances of the same
application. You can also provide an explicit identifier string
that will be compared instead.
The application should create the QtSingleApplication object early
in the startup phase, and call isRunning() to find out if another
instance of this application is already running. If isRunning()
returns false, it means that no other instance is running, and
this instance has assumed the role as the running instance. In
this case, the application should continue with the initialization
of the application user interface before entering the event loop
with exec(), as normal.
The messageReceived() signal will be emitted when the running
application receives messages from another instance of the same
application. When a message is received it might be helpful to the
user to raise the application so that it becomes visible. To
facilitate this, QtSingleApplication provides the
setActivationWindow() function and the activateWindow() slot.
If isRunning() returns true, another instance is already
running. It may be alerted to the fact that another instance has
started by using the sendMessage() function. Also data such as
startup parameters (e.g. the name of the file the user wanted this
new instance to open) can be passed to the running instance with
this function. Then, the application should terminate (or enter
client mode).
If isRunning() returns true, but sendMessage() fails, that is an
indication that the running instance is frozen.
Here's an example that shows how to convert an existing
application to use QtSingleApplication. It is very simple and does
not make use of all QtSingleApplication's functionality (see the
examples for that).
\code
// Original
int main(int argc, char **argv)
{
QApplication app(argc, argv);
MyMainWidget mmw;
mmw.show();
return app.exec();
}
// Single instance
int main(int argc, char **argv)
{
QtSingleApplication app(argc, argv);
if (app.isRunning())
return !app.sendMessage(someDataString);
MyMainWidget mmw;
app.setActivationWindow(&mmw);
mmw.show();
return app.exec();
}
\endcode
Once this QtSingleApplication instance is destroyed (normally when
the process exits or crashes), when the user next attempts to run the
application this instance will not, of course, be encountered. The
next instance to call isRunning() or sendMessage() will assume the
role as the new running instance.
For console (non-GUI) applications, QtSingleCoreApplication may be
used instead of this class, to avoid the dependency on the QtGui
library.
\sa QtSingleCoreApplication
*/
void QtSingleApplication::sysInit(const QString &appId)
{
actWin = 0;
peer = new QtLocalPeer(this, appId);
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
}
/*!
Creates a QtSingleApplication object. The application identifier
will be QCoreApplication::applicationFilePath(). \a argc, \a
argv, and \a GUIenabled are passed on to the QAppliation constructor.
If you are creating a console application (i.e. setting \a
GUIenabled to false), you may consider using
QtSingleCoreApplication instead.
*/
QtSingleApplication::QtSingleApplication(int &argc, char **argv, bool GUIenabled)
: QApplication(argc, argv, GUIenabled)
{
sysInit();
}
/*!
Creates a QtSingleApplication object with the application
identifier \a appId. \a argc and \a argv are passed on to the
QAppliation constructor.
*/
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv)
: QApplication(argc, argv)
{
sysInit(appId);
}
#if QT_VERSION < 0x050000
/*!
Creates a QtSingleApplication object. The application identifier
will be QCoreApplication::applicationFilePath(). \a argc, \a
argv, and \a type are passed on to the QAppliation constructor.
*/
QtSingleApplication::QtSingleApplication(int &argc, char **argv, Type type)
: QApplication(argc, argv, type)
{
sysInit();
}
# if defined(Q_WS_X11)
/*!
Special constructor for X11, ref. the documentation of
QApplication's corresponding constructor. The application identifier
will be QCoreApplication::applicationFilePath(). \a dpy, \a visual,
and \a cmap are passed on to the QApplication constructor.
*/
QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap)
: QApplication(dpy, visual, cmap)
{
sysInit();
}
/*!
Special constructor for X11, ref. the documentation of
QApplication's corresponding constructor. The application identifier
will be QCoreApplication::applicationFilePath(). \a dpy, \a argc, \a
argv, \a visual, and \a cmap are passed on to the QApplication
constructor.
*/
QtSingleApplication::QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap)
: QApplication(dpy, argc, argv, visual, cmap)
{
sysInit();
}
/*!
Special constructor for X11, ref. the documentation of
QApplication's corresponding constructor. The application identifier
will be \a appId. \a dpy, \a argc, \a
argv, \a visual, and \a cmap are passed on to the QApplication
constructor.
*/
QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap)
: QApplication(dpy, argc, argv, visual, cmap)
{
sysInit(appId);
}
# endif // Q_WS_X11
#endif // QT_VERSION < 0x050000
/*!
Returns true if another instance of this application is running;
otherwise false.
This function does not find instances of this application that are
being run by a different user (on Windows: that are running in
another session).
\sa sendMessage()
*/
bool QtSingleApplication::isRunning()
{
return peer->isClient();
}
/*!
Tries to send the text \a message to the currently running
instance. The QtSingleApplication object in the running instance
will emit the messageReceived() signal when it receives the
message.
This function returns true if the message has been sent to, and
processed by, the current instance. If there is no instance
currently running, or if the running instance fails to process the
message within \a timeout milliseconds, this function return false.
\sa isRunning(), messageReceived()
*/
bool QtSingleApplication::sendMessage(const QString &message, int timeout)
{
return peer->sendMessage(message, timeout);
}
/*!
Returns the application identifier. Two processes with the same
identifier will be regarded as instances of the same application.
*/
QString QtSingleApplication::id() const
{
return peer->applicationId();
}
/*!
Sets the activation window of this application to \a aw. The
activation window is the widget that will be activated by
activateWindow(). This is typically the application's main window.
If \a activateOnMessage is true (the default), the window will be
activated automatically every time a message is received, just prior
to the messageReceived() signal being emitted.
\sa activateWindow(), messageReceived()
*/
void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage)
{
actWin = aw;
if (activateOnMessage)
connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
else
disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
}
/*!
Returns the applications activation window if one has been set by
calling setActivationWindow(), otherwise returns 0.
\sa setActivationWindow()
*/
QWidget* QtSingleApplication::activationWindow() const
{
return actWin;
}
/*!
De-minimizes, raises, and activates this application's activation window.
This function does nothing if no activation window has been set.
This is a convenience function to show the user that this
application instance has been activated when he has tried to start
another instance.
This function should typically be called in response to the
messageReceived() signal. By default, that will happen
automatically, if an activation window has been set.
\sa setActivationWindow(), messageReceived(), initialize()
*/
void QtSingleApplication::activateWindow()
{
if (actWin) {
actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized);
actWin->raise();
actWin->activateWindow();
}
}
/*!
\fn void QtSingleApplication::messageReceived(const QString& message)
This signal is emitted when the current instance receives a \a
message from another instance of this application.
\sa sendMessage(), setActivationWindow(), activateWindow()
*/
/*!
\fn void QtSingleApplication::initialize(bool dummy = true)
\obsolete
*/
youker-assistant/src/qtsingleapplication/qtsinglecoreapplication.h 0000664 0001750 0001750 00000005025 13260315532 024764 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTSINGLECOREAPPLICATION_H
#define QTSINGLECOREAPPLICATION_H
#include
class QtLocalPeer;
class QtSingleCoreApplication : public QCoreApplication
{
Q_OBJECT
public:
QtSingleCoreApplication(int &argc, char **argv);
QtSingleCoreApplication(const QString &id, int &argc, char **argv);
bool isRunning();
QString id() const;
public Q_SLOTS:
bool sendMessage(const QString &message, int timeout = 5000);
Q_SIGNALS:
void messageReceived(const QString &message);
private:
QtLocalPeer* peer;
};
#endif // QTSINGLECOREAPPLICATION_H
youker-assistant/src/qtsingleapplication/QtLockedFile 0000664 0001750 0001750 00000000032 13260315532 022112 0 ustar feng feng #include "qtlockedfile.h"
youker-assistant/src/qtsingleapplication/qtsinglecoreapplication.cpp 0000664 0001750 0001750 00000012355 13260315532 025323 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtsinglecoreapplication.h"
#include "qtlocalpeer.h"
/*!
\class QtSingleCoreApplication qtsinglecoreapplication.h
\brief A variant of the QtSingleApplication class for non-GUI applications.
This class is a variant of QtSingleApplication suited for use in
console (non-GUI) applications. It is an extension of
QCoreApplication (instead of QApplication). It does not require
the QtGui library.
The API and usage is identical to QtSingleApplication, except that
functions relating to the "activation window" are not present, for
obvious reasons. Please refer to the QtSingleApplication
documentation for explanation of the usage.
A QtSingleCoreApplication instance can communicate to a
QtSingleApplication instance if they share the same application
id. Hence, this class can be used to create a light-weight
command-line tool that sends commands to a GUI application.
\sa QtSingleApplication
*/
/*!
Creates a QtSingleCoreApplication object. The application identifier
will be QCoreApplication::applicationFilePath(). \a argc and \a
argv are passed on to the QCoreAppliation constructor.
*/
QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv)
: QCoreApplication(argc, argv)
{
peer = new QtLocalPeer(this);
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
}
/*!
Creates a QtSingleCoreApplication object with the application
identifier \a appId. \a argc and \a argv are passed on to the
QCoreAppliation constructor.
*/
QtSingleCoreApplication::QtSingleCoreApplication(const QString &appId, int &argc, char **argv)
: QCoreApplication(argc, argv)
{
peer = new QtLocalPeer(this, appId);
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
}
/*!
Returns true if another instance of this application is running;
otherwise false.
This function does not find instances of this application that are
being run by a different user (on Windows: that are running in
another session).
\sa sendMessage()
*/
bool QtSingleCoreApplication::isRunning()
{
return peer->isClient();
}
/*!
Tries to send the text \a message to the currently running
instance. The QtSingleCoreApplication object in the running instance
will emit the messageReceived() signal when it receives the
message.
This function returns true if the message has been sent to, and
processed by, the current instance. If there is no instance
currently running, or if the running instance fails to process the
message within \a timeout milliseconds, this function return false.
\sa isRunning(), messageReceived()
*/
bool QtSingleCoreApplication::sendMessage(const QString &message, int timeout)
{
return peer->sendMessage(message, timeout);
}
/*!
Returns the application identifier. Two processes with the same
identifier will be regarded as instances of the same application.
*/
QString QtSingleCoreApplication::id() const
{
return peer->applicationId();
}
/*!
\fn void QtSingleCoreApplication::messageReceived(const QString& message)
This signal is emitted when the current instance receives a \a
message from another instance of this application.
\sa sendMessage()
*/
youker-assistant/src/qtsingleapplication/qtlockedfile.h 0000664 0001750 0001750 00000006307 13260315532 022513 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTLOCKEDFILE_H
#define QTLOCKEDFILE_H
#include
#ifdef Q_OS_WIN
#include
#endif
#if defined(Q_OS_WIN)
# if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT)
# define QT_QTLOCKEDFILE_EXPORT
# elif defined(QT_QTLOCKEDFILE_IMPORT)
# if defined(QT_QTLOCKEDFILE_EXPORT)
# undef QT_QTLOCKEDFILE_EXPORT
# endif
# define QT_QTLOCKEDFILE_EXPORT __declspec(dllimport)
# elif defined(QT_QTLOCKEDFILE_EXPORT)
# undef QT_QTLOCKEDFILE_EXPORT
# define QT_QTLOCKEDFILE_EXPORT __declspec(dllexport)
# endif
#else
# define QT_QTLOCKEDFILE_EXPORT
#endif
namespace QtLP_Private {
class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile
{
public:
enum LockMode { NoLock = 0, ReadLock, WriteLock };
QtLockedFile();
QtLockedFile(const QString &name);
~QtLockedFile();
bool open(OpenMode mode);
bool lock(LockMode mode, bool block = true);
bool unlock();
bool isLocked() const;
LockMode lockMode() const;
private:
#ifdef Q_OS_WIN
Qt::HANDLE wmutex;
Qt::HANDLE rmutex;
QVector rmutexes;
QString mutexname;
Qt::HANDLE getMutexHandle(int idx, bool doCreate);
bool waitMutex(Qt::HANDLE mutex, bool doBlock);
#endif
LockMode m_lock_mode;
};
}
#endif
youker-assistant/src/qtsingleapplication/qtlockedfile_unix.cpp 0000664 0001750 0001750 00000006614 13260315532 024112 0 ustar feng feng /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include
#include
#include
#include
#include "qtlockedfile.h"
bool QtLockedFile::lock(LockMode mode, bool block)
{
if (!isOpen()) {
qWarning("QtLockedFile::lock(): file is not opened");
return false;
}
if (mode == NoLock)
return unlock();
if (mode == m_lock_mode)
return true;
if (m_lock_mode != NoLock)
unlock();
struct flock fl;
fl.l_whence = SEEK_SET;
fl.l_start = 0;
fl.l_len = 0;
fl.l_type = (mode == ReadLock) ? F_RDLCK : F_WRLCK;
int cmd = block ? F_SETLKW : F_SETLK;
int ret = fcntl(handle(), cmd, &fl);
if (ret == -1) {
if (errno != EINTR && errno != EAGAIN)
qWarning("QtLockedFile::lock(): fcntl: %s", strerror(errno));
return false;
}
m_lock_mode = mode;
return true;
}
bool QtLockedFile::unlock()
{
if (!isOpen()) {
qWarning("QtLockedFile::unlock(): file is not opened");
return false;
}
if (!isLocked())
return true;
struct flock fl;
fl.l_whence = SEEK_SET;
fl.l_start = 0;
fl.l_len = 0;
fl.l_type = F_UNLCK;
int ret = fcntl(handle(), F_SETLKW, &fl);
if (ret == -1) {
qWarning("QtLockedFile::lock(): fcntl: %s", strerror(errno));
return false;
}
m_lock_mode = NoLock;
return true;
}
QtLockedFile::~QtLockedFile()
{
if (isOpen())
unlock();
}
youker-assistant/src/middlewidget.cpp 0000664 0001750 0001750 00000007130 13260315532 016763 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "middlewidget.h"
#include "../component/kylintoolbutton.h"
#include "mainwindow.h"
#include
MiddleWidget::MiddleWidget(QWidget *parent, QString arch, QString os)
: QWidget(parent), cur_arch(arch), osname(os)
{
this->setFixedSize(900, 47);
this->setAutoFillBackground(true);
QPalette palette;
palette.setColor(QPalette::Background, QColor(233,238,241));//#e9eef1
this->setPalette(palette);
QStringList icon_list;
QStringList text_list;
// if(this->cur_arch == "aarch64" || this->osname == "Kylin" || this->osname == "YHKylin")
// {
// icon_list<<":/tool/res/menu/home"<<":/tool/res/menu/cleanup"<<":/tool/res/menu/sysinfo"<<":/tool/res/menu/toolkits";
// text_list<< tr("KylinHome") << tr("Cleanup") << tr("Sysinfo") << tr("Toolkits");
// }
// else {
icon_list<<":/tool/res/menu/home"<<":/tool/res/menu/cleanup"<<":/tool/res/menu/sysinfo"<<":/tool/res/menu/feature"<<":/tool/res/menu/toolkits";
text_list<< tr("Home") << tr("Cleanup") << tr("Sysinfo") << tr("Feature") << tr("Toolkits");
// }
QHBoxLayout *button_layout = new QHBoxLayout();
QSignalMapper *signal_mapper = new QSignalMapper(this);
for(int i=0; isetFixedSize(180, 47);
button_list.append(tool_button);
connect(tool_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
signal_mapper->setMapping(tool_button, QString::number(i, 10));
button_layout->addWidget(tool_button, 0, Qt::AlignBottom);
}
this->switchSelectedPageIndex("0");
connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(switchSelectedPageIndex(QString)));
button_layout->addStretch();
button_layout->setSpacing(8);
button_layout->setMargin(0);
button_layout->setContentsMargins(15, 0, 15, 0);
setLayout(button_layout);
is_move = false;
}
MiddleWidget::~MiddleWidget()
{
for(int i=0; isetMousePress(true);
}
else
{
tool_button->setMousePress(false);
}
}
emit turnCurrentPage(current_index);
}
void MiddleWidget::showBoxTool()
{
// if(this->cur_arch == "aarch64" || this->osname == "Kylin" || this->osname == "YHKylin") {
// this->switchSelectedPageIndex("3");
// }
// else {
this->switchSelectedPageIndex("4");
// }
}
youker-assistant/src/toolkits.cpp 0000664 0001750 0001750 00000004561 13260315532 016176 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* 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 .
*/
#include "toolkits.h"
extern QPoint widgetPosition;
Toolkits::Toolkits(QObject *parent) :
QObject(parent)
{
this->mainwindow_width = 850;
this->mainwindow_height = 600;
this->alert_width = 200;
this->alert_height = 75;
alertBG = new AlertDialog();
this->alertTimer = new QTimer(this);
// connect(alertTimer, SIGNAL(timeout()), this, SLOT(updateAlert()));
// this->alertDelayTimer = new QTimer(this);
// connect(alertDelayTimer, SIGNAL(timeout()), this, SLOT(hideAlert()));
this->alertGOE = new QGraphicsOpacityEffect();
this->alertBG->setGraphicsEffect(alertGOE);
this->ao = 0.0;
this->alertBG->hide();
}
//启动alert提示
void Toolkits::alertMSG(const QString &alertText) {
this->alert_x = widgetPosition.x() + (mainwindow_width / 2) - (this->alert_width / 2);
this->alert_y = widgetPosition.y() + (mainwindow_height /2) - (this->alert_height / 2);
this->ay = this->alert_y;
this->ao = 0.0;
this->alertBG->move(this->alert_x, this->alert_y);
this->alertGOE->setOpacity(this->ao);
this->alertBG->setMSG(alertText);
this->alertBG->show();
// this->alertTimer->start(15);
}
//alert提示框的步处理
void Toolkits::updateAlert() {
// if(this->ao < 0.90){
// this->ao += 0.02;
// this->alertGOE->setOpacity(this->ao);
// }
// if(this->ay <= (this->alert_y - 150)){
// this->alertTimer->stop();
// //5秒后自动关闭alert提示框
// this->alertDelayTimer->start(1000);
// }else{
// this->ay -= 3;
// this->alertBG->move(this->alert_x,this->ay);
// }
}
//隐藏alert提示框
void Toolkits::hideAlert() {
this->alertBG->hide();
// this->alertDelayTimer->stop();
}
youker-assistant/src/kylinthread.cpp 0000664 0001750 0001750 00000001632 13260315532 016640 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "kylinthread.h"
#include "cleanerwidget.h"
KylinThread::KylinThread()
{
}
KylinThread::~KylinThread()
{
}
void KylinThread::run ()
{
return;
}
youker-assistant/src/mainwindow.h 0000664 0001750 0001750 00000010112 13260315532 016134 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include
#include
#include
#include
#include
#include "bottomcontentwidget.h"
#include "infowidget.h"
#include "settingwidget.h"
#include "cleanerwidget.h"
#include "boxwidget.h"
#include "../component/kylinmenu.h"
#include "../component/utils.h"
#include "../component/toolkits.h"
#include "aboutdialog.h"
class DataWorker;
class SystemDbusProxy;
class SessionDbusProxy;
class MainTopWidget;
class MiddleWidget;
class MainBottomWidget;
class TopBaseWidget;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QString cur_arch = "", int d_count = 0, QWidget* parent = 0/*, Qt::WindowFlags flags = 0*/);
~MainWindow();
void setTranslator(QTranslator* translator);
void initConnect();
void reViewThePointSkin(QString pciture);
void reViewTheOrgSkin();
void changeSkin(QString pciture);
void restoreSkin();
int getCurrentBackgroundIndex();
QString getCurrentBackgroundName();
QString getCurrentBackgroundAbsName();
QStringList filterSkin();
bool deleteFile(QString filename);
bool CopyFile(QString filename);
QString accessOSName();
void createAboutDialog();
void initWidgets();
void moveCenter();
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void closeEvent(QCloseEvent *);
// virtual void paintEvent(QPaintEvent *event);
public slots:
void openSkinCenter();
void openUpgradePage(/*QStringList version_list*/);
// void openUpgradePageAgain();
void showMainMenu();
void closeYoukerAssistant();
void setCurrentPageIndex(int index);
void changeLanguage(LANGUAGE language);
void newFeatures();
void setupConfigure();
void aboutUs();
void startDbusDaemon();
void onInitDataFinished();
void onPluginModuleError(const QString &info);
private:
QStackedWidget *m_topStack = nullptr;
QStackedWidget *m_bottomStack = nullptr;
MainTopWidget *m_mainTopWidget = nullptr;
MiddleWidget *m_middleWidget = nullptr;
MainBottomWidget *m_mainBottomWidget = nullptr;
MainTopWidget *cleaner_action_widget;
TopBaseWidget *info_action_widget = nullptr;
TopBaseWidget *setting_action_widget = nullptr;
TopBaseWidget *box_action_widget = nullptr;
InfoWidget *info_widget = nullptr;
CleanerWidget *cleaner_widget = nullptr;
SettingWidget *setting_widget = nullptr;
BoxWidget *box_widget = nullptr;
KylinMenu *main_menu = nullptr;
QPoint m_dragPosition; //移动的距离
bool m_mousePressed; //按下鼠标左键
QTranslator* translator = nullptr; //翻译器
LANGUAGE current_language; //当前语言
QPixmap main_skin_pixmap;
QString last_skin_path;
QPixmap review_skin_pixmap;
Toolkits *toolKits = nullptr;
AboutDialog *aboutDlg;
QSettings *mSettings;
QString desktop;
QString osName;
QString arch;
bool battery;
bool sensor;
int display_count;
QStringList m_cpulist;
QString m_currentCpuMode;
PAGESTATUS status;
DataWorker *m_dataWorker = nullptr;
QWidget *centralWidget = nullptr;
};
class GlobalData // define by hebing,just for transmit var
{
public:
static QString globalarch;
};
#endif // MAINWINDOW_H
youker-assistant/src/skincenter.h 0000664 0001750 0001750 00000006513 13260315532 016137 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef SKINCENTER_H
#define SKINCENTER_H
#include
#include
//#include
#include "../component/kylinlistwidget.h"
#include "../component/kylintitlebar.h"
#include "../component/kylinlistwidgetitem.h"
#include "../component/cardwidget.h"
#include "../component/itemcard.h"
class MainWindow;
class QParallelAnimationGroup;
//class SystemDispatcher;
//#include "../dbusproxy/youkersystemdbus.h"
class SkinCenter :public QDialog
{
Q_OBJECT
public:
SkinCenter(QWidget *parent = 0, QString skin = ":/background/res/skin/1.png", QString arch = "", QString os = "");//20161228
~SkinCenter();
void setParentWindow(MainWindow *From) { mainwindow = From;}
// void setSystemDbusProxy(SystemDispatcher* dispatcher) { systemProxy = dispatcher;}
void initSysBackgroundList();
void reloadBackgroundList();
// void setLanguage();
void initConnect();
void initTitleBar(const QString &path);
// void initUsingLogo(QListWidgetItem *init_item);
// void setLogo();
void initAnimation();
public slots:
void onCloseButtonClicked();
void changeSkinCenterBackground(QString pciture);
void changeEnterBackground(QString pciture);
void changeLeaveBackground();
void deleteBackground(QString picture);
void switchUsingLogo(QString index);
void switchCusteomUsingLogo(QString index);
void showSystem();
void showCustom();
void addCustomBackground();
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
//// virtual void enterEvent (QEvent *);
//// virtual void leaveEvent (QEvent *);
void closeEvent(QCloseEvent *event);
// void paintEvent(QPaintEvent *event);
// void enterEvent(QEvent *event);
// void leaveEvent(QEvent *event);
private:
MainWindow *mainwindow;
QPoint m_dragPosition; //移动的距离
// bool mouse_enter;
bool m_mousePressed; //按下鼠标左键
QWidget *baseWidget;
SystemButton *close_btn;
QLabel *indicator;
QLabel *label;
// KylinTitleBar *title_bar;
QWidget *skin_widget;
// KylinListWidget *list_widget;
QString last_skin_path;
// QLabel *using_label;
// QTimer *delayTimer;
// QString titlebar_pic;
QPushButton *sysBtn;
QPushButton *customBtn;
CardWidget *list_widget;
// SystemDispatcher *systemProxy;
QList card_list;
CardWidget *custom_list_widget;
QList custom_card_list;
QParallelAnimationGroup *aboutGroup;
QParallelAnimationGroup *contributorGroup;
};
#endif // SKINCENTER_H
youker-assistant/src/autostartwidget.ui 0000664 0001750 0001750 00000002470 13260315532 017410 0 ustar feng feng
AutoStartWidget
0
0
560
398
Dialog
0
32
560
33
0
65
560
31
0
96
560
300
true
0
0
558
298
youker-assistant/src/cameramanager.cpp 0000664 0001750 0001750 00000025031 13260315532 017104 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cameramanager.h"
#include "mainwindow.h"
#include
#include
#include "../dbusproxy/youkersessiondbus.h"
#include "../component/toolbutton.h"
//#include
#include
#include
CameraManager::CameraManager(QWidget *parent, SessionDispatcher *proxy, QString skin)
:QDialog(parent),sessionproxy(proxy)
{
this->setStyleSheet("QDialog{border: 1px solid white;border-radius:2px}");
this->setFixedSize(622, 480);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setAutoFillBackground(true);
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(Qt::white));
this->setPalette(palette);
timer = NULL;
imag = NULL;
cam = NULL;
frame = NULL;
title_bar = new KylinTitleBar(this);
initTitleBar(skin);
camera_label = new QLabel(this);
camera_label->setGeometry(QRect(0,32,622,340));
camera_label->hide();
baseWidget = new QWidget(this);
baseWidget->setStyleSheet("QWidget{border: none;background-color: #a6b6c1;}");//background:transparent;
baseWidget->setGeometry(QRect(0,372,622,108));
catch_label = new QLabel(baseWidget);
catch_label->setStyleSheet("QLabel{border: 1px solid white;}");
catch_label->setGeometry(QRect(10,11,145,86));
QImage image("://res/camera-default.png");
if (!image.isNull()) {
catch_label->setPixmap(QPixmap::fromImage(image).scaled(145, 86, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
disable_icon = new QLabel(baseWidget);
disable_icon->setGeometry(QRect(263,7,93,93));
disable_icon->setStyleSheet("QLabel{background-image:url(':/res/catch-disable.png')}");
disable_icon->hide();
okBtn = new QPushButton(baseWidget);
okBtn->setGeometry(QRect(263,7,93,93));
okBtn->hide();
okBtn->setCursor(Qt::PointingHandCursor);
okBtn->setFocusPolicy(Qt::NoFocus);
okBtn->setIconSize(QSize(93, 93));
okBtn->setFlat(true);
okBtn->setStyleSheet("QPushButton{background:transparent;background-image:url('://res/catch.png');}QPushButton:hover{background:url('://res/catch-hover.png');}");
viewBtn = new ToolButton(baseWidget, true);
viewBtn->setFocusPolicy(Qt::NoFocus);
viewBtn->setCursor(Qt::PointingHandCursor);
viewBtn->setIcon("://res/view.png");
viewBtn->setText(tr("View Photos"));
viewBtn->setGeometry(QRect(500,16,50,60));
error_icon = new QLabel(this);
error_icon->setGeometry(QRect(0,32,622,340));
error_icon->setStyleSheet("QLabel{background-image:url('://res/camera-error.png')}");
error_label = new QLabel(this);
error_label->setGeometry(QRect(10, 280, 600, 20));
error_label->setWordWrap(true);
error_label->setStyleSheet("QLabel{color:#90a5b1;font-family: 方正黑体_GBK;font-size: 14px;text-align: center;}");
error_label->setAlignment(Qt::AlignCenter);
error_label->setText(tr("The camera is out of question, Refresh to call it out ~"));
this->initCamera();
this->initConnect();
}
//CameraManager::~CameraManager()
//{
// if (timer != NULL) {
// disconnect(timer,SIGNAL(timeout()),this,SLOT(readFarme()));
// if(timer->isActive())
// timer->stop();
// delete timer;
// timer = NULL;
// }
// if (imag != NULL) {
// delete imag;
// imag = NULL;
// }
// if (cam != NULL) {
// delete cam;
// cam = NULL;
// }
//}
void CameraManager::initCamera()
{
timer = new QTimer(this);
imag = new QImage();
int number = this->countCamaras();//获取摄像头的个数
// qDebug() << "camara number:" << number;
// if (cam != NULL)
// return;
if(number < 1) {
this->setOKButtonEnable(false);
return;
}
else {
this->setOKButtonEnable(true);
}
//0表示内置摄像头 1表示外界摄像头
cam = cvCreateCameraCapture(0);//打开摄像头,从摄像头中获取视频
// assert(NULL != cam);
if(cam == NULL) {
this->setOKButtonEnable(false);
return;
}
cvSetCaptureProperty(cam, CV_CAP_PROP_FPS, 30);//帧率(只对摄像头有效)
//default :640*480
// cvSetCaptureProperty(cam, CV_CAP_PROP_FRAME_WIDTH, 1280);//视频流的帧宽度(只对摄像头有效)
// cvSetCaptureProperty(cam, CV_CAP_PROP_FRAME_HEIGHT, 720);//视频流的帧高度(只对摄像头有效)
timer->start(33);// 开始计时,超时则发出timeout()信号
}
QString CameraManager::getCurrentDateTime() {
QDateTime time = QDateTime::currentDateTime();//获取系统现在的时间
QString str = time.toString("yyyy-MM-dd hh:mm:ss dddd"); //设置显示格式
return str;
}
QString CameraManager::getHomePath() {
QString homepath = QDir::homePath();
return homepath;
}
int CameraManager::countCamaras() {
cv::VideoCapture temp_camera;
int maxTested = 10;
for (int i = 0; i < maxTested; i++) {
// try {
// cv::VideoCapture temp_camera(i);
// }
// catch(cv::Exception& e) {
// qDebug() << e.what();
// }
cv::VideoCapture temp_camera(i);
bool res = (!temp_camera.isOpened());
temp_camera.release();
if (res)
{
return i;
}
}
return maxTested;
}
void CameraManager::setOKButtonEnable(bool enable)
{
if(enable)
{
error_icon->hide();
error_label->hide();
disable_icon->hide();
camera_label->show();
okBtn->show();
// okBtn->setEnabled(true);
}
else
{
camera_label->hide();
// okBtn->setEnabled(false);
okBtn->hide();
error_icon->show();
error_label->show();
disable_icon->show();
}
}
void CameraManager::onOKButtonClicked()
{
frame = cvQueryFrame(cam);
// QImage image = QImage((const uchar*)frame->imageData, frame->width, frame->height, QImage::Format_RGB888).rgbSwapped();
QImage image = QImage((const uchar*)frame->imageData, frame->width, frame->height, QImage::Format_RGB888).rgbSwapped();
catch_label->setPixmap(QPixmap::fromImage(image).scaled(145, 86, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
IplImage* outImage = cvCreateImage(cvGetSize(frame),frame->depth,frame->nChannels);
cvCopy(frame,outImage,NULL);
// outImage = this->DoPyrDown(outImage);//图片缩放
QString outImageName = this->getHomePath() + "/" + this->getCurrentDateTime() + ".jpg";
char* ch;
QByteArray ba = outImageName.toUtf8();
ch=ba.data();
cvSaveImage(ch,outImage);
cvReleaseImage(&outImage);
}
void CameraManager::readFarme()
{
frame = cvQueryFrame(cam);
if(!frame)
return;
QImage image = QImage((const uchar*)frame->imageData, frame->width, frame->height, QImage::Format_RGB888).rgbSwapped();
camera_label->setPixmap(QPixmap::fromImage(image));
}
// 实现将拍下来的图片缩放一倍
IplImage* CameraManager::DoPyrDown(IplImage* image, int filter = IPL_GAUSSIAN_5x5)
//IplImage* CameraManager::DoPyrDown(IplImage* image, int filter = CV_GAUSSIAN_5x5)
{
CvSize size = cvSize(image->width / 2,image->height / 2);
IplImage* outImage = cvCreateImage(size,image->depth,image->nChannels);
cvPyrDown(image,outImage);
cvReleaseImage(&image);
return outImage;
}
void CameraManager::onViewButtonClicked()
{
// sessionproxy->open_folder_qt(sessionproxy->getHomePath());
QDesktopServices::openUrl(QUrl(QString("file:%1").arg(this->getHomePath()), QUrl::TolerantMode));
}
void CameraManager::initConnect()
{
connect(title_bar,SIGNAL(closeDialog()), this, SLOT(onCloseButtonClicked()));
connect(okBtn,SIGNAL(clicked()), this, SLOT(onOKButtonClicked()));
connect(viewBtn, SIGNAL(clicked()), this, SLOT(onViewButtonClicked()));
connect(error_label,SIGNAL(linkActivated(QString)),this,SLOT(refreshCamera()));
connect(timer, SIGNAL(timeout()), this, SLOT(readFarme())); // 时间到,读取当前摄像头信息
}
void CameraManager::refreshCamera()
{
int number = this->countCamaras();//获取摄像头的个数
if(number < 1) {
this->setOKButtonEnable(false);
return;
}
else {
this->setOKButtonEnable(true);
}
//0表示内置摄像头 1表示外界摄像头
cam = cvCreateCameraCapture(0);//打开摄像头,从摄像头中获取视频
if(cam == NULL) {
this->setOKButtonEnable(false);
return;
}
cvSetCaptureProperty(cam, CV_CAP_PROP_FPS, 30);//帧率(只对摄像头有效)
if(timer != NULL) {
if(timer->isActive())
timer->stop();
timer->start(33);// 开始计时,超时则发出timeout()信号
}
}
void CameraManager::onCloseButtonClicked()
{
cvReleaseCapture(&cam);
if (timer != NULL) {
disconnect(timer,SIGNAL(timeout()),this,SLOT(readFarme()));
if(timer->isActive())
timer->stop();
delete timer;
timer = NULL;
}
if (imag != NULL) {
delete imag;
imag = NULL;
}
if (cam != NULL) {
delete cam;
cam = NULL;
}
this->close();
}
void CameraManager::initTitleBar(QString skin)
{
title_bar->setTitleWidth(622);
title_bar->setTitleName(tr("Camera"));
title_bar->setTitleBackgound(skin);
}
void CameraManager::resetTitleSkin(QString skin)
{
title_bar->resetBackground(skin);
}
//void CameraManager::keyPressEvent(QKeyEvent *k)
//{
// if (k->key() == Qt::Key_Escape) {
// qDebug() << "prssss. esc.....";
// if (cam != NULL) {
// qDebug() << "cam not null";
// this->onCloseButtonClicked();
// }
// else
// qDebug() << "cam null";
// }
// else if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return)
// {
// qDebug() << "prssss. enter.....";
// if (cam != NULL)
// this->onPicButtonClicked();
// }
//}
youker-assistant/src/upgradedialog.h 0000664 0001750 0001750 00000006441 13260315532 016601 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef UPGRADEDIALOG_H
#define UPGRADEDIALOG_H
#include
#include "../component/kylintitlebar.h"
#include
#include
#include "../dbusproxy/youkersystemdbus.h"
#include "../dbusproxy/youkersessiondbus.h"
//class QMovie;
//class QTimer;
class LoadingLabel;
class UpgradeDialog : public QDialog
{
Q_OBJECT
public:
explicit UpgradeDialog(QWidget *parent = 0, /*const QString &version="", */QString skin = ":/background/res/skin/1.png", QString arch = "", QString os = "");//20161228
~UpgradeDialog();
void initConnect();
void resetTitleSkin(QString skin);
void switchPage(bool flag);
void setSystemDbusProxy(SystemDispatcher *dispatcher) { systemProxy = dispatcher;}
void setSessionDbusProxy(SessionDispatcher *dispatcher) { sessionProxy = dispatcher;}
void resetVersionNumber(QStringList version_list);
void startAccessData();
void showErrorComponents();
void showUpdateSourceComponents();
public slots:
void onCloseBtnClicked();
void onUpgradeBtnClicked();
void receiveFetchSignal(QString msg_type, QStringList msg);
void receiveAptSignal(QString msg_type, QStringList msg);
void checkLastestVersion();
void receiveCheckResultSignal(bool result);
void onRetryBtnClicked();
// void slotDisappearTip();
void openUrl(QString url);
signals:
void close_signal();
void showBackendBtnSignal(bool flag);
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
QPoint m_dragPosition; //移动的距离
bool m_mousePressed; //按下鼠标左键
QWidget *baseWidget;
SystemButton *close_btn;
QProgressBar *progressbar;
QLabel *visit_label;
QLabel *net_icon_label;
QLabel *normal_icon_label;
QLabel *ok_icon_label;
LoadingLabel *work_loading_label;
LoadingLabel *upgrade_loading_label;
QLabel *m_appNameLabel;
QLabel *doing_label;
QLabel *error_label;
QLabel *tip_label;
QLabel *splitlabel;
QLabel *version_label;
QWidget *new_widget;
QLabel *hook_label;
QLabel *official_label;
QLabel *vline;
QLabel *new_label;
QLabel *new_num_label;
QPushButton *retryBtn;
QPushButton *upgradeBtn;
QPushButton *okBtn;
SystemDispatcher *systemProxy;
SessionDispatcher *sessionProxy;
bool isBusy;
bool upgradeOver;
// QMovie *movie;
// QLabel *movie_label;
// QTimer *timer;
// QLabel *msg_label;
QString cur_version;
};
#endif // UPGRADEDIALOG_H
youker-assistant/src/cleanerwidget.cpp 0000664 0001750 0001750 00000006364 13260315532 017146 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cleanerwidget.h"
#include
#include
#include "../component/utils.h"
CleanerWidget::CleanerWidget(QWidget *parent) :
QWidget(parent)
{
this->setFixedSize(900, 403);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Widget);
//set white background color
this->setAutoFillBackground(true);
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(Qt::white));
this->setPalette(palette);
statked_widget = new QStackedWidget(this);
p_mainwindow = NULL;
main_widget = NULL;
detail_widget = NULL;
}
CleanerWidget::~CleanerWidget()
{
}
void CleanerWidget::initUI(QString skin)
{
//20180101
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()));
connect(main_widget, SIGNAL(showActionAnimaiton()), this, SIGNAL(tranActionAnimaitonSignal()));
// connect(detail_widget, SIGNAL(showActionAnimaiton()), this, SIGNAL(tranCleanActionAnimaitonSignal()));
connect(detail_widget, SIGNAL(sendScanOverStatus(bool)), this, SIGNAL(tranScanOverSignal(bool)));
statked_widget->addWidget(main_widget);
statked_widget->addWidget(detail_widget);
QVBoxLayout *layout1 = new QVBoxLayout();
layout1->addWidget(statked_widget);
layout1->setSpacing(0);
layout1->setMargin(0);
layout1->setContentsMargins(0, 0, 0, 0);
setLayout(layout1);
connect(main_widget, SIGNAL(startScanSystem(QMap)), this, SIGNAL(startScanSystem(QMap)));
connect(detail_widget, SIGNAL(startCleanSystem(QMap)), this, SIGNAL(startCleanSystem(QMap)));
connect(this, SIGNAL(tellCleanerDetailData(QStringList)), detail_widget, SLOT(showReciveData(QStringList)));
connect(this, SIGNAL(tellCleanerDetailStatus(QString)), detail_widget, SLOT(showReciveStatus(QString)));
}
void CleanerWidget::resetSkin(QString skin)
{
if(main_widget != NULL)
main_widget->resetCurrentSkin(skin);
if(detail_widget != NULL)
detail_widget->resetCurrentSkin(skin);
}
void CleanerWidget::displayDetailPage()
{
statked_widget->setCurrentIndex(1);
}
void CleanerWidget::displayMainPage()
{
statked_widget->setCurrentIndex(0);
main_widget->resetDefaultStatus();
detail_widget->CleanUIAndData();
}
youker-assistant/src/homepage.h 0000664 0001750 0001750 00000004742 13260315532 015561 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef HOMEPAGE_H
#define HOMEPAGE_H
#include
#include
#include
#include
#include
class MainWindow;
class SessionDispatcher;
class SystemDispatcher;
class ToolButton;
//#include "autostartwidget.h"
//#include "cameramanager.h"
class HomePage : public QWidget
{
Q_OBJECT
public:
explicit HomePage(QWidget *parent = 0, QString arch = "", QString os = ""/*, const QString &version = ""*/);
~HomePage();
void setLanguage();
void initBoxTool();
void initConnect();
void setSessionDbusProxy(SessionDispatcher *dispatcher) { sessionProxy = dispatcher;}
void setSystemDbusProxy(SystemDispatcher *dispatcher) { systemProxy = dispatcher;}
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void initUI();
//protected:
// bool eventFilter(QObject *obj, QEvent *event);
public slots:
void switchPageIndex(QString index);
// void checkLastestVersion();
void displayBackedBtn(bool flag);
void onCheckBtnClicked();
void hideBackedBtn();
signals:
void sendSubIndex(int index);
void sendSignal();
void moreSignal();
void sendOpenUpgrade();
private:
QLabel *version_logo;
QLabel *version_title;
QLabel *version_tip;
QPushButton *check_btn;
// QLabel *version_label;
QLabel *box_logo;
QPushButton *box_title;
QLabel *box_tip;
// QPushButton *more_text_btn;
// QPushButton *more_btn;
SessionDispatcher *sessionProxy;
SystemDispatcher *systemProxy;
MainWindow *p_mainwindow;
// AutoStartWidget *auto_start;
// CameraManager *camera_manager;
QString current_version;
QString osname;
QString osarch;
// QList item_list;
};
#endif // HOMEPAGE_H
youker-assistant/src/kylinthread.h 0000664 0001750 0001750 00000002135 13260315532 016304 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef KYLINTHREAD_H
#define KYLINTHREAD_H
#include
class CleanerWidget;
class KylinThread : public QThread
{
Q_OBJECT
public:
KylinThread();
~KylinThread();
virtual void run();
void setCleanerWidget(CleanerWidget* widget) { parent_widget = widget; }
private:
CleanerWidget *parent_widget;
};
#endif // KYLINTHREAD_H
youker-assistant/src/cleanerwidget.h 0000664 0001750 0001750 00000003733 13260315532 016610 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CLEANERWIDGET_H
#define CLEANERWIDGET_H
#include
#include "../cleaner/cleanermainwidget.h"
#include "../cleaner/cleanerdetailwidget.h"
#include
class Toolkits;
class MainWindow;
class CleanerWidget : public QWidget
{
Q_OBJECT
public:
explicit CleanerWidget(QWidget *parent = 0);
~CleanerWidget();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void setToolKits(Toolkits* kits) { toolKits = kits;}
void initUI(QString skin);
void resetSkin(QString skin);
public slots:
void displayDetailPage();
void displayMainPage();
signals:
void transCleanSignal();
void transScanSignal();
void tranActionAnimaitonSignal();
// void tranCleanActionAnimaitonSignal();
void tranScanOverSignal(bool status);
void tellCleanerDetailData(const QStringList &data);
void tellCleanerDetailStatus(const QString &status);
void startScanSystem(QMap itemsMap);
void startCleanSystem(QMap itemsMap);
private:
QStackedWidget *statked_widget;
CleanerMainWidget *main_widget;
CleanerDetailWidget *detail_widget;
MainWindow *p_mainwindow;
Toolkits *toolKits;
};
#endif // CLEANERWIDGET_H
youker-assistant/src/autostart.h 0000664 0001750 0001750 00000002373 13260315532 016020 0 ustar feng feng #ifndef AUTOSTART_H
#define AUTOSTART_H
#include
#include "../component/kylinlistwidget.h"
#include "../component/kylintitlebar.h"
#include "../component/autogroup.h"
//class KylinTitleBar;
//#include
//#include "../component/kylinscrollarea.h"
#include "../component/testscrollwidget.h"
class MainWindow;
class SessionDispatcher;
class AutoStart :public QDialog
{
Q_OBJECT
public:
AutoStart(QWidget *parent = 0, SessionDispatcher *proxy = 0);
~AutoStart();
// void setParentWindow(MainWindow *From) { mainwindow = From;}
void setLanguage();
void initConnect();
void initData();
public slots:
void onCloseButtonClicked();
void onMinButtonClicked();
void setCurrentItemAutoStatus(QString dekstopName);
void readyReciveData(const QStringList &data);
void readyShowUI();
private:
void initTitleBar();
private:
SessionDispatcher *sessionproxy;
// MainWindow *mainwindow;
KylinTitleBar *title_bar;
// QWidget *bottom_widget;
// KylinListWidget *list_widget;
// QList auto_list;
QList data_list;
// QScrollArea *scrollArea;
// QWidget *panel;
// KylinScrollArea *scroll_widget;
TestScrollWidget *scroll_widget;
};
#endif // AUTOSTART_H
youker-assistant/src/actionwidget.cpp 0000664 0001750 0001750 00000002016 13260315532 017000 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "actionwidget.h"
ActionWidget::ActionWidget(QWidget *parent)
: QWidget(parent)
{
this->setFixedSize(900, 227);
// this->setGeometry(0, 0, 900, 227);
this->setAutoFillBackground(true);
}
ActionWidget::~ActionWidget()
{
}
youker-assistant/src/settingwidget.h 0000664 0001750 0001750 00000025370 13260315532 016655 0 ustar feng feng /*
* 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 .
*/
#ifndef SETTINGWIDGET_H
#define SETTINGWIDGET_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "../setting/themewidget.h"
#include "../setting/iconwidget.h"
#include "../setting/mousewidget.h"
#include "../setting/soundwidget.h"
//#include "../setting/animationwidget.h"
#include "../setting/menuwidget.h"
#include "../setting/panelwidget.h"
#include "../setting/windowwidget.h"
#include "../setting/fontwidget.h"
#include "../setting/touchpadwidget.h"
//#include "../setting/deadpixelwidget.h"
#include "../setting/energywidget.h"
#include "../setting/filemanagerwidget.h"
#include "../component/quibo.h"
//#include "../component/settingaction.h"
class MainWindow;
class SettingListView;
class SettingModel;
class SettingWidget : public QWidget
{
Q_OBJECT
public:
explicit SettingWidget(/*QStringList cpulist, QString cpu, */QString cur_desktop, /*bool has_battery = false, */QWidget *parent = 0);
~SettingWidget();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void initSettingsUI(QStringList cpulist, QString cpu, bool has_battery = false /*QString skin*/);
void resetSkin(QString skin);
signals:
void changeActionPage(const QString &moduleName);//void changeActionPage(SettingAction::SettingModuleID moduleId);
void string_value_notify(QString key, QString value);
void bool_value_notify(QString key, bool value);
void int_value_notify(QString key, int value);
void double_value_notify(QString key, double value);
//theme
void changeSystemTheme(const QString &name);
void requestThemeData();
void sendThemeList(const QString ¤tTheme, const QStringList &themeList);
//icon
void requestIconData();
void resetIconTheme(const QString &name);
void sendIconThemeList(const QString ¤tTheme, const QStringList &themeList);
void sendDisplayIconValue(bool computer, bool folder, bool network, bool recycle, bool disk);
void displayComputerIcon(bool b);
void displayFolderIcon(bool b);
void displayNetworkIcon(bool b);
void displayRecycleBinIcon(bool b);
void displayDiskIcon(bool b);
//mouse
void requestMouseData();
void sendMouseThemeAndCusorSize(const QString ¤tTheme, const QStringList &themeList, int cusorSize);
void resetMouseCursorTheme(const QString &name);
void resetMouseCursorSize(int cursorSize);
//voice
void requestSoundData();
void sendSoundList(const QString ¤tSound, const QStringList &soundList);
void sendEnableSoundValue(bool login_music, bool sound_event, bool input_sound);
void resetVoiceTheme(QString selectTheme);
void resetLoginTipVoice(bool b);
void resetEventVoice(bool b);
void resetInputFeedbackVoice(bool b);
//panel
void requestMateOrUnityPanelData(bool isMate);
void sendMatePanelValue(bool app, bool desktop, bool icon, bool places);
void sendUnityBlurAndTransparencyValue(int blur, double transparent);
void sendUnityTimeValue(const QString &time_format, const QStringList &timelist, bool showSecond, bool showWeek, bool showDate);
void sendUnityPanelPowerValue(const QString &cur_power, const QStringList &powerlist, bool showPower, bool showBatteryTime);
void resetPanelTransparencyValue(double value);
void resetDateFormat(const QString &selected);
void resetShowBatteryIcon(const QString &selected);
void resetDashBlurExperimental(int value);
void resetDisplaySeconds(bool b);
void resetDisplayWeek(bool b);
void resetDisplayDate(bool b);
void resetDisplayBatteryPercentage(bool b);
void resetDisplayBatteryTime(bool b);
void resetShowApplications(bool b);
void resetShowDesktop(bool b);
void resetShowIcon(bool b);
void resetShowPlaces(bool b);
//launcher menu
void requestMateOrUnityMenuData(bool isMate);
void sendMatePanelIconValue(int topIconSize, int bottomIconSize, bool topIconHide, bool bottomIconHide);
void sendUnityIconValue(int iconSize, bool iconHide, bool desktopIconShowed, double launcherTransparency, int iconColourIndex, const QStringList &colourlist);
void sendUnityLauncherPosition(const QString ¤t_position, const QStringList &positionlist);
void resetIconSizeValue(int value);
void resetTransparencyValue(int value);
void resetIconColouring(int value);
void resetAutoHide(bool b);
void resetDisplayDesktopIcon(bool b);
void resetTopIconSizeValue(int value);
void resetBottomIconSizeValue(int value);
void resetTopAutoHide(bool b);
void resetBottomAutoHide(bool b);
void resetLauncherPosition(const QString &position);
//window
void requesetWindowButtonAlign();
void requesetMenusHaveIcons();
void requesetWindowTitileTags();
void sendWindowButtonAlign(const QString ¤t_value);
void sendMenusHaveIcons(bool menuHaveIcons);
void sendWindowTitileTags(const QString ¤t_wheel_type, const QStringList &wheellist, const QStringList &titlebarOptions, const QString ¤t_double_type, const QString ¤t_middle_type, const QString ¤t_right_type);
void resetMenusHaveIcon(bool);
void resetTitlebarWheel(const QString &selected);
void resetTitlebarDoubleClick(const QString &selected);
void resetMouseMiddleClick(const QString &selected);
void resetMouseRightClick(const QString &selected);
void resetWindowButtonLeftOrRightAlign(bool isLeft);
//font
void requestFontData();
void sendFontValue(const QString &curFont);
void sendDesktopFontValue(const QString &curFont);
void sendMonospaceFontValue(const QString &curFont);
void sendDocumentFontValue(const QString &curFont);
void sendTitlebarFontValue(const QString &curFont);
void sendFontSmoothAndAntialiasingValue(double fontZoom, const QString ¤t_smooth, const QStringList &smoothlist, const QString ¤t_antialiasing, const QStringList &antialiasinglist);
void setDefaultFontByName(const QString &cur_font);
void setDesktopFontByName(const QString &cur_font);
void setMonospaceFontByName(const QString &cur_font);
void setDocumentFontByName(const QString &cur_font);
void setTitlebarFontByName(const QString &cur_font);
void resetFontZoomScalingValue(double value);
void resetFontHinting(const QString &selected);
void resetFontAntialiasing(const QString &selected);
void restoreDefaultFont(bool isMate);
void restoreDesktopDefaultFont(bool isMate);
void restoreMonospaceDefaultFont(bool isMate);
void restoreDocumentDefaultFont(bool isMate);
void restoreTitlebarDefaultFont(bool isMate);
//touchpad
void requestMateOrUnityTouchpadData(bool isMate);
void sendTouchPadValue(bool touchpadEnable, bool touchscrollingHorizontal, const QString &mode_value, int scroll_int_value, const QString &scroll_string_value);
void resetTouchpad(bool b);
void resetHorizontalScrolling(bool b);
void setScrollbarOverlayOrLegacyMode(bool b);
void setMateTouchscrollingMode(int flag);
void setUnityTouchscrollingMode(int flag);
//ac and battery
void requestPowerAndBatteryData();
void sendIdleAndGammaData(double gamma, const QStringList &aclist, int brightnessValue, const QString &sleepTimeoutDisplayBattery, const QString &sleepTimeoutFisplayAC, const QString &idle_delay, const QStringList &idledelaylist);
void sendLockAndSleepData(bool lockEnabled, const QString &lock_delay, const QStringList &lockdelaylist, const QString &critical_low, const QString &laptop_battery, const QString &laptop_ac, const QString &sleepTimeoutBattery, const QStringList &batterylist, const QString &sleepTimeoutAc);
void resetScreenGammaValue(double value);
void resetBrightnessValue(int value);
void resetIdleDelay(int index, int curValue);
void resetLockEnabled(bool b);
void resetLockDelay(int index, int curValue);
void setCurrentCriticalLow(const QString &value);
void setCurrentLidBattery(const QString &value);
void setCurrentLidAC(const QString &value);
void resetSleepTimeoutBattery(int index, int value);
void resetSleepTimeoutAC(int index, int value);
void resetSleepTimeoutDisplayBattery(int index, int value);
void resetSleepTimeoutDisplayAC(int index, int value);
void setCurrentCpuMode(const QString &mode);
//file manager
void requestFileManagerData();
void sendFileManagerData(bool locationReplacePathbar, bool autoMountMedia, bool autoOpenFolder, bool promptAutorunPrograms, int thumbnailIconSize, int thumbnailCacheTime, int thumbnailCacheSize);
void resetLocationReplacePathbar(bool b);
void resetAutoMountMedia(bool b);
void resetAutoOpenFolder(bool b);
void resetPromptAutorunPrograms(bool b);
void resetThumbnailIconSize(int value);
void resetThumbnailCacheTime(int value);
void resetThumbnailCacheSize(int value);
public slots:
void displaySettingHomePage();
//void startMonitorCheck();
void onSettingItemClicked(const QModelIndex &index);
void onSettingItemEntered(const QModelIndex &index);
void on_string_value_notify(QString key, QString value);
void on_bool_value_notify(QString key, bool value);
void on_int_value_notify(QString key, int value);
void on_double_value_notify(QString key, double value);
private:
SettingListView *m_settingListView;
SettingModel *m_settingModel;
int itemSpace;
MainWindow *p_mainwindow;
QString desktop;
bool battery;
QStringList m_cpuList;
QString m_currentCpu;
QStackedWidget *stacked_widget;
ThemeWidget *theme_widget;
IconWidget *icon_widget;
MouseWidget *mouse_widget;
SoundWidget *sound_widget;
// AnimationWidget *animation_widget;
MenuWidget *launcher_widget;
PanelWidget *panel_widget;
WindowWidget *window_widget;
FontWidget *font_widget;
TouchpadWidget *touchpad_widget;
// DeadpixelWidget *deadpixel_widget;
EnergyWidget *conserve_widget;
FileManagerWidget *nautilus_widget;
//QUIBO *qtui;
};
#endif // SETTINGWIDGET_H
youker-assistant/src/cameramanager-org.h 0000664 0001750 0001750 00000003404 13260315532 017336 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CAMERAMANAGER_H
#define CAMERAMANAGER_H
#include
#include "../component/kylinlistwidget.h"
#include "../component/kylintitlebar.h"
class SessionDispatcher;
class MainWindow;
class CameraManager :public QDialog
{
Q_OBJECT
public:
CameraManager(QWidget *parent = 0, SessionDispatcher *proxy = 0, QString skin = ":/background/res/skin/1.png");
~CameraManager();
void setParentWindow(MainWindow *From) { mainwindow = From;}
// void initBackgroundList();
void setLanguage();
void initConnect();
void setOKButtonEnable(bool enable);
void resetTitleSkin(QString skin);
public slots:
void onCloseButtonClicked();
void onOKButtonClicked();
void onViewButtonClicked();
private:
void initTitleBar(QString skin);
private:
MainWindow *mainwindow;
SessionDispatcher *sessionproxy;
KylinTitleBar *title_bar;
QLabel *msg_label;
QLabel *tip_label;
QLabel *description_label;
QPushButton *okBtn;
QPushButton *viewBtn;
};
#endif // CAMERAMANAGER_H
youker-assistant/src/loginwidget.cpp 0000664 0001750 0001750 00000010716 13260315532 016641 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "loginwidget.h"
#include "mainwindow.h"
#include
#include
LoginWidget::LoginWidget(QWidget *parent)
: QWidget(parent)
{
this->setFixedSize(300, 72);
logo_label = new QPushButton();
logo_label->setObjectName("whiteButton");
logo_label->setCursor(Qt::PointingHandCursor);
// logo_label->setCursor(Qt::ArrowCursor);
// logo_label->setCursor(Qt::SizeHorCursor);
logo_label->setFocusPolicy(Qt::NoFocus);
login_button = new QPushButton();
login_button->setObjectName("loginButton");
login_button->setCursor(Qt::PointingHandCursor);
login_button->setFocusPolicy(Qt::NoFocus);
login_button->setFixedSize(44, 44);
// login_button->setIcon(QIcon("://res/logo.png"));
login_button->setIconSize(QSize(44, 44));
login_button->setFlat(true);
user_label = new QLabel();
user_label->hide();
user_label->setStyleSheet("QLabel{color:#ffffff;font-family: 方正黑体_GBK;font-size: 12px;text-align: right;}");
user_label->adjustSize();
logout_btn = new QPushButton();
logout_btn->setObjectName("whiteButton");
logout_btn->setCursor(Qt::PointingHandCursor);
logout_btn->setFocusPolicy(Qt::NoFocus);
logout_btn->hide();
QHBoxLayout *layout = new QHBoxLayout();
layout->addStretch();
layout->addWidget(logo_label, 0, Qt::AlignVCenter);
layout->addWidget(login_button, 0, Qt::AlignVCenter);
layout->addWidget(user_label, 0, Qt::AlignVCenter);
layout->addWidget(logout_btn, 0, Qt::AlignVCenter);
layout->setSpacing(11);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
is_move = false;
this->initConnect();
this->setLauguage();
}
LoginWidget::~LoginWidget()
{
if(login_button != NULL)
{
delete login_button;
login_button = NULL;
}
if(logo_label != NULL)
{
delete logo_label;
logo_label = NULL;
}
if(user_label != NULL)
{
delete user_label;
user_label = NULL;
}
if(logout_btn != NULL)
{
delete logout_btn;
logout_btn = NULL;
}
}
void LoginWidget::initConnect()
{
connect(logo_label, SIGNAL(clicked()), this, SLOT(onLoginButtonClicked()));
connect(login_button, SIGNAL(clicked()), this, SLOT(onLoginButtonClicked()));
connect(logout_btn, SIGNAL(clicked()), this, SLOT(onLogoutButtonClicked()));
}
void LoginWidget::showLoginInfo(QString name, QString email)
{
logo_label->hide();
login_button->hide();
user_label->show();
// user_label->setText(name + "<" + email + ">");
QString alltext= QString("%1 <%2>").arg(name).arg(email);
QFont ft;
QFontMetrics fm(ft);
QString elided_text = fm.elidedText(alltext, Qt::ElideRight, 260);
user_label->setText(elided_text);
if(elided_text.endsWith("…"))
user_label->setToolTip(alltext);
logout_btn->show();
}
void LoginWidget::showLoginAndLogoutStatus(bool status)
{
if(status)
{//logout success
logo_label->show();
login_button->show();
logout_btn->hide();
user_label->setText("");
user_label->hide();
}
else
{//login failed
qDebug() << "login failed";
}
}
void LoginWidget::setLauguage()
{
// logo_label->setText(tr("Login Youker Account"));
// logout_btn->setText(tr("Logout"));
logo_label->setText(tr("Login Kylin Account"));
logout_btn->setText(tr("Logout"));
}
void LoginWidget::onLoginButtonClicked()
{
sessionProxy->popup_login_dialog();
}
void LoginWidget::onLogoutButtonClicked()
{
sessionProxy->logout_ubuntukylin_account();
}
youker-assistant/src/infoactionwidget.h 0000664 0001750 0001750 00000002316 13260315532 017324 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef INFOACTIONWIDGET_H
#define INFOACTIONWIDGET_H
#include
#include
#include
#include
class InfoActionWidget : public QWidget
{
Q_OBJECT
public:
explicit InfoActionWidget(QWidget *parent = 0);
~InfoActionWidget();
void setLanguage();
private:
QLabel *img_label;
QLabel *suggest_label;
// QLabel *result_label;
};
#endif // INFOACTIONWIDGET_H
youker-assistant/src/cameramanager-org.cpp 0000664 0001750 0001750 00000012065 13260315532 017674 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
//#include "cameramanager.h"
#include "mainwindow.h"
#include
#include
#include "../dbusproxy/youkersessiondbus.h"
CameraManager::CameraManager(QWidget *parent, SessionDispatcher *proxy, QString skin)
:QDialog(parent),sessionproxy(proxy)
{
this->setStyleSheet("QDialog{border: 1px solid gray;border-radius:2px}");
this->setFixedSize(500, 271);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setAutoFillBackground(true);
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(Qt::white));
this->setPalette(palette);
title_bar = new KylinTitleBar();
initTitleBar(skin);
msg_label = new QLabel();
msg_label->setWordWrap(true);//QLabel自动换行
msg_label->setFixedWidth(480);
palette.setColor(QPalette::WindowText,Qt::red);
msg_label->setPalette(palette);
msg_label->hide();
tip_label = new QLabel();
tip_label->setWordWrap(true);//QLabel自动换行
tip_label->setFixedWidth(480);
description_label = new QLabel();
description_label->setWordWrap(true);//QLabel自动换行
description_label->setFixedWidth(480);
okBtn = new QPushButton();
viewBtn = new QPushButton();
okBtn->setFixedSize(91, 25);
okBtn->setObjectName("blackButton");
okBtn->setFocusPolicy(Qt::NoFocus);
viewBtn->setFixedSize(91, 25);
viewBtn->setObjectName("blackButton");
viewBtn->setFocusPolicy(Qt::NoFocus);
QHBoxLayout *h_layout = new QHBoxLayout();
h_layout->addStretch();
h_layout->addWidget(okBtn);
h_layout->addWidget(viewBtn);
h_layout->addStretch();
h_layout->setSpacing(50);
h_layout->setMargin(0);
h_layout->setContentsMargins(0,0,0,0);
QVBoxLayout *v_layout = new QVBoxLayout();
v_layout->addWidget(msg_label);
v_layout->addWidget(tip_label);
v_layout->addWidget(description_label);
v_layout->addLayout(h_layout);
v_layout->setSpacing(30);
v_layout->setMargin(0);
v_layout->setContentsMargins(10, 40, 10, 0);
QVBoxLayout *main_layout = new QVBoxLayout();
main_layout->addWidget(title_bar);
main_layout->addLayout(v_layout);
main_layout->addStretch();
main_layout->setSpacing(0);
main_layout->setMargin(0);
main_layout->setContentsMargins(0, 0, 0, 0);
setLayout(main_layout);
this->setLanguage();
this->initConnect();
}
CameraManager::~CameraManager()
{
if(title_bar != NULL) {
delete title_bar;
title_bar = NULL;
}
if(msg_label != NULL) {
delete msg_label;
msg_label = NULL;
}
if(tip_label != NULL) {
delete tip_label;
tip_label = NULL;
}
if(description_label != NULL) {
delete description_label;
description_label = NULL;
}
if(okBtn != NULL) {
delete okBtn;
okBtn = NULL;
}
if(viewBtn != NULL) {
delete viewBtn;
viewBtn = NULL;
}
}
void CameraManager::setLanguage()
{
msg_label->setText(tr("NO found camara"));
tip_label->setText(tr("An application to take pictures with the device camera."));
description_label->setText(tr("Press the [ESC] button to take picture and turn the camera off , the photo saved in home directory by default."));
okBtn->setText(tr("Open camera"));
viewBtn->setText(tr("View Photos"));
}
void CameraManager::setOKButtonEnable(bool enable)
{
if(enable)
{
msg_label->hide();
okBtn->setEnabled(true);
}
else
{
msg_label->show();
okBtn->setEnabled(false);
}
}
void CameraManager::onOKButtonClicked()
{
sessionproxy->call_camera_qt();
}
void CameraManager::onViewButtonClicked()
{
sessionproxy->open_folder_qt(sessionproxy->getHomePath());
}
void CameraManager::initConnect()
{
connect(title_bar,SIGNAL(closeDialog()), this, SLOT(onCloseButtonClicked()));
connect(okBtn,SIGNAL(clicked()), this, SLOT(onOKButtonClicked()));
connect(viewBtn,SIGNAL(clicked()), this, SLOT(onViewButtonClicked()));
}
void CameraManager::onCloseButtonClicked()
{
this->close();
}
void CameraManager::initTitleBar(QString skin)
{
title_bar->setTitleWidth(500);
title_bar->setTitleName(tr("Camera Manager"));
// title_bar->setTitleBackgound(":/background/res/skin/1.png");
title_bar->setTitleBackgound(skin);
}
void CameraManager::resetTitleSkin(QString skin)
{
title_bar->resetBackground(skin);
}
youker-assistant/src/aboutdialog.cpp 0000664 0001750 0001750 00000027042 13260315532 016617 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "QDesktopWidget"
#include "aboutdialog.h"
#include
#include
#include
#include "../component/utils.h"
AboutDialog::AboutDialog(QWidget *parent, /*const QString &version, */QString skin, QString arch, QString os):
QDialog(parent)
{
this->setWindowFlags(Qt::FramelessWindowHint);
// this->setWindowFlags(Qt::WindowStaysOnTopHint);
this->setFixedSize(442, 326);
this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}");
this->setWindowTitle(tr("About us"));
this->setWindowIcon(QIcon(":/res/kylin-assistant.png"));
aboutGroup = NULL;
contributorGroup = NULL;
baseWidget = new QWidget(this);
baseWidget->setGeometry(QRect(0, 0, 442, 82));
// baseWidget->setStyleSheet("QWidget{background:transparent url(://res/menu-big-hover.png);}");
baseWidget->setAutoFillBackground(true);
// QPixmap label_pixmap(skin);
// logo_label->setPixmap(label_pixmap);
// logo_label->setFixedSize(label_pixmap.size());
// QPixmap label_pixmap(skin);
// qDebug() << label_pixmap.size();
QPalette palette;
palette.setBrush(QPalette::Background, QBrush(QPixmap(skin)));
baseWidget->setPalette(palette);
close_btn = new SystemButton(baseWidget);
close_btn->setFocusPolicy(Qt::NoFocus);
close_btn->loadPixmap(":/sys/res/sysBtn/close_button.png");
iconLabel = new QLabel(baseWidget);
//iconLabel->setGeometry(QRect(380, 20, 44, 44));
iconLabel->setGeometry(QRect(360, 36, 44, 44));//20161228
m_appNameLabel = new QLabel(baseWidget);
m_appNameLabel->setGeometry(QRect(71, 0, 300, 30));
// linkLabel = new QLabel();
// iconLabel->setStyleSheet("QLabel{background-image:url(':/res/kylin-assistant.png')}");
QImage image(":/res/kylin-assistant.png");
image = image.scaled(QSize(44, 44), Qt::KeepAspectRatio, Qt::SmoothTransformation);
iconLabel->setPixmap(QPixmap::fromImage(image));
m_appNameLabel->setStyleSheet("QLabel{color:#ffffff;font-family: 方正黑体_GBK;font-size: 12px;text-align: center;font-weight:bold;}");
m_appNameLabel->setAlignment(Qt::AlignCenter);
// if (arch == "aarch64" || os == "Kylin" || os == "YHKylin") {//20161228
// close_btn->move(442-36, 0);
// m_appNameLabel->setText(tr("Kylin Assisant") + " " + VERSION);
// }
// else {
// close_btn->move(0, 0);
// m_appNameLabel->setText(tr("Youker Assisant") + " " + VERSION);
// }
close_btn->move(442-36, 0);
m_appNameLabel->setText(tr("Kylin Assistant") + " " + qApp->applicationVersion());
// linkLabel->setAlignment(Qt::AlignRight);
// linkLabel->setText(QString::fromLocal8Bit(" home page"));
aboutBtn = new QPushButton(baseWidget);
aboutBtn->setText(tr("About"));
aboutBtn->setGeometry(QRect(10, 50, 60, 24));
contributorBtn = new QPushButton(baseWidget);
contributorBtn->setText(tr("Contributor"));
contributorBtn->setGeometry(QRect(75, 50, 60, 24));
indicator = new QLabel(baseWidget);
indicator->setStyleSheet("QLabel{background-image:url('://res/underline.png');background-position:center;}");
indicator->setGeometry(QRect(10, 75, 60, 2));
// aboutIndicator = new QLabel(baseWidget);
// aboutIndicator->setGeometry(QRect(10, 75, 60, 2));
// contributorIndicator = new QLabel(baseWidget);
// contributorIndicator->setGeometry(QRect(75, 75, 60, 2));
// aboutIndicator->setStyleSheet("QLabel{background-image:url('://res/underline.png');background-position:center;}");
// contributorIndicator->setStyleSheet("QLabel{background-image:url('://res/underline.png');background-position:center;}");
// contributorIndicator->hide();
// aboutEdit = new QTextEdit(this);
aboutEdit = new QTextBrowser(this);
aboutEdit->setOpenLinks(true);
aboutEdit->setOpenExternalLinks(true);
contributorEdit = new QTextEdit(this);
aboutEdit->setGeometry(QRect(17, 92, 408, 200));
contributorEdit->setGeometry(QRect(17, 92, 408, 200));
aboutEdit->setReadOnly(true);
contributorEdit->setReadOnly(true);
// if (arch == "aarch64" || os == "Kylin" || os == "YHKylin") {
// contributorEdit->setText(tr("Maintainer:\nKylin Team "));
// aboutEdit->append(tr(" Kylin Assistant is a powerful system supporting software which is developed by Kylin team. Mainly for the naive user, it can help users manage the system. At present, It provides system junk scanning and cleaning, viewing the system hardware and software information, task manager, and some other functions."));
// aboutEdit->append(tr(" The software is still under development. Please visit ") + QString::fromLocal8Bit("www.ubuntukylin.com") + tr(" for more information. Welcome everyone to join with us. kylin-assistant Homepage: "));
// }
// else {
// contributorEdit->setText(tr("Maintainer:\nUbuntu Kylin Team "));
// aboutEdit->append(tr(" Youker Assistant is a powerful system supporting software which is developed by Ubuntu Kylin team. Mainly for the naive user, it can help users manage the system. At present, It provides system junk scanning and cleaning, viewing the system hardware and software information, system customization, task manager, and some other functions."));
// aboutEdit->append(tr(" The software is still under development. Please visit ") + QString::fromLocal8Bit("www.ubuntukylin.com") + tr(" for more information. Welcome everyone to join with us. youker-assistant Homepage: "));
// }
contributorEdit->setText(tr("Maintainer:\nKylin Team "));
aboutEdit->append(tr(" Kylin Assistant is a powerful system supporting software which is developed by Kylin team. Mainly for the naive user, it can help users manage the system. At present, It provides system junk scanning and cleaning, viewing the system hardware and software information, task manager, and some other functions."));
aboutEdit->append(tr(" The software is still under development. Please visit ") + QString::fromLocal8Bit("www.ubuntukylin.com") + tr(" for more information. Welcome everyone to join with us. kylin-assistant Homepage: "));
aboutEdit->append(QString::fromLocal8Bit("https://github.com/KylinAppCenter/youker-assistant"));
aboutEdit->append(QString::fromLocal8Bit("https://launchpad.net/youker-assistant"));
contributorEdit->hide();
aboutBtn->setFocusPolicy(Qt::NoFocus);
aboutBtn->setObjectName("transparentButton");
contributorBtn->setFocusPolicy(Qt::NoFocus);
contributorBtn->setObjectName("transparentButton");
aboutBtn->setStyleSheet("QPushButton{border:none;text-align:center;font-family: 方正黑体_GBK;font-size:14px;color:#ffffff;}");//QPushButton:hover{color:#666666;}//background:transparent;
contributorBtn->setStyleSheet("QPushButton{border:none;text-align:center;font-family: 方正黑体_GBK;font-size:14px;color:#ffffff;}");//QPushButton:hover{color:#666666;}//background:transparent;
// aboutEdit->setStyleSheet("QLineEdit{border:1px solid #bebebe;}");
// contributorEdit->setStyleSheet("QLineEdit{border:1px solid #bebebe;}");
aboutEdit->setStyleSheet("QTextBrowser{border:none;font-family: 方正黑体_GBK;font-size:14px;}");
contributorEdit->setStyleSheet("QTextEdit{border:none;font-family: 方正黑体_GBK;font-size:14px;}");
okBtn = new QPushButton(this);
okBtn->setGeometry(QRect(334, 295, 90, 25));
okBtn->setObjectName("blackButton");
okBtn->setFocusPolicy(Qt::NoFocus);
okBtn->setText(tr("Close"));
this->initAnimation();
this->initConnect();
}
AboutDialog::~AboutDialog()
{
if(aboutGroup != NULL)
{
delete aboutGroup;
aboutGroup = NULL;
}
if(contributorGroup != NULL)
{
delete contributorGroup;
contributorGroup = NULL;
}
}
void AboutDialog::initAnimation()
{
QRect mainAcitonRect(10, 75, 60, 2);
QRect origAcitonRect(75, 75, 60, 2);
QPropertyAnimation *aboutAnimation = new QPropertyAnimation(indicator, "geometry");
aboutAnimation->setDuration(300);
aboutAnimation->setStartValue(origAcitonRect);
aboutAnimation->setEndValue(mainAcitonRect);
aboutGroup = new QParallelAnimationGroup(this);
aboutGroup->addAnimation(aboutAnimation);
QPropertyAnimation *contributorAnimation = new QPropertyAnimation(indicator, "geometry");
contributorAnimation->setDuration(300);
contributorAnimation->setStartValue(mainAcitonRect);
contributorAnimation->setEndValue(origAcitonRect);
contributorGroup = new QParallelAnimationGroup(this);
contributorGroup->addAnimation(contributorAnimation);
}
void AboutDialog::initConnect()
{
connect(aboutBtn, SIGNAL(clicked()), this, SLOT(onAboutBtnClicked()));
connect(contributorBtn, SIGNAL(clicked()), this, SLOT(onContributorBtnClicked()));
connect(close_btn, SIGNAL(clicked()), this, SLOT(onCloseBtnClicked()));
connect(okBtn, SIGNAL(clicked()), this, SLOT(onCloseBtnClicked()));
// connect(title_bar,SIGNAL(closeDialog()), this, SLOT(onCloseBtnClicked()));
// connect(linkLabel,SIGNAL(linkActivated(QString)),this,SLOT(openUrl(QString)));
}
void AboutDialog::onAboutBtnClicked()
{
aboutGroup->start();
aboutEdit->show();
// aboutIndicator->show();
contributorEdit->hide();
// contributorIndicator->hide();
}
void AboutDialog::onContributorBtnClicked()
{
contributorGroup->start();
contributorEdit->show();
// contributorIndicator->show();
aboutEdit->hide();
// aboutIndicator->hide();
}
void AboutDialog::resetTitleSkin(QString skin)
{
// title_bar->resetBackground(skin);
QPalette palette;
palette.setBrush(QPalette::Background, QBrush(QPixmap(skin)));
baseWidget->setPalette(palette);
}
void AboutDialog::onCloseBtnClicked()
{
this->close();
}
void AboutDialog::openUrl(QString url)
{
QDesktopServices::openUrl(QUrl(url));
}
void AboutDialog::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
m_mousePressed = true;
m_dragPosition = event->globalPos() - this->frameGeometry().topLeft();
event->accept();
}
}
void AboutDialog::mouseReleaseEvent(QMouseEvent *)
{
m_mousePressed = false;
}
void AboutDialog::mouseMoveEvent(QMouseEvent *event)
{
if(m_mousePressed)
{
QPoint move_pos = event->globalPos();
move(move_pos - m_dragPosition);
event->accept();
}
}
youker-assistant/src/settingactionwidget.cpp 0000664 0001750 0001750 00000023724 13260315532 020407 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "settingactionwidget.h"
#include "mainwindow.h"
SettingActionWidget::SettingActionWidget(QString cur_desktop, QWidget *parent)
: QWidget(parent), desktop(cur_desktop)
{
this->setFixedSize(900, 150);
this->setAutoFillBackground(true);
this->setObjectName("transparentWidget");
img_label = new QLabel();
title_label = new QLabel();
// description_label = new QLabel();
main_action = new QWidget();
img_label->setScaledContents(true);//自动缩放,显示图像大小自动调整为Qlabel大小
QPixmap label_pixmap("://res/systemset.png");
img_label->setPixmap(label_pixmap);
img_label->setFixedSize(label_pixmap.size());
title_label->setObjectName("whiteLabel");
// description_label->setWordWrap(true);//QLabel自动换行
// description_label->setObjectName("tipLabel");
// QVBoxLayout *layout1 = new QVBoxLayout();
// layout1->addStretch();
// layout1->addWidget(title_label);
// layout1->addWidget(description_label);
// layout1->addStretch();
// layout1->setSpacing(15);
// layout1->setMargin(0);
// layout1->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->addWidget(img_label, 0, Qt::AlignVCenter);
layout2->addWidget(title_label, 0, Qt::AlignVCenter);
// layout2->addLayout(layout1);
layout2->setSpacing(20);
layout2->setMargin(0);
layout2->setContentsMargins(20, 20, 0, 0);
main_action->setLayout(layout2);
stacked_widget = new QStackedWidget(this);//stacked_widget will delete when SettingWidget delete
// main_action = new SettingAction(desktop);
// main_action->setModuleName("MainPage");
theme_action = new SettingAction(desktop);
theme_action->setModuleName("ThemePage");
// theme_action->setModuleNameID(SettingAction::ThemePage);
// enum SettingModuleID{
// ThemePage = 0,
// IconPage,
// MousePage,
// SoundPage,
// PanelPage,
// MenuPage,
// WindowPage,
// FontPage,
// TouchPadPage,
// EnergyPage,
// FMPage
// };
// theme_action->setLanguage(1);
icon_action = new SettingAction(desktop);
icon_action->setModuleName("IconPage");
// icon_action->setLanguage(2);
mouse_action = new SettingAction(desktop);
mouse_action->setModuleName("MousePage");
// mouse_action->setLanguage(3);
voice_action = new SettingAction(desktop);
voice_action->setModuleName("SoundPage");
// voice_action->setLanguage(4);
// animation_action = new SettingAction(desktop);
// animation_action->setLanguage(5);
launcher_action = new SettingAction(desktop);
launcher_action->setModuleName("MenuPage");
// launcher_action->setLanguage(5);
panel_action = new SettingAction(desktop);
panel_action->setModuleName("PanelPage");
// panel_action->setLanguage(6);
window_action = new SettingAction(desktop);
window_action->setModuleName("WindowPage");
// window_action->setLanguage(7);
font_action = new SettingAction(desktop);
font_action->setModuleName("FontPage");
// font_action->setLanguage(8);
touchpad_action = new SettingAction(desktop);
touchpad_action->setModuleName("TouchPadPage");
// touchpad_action->setLanguage(9);
// deadpixel_action = new SettingAction(desktop);
// deadpixel_action->setModuleName("MonitorPage");
// deadpixel_action->setLanguage(10);
conserve_aciton = new SettingAction(desktop);
conserve_aciton->setModuleName("EnergyPage");
// conserve_aciton->setLanguage(11);
nautilus_action = new SettingAction(desktop);
nautilus_action->setModuleName("FMPage");
// nautilus_action->setLanguage(12);
stacked_widget->addWidget(main_action);
stacked_widget->addWidget(theme_action);
stacked_widget->addWidget(icon_action);
stacked_widget->addWidget(mouse_action);
stacked_widget->addWidget(voice_action);
// stacked_widget->addWidget(animation_action);
stacked_widget->addWidget(launcher_action);
stacked_widget->addWidget(panel_action);
stacked_widget->addWidget(window_action);
stacked_widget->addWidget(font_action);
stacked_widget->addWidget(touchpad_action);
// stacked_widget->addWidget(deadpixel_action);
stacked_widget->addWidget(conserve_aciton);
stacked_widget->addWidget(nautilus_action);
QHBoxLayout *main_layout = new QHBoxLayout();
main_layout->addWidget(stacked_widget);
main_layout->setSpacing(0);
main_layout->setContentsMargins(0, 0, 0, 0);
this->setLayout(main_layout);
this->initConnect();
this->setLanguage();
}
SettingActionWidget::~SettingActionWidget()
{
if(img_label != NULL)
{
delete img_label;
img_label = NULL;
}
if(title_label != NULL)
{
delete title_label;
title_label = NULL;
}
if(main_action != NULL)
{
delete main_action;
main_action = NULL;
}
if(theme_action != NULL)
{
delete theme_action;
theme_action = NULL;
}
if(icon_action != NULL)
{
delete icon_action;
icon_action = NULL;
}
if(mouse_action != NULL)
{
delete mouse_action;
mouse_action = NULL;
}
if(voice_action != NULL)
{
delete voice_action;
voice_action = NULL;
}
if(launcher_action != NULL)
{
delete launcher_action;
launcher_action = NULL;
}
if(panel_action != NULL)
{
delete panel_action;
panel_action = NULL;
}
if(window_action != NULL)
{
delete window_action;
window_action = NULL;
}
if(font_action != NULL)
{
delete font_action;
font_action = NULL;
}
if(touchpad_action != NULL)
{
delete touchpad_action;
touchpad_action = NULL;
}
// if(deadpixel_action != NULL)
// {
// delete deadpixel_action;
// deadpixel_action = NULL;
// }
if(conserve_aciton != NULL)
{
delete conserve_aciton;
conserve_aciton = NULL;
}
if(nautilus_action != NULL)
{
delete nautilus_action;
nautilus_action = NULL;
}
}
void SettingActionWidget::initConnect()
{
connect(theme_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(icon_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(mouse_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(voice_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
// connect(animation_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(launcher_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(panel_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(window_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(font_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(touchpad_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
// connect(deadpixel_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(conserve_aciton, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
connect(nautilus_action, SIGNAL(showSettingMainWidget()), this, SLOT(displayActionMainPage()));
}
void SettingActionWidget::setLanguage()
{
title_label->setText(tr("You can perform a full range of customized systems based on personal preferences"));//您可以根据个人喜好对系统进行全方位的定制
// description_label->setText(tr("您可以根据个人喜好对系统进行全方位的定制"));
}
//void SettingActionWidget::displayActionSubPage(SettingAction::SettingModuleID moduleId)
void SettingActionWidget::displayActionSubPage(QString moduleName)
{
for (int i = 0; i < stacked_widget->count(); i++) {
if (QWidget *widget = static_cast(stacked_widget->widget(i))) {
if (widget->inherits("SettingAction")) {
if (SettingAction *action = static_cast(stacked_widget->widget(i))) {
QPointer panel(action);
if (panel.isNull()) {
continue;
}
if (action->getModuleName() == moduleName) {
stacked_widget->setCurrentWidget(action);
break;
}
// if (action->getModuleNameID() == moduleId) {
// stacked_widget->setCurrentWidget(action);
// }
}
}
}
}
}
void SettingActionWidget::displayActionMainPage() {
stacked_widget->setCurrentWidget(main_action);
emit this->notifyContentPageToMain();
// QObject *object = QObject::sender();
// QAction *action = qobject_cast(object);
// QString object_name = action->objectName();
}
youker-assistant/src/cameramanager.h 0000664 0001750 0001750 00000005225 13260315532 016554 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CAMERAMANAGER_H
#define CAMERAMANAGER_H
//sudo apt-get install libcv-dev libopencv-highgui-dev libopencv-dev libhighgui-dev
#include
#include "../component/kylintitlebar.h"
#include
#include // 设置采集数据的间隔时间
#include //包含opencv库头文件
#include
//#include //1710opencv库
//#include
//#include
#include
#include
#include
#include
#include
class SessionDispatcher;
class MainWindow;
class ToolButton;
class CameraManager :public QDialog
{
Q_OBJECT
public:
CameraManager(QWidget *parent = 0, SessionDispatcher *proxy = 0, QString skin = ":/background/res/skin/1.png");
// ~CameraManager();
void setParentWindow(MainWindow *From) { mainwindow = From;}
void initConnect();
void setOKButtonEnable(bool enable);
void resetTitleSkin(QString skin);
void initCamera();
IplImage* DoPyrDown(IplImage* image, int filter);
QString getCurrentDateTime();
QString getHomePath();
int countCamaras();
public slots:
void readFarme();//读取当前帧信息
void onCloseButtonClicked();
void onOKButtonClicked();
void onViewButtonClicked();
void refreshCamera();
//protected:
// void keyPressEvent( QKeyEvent *k );
private:
void initTitleBar(QString skin);
private:
MainWindow *mainwindow;
SessionDispatcher *sessionproxy;
QTimer *timer;
QImage *imag;
CvCapture *cam;// 视频获取结构, 用来作为视频获取函数的一个参数
IplImage *frame;//申请IplImage类型指针,就是申请内存空间来存放每一帧图像
KylinTitleBar *title_bar;
QLabel *camera_label;
QWidget *baseWidget;
QLabel *catch_label;
QLabel *disable_icon;
QPushButton *okBtn;
ToolButton *viewBtn;
QLabel *error_icon;
QLabel *error_label;
};
#endif // CAMERAMANAGER_H
youker-assistant/src/signalmanager.h 0000664 0001750 0001750 00000000545 13260315532 016601 0 ustar feng feng #ifndef SIGNALMANAGER_H
#define SIGNALMANAGER_H
#include
class SignalManager : public QObject
{
Q_OBJECT
public:
static SignalManager *Instance();
signals:
void showTip(const QString &msg);
private:
explicit SignalManager(QObject *parent = 0);
private:
static SignalManager *m_signalManager;
};
#endif // SIGNALMANAGER_H
youker-assistant/src/aboutdialog.ui 0000664 0001750 0001750 00000016056 13260315532 016455 0 ustar feng feng
AboutDialog
0
0
400
320
400
320
400
320
About
2
0
396
271
1
About
10
1
64
64
:/res/youker-assistant.png
77
17
241
20
Youker Assistant
Qt::AlignCenter
292
42
101
17
Qt::AlignCenter
18
76
361
151
true
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:11pt;"> Youker Assistant is a powerful system supporting software which is developed by Ubuntu Kylin team. Mainly for the naive user, it can help users manage the system. At present, It provides system junk scanning and cleaning, viewing the system hardware and software information , system customization, task manager, monitoring ball, and some other functions. </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:11pt;"> The software is still under development. Please visit www.ubuntukylin.com for more information. Welcome everyone to join with us. youker-assistant Homepage: https://launchpad.net/youker-assistant.</span></p></body></html>
Contributor
18
76
361
151
true
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:11pt;">Maintainer</span><span style=" font-family:'Droid Sans Fallback'; font-size:11pt;">:</span></p>
<p style=" margin-top:11px; margin-bottom:11px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:11pt;">Ubuntu Kylin Team <ubuntukylin-members@list.launchpad.net></span></p></body></html>
10
1
64
64
:/res/youker-assistant.png
77
17
241
20
Youker Assistant
Qt::AlignCenter
292
42
101
17
<a href=https://launchpad.net/youker-assistant>home page</a>
Qt::AlignCenter
291
281
81
30
Close
youker-assistant/src/actionwidget.h 0000664 0001750 0001750 00000001775 13260315532 016460 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef ACTIONWIDGET_H
#define ACTIONWIDGET_H
#include
class ActionWidget : public QWidget
{
Q_OBJECT
public:
explicit ActionWidget(QWidget *parent = 0);
~ActionWidget();
};
#endif // ACTIONWIDGET_H
youker-assistant/src/autostartwidget.cpp 0000664 0001750 0001750 00000020341 13260315532 017552 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "autostartwidget.h"
#include "ui_autostartwidget.h"
#include
#include
#include
#include "../dbusproxy/youkersessiondbus.h"
#include "../component/utils.h"
//AutoStartWidget::AutoStartWidget(QWidget *parent, SessionDispatcher *proxy) :
// QWidget(parent),sessionproxy(proxy),
AutoStartWidget::AutoStartWidget(QDialog *parent, SessionDispatcher *proxy, QString skin) :
QDialog(parent),sessionproxy(proxy),
ui(new Ui::AutoStartWidget)
{
ui->setupUi(this);
this->setFixedSize(560, 398);
setWindowFlags(Qt::FramelessWindowHint);
this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}");
this->setWindowIcon(QIcon(":/res/kylin-assistant.png"));
this->setWindowTitle(tr("Boot Manager"));
tip_label = new QLabel();
num_label = new QLabel();
on_label = new QLabel();
on_num_label = new QLabel();
off_label = new QLabel();
off_num_label = new QLabel();
name_label = new QLabel();
status_label = new QLabel();
ui->widget_1->setAutoFillBackground(true);
ui->widget_2->setAutoFillBackground(true);
QPalette palette;
palette.setColor(QPalette::Background, QColor(233,238,241));//#e9eef1
ui->widget_1->setPalette(palette);
palette.setColor(QPalette::Background, QColor(255,255,255));//#ffffff
ui->widget_2->setPalette(palette);
tip_label->setText(tr("AutoStart Items:"));
name_label->setText(tr("App"));
status_label->setText(tr("Status"));
on_label->setText(tr("ON Items:"));
off_label->setText(tr("OFF Items:"));
QHBoxLayout *layout1 = new QHBoxLayout();
layout1->addWidget(tip_label);
layout1->addWidget(num_label);
layout1->setSpacing(0);
layout1->setMargin(0);
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->addWidget(on_label);
layout2->addWidget(on_num_label);
layout2->setSpacing(0);
layout2->setMargin(0);
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->addWidget(off_label);
layout3->addWidget(off_num_label);
layout3->setSpacing(0);
layout3->setMargin(0);
QHBoxLayout *tip_layout = new QHBoxLayout();
tip_layout->addLayout(layout1);
tip_layout->addStretch();
tip_layout->addLayout(layout2);
tip_layout->addStretch();
tip_layout->addLayout(layout3);
tip_layout->setSpacing(0);
tip_layout->setMargin(0);
tip_layout->setContentsMargins(10, 0, 10, 1);
ui->widget_1->setLayout(tip_layout);
// QHBoxLayout *tip_layout = new QHBoxLayout();
// tip_layout->addWidget(tip_label);
// tip_layout->addWidget(num_label);
// tip_layout->addStretch();
// tip_layout->setSpacing(0);
// tip_layout->setMargin(0);
// tip_layout->setContentsMargins(20, 0, 0, 0);
// ui->widget_1->setLayout(tip_layout);
QHBoxLayout *status_layout = new QHBoxLayout();
status_layout->addWidget(name_label);
status_layout->addStretch();
status_layout->addWidget(status_label);
status_layout->setSpacing(0);
status_layout->setMargin(0);
status_layout->setContentsMargins(10, 0, 10, 0);
ui->widget_2->setLayout(status_layout);
title_bar = new KylinTitleBar(this);
title_bar->move(0,0);
title_bar->show();
initTitleBar(skin);
ui->scrollArea->setStyleSheet("QScrollArea{border: none}");
ui->scrollArea->setFixedSize(556,300);
ui->scrollArea->setAutoFillBackground(true);
ui->scrollArea->setBackgroundRole(QPalette::Light);
this->initConnect();
}
AutoStartWidget::~AutoStartWidget()
{
// KylinTitleBar *title_bar;
if(tip_label != NULL) {
delete tip_label;
tip_label = NULL;
}
if(num_label != NULL) {
delete num_label;
num_label = NULL;
}
if(on_label != NULL) {
delete on_label;
on_label = NULL;
}
if(on_num_label != NULL) {
delete on_num_label;
on_num_label = NULL;
}
if(off_label != NULL) {
delete off_label;
off_label = NULL;
}
if(off_num_label != NULL) {
delete off_num_label;
off_num_label = NULL;
}
if(name_label != NULL) {
delete name_label;
name_label = NULL;
}
if(status_label != NULL) {
delete status_label;
status_label = NULL;
}
for(int i=0; igetAutoStartAppStatus();
}
void AutoStartWidget::readyReciveData(const QStringList &data)
{
data_list.append(data);
}
void AutoStartWidget::readyShowUI()
{
int rowIndex = 0;
QVBoxLayout *v_layout = new QVBoxLayout();
// QGridLayout *v_layout = new QGridLayout();
QSignalMapper *signal_mapper = new QSignalMapper(this);
onNum = offNum = 0;
num_label->setText(QString::number(data_list.length()));
for(int i =0; i tmpMap;
QStringList tmp_list = data_list.at(i);
for(int j=0;jsetFixedHeight(50);
auto_group->initData(tmpMap);
if(tmpMap.value("Status") == "true")
onNum += 1;
else if(tmpMap.value("Status") == "false")
offNum += 1;
connect(auto_group, SIGNAL(autoStatusChange()), signal_mapper, SLOT(map()));
signal_mapper->setMapping(auto_group, tmpMap.value("Path"));
v_layout->addWidget(auto_group, 0, Qt::AlignBottom);
// v_layout->addWidget(auto_group, rowIndex, 0);
rowIndex += 1;
switcher_list.append(auto_group);
}
v_layout->addStretch();
connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(setCurrentItemAutoStatus(QString)));
on_num_label->setText(QString::number(onNum));
off_num_label->setText(QString::number(offNum));
// QVBoxLayout *layout = new QVBoxLayout();
// layout->addLayout(v_layout);
// layout->setSpacing(0);
// layout->setMargin(0);
// layout->setContentsMargins(10, 0, 10, 10);
ui->scrollAreaWidgetContents->setLayout(v_layout);
}
void AutoStartWidget::scanAllSwitcher() {
int count = switcher_list.count();
onNum = offNum = 0;
for(int i=0; igetSwitcherStatus())
{
onNum +=1;
}
else {
offNum += 1;
}
}
on_num_label->setText(QString::number(onNum));
off_num_label->setText(QString::number(offNum));
}
void AutoStartWidget::setCurrentItemAutoStatus(QString dekstopName)
{
int start_pos = dekstopName.lastIndexOf("/") + 1;
int end_pos = dekstopName.length();
QString name = dekstopName.mid(start_pos, end_pos-start_pos);
sessionproxy->changeAutoStartAppStatus(name);
this->scanAllSwitcher();
}
void AutoStartWidget::initConnect()
{
connect(title_bar,SIGNAL(closeDialog()), this, SLOT(onCloseButtonClicked()));
}
void AutoStartWidget::initTitleBar(QString skin)
{
title_bar->setTitleWidth(560);
title_bar->setTitleName(tr("Boot Manager"));
// title_bar->setTitleBackgound(":/background/res/skin/1.png");
title_bar->setTitleBackgound(skin);
}
void AutoStartWidget::resetTitleSkin(QString skin)
{
title_bar->resetBackground(skin);
}
void AutoStartWidget::onCloseButtonClicked()
{
this->close();
}
youker-assistant/src/topbasewidget.cpp 0000664 0001750 0001750 00000025306 13260315532 017167 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "topbasewidget.h"
#include "mainwindow.h"
#include
#include
#include
#include
#include
#include
#include
// enum SettingModuleID{
// ThemePage = 0,
// IconPage,
// MousePage,
// SoundPage,
// PanelPage,
// MenuPage,
// WindowPage,
// FontPage,
// TouchPadPage,
// EnergyPage,
// FMPage
// };
namespace {
//const QMap titleMap()
//{
// QMap m;
// m.insert(SettingAction::ThemePage, "a");
// m.insert(SettingAction::IconPage, "b");
// m.insert(SettingAction::MousePage, "c");
// m.insert(SettingAction::SoundPage, "d");
// return m;
//}
//int filterTitleAccordModuleName(SettingAction::SettingModuleID id)
//{
// return titleMap().value(id);
//}
const QMap titleMap()
{
QMap tMap;
tMap.insert("ThemePage", QObject::tr("Choose the theme what you want"));
tMap.insert("IconPage", QObject::tr("Set the desktop icon theme and the visibility of desktop icons"));
tMap.insert("MousePage", QObject::tr("Replace the theme and size of the mouse pointer, and theme change need to restart system"));
tMap.insert("SoundPage", QObject::tr("Set the sound theme you want"));
tMap.insert("PanelPage", QObject::tr("Setting the panel mode of auto hide and icon size"));
tMap.insert("MenuPage", QObject::tr("Manage display of the start menu"));
tMap.insert("WindowPage", QObject::tr("Window Manager settings"));
tMap.insert("FontPage", QObject::tr("According to personal preferences to set the system default font, click the 'Restore' button, can be restored to the state before the font settings"));
tMap.insert("TouchPadPage", QObject::tr("Setting the relevant properties of your touchpad,make the operation more convenient"));
tMap.insert("EnergyPage", QObject::tr("Save energy to let the computer longer standby time"));
tMap.insert("FMPage", QObject::tr("Manage the file manager. Tips: if the thumbnail's cache time or size is set to -1, it will not be checked"));
return tMap;
}
QString filterTitleAccordModuleName(QString moduleName)
{
return titleMap().value(moduleName);
}
}
TopBaseWidget::TopBaseWidget(QWidget *parent)
: QWidget(parent)
{
m_titileMessage = "";
this->setFixedSize(900, 150);
this->setAutoFillBackground(true);
// this->setObjectName("transparentWidget");
this->initWidgets();
}
TopBaseWidget::~TopBaseWidget()
{
if(img_label != NULL) {
delete img_label;
img_label = NULL;
}
if(suggest_label != NULL) {
delete suggest_label;
suggest_label = NULL;
}
delete back_button;
//Segmentation fault
QLayoutItem *child;
while ((child = m_titleLeftLayout->takeAt(0)) != 0) {
if (child->widget())
child->widget()->deleteLater();
delete child;
}
while ((child = m_titleRightLayout->takeAt(0)) != 0) {
if (child->widget())
child->widget()->deleteLater();
delete child;
}
while ((child = m_toolLeftLayout->takeAt(0)) != 0) {
if (child->widget())
child->widget()->deleteLater();
delete child;
}
while ((child = m_toolRightLayout->takeAt(0)) != 0) {
if (child->widget())
child->widget()->deleteLater();
delete child;
}
while ((child = m_topLayout->takeAt(0)) != 0) {
if (child->widget())
child->widget()->deleteLater();
delete child;
}
while ((child = m_bottomLayout->takeAt(0)) != 0) {
if (child->widget())
child->widget()->deleteLater();
delete child;
}
delete m_layout;
}
void TopBaseWidget::setTipMessage(const QString &message)
{
this->m_titileMessage = message;
suggest_label->setText(message);
}
void TopBaseWidget::setImage(const QString &pic)
{
QPixmap label_pixmap(pic);
img_label->setPixmap(label_pixmap);
img_label->setFixedSize(label_pixmap.size());
}
//QString TopBaseWidget::getModuleName() /*const*/
//{
// return this->m_moduleName;
//}
//void SettingAction::setModuleName(const QString &name)
//void TopBaseWidget::setModuleName(QString name)
//{
//// this->m_moduleName = name;
//// back_button->setVisible(true);
//// const QString title = filterTitleAccordModuleName(name);
//// if (title.isEmpty() || title.isNull()) {
//// suggest_label->setText(tr("There may be a mistake."));
//// }
//// else {
//// suggest_label->setText(title);
//// }
//}
//void TopBaseWidget::displayActionSubPage(SettingAction::SettingModuleID moduleId)
void TopBaseWidget::displayActionSubPage(QString moduleName)
{
// this->m_moduleName = moduleName;
back_button->setVisible(true);
const QString title = filterTitleAccordModuleName(moduleName);
if (title.isEmpty() || title.isNull()) {
suggest_label->setText(tr("There may be a mistake."));
}
else {
suggest_label->setText(title);
}
}
void TopBaseWidget::initTitlebarLeftContent()
{
QWidget *w = new QWidget;
m_titleLeftLayout = new QHBoxLayout(w);
m_titleLeftLayout->setContentsMargins(6, 0, 0, 0);
m_titleLeftLayout->setSpacing(0);
QLabel *appLabel = new QLabel;
appLabel->setStyleSheet("QLabel{background-color:transparent;color:#ffffff; font-size:12px;}");
appLabel->setText(tr("Kylin Assistant"));
m_titleLeftLayout->addWidget(appLabel);
m_topLayout->addWidget(w, 1, Qt::AlignLeft);
}
void TopBaseWidget::initTitlebarRightContent()
{
QWidget *w = new QWidget;
m_titleRightLayout = new QHBoxLayout(w);
m_titleRightLayout->setContentsMargins(0, 0, 1, 0);
m_titleRightLayout->setSpacing(0);
m_topLayout->addWidget(w, 1, Qt::AlignRight);
SystemButton *min_button = new SystemButton();
SystemButton *close_button = new SystemButton();
// SystemButton *skin_button = new SystemButton();
SystemButton *main_menu_button = new SystemButton();
min_button->loadPixmap(":/sys/res/sysBtn/min_button.png");
close_button->loadPixmap(":/sys/res/sysBtn/close_button.png");
// skin_button->loadPixmap(":/sys/res/sysBtn/skin_button.png");
main_menu_button->loadPixmap(":/sys/res/sysBtn/main_menu.png");
min_button->setFocusPolicy(Qt::NoFocus);
close_button->setFocusPolicy(Qt::NoFocus);
// skin_button->setFocusPolicy(Qt::NoFocus);
main_menu_button->setFocusPolicy(Qt::NoFocus);
m_titleRightLayout->addWidget(main_menu_button);
// m_titleRightLayout->addWidget(skin_button);
m_titleRightLayout->addWidget(min_button);
m_titleRightLayout->addWidget(close_button);
connect(main_menu_button, &SystemButton::clicked, this, [=] {
emit this->showMenu();
});
// connect(skin_button, &SystemButton::clicked, this, [=] {
// emit this->showSkinCenter();
// });
connect(min_button, &SystemButton::clicked, this, [=] {
emit this->showMin();
});
connect(close_button, &SystemButton::clicked, this, [=] {
emit this->closeApp();//window()->close();
});
}
void TopBaseWidget::initContentLeftContent()
{
QWidget *w = new QWidget;
w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_toolLeftLayout = new QHBoxLayout(w);
m_toolLeftLayout->setContentsMargins(0, 0, 0, 0);
img_label = new QLabel();
suggest_label = new QLabel();
img_label->setScaledContents(true);//自动缩放,显示图像大小自动调整为Qlabel大小
suggest_label->setObjectName("whiteLabel");
suggest_label->setWordWrap(true);//QLabel自动换行
suggest_label->setFixedWidth(650);
m_toolLeftLayout->setSpacing(10);
m_toolLeftLayout->addStretch();
m_toolLeftLayout->addWidget(img_label, 0, Qt::AlignHCenter);
m_toolLeftLayout->addWidget(suggest_label, 0, Qt::AlignHCenter);
m_toolLeftLayout->addStretch();
// m_bottomLayout->addWidget(w);
m_bottomLayout->addWidget(w, 1, Qt::AlignLeft);
}
void TopBaseWidget::initActionRightContent()
{
QWidget *w = new QWidget;
m_toolRightLayout = new QHBoxLayout(w);
m_toolRightLayout->setContentsMargins(0, 3, 0, 10);
m_toolRightLayout->setSpacing(0);
back_button = new QPushButton();
back_button->setCursor(Qt::PointingHandCursor);
back_button->setFixedSize(91,39);
back_button->setFocusPolicy(Qt::NoFocus);
QPixmap pixmap("://res/back-arrow.png");
back_button->setIcon(pixmap);
back_button->setIconSize(pixmap.size());
back_button->setObjectName("backgroundButton");
back_button->setText(tr("Back"));
back_button->setVisible(false);
connect(back_button, &QPushButton::clicked, this, [=] {
suggest_label->setText(this->m_titileMessage);
back_button->setVisible(false);
emit this->notifyContentPageToMain();
});
m_toolRightLayout->addWidget(back_button);
m_bottomLayout->addWidget(w, 1, Qt::AlignRight);
}
void TopBaseWidget::initWidgets()
{
m_layout = new QVBoxLayout(this);
m_layout->setContentsMargins(0, 0, 0, 0);
m_layout->setSpacing(0);
QWidget *topWidget = new QWidget;
m_topLayout = new QHBoxLayout(topWidget);
m_topLayout->setContentsMargins(0, 0, 0, 0);
m_topLayout->setSpacing(0);
m_layout->addWidget(topWidget, 0, Qt::AlignTop);
QWidget *bottomWidget = new QWidget;
m_bottomLayout = new QHBoxLayout(bottomWidget);
m_bottomLayout->setContentsMargins(19, 0, 0, 26);
m_bottomLayout->setSpacing(0);
m_layout->addWidget(bottomWidget, 0, Qt::AlignBottom);
this->setLayout(m_layout);
initTitlebarLeftContent();
initTitlebarRightContent();
initContentLeftContent();
initActionRightContent();
}
youker-assistant/src/cleaneractionwidget.cpp 0000664 0001750 0001750 00000030234 13260315532 020335 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "cleaneractionwidget.h"
#include
#include "../dbusproxy/youkersessiondbus.h"
#include "../dbusproxy/youkersystemdbus.h"
CleanerActionWidget::CleanerActionWidget(QWidget *parent)
: QWidget(parent)
{
this->setFixedSize(900, 150);
this->setAutoFillBackground(true);
// this->setObjectName("transparentWidget");
// cache_page = new CacheActionWidget(this);
// statked_widget = new QStackedWidget(this);
//// QPalette palette;
//// palette.setBrush(QPalette::Window, QBrush(Qt::white));
//// statked_widget->setPalette(palette);
//// statked_widget->setAutoFillBackground(true);
// statked_widget->addWidget(cache_page);
// QVBoxLayout *layout1 = new QVBoxLayout();
// layout1->addWidget(statked_widget);
// layout1->setMargin(0);
// layout1->setContentsMargins(0, 0, 0, 0);
// setLayout(layout1);
suggest_label = new QLabel();
// result_label = new QLabel();
doing_label = new QLabel();
scan_button = new QPushButton(this);
clean_button = new QPushButton(this);
back_button = new QPushButton(this);
back_button->setObjectName("backButton");
back_button->hide();
loading_label = new LoadingLabel(this, "clean");
loading_label->show();
suggest_label->setObjectName("whiteLabel");
suggest_label->setWordWrap(true);//QLabel自动换行
suggest_label->setFixedWidth(550);
// result_label->setWordWrap(true);//QLabel自动换行
// result_label->setObjectName("tipLabel");
doing_label->setFixedWidth(550);
doing_label->setWordWrap(true);//QLabel自动换行
doing_label->setObjectName("whiteLabel");
doing_label->hide();
// scan_button->setFixedSize(182, 58);
scan_button->setGeometry(QRect(680, 50, 182, 58));
scan_button->setFocusPolicy(Qt::NoFocus);
scan_button->setObjectName("greenButton");
scan_button->show();
// clean_button->setFixedSize(182, 58);
clean_button->setGeometry(QRect(680, 50, 182, 58));
clean_button->setFocusPolicy(Qt::NoFocus);
clean_button->setObjectName("greenButton");
clean_button->hide();
back_button->setFocusPolicy(Qt::NoFocus);
// back_button->setFixedSize(50, 30);
back_button->setGeometry(QRect(820, 110, 50, 30));
back_button->setObjectName("underlineButton");
back_button->hide();
//set underline
// QFont font = back_button->font();
// font.setUnderline(true);
// back_button->setFont(font);
//set scan button text color
// QPalette palette;
// palette.setColor(QPalette::ButtonText, QColor(255,17,135));
// scan_button->setPalette(palette);
QVBoxLayout *layout1 = new QVBoxLayout();
layout1->addStretch();
layout1->addWidget(suggest_label, 0 , Qt::AlignVCenter);
// layout1->addWidget(result_label);
layout1->addWidget(doing_label, 0 , Qt::AlignVCenter);
layout1->addStretch();
layout1->setSpacing(0);
layout1->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->addWidget(loading_label, 0, Qt::AlignVCenter);
layout2->addLayout(layout1);
layout2->setSpacing(20);
layout2->setMargin(0);
layout2->setContentsMargins(0, 0, 0, 0);
// QVBoxLayout *layout3 = new QVBoxLayout();
// layout3->addStretch();
// layout3->addWidget(scan_button, 0, Qt::AlignRight);
// layout3->addWidget(clean_button, 0, Qt::AlignRight);
// layout3->addWidget(back_button, 0, Qt::AlignRight);
// layout3->addStretch();
// layout3->setSpacing(10);
// layout3->setContentsMargins(0, 20, 0, 0);
QHBoxLayout *main_layout = new QHBoxLayout();
main_layout->addLayout(layout2);
main_layout->addStretch();
// main_layout->addLayout(layout3);
main_layout->setSpacing(0);
main_layout->setMargin(0);
main_layout->setContentsMargins(13, 20, 44, 0);
setLayout(main_layout);
this->initConnect();
this->setLanguage();
}
CleanerActionWidget::~CleanerActionWidget()
{
if(suggest_label != NULL) {
delete suggest_label;
suggest_label = NULL;
}
if(doing_label != NULL) {
delete doing_label;
doing_label = NULL;
}
}
void CleanerActionWidget::initConnect()
{
connect(scan_button, SIGNAL(clicked()), this, SLOT(onStartButtonClicked()));
connect(clean_button, SIGNAL(clicked()), this, SLOT(onCleanButtonClicked()));
connect(back_button, SIGNAL(clicked()), this, SLOT(onBackButtonClicked()));
}
void CleanerActionWidget::setLanguage()
{
suggest_label->setText(tr("Regular cleaning, let your computer remains the relaxed state"));//经常清理,让电脑保持最轻松的状态
// result_label->setText(tr("上次检测时间为2014-07-07 16:40:35 星期一,清理了4.84KB垃圾。"));
scan_button->setText(tr("Start Scan"));//开始扫描
clean_button->setText(tr("Start Cleanup"));//开始清理
back_button->setText(tr("Back"));
doing_label->setText(tr("Scanning......"));//正在扫描......
}
void CleanerActionWidget::showCleanOverStatus()
{
loading_label->stopLoading();
scan_button->show();
scan_button->setEnabled(true);
clean_button->hide();
clean_button->setEnabled(true);
back_button->hide();
doing_label->setText(tr("Clean OK"));
}
void CleanerActionWidget::showCleanerData(const QStringList &data)
{
if(data.length() == 2)
{
doing_label->setText(tr("Cleaning: ") + data.at(0).split(":").at(1));
}
else if(data.length() == 3)
{
doing_label->setText(data.at(0).split(":").at(1) + tr(", Percent is: ") + data.at(1).split(":").at(1) + tr("%, Status is: ") + data.at(2).split(":").at(1));
}
}
void CleanerActionWidget::showCleanerStatus(const QString &status, const QString &domain)
{
if(status == "Complete:History.firefox" && domain == "history")
{
doing_label->setText(tr("Clean Firefox history......"));
}
else if(status == "Complete:History.chromium" && domain == "history")
{
doing_label->setText(tr("Clean Chromium history......"));
}
else if(status == "Complete:History.system" && domain == "history")
{
doing_label->setText(tr("Clean system history......"));
}
else if(status == "Complete:" && domain == "apt")
{
doing_label->setText(tr("Clean apt......"));
}
else if(status == "Start:" && domain == "apt")
{
doing_label->setText(tr("Start clean apt......"));
}
else if(status == "Complete:Cookies.firefox")
{
doing_label->setText(tr("Clean Firefox Cookie:") + domain);
}
else if(status == "Complete:Cookies.chromium")
{
doing_label->setText(tr("Clean Chromium Cookie:") + domain);
}
}
void CleanerActionWidget::showCleanerError(const QString &status)
{
if(status.contains("Non-existent:"))
{
if(status.split(":").at(1).length() > 0)
doing_label->setText(status.split(":").at(1) + tr(" does not exist"));
}
else if(status.contains("Working:Chromium"))
{
doing_label->setText(tr("Chromium Browser is running......"));
}
}
void CleanerActionWidget::showCleanReciveStatus(const QString &status)
{
if(status == "Complete:Cache")
{
doing_label->setText(tr("Cache Scan OK"));
}
else if(status == "Complete:Cookies")
{
doing_label->setText(tr("Cookies Scan OK"));
}
else if(status == "Complete:")
{
doing_label->setText(tr("History Scan OK"));
}
else if(status == "Complete:Packages")
{
doing_label->setText(tr("Packages Scan OK"));
}
else if(status == "Complete:All")
{
// doing_label->setText(tr("Scanning......"));
// doing_label->hide();
// loading_label->stopLoading();
// scan_button->hide();
// scan_button->setEnabled(true);
// clean_button->show();
// clean_button->setEnabled(true);
// suggest_label->show();
// back_button->show();
}
}
void CleanerActionWidget::accordScanOverStatusToChange(bool status)
{
if (status) {
doing_label->setText(tr("Scanning......"));
doing_label->hide();
loading_label->stopLoading();
scan_button->hide();
scan_button->setEnabled(true);
clean_button->show();
clean_button->setEnabled(true);
suggest_label->show();
back_button->show();
}
else {
doing_label->setText(tr("Scanning......"));
doing_label->hide();
loading_label->stopLoading();
scan_button->hide();
scan_button->setEnabled(true);
clean_button->hide();
clean_button->setEnabled(true);
suggest_label->show();
back_button->show();
}
}
void CleanerActionWidget::showCleanReciveError(const QString &status)
{
doing_label->setText(tr("Error: ") + status);
if(status == "Uninstalled:Firefox")
{
doing_label->setText(tr("Firefox Browser does not be installed"));
}
else if(status == "Uninstalled:Chromium")
{
doing_label->setText(tr("Chromium Browser does not be installed"));
}
else if(status == "Working:Chromium")
{
doing_label->setText(tr("Chromium Browser is running"));
}
else
{
if(status.contains("Non-existent:"))
doing_label->setText(status.split(":").at(1) + tr(" does not exist"));
}
}
void CleanerActionWidget::displayAnimation()
{
scan_button->setEnabled(false);
loading_label->startLoading();
suggest_label->hide();
doing_label->show();
emit this->showDetailData();
}
//void CleanerActionWidget::displayCleanAnimation()
//{
// clean_button->show();
// clean_button->setEnabled(false);
// loading_label->startLoading();
// suggest_label->hide();
// doing_label->setText(tr("Ready to Cleanup......"));//准备清理......
// doing_label->show();
//}
void CleanerActionWidget::receivePolicyKitSignal(bool status)
{
/*display Clean Animation
status = true:ok
status = false:cacel
*/
if(status)//ok
{
clean_button->show();
clean_button->setEnabled(false);
back_button->hide();//0713
scan_button->hide();
loading_label->startLoading();
suggest_label->hide();
doing_label->setText(tr("Ready to Cleanup......"));//准备清理......
doing_label->show();
}
else {
clean_button->show();
back_button->show();
}
}
void CleanerActionWidget::onStartButtonClicked()
{
doing_label->setText(tr("Scanning......"));
emit this->sendScanSignal();
}
void CleanerActionWidget::onCleanButtonClicked()
{
clean_button->hide();
back_button->hide();
emit this->sendCleanSignal();
}
void CleanerActionWidget::displayOrgPage()
{
doing_label->hide();
back_button->hide();
// loading_label->stopLoading();
scan_button->show();
scan_button->setEnabled(true);
clean_button->hide();
suggest_label->show();
}
void CleanerActionWidget::onBackButtonClicked()
{
doing_label->hide();
back_button->hide();
loading_label->stopLoading();
scan_button->show();
scan_button->setEnabled(true);
clean_button->hide();
// back_button->hide();
suggest_label->show();
// result_label->show();
emit this->showMainData();
}
youker-assistant/src/homeactionwidget.h 0000664 0001750 0001750 00000005605 13260315532 017325 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef HOMEACTIONWIDGET_H
#define HOMEACTIONWIDGET_H
#include
#include
#include
#include
#include
#include
#include
#include
#include "../component/kylinbutton.h"
#include "../component/systembutton.h"
#include "../component/loadinglabel.h"
class MainWindow;
class SessionDispatcher;
class SystemDispatcher;
class HomeActionWidget : public QWidget
{
Q_OBJECT
public:
explicit HomeActionWidget(QWidget *parent = 0, QSettings *mSettings = 0);
~HomeActionWidget();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void setSessionDbusProxy(SessionDispatcher* dispatcher) { sessionProxy = dispatcher;}
void setSystemDbusProxy(SystemDispatcher* dispatcher) { systemProxy = dispatcher;}
void initConnect();
void setLanguage();
void writeFixCleanDate();
QString getFixCleanDate();
QString getCurrentDateTime();
void writeSafeScanDate();
QString getSafeScanDate();
QString getOneKeyFlag();
void enableSanButton();
public slots:
void onStartButtonClicked();
void onCleanButtonClicked();
void onEndButtonClicked();
void getScanResult(QString msg);
void finishScanResult(QString msg);
void getScanAllResult(QString flag, QString msg);
void getCleanResult(QString msg/*, QString flag*/);
void finishCleanError(QString msg);
void getCleaningMessage(QString type, QString status);
private:
QPoint press_point;//鼠标按下去的点
bool is_move;
LoadingLabel *loading_label;
QLabel *suggest_label;
QLabel *scan_result_label;
QLabel *result_label;
QLabel *doing_label;
QPushButton *scan_button;
QPushButton *clean_button;
QPushButton *back_button;
MainWindow *p_mainwindow;
SystemDispatcher *systemProxy;
SessionDispatcher *sessionProxy;
QString trace;
QString cookies;
QString garbage;
QSettings *pSettings;
QString dateStr;
QString workFlag;
QString scanFinishTime;
};
#endif // HOMEACTIONWIDGET_H
youker-assistant/src/mainbottomwidget.cpp 0000664 0001750 0001750 00000016475 13260315532 017712 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "mainbottomwidget.h"
#include "../component/toolbutton.h"
#include "../component/utils.h"
#include
#include
#include
MainBottomWidget::MainBottomWidget(QWidget *parent, QString arch, QString os/*, const QString &version*/) :
QWidget(parent), osarch(arch), osname(os)
{
this->setFixedSize(900, 326);
//set white background color
this->setAutoFillBackground(true);
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(Qt::white));
this->setPalette(palette);
//// QPixmap label_pixmap("");
//// movie_label->setPixmap(label_pixmap);
//// movie_label->setFixedSize(label_pixmap.size());
// scan_button->setFocusPolicy(Qt::NoFocus);
// QPixmap pixmap("://res/scan.png");
// scan_button->setIcon(pixmap);
// scan_button->setIconSize(pixmap.size());
current_version = qApp->applicationVersion();
version_logo = new QLabel();
version_title = new QLabel();
version_tip = new QLabel();
check_btn = new QPushButton();
check_btn->hide();
// version_label = new QLabel();
box_logo = new QLabel();
box_title = new QPushButton();
box_title->setFixedWidth(240);
box_title->setCursor(Qt::PointingHandCursor);
box_title->setFocusPolicy(Qt::NoFocus);
box_title->setStyleSheet("QPushButton{background-color:transparent;border:none;text-align:left;font-family: 方正黑体_GBK;font-size:24px;color:#000000;}QPushButton:hover{color:#3f96e4;}");//background:transparent;
// box_title->installEventFilter(this);
box_tip = new QLabel();
// more_text_btn = new QPushButton();
// more_btn = new QPushButton();
// auto_start = NULL;
// camera_manager = NULL;
// more_text_btn->setObjectName("checkButton");
// more_text_btn->setCursor(Qt::PointingHandCursor);
// more_text_btn->setCursor(Qt::OpenHandCursor);
// more_text_btn->setFocusPolicy(Qt::NoFocus);
// QFont font = more_text_btn->font();
// font.setUnderline(true);
// more_text_btn->setFont(font);
check_btn->setObjectName("checkButton");
check_btn->setCursor(Qt::PointingHandCursor);
check_btn->setFocusPolicy(Qt::NoFocus);
// version_label->setObjectName("smallgrayLabel");
version_title->setObjectName("bigblackLabel");
// box_title->setObjectName("bigblackLabel");
version_tip->setAlignment(Qt::AlignLeft);
version_tip->setObjectName("smallgrayLabel");
version_tip->setFixedWidth(380);
box_tip->setAlignment(Qt::AlignLeft);
box_tip->setObjectName("smallgrayLabel");
version_tip->setWordWrap(true);//QLabel自动换行
box_tip->setWordWrap(true);//QLabel自动换行
box_tip->setFixedWidth(380);
// more_btn->setObjectName("transparentButton");
// more_btn->setCursor(Qt::PointingHandCursor);
version_logo->setFixedSize(65, 65);
version_logo->setPixmap(QPixmap("://res/version.png"));
box_logo->setFixedSize(65, 65);
box_logo->setPixmap(QPixmap("://res/box.png"));
this->initUI();
this->initConnect();
this->setLanguage();
}
MainBottomWidget::~MainBottomWidget()
{
if(version_logo != NULL) {
delete version_logo;
version_logo = NULL;
}
if(version_title != NULL) {
delete version_title;
version_title = NULL;
}
if(version_tip != NULL) {
delete version_tip;
version_tip = NULL;
}
if(check_btn != NULL) {
delete check_btn;
check_btn = NULL;
}
if(box_logo != NULL) {
delete box_logo;
box_logo = NULL;
}
if(box_title != NULL) {
delete box_title;
box_title = NULL;
}
if(box_tip != NULL) {
delete box_tip;
box_tip = NULL;
}
// for(int i=0; iaddWidget(version_title);
layout1->addWidget(check_btn);
// layout1->addWidget(version_label);
layout1->addStretch();
layout1->setMargin(0);
layout1->setSpacing(5);
layout1->setContentsMargins(0,0,0,0);
QVBoxLayout *layout2 = new QVBoxLayout();
layout2->addStretch();
layout2->addLayout(layout1);
layout2->addWidget(version_tip);
layout2->addStretch();
layout2->setMargin(0);
layout2->setSpacing(5);
layout2->setContentsMargins(0,0,0,0);
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->addWidget(version_logo/* ,0, Qt::AlignVCenter*/);
layout3->addLayout(layout2);
layout3->addStretch();
layout3->setMargin(0);
layout3->setSpacing(5);
layout3->setContentsMargins(0,0,0,0);
QVBoxLayout *layout4 = new QVBoxLayout();
layout4->addStretch();
layout4->addWidget(box_title);
layout4->addWidget(box_tip);
layout4->addStretch();
layout4->setMargin(0);
layout4->setSpacing(5);
layout4->setContentsMargins(0,0,0,0);
QHBoxLayout *layout5 = new QHBoxLayout();
layout5->addWidget(box_logo);
layout5->addLayout(layout4);
layout5->addStretch();
// layout5->addLayout(button_layout);
layout5->setMargin(0);
layout5->setSpacing(5);
layout5->setContentsMargins(0,0,0,0);
QVBoxLayout *main_layout = new QVBoxLayout();
main_layout->addLayout(layout3);
main_layout->addLayout(layout5);
main_layout->setMargin(0);
main_layout->setSpacing(50);
main_layout->setContentsMargins(60,50,60,80);
this->setLayout(main_layout);
}
void MainBottomWidget::initConnect()
{
connect(check_btn, SIGNAL(clicked()), this, SLOT(onCheckBtnClicked()));
connect(box_title, SIGNAL(clicked()), this, SIGNAL(sendSignal()));
}
void MainBottomWidget::setLanguage()
{
version_title->setText(tr("Current Version Number") + " " + current_version);
version_tip->setText(tr("Update to the lastest version, make it work better"));
check_btn->setText(tr("updating on the backend"));
box_title->setText(tr("Common toolbox"));
box_tip->setText(tr("Fast and practical, making the system more personalized"));
// more_text_btn->setText(tr("More"));
// more_btn->setToolTip(tr("More"));
}
void MainBottomWidget::initBoxTool()
{
}
void MainBottomWidget::onCheckBtnClicked()
{
emit this->sendOpenUpgrade();
check_btn->hide();
}
void MainBottomWidget::displayBackedBtn(bool flag)
{
if(flag)
check_btn->setText(tr("Upgrade is complete"));
else
check_btn->setText(tr("Updating on the backend"));
check_btn->show();
}
void MainBottomWidget::hideBackedBtn()
{
check_btn->hide();
}
void MainBottomWidget::switchPageIndex(QString index)
{
}
youker-assistant/src/homepage.cpp 0000664 0001750 0001750 00000033755 13260315532 016122 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "homepage.h"
#include
#include
#include "mainwindow.h"
#include "../component/toolbutton.h"
#include "../component/utils.h"
HomePage::HomePage(QWidget *parent, QString arch, QString os/*, const QString &version*/) :
QWidget(parent), osarch(arch), osname(os)
{
this->setFixedSize(900, 326);
//set white background color
this->setAutoFillBackground(true);
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(Qt::white));
this->setPalette(palette);
//// QPixmap label_pixmap("");
//// movie_label->setPixmap(label_pixmap);
//// movie_label->setFixedSize(label_pixmap.size());
// scan_button->setFocusPolicy(Qt::NoFocus);
// QPixmap pixmap("://res/scan.png");
// scan_button->setIcon(pixmap);
// scan_button->setIconSize(pixmap.size());
current_version = qApp->applicationVersion();
version_logo = new QLabel();
version_title = new QLabel();
version_tip = new QLabel();
check_btn = new QPushButton();
check_btn->hide();
// version_label = new QLabel();
box_logo = new QLabel();
box_title = new QPushButton();
box_title->setFixedWidth(240);
box_title->setCursor(Qt::PointingHandCursor);
box_title->setFocusPolicy(Qt::NoFocus);
box_title->setStyleSheet("QPushButton{background:#ffffff;border:none;text-align:left;font-family: 方正黑体_GBK;font-size:24px;color:#000000;}QPushButton:hover{color:#3f96e4;}");//background:transparent;
// box_title->installEventFilter(this);
box_tip = new QLabel();
// more_text_btn = new QPushButton();
// more_btn = new QPushButton();
// auto_start = NULL;
// camera_manager = NULL;
// more_text_btn->setObjectName("checkButton");
// more_text_btn->setCursor(Qt::PointingHandCursor);
// more_text_btn->setCursor(Qt::OpenHandCursor);
// more_text_btn->setFocusPolicy(Qt::NoFocus);
// QFont font = more_text_btn->font();
// font.setUnderline(true);
// more_text_btn->setFont(font);
check_btn->setObjectName("checkButton");
check_btn->setCursor(Qt::PointingHandCursor);
check_btn->setFocusPolicy(Qt::NoFocus);
// version_label->setObjectName("smallgrayLabel");
version_title->setObjectName("bigblackLabel");
// box_title->setObjectName("bigblackLabel");
version_tip->setAlignment(Qt::AlignLeft);
version_tip->setObjectName("smallgrayLabel");
version_tip->setFixedWidth(380);
box_tip->setAlignment(Qt::AlignLeft);
box_tip->setObjectName("smallgrayLabel");
version_tip->setWordWrap(true);//QLabel自动换行
box_tip->setWordWrap(true);//QLabel自动换行
box_tip->setFixedWidth(380);
// more_btn->setObjectName("transparentButton");
// more_btn->setCursor(Qt::PointingHandCursor);
version_logo->setFixedSize(65, 65);
version_logo->setPixmap(QPixmap("://res/version.png"));
box_logo->setFixedSize(65, 65);
box_logo->setPixmap(QPixmap("://res/box.png"));
this->setLanguage();
}
HomePage::~HomePage()
{
if(version_logo != NULL) {
delete version_logo;
version_logo = NULL;
}
if(version_title != NULL) {
delete version_title;
version_title = NULL;
}
if(version_tip != NULL) {
delete version_tip;
version_tip = NULL;
}
if(check_btn != NULL) {
delete check_btn;
check_btn = NULL;
}
if(box_logo != NULL) {
delete box_logo;
box_logo = NULL;
}
if(box_title != NULL) {
delete box_title;
box_title = NULL;
}
if(box_tip != NULL) {
delete box_tip;
box_tip = NULL;
}
// for(int i=0; iaddWidget(version_title);
layout1->addWidget(check_btn);
// layout1->addWidget(version_label);
layout1->addStretch();
layout1->setMargin(0);
layout1->setSpacing(5);
layout1->setContentsMargins(0,0,0,0);
QVBoxLayout *layout2 = new QVBoxLayout();
layout2->addStretch();
layout2->addLayout(layout1);
layout2->addWidget(version_tip);
layout2->addStretch();
layout2->setMargin(0);
layout2->setSpacing(5);
layout2->setContentsMargins(0,0,0,0);
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->addWidget(version_logo/* ,0, Qt::AlignVCenter*/);
layout3->addLayout(layout2);
layout3->addStretch();
layout3->setMargin(0);
layout3->setSpacing(5);
layout3->setContentsMargins(0,0,0,0);
QVBoxLayout *layout4 = new QVBoxLayout();
layout4->addStretch();
layout4->addWidget(box_title);
layout4->addWidget(box_tip);
layout4->addStretch();
layout4->setMargin(0);
layout4->setSpacing(5);
layout4->setContentsMargins(0,0,0,0);
/*QStringList icon_list;
// icon_list<<"://res/ubuntukylin-software-center"<<"://res/boot"<<"://res/camera";
icon_list<<"://res/boot" << "://res/more.png";
QStringList text_list;
// text_list<< tr("Youker Softeware Center") << tr("Boot Manager") << tr("Camera");
text_list << tr("Boot Manager") << tr("More");
QHBoxLayout *button_layout = new QHBoxLayout();
QSignalMapper *signal_mapper = new QSignalMapper(this);
for(int i=0; isetFocusPolicy(Qt::NoFocus);
tool_button->setIcon(icon_list.at(i));
tool_button->setText(text_list.at(i));
connect(tool_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
signal_mapper->setMapping(tool_button, QString::number(i, 10));
button_layout->addWidget(tool_button);
item_list.append(tool_button);
}
connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(switchPageIndex(QString)));
*/
// more_btn->setFocusPolicy(Qt::NoFocus);
// QPixmap pixmap("://res/more.png");
// more_btn->setIcon(pixmap);
// more_btn->setIconSize(pixmap.size());
// QVBoxLayout *more_layout = new QVBoxLayout();
//// more_layout->addStretch();
// more_layout->addWidget(more_btn);
// more_layout->addWidget(more_text_btn);
//// more_layout->addStretch();
// more_layout->setSpacing(0);
// more_layout->setMargin(0);
// more_layout->setContentsMargins(0, 8, 0, 0);
// button_layout->addStretch();
// button_layout->addLayout(more_layout);
//// button_layout->addWidget(more_btn, 0, Qt::AlignTop);
// button_layout->setSpacing(20);
// button_layout->setMargin(0);
// button_layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layout5 = new QHBoxLayout();
layout5->addWidget(box_logo);
layout5->addLayout(layout4);
layout5->addStretch();
// layout5->addLayout(button_layout);
layout5->setMargin(0);
layout5->setSpacing(5);
layout5->setContentsMargins(0,0,0,0);
QVBoxLayout *main_layout = new QVBoxLayout();
main_layout->addLayout(layout3);
main_layout->addLayout(layout5);
main_layout->setMargin(0);
main_layout->setSpacing(50);
main_layout->setContentsMargins(60,50,60,80);
this->setLayout(main_layout);
}
void HomePage::initConnect()
{
connect(this, SIGNAL(moreSignal()), p_mainwindow, SIGNAL(chanegBoxToolStatus()));
// connect(more_btn, SIGNAL(clicked()), p_mainwindow, SLOT(showBoxWidget()));
// connect(more_btn, SIGNAL(clicked()), p_mainwindow, SIGNAL(chanegBoxToolStatus()));
// connect(more_text_btn, SIGNAL(clicked()), p_mainwindow, SLOT(showBoxWidget()));
// connect(more_text_btn, SIGNAL(clicked()), p_mainwindow, SIGNAL(chanegBoxToolStatus()));
// connect(check_btn, SIGNAL(clicked()), this, SLOT(checkLastestVersion()));
connect(check_btn, SIGNAL(clicked()), this, SLOT(onCheckBtnClicked()));
connect(this, SIGNAL(sendSignal()), p_mainwindow, SIGNAL(chanegBoxToolStatus()));
connect(box_title, SIGNAL(clicked()), this, SIGNAL(sendSignal()));
}
void HomePage::setLanguage()
{
version_title->setText(tr("Current Version Number") + " " + current_version);
version_tip->setText(tr("Update to the lastest version, make it work better"));
check_btn->setText(tr("updating on the backend"));
box_title->setText(tr("Common toolbox"));
box_tip->setText(tr("Fast and practical, making the system more personalized"));
// more_text_btn->setText(tr("More"));
// more_btn->setToolTip(tr("More"));
}
void HomePage::initBoxTool()
{
}
void HomePage::onCheckBtnClicked()
{
emit this->sendOpenUpgrade();
check_btn->hide();
}
void HomePage::displayBackedBtn(bool flag)
{
if(flag)
check_btn->setText(tr("Upgrade is complete"));
else
check_btn->setText(tr("Updating on the backend"));
check_btn->show();
}
void HomePage::hideBackedBtn()
{
check_btn->hide();
}
//void HomePage::checkLastestVersion()
//{
// QStringList version_list = sessionProxy->checkNewVersion();
// if(version_list.length() == 1) {
// version_label->setText(version_list.at(0));
// }
// if(version_list.length() == 4) {
// version_label->setText(version_list.at(2));
// if(version_list.at(3) == "1") {
// qDebug() << "Neet to UPdate......";
// p_mainwindow->openUpgradePage(version_list);
//// systemProxy->update_myself();
// }
// else {
// qDebug() << "Unneccesary to UPdate......";
// p_mainwindow->openUpgradePage(version_list);
// }
// }
// else {
// version_label->setText("");
// }
//}
void HomePage::switchPageIndex(QString index)
{
// bool ok;
// int current_index = index.toInt(&ok, 10);
if(index == "0")
emit this->sendSubIndex(0);
// else if(index == "-1")
// if(this->osarch == "aarch64" || this->osname == "Kylin" || this->osname == "YHKylin")
// sessionProxy->runApp("cheese");
// else
// emit this->sendSubIndex(1);
// else if(index == "1") {
//// p_mainwindow->showBoxWidget();
// emit this->moreSignal();
// }
// if(index == "0")
// {
// if(auto_start == NULL) {
// auto_start = new AutoStartWidget(0, sessionProxy);
// connect(sessionProxy, SIGNAL(tellAutoModel(QStringList)), auto_start, SLOT(readyReciveData(QStringList)));
// connect(sessionProxy, SIGNAL(showAutoModel()), auto_start, SLOT(readyShowUI()));
// auto_start->initData();
// int w_x = p_mainwindow->frameGeometry().topLeft().x() + (900 / 2) - (560 / 2);
// int w_y = p_mainwindow->frameGeometry().topLeft().y() + (600 /2) - (398 / 2);
// auto_start->move(w_x, w_y);
// auto_start->show();
// auto_start->raise();
// }
// else {
// int w_x = p_mainwindow->frameGeometry().topLeft().x() + (900 / 2) - (560 / 2);
// int w_y = p_mainwindow->frameGeometry().topLeft().y() + (600 /2) - (398 / 2);
// auto_start->move(w_x, w_y);
// auto_start->show();
// auto_start->raise();
// }
// }
// else if(index == "1")
// {
// if(camera_manager == NULL) {
// camera_manager = new CameraManager(0, sessionProxy);
// if(sessionProxy->judge_camera_qt())
// {
// camera_manager->setOKButtonEnable(true);
// }
// else{
// camera_manager->setOKButtonEnable(false);
// }
// int w_x = p_mainwindow->frameGeometry().topLeft().x() + (900 / 2) - (524 / 2);
// int w_y = p_mainwindow->frameGeometry().topLeft().y() + (600 /2) - (277 / 2);
// camera_manager->move(w_x, w_y);
// camera_manager->exec();
//// camera_manager->show();
//// camera_manager->raise();
// }
// else {
// int w_x = p_mainwindow->frameGeometry().topLeft().x() + (900 / 2) - (524 / 2);
// int w_y = p_mainwindow->frameGeometry().topLeft().y() + (600 /2) - (277 / 2);
// camera_manager->move(w_x, w_y);
// camera_manager->show();
// camera_manager->raise();
// }
// }
}
//bool HomePage::eventFilter(QObject *obj, QEvent *event)
//{
// if(obj == box_title){
// if(event->type() == QEvent::MouseButtonRelease){
// emit this->sendSignal();
//// p_mainwindow->showBoxWidget();
// }
//// if(event->type() == QEvent::Enter){
//// ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn_hover.png"));
//// }else if(event->type() == QEvent::Leave){
//// ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
//// }else if(event->type() == QEvent::MouseButtonPress){
//// ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn_hover.png"));
//// }else if(event->type() == QEvent::MouseButtonRelease){
//// QMouseEvent *me = (QMouseEvent *)event;
//// QLabel *lb = (QLabel *)obj;
//// if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
//// this->close();
//// this->destroy();
//// }else{
//// ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
//// }
//// } else {
//// return QObject::eventFilter(obj, event);
//// }
// }
// return QObject::eventFilter(obj, event);
//}
youker-assistant/src/mainbottomwidget.h 0000664 0001750 0001750 00000003462 13260315532 017347 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef MAINBOTTOMWIDGET_H
#define MAINBOTTOMWIDGET_H
#include
#include
#include
#include
#include
class ToolButton;
class MainBottomWidget : public QWidget
{
Q_OBJECT
public:
explicit MainBottomWidget(QWidget *parent = 0, QString arch = "", QString os = ""/*, const QString &version = ""*/);
~MainBottomWidget();
void setLanguage();
void initBoxTool();
void initConnect();
void initUI();
public slots:
void switchPageIndex(QString index);
void displayBackedBtn(bool flag);
void onCheckBtnClicked();
void hideBackedBtn();
signals:
void sendSubIndex(int index);
void sendSignal();
void sendOpenUpgrade();
private:
QLabel *version_logo;
QLabel *version_title;
QLabel *version_tip;
QPushButton *check_btn;
// QLabel *version_label;
QLabel *box_logo;
QPushButton *box_title;
QLabel *box_tip;
QString current_version;
QString osname;
QString osarch;
// QList item_list;
};
#endif // MAINBOTTOMWIDGET_H
youker-assistant/src/bottomcontentwidget.cpp 0000664 0001750 0001750 00000002042 13260315532 020421 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#include "bottomcontentwidget.h"
#include
BottomContentWidget::BottomContentWidget(QWidget *parent)
: QWidget(parent)
{
// this->resize(900, 326);
this->setFixedSize(900, 326);
// this->setGeometry(0, 274, 900, 326);
}
BottomContentWidget::~BottomContentWidget()
{
}
youker-assistant/src/titlewidget.h 0000664 0001750 0001750 00000003310 13260315532 016307 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef TITLEWIDGET_H
#define TITLEWIDGET_H
#include
#include
#include
#include
#include
#include
#include
#include "../component/kylinbutton.h"
#include "../component/systembutton.h"
class MainWindow;
class TitleWidget : public QWidget
{
Q_OBJECT
public:
explicit TitleWidget(QWidget *parent = 0, QString arch = "", QString os = "");
~TitleWidget();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void initConnect();
//protected:
// virtual void paintEvent(QPaintEvent *event);
signals:
void closeApp();
private:
QPoint press_point;//鼠标按下去的点
bool is_move;
SystemButton *min_button;
SystemButton *close_button;
SystemButton *skin_button;
SystemButton *main_menu_button;
MainWindow *p_mainwindow;
};
#endif // TITLEWIDGET_H
youker-assistant/src/bottomcontentwidget.h 0000664 0001750 0001750 00000002400 13260315532 020064 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef BOTTOMCONTENTWIDGET_H
#define BOTTOMCONTENTWIDGET_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
class BottomContentWidget : public QWidget
{
Q_OBJECT
public:
explicit BottomContentWidget(QWidget *parent = 0);
~BottomContentWidget();
void setLanguage();
private:
protected:
public slots:
signals:
private:
};
#endif // BOTTOMCONTENTWIDGET_H
youker-assistant/src/cleaneractionwidget.h 0000664 0001750 0001750 00000005134 13260315532 020003 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & 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 .
*/
#ifndef CLEANERACTIONWIDGET_H
#define CLEANERACTIONWIDGET_H
#include
#include