add selectcategorywidget

This commit is contained in:
balloonflower 2018-02-10 14:40:50 +08:00
parent 1ab816ed1a
commit a48abc42ee
18 changed files with 896 additions and 395 deletions

View File

@ -25,8 +25,8 @@
#include <QDebug> #include <QDebug>
#include <QBoxLayout> #include <QBoxLayout>
CleanerDetailWidget::CleanerDetailWidget(QWidget *parent, /*SessionDispatcher *seroxy, SystemDispatcher *syproxy, */MainWindow *window, Toolkits *kits, QString skin) CleanerDetailWidget::CleanerDetailWidget(QWidget *parent, MainWindow *window, Toolkits *kits, QString skin)
: QWidget(parent), /*sessionproxy(seroxy), systemproxy(syproxy), */parentWindow(window), toolKits(kits),cur_skin(skin), : QWidget(parent), parentWindow(window), toolKits(kits),cur_skin(skin),
ui(new Ui::CleanerDetailWidget) ui(new Ui::CleanerDetailWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -62,15 +62,15 @@ CleanerDetailWidget::CleanerDetailWidget(QWidget *parent, /*SessionDispatcher *s
// grid_layout = new QGridLayout(); // grid_layout = new QGridLayout();
// rowIndex = columnIndex = 0; // rowIndex = columnIndex = 0;
cache_apt_items = NULL; // cache_apt_items = NULL;
cache_apt_btn = NULL; cache_apt_btn = NULL;
cache_software_items = NULL; // cache_software_items = NULL;
cache_software_btn = NULL; cache_software_btn = NULL;
cache_thumbnails_items = NULL; // cache_thumbnails_items = NULL;
cache_thumbnails_btn = NULL; cache_thumbnails_btn = NULL;
cache_firefox_items = NULL; // cache_firefox_items = NULL;
cache_firefox_btn = NULL; cache_firefox_btn = NULL;
cache_chromium_items = NULL; // cache_chromium_items = NULL;
cache_chromium_btn = NULL; cache_chromium_btn = NULL;
// package_unneed_items = NULL; // package_unneed_items = NULL;
@ -80,9 +80,9 @@ CleanerDetailWidget::CleanerDetailWidget(QWidget *parent, /*SessionDispatcher *s
// package_configfile_items = NULL; // package_configfile_items = NULL;
// package_configfile_btn = NULL; // package_configfile_btn = NULL;
cookies_firefox_items = NULL; // cookies_firefox_items = NULL;
cookies_firefox_btn = NULL; cookies_firefox_btn = NULL;
cookies_chromium_items = NULL; // cookies_chromium_items = NULL;
cookies_chromium_btn = NULL; cookies_chromium_btn = NULL;
trace_firefox_btn = NULL; trace_firefox_btn = NULL;
@ -90,7 +90,7 @@ CleanerDetailWidget::CleanerDetailWidget(QWidget *parent, /*SessionDispatcher *s
trace_system_btn = NULL; trace_system_btn = NULL;
trace_bash_btn = NULL; trace_bash_btn = NULL;
trace_x11_btn = NULL; trace_x11_btn = NULL;
trace_x11_items = NULL; // trace_x11_items = NULL;
// ui->scrollAreaWidgetContents->setLayout(grid_layout); // ui->scrollAreaWidgetContents->setLayout(grid_layout);
this->number_per_row = (this->width() + this->cardspace - 60) / (this->itemwidth + this->cardspace); this->number_per_row = (this->width() + this->cardspace - 60) / (this->itemwidth + this->cardspace);
@ -99,31 +99,31 @@ CleanerDetailWidget::CleanerDetailWidget(QWidget *parent, /*SessionDispatcher *s
CleanerDetailWidget::~CleanerDetailWidget() CleanerDetailWidget::~CleanerDetailWidget()
{ {
if(cache_apt_items != NULL) // if(cache_apt_items != NULL)
{ // {
delete cache_apt_items; // delete cache_apt_items;
cache_apt_items = NULL; // cache_apt_items = NULL;
} // }
if(cache_software_items != NULL) // if(cache_software_items != NULL)
{ // {
delete cache_software_items; // delete cache_software_items;
cache_software_items = NULL; // cache_software_items = NULL;
} // }
if(cache_thumbnails_items != NULL) // if(cache_thumbnails_items != NULL)
{ // {
delete cache_thumbnails_items; // delete cache_thumbnails_items;
cache_thumbnails_items = NULL; // cache_thumbnails_items = NULL;
} // }
if(cache_firefox_items != NULL) // if(cache_firefox_items != NULL)
{ // {
delete cache_firefox_items; // delete cache_firefox_items;
cache_firefox_items = NULL; // cache_firefox_items = NULL;
} // }
if(cache_chromium_items != NULL) // if(cache_chromium_items != NULL)
{ // {
delete cache_chromium_items; // delete cache_chromium_items;
cache_chromium_items = NULL; // cache_chromium_items = NULL;
} // }
/*if(package_unneed_items != NULL) /*if(package_unneed_items != NULL)
{ {
delete package_unneed_items; delete package_unneed_items;
@ -139,21 +139,21 @@ CleanerDetailWidget::~CleanerDetailWidget()
delete package_configfile_items; delete package_configfile_items;
package_configfile_items = NULL; package_configfile_items = NULL;
}*/ }*/
if(cookies_firefox_items != NULL) // if(cookies_firefox_items != NULL)
{ // {
delete cookies_firefox_items; // delete cookies_firefox_items;
cookies_firefox_items = NULL; // cookies_firefox_items = NULL;
} // }
if(cookies_chromium_items != NULL) // if(cookies_chromium_items != NULL)
{ // {
delete cookies_chromium_items; // delete cookies_chromium_items;
cookies_chromium_items = NULL; // cookies_chromium_items = NULL;
} // }
if(trace_x11_items != NULL) // if(trace_x11_items != NULL)
{ // {
delete trace_x11_items; // delete trace_x11_items;
trace_x11_items = NULL; // trace_x11_items = NULL;
} // }
// if(grid_layout != NULL) // if(grid_layout != NULL)
// { // {
// delete grid_layout; // delete grid_layout;
@ -162,6 +162,46 @@ CleanerDetailWidget::~CleanerDetailWidget()
delete ui; 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() void CleanerDetailWidget::CleanUIAndData()
{ {
if(!ui->label->isHidden()) if(!ui->label->isHidden())
@ -186,6 +226,15 @@ void CleanerDetailWidget::CleanUIAndData()
trace_bash_path.clear(); trace_bash_path.clear();
trace_x11_list.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 //clear ui
// foreach (QObject *child, ui->scrollAreaWidgetContents->children()) { // foreach (QObject *child, ui->scrollAreaWidgetContents->children()) {
// QWidget *widget = static_cast<QWidget *>(child); // QWidget *widget = static_cast<QWidget *>(child);
@ -369,11 +418,11 @@ void CleanerDetailWidget::showReciveData(const QStringList &data)
void CleanerDetailWidget::showReciveStatus(const QString &status) void CleanerDetailWidget::showReciveStatus(const QString &status)
{ {
if(status == "Complete:Cache") if(status == "Complete:Cache") {
{ if(cache_apt_list.length() > 0) {
if(cache_apt_list.length() > 0) m_selectedAptList.clear();
{ m_selectedAptList = cache_apt_list;
cache_apt_items = new CleanListWidget(cache_apt_list, this->cur_skin, tr("Apt Cache Clean Items"));
// cache_apt_btn = new CommonCheckBox(0, "://res/cache"); // cache_apt_btn = new CommonCheckBox(0, "://res/cache");
cache_apt_btn = new CleanSubGroup(this, "://res/janitor/apt"); cache_apt_btn = new CleanSubGroup(this, "://res/janitor/apt");
cache_apt_btn->setFocusPolicy(Qt::NoFocus); cache_apt_btn->setFocusPolicy(Qt::NoFocus);
@ -381,12 +430,13 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// cache_apt_btn->setFixedSize(160, 200); // cache_apt_btn->setFixedSize(160, 200);
cache_apt_btn->setStatusTip("cache-apt"); cache_apt_btn->setStatusTip("cache-apt");
cache_apt_btn->setLabelText(tr("Apt Cache count:"), cache_apt_list.length()); cache_apt_btn->setLabelText(tr("Apt Cache count:"), cache_apt_list.length());
//子checkbox的状态被改变时重新设置总按钮的状态
connect(cache_apt_items, SIGNAL(notifyMainCheckBox(int)), cache_apt_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后,显示自定义页面 //点击自定义按钮后,显示自定义页面
connect(cache_apt_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage())); connect(cache_apt_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
/*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的状态 //点击总按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_apt_btn, SIGNAL(spreadStatus(int)), cache_apt_items, SLOT(resetSubCheckbox(int))); connect(cache_apt_btn, SIGNAL(spreadStatus(int)), cache_apt_items, SLOT(resetSubCheckbox(int)));*/
// if(grid_layout == NULL) // if(grid_layout == NULL)
// { // {
// grid_layout = new QGridLayout(); // grid_layout = new QGridLayout();
@ -415,9 +465,10 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// columnIndex += 1; // columnIndex += 1;
// } // }
} }
if(cache_software_list.length() > 0) if(cache_software_list.length() > 0) {
{ m_selectedSoftwareList.clear();
cache_software_items = new CleanListWidget(cache_software_list, this->cur_skin, tr("Software Cache Clean Items")); m_selectedSoftwareList = cache_software_list;
// cache_software_btn = new CommonCheckBox(0, "://res/cache"); // cache_software_btn = new CommonCheckBox(0, "://res/cache");
cache_software_btn = new CleanSubGroup(this, "://res/janitor/software"); cache_software_btn = new CleanSubGroup(this, "://res/janitor/software");
cache_software_btn->setFocusPolicy(Qt::NoFocus); cache_software_btn->setFocusPolicy(Qt::NoFocus);
@ -425,12 +476,13 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// cache_software_btn->setFixedSize(160, 200); // cache_software_btn->setFixedSize(160, 200);
cache_software_btn->setStatusTip("cache-software"); cache_software_btn->setStatusTip("cache-software");
cache_software_btn->setLabelText(tr("Software Cache count:"), cache_software_list.length()); cache_software_btn->setLabelText(tr("Software Cache count:"), cache_software_list.length());
//子checkbox的状态被改变时重新设置总按钮的状态
connect(cache_software_items, SIGNAL(notifyMainCheckBox(int)), cache_software_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后根据总按钮的状态去改变子checkbox的状态 //点击自定义按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_software_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage())); connect(cache_software_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
/*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的状态 //点击总按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_software_btn, SIGNAL(spreadStatus(int)), cache_software_items, SLOT(resetSubCheckbox(int))); 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 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 y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
@ -460,9 +512,10 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// columnIndex += 1; // columnIndex += 1;
// } // }
} }
if(cache_thumbnails_list.length() > 0) if(cache_thumbnails_list.length() > 0) {
{ m_selectedThumbnailsList.clear();
cache_thumbnails_items = new CleanListWidget(cache_thumbnails_list, this->cur_skin, tr("Thumbnails Cache Clean Items")); m_selectedThumbnailsList = cache_thumbnails_list;
// cache_thumbnails_btn = new CommonCheckBox(0, "://res/cache"); // cache_thumbnails_btn = new CommonCheckBox(0, "://res/cache");
cache_thumbnails_btn = new CleanSubGroup(this, "://res/janitor/thumbnails"); cache_thumbnails_btn = new CleanSubGroup(this, "://res/janitor/thumbnails");
cache_thumbnails_btn->setFocusPolicy(Qt::NoFocus); cache_thumbnails_btn->setFocusPolicy(Qt::NoFocus);
@ -470,12 +523,13 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// cache_thumbnails_btn->setFixedSize(160, 200); // cache_thumbnails_btn->setFixedSize(160, 200);
cache_thumbnails_btn->setStatusTip("cache-thumbnails"); cache_thumbnails_btn->setStatusTip("cache-thumbnails");
cache_thumbnails_btn->setLabelText(tr("Thumbnails Cache Count:"), cache_thumbnails_list.length()); cache_thumbnails_btn->setLabelText(tr("Thumbnails Cache Count:"), cache_thumbnails_list.length());
//子checkbox的状态被改变时重新设置总按钮的状态
connect(cache_thumbnails_items, SIGNAL(notifyMainCheckBox(int)), cache_thumbnails_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后根据总按钮的状态去改变子checkbox的状态 //点击自定义按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_thumbnails_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage())); connect(cache_thumbnails_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
/*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的状态 //点击总按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_thumbnails_btn, SIGNAL(spreadStatus(int)), cache_thumbnails_items, SLOT(resetSubCheckbox(int))); 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 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 y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
@ -507,21 +561,24 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
} }
if(cache_firefox_list.length() > 0) if(cache_firefox_list.length() > 0) {
{ m_selectedFirefoxCacheList.clear();
cache_firefox_items = new CleanListWidget(cache_firefox_list, this->cur_skin, tr("Software Cache Clean Items")); m_selectedFirefoxCacheList = cache_firefox_list;
// cache_firefox_btn = new CommonCheckBox(0, "://res/cache"); // cache_firefox_btn = new CommonCheckBox(0, "://res/cache");
cache_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox"); cache_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox");
cache_firefox_btn->setFocusPolicy(Qt::NoFocus); cache_firefox_btn->setFocusPolicy(Qt::NoFocus);
// cache_firefox_btn->setFixedSize(160, 130); // cache_firefox_btn->setFixedSize(160, 130);
cache_firefox_btn->setStatusTip("cache-firefox"); cache_firefox_btn->setStatusTip("cache-firefox");
cache_firefox_btn->setLabelText(tr("Firefox Cache Count:"), cache_firefox_list.length()); cache_firefox_btn->setLabelText(tr("Firefox Cache Count:"), cache_firefox_list.length());
//子checkbox的状态被改变时重新设置总按钮的状态
connect(cache_firefox_items, SIGNAL(notifyMainCheckBox(int)), cache_firefox_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后根据总按钮的状态去改变子checkbox的状态 //点击自定义按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_firefox_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage())); connect(cache_firefox_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
/*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的状态 //点击总按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_firefox_btn, SIGNAL(spreadStatus(int)), cache_firefox_items, SLOT(resetSubCheckbox(int))); 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 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 y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
@ -550,21 +607,24 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// columnIndex += 1; // columnIndex += 1;
// } // }
} }
if(cache_chromium_list.length() > 0) if(cache_chromium_list.length() > 0) {
{ m_selectedChromiumCacheList.clear();
cache_chromium_items = new CleanListWidget(cache_chromium_list, this->cur_skin, tr("Thumbnails Cache Clean Items")); m_selectedChromiumCacheList = cache_chromium_list;
// cache_chromium_btn = new CommonCheckBox(0, "://res/cache"); // cache_chromium_btn = new CommonCheckBox(0, "://res/cache");
cache_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium"); cache_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium");
cache_chromium_btn->setFocusPolicy(Qt::NoFocus); cache_chromium_btn->setFocusPolicy(Qt::NoFocus);
// cache_chromium_btn->setFixedSize(160, 130); // cache_chromium_btn->setFixedSize(160, 130);
cache_chromium_btn->setStatusTip("cache-chromium"); cache_chromium_btn->setStatusTip("cache-chromium");
cache_chromium_btn->setLabelText(tr("Chromium Cache Count:"), cache_chromium_list.length()); cache_chromium_btn->setLabelText(tr("Chromium Cache Count:"), cache_chromium_list.length());
//子checkbox的状态被改变时重新设置总按钮的状态
connect(cache_chromium_items, SIGNAL(notifyMainCheckBox(int)), cache_chromium_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后根据总按钮的状态去改变子checkbox的状态 //点击自定义按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_chromium_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage())); connect(cache_chromium_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
/*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的状态 //点击总按钮后根据总按钮的状态去改变子checkbox的状态
connect(cache_chromium_btn, SIGNAL(spreadStatus(int)), cache_chromium_items, SLOT(resetSubCheckbox(int))); 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 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 y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
@ -594,24 +654,25 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// } // }
} }
} }
else if(status == "Complete:Cookies") else if(status == "Complete:Cookies") {
{
// doing_label->setText(tr("Cookies Scan OK......")); // doing_label->setText(tr("Cookies Scan OK......"));
if(cookies_firefox_list.length() > 0) if(cookies_firefox_list.length() > 0) {
{ m_selectedFirefoxCookieList.clear();
cookies_firefox_items = new CleanListWidget(cookies_firefox_list, this->cur_skin, tr("Firefox Cookies Clean Items")); m_selectedFirefoxCookieList = cookies_firefox_list;
// cookies_firefox_btn = new CommonCheckBox(0, "://res/cookie"); // cookies_firefox_btn = new CommonCheckBox(0, "://res/cookie");
cookies_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox"); cookies_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox");
cookies_firefox_btn->setFocusPolicy(Qt::NoFocus); cookies_firefox_btn->setFocusPolicy(Qt::NoFocus);
// cookies_firefox_btn->setFixedSize(160, 130); // cookies_firefox_btn->setFixedSize(160, 130);
cookies_firefox_btn->setStatusTip("cookes-firefox"); cookies_firefox_btn->setStatusTip("cookes-firefox");
cookies_firefox_btn->setLabelText(tr("Firefox Cookies Count:"), cookies_firefox_list.length()); cookies_firefox_btn->setLabelText(tr("Firefox Cookies Count:"), cookies_firefox_list.length());
//子checkbox的状态被改变时重新设置总按钮的状态
connect(cookies_firefox_items, SIGNAL(notifyMainCheckBox(int)), cookies_firefox_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后根据总按钮的状态去改变子checkbox的状态 //点击自定义按钮后根据总按钮的状态去改变子checkbox的状态
connect(cookies_firefox_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage())); connect(cookies_firefox_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
/*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的状态 //点击总按钮后根据总按钮的状态去改变子checkbox的状态
connect(cookies_firefox_btn, SIGNAL(spreadStatus(int)), cookies_firefox_items, SLOT(resetSubCheckbox(int))); 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 x = int(this->subCount % this->number_per_row) * (this->itemwidth + this->cardspace) + 30;
@ -641,21 +702,23 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// columnIndex += 1; // columnIndex += 1;
// } // }
} }
if(cookies_chromium_list.length() > 0) if(cookies_chromium_list.length() > 0) {
{ m_selectedChromiumCookieList.clear();
cookies_chromium_items = new CleanListWidget(cookies_chromium_list, this->cur_skin, tr("Chromium Cookies Clean Items")); m_selectedChromiumCookieList = cookies_chromium_list;
// cookies_chromium_btn = new CommonCheckBox(0, "://res/cache"); // cookies_chromium_btn = new CommonCheckBox(0, "://res/cache");
cookies_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium"); cookies_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium");
cookies_chromium_btn->setFocusPolicy(Qt::NoFocus); cookies_chromium_btn->setFocusPolicy(Qt::NoFocus);
// cookies_chromium_btn->setFixedSize(160, 130); // cookies_chromium_btn->setFixedSize(160, 130);
cookies_chromium_btn->setStatusTip("cookes-chromium"); cookies_chromium_btn->setStatusTip("cookes-chromium");
cookies_chromium_btn->setLabelText(tr("Chromium Cookies Count:"), cookies_chromium_list.length()); cookies_chromium_btn->setLabelText(tr("Chromium Cookies Count:"), cookies_chromium_list.length());
//子checkbox的状态被改变时重新设置总按钮的状态
connect(cookies_chromium_items, SIGNAL(notifyMainCheckBox(int)), cookies_chromium_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后根据总按钮的状态去改变子checkbox的状态 //点击自定义按钮后根据总按钮的状态去改变子checkbox的状态
connect(cookies_chromium_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage())); connect(cookies_chromium_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
/*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的状态 //点击总按钮后根据总按钮的状态去改变子checkbox的状态
connect(cookies_chromium_btn, SIGNAL(spreadStatus(int)), cookies_chromium_items, SLOT(resetSubCheckbox(int))); 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 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 y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
@ -685,11 +748,9 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// } // }
} }
} }
else if(status == "Complete:History") else if(status == "Complete:History") {
{
// doing_label->setText(tr("History Scan OK")); // doing_label->setText(tr("History Scan OK"));
if(trace_firefox_count.length() > 0) if(trace_firefox_count.length() > 0) {
{
// trace_firefox_btn = new CommonCheckBox(0, "://res/cache"); // trace_firefox_btn = new CommonCheckBox(0, "://res/cache");
trace_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox"); trace_firefox_btn = new CleanSubGroup(this, "://res/janitor/firefox");
trace_firefox_btn->setFocusPolicy(Qt::NoFocus); trace_firefox_btn->setFocusPolicy(Qt::NoFocus);
@ -725,8 +786,7 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// columnIndex += 1; // columnIndex += 1;
// } // }
} }
if(trace_chromium_count.length() > 0) if(trace_chromium_count.length() > 0) {
{
trace_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium"); trace_chromium_btn = new CleanSubGroup(this, "://res/janitor/chromium");
trace_chromium_btn->setFocusPolicy(Qt::NoFocus); trace_chromium_btn->setFocusPolicy(Qt::NoFocus);
trace_chromium_btn->hideCustomButton(); trace_chromium_btn->hideCustomButton();
@ -761,8 +821,7 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// } // }
} }
if(trace_system_count.length() > 0) if(trace_system_count.length() > 0) {
{
trace_system_btn = new CleanSubGroup(this, "://res/janitor/trace"); trace_system_btn = new CleanSubGroup(this, "://res/janitor/trace");
trace_system_btn->setFocusPolicy(Qt::NoFocus); trace_system_btn->setFocusPolicy(Qt::NoFocus);
trace_system_btn->hideCustomButton(); trace_system_btn->hideCustomButton();
@ -798,8 +857,7 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// } // }
} }
//kobe //kobe
if(!trace_bash_path.isEmpty()) if(!trace_bash_path.isEmpty()) {
{
trace_bash_btn = new CleanSubGroup(this, "://res/janitor/trace"); trace_bash_btn = new CleanSubGroup(this, "://res/janitor/trace");
trace_bash_btn->setFocusPolicy(Qt::NoFocus); trace_bash_btn->setFocusPolicy(Qt::NoFocus);
trace_bash_btn->hideCustomButton(); trace_bash_btn->hideCustomButton();
@ -835,19 +893,21 @@ void CleanerDetailWidget::showReciveStatus(const QString &status)
// } // }
} }
if(trace_x11_list.length() > 0) if(trace_x11_list.length() > 0) {
{ m_selectedTraceX11List.clear();
trace_x11_items = new CleanListWidget(trace_x11_list, this->cur_skin, tr("Debug log Items")); m_selectedTraceX11List = trace_x11_list;
trace_x11_btn = new CleanSubGroup(this, "://res/janitor/debug"); trace_x11_btn = new CleanSubGroup(this, "://res/janitor/debug");
trace_x11_btn->setFocusPolicy(Qt::NoFocus); trace_x11_btn->setFocusPolicy(Qt::NoFocus);
trace_x11_btn->setStatusTip("x11-history"); trace_x11_btn->setStatusTip("x11-history");
trace_x11_btn->setLabelText(tr("Debug log:"), trace_x11_list.length()); trace_x11_btn->setLabelText(tr("Debug log:"), trace_x11_list.length());
//子checkbox的状态被改变时重新设置总按钮的状态
connect(trace_x11_items, SIGNAL(notifyMainCheckBox(int)), trace_x11_btn, SLOT(resetMainStatus(int)));
//点击自定义按钮后根据总按钮的状态去改变子checkbox的状态 //点击自定义按钮后根据总按钮的状态去改变子checkbox的状态
connect(trace_x11_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage())); connect(trace_x11_btn, SIGNAL(customButtonClicked()), this, SLOT(showCustomPage()));
/*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的状态 //点击总按钮后根据总按钮的状态去改变子checkbox的状态
connect(trace_x11_btn, SIGNAL(spreadStatus(int)), trace_x11_items, SLOT(resetSubCheckbox(int))); 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 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 y = int(this->subCount / this->number_per_row) * (this->itemheight + this->cardspace) + 30;
@ -1024,62 +1084,100 @@ void CleanerDetailWidget::showCustomPage()
// CommonCheckBox *checkbox = qobject_cast<CommonCheckBox *>(object); // CommonCheckBox *checkbox = qobject_cast<CommonCheckBox *>(object);
CleanSubGroup *checkbox = qobject_cast<CleanSubGroup *>(object); CleanSubGroup *checkbox = qobject_cast<CleanSubGroup *>(object);
QString object_name = checkbox->statusTip(); QString object_name = checkbox->statusTip();
if(object_name == "cache-apt") if(object_name == "cache-apt") {
{ /*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2); int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_apt_items->move(w_x, w_y); cache_apt_items->move(w_x, w_y);
cache_apt_items->exec(); 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, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
} }
else if(object_name == "cache-software") else if(object_name == "cache-software") {
{ /*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2); int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_software_items->move(w_x, w_y); cache_software_items->move(w_x, w_y);
cache_software_items->exec(); cache_software_items->exec();*/
}
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; SelectWidget *w = new SelectWidget(CleanerModuleID::CacheSoftware, tr("Software Cache Clean Items"));
w->loadData(tr("Thumbnails Cache Clean Items"), cache_thumbnails_list); w->loadData(tr("Software Cache Clean Items"), cache_software_list);
//子checkbox的状态被改变时重新设置总按钮的状态 //子checkbox的状态被改变时重新设置总按钮的状态
connect(w, SIGNAL(notifyMainCheckBox(int)), cache_software_btn, SLOT(resetMainStatus(int))); connect(w, SIGNAL(notifyMainCheckBox(int)), cache_software_btn, SLOT(resetMainStatus(int)));
connect(w, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec(); w->exec();
delete w;*/ delete w;
//kobe test 2018
} }
else if(object_name == "cache-firefox") else if(object_name == "cache-thumbnails") {
{ /*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
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, 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); int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_firefox_items->move(w_x, w_y); cache_firefox_items->move(w_x, w_y);
cache_firefox_items->exec(); 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, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
} }
else if(object_name == "cache-chromium") else if(object_name == "cache-chromium") {
{ /*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2); int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cache_chromium_items->move(w_x, w_y); cache_chromium_items->move(w_x, w_y);
cache_chromium_items->exec(); 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, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
} }
else if(object_name == "cookes-firefox") else if(object_name == "cookes-firefox") {
{ /*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2); int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cookies_firefox_items->move(w_x, w_y); cookies_firefox_items->move(w_x, w_y);
cookies_firefox_items->exec(); 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, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
} }
else if(object_name == "cookes-chromium") else if(object_name == "cookes-chromium") {
{ /*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2); int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
cookies_chromium_items->move(w_x, w_y); cookies_chromium_items->move(w_x, w_y);
cookies_chromium_items->exec(); 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, SIGNAL(refreshSelectedItems(CleanerModuleID,QStringList)), this, SLOT(onRefreshSelectedItems(CleanerModuleID,QStringList)));
w->exec();
delete w;
} }
/*else if(object_name == "package-unneed") /*else if(object_name == "package-unneed")
{ {
@ -1102,12 +1200,19 @@ void CleanerDetailWidget::showCustomPage()
package_configfile_items->move(w_x, w_y); package_configfile_items->move(w_x, w_y);
package_configfile_items->exec(); package_configfile_items->exec();
}*/ }*/
else if(object_name == "x11-history") else if(object_name == "x11-history") {
{ /*int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2); int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
trace_x11_items->move(w_x, w_y); trace_x11_items->move(w_x, w_y);
trace_x11_items->exec(); 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, 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" ) { // else if(object_name == "history-firefox" || object_name == "history-chromium" || object_name == "history-system"|| object_name == "history-bash" ) {
// } // }
@ -1125,28 +1230,28 @@ void CleanerDetailWidget::resetCurrentSkin(QString skin)
this->cur_skin = skin; this->cur_skin = skin;
//can remove this code //can remove this code
if(cache_apt_items != NULL) // if(cache_apt_items != NULL)
cache_apt_items->resetTitleSkin(skin); // cache_apt_items->resetTitleSkin(skin);
if(cache_software_items != NULL) // if(cache_software_items != NULL)
cache_software_items->resetTitleSkin(skin); // cache_software_items->resetTitleSkin(skin);
if(cache_thumbnails_items != NULL) // if(cache_thumbnails_items != NULL)
cache_thumbnails_items->resetTitleSkin(skin); // cache_thumbnails_items->resetTitleSkin(skin);
if(cache_firefox_items != NULL) // if(cache_firefox_items != NULL)
cache_firefox_items->resetTitleSkin(skin); // cache_firefox_items->resetTitleSkin(skin);
if(cache_chromium_items != NULL) // if(cache_chromium_items != NULL)
cache_chromium_items->resetTitleSkin(skin); // cache_chromium_items->resetTitleSkin(skin);
if(cookies_firefox_items != NULL) // if(cookies_firefox_items != NULL)
cookies_firefox_items->resetTitleSkin(skin); // cookies_firefox_items->resetTitleSkin(skin);
if(cookies_chromium_items != NULL) // if(cookies_chromium_items != NULL)
cookies_chromium_items->resetTitleSkin(skin); // cookies_chromium_items->resetTitleSkin(skin);
/*if(package_unneed_items != NULL) /*if(package_unneed_items != NULL)
package_unneed_items->resetTitleSkin(skin); package_unneed_items->resetTitleSkin(skin);
if(package_oldkernel_items != NULL) if(package_oldkernel_items != NULL)
package_oldkernel_items->resetTitleSkin(skin); package_oldkernel_items->resetTitleSkin(skin);
if(package_configfile_items != NULL) if(package_configfile_items != NULL)
package_configfile_items->resetTitleSkin(skin);*/ package_configfile_items->resetTitleSkin(skin);*/
if(trace_x11_items != NULL) // if(trace_x11_items != NULL)
trace_x11_items->resetTitleSkin(skin); // trace_x11_items->resetTitleSkin(skin);
} }
void CleanerDetailWidget::receiveCleanSignal() void CleanerDetailWidget::receiveCleanSignal()
@ -1180,50 +1285,89 @@ void CleanerDetailWidget::getAllSelectedItems()
argsData.clear(); argsData.clear();
QStringList fileTmp; QStringList fileTmp;
// QStringList packageTmp; // QStringList packageTmp;
QStringList firefoxcookieTmp; // QStringList firefoxcookieTmp;
QStringList chromiumcookieTmp; // QStringList chromiumcookieTmp;
QStringList traceTmp; // QStringList traceTmp;
if(cache_apt_btn != NULL && cache_apt_btn->getCheckBoxStatus() != 0) foreach (QString info, m_selectedAptList) {
{ fileTmp.append(info);
QStringList tmp = cache_apt_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++)
{
fileTmp.append(tmp.at(i));
} }
foreach (QString info, m_selectedSoftwareList) {
fileTmp.append(info);
} }
if(cache_software_btn != NULL && cache_software_btn->getCheckBoxStatus() != 0) foreach (QString info, m_selectedThumbnailsList) {
{ fileTmp.append(info);
QStringList tmp = cache_software_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++)
{
fileTmp.append(tmp.at(i));
} }
foreach (QString info, m_selectedFirefoxCacheList) {
fileTmp.append(info);
} }
if(cache_thumbnails_btn != NULL && cache_thumbnails_btn->getCheckBoxStatus() != 0) foreach (QString info, m_selectedChromiumCacheList) {
{ fileTmp.append(info);
QStringList tmp = cache_thumbnails_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++)
{
fileTmp.append(tmp.at(i));
} }
if(trace_firefox_btn != NULL && trace_firefox_btn->getCheckBoxStatus() != 0) {
argsData.insert("firefox-history", QStringList() << trace_firefox_count);
} }
if(cache_firefox_btn != NULL && cache_firefox_btn->getCheckBoxStatus() != 0) if(trace_chromium_btn != NULL && trace_chromium_btn->getCheckBoxStatus() != 0) {
{ argsData.insert("chromium-history", QStringList() << trace_chromium_count);
QStringList tmp = cache_firefox_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++)
{
fileTmp.append(tmp.at(i));
} }
if(trace_system_btn != NULL && trace_system_btn->getCheckBoxStatus() != 0) {
argsData.insert("system-history", QStringList() << trace_system_count);
} }
if(cache_chromium_btn != NULL && cache_chromium_btn->getCheckBoxStatus() != 0) if(trace_bash_btn != NULL && trace_bash_btn->getCheckBoxStatus() != 0) {
{ argsData.insert("bash-history", QStringList() << trace_bash_path);
QStringList tmp = cache_chromium_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++)
{
fileTmp.append(tmp.at(i));
}
} }
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; i<tmp.length();i++)
// {
// fileTmp.append(tmp.at(i));
// }
// }
// if(cache_software_btn != NULL && cache_software_btn->getCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_software_items->getSelectedItems();
// for(int i = 0; i<tmp.length();i++)
// {
// fileTmp.append(tmp.at(i));
// }
// }
// if(cache_thumbnails_btn != NULL && cache_thumbnails_btn->getCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_thumbnails_items->getSelectedItems();
// for(int i = 0; i<tmp.length();i++)
// {
// fileTmp.append(tmp.at(i));
// }
// }
// if(cache_firefox_btn != NULL && cache_firefox_btn->getCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_firefox_items->getSelectedItems();
// for(int i = 0; i<tmp.length();i++)
// {
// fileTmp.append(tmp.at(i));
// }
// }
// if(cache_chromium_btn != NULL && cache_chromium_btn->getCheckBoxStatus() != 0)
// {
// QStringList tmp = cache_chromium_items->getSelectedItems();
// for(int i = 0; i<tmp.length();i++)
// {
// fileTmp.append(tmp.at(i));
// }
// }
/*if(package_unneed_btn != NULL && package_unneed_btn->getCheckBoxStatus() != 0) /*if(package_unneed_btn != NULL && package_unneed_btn->getCheckBoxStatus() != 0)
{ {
QStringList tmp = package_unneed_items->getSelectedItems(); QStringList tmp = package_unneed_items->getSelectedItems();
@ -1248,56 +1392,56 @@ void CleanerDetailWidget::getAllSelectedItems()
packageTmp.append(tmp.at(i)); packageTmp.append(tmp.at(i));
} }
}*/ }*/
if(cookies_firefox_btn != NULL && cookies_firefox_btn->getCheckBoxStatus() != 0) // if(cookies_firefox_btn != NULL && cookies_firefox_btn->getCheckBoxStatus() != 0)
{ // {
QStringList tmp = cookies_firefox_items->getSelectedItems(); // QStringList tmp = cookies_firefox_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++) // for(int i = 0; i<tmp.length();i++)
{ // {
firefoxcookieTmp.append(tmp.at(i)); // firefoxcookieTmp.append(tmp.at(i));
} // }
} // }
if(cookies_chromium_btn != NULL && cookies_chromium_btn->getCheckBoxStatus() != 0) // if(cookies_chromium_btn != NULL && cookies_chromium_btn->getCheckBoxStatus() != 0)
{ // {
QStringList tmp = cookies_chromium_items->getSelectedItems(); // QStringList tmp = cookies_chromium_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++) // for(int i = 0; i<tmp.length();i++)
{ // {
chromiumcookieTmp.append(tmp.at(i)); // chromiumcookieTmp.append(tmp.at(i));
} // }
} // }
if(trace_firefox_btn != NULL && trace_firefox_btn->getCheckBoxStatus() != 0) // if(trace_firefox_btn != NULL && trace_firefox_btn->getCheckBoxStatus() != 0)
{ // {
argsData.insert("firefox-history", QStringList() << trace_firefox_count); // argsData.insert("firefox-history", QStringList() << trace_firefox_count);
} // }
if(trace_chromium_btn != NULL && trace_chromium_btn->getCheckBoxStatus() != 0) // if(trace_chromium_btn != NULL && trace_chromium_btn->getCheckBoxStatus() != 0)
{ // {
argsData.insert("chromium-history", QStringList() << trace_chromium_count); // argsData.insert("chromium-history", QStringList() << trace_chromium_count);
} // }
if(trace_system_btn != NULL && trace_system_btn->getCheckBoxStatus() != 0) // if(trace_system_btn != NULL && trace_system_btn->getCheckBoxStatus() != 0)
{ // {
argsData.insert("system-history", QStringList() << trace_system_count); // argsData.insert("system-history", QStringList() << trace_system_count);
} // }
//kobe // //kobe
if(trace_bash_btn != NULL && trace_bash_btn->getCheckBoxStatus() != 0) // if(trace_bash_btn != NULL && trace_bash_btn->getCheckBoxStatus() != 0)
{ // {
argsData.insert("bash-history", QStringList() << trace_bash_path); // argsData.insert("bash-history", QStringList() << trace_bash_path);
} // }
if(trace_x11_btn != NULL && trace_x11_btn->getCheckBoxStatus() != 0) //// if(trace_x11_btn != NULL && trace_x11_btn->getCheckBoxStatus() != 0)
{ //// {
QStringList tmp = trace_x11_items->getSelectedItems(); //// QStringList tmp = trace_x11_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++) //// for(int i = 0; i<tmp.length();i++)
{ //// {
traceTmp.append(tmp.at(i)); //// traceTmp.append(tmp.at(i));
} //// }
} //// }
if(fileTmp.length() > 0) // if(fileTmp.length() > 0)
argsData.insert("file", fileTmp); // argsData.insert("file", fileTmp);
// if(packageTmp.length() > 0) //// if(packageTmp.length() > 0)
// argsData.insert("package", packageTmp); //// argsData.insert("package", packageTmp);
if(firefoxcookieTmp.length() > 0) // if(firefoxcookieTmp.length() > 0)
argsData.insert("firefox-cookie", firefoxcookieTmp); // argsData.insert("firefox-cookie", firefoxcookieTmp);
if(chromiumcookieTmp.length() > 0) // if(chromiumcookieTmp.length() > 0)
argsData.insert("chromium-cookie", chromiumcookieTmp); // argsData.insert("chromium-cookie", chromiumcookieTmp);
if(traceTmp.length() > 0) // if(traceTmp.length() > 0)
argsData.insert("x11-history", traceTmp); // argsData.insert("x11-history", traceTmp);
} }

View File

@ -23,6 +23,7 @@
#include <QWidget> #include <QWidget>
#include "cleaneritems.h" #include "cleaneritems.h"
#include "cleanlistwidget.h" #include "cleanlistwidget.h"
#include "../component/utils.h"
class QLabel; class QLabel;
class QBoxLayout; class QBoxLayout;
@ -59,6 +60,7 @@ public slots:
void showReciveStatus(const QString &status); void showReciveStatus(const QString &status);
void CleanUIAndData(); void CleanUIAndData();
// void receivePolicyKitSignal(bool status); // void receivePolicyKitSignal(bool status);
void onRefreshSelectedItems(CleanerModuleID id, const QStringList &infos);
signals: signals:
// void notifyMainCheckBox(int status); // void notifyMainCheckBox(int status);
@ -76,15 +78,15 @@ private:
// SystemDispatcher *systemproxy; // SystemDispatcher *systemproxy;
Toolkits *toolKits; Toolkits *toolKits;
QMap<QString, QVariant> argsData; QMap<QString, QVariant> argsData;
CleanListWidget *cache_apt_items ; // CleanListWidget *cache_apt_items ;
CleanSubGroup *cache_apt_btn; CleanSubGroup *cache_apt_btn;
CleanListWidget *cache_software_items ; // CleanListWidget *cache_software_items ;
CleanSubGroup *cache_software_btn; CleanSubGroup *cache_software_btn;
CleanListWidget *cache_thumbnails_items ; // CleanListWidget *cache_thumbnails_items ;
CleanSubGroup *cache_thumbnails_btn; CleanSubGroup *cache_thumbnails_btn;
CleanListWidget *cache_firefox_items ; // CleanListWidget *cache_firefox_items ;
CleanSubGroup *cache_firefox_btn; CleanSubGroup *cache_firefox_btn;
CleanListWidget *cache_chromium_items ; // CleanListWidget *cache_chromium_items ;
CleanSubGroup *cache_chromium_btn; CleanSubGroup *cache_chromium_btn;
/*CleanListWidget *package_unneed_items ; /*CleanListWidget *package_unneed_items ;
@ -94,16 +96,16 @@ private:
CleanListWidget *package_configfile_items ; CleanListWidget *package_configfile_items ;
CleanSubGroup *package_configfile_btn;*/ CleanSubGroup *package_configfile_btn;*/
CleanListWidget *cookies_firefox_items ; // CleanListWidget *cookies_firefox_items ;
CleanSubGroup *cookies_firefox_btn; CleanSubGroup *cookies_firefox_btn;
CleanListWidget *cookies_chromium_items ; // CleanListWidget *cookies_chromium_items ;
CleanSubGroup *cookies_chromium_btn; CleanSubGroup *cookies_chromium_btn;
CleanSubGroup *trace_firefox_btn; CleanSubGroup *trace_firefox_btn;
CleanSubGroup *trace_chromium_btn; CleanSubGroup *trace_chromium_btn;
CleanSubGroup *trace_system_btn; CleanSubGroup *trace_system_btn;
CleanSubGroup *trace_bash_btn; CleanSubGroup *trace_bash_btn;
CleanListWidget *trace_x11_items ; // CleanListWidget *trace_x11_items ;
CleanSubGroup *trace_x11_btn; CleanSubGroup *trace_x11_btn;
QStringList cache_apt_list; QStringList cache_apt_list;
@ -123,6 +125,20 @@ private:
QString trace_bash_path; QString trace_bash_path;
QStringList trace_x11_list; 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;
QGridLayout *grid_layout; QGridLayout *grid_layout;
// int rowIndex; // int rowIndex;
// int columnIndex; // int columnIndex;

View File

@ -20,10 +20,11 @@
#include "cleanermainwidget.h" #include "cleanermainwidget.h"
#include <QDebug> #include <QDebug>
#include "../src/mainwindow.h" #include "../src/mainwindow.h"
#include "../component/selectcategorywidget.h"
#include "../component/cleangroup.h" #include "../component/cleangroup.h"
CleanerMainWidget::CleanerMainWidget(QWidget *parent, /*SessionDispatcher *seroxy, */MainWindow *window, Toolkits *kits, QString skin) CleanerMainWidget::CleanerMainWidget(QWidget *parent, MainWindow *window, Toolkits *kits, QString skin)
: QWidget(parent), /*sessionproxy(seroxy), */parentWindow(window), toolKits(kits) : QWidget(parent), parentWindow(window), toolKits(kits)
{ {
this->setFixedSize(900, 403); this->setFixedSize(900, 403);
this->setObjectName("transparentWidget"); this->setObjectName("transparentWidget");
@ -35,10 +36,10 @@ CleanerMainWidget::CleanerMainWidget(QWidget *parent, /*SessionDispatcher *serox
tip_label = new QLabel(this); tip_label = new QLabel(this);
tip_label->setGeometry(QRect(30, 10, 800, 30)); tip_label->setGeometry(QRect(30, 10, 800, 30));
tip_label->setObjectName("tipLabel"); tip_label->setObjectName("tipLabel");
QStringList cache_list, status_list; // 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"); // 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"; // status_list << "apt" << "software-center" << "thumbnails" << "firefox" << "chromium";
cache_items = new CleanerItems(cache_list, status_list, skin, 280, tr("Cache Items")); // cache_items = new CleanerItems(cache_list, status_list, skin, 280, tr("Cache Items"));
// cache_btn = new KylinCheckBox(0, "://res/cache.png"); // cache_btn = new KylinCheckBox(0, "://res/cache.png");
cache_btn = new CleanGroup(this, "://res/cache"); cache_btn = new CleanGroup(this, "://res/cache");
cache_btn->setFocusPolicy(Qt::NoFocus); cache_btn->setFocusPolicy(Qt::NoFocus);
@ -48,7 +49,7 @@ CleanerMainWidget::CleanerMainWidget(QWidget *parent, /*SessionDispatcher *serox
cache_btn->setStatusTip("cache"); cache_btn->setStatusTip("cache");
cache_btn->setLabelText(tr("System Cache"), tr("Cleanup cache of system, software-center, thumbnails and browser"));//系统缓存垃圾 清除包、软件中心、缩略图和浏览器缓存 cache_btn->setLabelText(tr("System Cache"), tr("Cleanup cache of system, software-center, thumbnails and browser"));//系统缓存垃圾 清除包、软件中心、缩略图和浏览器缓存
//子checkbox的状态被改变时重新设置总按钮的状态 //子checkbox的状态被改变时重新设置总按钮的状态
connect(cache_items, SIGNAL(notifyMainCheckBox(int)), cache_btn, SLOT(resetMainStatus(int))); // connect(cache_items, SIGNAL(notifyMainCheckBox(int)), cache_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面 //点击按钮后,显示子页面
connect(cache_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(cache_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
@ -70,11 +71,11 @@ CleanerMainWidget::CleanerMainWidget(QWidget *parent, /*SessionDispatcher *serox
//点击按钮后,显示子页面 //点击按钮后,显示子页面
connect(package_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));*/ connect(package_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));*/
QStringList cookies_list; // QStringList cookies_list;
cookies_list << tr("Cleanup the Cookies saving in Firefox") << tr("Cleanup the Cookies saving in Chromium"); // cookies_list << tr("Cleanup the Cookies saving in Firefox") << tr("Cleanup the Cookies saving in Chromium");
status_list.clear(); // status_list.clear();
status_list << "firefox" << "chromium"; // status_list << "firefox" << "chromium";
cookies_items = new CleanerItems(cookies_list, status_list, skin, 170, tr("Cookies Items")); // cookies_items = new CleanerItems(cookies_list, status_list, skin, 170, tr("Cookies Items"));
// cookies_btn = new KylinCheckBox(0, "://res/cookie.png"); // cookies_btn = new KylinCheckBox(0, "://res/cookie.png");
cookies_btn = new CleanGroup(this, "://res/cookie"); cookies_btn = new CleanGroup(this, "://res/cookie");
cookies_btn->setFocusPolicy(Qt::NoFocus); cookies_btn->setFocusPolicy(Qt::NoFocus);
@ -84,15 +85,15 @@ CleanerMainWidget::CleanerMainWidget(QWidget *parent, /*SessionDispatcher *serox
cookies_btn->setLabelText(tr("Cookies"), tr("Clean up user login information, support Firefox and Chromium browser"));//清除上网、游戏、购物等记录 cookies_btn->setLabelText(tr("Cookies"), tr("Clean up user login information, support Firefox and Chromium browser"));//清除上网、游戏、购物等记录
cookies_btn->setStatusTip("cookies"); cookies_btn->setStatusTip("cookies");
//子checkbox的状态被改变时重新设置总按钮的状态 //子checkbox的状态被改变时重新设置总按钮的状态
connect(cookies_items, SIGNAL(notifyMainCheckBox(int)), cookies_btn, SLOT(resetMainStatus(int))); // connect(cookies_items, SIGNAL(notifyMainCheckBox(int)), cookies_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面 //点击按钮后,显示子页面
connect(cookies_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(cookies_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
QStringList trace_list; // 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"); // 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.clear();
status_list << "firefox" << "chromium" << "system" << "bash" << "X11"; // status_list << "firefox" << "chromium" << "system" << "bash" << "X11";
trace_items = new CleanerItems(trace_list, status_list, skin, 280, tr("Trace Items")); // trace_items = new CleanerItems(trace_list, status_list, skin, 280, tr("Trace Items"));
// trace_btn = new KylinCheckBox(0, "://res/trace.png"); // trace_btn = new KylinCheckBox(0, "://res/trace.png");
trace_btn = new CleanGroup(this, "://res/trace"); trace_btn = new CleanGroup(this, "://res/trace");
trace_btn->setFocusPolicy(Qt::NoFocus); trace_btn->setFocusPolicy(Qt::NoFocus);
@ -102,30 +103,42 @@ CleanerMainWidget::CleanerMainWidget(QWidget *parent, /*SessionDispatcher *serox
trace_btn->setLabelText(tr("History trace"), tr("Cleaning the internet and opened documents recently records"));//使用痕迹 清除浏览器和系统使用痕迹 trace_btn->setLabelText(tr("History trace"), tr("Cleaning the internet and opened documents recently records"));//使用痕迹 清除浏览器和系统使用痕迹
trace_btn->setStatusTip("trace"); trace_btn->setStatusTip("trace");
//子checkbox的状态被改变时重新设置总按钮的状态 //子checkbox的状态被改变时重新设置总按钮的状态
connect(trace_items, SIGNAL(notifyMainCheckBox(int)), trace_btn, SLOT(resetMainStatus(int))); // connect(trace_items, SIGNAL(notifyMainCheckBox(int)), trace_btn, SLOT(resetMainStatus(int)));
//点击按钮后,显示子页面 //点击按钮后,显示子页面
connect(trace_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(trace_btn, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
this->setLanguage(); 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() CleanerMainWidget::~CleanerMainWidget()
{ {
if(cache_items != NULL) { argsMap.clear();
delete cache_items; // if(cache_items != NULL) {
cache_items = NULL; // delete cache_items;
} // cache_items = NULL;
// }
// if(package_items != NULL) { // if(package_items != NULL) {
// delete package_items; // delete package_items;
// package_items = NULL; // package_items = NULL;
// } // }
if(cookies_items != NULL) { // if(cookies_items != NULL) {
delete cookies_items; // delete cookies_items;
cookies_items = NULL; // cookies_items = NULL;
} // }
if(trace_items != NULL) { // if(trace_items != NULL) {
delete trace_items; // delete trace_items;
trace_items = NULL; // trace_items = NULL;
} // }
} }
void CleanerMainWidget::setLanguage() void CleanerMainWidget::setLanguage()
@ -135,25 +148,23 @@ void CleanerMainWidget::setLanguage()
void CleanerMainWidget::resetCurrentSkin(QString skin) void CleanerMainWidget::resetCurrentSkin(QString skin)
{ {
if(cache_items != NULL) // if(cache_items != NULL)
cache_items->resetTitleSkin(skin); // cache_items->resetTitleSkin(skin);
if(trace_items != NULL) // if(trace_items != NULL)
trace_items->resetTitleSkin(skin); // trace_items->resetTitleSkin(skin);
// if(package_items != NULL) // if(package_items != NULL)
// package_items->resetTitleSkin(skin); // package_items->resetTitleSkin(skin);
if(cookies_items != NULL) // if(cookies_items != NULL)
cookies_items->resetTitleSkin(skin); // cookies_items->resetTitleSkin(skin);
} }
void CleanerMainWidget::receiveScanSignal() void CleanerMainWidget::receiveScanSignal()
{ {
this->getAllScanSelectedItems(); this->getAllScanSelectedItems();
if(argsMap.empty()) if (argsMap.empty()) {
{
toolKits->alertMSG(parentWindow->geometry().topLeft().x(), parentWindow->geometry().topLeft().y(), tr("Scan args is empty!")); toolKits->alertMSG(parentWindow->geometry().topLeft().x(), parentWindow->geometry().topLeft().y(), tr("Scan args is empty!"));
} }
else else {
{
// qDebug() << "args is.........." << argsMap; // qDebug() << "args is.........." << argsMap;
emit this->showActionAnimaiton(); emit this->showActionAnimaiton();
emit this->startScanSystem(argsMap); emit this->startScanSystem(argsMap);
@ -164,19 +175,32 @@ void CleanerMainWidget::receiveScanSignal()
void CleanerMainWidget::getAllScanSelectedItems() void CleanerMainWidget::getAllScanSelectedItems()
{ {
argsMap.clear(); argsMap.clear();
QStringList cacheTmp;
// QStringList packageTmp;
QStringList cookieTmp;
QStringList historyTmp;
if(cache_btn != NULL && cache_btn->getCheckBoxStatus() != 0) qDebug() << "m_selectedCache=" << m_selectedCache;
{ qDebug() << "m_selectedCookie=" << m_selectedCookie;
QStringList tmp = cache_items->getSelectedItems(); qDebug() << "m_selectedTrace=" << m_selectedTrace;
for(int i = 0; i<tmp.length();i++)
{ if (!m_selectedCache.isEmpty())
cacheTmp.append(tmp.at(i)); 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; i<tmp.length();i++)
// {
// cacheTmp.append(tmp.at(i));
// }
// }
// if(package_btn != NULL && package_btn->getCheckBoxStatus() != 0) // if(package_btn != NULL && package_btn->getCheckBoxStatus() != 0)
// { // {
@ -187,31 +211,64 @@ void CleanerMainWidget::getAllScanSelectedItems()
// } // }
// } // }
if(cookies_btn != NULL && cookies_btn->getCheckBoxStatus() != 0) // if(cookies_btn != NULL && cookies_btn->getCheckBoxStatus() != 0)
{ // {
QStringList tmp = cookies_items->getSelectedItems(); // QStringList tmp = cookies_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++) // for(int i = 0; i<tmp.length();i++)
{ // {
cookieTmp.append(tmp.at(i)); // cookieTmp.append(tmp.at(i));
} // }
} // }
if(trace_btn != NULL && trace_btn->getCheckBoxStatus() != 0) // if(trace_btn != NULL && trace_btn->getCheckBoxStatus() != 0)
{ // {
QStringList tmp = trace_items->getSelectedItems(); // QStringList tmp = trace_items->getSelectedItems();
for(int i = 0; i<tmp.length();i++) // for(int i = 0; i<tmp.length();i++)
{ // {
historyTmp.append(tmp.at(i)); // historyTmp.append(tmp.at(i));
// }
// }
// if(cacheTmp.length() > 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;
} }
} }
if(cacheTmp.length() > 0)
argsMap.insert("Cache", cacheTmp); void CleanerMainWidget::resetDefaultStatus()
// if(packageTmp.length() > 0) {
// argsMap.insert("Packages", packageTmp); cache_btn->resetMainStatus(2);
if(cookieTmp.length() > 0) cookies_btn->resetMainStatus(2);
argsMap.insert("Cookies", cookieTmp); trace_btn->resetMainStatus(2);
if(historyTmp.length() > 0)
argsMap.insert("History", historyTmp); m_selectedCache = cache_status_list;
m_selectedCookie = cookies_status_list;
m_selectedTrace = trace_status_list;
} }
void CleanerMainWidget::onButtonClicked() void CleanerMainWidget::onButtonClicked()
@ -220,12 +277,20 @@ void CleanerMainWidget::onButtonClicked()
// KylinCheckBox *checkbox = qobject_cast<KylinCheckBox *>(object); // KylinCheckBox *checkbox = qobject_cast<KylinCheckBox *>(object);
CleanGroup *checkbox = qobject_cast<CleanGroup *>(object); CleanGroup *checkbox = qobject_cast<CleanGroup *>(object);
QString object_name = checkbox->statusTip(); QString object_name = checkbox->statusTip();
if(object_name == "cache") if (object_name == "cache") {
{ // int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2); // int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2); // cache_items->move(w_x, w_y);
cache_items->move(w_x, w_y); // cache_items->exec();
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") // if(object_name == "package")
// { // {
@ -234,18 +299,36 @@ void CleanerMainWidget::onButtonClicked()
// package_items->move(w_x, w_y); // package_items->move(w_x, w_y);
// package_items->exec(); // package_items->exec();
// } // }
if(object_name == "cookies") if (object_name == "cookies") {
{ // int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2); // int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (170 / 2);
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (170 / 2); // cookies_items->move(w_x, w_y);
cookies_items->move(w_x, w_y); // cookies_items->exec();
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") if (object_name == "trace") {
{ // m_selectedTrace.clear();
int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2); // m_selectedTrace = status_list;
int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2); // int w_x = parentWindow->frameGeometry().topLeft().x() + (900 / 2) - (410 / 2);
trace_items->move(w_x, w_y); // int w_y = parentWindow->frameGeometry().topLeft().y() + (600 /2) - (280 / 2);
trace_items->exec(); // 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;
} }
} }

View File

@ -23,17 +23,17 @@
#include <QWidget> #include <QWidget>
#include <QStackedWidget> #include <QStackedWidget>
#include "cleaneritems.h" #include "cleaneritems.h"
#include "../component/utils.h"
class MainWindow; class MainWindow;
class CleanGroup; class CleanGroup;
class SessionDispatcher;
class Toolkits; class Toolkits;
class CleanerMainWidget : public QWidget class CleanerMainWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CleanerMainWidget(QWidget *parent = 0, /*SessionDispatcher *seroxy = 0, */MainWindow *window = 0, Toolkits *kits = 0, QString skin = ":/background/res/skin/1.png"); explicit CleanerMainWidget(QWidget *parent = 0, MainWindow *window = 0, Toolkits *kits = 0, QString skin = ":/background/res/skin/1.png");
~CleanerMainWidget(); ~CleanerMainWidget();
void setLanguage(); void setLanguage();
void getAllScanSelectedItems(); void getAllScanSelectedItems();
@ -42,6 +42,8 @@ public:
public slots: public slots:
void onButtonClicked(); void onButtonClicked();
void receiveScanSignal(); void receiveScanSignal();
void onRefreshSelectedItems(CleanerCategoryID id, const QStringList &infos);
void resetDefaultStatus();
signals: signals:
void showActionAnimaiton(); void showActionAnimaiton();
@ -52,17 +54,27 @@ private:
QLabel *tip_label; QLabel *tip_label;
CleanGroup *cache_btn; CleanGroup *cache_btn;
CleanerItems *cache_items; // CleanerItems *cache_items;
// CleanGroup *package_btn; // CleanGroup *package_btn;
// CleanerItems *package_items; // CleanerItems *package_items;
CleanGroup *cookies_btn; CleanGroup *cookies_btn;
CleanerItems *cookies_items; // CleanerItems *cookies_items;
CleanGroup *trace_btn; CleanGroup *trace_btn;
CleanerItems *trace_items; // CleanerItems *trace_items;
QMap<QString, QVariant> argsMap; QMap<QString, QVariant> argsMap;
// SessionDispatcher *sessionproxy;
Toolkits *toolKits; 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 #endif // CLEANERMAINWIDGET_H

View File

@ -26,8 +26,9 @@
#include <QLabel> #include <QLabel>
#include <QPainter> #include <QPainter>
MyTitleBar::MyTitleBar(bool needMin, QWidget *parent) MyTitleBar::MyTitleBar(const QString &title, bool needMin, QWidget *parent)
:QFrame(parent) :QFrame(parent)
, m_title(title)
, m_needMin(needMin) , m_needMin(needMin)
{ {
this->setWindowFlags(Qt::FramelessWindowHint);//this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint); this->setWindowFlags(Qt::FramelessWindowHint);//this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);
@ -101,6 +102,7 @@ void MyTitleBar::initLeftContent()
QLabel *titleLabel = new QLabel; QLabel *titleLabel = new QLabel;
titleLabel->setStyleSheet("QLabel{background-color:transparent;color:#ffffff; font-size:12px;}"); titleLabel->setStyleSheet("QLabel{background-color:transparent;color:#ffffff; font-size:12px;}");
titleLabel->setText(m_title);
m_lLayout->addWidget(titleLabel); m_lLayout->addWidget(titleLabel);
m_layout->addWidget(w, 1, Qt::AlignLeft); m_layout->addWidget(w, 1, Qt::AlignLeft);

View File

@ -28,7 +28,7 @@ class MyTitleBar : public QFrame
{ {
Q_OBJECT Q_OBJECT
public: public:
MyTitleBar(bool needMin = false, QWidget *parent = 0); MyTitleBar(const QString &title = "", bool needMin = false, QWidget *parent = 0);
~MyTitleBar(); ~MyTitleBar();
void setLeftContent(QWidget *content); void setLeftContent(QWidget *content);
@ -44,6 +44,7 @@ signals:
void closeSignal(); void closeSignal();
private: private:
QString m_title;
bool m_needMin; bool m_needMin;
QHBoxLayout *m_layout = nullptr; QHBoxLayout *m_layout = nullptr;
QHBoxLayout *m_lLayout = nullptr; QHBoxLayout *m_lLayout = nullptr;

View File

@ -0,0 +1,115 @@
/*
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
*
* Authors:
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "selectcategorywidget.h"
#include "utils.h"
#include <QApplication>
SelectCategoryWidget::SelectCategoryWidget(CleanerCategoryID id, const QString &title, bool needMin, QWidget *parent)
: QDialog(parent)
, m_mousePressed(false)
, m_id(id)
{
this->setWindowFlags(Qt::FramelessWindowHint);
this->setFixedSize(464, 500);
QWidget *containerW = new QWidget(this);
m_mainLayout = new QVBoxLayout(containerW);
m_mainLayout->setSpacing(0);
m_mainLayout->setMargin(0);
m_titleBar = new MyTitleBar(title, needMin, this);
m_titleBar->setFixedSize(this->width(), TITILE_BAR_HEIGHT);
m_listWidget = new SelectListWidget(true, this);
m_listWidget->setFixedSize(this->width(), this->height() - TITILE_BAR_HEIGHT);
m_mainLayout->addWidget(m_titleBar);
m_mainLayout->addWidget(m_listWidget);
connect(m_titleBar, SIGNAL(minSignal()), this, SLOT(hide()));
connect(m_titleBar, SIGNAL(closeSignal()), this, SLOT(onClose()));
connect(m_listWidget, SIGNAL(notifyMainCheckBox(int)), this, SIGNAL(notifyMainCheckBox(int)));
QDesktopWidget* desktop = QApplication::desktop();
this->move((desktop->width() - this->width())/2, (desktop->height() - this->height())/3);
}
SelectCategoryWidget::~SelectCategoryWidget()
{
}
void SelectCategoryWidget::onClose()
{
emit refreshSelectedItems(m_id, m_listWidget->getSelectedItems());
this->close();
}
void SelectCategoryWidget::loadData(const QStringList &arglist, const QStringList &statuslist)
{
m_listWidget->loadListItemsWithTips(arglist, statuslist, this->width());
}
void SelectCategoryWidget::moveCenter()
{
/*QPoint pos = QCursor::pos();
QRect primaryGeometry;
for (QScreen *screen : qApp->screens()) {
if (screen->geometry().contains(pos)) {
primaryGeometry = screen->geometry();
}
}
if (primaryGeometry.isEmpty()) {
primaryGeometry = qApp->primaryScreen()->geometry();
}
this->move(primaryGeometry.x() + (primaryGeometry.width() - this->width())/2,
primaryGeometry.y() + (primaryGeometry.height() - this->height())/2);
this->show();
this->raise();*/
}
void SelectCategoryWidget::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
this->m_dragPosition = event->globalPos() - frameGeometry().topLeft();
this->m_mousePressed = true;
}
QDialog::mousePressEvent(event);
}
void SelectCategoryWidget::mouseReleaseEvent(QMouseEvent *event)
{
this->m_mousePressed = false;
setWindowOpacity(1);
QDialog::mouseReleaseEvent(event);
}
void SelectCategoryWidget::mouseMoveEvent(QMouseEvent *event)
{
if (this->m_mousePressed) {
move(event->globalPos() - this->m_dragPosition);
setWindowOpacity(0.9);
}
QDialog::mouseMoveEvent(event);
}

View File

@ -0,0 +1,63 @@
/*
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
*
* Authors:
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SELECTCATEGORYWIDGET_H
#define SELECTCATEGORYWIDGET_H
#include <QDialog>
#include <QVBoxLayout>
#include <QMouseEvent>
#include "mytitlebar.h"
#include "selectlistwidget.h"
#include "../component/utils.h"
class SelectCategoryWidget : public QDialog
{
Q_OBJECT
public:
SelectCategoryWidget(CleanerCategoryID id = InvalidCategory, const QString &title = "", bool needMin = false, QWidget *parent = 0);
~SelectCategoryWidget();
void loadData(const QStringList &arglist, const QStringList &statuslist);
void moveCenter();
public slots:
void onClose();
signals:
void notifyMainCheckBox(int status);
void refreshSelectedItems(CleanerCategoryID id, const QStringList &selecteds);
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
CleanerCategoryID m_id;
QVBoxLayout *m_mainLayout = nullptr;
MyTitleBar *m_titleBar = nullptr;
SelectListWidget *m_listWidget = nullptr;
QPoint m_dragPosition; //移动的距离
bool m_mousePressed; //按下鼠标左键
};
#endif // SELECTCATEGORYWIDGET_H

View File

@ -19,9 +19,11 @@
#include "selectlistitem.h" #include "selectlistitem.h"
SelectListItem::SelectListItem(QWidget *parent, QString description,int itemWidth) : SelectListItem::SelectListItem(QWidget *parent, QString description, QString tipMsg, bool hasTip, int itemWidth) :
QWidget(parent) QWidget(parent)
, m_description(description) , m_description(description)
, m_tip(tipMsg)
, m_hasTip(hasTip)
{ {
m_mainLayout = new QHBoxLayout(this); m_mainLayout = new QHBoxLayout(this);
m_mainLayout->setSpacing(5); m_mainLayout->setSpacing(5);
@ -32,7 +34,7 @@ SelectListItem::SelectListItem(QWidget *parent, QString description,int itemWidt
m_checkBox->setChecked(true); m_checkBox->setChecked(true);
connect(m_checkBox, &QCheckBox::clicked, [=] (bool checked) { connect(m_checkBox, &QCheckBox::clicked, [=] (bool checked) {
emit this->selectedSignal(checked, m_description); emit this->selectedSignal(checked, this->itemDescription());
}); });
m_descLabel = new QLabel(this); m_descLabel = new QLabel(this);
@ -57,5 +59,8 @@ bool SelectListItem::itemIsChecked()
QString SelectListItem::itemDescription() QString SelectListItem::itemDescription()
{ {
if (m_hasTip)
return this->m_tip;
else
return this->m_description; return this->m_description;
} }

View File

@ -30,7 +30,7 @@ class SelectListItem : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SelectListItem(QWidget *parent = 0, QString description = "", int itemWidth = 0); explicit SelectListItem(QWidget *parent = 0, QString description = "", QString tipMsg = "", bool hasTip = false, int itemWidth = 0);
~SelectListItem(); ~SelectListItem();
bool itemIsChecked(); bool itemIsChecked();
@ -40,7 +40,9 @@ signals:
void selectedSignal(bool checked, QString description); void selectedSignal(bool checked, QString description);
private: private:
bool m_hasTip;
QString m_description; QString m_description;
QString m_tip;
QHBoxLayout *m_mainLayout = nullptr; QHBoxLayout *m_mainLayout = nullptr;
QCheckBox *m_checkBox = nullptr; QCheckBox *m_checkBox = nullptr;
QLabel *m_descLabel = nullptr; QLabel *m_descLabel = nullptr;

View File

@ -20,15 +20,11 @@
#include "selectlistwidget.h" #include "selectlistwidget.h"
#include <QDebug> #include <QDebug>
SelectListWidget::SelectListWidget(QWidget *parent) : SelectListWidget::SelectListWidget(bool hasTip, QWidget *parent) :
QWidget(parent) QWidget(parent)
, m_hasTip(hasTip)
{ {
m_gridLayout = new QGridLayout(this); m_gridLayout = new QGridLayout(this);
m_titleLabel = new QLabel;
m_titleLabel->setFixedSize(80,30);
m_titleLabel->setText(tr("Items:"));
m_countLabel = new QLabel;
m_countLabel->setFixedSize(100,30);
m_widget = new QWidget; m_widget = new QWidget;
m_widget->setObjectName("transparentWidget"); m_widget->setObjectName("transparentWidget");
m_listAreaWidgetLayout = new QVBoxLayout(m_widget); m_listAreaWidgetLayout = new QVBoxLayout(m_widget);
@ -36,10 +32,20 @@ SelectListWidget::SelectListWidget(QWidget *parent) :
m_scrollArea->setWidgetResizable(true); m_scrollArea->setWidgetResizable(true);
m_scrollArea->setWidget(m_widget); m_scrollArea->setWidget(m_widget);
if (hasTip) {
m_gridLayout->addWidget(m_scrollArea);
}
else {
m_titleLabel = new QLabel;
m_titleLabel->setFixedSize(80,30);
m_titleLabel->setText(tr("Items:"));
m_countLabel = new QLabel;
m_countLabel->setFixedSize(100,30);
m_gridLayout->addWidget(m_titleLabel,0,0,1,1); m_gridLayout->addWidget(m_titleLabel,0,0,1,1);
m_gridLayout->addItem(new QSpacerItem(10,10),0,0,1,3); m_gridLayout->addItem(new QSpacerItem(10,10),0,0,1,3);
m_gridLayout->addWidget(m_countLabel,0,1,1,1); m_gridLayout->addWidget(m_countLabel,0,1,1,1);
m_gridLayout->addWidget(m_scrollArea,1,0,5,5); m_gridLayout->addWidget(m_scrollArea,1,0,5,5);
}
resetToDefault(); resetToDefault();
} }
@ -57,7 +63,7 @@ void SelectListWidget::loadListItems(const QString &title, const QStringList &ca
m_countLabel->setText(QString::number(count)); m_countLabel->setText(QString::number(count));
foreach (QString cache, cachelist) { foreach (QString cache, cachelist) {
SelectListItem *item = new SelectListItem(0, cache, itemWidth); SelectListItem *item = new SelectListItem(0, cache, "", false, itemWidth);
connect(item, SIGNAL(selectedSignal(bool,QString)), this, SLOT(onSelectedSignal(bool,QString))); connect(item, SIGNAL(selectedSignal(bool,QString)), this, SLOT(onSelectedSignal(bool,QString)));
item->setMaximumSize(itemWidth, 30); item->setMaximumSize(itemWidth, 30);
m_listAreaWidgetLayout->addWidget(item); m_listAreaWidgetLayout->addWidget(item);
@ -66,6 +72,24 @@ void SelectListWidget::loadListItems(const QString &title, const QStringList &ca
m_listAreaWidgetLayout->addStretch(); m_listAreaWidgetLayout->addStretch();
} }
void SelectListWidget::loadListItemsWithTips(const QStringList &arglist, const QStringList &statuslist, int itemWidth)
{
if (arglist.length() != statuslist.length())
return;
m_itemsMap.clear();
for (int i = 0; i < arglist.length(); ++i) {
SelectListItem *item = new SelectListItem(0, arglist.at(i), statuslist.at(i), true, itemWidth);
connect(item, SIGNAL(selectedSignal(bool,QString)), this, SLOT(onSelectedSignal(bool,QString)));
item->setMaximumSize(itemWidth, 30);
m_listAreaWidgetLayout->addWidget(item);
m_itemsMap.insert(arglist.at(i), item);
}
m_listAreaWidgetLayout->addStretch();
}
void SelectListWidget::removeOneItem(const QString &description) void SelectListWidget::removeOneItem(const QString &description)
{ {
SelectListItem *item = m_itemsMap.value(description); SelectListItem *item = m_itemsMap.value(description);
@ -99,7 +123,9 @@ void SelectListWidget::scanAllSubCheckbox()
if (item->itemIsChecked()) if (item->itemIsChecked())
selectedCount += 1; selectedCount += 1;
} }
if (!m_hasTip)
m_countLabel->setText(QString::number(selectedCount)); m_countLabel->setText(QString::number(selectedCount));
if (selectedCount == 0) { if (selectedCount == 0) {
emit this->notifyMainCheckBox(0); emit this->notifyMainCheckBox(0);
} }
@ -154,7 +180,7 @@ void SelectListWidget::resetSubCheckbox(int status)
void SelectListWidget::onSelectedSignal(bool checked, QString description) void SelectListWidget::onSelectedSignal(bool checked, QString description)
{ {
this->scanAllSubCheckbox();
} }
void SelectListWidget::resetToDefault() void SelectListWidget::resetToDefault()

View File

@ -35,11 +35,12 @@ class SelectListWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SelectListWidget(QWidget *parent = 0); explicit SelectListWidget(bool hasTip = false, QWidget *parent = 0);
~SelectListWidget(); ~SelectListWidget();
public slots: public slots:
void loadListItems(const QString &title, const QStringList &cachelist, int itemWidth); void loadListItems(const QString &title, const QStringList &cachelist, int itemWidth);
void loadListItemsWithTips(const QStringList &arglist, const QStringList &statuslist, int itemWidth);
void removeOneItem(const QString &description); void removeOneItem(const QString &description);
void resetToDefault(); void resetToDefault();
QStringList getSelectedItems(); QStringList getSelectedItems();
@ -51,6 +52,7 @@ signals:
void notifyMainCheckBox(int status); void notifyMainCheckBox(int status);
private: private:
bool m_hasTip;
QGridLayout *m_gridLayout = nullptr; QGridLayout *m_gridLayout = nullptr;
QScrollArea *m_scrollArea = nullptr; QScrollArea *m_scrollArea = nullptr;
QWidget *m_widget = nullptr; QWidget *m_widget = nullptr;

View File

@ -22,9 +22,10 @@
#include <QApplication> #include <QApplication>
SelectWidget::SelectWidget(bool needMin, QWidget *parent) SelectWidget::SelectWidget(CleanerModuleID id, const QString &title, bool needMin, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_mousePressed(false) , m_mousePressed(false)
, m_id(id)
{ {
this->setWindowFlags(Qt::FramelessWindowHint); this->setWindowFlags(Qt::FramelessWindowHint);
this->setFixedSize(464, 500); this->setFixedSize(464, 500);
@ -33,15 +34,15 @@ SelectWidget::SelectWidget(bool needMin, QWidget *parent)
m_mainLayout = new QVBoxLayout(containerW); m_mainLayout = new QVBoxLayout(containerW);
m_mainLayout->setSpacing(0); m_mainLayout->setSpacing(0);
m_mainLayout->setMargin(0); m_mainLayout->setMargin(0);
m_titleBar = new MyTitleBar(needMin, this); m_titleBar = new MyTitleBar(title, needMin, this);
m_titleBar->setFixedSize(this->width(), TITILE_BAR_HEIGHT); m_titleBar->setFixedSize(this->width(), TITILE_BAR_HEIGHT);
m_listWidget = new SelectListWidget(this); m_listWidget = new SelectListWidget(false, this);
m_listWidget->setFixedSize(this->width(), this->height() - TITILE_BAR_HEIGHT); m_listWidget->setFixedSize(this->width(), this->height() - TITILE_BAR_HEIGHT);
m_mainLayout->addWidget(m_titleBar); m_mainLayout->addWidget(m_titleBar);
m_mainLayout->addWidget(m_listWidget); m_mainLayout->addWidget(m_listWidget);
connect(m_titleBar, SIGNAL(minSignal()),this, SLOT(hide())); connect(m_titleBar, SIGNAL(minSignal()), this, SLOT(hide()));
connect(m_titleBar, SIGNAL(closeSignal()),this, SLOT(close())); connect(m_titleBar, SIGNAL(closeSignal()), this, SLOT(onClose()));
connect(m_listWidget, SIGNAL(notifyMainCheckBox(int)), this, SIGNAL(notifyMainCheckBox(int))); connect(m_listWidget, SIGNAL(notifyMainCheckBox(int)), this, SIGNAL(notifyMainCheckBox(int)));
QDesktopWidget* desktop = QApplication::desktop(); QDesktopWidget* desktop = QApplication::desktop();
@ -53,6 +54,12 @@ SelectWidget::~SelectWidget()
} }
void SelectWidget::onClose()
{
emit refreshSelectedItems(m_id, m_listWidget->getSelectedItems());
this->close();
}
void SelectWidget::loadData(const QString &title, const QStringList &cachelist) void SelectWidget::loadData(const QString &title, const QStringList &cachelist)
{ {
m_listWidget->loadListItems(title, cachelist, this->width()); m_listWidget->loadListItems(title, cachelist, this->width());

View File

@ -26,19 +26,24 @@
#include "mytitlebar.h" #include "mytitlebar.h"
#include "selectlistwidget.h" #include "selectlistwidget.h"
#include "../component/utils.h"
class SelectWidget : public QDialog class SelectWidget : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
SelectWidget(bool needMin = false, QWidget *parent = 0); SelectWidget(CleanerModuleID id = InvalidID, const QString &title = "", bool needMin = false, QWidget *parent = 0);
~SelectWidget(); ~SelectWidget();
void loadData(const QString &title, const QStringList &cachelist); void loadData(const QString &title, const QStringList &cachelist);
void moveCenter(); void moveCenter();
public slots:
void onClose();
signals: signals:
void notifyMainCheckBox(int status); void notifyMainCheckBox(int status);
void refreshSelectedItems(CleanerModuleID id, const QStringList &selecteds);
protected: protected:
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
@ -46,6 +51,7 @@ protected:
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
private: private:
CleanerModuleID m_id;
QVBoxLayout *m_mainLayout = nullptr; QVBoxLayout *m_mainLayout = nullptr;
MyTitleBar *m_titleBar = nullptr; MyTitleBar *m_titleBar = nullptr;
SelectListWidget *m_listWidget = nullptr; SelectListWidget *m_listWidget = nullptr;
@ -53,4 +59,4 @@ private:
bool m_mousePressed; //按下鼠标左键 bool m_mousePressed; //按下鼠标左键
}; };
#endif // MAINWINDOW_H #endif // SELECTWIDGET_H

View File

@ -39,7 +39,24 @@
const QString KYLIN_COMPANY_SETTING = "kylin/kylin-assistant"; const QString KYLIN_COMPANY_SETTING = "kylin/kylin-assistant";
const QString KYLIN_SETTING_FILE_NAME_SETTING = "kylin-assistant"; const QString KYLIN_SETTING_FILE_NAME_SETTING = "kylin-assistant";
enum CleanerModuleID {
CacheApt = 0,
CacheSoftware,
CacheThumbnail,
CacheFirefox,
CacheChromium,
CookieFirefox,
CookieChromium,
TraceX11,
InvalidID,
};
enum CleanerCategoryID {
CacheCategory = 0,
CookieCategory,
TraceCategory,
InvalidCategory,
};
typedef enum{ typedef enum{
YOUKER_EN, YOUKER_EN,

View File

@ -56,8 +56,6 @@ void CleanerWidget::initUI(QString skin)
// connect(detail_widget, SIGNAL(showActionAnimaiton()), this, SIGNAL(tranCleanActionAnimaitonSignal())); // connect(detail_widget, SIGNAL(showActionAnimaiton()), this, SIGNAL(tranCleanActionAnimaitonSignal()));
connect(detail_widget, SIGNAL(sendScanOverStatus(bool)), this, SIGNAL(tranScanOverSignal(bool))); connect(detail_widget, SIGNAL(sendScanOverStatus(bool)), this, SIGNAL(tranScanOverSignal(bool)));
connect(this, SIGNAL(clearDetailPage()), detail_widget, SLOT(CleanUIAndData()));
statked_widget->addWidget(main_widget); statked_widget->addWidget(main_widget);
statked_widget->addWidget(detail_widget); statked_widget->addWidget(detail_widget);
QVBoxLayout *layout1 = new QVBoxLayout(); QVBoxLayout *layout1 = new QVBoxLayout();
@ -90,5 +88,6 @@ void CleanerWidget::displayDetailPage()
void CleanerWidget::displayMainPage() void CleanerWidget::displayMainPage()
{ {
statked_widget->setCurrentIndex(0); statked_widget->setCurrentIndex(0);
emit this->clearDetailPage(); main_widget->resetDefaultStatus();
detail_widget->CleanUIAndData();
} }

View File

@ -51,7 +51,6 @@ public slots:
signals: signals:
void transCleanSignal(); void transCleanSignal();
void transScanSignal(); void transScanSignal();
void clearDetailPage();
void tranActionAnimaitonSignal(); void tranActionAnimaitonSignal();
// void tranCleanActionAnimaitonSignal(); // void tranCleanActionAnimaitonSignal();
void tranScanOverSignal(bool status); void tranScanOverSignal(bool status);

View File

@ -71,6 +71,7 @@ SOURCES += main.cpp \
../component/selectlistwidget.cpp \ ../component/selectlistwidget.cpp \
../component/selectlistitem.cpp \ ../component/selectlistitem.cpp \
../component/selectwidget.cpp \ ../component/selectwidget.cpp \
../component/selectcategorywidget.cpp \
../component/mytitlebar.cpp \ ../component/mytitlebar.cpp \
../plugins/widgets/mytristatebutton.cpp \ ../plugins/widgets/mytristatebutton.cpp \
../info/infounitwidget.cpp \ ../info/infounitwidget.cpp \
@ -152,6 +153,7 @@ HEADERS += mainwindow.h \
../component/selectlistwidget.h \ ../component/selectlistwidget.h \
../component/selectlistitem.h \ ../component/selectlistitem.h \
../component/selectwidget.h \ ../component/selectwidget.h \
../component/selectcategorywidget.h \
../component/mytitlebar.h \ ../component/mytitlebar.h \
../plugins/widgets/mytristatebutton.h \ ../plugins/widgets/mytristatebutton.h \
../info/infounitwidget.h \ ../info/infounitwidget.h \