youker-assistant/ 0000775 0001750 0001750 00000000000 15227663670 013043 5 ustar feng feng youker-assistant/info/ 0000775 0001750 0001750 00000000000 15227663670 013776 5 ustar feng feng youker-assistant/info/infoitemline.cpp 0000664 0001750 0001750 00000042502 15227663670 017167 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 .
*/
#include "infoitemline.h"
#include
#include
#include
inline const QString covertKeyName(const QString &key)
{
if(key == "MulProduct")//声卡型号
return QString(QObject::tr("Audio Model"));
else if(key == "MulVendor")//制造商
return QString(QObject::tr("Vendor"));
else if(key == "MulBusinfo")//总线地址
return QString(QObject::tr("Bus Address"));
else if(key == "MulDrive")//声卡驱动
return QString(QObject::tr("Audio Driver"));
else if(key == "POWER_SUPPLY_NAME")//设备名
return QString(QObject::tr("Device Name"));
else if(key == "POWER_SUPPLY_MANUFACTURER")//发行商
return QString(QObject::tr("Manufacturer"));
// else if(key == "POWER_SUPPLY_CAPACITY")//
// return QString(QObject::tr("POWER_SUPPLY_CAPACITY");
// else if(key == "POWER_SUPPLY_CYCLE_COUNT")//
// return QString(QObject::tr("POWER_SUPPLY_CYCLE_COUNT");
// else if(key == "POWER_SUPPLY_POWER_NOW")//
// return QString(QObject::tr("POWER_SUPPLY_POWER_NOW");
// else if(key == "POWER_SUPPLY_PRESENT")//
// return QString(QObject::tr("POWER_SUPPLY_PRESENT");
// else if(key == "POWER_SUPPLY_STATUS")//
// return QString(QObject::tr("POWER_SUPPLY_STATUS");
// else if(key == "POWER_SUPPLY_VOLTAGE_MIN_DESIGN")//
// return QString(QObject::tr("POWER_SUPPLY_VOLTAGE_MIN_DESIGN");
// POWER_SUPPLY_CAPACITY_LEVEL
// POWER_SUPPLY_CHARGE_FULL
// POWER_SUPPLY_CHARGE_FULL_DESIGN
// POWER_SUPPLY_CHARGE_NOW
// POWER_SUPPLY_CURRENT_NOW
// POWER_SUPPLY_PROP_STATUS
// POWER_SUPPLY_PROP_CHARGE_TYPE
// POWER_SUPPLY_PROP_HEALTH
// POWER_SUPPLY_PROP_PRESENT,
// POWER_SUPPLY_PROP_TECHNOLOGY,
// POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
// POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
// POWER_SUPPLY_PROP_VOLTAGE_NOW,
// POWER_SUPPLY_PROP_CAPACITY,
// POWER_SUPPLY_PROP_CURRENT_NOW,
// POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
// POWER_SUPPLY_PROP_TEMP,
// POWER_SUPPLY_PROP_SYSTEM_TEMP_LEVEL
// POWER_SUPPLY_ATTR
// POWER_SUPPLY_CURRENT_MAX
// SEQNUM
// POWER_SUPPLY_CHARGING_ENABLED
// POWER_SUPPLY_CHARGE_TYPE
// POWER_SUPPLY_HEALTH
// POWER_SUPPLY_VOLTAGE_MAX_DESIGN
// POWER_SUPPLY_TEMP
// POWER_SUPPLY_SYSTEM_TEMP_LEVEL
else if(key == "POWER_SUPPLY_MODEL_NAME")//型号
return QString(QObject::tr("Model"));
else if(key == "POWER_SUPPLY_TECHNOLOGY")//技术
return QString(QObject::tr("Technology"));
else if(key == "POWER_SUPPLY_VOLTAGE_NOW")//电压
return QString(QObject::tr("Voltage"));
else if(key == "POWER_SUPPLY_ENERGY_FULL_DESIGN")//能量(设计)
return QString(QObject::tr("Energy Designed"));
else if(key == "POWER_SUPPLY_ENERGY_FULL")//满时能量
return QString(QObject::tr("Energy Full"));
else if(key == "POWER_SUPPLY_ENERGY_NOW")//能量
return QString(QObject::tr("Energy Now"));
else if(key == "POWER_SUPPLY_SERIAL_NUMBER")//序列号
return QString(QObject::tr("Serial Number"));
else if(key == "BoaVendor")//主板型号
return QString(QObject::tr("Motherboard Model"));
else if(key == "BoaProduct")//主板产商
return QString(QObject::tr("Motherboard Vendor"));
else if(key == "BoaSerial")//序列号
return QString(QObject::tr("Serial Number"));
else if(key == "BioVendor")//BIOS产商
return QString(QObject::tr("BIOS Vendor"));
else if(key == "BioVersion")//BIOS版本
return QString(QObject::tr("BIOS Version"));
else if(key == "BioRelease")//发布日期
return QString(QObject::tr("Release Date"));
else if(key == "DvdProduct")//光驱型号
return QString(QObject::tr("CD-ROM Model"));
else if(key == "DvdVendor")//制造商
return QString(QObject::tr("Vendor"));
else if(key == "DvdName")//设备名称
return QString(QObject::tr("Device Name"));
else if(key == "DvdFw")//固件版本
return QString(QObject::tr("Firmware Version"));
else if(key == "DvdSerial")//序列号
return QString(QObject::tr("Serial Number"));
else if(key == "CpuVersion")//处理器:
return QString(QObject::tr("CPU"));
else if(key == "CpuVendor")//制造商:
return QString(QObject::tr("Vendor"));
else if(key == "CpuSerial")//序列号:
return QString(QObject::tr("Serial Number"));
else if(key == "CpuSlot")//插座/插槽:
return QString(QObject::tr("Socket/Slot"));
else if(key == "CpuCapacity")//最大主频:
return QString(QObject::tr("Maximum Frequency"));
else if(key == "CpuSize")//当前主频:
return QString(QObject::tr("Current Frequency"));
else if(key == "CpuClock")//前端总线:
return QString(QObject::tr("FSB"));
else if(key == "cpu_cores")//核心数目:
return QString(QObject::tr("Core Number"));
else if(key == "cpu_siblings")//线程
return QString(QObject::tr("Thread"));
else if(key == "clflush_size")//一级缓存:
return QString(QObject::tr("L1 Cache"));
else if(key == "cache_size")//二级缓存:
return QString(QObject::tr("L2 Cache"));
// else if(key == "1500a v1.0 64 bits")//1500a v1.0 64位
// return QString(QObject::tr("1500a v1.0 64 bits");
else if(key == "phytium")//飞腾
return QString(QObject::tr("phytium"));
else if(key == "4 cores")//4核
return QString(QObject::tr("4 cores"));
else if(key == "4 thread/core")//4线程/核
return QString(QObject::tr("4 thread/core"));
else if(key == "desktopenvironment")//桌面环境
return QString(QObject::tr("Desktop Environment"));
else if(key == "cpu")
return QString(QObject::tr("CPU"));
else if(key == "hostname")
return QString(QObject::tr("Host Name"));
else if(key == "ram")
return QString(QObject::tr("Memory Capacity"));
else if(key == "terminal")
return QString(QObject::tr("Terminal"));
else if(key == "distribution")//发行版
return QString(QObject::tr("Distribution"));
else if(key == "language")//语言
return QString(QObject::tr("Language"));
else if(key == "currrent_user")//当前用户
return QString(QObject::tr("User"));
else if(key == "home_path")//用户主目录
return QString(QObject::tr("Home Folder"));
else if(key == "Host bridge")//主桥
return QString(QObject::tr("Host bridge"));
else if(key == "VGA compatible controller")//VGA兼容控制器
return QString(QObject::tr("VGA Model"));
else if(key == "USB controller")//USB控制器
return QString(QObject::tr("USB Model"));
else if(key == "Communication controller")//通信控制器
return QString(QObject::tr("Communication Model"));
else if(key == "Ethernet controller")//以太网控制器
return QString(QObject::tr("Ethernet Model"));
else if(key == "Audio device")//音频设备
return QString(QObject::tr("Audio Model"));
else if(key == "PCI bridge")//PCI桥
return QString(QObject::tr("PCI bridge"));
else if(key == "ISA bridge")//ISA桥
return QString(QObject::tr("ISA bridge"));
else if(key == "SATA controller")//SATA控制器
return QString(QObject::tr("SATA Model"));
else if(key == "SMBus")//系统管理总线
return QString(QObject::tr("SMBus"));
else if(key == "System peripheral")//系统外围
return QString(QObject::tr("System peripheral"));
else if(key == "driver in use")//使用的驱动
return QString(QObject::tr("Driver in use"));
else if(key == "existing drivers")//可选的驱动
return QString(QObject::tr("existing drivers"));
else if(key == "IDE interface")//IDE接口
return QString(QObject::tr("IDE interface"));
else if(key == "Signal processing controller")//信号处理控制器
return QString(QObject::tr("SP controller"));
else if(key == "Network controller")//网络控制器
return QString(QObject::tr("Network controller"));
else if(key == "Multimedia audio controller")//多媒体音频控制器
return QString(QObject::tr("Multimedia audio controller"));
else if(key == "DiskProduct")//硬盘型号:
return QString(QObject::tr("HDD Model"));
else if(key == "DiskVendor")//硬盘厂商:
return QString(QObject::tr("HDD Vendor"));
else if(key == "DiskCapacity")//硬盘容量:
return QString(QObject::tr("HDD Capacity"));
else if(key == "DiskName")//设备名称:
return QString(QObject::tr("Device Name"));
else if(key == "DiskFw")//固件版本:
return QString(QObject::tr("Firmware Version"));
else if(key == "DiskSerial")//序列号:
return QString(QObject::tr("Serial Number"));
else if(key == "MemSlot")//插槽号:
return QString(QObject::tr("Slot Number"));
else if(key == "MemProduct")//内存型号:
return QString(QObject::tr("Memory Model"));
else if(key == "MemVendor")//制造商:
return QString(QObject::tr("Vendor"));
else if(key == "MemSerial")//序列号:
return QString(QObject::tr("Serial Number"));
else if(key == "MemSize")//内存大小:
return QString(QObject::tr("Memory Size"));
else if(key == "MemWidth")//数据宽度:
return QString(QObject::tr("Data Width"));
else if(key == "MemInfo")//内存条信息:
return QString(QObject::tr("Memory Info"));
else if(key == "Vga_product")//显卡型号:
return QString(QObject::tr("Graphics Card Model"));
else if(key == "Mon_chip")//当前显卡:
return QString(QObject::tr("Current Graphics Card"));
else if(key == "Vga_vendor")//显卡制造商:
return QString(QObject::tr("Graphics Card Vendor"));
else if(key == "Vga_Drive")//显卡驱动:
return QString(QObject::tr("Graphics Driver"));
else if(key == "Vga_businfo")//显卡总线地址:
return QString(QObject::tr("Bus Address"));
else if(key == "Mon_gamma")//伽马值
return QString(QObject::tr("Gamma"));
else if(key == "Mon_in")//屏幕尺寸(英寸)
return QString(QObject::tr("Screen Size(inch)"));
else if(key == "Mon_maxmode")//最大分辨率
return QString(QObject::tr("Max Resolution"));
else if(key == "Mon_output")//当前接口
return QString(QObject::tr("Current Interface"));
else if(key == "Mon_product")//显示器型号:
return QString(QObject::tr("Monitor Model"));
else if(key == "Mon_size")//可视面积
return QString(QObject::tr("Visual Area"));
else if(key == "Mon_support")//支持接口
return QString(QObject::tr("Support Interface"));
else if(key == "Mon_vendor")//显示器制造商
return QString(QObject::tr("Monitor Manufacturers"));
else if(key == "Mon_week")//生产日期_周
return QString(QObject::tr("Date of production/Week"));
else if(key == "Mon_year")//生产日期_年
return QString(QObject::tr("Date of production/Year"));
else if(key == "NetVendor")//制造商:
return QString(QObject::tr("Vendor"));
else if(key == "NetProduct")//网卡型号:
return QString(QObject::tr("NIC Model"));
else if(key == "NetDrive")//有线网卡驱动:
return QString(QObject::tr("NIC Driver"));
else if(key == "NetBusinfo")//总线地址:
return QString(QObject::tr("Bus Address"));
else if(key == "NetLogicalname")//设备名称:
return QString(QObject::tr("Device Name"));
else if(key == "NetIp")//IP地址:
return QString(QObject::tr("IP Address"));
else if(key == "NetSerial")//MAC地址:
return QString(QObject::tr("Mac Address"));
else if(key == "NetLink")//连接状态:
return QString(QObject::tr("Connection Status"));
else if(key == "NetCapacity")//最大带宽:
return QString(QObject::tr("Max Bandwidth"));
else if(key == "WlanVendor")//制造商:
return QString(QObject::tr("Vendor"));
else if(key == "WlanDrive")//无线网卡驱动:
return QString(QObject::tr("WLan NIC Driver"));
else if(key == "WlanProduct")//网卡型号:
return QString(QObject::tr("WLan NIC Model"));
else if(key == "WlanBusinfo")//总线地址:
return QString(QObject::tr("Bus Address"));
else if(key == "WlanLogicalname")//设备名称:
return QString(QObject::tr("Device Name:"));
else if(key == "WlanSerial")//序列号:
return QString(QObject::tr("Serial Number"));
else if(key == "WlanIp")//IP地址:
return QString(QObject::tr("IP Address"));
else if (key == "VNIC") {
return QString(QObject::tr("VNIC"));
}
else if (key == "NetType") {
return QString(QObject::tr("NetType"));
}
else if (key == "Ethernet interface") {
return QString(QObject::tr("Ethernet interface"));
}
else if (key == "Wireless interface") {
return QString(QObject::tr("Wireless interface"));
}
else if(key == "ComVendor")//制造商:
return QString(QObject::tr("Vendor"));
else if(key == "ComProduct")//电脑型号:
return QString(QObject::tr("Model"));
else if(key == "ComVersion")//电脑版本:
return QString(QObject::tr("Version"));
else if(key == "ComSerial")//序列号:
return QString(QObject::tr("Serial Number"));
else if(key == "node")//主机名:
return QString(QObject::tr("Hostname"));
else if(key == "uptime")//持续运行时间:
return QString(QObject::tr("Running Time"));
else if(key == "system")//操作系统类型:
return QString(QObject::tr("OS Types"));
else if(key == "osname")//操作系统版本:
return QString(QObject::tr("OS Version"));
else if(key == "architecture")//系统位数:
return QString(QObject::tr("Kernel Bit"));
else if(key == "release")//内核版本:
return QString(QObject::tr("Kernel Version"));
else if(key == "machine")//内核架构:
return QString(QObject::tr("Kernel Arch"));
else if (key == "32bit")
return QString(QObject::tr("32bit"));
else if (key == "64bit" || key == "64 bits")
return QString(QObject::tr("64bit"));
else if (key == "YHKylin community")
return QString(QObject::tr("YHKylin community"));
else if(key == "IN0")//内存参考电压
return QString(QObject::tr("Memory reference voltage"));
else if(key == "IN2")//SATA控制器电压
return QString(QObject::tr("SATA controller voltage"));
else if(key == "IN3")//内存电压
return QString(QObject::tr("Memory voltage"));
else if(key == "IN5")//CPU管脚电压
return QString(QObject::tr("CPU pin voltage"));
else if(key == "IN6")//桥片电压
return QString(QObject::tr("Bridge voltage"));
else if(key == "TR4")//CPU核电压
return QString(QObject::tr("CPU core voltage"));
else if(key == "TR5")//CPU温度
return QString(QObject::tr("CPU temperature"));
else if(key == "TR6")//主板温度
return QString(QObject::tr("Motherboard temperature"));
else if(key == "FANIN1")//CPU风扇转速
return QString(QObject::tr("CPU fan speed"));
else
return key;
}
InfoItemLine::InfoItemLine(QFrame *parent)
: QFrame(parent)
{
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
this->setFixedHeight(36);
m_key = "";
m_keyLabel = new QLabel;
m_valueLabel = new QLabel;
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->setSpacing(0);
mainLayout->setMargin(0);
mainLayout->setContentsMargins(20, 0, 10, 0);
mainLayout->addWidget(m_keyLabel);
mainLayout->addSpacing(10);
mainLayout->addWidget(m_valueLabel);
mainLayout->addStretch();
this->setLayout(mainLayout);
}
InfoItemLine::~InfoItemLine()
{
delete m_keyLabel;
delete m_valueLabel;
}
void InfoItemLine::setInfoKey(const QString &key)
{
const QString name = covertKeyName(key);
m_keyLabel->setText(name);
m_key = key;
QFont ft;
QFontMetrics fm(ft);
this->keyWidth = fm.width(key);
}
void InfoItemLine::setInfoValue(const QString &value)
{
int maxWidth = this->width() - keyWidth - 40;
QFont ft;
QFontMetrics fm(ft);
QString elided_text = fm.elidedText(value, Qt::ElideRight, maxWidth);
m_valueLabel->setText(elided_text);
if(elided_text.endsWith("…"))
m_valueLabel->setToolTip(value);
}
QString InfoItemLine::getLineKey()
{
return m_key;
}
youker-assistant/info/infounitwidget.h 0000664 0001750 0001750 00000003216 15227663670 017210 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 INFOUNITWIDGET_H
#define INFOUNITWIDGET_H
#include "infounitwidget.h"
#include "infoitemsgroup.h"
#include
#include
#include
#include
class InfoUnitWidget : public QWidget
{
Q_OBJECT
public:
explicit InfoUnitWidget(QString title, QWidget *parent = 0);
~InfoUnitWidget();
const QString title() const;
void setInfoTitle(const QString &title);
void setInfoVendor(const QString &vendor);
int getCurrentRunningTimeUIIndex();
void refreshInfoItem(const QString &key, const QString &value);
protected:
QVBoxLayout *m_infoLayout = nullptr;
public slots:
void addInfoItem(const QString &key, const QString &value);
private:
InfoItemsGroup *m_infoItemsGroup = nullptr;
QLabel *m_titleLabel = nullptr;
QLabel *m_vendorLabel = nullptr;
int m_currentRunningTimeUIIndex;
};
#endif // INFOUNITWIDGET_H
youker-assistant/info/infoitemsgroup.cpp 0000664 0001750 0001750 00000004350 15227663670 017556 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 .
*/
#include "infoitemsgroup.h"
#include "infoitemline.h"
#include
#include
InfoItemsGroup::InfoItemsGroup(QFrame *parent) :
QFrame(parent),
m_layout(new QVBoxLayout)
{
m_layout->setMargin(0);
m_layout->setSpacing(1);
this->setLayout(m_layout);
}
InfoItemsGroup::~InfoItemsGroup()
{
/*if (m_layout) {
foreach (QObject *child, m_layout->children()) {
QWidget *widget = static_cast(child);
widget->deleteLater();
}
}*/
for (int i = 0; i != m_layout->count(); ++i)
{
QLayoutItem *child = m_layout->takeAt(0);
QWidget *w = child->widget();
w->removeEventFilter(this);
w->setParent(nullptr);
delete child;
child = nullptr;
}
/*QLayoutItem *child;
while ((child = m_layout->takeAt(0)) != 0) {
if (child->widget())
child->widget()->deleteLater();
delete child;
}*/
}
int InfoItemsGroup::appendItem(InfoItemLine *item)
{
m_layout->insertWidget(m_layout->count(), item);
item->installEventFilter(this);
return m_layout->count() - 1;
}
void InfoItemsGroup::removeItem(InfoItemLine *item)
{
m_layout->removeWidget(item);
item->removeEventFilter(this);
}
InfoItemLine *InfoItemsGroup::getInfoItem(int index)
{
if(index < 0)
return NULL;
if(index < m_layout->count())
{
return qobject_cast(m_layout->itemAt(index)->widget());
}
return NULL;
}
youker-assistant/info/infounitwidget.cpp 0000664 0001750 0001750 00000010663 15227663670 017547 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 .
*/
#include "infounitwidget.h"
#include "infoitemline.h"
#include "infoitemsgroup.h"
#include
#include
#include
InfoUnitWidget::InfoUnitWidget(QString title, QWidget *parent)
: QWidget(parent)
, m_currentRunningTimeUIIndex(-1)
{
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
this->setStyleSheet("QWidget {background-color: rgba(255, 255, 255, 0.1);border-radius: 2px;}");
//kobe: QHBoxLayout *mainLayout = static_cast(layout());
m_titleLabel = new QLabel;
m_titleLabel->setStyleSheet("QLabel{background-color:transparent;color:#000000;font-size:15px;font-weight:bold;}");
m_titleLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
m_titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_vendorLabel = new QLabel;
m_titleLabel->setStyleSheet("QLabel{background-color:transparent;}");
m_vendorLabel->setFixedSize(48, 48);
this->setInfoTitle(title);
QHBoxLayout *headerLayout = new QHBoxLayout;
headerLayout->setContentsMargins(10, 0, 30, 0);
headerLayout->addWidget(m_titleLabel);
headerLayout->addStretch();
headerLayout->addWidget(m_vendorLabel);
headerLayout->setAlignment(m_vendorLabel, Qt::AlignCenter);
QFrame *headerWidget = new QFrame;
headerWidget->setStyleSheet("QFrame {padding:5px 0;} QFrame:hover {background-color:rgba(141,238,238,0.2);border-radius:4px;}");
headerWidget->setLayout(headerLayout);
m_infoLayout = new QVBoxLayout;
m_infoLayout->addWidget(headerWidget);
m_infoLayout->setSpacing(5);
m_infoLayout->setMargin(0);
m_infoLayout->setContentsMargins(0,0,0,0);
m_infoItemsGroup = new InfoItemsGroup;
m_infoLayout->addWidget(m_infoItemsGroup);
setLayout(m_infoLayout);
// m_infoItemsGroup->getInfoItem()
}
InfoUnitWidget::~InfoUnitWidget()
{
m_currentRunningTimeUIIndex = -1;
QList items = findChildren();
for (InfoItemLine *item : items) {
m_infoItemsGroup->removeItem(item);
item->deleteLater();
}
if (m_infoItemsGroup) {
delete m_infoItemsGroup;
m_infoItemsGroup = 0;
}
}
const QString InfoUnitWidget::title() const
{
return m_titleLabel->text();
}
void InfoUnitWidget::setInfoTitle(const QString &title)
{
m_titleLabel->setText(title);
setAccessibleName(title);
}
void InfoUnitWidget::setInfoVendor(const QString &vendor)
{
QPainterPath painterPath;
painterPath.addEllipse(QRect(0, 0, 48, 48));
QPixmap pixmap = QPixmap(vendor);
if (pixmap.isNull())
return;
pixmap = pixmap.scaled(48, 48, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap pic(48, 48);
pic.fill(Qt::transparent);
QPainter painter(&pic);
painter.setRenderHint(QPainter::Antialiasing);
painter.setClipPath(painterPath);
painter.drawPixmap(QRect(0, 0, 48, 48), pixmap);
m_vendorLabel->setPixmap(pic);
}
void InfoUnitWidget::addInfoItem(const QString &key, const QString &value)
{
InfoItemLine *w = new InfoItemLine;
const int index = m_infoItemsGroup->appendItem(w);
if (key == "uptime") {
m_currentRunningTimeUIIndex = index;
}
w->setInfoKey(key);
w->setInfoValue(value);
connect(w, &InfoItemLine::clicked, [=] (const QString &context) { qDebug() << context; });
}
void InfoUnitWidget::refreshInfoItem(const QString &key, const QString &value)
{
QList items = findChildren();
for (InfoItemLine *item : items) {
if (item->getLineKey() == key) {
item->setInfoValue(value);
}
}
}
int InfoUnitWidget::getCurrentRunningTimeUIIndex()
{
return m_currentRunningTimeUIIndex;
}
youker-assistant/info/infoitemsgroup.h 0000664 0001750 0001750 00000002277 15227663670 017231 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 INFOITEMSGROUP_H
#define INFOITEMSGROUP_H
#include
class QVBoxLayout;
class InfoItemLine;
class InfoItemsGroup : public QFrame
{
Q_OBJECT
public:
explicit InfoItemsGroup(QFrame *parent = 0);
~InfoItemsGroup();
int appendItem(InfoItemLine *item);
void removeItem(InfoItemLine *item);
InfoItemLine* getInfoItem(int index);
private:
QVBoxLayout *m_layout = nullptr;
};
#endif // INFOITEMSGROUP_H
youker-assistant/info/infogui.h 0000664 0001750 0001750 00000003020 15227663670 015602 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 INFOGUI_H
#define INFOGUI_H
#include "infounitwidget.h"
#include
class QVBoxLayout;
class QScrollArea;
class InfoGui : public QWidget
{
Q_OBJECT
public:
explicit InfoGui(QWidget *parent = 0);
~InfoGui();
const QString infoGuiName() const;
void setInfoGuiName(const QString &name);
void clearWidget();
void loadOnePage(int index, const QString &title, QMap infoMap);
void updatePageData(const QString &title, QMap infoMap);
void updateRunningTime(const QString &runningTime);
private:
QVBoxLayout *m_vLayout = nullptr;
QFrame *m_widget = nullptr;
QScrollArea *m_scrollArea = nullptr;
QList m_pageList;
QString m_infoGuiName;
};
#endif // INFOGUI_H
youker-assistant/info/infoitemline.h 0000664 0001750 0001750 00000002425 15227663670 016634 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 INFOITEMLINE_H
#define INFOITEMLINE_H
#include
class QRadioButton;
class InfoItemLine : public QFrame
{
Q_OBJECT
public:
explicit InfoItemLine(QFrame *parent = 0);
~InfoItemLine();
void setInfoKey(const QString &key);
void setInfoValue(const QString &value);
QString getLineKey();
signals:
void clicked(const QString &context) const;
private:
QLabel *m_keyLabel = nullptr;
QLabel *m_valueLabel = nullptr;
QString m_key;
int keyWidth;
};
#endif // INFOITEMLINE_H
youker-assistant/info/devicemanager.h 0000664 0001750 0001750 00000002216 15227663670 016742 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 DEVICEMANAGER_H
#define DEVICEMANAGER_H
#include
#include
#include
#include
#include
class DeviceManager : public QObject
{
Q_OBJECT
public:
explicit DeviceManager(QObject *parent = 0);
//得到硬件设备及其驱动信息
Q_INVOKABLE QStringList getDeviceMsg();
signals:
public slots:
};
#endif // DEVICEMANAGER_H
youker-assistant/info/infogui.cpp 0000664 0001750 0001750 00000015212 15227663670 016143 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 .
*/
#include "infogui.h"
#include "infounitwidget.h"
#include
#include
#include
#include
#include
#include
InfoGui::InfoGui(QWidget *parent)
: QWidget(parent)
{
// this->setAutoFillBackground(true);
// QPalette palette;
// palette.setColor(QPalette::Background, QColor("#0d87ca"));
// this->setPalette(palette);
// setFixedSize(750, 403);
// this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
this->setStyleSheet("QWidget {background-color: rgba(255, 255, 255, 0.1);border:none;}");
this->resize(750, parent->size().height());
m_infoGuiName = "";
m_vLayout = new QVBoxLayout,
m_widget = new QFrame;
m_scrollArea = new QScrollArea;
m_scrollArea->setWidgetResizable(true);
m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_scrollArea->setStyleSheet("QScrollArea{border: none;background-color: #ffffff;}");
m_vLayout->setSpacing(10);
m_vLayout->setMargin(0);
m_widget->setLayout(m_vLayout);
m_widget->setFixedWidth(750);//m_scrollArea->width()
m_scrollArea->setWidget(m_widget);
QVBoxLayout *layout = new QVBoxLayout;//QHBoxLayout *mainLayout = static_cast(layout());
layout->addWidget(m_scrollArea);
layout->setContentsMargins(5, 5, 5, 5);
layout->setSpacing(0);
this->setLayout(layout);
// this->loadOnePage(0, "AAA1", QMap());
// this->loadOnePage(1, "AAA2", QMap());
}
const QString InfoGui::infoGuiName() const
{
return this->m_infoGuiName;
}
void InfoGui::setInfoGuiName(const QString &name)
{
if (name != m_infoGuiName)
m_infoGuiName = name;
}
InfoGui::~InfoGui()
{
qDeleteAll(m_pageList);
m_pageList.clear();
if (m_vLayout) {
delete m_vLayout;
m_vLayout = nullptr;
}
if (m_widget) {
delete m_widget;
m_widget = nullptr;
}
if (m_scrollArea) {
delete m_scrollArea;
m_scrollArea = nullptr;
}
}
void InfoGui::clearWidget()
{
qDeleteAll(m_pageList);
m_pageList.clear();
}
void InfoGui::loadOnePage(int index, const QString &title, QMap infoMap)
{
InfoUnitWidget *w = new InfoUnitWidget(title, this);
QMap::iterator it; //遍历map
for (it = infoMap.begin(); it != infoMap.end(); ++it) {
QString valueStr = it.value().toString().trimmed();
if (QString::compare(valueStr, "UNKNOWN", Qt::CaseInsensitive) == 0 || QString::compare(valueStr, "UNKNOWN", Qt::CaseInsensitive) == 0) {//for arm memory
//do nothing
}
else if (it.key().length() > 0 && valueStr.length() > 0) {
if (it.key() == "MemVendor") {
w->setInfoVendor(":/vendor/res/manufacturer/" + valueStr.toUpper() + ".jpg");
}
else if (it.key() == "BoaVendor") {
w->setInfoVendor(":/vendor/res/manufacturer/" + valueStr.toUpper() + ".jpg");
}
else if (it.key() == "DiskVendor") {
w->setInfoVendor(":/vendor/res/manufacturer/" + valueStr.toUpper() + ".jpg");
}
else if (it.key() == "Vga_vendor") {
w->setInfoVendor(":/vendor/res/manufacturer/" + valueStr.toUpper() + ".jpg");
}
else if (it.key() == "MulVendor") {
w->setInfoVendor(":/vendor/res/manufacturer/" + valueStr.toUpper() + ".jpg");
}
else if (it.key() == "POWER_SUPPLY_MANUFACTURER") {
w->setInfoVendor(":/vendor/res/manufacturer/" + valueStr.toUpper() + ".jpg");
}
else {
if (it.key().contains("INTEL"))
w->setInfoVendor(":/vendor/res/manufacturer/INTEL.jpg");
else if (it.key().contains("REALTEK"))
w->setInfoVendor(":/vendor/res/manufacturer/REALTEK.jpg");
}
w->addInfoItem(it.key(), valueStr);
}
}
m_vLayout->addWidget(w, 0, Qt::AlignTop);//m_vLayout->insertWidget(index, w);
m_pageList.append(w);
}
void InfoGui::updatePageData(const QString &title, QMap infoMap)
{
if (m_pageList.count() <= 0) {
InfoUnitWidget *m_testWidget = new InfoUnitWidget(title);
QMap::iterator it; //遍历map
for (it = infoMap.begin(); it != infoMap.end(); ++it) {
QString valueStr = it.value().toString().trimmed();
if (QString::compare(valueStr, "UNKNOWN", Qt::CaseInsensitive) == 0 || QString::compare(valueStr, "UNKNOWN", Qt::CaseInsensitive) == 0) {//for arm memory
//do nothing
}
else if (it.key().length() > 0 && valueStr.length() > 0) {
m_testWidget->addInfoItem(it.key(), valueStr);
}
}
m_vLayout->addWidget(m_testWidget, 0, Qt::AlignTop);//m_vLayout->insertWidget(index, m_testWidget);
m_pageList.append(m_testWidget);
}
foreach (InfoUnitWidget *widget, m_pageList) {
if (widget->title() == title) {
QMap::iterator it; //遍历map
for (it = infoMap.begin(); it != infoMap.end(); ++it) {
QString valueStr = it.value().toString().trimmed();
if (QString::compare(valueStr, "UNKNOWN", Qt::CaseInsensitive) == 0 || QString::compare(valueStr, "UNKNOWN", Qt::CaseInsensitive) == 0) {//for arm memory
//do nothing
}
else if (it.key().length() > 0 && valueStr.length() > 0) {
widget->refreshInfoItem(it.key(), valueStr);
}
}
break;
}
}
}
void InfoGui::updateRunningTime(const QString &runningTime)
{
foreach (InfoUnitWidget *widget, m_pageList) {
int index = widget->getCurrentRunningTimeUIIndex();
if (index >= 0) {
// getInfoItem
}
}
}
youker-assistant/info/devicemanager.cpp 0000664 0001750 0001750 00000003640 15227663670 017277 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 "devicemanager.h"
DeviceManager::DeviceManager(QObject *parent) :
QObject(parent)
{
}
QStringList DeviceManager::getDeviceMsg(){
QString cmd = "lspci -k";
QProcess *p = new QProcess();
p->start(cmd);
p->waitForFinished();
QStringList tmpList;
while(p->canReadLine()){
QString str = p->readLine();
str = str.left(str.length() - 1);
tmpList.append(str);
}
QString tmps;
QStringList deviceMsgList;
for (int i = 0;i < tmpList.size();i ++) {
QString str = tmpList.at(i);
if(str.startsWith("\t") == false){
if(tmps != ""){
deviceMsgList.append(tmps);
}
tmps = str.mid(str.indexOf(" "));
}else{
QStringList tmparr = str.split(":");
if(tmparr.at(0).indexOf("Kernel driver in use") != -1){
tmps += ";";
tmps += "driver in use:"; //"使用中的驱动:"
tmps += tmparr.at(1);
}
if(tmparr.at(0).indexOf("Kernel modules") != -1){
tmps += ";";
tmps += "existing drivers:"; //"可选择的驱动:"
tmps += tmparr.at(1);
}
}
}
return deviceMsgList;
}
youker-assistant/cleaner/ 0000775 0001750 0001750 00000000000 15227663670 014454 5 ustar feng feng youker-assistant/cleaner/cleanermainwidget.h 0000664 0001750 0001750 00000004564 15227663670 020320 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/cleanerdetailwidget.cpp 0000664 0001750 0001750 00000211567 15227663670 021174 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/cleanermainwidget.cpp 0000664 0001750 0001750 00000034252 15227663670 020650 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("Cleans up cache of system"));//系统缓存垃圾 清除包、软件中心、缩略图和浏览器缓存
//子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("Cleans up cookies in 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("Cleans up records of history"));
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/cleanlistwidget.ui 0000664 0001750 0001750 00000002141 15227663670 020173 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-org.h 0000664 0001750 0001750 00000003717 15227663670 021104 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/cleanerdetailwidget.h 0000664 0001750 0001750 00000006512 15227663670 020631 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/cleanermainwidget-new.h 0000664 0001750 0001750 00000004326 15227663670 021103 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/cleanlistwidget.h 0000664 0001750 0001750 00000003645 15227663670 020017 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/cleanermainwidget-new.cpp 0000664 0001750 0001750 00000037311 15227663670 021436 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/cleanermainwidget-org.cpp 0000664 0001750 0001750 00000032257 15227663670 021440 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/cacheactionwidget.cpp 0000664 0001750 0001750 00000005237 15227663670 020634 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/cleanlistwidget.cpp 0000664 0001750 0001750 00000013734 15227663670 020352 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/cleaner/cacheactionwidget.h 0000664 0001750 0001750 00000002443 15227663670 020275 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/cleaneritems.cpp 0000664 0001750 0001750 00000015463 15227663670 017644 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/cleaneritems.h 0000664 0001750 0001750 00000004201 15227663670 017275 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/autogen.sh 0000775 0001750 0001750 00000000137 15227663670 015045 0 ustar feng feng #!/bin/sh
# Run this to generate all the initial makefiles, etc.
lrelease kylin-assistant.pro
youker-assistant/COPYING 0000664 0001750 0001750 00000104513 15227663670 014102 0 ustar feng feng GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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, either version 3 of the License, or
(at your option) any later version.
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 .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
youker-assistant/kylin-assistant.desktop 0000664 0001750 0001750 00000000441 15227663670 017572 0 ustar feng feng [Desktop Entry]
Name=Kylin Assistant
Name[zh_CN]=麒麟助手
Comment=System Auxiliar Tools
Comment[zh_CN]=系统辅助工具
Keywords=Settings;Cleaning;Customization
Exec=/usr/bin/kylin-assistant %u
Icon=kylin-assistant
Terminal=false
Type=Application
Categories=GNOME;GTK;System;Viewer;
youker-assistant/man/ 0000775 0001750 0001750 00000000000 15227663670 013616 5 ustar feng feng youker-assistant/man/kylin-assistant-backend.py.1 0000664 0001750 0001750 00000000764 15227663670 021060 0 ustar feng feng .\" Hey, EMACS: -*- nroff -*-
.TH KYLIN-ASSISTANT-BACKEND 1 "22 DEC 2017"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
kylin-assistant-backend \- launch backends
.SH SYNOPSIS
.B kylin-assistant-backend
.SH DESCRIPTION
.B kylin-assistant-backend
It is used to launch backends.
.PP
.SH SEE ALSO
.BR kylin-assistant-backend (1),
.br
.SH AUTHOR
kylin-assistant-backend was written by lixiang .
.PP
This manual page was written by lixiang .
youker-assistant/man/kylin-assistant.1 0000664 0001750 0001750 00000000726 15227663653 017043 0 ustar feng feng .\" Hey, EMACS: -*- nroff -*-
.TH KYLIN-ASSISTANT 1 "22 DEC 2017"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
kylin-assistant \- launch kylin-assistant frontends
.SH SYNOPSIS
.B kylin-assistant
.SH DESCRIPTION
.B kylin-assistant
It is used to launch frontends.
.PP
.SH SEE ALSO
.BR kylin-assistant (1),
.br
.SH AUTHOR
kylin-assistant was written by lixiang .
.PP
This manual page was written by lixiang .
youker-assistant/man/kylin-assistant-session.py.1 0000664 0001750 0001750 00000000764 15227663670 021154 0 ustar feng feng .\" Hey, EMACS: -*- nroff -*-
.TH KYLIN-ASSISTANT-SESSION 1 "22 DEC 2017"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
kylin-assistant-session \- launch backends
.SH SYNOPSIS
.B kylin-assistant-session
.SH DESCRIPTION
.B kylin-assistant-session
It is used to launch backends.
.PP
.SH SEE ALSO
.BR kylin-assistant-session (1),
.br
.SH AUTHOR
kylin-assistant-session was written by lixiang .
.PP
This manual page was written by lixiang .
youker-assistant/setting/ 0000775 0001750 0001750 00000000000 15227663670 014520 5 ustar feng feng youker-assistant/setting/themewidget.cpp 0000664 0001750 0001750 00000006601 15227663670 017535 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 .
*/
#include "themewidget.h"
#include "theme/themeview.h"
#include
#include
#include
#include
#include
#include
ThemeWidget::ThemeWidget(QWidget *parent) :
SettingModulePage(parent)
{
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// this->resize(parent->size());
// this->setFixedSize(900, 403);
label = new QLabel(this);
label->setObjectName("tipLabel");
label->setFixedHeight(30);
// label->setGeometry(QRect(30, 15, 860, 50));
label->setText(tr("Please choose theme which you need"));
m_themeView = new ThemeView(this);
connect(m_themeView, SIGNAL(sendSelectThemeName(QString)), this, SLOT(changeTheme(QString)));
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setSpacing(5);
layout->setMargin(0);
layout->setContentsMargins(10, 5, 10, 0);
layout->addWidget(label);
layout->addWidget(m_themeView);
this->setLayout(layout);
}
QString ThemeWidget::settingModuleName()
{
return "ThemePage";
}
void ThemeWidget::onReceiveThemeList(const QString ¤tTheme, const QStringList &themeList)
{
// qDebug() << "currentTheme="<::Iterator it = syslist.begin(), itend = syslist.end();
int index = -1;
bool exist = false;
for(;it != itend; it++)
{
++index;
if(*it == value) {
exist = true;
break;
}
}
if(exist)
{
exist = false;
this->switchUsingLogo(QString::number(index, 10));
}
}
}
youker-assistant/setting/soundwidget.cpp 0000664 0001750 0001750 00000016553 15227663670 017572 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 "soundwidget.h"
#include
#include
#include
SoundWidget::SoundWidget(QWidget *parent, QString cur_desktop) :
SettingModulePage(parent),desktop(cur_desktop)
{
theme_label = new QLabel();
tip_label = new QLabel();
event_label = new QLabel();
feedback_label = new QLabel();
theme_combo = new QComboBox();
tip_switcher = new KylinSwitcher();
event_switcher = new KylinSwitcher();
feedback_switcher = new KylinSwitcher();
theme_label->setFixedWidth(180);
tip_label->setFixedWidth(180);
event_label->setFixedWidth(180);
feedback_label->setFixedWidth(180);
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
{
tip_label->hide();
tip_switcher->hide();
}
QHBoxLayout *layout1 = new QHBoxLayout();
layout1->setSpacing(10);
layout1->addWidget(theme_label);
layout1->addWidget(theme_combo);
layout1->addStretch();
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->setSpacing(10);
layout2->addWidget(tip_label);
layout2->addWidget(tip_switcher);
layout2->addStretch();
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->setSpacing(10);
layout3->addWidget(event_label);
layout3->addWidget(event_switcher);
layout3->addStretch();
QHBoxLayout *layout4 = new QHBoxLayout();
layout4->setSpacing(10);
layout4->addWidget(feedback_label);
layout4->addWidget(feedback_switcher);
layout4->addStretch();
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(layout1);
layout->addLayout(layout2);
layout->addLayout(layout3);
layout->addLayout(layout4);
layout->addStretch();
setLayout(layout);
layout->setSpacing(10);
layout->setContentsMargins(20, 20, 0, 0);
// splitter->addWidget(top_widget);
// splitter->addWidget(bottom_widget);
// QHBoxLayout *main_layout = new QHBoxLayout;
// main_layout->addStretch();
// main_layout->addWidget(splitter);
// main_layout->setSpacing(0);
// main_layout->setContentsMargins(0, 0, 0, 0);
// setLayout(main_layout);
// this->initSettingData();
this->setLanguage();
}
SoundWidget::~SoundWidget()
{
if (theme_label != NULL) {
delete theme_label;
theme_label = NULL;
}
if (tip_label != NULL) {
delete tip_label;
tip_label = NULL;
}
if (event_label != NULL) {
delete event_label;
event_label = NULL;
}
if (feedback_label != NULL) {
delete feedback_label;
feedback_label = NULL;
}
if (theme_combo != NULL) {
delete theme_combo;
theme_combo = NULL;
}
if (tip_switcher != NULL) {
delete tip_switcher;
tip_switcher = NULL;
}
if (event_switcher != NULL) {
delete event_switcher;
event_switcher = NULL;
}
if (feedback_switcher != NULL) {
delete feedback_switcher;
feedback_switcher = NULL;
}
}
QString SoundWidget::settingModuleName()
{
return "SoundPage";
}
void SoundWidget::setLanguage() {
// title_label->setText(tr("Sound effect"));
// description_label->setText(tr("Set the sound theme you want."));
// back_btn->setText(tr("Back"));
theme_label->setText(tr("Sound theme") + ":");
tip_label->setText(tr("Login tone") + ":");
event_label->setText(tr("Event sounds") + ":");
feedback_label->setText(tr("Input feedback sounds") + ":");
}
void SoundWidget::initSettingData()
{
emit this->requestSoundData();
this->initConnect();
}
void SoundWidget::onSendSoundList(const QString ¤tSound, const QStringList &soundList)
{
if (!soundList.isEmpty()) {
m_soundlist.clear();
m_soundlist = soundList;
theme_combo->clear();
theme_combo->clearEditText();
theme_combo->addItems(m_soundlist);
QList::Iterator it = m_soundlist.begin(), itend = m_soundlist.end();
int initIndex = 0;
for(;it != itend; it++,initIndex++)
{
if(*it == currentSound)
break;
}
theme_combo->setCurrentIndex(initIndex);
}
}
void SoundWidget::onSendEnableSoundValue(bool login_music, bool sound_event, bool input_sound)
{
if (desktop != "mate" && desktop != "MATE")
{
tip_switcher->switchedOn = login_music;
}
event_switcher->switchedOn = sound_event;
feedback_switcher->switchedOn = input_sound;
}
void SoundWidget::initConnect() {
// connect(back_btn, SIGNAL(clicked()), this, SIGNAL(showSettingMainWidget()));
connect(theme_combo, SIGNAL(currentIndexChanged(QString)), this, SLOT(setVoiceTheme(QString)));
connect(tip_switcher, SIGNAL(clicked()), this, SLOT(setLoginTipVoice()));
connect(event_switcher, SIGNAL(clicked()), this, SLOT(setEventVoice()));
connect(feedback_switcher, SIGNAL(clicked()), this, SLOT(setInputFeedbackVoice()));
// connect(sessionproxy, SIGNAL(string_value_notify(QString, QString)), this, SLOT(voicewidget_notify_string(QString, QString)));
// connect(sessionproxy, SIGNAL(bool_value_notify(QString, bool)), this, SLOT(voicewidget_notify_bool(QString, bool)));
}
void SoundWidget::voicewidget_notify_string(QString key, QString value)
{
if (key == "theme-name") {
QList::Iterator it = m_soundlist.begin(), itend = m_soundlist.end();
int index = -1;
bool exist = false;
for(;it != itend; it++)
{
++index;
if(*it == value) {
exist = true;
break;
}
}
if (exist) {
exist = false;
theme_combo->setCurrentIndex(index);
}
else
theme_combo->setCurrentIndex(-1);
}
}
void SoundWidget::voicewidget_notify_bool(QString key, bool value)
{
if (key == "event-sounds") {
event_switcher->switchedOn = value;
}
else if (key == "input-feedback-sounds") {
feedback_switcher->switchedOn = value;
}
}
void SoundWidget::setVoiceTheme(QString selectTheme) {
emit resetVoiceTheme(selectTheme);
// sessionproxy->set_sound_theme_qt(selectTheme);
}
void SoundWidget::setLoginTipVoice() {
emit resetLoginTipVoice(tip_switcher->switchedOn);
// sessionproxy->set_login_music_enable_qt(tip_switcher->switchedOn);
}
void SoundWidget::setEventVoice() {
emit resetEventVoice(event_switcher->switchedOn);
// sessionproxy->set_sound_event_enable_qt(event_switcher->switchedOn);
}
void SoundWidget::setInputFeedbackVoice() {
emit resetInputFeedbackVoice(feedback_switcher->switchedOn);
// sessionproxy->set_input_feedback_sounds_enable_qt(feedback_switcher->switchedOn);
}
youker-assistant/setting/panelwidget.cpp 0000664 0001750 0001750 00000055163 15227663670 017541 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 "panelwidget.h"
#include
#include
#include
#include
#include
PanelWidget::PanelWidget(QWidget *parent, QString cur_desktop, bool has_battery) :
SettingModulePage(parent),desktop(cur_desktop)
{
blur_label = new QLabel();
transparency_label = new QLabel();
date_format_label = new QLabel();
second_label = new QLabel();
week_label = new QLabel();
date_label = new QLabel();
battery_icon_label = new QLabel();
battery_percentage_label = new QLabel();
battery_time_label = new QLabel();
show_app_label = new QLabel();
show_desktop_label = new QLabel();
show_icon_label = new QLabel();
show_places_label = new QLabel();
smart_radio = new QRadioButton();
smart_radio->setFocusPolicy(Qt::NoFocus);
smart_radio->setChecked(true);
smart_radio->setObjectName("smart_radio");
static_radio = new QRadioButton();
static_radio->setFocusPolicy(Qt::NoFocus);
static_radio->setChecked(false);
static_radio->setObjectName("static_radio");
clear_radio = new QRadioButton();
clear_radio->setFocusPolicy(Qt::NoFocus);
clear_radio->setChecked(false);
clear_radio->setObjectName("clear_radio");
QHBoxLayout *radio_layout = new QHBoxLayout();
radio_layout->setSpacing(10);
radio_layout->addWidget(smart_radio);
radio_layout->addWidget(static_radio);
radio_layout->addWidget(clear_radio);
radio_layout->addStretch();
transparency_slider = new QDoubleSpinBox();
transparency_slider->setButtonSymbols(QAbstractSpinBox::PlusMinus);
transparency_slider->setSingleStep(0.1);
transparency_slider->setMinimum(0.2);
transparency_slider->setMaximum(8.0);
date_combo = new QComboBox();
second_switcher = new KylinSwitcher();
week_switcher = new KylinSwitcher();
date_switcher = new KylinSwitcher();
battery_combo = new QComboBox();
battery_percentage_switcher = new KylinSwitcher();
battery_time_switcher = new KylinSwitcher();
app_switcher = new KylinSwitcher();
desktop_switcher = new KylinSwitcher();
icon_switcher = new KylinSwitcher();
places_switcher = new KylinSwitcher();
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui") {
blur_label->hide();
transparency_label->hide();
date_format_label->hide();
second_label->hide();
week_label->hide();
date_label->hide();
battery_icon_label->hide();
battery_percentage_label->hide();
battery_time_label->hide();
smart_radio->hide();
static_radio->hide();
clear_radio->hide();
transparency_slider->hide();
date_combo->hide();
second_switcher->hide();
week_switcher->hide();
date_switcher->hide();
battery_combo->hide();
battery_percentage_switcher->hide();
battery_time_switcher->hide();
}
else {
show_app_label->hide();
show_desktop_label->hide();
show_icon_label->hide();
show_places_label->hide();
app_switcher->hide();
desktop_switcher->hide();
icon_switcher->hide();
places_switcher->hide();
}
blur_label->setFixedWidth(220);
transparency_label->setFixedWidth(220);
date_format_label->setFixedWidth(220);
second_label->setFixedWidth(220);
week_label->setFixedWidth(220);
date_label->setFixedWidth(220);
battery_icon_label->setFixedWidth(220);
battery_percentage_label->setFixedWidth(220);
battery_time_label->setFixedWidth(220);
show_app_label->setFixedWidth(220);
show_desktop_label->setFixedWidth(220);
show_icon_label->setFixedWidth(220);
show_places_label->setFixedWidth(220);
QHBoxLayout *layout1 = new QHBoxLayout();
layout1->setSpacing(10);
layout1->addWidget(blur_label);
layout1->addLayout(radio_layout);
layout1->addStretch();
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->setSpacing(10);
layout2->addWidget(transparency_label);
layout2->addWidget(transparency_slider);
layout2->addStretch();
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->setSpacing(10);
layout3->addWidget(date_format_label);
layout3->addWidget(date_combo);
layout3->addStretch();
QHBoxLayout *layout4 = new QHBoxLayout();
layout4->setSpacing(10);
layout4->addWidget(second_label);
layout4->addWidget(second_switcher);
layout4->addStretch();
QHBoxLayout *layout5 = new QHBoxLayout();
layout5->setSpacing(10);
layout5->addWidget(week_label);
layout5->addWidget(week_switcher);
layout5->addStretch();
QHBoxLayout *layout6 = new QHBoxLayout();
layout6->setSpacing(10);
layout6->addWidget(date_label);
layout6->addWidget(date_switcher);
layout6->addStretch();
QHBoxLayout *layout7 = new QHBoxLayout();
layout7->setSpacing(10);
layout7->addWidget(battery_icon_label);
layout7->addWidget(battery_combo);
layout7->addStretch();
QHBoxLayout *layout8 = new QHBoxLayout();
layout8->setSpacing(10);
layout8->addWidget(battery_percentage_label);
layout8->addWidget(battery_percentage_switcher);
layout8->addStretch();
QHBoxLayout *layout9 = new QHBoxLayout();
layout9->setSpacing(10);
layout9->addWidget(battery_time_label);
layout9->addWidget(battery_time_switcher);
layout9->addStretch();
QHBoxLayout *layout10 = new QHBoxLayout();
layout10->setSpacing(10);
layout10->addWidget(show_app_label);
layout10->addWidget(app_switcher);
layout10->addStretch();
QHBoxLayout *layout11 = new QHBoxLayout();
layout11->setSpacing(10);
layout11->addWidget(show_desktop_label);
layout11->addWidget(desktop_switcher);
layout11->addStretch();
QHBoxLayout *layout12 = new QHBoxLayout();
layout12->setSpacing(10);
layout12->addWidget(show_icon_label);
layout12->addWidget(icon_switcher);
layout12->addStretch();
QHBoxLayout *layout13 = new QHBoxLayout();
layout13->setSpacing(10);
layout13->addWidget(show_places_label);
layout13->addWidget(places_switcher);
layout13->addStretch();
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(layout1);
layout->addLayout(layout2);
layout->addLayout(layout3);
layout->addLayout(layout4);
layout->addLayout(layout5);
layout->addLayout(layout6);
// if(sessionproxy->judge_power_is_exists_qt())
if(has_battery)
{
layout->addLayout(layout7);
layout->addLayout(layout8);
layout->addLayout(layout9);
}
layout->addLayout(layout10);
layout->addLayout(layout11);
layout->addLayout(layout12);
layout->addLayout(layout13);
layout->addStretch();
setLayout(layout);
layout->setSpacing(10);
layout->setContentsMargins(20, 20, 0, 0);
// splitter->addWidget(top_widget);
// splitter->addWidget(bottom_widget);
// QHBoxLayout *main_layout = new QHBoxLayout;
// main_layout->addStretch();
// main_layout->addWidget(splitter);
// main_layout->setSpacing(0);
// main_layout->setContentsMargins(0, 0, 0, 0);
// setLayout(main_layout);
// this->initSettingData();
this->setLanguage();
}
PanelWidget::~PanelWidget()
{
if (blur_label != NULL) {
delete blur_label;
blur_label = NULL;
}
if (transparency_label != NULL) {
delete transparency_label;
transparency_label = NULL;
}
if (date_format_label != NULL) {
delete date_format_label;
date_format_label = NULL;
}
if (second_label != NULL) {
delete second_label;
second_label = NULL;
}
if (week_label != NULL) {
delete week_label;
week_label = NULL;
}
if (date_label != NULL) {
delete date_label;
date_label = NULL;
}
if (battery_icon_label != NULL) {
delete battery_icon_label;
battery_icon_label = NULL;
}
if (battery_percentage_label != NULL) {
delete battery_percentage_label;
battery_percentage_label = NULL;
}
if (battery_time_label != NULL) {
delete battery_time_label;
battery_time_label = NULL;
}
if (show_app_label != NULL) {
delete show_app_label;
show_app_label = NULL;
}
if (show_desktop_label != NULL) {
delete show_desktop_label;
show_desktop_label = NULL;
}
if (show_icon_label != NULL) {
delete show_icon_label;
show_icon_label = NULL;
}
if (show_places_label != NULL) {
delete show_places_label;
show_places_label = NULL;
}
if (smart_radio != NULL) {
delete smart_radio;
smart_radio = NULL;
}
if (static_radio != NULL) {
delete static_radio;
static_radio = NULL;
}
if (clear_radio != NULL) {
delete clear_radio;
clear_radio = NULL;
}
if (transparency_slider != NULL) {
delete transparency_slider;
transparency_slider = NULL;
}
if (date_combo != NULL) {
delete date_combo;
date_combo = NULL;
}
if (second_switcher != NULL) {
delete second_switcher;
second_switcher = NULL;
}
if (week_switcher != NULL) {
delete week_switcher;
week_switcher = NULL;
}
if (date_switcher != NULL) {
delete date_switcher;
date_switcher = NULL;
}
if (battery_combo != NULL) {
delete battery_combo;
battery_combo = NULL;
}
if (battery_percentage_switcher != NULL) {
delete battery_percentage_switcher;
battery_percentage_switcher = NULL;
}
if (battery_time_switcher != NULL) {
delete battery_time_switcher;
battery_time_switcher = NULL;
}
if (app_switcher != NULL) {
delete app_switcher;
app_switcher = NULL;
}
if (desktop_switcher != NULL) {
delete desktop_switcher;
desktop_switcher = NULL;
}
if (icon_switcher != NULL) {
delete icon_switcher;
icon_switcher = NULL;
}
if (places_switcher != NULL) {
delete places_switcher;
places_switcher = NULL;
}
}
QString PanelWidget::settingModuleName()
{
return "PanelPage";
}
void PanelWidget::setLanguage() {
// title_label->setText(tr("Dash & Panel"));
// description_label->setText(tr("Manage Dash and Panel menu settings."));
// back_btn->setText(tr("Back"));
blur_label->setText(tr("Dash background blur type") + ":");
transparency_label->setText(tr("Panel Transparency") + ":");
date_format_label->setText(tr("Date & time format") + ":");
second_label->setText(tr("Display seconds") + ":");
week_label->setText(tr("Display week") + ":");
date_label->setText(tr("Display the date") + ":");
battery_icon_label->setText(tr("Display battery icon") + ":");
battery_percentage_label->setText(tr("Display battery percentage") + ":");
battery_time_label->setText(tr("Display battery remaining time") + ":");
smart_radio->setText(tr("Smart blur"));
static_radio->setText(tr("Static blur"));
clear_radio->setText(tr("Clear"));
show_app_label->setText(tr("Show applications") + ":");
show_desktop_label->setText(tr("Show system") + ":");//Show desktop
show_icon_label->setText(tr("Show icon") + ":");
show_places_label->setText(tr("Show places") + ":");
}
void PanelWidget::initSettingData()
{
if(this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui") {
emit this->requestMateOrUnityPanelData(true);
// app_switcher->switchedOn = sessionproxy->get_show_apps_qt();
// desktop_switcher->switchedOn = sessionproxy->get_show_desktop_qt();
// icon_switcher->switchedOn = sessionproxy->get_show_icon_qt();
// places_switcher->switchedOn = sessionproxy->get_show_places_qt();
}
else {//unity
emit this->requestMateOrUnityPanelData(false);
/*int default_value = sessionproxy->get_dash_blur_experimental_qt();
if(default_value == 2) {
smart_radio->setChecked(true);
static_radio->setChecked(false);
clear_radio->setChecked(false);
}
else if(default_value == 1) {
static_radio->setChecked(true);
smart_radio->setChecked(false);
clear_radio->setChecked(false);
}
else if(default_value == 0) {
clear_radio->setChecked(true);
static_radio->setChecked(false);
smart_radio->setChecked(false);
}
transparency_slider->setValue(sessionproxy->get_panel_transparency_qt());
QString cur_format = sessionproxy->get_time_format_qt();
QStringList timelist = sessionproxy->get_all_time_format_qt();
date_combo->clear();
date_combo->clearEditText();
date_combo->addItems(timelist);
QList::Iterator it = timelist.begin(), itend = timelist.end();
int initIndex = 0;
for(;it != itend; it++,initIndex++)
{
if(*it == cur_format)
break;
}
date_combo->setCurrentIndex(initIndex);
second_switcher->switchedOn = sessionproxy->get_show_seconds_qt();
week_switcher->switchedOn = sessionproxy->get_show_week_qt();
date_switcher->switchedOn = sessionproxy->get_show_date_qt();
QString cur_power = sessionproxy->get_power_icon_policy_qt();
m_powerlist = sessionproxy->get_all_power_icon_policy_qt();
battery_combo->clear();
battery_combo->clearEditText();
battery_combo->addItems(m_powerlist);
QList::Iterator ite = m_powerlist.begin(), iteend = m_powerlist.end();
int index = 0;
for(;ite != iteend; ite++,index++)
{
if(*ite == cur_power)
break;
}
battery_combo->setCurrentIndex(index);
battery_percentage_switcher->switchedOn = sessionproxy->get_show_power_percentage_qt();
battery_time_switcher->switchedOn = sessionproxy->get_show_power_time_qt();*/
}
this->initConnect();
}
void PanelWidget::onSendMatePanelValue(bool app, bool desktop, bool icon, bool places)
{
app_switcher->switchedOn = app;
desktop_switcher->switchedOn = desktop;
icon_switcher->switchedOn = icon;
places_switcher->switchedOn = places;
}
void PanelWidget::onSendUnityBlurAndTransparencyValue(int blur, double transparent)
{
if(blur == 2) {
smart_radio->setChecked(true);
static_radio->setChecked(false);
clear_radio->setChecked(false);
}
else if(blur == 1) {
static_radio->setChecked(true);
smart_radio->setChecked(false);
clear_radio->setChecked(false);
}
else if(blur == 0) {
clear_radio->setChecked(true);
static_radio->setChecked(false);
smart_radio->setChecked(false);
}
transparency_slider->setValue(transparent);
}
void PanelWidget::onSendUnityTimeValue(const QString &time_format, const QStringList &timelist, bool showSecond, bool showWeek, bool showDate)
{
QStringList m_timelist = timelist;
date_combo->clear();
date_combo->clearEditText();
date_combo->addItems(m_timelist);
QList::Iterator it = m_timelist.begin(), itend = m_timelist.end();
int initIndex = 0;
for(;it != itend; it++,initIndex++)
{
if(*it == time_format)
break;
}
date_combo->setCurrentIndex(initIndex);
second_switcher->switchedOn = showSecond;
week_switcher->switchedOn = showWeek;
date_switcher->switchedOn = showDate;
}
void PanelWidget::onSendUnityPanelPowerValue(const QString &cur_power, const QStringList &powerlist, bool showPower, bool showBatteryTime)
{
m_powerlist.clear();
m_powerlist = powerlist;
battery_combo->clear();
battery_combo->clearEditText();
battery_combo->addItems(m_powerlist);
QList::Iterator ite = m_powerlist.begin(), iteend = m_powerlist.end();
int index = 0;
for(;ite != iteend; ite++,index++)
{
if(*ite == cur_power)
break;
}
battery_combo->setCurrentIndex(index);
battery_percentage_switcher->switchedOn = showPower;
battery_time_switcher->switchedOn = showBatteryTime;
}
void PanelWidget::initConnect() {
// connect(back_btn, SIGNAL(clicked()), this, SIGNAL(showSettingMainWidget()));
connect(smart_radio, SIGNAL(clicked()), this, SLOT(setRadioButtonRowStatus()));
connect(static_radio, SIGNAL(clicked()), this, SLOT(setRadioButtonRowStatus()));
connect(clear_radio, SIGNAL(clicked()), this, SLOT(setRadioButtonRowStatus()));
connect(transparency_slider, SIGNAL(valueChanged(double)), this, SLOT(setTransparencyValue(double)));
connect(date_combo, SIGNAL(currentIndexChanged(QString)), this, SLOT(setDateFormat(QString)));
connect(second_switcher, SIGNAL(clicked()), this, SLOT(setDisplaySeconds()));
connect(week_switcher, SIGNAL(clicked()), this, SLOT(setDisplayWeek()));
connect(date_switcher, SIGNAL(clicked()), this, SLOT(setDisplayDate()));
connect(battery_combo, SIGNAL(currentIndexChanged(QString)), this, SLOT(setShowBatteryIcon(QString)));
connect(battery_percentage_switcher, SIGNAL(clicked()), this, SLOT(setDisplayBatteryPercentage()));
connect(battery_time_switcher, SIGNAL(clicked()), this, SLOT(setDisplayBatteryTime()));
connect(app_switcher, SIGNAL(clicked()), this, SLOT(showApplications()));
connect(desktop_switcher, SIGNAL(clicked()), this, SLOT(showDesktop()));
connect(icon_switcher, SIGNAL(clicked()), this, SLOT(showIcon()));
connect(places_switcher, SIGNAL(clicked()), this, SLOT(showPlaces()));
// connect(sessionproxy, SIGNAL(string_value_notify(QString, QString)), this, SLOT(panelwidget_notify_string(QString, QString)));
// connect(sessionproxy, SIGNAL(bool_value_notify(QString, bool)), this, SLOT(panelwidget_notify_bool(QString, bool)));
}
void PanelWidget::panelwidget_notify_string(QString key, QString value)
{
if (key == "icon-policy") {
QList::Iterator it = m_powerlist.begin(), itend = m_powerlist.end();
int index = -1;
bool exist = false;
for(;it != itend; it++)
{
++index;
if(*it == value) {
exist = true;
break;
}
}
if (exist) {
exist = false;
battery_combo->setCurrentIndex(index);
}
else
battery_combo->setCurrentIndex(-1);
}
}
void PanelWidget::panelwidget_notify_bool(QString key, bool value)
{
if (key == "show-seconds") {
second_switcher->switchedOn = value;
}
else if (key == "show-day") {
week_switcher->switchedOn = value;
}
else if (key == "show-date") {
date_switcher->switchedOn = value;
}
else if (key == "show-time") {
battery_time_switcher->switchedOn = value;
}
else if (key == "show-percentage") {
battery_percentage_switcher->switchedOn = value;
}
else if (key == "show-applications") {
app_switcher->switchedOn = value;
}
else if (key == "show-desktop") {
desktop_switcher->switchedOn = value;
}
else if (key == "show-icon") {
icon_switcher->switchedOn = value;
}
else if (key == "show-places") {
places_switcher->switchedOn = value;
}
}
void PanelWidget::setTransparencyValue(double value)
{
emit resetPanelTransparencyValue(value);
// sessionproxy->set_panel_transparency_qt(value);
}
void PanelWidget::setDateFormat(QString selected) {
emit resetDateFormat(selected);
// sessionproxy->set_time_format_qt(selected);
}
void PanelWidget::setShowBatteryIcon(QString selected) {
emit resetShowBatteryIcon(selected);
// sessionproxy->set_power_icon_policy_qt(selected);
}
//TODO: 设计一个枚举变量作为标记,用一个函数去调用dbus设置各个值
void PanelWidget::setRadioButtonRowStatus(/*bool status*/)
{
QObject *obj = sender(); //返回发出信号的对象,用QObject类型接收
QRadioButton* pbtn = qobject_cast(obj);
QString obj_name = pbtn->objectName();
if(obj_name == "smart_radio")
{
emit resetDashBlurExperimental(2);
// sessionproxy->set_dash_blur_experimental_qt(2);
}
else if(obj_name == "static_radio")
{
emit resetDashBlurExperimental(1);
// sessionproxy->set_dash_blur_experimental_qt(1);
}
else if(obj_name == "clear_radio")
{
emit resetDashBlurExperimental(0);
// sessionproxy->set_dash_blur_experimental_qt(0);
}
}
void PanelWidget::setDisplaySeconds()
{
emit resetDisplaySeconds(second_switcher->switchedOn);
// sessionproxy->set_show_seconds_qt(second_switcher->switchedOn);
}
void PanelWidget::setDisplayWeek()
{
emit resetDisplayWeek(week_switcher->switchedOn);
// sessionproxy->set_show_week_qt(week_switcher->switchedOn);
}
void PanelWidget::setDisplayDate()
{
emit resetDisplayDate(date_switcher->switchedOn);
// sessionproxy->set_show_date_qt(date_switcher->switchedOn);
}
void PanelWidget::setDisplayBatteryPercentage()
{
emit resetDisplayBatteryPercentage(battery_percentage_switcher->switchedOn);
// sessionproxy->set_show_power_percentage_qt(battery_percentage_switcher->switchedOn);
}
void PanelWidget::setDisplayBatteryTime()
{
emit resetDisplayBatteryTime(battery_time_switcher->switchedOn);
// sessionproxy->set_show_power_time_qt(battery_time_switcher->switchedOn);
}
void PanelWidget::showApplications()
{
emit resetShowApplications(app_switcher->switchedOn);
// sessionproxy->set_show_apps_qt(app_switcher->switchedOn);
}
void PanelWidget::showDesktop()
{
emit resetShowDesktop(desktop_switcher->switchedOn);
// sessionproxy->set_show_desktop_qt(desktop_switcher->switchedOn);
}
void PanelWidget::showIcon()
{
emit resetShowIcon(icon_switcher->switchedOn);
// sessionproxy->set_show_icon_qt(icon_switcher->switchedOn);
}
void PanelWidget::showPlaces()
{
emit resetShowPlaces(places_switcher->switchedOn);
// sessionproxy->set_show_places_qt(places_switcher->switchedOn);
}
youker-assistant/setting/panelwidget.h 0000664 0001750 0001750 00000007610 15227663670 017200 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 PANELWIDGET_H
#define PANELWIDGET_H
#include
#include "../component/kylinswitcher.h"
class QLabel;
class QPushButton;
class QComboBox;
class QSlider;
class QDoubleSpinBox;
class QRadioButton;
#include "settingmodulelpage.h"
class PanelWidget : public SettingModulePage
{
Q_OBJECT
public:
explicit PanelWidget(QWidget *parent = 0, QString cur_desktop = "", bool has_battery = false);
~PanelWidget();
void setLanguage();
void initConnect();
void initSettingData() Q_DECL_OVERRIDE;
QString settingModuleName() Q_DECL_OVERRIDE;
signals:
void requestMateOrUnityPanelData(bool isMate);
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);
// void showSettingMainWidget();
public slots:
void setDateFormat(QString selected);
void setShowBatteryIcon(QString selected);
void setTransparencyValue(double value);
void setRadioButtonRowStatus(/*bool status*/);
void setDisplaySeconds();
void setDisplayWeek();
void setDisplayDate();
void setDisplayBatteryPercentage();
void setDisplayBatteryTime();
void showApplications();
void showDesktop();
void showIcon();
void showPlaces();
void panelwidget_notify_string(QString key, QString value);
void panelwidget_notify_bool(QString key, bool value);
void onSendMatePanelValue(bool app, bool desktop, bool icon, bool places);
void onSendUnityBlurAndTransparencyValue(int blur, double transparent);
void onSendUnityTimeValue(const QString &time_format, const QStringList &timelist, bool showSecond, bool showWeek, bool showDate);
void onSendUnityPanelPowerValue(const QString &cur_power, const QStringList &powerlist, bool showPower, bool showBatteryTime);
private:
QString desktop;
QStringList m_powerlist;
QLabel *blur_label;
QLabel *transparency_label;
QLabel *date_format_label;
QLabel *second_label;
QLabel *week_label;
QLabel *date_label;
QLabel *battery_icon_label;
QLabel *battery_percentage_label;
QLabel *battery_time_label;
QLabel *show_app_label;
QLabel *show_desktop_label;
QLabel *show_icon_label;
QLabel *show_places_label;
QRadioButton *smart_radio;
QRadioButton *static_radio;
QRadioButton *clear_radio;
QDoubleSpinBox *transparency_slider;
QComboBox *date_combo;
KylinSwitcher *second_switcher;
KylinSwitcher *week_switcher;
KylinSwitcher *date_switcher;
QComboBox *battery_combo;
KylinSwitcher *battery_percentage_switcher;
KylinSwitcher *battery_time_switcher;
KylinSwitcher *app_switcher;
KylinSwitcher *desktop_switcher;
KylinSwitcher *icon_switcher;
KylinSwitcher *places_switcher;
};
#endif // PANELWIDGET_H
youker-assistant/setting/deadpixelwidget.cpp 0000664 0001750 0001750 00000005255 15227663670 020376 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 "deadpixelwidget.h"
#include
#include
#include
DeadpixelWidget::DeadpixelWidget(QWidget *parent) :
QWidget(parent)
{
this->qtui = NULL;
tip_label = new QLabel();
tip_label->setWordWrap(true);//QLabel自动换行
tip_label->setFixedWidth(500);
ok_btn = new QPushButton();
ok_btn->setFixedSize(91, 25);
ok_btn->setObjectName("blackButton");
ok_btn->setFocusPolicy(Qt::NoFocus);
// QVBoxLayout *layout = new QVBoxLayout();
// layout->addStretch();
// layout->addWidget(tip_label);
// layout->addWidget(ok_btn);
// layout->addStretch();
// bottom_widget->setLayout(layout);
// splitter->addWidget(top_widget);
// splitter->addWidget(bottom_widget);
QHBoxLayout *main_layout = new QHBoxLayout(this);
// main_layout->addWidget(splitter);
main_layout->addStretch();
main_layout->addWidget(tip_label);
main_layout->addWidget(ok_btn);
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();
}
DeadpixelWidget::~DeadpixelWidget()
{
if(qtui != NULL)
{
delete qtui;
qtui = NULL;
}
}
void DeadpixelWidget::setLanguage()
{
// title_label->setText(tr("Monitor Check"));
// description_label->setText(tr("Monitor Check."));
// back_btn->setText(tr("Back"));
tip_label->setText(tr("Left-click to change the color, right-click to exit from this detection."));
ok_btn->setText(tr("OK"));
}
void DeadpixelWidget::initConnect()
{
// connect(back_btn, SIGNAL(clicked()), this, SIGNAL(showSettingMainWidget()));
connect(ok_btn, SIGNAL(clicked()), this, SLOT(startMonitorCheck()));
}
void DeadpixelWidget::startMonitorCheck() {
if (this->qtui)
{
delete this->qtui;
this->qtui = NULL;
}
this->qtui = new QUIBO();
}
youker-assistant/setting/iconwidget.cpp 0000664 0001750 0001750 00000031332 15227663670 017362 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 "iconwidget.h"
#include
#include
#include
#include
IconWidget::IconWidget(QWidget *parent, QString cur_desktop) :
SettingModulePage(parent),desktop(cur_desktop)
{
theme_label = new QLabel();
// show_label = new QLabel();
computer_label = new QLabel();
folder_label = new QLabel();
network_label = new QLabel();
recycle_label = new QLabel();
disk_label = new QLabel();
theme_combo = new QComboBox();
// show_switcher = new KylinSwitcher();
computer_switcher = new KylinSwitcher();
folder_switcher = new KylinSwitcher();
network_switcher = new KylinSwitcher();
recycle_switcher = new KylinSwitcher();
disk_switcher = new KylinSwitcher();
if (this->desktop != "mate" && this->desktop != "MATE")
{
computer_label->hide();
computer_switcher->hide();
}
theme_label->setFixedWidth(150);
// show_label->setFixedWidth(150);
computer_label->setFixedWidth(150);
folder_label->setFixedWidth(150);
network_label->setFixedWidth(150);
recycle_label->setFixedWidth(150);
disk_label->setFixedWidth(150);
// switcher = new KylinSwitcher();
// connect(switcher, SIGNAL(clicked()), this, SLOT(changeSwitcherStatus()));
QHBoxLayout *layout1 = new QHBoxLayout();
layout1->setSpacing(10);
layout1->addWidget(theme_label);
layout1->addWidget(theme_combo);
layout1->addStretch();
// QHBoxLayout *layout2 = new QHBoxLayout();
// layout2->setSpacing(10);
// layout2->addWidget(show_label);
// layout2->addWidget(show_switcher);
// layout2->addStretch();
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->setSpacing(10);
layout3->addWidget(computer_label);
layout3->addWidget(computer_switcher);
layout3->addStretch();
QHBoxLayout *layout4 = new QHBoxLayout();
layout4->setSpacing(10);
layout4->addWidget(folder_label);
layout4->addWidget(folder_switcher);
layout4->addStretch();
QHBoxLayout *layout5 = new QHBoxLayout();
layout5->setSpacing(10);
layout5->addWidget(network_label);
layout5->addWidget(network_switcher);
layout5->addStretch();
QHBoxLayout *layout6 = new QHBoxLayout();
layout6->setSpacing(10);
layout6->addWidget(recycle_label);
layout6->addWidget(recycle_switcher);
layout6->addStretch();
QHBoxLayout *layout7 = new QHBoxLayout();
layout7->setSpacing(10);
layout7->addWidget(disk_label);
layout7->addWidget(disk_switcher);
layout7->addStretch();
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(layout1);
// layout->addLayout(layout2);
layout->addLayout(layout3);
layout->addLayout(layout4);
layout->addLayout(layout5);
layout->addLayout(layout6);
layout->addLayout(layout7);
layout->addStretch();
setLayout(layout);
layout->setSpacing(10);
layout->setContentsMargins(20, 20, 0, 0);
// QGridLayout *grid_layout = new QGridLayout;
// grid_layout->addWidget(theme_label, 0, 0/* ,1, 1*/);
// grid_layout->addWidget(theme_combo, 0, 1/* ,1, 1*/);
// grid_layout->addWidget(folder_label, 1, 0/* ,1, 1*/);
// grid_layout->addWidget(show_switcher, 1, 1/* ,1, 1*/);
// grid_layout->addWidget(show_label, 2, 0 /*,1, 1*/);
// grid_layout->addWidget(folder_switcher, 2, 1/* ,1, 1*/);
// grid_layout->addWidget(network_label, 3, 0 /*,1, 1*/);
// grid_layout->addWidget(network_switcher, 3, 1 /*,1, 1*/);
// grid_layout->addWidget(recycle_label, 4, 0 /*,1, 1*/);
// grid_layout->addWidget(recycle_switcher, 4, 1/* ,1, 1*/);
// grid_layout->addWidget(disk_label, 5, 0/* ,1, 1*/);
// grid_layout->addWidget(disk_switcher, 5, 1/* ,1, 1*/);
// grid_layout->setColumnStretch(0,1);
// grid_layout->setColumnStretch(1,3);
// bottom_widget->setLayout(grid_layout);
// splitter->addWidget(top_widget);
// splitter->addWidget(bottom_widget);
// for(int i = 0; icount();i++)
// {
// QSplitterHandle *handle = splitter->handle(i);
// handle->setEnabled(false);
// }
// QHBoxLayout *main_layout = new QHBoxLayout;
// main_layout->addStretch();
// main_layout->addWidget(splitter);
// main_layout->setSpacing(0);
// main_layout->setContentsMargins(0, 0, 0, 0);
// setLayout(main_layout);
// this->initSettingData();
this->setLanguage();
}
IconWidget::~IconWidget()
{
if (theme_label != NULL) {
delete theme_label;
theme_label = NULL;
}
if (computer_label != NULL) {
delete computer_label;
computer_label = NULL;
}
if (folder_label != NULL) {
delete folder_label;
folder_label = NULL;
}
if (network_label != NULL) {
delete network_label;
network_label = NULL;
}
if (recycle_label != NULL) {
delete recycle_label;
recycle_label = NULL;
}
if (disk_label != NULL) {
delete disk_label;
disk_label = NULL;
}
if (theme_combo != NULL) {
delete theme_combo;
theme_combo = NULL;
}
if (computer_switcher != NULL) {
delete computer_switcher;
computer_switcher = NULL;
}
if (folder_switcher != NULL) {
delete folder_switcher;
folder_switcher = NULL;
}
if (network_switcher != NULL) {
delete network_switcher;
network_switcher = NULL;
}
if (recycle_switcher != NULL) {
delete recycle_switcher;
recycle_switcher = NULL;
}
if (disk_switcher != NULL) {
delete disk_switcher;
disk_switcher = NULL;
}
}
QString IconWidget::settingModuleName()
{
return "IconPage";
}
void IconWidget::changeSwitcherStatus() {
}
void IconWidget::setLanguage() {
// title_label->setText(tr("Desktop Icons"));
// description_label->setText(tr("Set the desktop icon theme and the visibility of desktop icons."));
// back_btn->setText(tr("Back"));
theme_label->setText(tr("Icon theme") + ":");
// show_label->setText(tr("Show Desktop Icons") + ":");
computer_label->setText(tr("Computer") + ":");
folder_label->setText(tr("Home Folder") + ":");
network_label->setText(tr("Network") + ":");
recycle_label->setText(tr("Trash") + ":");
disk_label->setText(tr("Mounted Volumes") + ":");
}
void IconWidget::onReceiveIconThemeList(const QString ¤tTheme, const QStringList &themeList)
{
iconlist.clear();
iconlist = themeList;
theme_combo->clear();
theme_combo->clearEditText();
theme_combo->addItems(iconlist);
QList::Iterator it = iconlist.begin(), itend = iconlist.end();
int initIndex = 0;
for(;it != itend; it++,initIndex++)
{
if(*it == currentTheme)
break;
}
theme_combo->setCurrentIndex(initIndex);
}
void IconWidget::onReceiveDisplayIconValue(bool computer, bool folder, bool network, bool recycle, bool disk)
{
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
{
computer_switcher->switchedOn = computer;
}
folder_switcher->switchedOn = folder;
network_switcher->switchedOn = network;
recycle_switcher->switchedOn = recycle;
disk_switcher->switchedOn = disk;
}
void IconWidget::initSettingData()
{
emit this->requestIconData();
this->initConnect();
/*QString current_icon_theme = sessionproxy->get_icon_theme_qt();
iconlist = sessionproxy->get_icon_themes_qt();
theme_combo->clear();
theme_combo->clearEditText();
theme_combo->addItems(iconlist);
QList::Iterator it = iconlist.begin(), itend = iconlist.end();
int initIndex = 0;
for(;it != itend; it++,initIndex++)
{
if(*it == current_icon_theme)
break;
}
theme_combo->setCurrentIndex(initIndex);
// show_switcher->setSwitchStatus(sessionproxy->get_show_desktop_icons_qt());
// folder_switcher->setSwitchStatus(sessionproxy->get_show_homefolder_qt());
// network_switcher->setSwitchStatus(sessionproxy->get_show_network_qt());
// recycle_switcher->setSwitchStatus(sessionproxy->get_show_trash_qt());
// disk_switcher->setSwitchStatus(sessionproxy->get_show_devices_qt());
// show_switcher->switchedOn = sessionproxy->get_show_desktop_icons_qt();
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
{
computer_switcher->switchedOn = sessionproxy->get_show_computer_qt();
}
folder_switcher->switchedOn = sessionproxy->get_show_homefolder_qt();
network_switcher->switchedOn = sessionproxy->get_show_network_qt();
recycle_switcher->switchedOn = sessionproxy->get_show_trash_qt();
disk_switcher->switchedOn = sessionproxy->get_show_devices_qt();
*/
}
void IconWidget::initConnect() {
// connect(back_btn, SIGNAL(clicked()), this, SIGNAL(showSettingMainWidget()));
// connect(theme_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(setIconTheme()));
connect(theme_combo, SIGNAL(currentIndexChanged(QString)), this, SLOT(setIconTheme(QString)));
// connect(show_switcher, SIGNAL(clicked()), this, SLOT(setShowDesktopIcons()));
connect(computer_switcher, SIGNAL(clicked()), this, SLOT(setComputerIcon()));
connect(folder_switcher, SIGNAL(clicked()), this, SLOT(setFolderIcon()));
connect(network_switcher, SIGNAL(clicked()), this, SLOT(setNetworkIcon()));
connect(recycle_switcher, SIGNAL(clicked()), this, SLOT(setRecycleBinIcon()));
connect(disk_switcher, SIGNAL(clicked()), this, SLOT(setDiskIcon()));
//20180101
// connect(sessionproxy, SIGNAL(string_value_notify(QString, QString)), this, SLOT(iconwidget_notify_string(QString, QString)));
// connect(sessionproxy, SIGNAL(bool_value_notify(QString, bool)), this, SLOT(iconwidget_notify_bool(QString, bool)));
}
void IconWidget::iconwidget_notify_string(QString key, QString value)
{
if (key == "icon-theme") {
QList::Iterator it = iconlist.begin(), itend = iconlist.end();
int index = -1;
bool exist = false;
for(;it != itend; it++)
{
++index;
if(*it == value) {
exist = true;
break;
}
}
if (exist) {
exist = false;
theme_combo->setCurrentIndex(index);
}
else
theme_combo->setCurrentIndex(-1);
}
}
void IconWidget::iconwidget_notify_bool(QString key, bool value)
{
// if (key == "show-desktop-icons") {
// show_switcher->switchedOn = value;
// }
if (key == "computer-icon-visible") {
computer_switcher->switchedOn = value;
}
else if (key == "home-icon-visible")
{
folder_switcher->switchedOn = value;
}
else if (key == "network-icon-visible") {
network_switcher->switchedOn = value;
}
else if (key == "trash-icon-visible") {
recycle_switcher->switchedOn = value;
}
else if (key == "volumes-visible") {
disk_switcher->switchedOn = value;
}
}
void IconWidget::setIconTheme(QString selectTheme) {
// sessionproxy->set_icon_theme_qt(selectTheme);
emit resetIconTheme(selectTheme);
}
//void IconWidget::setShowDesktopIcons() {
// sessionproxy->set_show_desktop_icons_qt(show_switcher->switchedOn);
//}
void IconWidget::setComputerIcon() {
// emit changeSystemTheme(name);
emit displayComputerIcon(computer_switcher->switchedOn);
// sessionproxy->set_show_computer_qt(computer_switcher->switchedOn);
}
void IconWidget::setFolderIcon() {
emit displayFolderIcon(folder_switcher->switchedOn);
// sessionproxy->set_show_homefolder_qt(folder_switcher->switchedOn);
}
void IconWidget::setNetworkIcon() {
emit displayNetworkIcon(network_switcher->switchedOn);
// sessionproxy->set_show_network_qt(network_switcher->switchedOn);
}
void IconWidget::setRecycleBinIcon() {
emit displayRecycleBinIcon(recycle_switcher->switchedOn);
// sessionproxy->set_show_trash_qt(recycle_switcher->switchedOn);
}
void IconWidget::setDiskIcon() {
emit displayDiskIcon(disk_switcher->switchedOn);
// sessionproxy->set_show_devices_qt(disk_switcher->switchedOn);
}
youker-assistant/setting/filemanagerwidget.cpp 0000664 0001750 0001750 00000033176 15227663670 020714 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 "filemanagerwidget.h"
#include
#include
#include
#include
FileManagerWidget::FileManagerWidget(QWidget *parent) :
SettingModulePage(parent)
{
location_label = new QLabel();
mount_media_label = new QLabel();
open_folder_label = new QLabel();
autorun_program_label = new QLabel();
icon_size_label = new QLabel();
cache_time_label = new QLabel();
cache_size_label = new QLabel();
size_value_label = new QLabel();
time_value_label = new QLabel();
cache_value_label = new QLabel();
location_switcher = new KylinSwitcher();
mount_media_switcher = new KylinSwitcher();
open_folder_switcher = new KylinSwitcher();
autorun_program_switcher = new KylinSwitcher();
icon_size_slider = new QSlider(Qt::Horizontal);
icon_size_slider->setRange(16, 512);
icon_size_slider->setSingleStep(1);
// icon_size_slider->setTickPosition(QSlider::TicksRight);
icon_size_slider->setFocusPolicy(Qt::NoFocus);
// icon_size_slider->setMinimum(1);
// icon_size_slider->setMaximum(10);
// icon_size_slider->setValue(2);
cache_time_slider = new QSlider(Qt::Horizontal);
cache_time_slider->setRange(-1, 180);
cache_time_slider->setSingleStep(1);
// cache_time_slider->setTickPosition(QSlider::TicksRight);
cache_time_slider->setFocusPolicy(Qt::NoFocus);
// cache_time_slider->setValue(2);
cache_size_slider = new QSlider(Qt::Horizontal);
cache_size_slider->setRange(-1, 512);
cache_size_slider->setSingleStep(1);
// cache_size_slider->setTickPosition(QSlider::TicksRight);
cache_size_slider->setFocusPolicy(Qt::NoFocus);
// cache_size_slider->setValue(2);
location_label->setFixedWidth(245);
mount_media_label->setFixedWidth(245);
open_folder_label->setFixedWidth(245);
autorun_program_label->setFixedWidth(245);
icon_size_label->setFixedWidth(245);
cache_time_label->setFixedWidth(245);
cache_size_label->setFixedWidth(245);
// QFormLayout *form_layout = new QFormLayout();
// form_layout->setSpacing(10);
// form_layout->setHorizontalSpacing(5);
// form_layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
// form_layout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
// form_layout->addRow(QString(tr("Display entry location") + ":"), location_switcher);
// form_layout->addRow(QString(tr("Automatically mount media") + ":"), mount_media_switcher);
// form_layout->addRow(QString(tr("Automatically open a folder") + ":"), open_folder_switcher);
// form_layout->addRow(QString(tr("Prompt autorun programs") + ":"), autorun_program_switcher);
// form_layout->addRow(QString(tr("Thumbnail icon size (pixels)") + ":"), icon_size_slider);
// form_layout->addRow(QString(tr("Thumbnail cache time (days)") + ":"), cache_time_slider);
// form_layout->addRow(QString(tr("Maximum thumbnail cache size (MB)") + ":"), cache_size_slider);
QHBoxLayout *layout1 = new QHBoxLayout();
layout1->setSpacing(10);
layout1->addWidget(location_label);
layout1->addWidget(location_switcher);
layout1->addStretch();
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->setSpacing(10);
layout2->addWidget(mount_media_label);
layout2->addWidget(mount_media_switcher);
layout2->addStretch();
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->setSpacing(10);
layout3->addWidget(open_folder_label);
layout3->addWidget(open_folder_switcher);
layout3->addStretch();
QHBoxLayout *layout4 = new QHBoxLayout();
layout4->setSpacing(10);
layout4->addWidget(autorun_program_label);
layout4->addWidget(autorun_program_switcher);
layout4->addStretch();
QHBoxLayout *layout5 = new QHBoxLayout();
layout5->setSpacing(10);
layout5->addWidget(icon_size_label);
layout5->addWidget(icon_size_slider);
layout5->addWidget(size_value_label);
layout5->addStretch();
QHBoxLayout *layout6 = new QHBoxLayout();
layout6->setSpacing(10);
layout6->addWidget(cache_time_label);
layout6->addWidget(cache_time_slider);
layout6->addWidget(time_value_label);
layout6->addStretch();
QHBoxLayout *layout7 = new QHBoxLayout();
layout7->setSpacing(10);
layout7->addWidget(cache_size_label);
layout7->addWidget(cache_size_slider);
layout7->addWidget(cache_value_label);
layout7->addStretch();
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(layout1);
layout->addLayout(layout2);
layout->addLayout(layout3);
layout->addLayout(layout4);
layout->addLayout(layout5);
layout->addLayout(layout6);
layout->addLayout(layout7);
layout->addStretch();
setLayout(layout);
layout->setSpacing(10);
layout->setContentsMargins(20, 20, 0, 0);
// setLayout(form_layout);
// splitter->addWidget(top_widget);
// splitter->addWidget(bottom_widget);
// QHBoxLayout *main_layout = new QHBoxLayout;
// main_layout->addStretch();
// main_layout->addWidget(splitter);
// main_layout->setSpacing(0);
// main_layout->setContentsMargins(0, 0, 0, 0);
// setLayout(main_layout);
// this->initSettingData();
this->setLanguage();
}
FileManagerWidget::~FileManagerWidget()
{
if (location_label != NULL) {
delete location_label;
location_label = NULL;
}
if (mount_media_label != NULL) {
delete mount_media_label;
mount_media_label = NULL;
}
if (open_folder_label != NULL) {
delete open_folder_label;
open_folder_label = NULL;
}
if (autorun_program_label != NULL) {
delete autorun_program_label;
autorun_program_label = NULL;
}
if (icon_size_label != NULL) {
delete icon_size_label;
icon_size_label = NULL;
}
if (size_value_label != NULL) {
delete size_value_label;
size_value_label = NULL;
}
if (cache_time_label != NULL) {
delete cache_time_label;
cache_time_label = NULL;
}
if (time_value_label != NULL) {
delete time_value_label;
time_value_label = NULL;
}
if (cache_size_label != NULL) {
delete cache_size_label;
cache_size_label = NULL;
}
if (cache_value_label != NULL) {
delete cache_value_label;
cache_value_label = NULL;
}
if (location_switcher != NULL) {
delete location_switcher;
location_switcher = NULL;
}
if (mount_media_switcher != NULL) {
delete mount_media_switcher;
mount_media_switcher = NULL;
}
if (open_folder_switcher != NULL) {
delete open_folder_switcher;
open_folder_switcher = NULL;
}
if (autorun_program_switcher != NULL) {
delete autorun_program_switcher;
autorun_program_switcher = NULL;
}
if (icon_size_slider != NULL) {
delete icon_size_slider;
icon_size_slider = NULL;
}
if (cache_time_slider != NULL) {
delete cache_time_slider;
cache_time_slider = NULL;
}
if (cache_size_slider != NULL) {
delete cache_size_slider;
cache_size_slider = NULL;
}
}
QString FileManagerWidget::settingModuleName()
{
return "FMPage";
}
void FileManagerWidget::setLanguage() {
// title_label->setText(tr("File Manager"));
// description_label->setText(tr("Manage the Nautilus file manager. Tips: if the thumbnail's cache time or size is set to -1, it will not be checked."));
// back_btn->setText(tr("Back"));
location_label->setText(tr("Display entry location") + ":");
mount_media_label->setText(tr("Automatically mount media") + ":");
open_folder_label->setText(tr("Automatically open a folder") + ":");
autorun_program_label->setText(tr("Prompt autorun programs") + ":");
icon_size_label->setText(tr("Thumbnail icon size (pixels)") + ":");
cache_time_label->setText(tr("Thumbnail cache time (days)") + ":");
cache_size_label->setText(tr("Maximum thumbnail cache size (MB)") + ":");
}
void FileManagerWidget::initSettingData()
{
emit requestFileManagerData();
// location_switcher->switchedOn = sessionproxy->get_location_replace_pathbar_qt();
// mount_media_switcher->switchedOn = sessionproxy->get_auto_mount_media_qt();
// open_folder_switcher->switchedOn = sessionproxy->get_auto_open_folder_qt();
// autorun_program_switcher->switchedOn = sessionproxy->get_prompt_autorun_programs_qt();
// icon_size_slider->setValue(sessionproxy->get_thumbnail_icon_size_qt());
// cache_time_slider->setValue(sessionproxy->get_thumbnail_cache_time_qt());
// cache_size_slider->setValue(sessionproxy->get_thumbnail_cache_size_qt());
// size_value_label->setText(QString::number(icon_size_slider->value()));
// time_value_label->setText(QString::number(cache_time_slider->value()));
// cache_value_label->setText(QString::number(cache_size_slider->value()));
this->initConnect();
}
void FileManagerWidget::onSendFileManagerData(bool locationReplacePathbar, bool autoMountMedia, bool autoOpenFolder, bool promptAutorunPrograms, int thumbnailIconSize, int thumbnailCacheTime, int thumbnailCacheSize)
{
location_switcher->switchedOn = locationReplacePathbar;
mount_media_switcher->switchedOn = autoMountMedia;
open_folder_switcher->switchedOn = autoOpenFolder;
autorun_program_switcher->switchedOn = promptAutorunPrograms;
icon_size_slider->setValue(thumbnailIconSize);
cache_time_slider->setValue(thumbnailCacheTime);
cache_size_slider->setValue(thumbnailCacheSize);
size_value_label->setText(QString::number(icon_size_slider->value()));
time_value_label->setText(QString::number(cache_time_slider->value()));
cache_value_label->setText(QString::number(cache_size_slider->value()));
}
void FileManagerWidget::initConnect() {
// connect(back_btn, SIGNAL(clicked()), this, SIGNAL(showSettingMainWidget()));
connect(location_switcher, SIGNAL(clicked()), this, SLOT(setLocation()));
connect(mount_media_switcher, SIGNAL(clicked()), this, SLOT(setMountMedia()));
connect(open_folder_switcher, SIGNAL(clicked()), this, SLOT(setOpenFolder()));
connect(autorun_program_switcher, SIGNAL(clicked()), this, SLOT(setAutorunProgram()));
connect(icon_size_slider, SIGNAL(valueChanged(int)), this, SLOT(setIconSizeValue(int)));
connect(cache_time_slider, SIGNAL(valueChanged(int)), this, SLOT(setCacheTimeValue(int)));
connect(cache_size_slider, SIGNAL(valueChanged(int)), this, SLOT(setCacheSizeValue(int)));
// connect(sessionproxy, SIGNAL(bool_value_notify(QString, bool)), this, SLOT(nautiluswidget_notify_bool(QString, bool)));
// connect(sessionproxy, SIGNAL(int_value_notify(QString, int)), this, SLOT(nautiluswidget_notify_int(QString, int)));
}
void FileManagerWidget::nautiluswidget_notify_bool(QString key, bool value)
{
if (key == "always-use-location-entry") {
location_switcher->switchedOn = value;
}
else if (key == "automount") {
mount_media_switcher->switchedOn = value;
}
else if (key == "automount-open") {
open_folder_switcher->switchedOn = value;
}
else if (key == "autorun-never") {
autorun_program_switcher->switchedOn = value;
}
}
void FileManagerWidget::nautiluswidget_notify_int(QString key, int value)
{
if (key == "thumbnail-size") {
icon_size_slider->setValue(value);
size_value_label->setText(QString::number(value));
}
else if (key == "maximum-age") {
cache_time_slider->setValue(value);
time_value_label->setText(QString::number(value));
}
else if (key == "maximum-size") {
cache_size_slider->setValue(value);
cache_value_label->setText(QString::number(value));
}
}
void FileManagerWidget::setLocation()
{
emit resetLocationReplacePathbar(location_switcher->switchedOn);
// sessionproxy->set_location_replace_pathbar_qt(location_switcher->switchedOn);
}
void FileManagerWidget::setMountMedia()
{
emit resetAutoMountMedia(mount_media_switcher->switchedOn);
// sessionproxy->set_auto_mount_media_qt(mount_media_switcher->switchedOn);
}
void FileManagerWidget::setOpenFolder()
{
emit resetAutoOpenFolder(open_folder_switcher->switchedOn);
// sessionproxy->set_auto_open_folder_qt(open_folder_switcher->switchedOn);
}
void FileManagerWidget::setAutorunProgram()
{
emit resetPromptAutorunPrograms(autorun_program_switcher->switchedOn);
// sessionproxy->set_prompt_autorun_programs_qt(autorun_program_switcher->switchedOn);
}
void FileManagerWidget::setIconSizeValue(int value)
{
size_value_label->setText(QString::number(value));
emit resetThumbnailIconSize(value);
// sessionproxy->set_thumbnail_icon_size_qt(value);
}
void FileManagerWidget::setCacheTimeValue(int value)
{
time_value_label->setText(QString::number(value));
emit resetThumbnailCacheTime(value);
// sessionproxy->set_thumbnail_cache_time_qt(value);
}
void FileManagerWidget::setCacheSizeValue(int value)
{
cache_value_label->setText(QString::number(value));
emit resetThumbnailCacheSize(value);
// sessionproxy->set_thumbnail_cache_size_qt(value);
}
youker-assistant/setting/settinglistview.cpp 0000664 0001750 0001750 00000002551 15227663670 020473 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 .
*/
#include "settinglistview.h"
#include
#include
#include
SettingListView::SettingListView(QWidget *parent)
: QListView(parent)
{
//this->setStyleSheet("QListView{border:none;background-color: rgba(84, 255, 159, 127);}");
setViewMode(QListView::IconMode);
setFrameStyle(QFrame::NoFrame);
setSpacing(20);
setMouseTracking(true);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
void SettingListView::leaveEvent(QEvent *e)
{
QListView::leaveEvent(e);
emit entered(QModelIndex());
}
youker-assistant/setting/deadpixelwidget.h 0000664 0001750 0001750 00000002325 15227663670 020036 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 DEADPIXELWIDGET_H
#define DEADPIXELWIDGET_H
#include
#include "../component/quibo.h"
class QLabel;
class QPushButton;
class DeadpixelWidget : public QWidget
{
Q_OBJECT
public:
explicit DeadpixelWidget(QWidget *parent = 0);
~DeadpixelWidget();
void setLanguage();
void initConnect();
public slots:
void startMonitorCheck();
private:
QUIBO *qtui;
QLabel *tip_label;
QPushButton *ok_btn;
};
#endif // DEADPIXELWIDGET_H
youker-assistant/setting/settingdelegate.h 0000664 0001750 0001750 00000002341 15227663670 020041 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 SETTINGDELEGATE_H
#define SETTINGDELEGATE_H
#include
#include
#include
class SettingDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit SettingDelegate(QObject *parent = 0);
private:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
#endif // SETTINGDELEGATE_H
youker-assistant/setting/settingmodel.h 0000664 0001750 0001750 00000002562 15227663670 017374 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 SETTINGMODEL_H
#define SETTINGMODEL_H
#include
class SettingModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit SettingModel(QObject *parent = 0);
enum ItemRole
{
HoverRole = Qt::UserRole + 1,//101
};
public slots:
void addItem(const QString &moduleName);
void setCurrentItem(const QModelIndex &index);
int rowCount(const QModelIndex &index) const;
QVariant data(const QModelIndex &index, int role) const;
private:
QStringList m_moduleList;
// QStringList m_nameList;
QModelIndex m_currentIndex;
};
#endif // SETTINGMODEL_H
youker-assistant/setting/touchpadwidget.cpp 0000664 0001750 0001750 00000040524 15227663670 020244 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 "touchpadwidget.h"
#include
#include
#include
#include
#include
#include
#include
TouchpadWidget::TouchpadWidget(QWidget *parent, QString cur_desktop) :
SettingModulePage(parent),
desktop(cur_desktop)
{
touchpad_label = new QLabel();
horizontal_scrolling_label = new QLabel();
scrollbar_type_label = new QLabel();
scrolling_mode_label = new QLabel();
touchpad_switcher = new KylinSwitcher();
horizontal_scrolling_switcher = new KylinSwitcher();
features_radio = new QRadioButton();
features_radio->setFocusPolicy(Qt::NoFocus);
// features_radio->setChecked(true);
features_radio->setObjectName("features_radio");
standard_radio = new QRadioButton();
standard_radio->setFocusPolicy(Qt::NoFocus);
// standard_radio->setChecked(false);
standard_radio->setObjectName("standard_radio");
QButtonGroup *btnGroup1 = new QButtonGroup();
btnGroup1->addButton(features_radio);
btnGroup1->addButton(standard_radio);
disable_radio = new QRadioButton();
disable_radio->setFocusPolicy(Qt::NoFocus);
disable_radio->setObjectName("disable_radio");
edge_radio = new QRadioButton();
edge_radio->setFocusPolicy(Qt::NoFocus);
// edge_radio->setChecked(true);
edge_radio->setObjectName("edge_radio");
two_finger_radio = new QRadioButton();
two_finger_radio->setFocusPolicy(Qt::NoFocus);
// two_finger_radio->setChecked(false);
two_finger_radio->setObjectName("two_finger_radio");
QButtonGroup *btnGroup2 = new QButtonGroup();
btnGroup2->addButton(disable_radio);
btnGroup2->addButton(edge_radio);
btnGroup2->addButton(two_finger_radio);
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui") {
scrollbar_type_label->hide();
features_radio->hide();
standard_radio->hide();
}
touchpad_label->setFixedWidth(180);
horizontal_scrolling_label->setFixedWidth(180);
scrollbar_type_label->setFixedWidth(180);
scrolling_mode_label->setFixedWidth(180);
//20180101
//kobe1510
/*this->release = sessionproxy->get_os_release_qt();
if(this->release.endsWith("15.10-wily")) {
touchpad_label->hide();
touchpad_switcher->hide();
horizontal_scrolling_label->hide();
horizontal_scrolling_switcher->hide();
scrollbar_type_label->hide();
features_radio->hide();
standard_radio->hide();
}*/
QHBoxLayout *layout1 = new QHBoxLayout();
layout1->setSpacing(10);
layout1->addWidget(touchpad_label);
layout1->addWidget(touchpad_switcher);
layout1->addStretch();
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->setSpacing(10);
layout2->addWidget(horizontal_scrolling_label);
layout2->addWidget(horizontal_scrolling_switcher);
layout2->addStretch();
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->setSpacing(10);
layout3->addWidget(scrollbar_type_label);
layout3->addWidget(features_radio);
layout3->addWidget(standard_radio);
layout3->addStretch();
QHBoxLayout *layout4 = new QHBoxLayout();
layout4->setSpacing(10);
layout4->addWidget(scrolling_mode_label);
layout4->addWidget(disable_radio);
layout4->addWidget(edge_radio);
layout4->addWidget(two_finger_radio);
layout4->addStretch();
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(layout1);
layout->addLayout(layout2);
layout->addLayout(layout3);
layout->addLayout(layout4);
layout->addStretch();
setLayout(layout);
layout->setSpacing(10);
layout->setContentsMargins(20, 20, 0, 0);
// splitter->addWidget(top_widget);
// splitter->addWidget(bottom_widget);
// QHBoxLayout *main_layout = new QHBoxLayout;
// main_layout->addStretch();
// main_layout->addWidget(splitter);
// main_layout->setSpacing(0);
// main_layout->setContentsMargins(0, 0, 0, 0);
// setLayout(main_layout);
// this->initSettingData();
this->setLanguage();
}
TouchpadWidget::~TouchpadWidget()
{
if (touchpad_label != NULL) {
delete touchpad_label;
touchpad_label = NULL;
}
if (horizontal_scrolling_label != NULL) {
delete horizontal_scrolling_label;
horizontal_scrolling_label = NULL;
}
if (scrollbar_type_label != NULL) {
delete scrollbar_type_label;
scrollbar_type_label = NULL;
}
if (scrolling_mode_label != NULL) {
delete scrolling_mode_label;
scrolling_mode_label = NULL;
}
if (touchpad_switcher != NULL) {
delete touchpad_switcher;
touchpad_switcher = NULL;
}
if (horizontal_scrolling_switcher != NULL) {
delete horizontal_scrolling_switcher;
horizontal_scrolling_switcher = NULL;
}
if (features_radio != NULL) {
delete features_radio;
features_radio = NULL;
}
if (standard_radio != NULL) {
delete standard_radio;
standard_radio = NULL;
}
if (disable_radio != NULL) {
delete disable_radio;
disable_radio = NULL;
}
if (edge_radio != NULL) {
delete edge_radio;
edge_radio = NULL;
}
if (two_finger_radio != NULL) {
delete two_finger_radio;
two_finger_radio = NULL;
}
}
QString TouchpadWidget::settingModuleName()
{
return "TouchPadPage";
}
void TouchpadWidget::setLanguage() {
// title_label->setText(tr("Touchpad settings"));
// description_label->setText(tr("Setting the relevant properties of your touchpad,make the operation more convenient."));
// back_btn->setText(tr("Back"));
touchpad_label->setText(tr("Enable touchpad") + ":");
horizontal_scrolling_label->setText(tr("Enable horizontal scrolling") + ":");
scrollbar_type_label->setText(tr("Scrollbar type") + ":");
scrolling_mode_label->setText(tr("Touchpad scrolling mode") + ":");//触摸板滚动模式
features_radio->setText(tr("Features Type"));
standard_radio->setText(tr("Standard Type"));
disable_radio->setText(tr("Disabled"));//禁用
edge_radio->setText(tr("Edge Scrolling"));//边界滚动
two_finger_radio->setText(tr("Two-finger Scrolling"));//双指滚动
}
void TouchpadWidget::initSettingData()
{
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
{
emit requestMateOrUnityTouchpadData(true);
}
else {
emit requestMateOrUnityTouchpadData(false);
}
//kobe1510
/*if(!this->release.endsWith("15.10-wily")) {
touchpad_switcher->switchedOn = sessionproxy->get_touchpad_enable_qt();
horizontal_scrolling_switcher->switchedOn = sessionproxy->get_touchscrolling_use_horizontal_qt();
QString mode_value = sessionproxy->get_scrollbars_mode_qt();
if(mode_value == "overlay-auto") {
features_radio->setChecked(true);
standard_radio->setChecked(false);
}
else if(mode_value == "normal") {
standard_radio->setChecked(true);
features_radio->setChecked(false);
}
}
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
{
int scroll_value = sessionproxy->get_mate_touchscrolling_mode_qt();
if(scroll_value == 0) {
disable_radio->setChecked(true);
edge_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(scroll_value == 1) {
edge_radio->setChecked(true);
disable_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(scroll_value == 2) {
two_finger_radio->setChecked(true);
disable_radio->setChecked(false);
edge_radio->setChecked(false);
}
}
else
{
QString scroll_value = sessionproxy->get_touchscrolling_mode_qt();
if(scroll_value == "disabled") {
disable_radio->setChecked(true);
edge_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(scroll_value == "edge-scrolling") {
edge_radio->setChecked(true);
disable_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(scroll_value == "two-finger-scrolling") {
two_finger_radio->setChecked(true);
disable_radio->setChecked(false);
edge_radio->setChecked(false);
}
}*/
this->initConnect();
}
void TouchpadWidget::onSendTouchPadValue(bool touchpadEnable, bool touchscrollingHorizontal, const QString &mode_value, int scroll_int_value, const QString &scroll_string_value)
{
touchpad_switcher->switchedOn = touchpadEnable;
horizontal_scrolling_switcher->switchedOn = touchscrollingHorizontal;
if(mode_value == "overlay-auto") {
features_radio->setChecked(true);
standard_radio->setChecked(false);
}
else if(mode_value == "normal") {
standard_radio->setChecked(true);
features_radio->setChecked(false);
}
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
{
if(scroll_int_value == 0) {
disable_radio->setChecked(true);
edge_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(scroll_int_value == 1) {
edge_radio->setChecked(true);
disable_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(scroll_int_value == 2) {
two_finger_radio->setChecked(true);
disable_radio->setChecked(false);
edge_radio->setChecked(false);
}
}
else
{
if(scroll_string_value == "disabled") {
disable_radio->setChecked(true);
edge_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(scroll_string_value == "edge-scrolling") {
edge_radio->setChecked(true);
disable_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(scroll_string_value == "two-finger-scrolling") {
two_finger_radio->setChecked(true);
disable_radio->setChecked(false);
edge_radio->setChecked(false);
}
}
}
void TouchpadWidget::initConnect() {
// connect(back_btn, SIGNAL(clicked()), this, SIGNAL(showSettingMainWidget()));
connect(touchpad_switcher, SIGNAL(clicked()), this, SLOT(setTouchpad()));
connect(horizontal_scrolling_switcher, SIGNAL(clicked()), this, SLOT(setHorizontalScrolling()));
connect(features_radio, SIGNAL(clicked(/*bool*/)), this, SLOT(setRadioButtonRowStatus(/*bool*/)));
connect(standard_radio, SIGNAL(clicked(/*bool*/)), this, SLOT(setRadioButtonRowStatus(/*bool*/)));
connect(disable_radio, SIGNAL(clicked(/*bool*/)), this, SLOT(setRadioButtonRowStatus(/*bool*/)));
connect(edge_radio, SIGNAL(clicked(/*bool*/)), this, SLOT(setRadioButtonRowStatus(/*bool*/)));
connect(two_finger_radio, SIGNAL(clicked(/*bool*/)), this, SLOT(setRadioButtonRowStatus(/*bool*/)));
// connect(sessionproxy, SIGNAL(string_value_notify(QString, QString)), this, SLOT(touchpadwidget_notify_string(QString, QString)));
// connect(sessionproxy, SIGNAL(bool_value_notify(QString, bool)), this, SLOT(touchpadwidget_notify_bool(QString, bool)));
// connect(sessionproxy, SIGNAL(int_value_notify(QString, int)), this, SLOT(touchpadwidget_notify_int(QString, int)));
}
void TouchpadWidget::touchpadwidget_notify_string(QString key, QString value)
{
if (key == "scroll-method") {
if(value == "disabled") {
disable_radio->setChecked(true);
edge_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(value == "edge-scrolling") {
edge_radio->setChecked(true);
disable_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(value == "two-finger-scrolling") {
two_finger_radio->setChecked(true);
disable_radio->setChecked(false);
edge_radio->setChecked(false);
}
}
else if (key == "scrollbar-mode") {
if(value == "overlay-auto") {
features_radio->setChecked(true);
standard_radio->setChecked(false);
}
else if(value == "normal") {
standard_radio->setChecked(true);
features_radio->setChecked(false);
}
}
}
void TouchpadWidget::touchpadwidget_notify_bool(QString key, bool value)
{
if (key == "touchpad-enabled") {
touchpad_switcher->switchedOn = value;
}
else if (key == "horiz-scroll-enabled") {
horizontal_scrolling_switcher->switchedOn = value;
}
}
void TouchpadWidget::touchpadwidget_notify_int(QString key, int value)
{
if (key == "scroll-method") {
if(value == 0) {
disable_radio->setChecked(true);
edge_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(value == 1) {
edge_radio->setChecked(true);
disable_radio->setChecked(false);
two_finger_radio->setChecked(false);
}
else if(value == 2) {
two_finger_radio->setChecked(true);
disable_radio->setChecked(false);
edge_radio->setChecked(false);
}
}
}
void TouchpadWidget::setTouchpad()
{
emit resetTouchpad(touchpad_switcher->switchedOn);
// sessionproxy->set_touchpad_enable_qt(touchpad_switcher->switchedOn);
}
void TouchpadWidget::setHorizontalScrolling()
{
emit resetHorizontalScrolling(horizontal_scrolling_switcher->switchedOn);
// sessionproxy->set_touchscrolling_use_horizontal_qt(horizontal_scrolling_switcher->switchedOn);
}
void TouchpadWidget::setRadioButtonRowStatus(/*bool status*/)
{
QObject *obj = sender(); //返回发出信号的对象,用QObject类型接收
QRadioButton* pbtn = qobject_cast(obj);
QString obj_name = pbtn->objectName();
if(obj_name == "features_radio")
{
emit setScrollbarOverlayOrLegacyMode(true);
// sessionproxy->set_scrollbars_mode_overlay_qt();
}
else if(obj_name == "standard_radio")
{
emit setScrollbarOverlayOrLegacyMode(false);
// sessionproxy->set_scrollbars_mode_legacy_qt();
}
else if(obj_name == "disable_radio")
{
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
emit setMateTouchscrollingMode(0);
// sessionproxy->set_mate_touchscrolling_mode_qt(0);
else {
emit setUnityTouchscrollingMode(0);
// sessionproxy->set_touchscrolling_mode_disabled_qt();
}
}
else if(obj_name == "edge_radio")
{
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
emit setMateTouchscrollingMode(1);
// sessionproxy->set_mate_touchscrolling_mode_qt(1);
else {
emit setUnityTouchscrollingMode(1);
// sessionproxy->set_touchscrolling_mode_edge_qt();
}
}
else if(obj_name == "two_finger_radio")
{
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
emit setMateTouchscrollingMode(2);
// sessionproxy->set_mate_touchscrolling_mode_qt(2);
else {
emit setUnityTouchscrollingMode(2);
// sessionproxy->set_touchscrolling_mode_twofinger_qt();
}
}
}
youker-assistant/setting/themewidget.h 0000664 0001750 0001750 00000003306 15227663670 017201 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 THEMEWIDGET_H
#define THEMEWIDGET_H
#include
class QLabel;
class QPushButton;
class QListWidget;
class QListWidgetItem;
class ThemeView;
#include "settingmodulelpage.h"
//class ThemeWidget : public QWidget
class ThemeWidget : public SettingModulePage
{
Q_OBJECT
public:
explicit ThemeWidget(QWidget *parent = 0);
~ThemeWidget();
void initConnect();
void resetUI();
void initSettingData() Q_DECL_OVERRIDE;
QString settingModuleName() Q_DECL_OVERRIDE;
public slots:
void themewidget_notify_string(QString key, QString value);
void switchUsingLogo(QString index);
void changeTheme(QString name);
void onReceiveThemeList(const QString ¤tTheme, const QStringList &themeList);
signals:
void requestThemeData();
void changeSystemTheme(const QString &name);
private:
ThemeView *m_themeView = nullptr;
QStringList syslist;
QLabel *label = nullptr;
};
#endif // THEMEWIDGET_H
youker-assistant/setting/energywidget.h 0000664 0001750 0001750 00000010654 15227663670 017374 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 ENERGYWIDGET_H
#define ENERGYWIDGET_H
#include
#include "../component/kylinswitcher.h"
#include
#include
#include
class QLabel;
class QComboBox;
class QDoubleSpinBox;
class QSlider;
class QRadioButton;
class QVBoxLayout;
#include "settingmodulelpage.h"
class EnergyWidget : public SettingModulePage
{
Q_OBJECT
public:
explicit EnergyWidget(QStringList cpulist, QString cpu, QString cur_desktop, bool has_battery = false, QWidget *parent = 0);
~EnergyWidget();
void setLanguage();
void initConnect();
void initSettingData() Q_DECL_OVERRIDE;
QString settingModuleName() Q_DECL_OVERRIDE;
public slots:
void setScreenGammaValue(double value);
void setBrightnessValue(int value);
// void setIdleDelay(QString value);
void setIdleDelay(int index);
void setLockEnabled();
// void setLockDelay(QString value);
void setLockDelay(int index);
void onCpuRadioButtonClicked();
void setRadioButtonRowStatus();
void setSleepTimeoutBattery(int index);
void setSleepTimeoutAC(int index);
void setSleepTimeoutDisplayBattery(int index);
void setSleepTimeoutDisplayAC(int index);
void onSendIdleAndGammaData(double gamma, const QStringList &aclist, int brightnessValue, const QString &sleepTimeoutDisplayBattery, const QString &sleepTimeoutFisplayAC, const QString &idle_delay, const QStringList &idledelaylist);
void onSendLockAndSleepData(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);
signals:
void requestPowerAndBatteryData();
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);
private:
QString desktop;
QString current_idle_delay;
QString current_lock_delay;
QString sleep_timeout_battery;
QString sleep_timeout_ac;
QString sleep_timeout_display_battery;
QString sleep_timeout_display_ac;
QLabel *gamma_label;
QDoubleSpinBox *gamma_slider;
QLabel *brightness_label;
QLabel *brightness_value_label;
QSlider *brightness_slider;
QLabel *idle_delay_label;
QComboBox *idle_delay_combo;
QLabel *lock_enabled_label;
KylinSwitcher *lock_enabled_switch;
QLabel *lock_delay_label;
QComboBox *lock_delay_combo;
QLabel *critical_low_label;
QRadioButton *suspend_low_radio;
QRadioButton *shutdown_radio;
QLabel *laptop_lid_battery_label;
QRadioButton *suspend_lid_battery_radio;
QRadioButton *nothing_battery_radio;
QLabel *laptop_lid_ac_label;
QRadioButton *suspend_lid_ac_radio;
QRadioButton *nothing_ac_radio;
QLabel *sleep_battery_label;
QComboBox *sleep_battery_combo;
QLabel *sleep_ac_label;
QComboBox *sleep_ac_combo;
QLabel *sleep_battery_display_label;
QComboBox *sleep_battery_display_combo;
QLabel *sleep_ac_display_label;
QComboBox *sleep_ac_display_combo;
QStringList m_aclist;
QVBoxLayout *m_layout = nullptr;
};
#endif // ENERGYWIDGET_H
youker-assistant/setting/themewidget-org.h 0000664 0001750 0001750 00000003101 15227663670 017757 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 THEMEWIDGET_H
#define THEMEWIDGET_H
#include
class SessionDispatcher;
class QLabel;
class QPushButton;
class QListWidget;
class QListWidgetItem;
class ThemeWidget : public QWidget
{
Q_OBJECT
public:
explicit ThemeWidget(QWidget *parent = 0, SessionDispatcher *proxy = 0);
~ThemeWidget();
void initConnect();
void initCurrentTheme(QListWidgetItem *init_item);
void initData();
bool getStatus();
protected:
void paintEvent(QPaintEvent *);
public slots:
void onItemClicked(QListWidgetItem *selected_item);
void themewidget_notify_string(QString key, QString value);
private:
QListWidget *list_widget;
int current_index;
QLabel *using_label;
SessionDispatcher *sessionproxy;
bool dataOK;
int initIndex;
QStringList syslist;
};
#endif // THEMEWIDGET_H
youker-assistant/setting/animationwidget.h 0000664 0001750 0001750 00000003372 15227663670 020061 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 ANIMATIONWIDGET_H
#define ANIMATIONWIDGET_H
#include
#include
class SystemDispatcher;
class MainWindow;
class QLabel;
class QPushButton;
class AnimationWidget : public QWidget
{
Q_OBJECT
public:
explicit AnimationWidget(QWidget *parent = 0, SystemDispatcher *proxy = 0, MainWindow *window = 0);
~AnimationWidget();
void setLanguage();
void initConnect();
void initData();
bool getStatus();
public slots:
void selectCustomAnimation();
void setCustomAnimation();
void deleteSelectedAnimation(QString name);
void displayCurrentItemInfo(QString info);
private:
SystemDispatcher *systemproxy;
bool dataOK;
MainWindow *parentWindow;
QWidget * left_widget;
QWidget * right_widget;
QLabel *title_label;
QPushButton *custom_btn;
QPushButton *ok_btn;
QWidget *view_widget;
QWidget *show_widget;
QLabel *tip_label;
QListWidget *list_widget;
QString selected_animation;
};
#endif // ANIMATIONWIDGET_H
youker-assistant/setting/settingdelegate.cpp 0000664 0001750 0001750 00000007423 15227663670 020402 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 .
*/
#include "settingdelegate.h"
#include "settingmodel.h"
#include
#include
#include
inline const QString covertModuleName(const QString &module)
{
if (module == "ThemePage") {
return QString(QObject::tr("ThemeSetting"));
}
else if (module == "IconPage") {
return QString(QObject::tr("IconSetting"));
}
else if (module == "MousePage") {
return QString(QObject::tr("MousePointer"));
}
else if (module == "SoundPage") {
return QString(QObject::tr("SoundEffect"));
}
else if (module == "PanelPage") {
return QString(QObject::tr("Panel"));
}
else if (module == "MenuPage") {
return QString(QObject::tr("StartMenu"));
}
else if (module == "WindowPage") {
return QString(QObject::tr("Window"));
}
else if (module == "FontPage") {
return QString(QObject::tr("FontSetting"));
}
else if (module == "TouchPadPage") {
return QString(QObject::tr("Touchpad"));
}
else if (module == "EnergyPage") {
return QString(QObject::tr("Energy saving"));
}
else if (module == "FMPage") {
return QString(QObject::tr("File manager"));
}
else {
return module;
}
}
SettingDelegate::SettingDelegate(QObject *parent)
: QItemDelegate(parent)
{
}
void SettingDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
const QString module = index.data().toString();
if (module.isEmpty())
return;
QPainterPath path;//QPainterPath path(option.rect.topLeft());
painter->setRenderHint(QPainter::Antialiasing, true);
path.addRect(QRectF(option.rect));
// QRectF r(0 / 2.0, 0 / 2.0, option.rect.width() - 0, option.rect.height() - 0);//左边 上边 右边 下边
// path.addRoundedRect(r, 4, 4);painter.drawRoundedRect(r, 4, 4);
QPen pen;
pen.setColor(QColor("#0B95D7"));
pen.setWidth(0.8);
painter->setPen(pen);//painter->setPen(Qt::NoPen);
if (index.data(SettingModel::HoverRole).toBool()) {
painter->setOpacity(1);
painter->drawPixmap(QPoint(option.rect.x() + 5, option.rect.y() + 5), QPixmap("://res/clothes.png"));
painter->fillPath(path, QColor(135, 206, 250, 127));//QColor::fromRgbF(1, 1, 1, 0.4)
}
else {
painter->setOpacity(0.5);
painter->fillPath(path, QColor(255, 250, 250, 127));
}
painter->drawPath(path);
auto font = option.font;
if (index.data(SettingModel::HoverRole).toBool()) {
font.setPixelSize(15);
painter->setFont(font);
painter->setPen(Qt::white);
}
else {
font.setPixelSize(12);
painter->setFont(font);
painter->setPen(QPen(QColor("#363636"), 1));
}
const QString name = covertModuleName(module);
painter->drawText(option.rect, Qt::AlignCenter, name);
}
QSize SettingDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
Q_UNUSED(option);
return index.data(Qt::SizeHintRole).toSize();
}
youker-assistant/setting/switchmenu.h 0000664 0001750 0001750 00000001303 15227663670 017054 0 ustar feng feng #ifndef SWITCHMENU_H
#define SWITCHMENU_H
#include
class SwitchMenu : public QWidget
{
Q_OBJECT
public:
explicit SwitchMenu(QWidget *parent = 0);
protected:
// /*virtual */void paintEvent(QPaintEvent *);
// virtual void mousePressEvent(QMouseEvent *);
// virtual void mouseReleaseEvent(QMouseEvent *);
protected:
void enterEvent(QEvent *);
void leaveEvent(QEvent *);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *);
signals:
public slots:
private:
QPixmap m_pixmapBk;
QPixmap m_pixmapFore;
bool m_bOn;
bool m_bLBtnDown;
};
#endif // SWITCHMENU_H
youker-assistant/setting/windowwidget.h 0000664 0001750 0001750 00000005651 15227663670 017413 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 WINDOWWIDGET_H
#define WINDOWWIDGET_H
#include
#include "../component/kylinswitcher.h"
#include "settingmodulelpage.h"
class QLabel;
class QPushButton;
class QComboBox;
class QRadioButton;
class WindowWidget : public SettingModulePage
{
Q_OBJECT
public:
explicit WindowWidget(QWidget *parent = 0, QString cur_desktop = "");
~WindowWidget();
void setLanguage();
void initConnect();
void initSettingData() Q_DECL_OVERRIDE;
QString settingModuleName() Q_DECL_OVERRIDE;
public slots:
void setMenuIcon();
void setMouseWheel(QString selected);
void setMouseDoubleClick(QString selected);
void setMouseMiddleClick(QString selected);
void setMouseRightClick(QString selected);
void setRadioButtonRowStatus();
void windowwidget_notify_string(QString key, QString value);
void windowwidget_notify_bool(QString key, bool value);
void onSendWindowButtonAlign(const QString ¤t_value);
void onSendMenusHaveIcons(bool menuHaveIcons);
void onSendWindowTitileTags(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);
signals:
void requesetWindowButtonAlign();
void requesetMenusHaveIcons();
void requesetWindowTitileTags();
void resetMenusHaveIcon(bool b);
void resetTitlebarWheel(const QString &selected);
void resetTitlebarDoubleClick(const QString &selected);
void resetMouseMiddleClick(const QString &selected);
void resetMouseRightClick(const QString &selected);
void resetWindowButtonLeftOrRightAlign(bool isLeft);
private:
QString desktop;
QStringList m_wheellist;
QStringList m_titlebarOptions;
QLabel *icon_label;
QLabel *wheel_label;
QLabel *double_click_label;
QLabel *middle_click_label;
QLabel *right_click_label;
KylinSwitcher *icon_switcher;
QComboBox *wheel_combo;
QComboBox *double_click_combo;
QComboBox *middle_click_combo;
QComboBox *right_click_combo;
QLabel *position_label;
QRadioButton *left_radio;
QRadioButton *right_radio;
};
#endif // WINDOWWIDGET_H
youker-assistant/setting/settingmodulelpage.h 0000664 0001750 0001750 00000002170 15227663670 020565 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 SETTINGMODULEPAGE_H
#define SETTINGMODULEPAGE_H
#include
#include
#include
class SettingModulePage : public QFrame
{
Q_OBJECT
public:
SettingModulePage(QWidget *parent = 0)
:QFrame(parent)
{
}
virtual QString settingModuleName() = 0;
virtual void initSettingData() = 0;
};
#endif // SETTINGMODULEPAGE_H
youker-assistant/setting/switchmenu.cpp 0000664 0001750 0001750 00000003530 15227663670 017413 0 ustar feng feng #include "switchmenu.h"
#include
#include
#include
SwitchMenu::SwitchMenu(QWidget *parent) :
QWidget(parent)
{
// setWindowFlags(Qt::FramelessWindowHint);
m_bOn = false;
m_bLBtnDown = false;
m_pixmapBk.load(":/background/res/on.png");
m_pixmapFore.load(":/background/res/off.png");
setGeometry(0, 0, m_pixmapBk.width(), m_pixmapBk.height());
}
void SwitchMenu::paintEvent(QPaintEvent *)
{
qDebug() << "1111111111";
QPainter painter(this);
painter.drawPixmap(QPoint(0,0), m_pixmapBk);
QPoint ptFore;
if (m_bOn) {
ptFore = rect().topLeft();
} else {
ptFore = QPoint(this->width() - m_pixmapFore.width(),
this->rect().top());
}
painter.drawPixmap(ptFore, m_pixmapFore);
QRect rcOn;
rcOn.setTopLeft(rect().topLeft());
rcOn.setBottomRight(QPoint(m_pixmapFore.width(), m_pixmapFore.height()));
painter.drawText(rcOn, Qt::AlignCenter, "ON");
QRect rcOff;
rcOff.setTopLeft(QPoint(rect().width() - m_pixmapFore.width(), rect().top()));
rcOff.setBottomRight(rect().bottomRight());
painter.drawText(rcOff, Qt::AlignCenter, "Off");
}
void SwitchMenu::mousePressEvent(QMouseEvent *)
{
qDebug() << "333333333";
m_bLBtnDown = true;
}
void SwitchMenu::mouseReleaseEvent(QMouseEvent *e)
{
qDebug() << "222222222";
if (m_bLBtnDown) {
m_bOn = !m_bOn;
m_bLBtnDown = false;
}
update();
}
void SwitchMenu::leaveEvent(QEvent *)
{
// status = NORMAL;
update();
}
void SwitchMenu::enterEvent(QEvent *)
{
// status = ENTER;
update();
}
//void SystemButton::paintEvent(QPaintEvent *)
//{
// QPainter painter;
// painter.begin(this);
// painter.drawPixmap(this->rect(), pixmap.copy(btn_width * status, 0, btn_width, btn_height));
// painter.end();
//}
youker-assistant/setting/theme/ 0000775 0001750 0001750 00000000000 15227663670 015622 5 ustar feng feng youker-assistant/setting/theme/themeview.h 0000664 0001750 0001750 00000003226 15227663670 017773 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 THEMEVIEW_H
#define THEMEVIEW_H
#include
#include
class ThemeDelegate;
class ThemeView : public QListView
{
Q_OBJECT
public:
explicit ThemeView(QWidget *parent = 0);
~ThemeView();
void loadOneTheme(const QString &name, bool isCurrrent = false);
QModelIndex loadThemeData(const QString &name, bool isCurrrent = false);
void clearData();
int isExist(const QString &name) const;
QSize itemSize() const;
public slots:
void onItemClicked(const QModelIndex &index);
signals:
void sendSelectThemeName(QString themeName);
protected:
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
// bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
private:
ThemeDelegate *m_delegate = nullptr;
QStandardItemModel *m_model = nullptr;
QSize m_itemSize;
QModelIndex m_prevModelIndex;
};
#endif // THEMEVIEW_H
youker-assistant/setting/theme/themedelegate.h 0000664 0001750 0001750 00000004031 15227663670 020566 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 THEMEDELEGATE_H
#define THEMEDELEGATE_H
#include
#include
class ThemeDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit ThemeDelegate(QObject *parent = nullptr);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
void setEditorData(QWidget* editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE;
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex &index) const Q_DECL_OVERRIDE;
// bool editorEvent(QEvent* event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
void drawBackground(const QStyleOptionViewItem &option, QPainter *painter) const;
void drawImage(const QStyleOptionViewItem &option, const QModelIndex &index, QPainter *painter) const;
void drawTitle(const QStyleOptionViewItem &option, const QModelIndex &index, QPainter *painter) const;
private:
QColor m_textColor;
};
#endif // THEMEDELEGATE_H
youker-assistant/setting/theme/themeview.cpp 0000664 0001750 0001750 00000013131 15227663670 020322 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 .
*/
#include "themeview.h"
#include "themedelegate.h"
#include
#include
#include
namespace {
const QSize THEME_ITEM_DEFAULT_SIZE = QSize(139, 160);
}
ThemeView::ThemeView(QWidget *parent)
: QListView(parent)
, m_itemSize(THEME_ITEM_DEFAULT_SIZE)
, m_prevModelIndex(QModelIndex())
{
setMouseTracking(true);
m_delegate = new ThemeDelegate(this);
setItemDelegate(m_delegate);
m_model = new QStandardItemModel(this);
setModel(m_model);
setEditTriggers(QAbstractItemView::NoEditTriggers);
setResizeMode(QListView::Adjust);
setViewMode(QListView::IconMode);
setSelectionMode(QAbstractItemView::SingleSelection);
setUniformItemSizes(true);
setSpacing(60);
setDragEnabled(false);
// connect(this, SIGNAL(ri))
connect(this, &ThemeView::doubleClicked, this, &ThemeView::onItemClicked);
connect(this, &ThemeView::clicked, this, &ThemeView::onItemClicked);
connect(selectionModel(), &QItemSelectionModel::currentChanged, this, [=] (const QModelIndex ¤t) {
if (!current.isValid())
return;
if (m_prevModelIndex.isValid()) {//update the previous model index's data
QList datas = m_prevModelIndex.model()->data(m_prevModelIndex, Qt::DisplayRole).toList();
if (!datas.isEmpty()) {
datas.replace(3, QVariant(false));
m_model->setData(m_prevModelIndex, QVariant(datas), Qt::DisplayRole);
m_model->setData(m_prevModelIndex, QVariant(m_itemSize), Qt::SizeHintRole);
}
}
m_prevModelIndex = current;
});
}
ThemeView::~ThemeView()
{
this->clearData();
}
void ThemeView::clearData()
{
setAutoScroll(false);
for (int i = 0; i < this->m_model->rowCount(); ++i) {
this->m_model->removeRow(i);
}
setAutoScroll(true);
m_prevModelIndex = QModelIndex();
}
QModelIndex ThemeView::loadThemeData(const QString &name, bool isCurrrent)
{
QVariantList datas;
datas.append(QVariant(name));//theme name
datas.append(QVariant(QString(":/gtk/res/theme/%1.png").arg(name)));//theme picture
datas.append(QVariant(":/gtk/res/theme/disappear.png"));//default picture
datas.append(QVariant(isCurrrent));
QModelIndex index;
const int existIndex = isExist(name);
if (existIndex != -1) {//it exist, then update data
index = m_model->index(existIndex, 0);
}
else {//it not exist, then new item
QStandardItem *item = new QStandardItem();
QList items;
items.append(item);
m_model->appendRow(items);
index = m_model->index(m_model->rowCount() - 1, 0);
}
m_model->setData(index, QVariant(datas), Qt::DisplayRole);
m_model->setData(index, QVariant(m_itemSize), Qt::SizeHintRole);
return index;
}
QSize ThemeView::itemSize() const
{
return m_itemSize;
}
int ThemeView::isExist(const QString &name) const
{
for (int i = 0; i < m_model->rowCount(); i++) {
const QVariantList datas = m_model->data(m_model->index(i, 0), Qt::DisplayRole).toList();
if (!datas.isEmpty() && datas[0].toString() == name) {
return i;
}
}
return -1;
}
void ThemeView::onItemClicked(const QModelIndex &index)
{
if (!index.isValid())
return;
QList datas = index.model()->data(index, Qt::DisplayRole).toList();
if (!datas.isEmpty()) {
const QString name = datas[0].toString();
const int ti = isExist(name);
if (ti != -1) {//it must be exist, then update the current model index's data
datas.replace(3, QVariant(true));
m_model->setData(index, QVariant(datas), Qt::DisplayRole);
m_model->setData(index, QVariant(m_itemSize), Qt::SizeHintRole);
setCurrentIndex(index);
emit this->sendSelectThemeName(name);
}
}
}
void ThemeView::loadOneTheme(const QString &name, bool isCurrrent)
{
QModelIndex index = loadThemeData(name, isCurrrent);
if (isCurrrent)
setCurrentIndex(index);
scrollTo(m_model->index(index.row() + 1, 0, index.parent()));
}
void ThemeView::mousePressEvent(QMouseEvent *e)
{
if (!indexAt(e->pos()).isValid()) {
this->selectionModel()->clearSelection();
}
QListView::mousePressEvent(e);
}
/*bool ThemeView::eventFilter(QObject *obj, QEvent *event)
{
if(event->type() == QEvent::MouseButtonPress) {
QMouseEvent *me = (QMouseEvent *)event;
}
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast(event);
qDebug("Key press %d", keyEvent->key());
if (keyEvent->key() == Qt::Key_Tab) {
}
else if (keyEvent->key() == Qt::Key_Escape) {
}
return true;
}
else {
// standard event processing
return QObject::eventFilter(obj, event);
}
}*/
youker-assistant/setting/theme/themedelegate.cpp 0000664 0001750 0001750 00000015610 15227663670 021126 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 .
*/
#include "themedelegate.h"
#include
#include
#include
#include
namespace {
const int THEME_IMAGE_MARGIN = 10;
}
ThemeDelegate::ThemeDelegate(QObject *parent)
: QStyledItemDelegate(parent)
, m_textColor(QColor("rgba(0,153,68,0.3)"))
{
}
QWidget *ThemeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
Q_UNUSED(index)
Q_UNUSED(option)
return QStyledItemDelegate::createEditor(parent, option, index);
}
void ThemeDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
if (!index.isValid()) {
return;
}
QStyledItemDelegate::setEditorData(editor, index);
}
void ThemeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
QStyledItemDelegate::setModelData(editor, model, index);
}
void ThemeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QList datas = index.model()->data(index, Qt::DisplayRole).toList();
if (!datas.isEmpty()) {
// Draw background
drawBackground(option, painter);//or draw shadow effect: "://res/theme-cover.png"
// Draw theme image
drawImage(option, index, painter);
// Draw title text
drawTitle(option, index, painter);
}
}
/*bool ThemeDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
{
Q_UNUSED(index)
Q_UNUSED(option)
QMouseEvent *pEvent = static_cast (event);
qDebug() << pEvent->globalPos();
//QPoint m_mousePoint = pEvent->pos();
switch (event->type())
{
case QEvent::MouseMove://鼠标滑过
break;
case QEvent::MouseButtonPress://鼠标按下
break;
case QEvent::MouseButtonRelease://鼠标释放
break;
default:
break;
}
return QStyledItemDelegate::editorEvent(event, model, option, index);
}*/
QSize ThemeDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
Q_UNUSED(option)
return index.model()->data(index, Qt::SizeHintRole).toSize();
}
void ThemeDelegate::drawBackground(const QStyleOptionViewItem &option, QPainter *painter) const
{
painter->setRenderHint(QPainter::Antialiasing, true);
QRect rect = option.rect;
rect.setSize(QSize(rect.width() - 1, rect.height() - 1));
QColor bgColor;
QColor borderColor;
if ((option.state & QStyle::State_MouseOver) && (option.state & QStyle::State_Selected) == 0) {
bgColor = QColor(224,244,249,127);//QColor("#e0f4f9")
borderColor = QColor("#999999");
}
else if (option.state & QStyle::State_Selected) {
bgColor = QColor(43,182,234,127);//QColor("#2bb6ea")
borderColor = QColor("#e0f4f9");
}
else {
bgColor = QColor("#ffffff");
borderColor = QColor("#ffffff");
}
QPainterPath path;
path.addRoundedRect(rect.x(), rect.y(), rect.width(), rect.height(), 5, 5);
painter->fillPath(path, QBrush(bgColor));
QPen borderPen(QBrush(borderColor), 1);
painter->setPen(borderPen);
painter->drawPath(path);
}
void ThemeDelegate::drawImage(const QStyleOptionViewItem &option, const QModelIndex& index, QPainter *painter) const
{
painter->setRenderHint(QPainter::Antialiasing, true);
QRect rect = option.rect;
const int pixmapSize = rect.width() - THEME_IMAGE_MARGIN * 2;
QList datas = index.model()->data(index, Qt::DisplayRole).toList();
//QString data = index.data().toString();
const QString name = datas[0].toString();
const QString picture = datas[1].toString();
const QString defaultPic = datas[2].toString();
bool isCurrent = datas[3].toBool();
// Theme image
QSize imageSize;
imageSize.setWidth(option.rect.width() - THEME_IMAGE_MARGIN * 2);
imageSize.setHeight(imageSize.width());
/*if ((option.state & QStyle::State_MouseOver) && (option.state & QStyle::State_Selected) == 0) {
}
else if (option.state & QStyle::State_Selected) {
}*/
QPixmap pixmap = QPixmap(picture);
if (!pixmap.isNull())
pixmap = pixmap.scaled(imageSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
else
pixmap = QPixmap(defaultPic).scaled(imageSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap scalePixmap = pixmap.scaled(pixmapSize, pixmapSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
painter->drawPixmap(rect.x() + THEME_IMAGE_MARGIN, rect.y() + THEME_IMAGE_MARGIN, pixmapSize, pixmapSize, scalePixmap);
if (isCurrent) {
painter->drawPixmap(rect.x() + 2*THEME_IMAGE_MARGIN, rect.y() + 2*THEME_IMAGE_MARGIN, 20, 20, QPixmap("://res/choose.png"));
}
}
void ThemeDelegate::drawTitle(const QStyleOptionViewItem &option, const QModelIndex &index, QPainter *painter) const
{
painter->setRenderHint(QPainter::Antialiasing, false);
QRect rect = option.rect;
QFont font;
font.setPixelSize(12);
QPen pen(m_textColor);
QList datas = index.model()->data(index, Qt::DisplayRole).toList();
// QString data = index.data().toString();
QString name = datas[0].toString();
painter->setPen(pen);
QFont textFont(painter->font());
textFont.setPixelSize(12);
textFont.setWeight(24);
const QFontMetrics fm(textFont);
const int textHeight = rect.height() * 0.78;
const QRectF textRect = QRect(rect.x(), rect.y() + textHeight + 5, rect.width(), rect.height() - textHeight);
// Draw theme name text background
/*QSize textSize(qMin(fm.width(name) + 18, rect.width()), fm.height() + 2);
QRect bgRect(rect.x() + (rect.width() - textSize.width()) / 2, textRect.y()+ (textRect.height() - textSize.height()) / 2, textSize.width(), textSize.height());
if (option.state & QStyle::State_Selected) {
QPainterPath textPainterPath;
textPainterPath.addRoundedRect(bgRect, 2, 2);
painter->fillPath(textPainterPath, QBrush(QColor("#2ca7f8")));
}*/
painter->setFont(textFont);
painter->drawText(textRect, fm.elidedText(name, Qt::ElideMiddle, rect.width()), QTextOption(Qt::AlignCenter));
}
youker-assistant/setting/fontwidget.h 0000664 0001750 0001750 00000010600 15227663670 017040 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 FONTWIDGET_H
#define FONTWIDGET_H
#include
#include
#include
class MainWindow;
class QLabel;
class QPushButton;
class QComboBox;
class QDoubleSpinBox;
#include "settingmodulelpage.h"
class FontWidget : public SettingModulePage
{
Q_OBJECT
public:
explicit FontWidget(QWidget *parent = 0, MainWindow *window = 0, QString cur_desktop = "", QString skin = ":/background/res/skin/1.png");
~FontWidget();
void setLanguage();
void initConnect();
void initSettingData() Q_DECL_OVERRIDE;
QString settingModuleName() Q_DECL_OVERRIDE;
void resetCurrentSkin(QString skin);
public slots:
void setDefaultFont();
void setDesktopFont();
void setMonospaceFont();
void setDocumentFont();
void setTitlebarFont();
void setScalingValue(double value);
void setFontHinting(QString selected);
void setFontAntialiasing(QString selected);
void resetDefaultFont(QString cur_font);
void resetDesktopFont(QString cur_font);
void resetMonospaceFont(QString cur_font);
void resetDocumentFont(QString cur_font);
void resetTitlebarFont(QString cur_font);
void restore_default_font();
void restore_desktop_font();
void restore_monospace_font();
void restore_document_font();
void restore_titlebar_font();
void fontwidget_notify_string(QString key, QString value);
void fontwidget_notify_double(QString key, double value);
void onSendFontValue(const QString &curFont);
void onSendDesktopFontValue(const QString &curFont);
void onSendMonospaceFontValue(const QString &curFont);
void onSendDocumentFontValue(const QString &curFont);
void onSendTitlebarFontValue(const QString &curFont);
void onSendFontSmoothAndAntialiasingValue(double fontZoom, const QString ¤t_smooth, const QStringList &smoothlist, const QString ¤t_antialiasing, const QStringList &antialiasinglist);
signals:
void requestFontData();
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);
private:
QStringList m_smoothlist;
QStringList m_antialiasinglist;
MainWindow *parentWindow;
QLabel *default_font_label;
QLabel *desktop_font_label;
QLabel *monospace_font_label;
QLabel *document_font_label;
QLabel *titlebar_font_label;
QLabel *scaling_label;
QLabel *hinting_label;
QLabel *antialiasing_label;
QPushButton *default_font_btn;
QPushButton *desktop_font_btn;
QPushButton *monospace_font_btn;
QPushButton *document_font_btn;
QPushButton *titlebar_font_btn;
QDoubleSpinBox *scaling_slider;
QComboBox *hinting_combo;
QComboBox *antialiasing_combo;
QPushButton *restore_default_font_btn;
QPushButton *restore_desktop_font_btn;
QPushButton *restore_monospace_font_btn;
QPushButton *restore_document_font_btn;
QPushButton *restore_titlebar_font_btn;
QString current_font;
QString desktop_font;
QString monospace_font;
QString document_font;
QString titlebar_font;
QString desktop;
QString cur_skin;
};
#endif // FONTWIDGET_H
youker-assistant/setting/menuwidget.cpp 0000664 0001750 0001750 00000043543 15227663670 017405 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 "menuwidget.h"
#include
#include
#include
#include
#include
#include
#include
MenuWidget::MenuWidget(QWidget *parent, QString cur_desktop) :
SettingModulePage(parent),desktop(cur_desktop)
{
size_label = new QLabel();
size_value_label = new QLabel();
hide_label = new QLabel();
icon_label = new QLabel();
transparency_label = new QLabel();
background_label = new QLabel();
size_top_label = new QLabel();
hide_top_label = new QLabel();
size_top_value_label = new QLabel();
size_bottom_label = new QLabel();
hide_bottom_label = new QLabel();
size_bottom_value_label = new QLabel();
position_label = new QLabel();
size_slider = new QSlider(Qt::Horizontal);
size_slider->setFocusPolicy(Qt::NoFocus);
size_slider->setRange(32, 64);
size_slider->setSingleStep(1);
hide_switcher = new KylinSwitcher();
icon_switcher = new KylinSwitcher();
transparency_slider = new QDoubleSpinBox();
transparency_slider->setButtonSymbols(QAbstractSpinBox::PlusMinus);
transparency_slider->setSingleStep(0.1);
transparency_slider->setMinimum(0.0);
transparency_slider->setMaximum(1.0);
backgound_combo = new QComboBox();
size_top_slider = new QSlider(Qt::Horizontal);
size_top_slider->setFocusPolicy(Qt::NoFocus);
size_top_slider->setRange(24, 180);
size_top_slider->setSingleStep(1);
size_bottom_slider = new QSlider(Qt::Horizontal);
size_bottom_slider->setFocusPolicy(Qt::NoFocus);
size_bottom_slider->setRange(24, 180);
size_bottom_slider->setSingleStep(1);
hide_top_switcher = new KylinSwitcher();
hide_bottom_switcher = new KylinSwitcher();
position_combo = new QComboBox();
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui") {
size_label->hide();
size_value_label->hide();
hide_label->hide();
icon_label->hide();
transparency_label->hide();
background_label->hide();
position_label->hide();
size_slider->hide();
hide_switcher->hide();
icon_switcher->hide();
transparency_slider->hide();
backgound_combo->hide();
position_combo->hide();
}
else
{
size_top_label->hide();
hide_top_label->hide();
size_top_value_label->hide();
size_bottom_label->hide();
hide_bottom_label->hide();
size_bottom_value_label->hide();
size_top_slider->hide();
size_bottom_slider->hide();
hide_top_switcher->hide();
hide_bottom_switcher->hide();
}
size_label->setFixedWidth(180);
hide_label->setFixedWidth(180);
icon_label->setFixedWidth(180);
transparency_label->setFixedWidth(180);
background_label->setFixedWidth(180);
size_top_label->setFixedWidth(180);
hide_top_label->setFixedWidth(180);
size_bottom_label->setFixedWidth(180);
hide_bottom_label->setFixedWidth(180);
position_label->setFixedWidth(180);
QHBoxLayout *layout1 = new QHBoxLayout();
layout1->setSpacing(10);
layout1->addWidget(size_label);
layout1->addWidget(size_slider);
layout1->addWidget(size_value_label);
layout1->addStretch();
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->setSpacing(10);
layout2->addWidget(hide_label);
layout2->addWidget(hide_switcher);
layout2->addStretch();
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->setSpacing(10);
layout3->addWidget(icon_label);
layout3->addWidget(icon_switcher);
layout3->addStretch();
QHBoxLayout *layout4 = new QHBoxLayout();
layout4->setSpacing(10);
layout4->addWidget(transparency_label);
layout4->addWidget(transparency_slider);
layout4->addStretch();
QHBoxLayout *layout5 = new QHBoxLayout();
layout5->setSpacing(10);
layout5->addWidget(background_label);
layout5->addWidget(backgound_combo);
layout5->addStretch();
QHBoxLayout *layout6 = new QHBoxLayout();
layout6->setSpacing(10);
layout6->addWidget(size_top_label);
layout6->addWidget(size_top_slider);
layout6->addWidget(size_top_value_label);
layout6->addStretch();
QHBoxLayout *layout7 = new QHBoxLayout();
layout7->setSpacing(10);
layout7->addWidget(hide_top_label);
layout7->addWidget(hide_top_switcher);
layout7->addStretch();
QHBoxLayout *layout8 = new QHBoxLayout();
layout8->setSpacing(10);
layout8->addWidget(size_bottom_label);
layout8->addWidget(size_bottom_slider);
layout8->addWidget(size_bottom_value_label);
layout8->addStretch();
QHBoxLayout *layout9 = new QHBoxLayout();
layout9->setSpacing(10);
layout9->addWidget(hide_bottom_label);
layout9->addWidget(hide_bottom_switcher);
layout9->addStretch();
QHBoxLayout *layout10 = new QHBoxLayout();
layout10->setSpacing(10);
layout10->addWidget(position_label);
layout10->addWidget(position_combo);
layout10->addStretch();
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(layout1);
layout->addLayout(layout2);
layout->addLayout(layout10);
layout->addLayout(layout3);
layout->addLayout(layout4);
layout->addLayout(layout5);
layout->addLayout(layout6);
layout->addLayout(layout7);
layout->addLayout(layout8);
layout->addLayout(layout9);
layout->addStretch();
setLayout(layout);
layout->setSpacing(10);
layout->setContentsMargins(20, 20, 0, 0);
this->setLanguage();
}
MenuWidget::~MenuWidget()
{
if (size_label != NULL) {
delete size_label;
size_label = NULL;
}
if (size_value_label != NULL) {
delete size_value_label;
size_value_label = NULL;
}
if (hide_label != NULL) {
delete hide_label;
hide_label = NULL;
}
if (icon_label != NULL) {
delete icon_label;
icon_label = NULL;
}
if (transparency_label != NULL) {
delete transparency_label;
transparency_label = NULL;
}
if (background_label != NULL) {
delete background_label;
background_label = NULL;
}
if (size_top_label != NULL) {
delete size_top_label;
size_top_label = NULL;
}
if (hide_top_label != NULL) {
delete hide_top_label;
hide_top_label = NULL;
}
if (position_label != NULL) {
delete position_label;
position_label = NULL;
}
if (size_top_value_label != NULL) {
delete size_top_value_label;
size_top_value_label = NULL;
}
if (size_bottom_label != NULL) {
delete size_bottom_label;
size_bottom_label = NULL;
}
if (hide_bottom_label != NULL) {
delete hide_bottom_label;
hide_bottom_label = NULL;
}
if (size_bottom_value_label != NULL) {
delete size_bottom_value_label;
size_bottom_value_label = NULL;
}
if (size_slider != NULL) {
delete size_slider;
size_slider = NULL;
}
if (hide_switcher != NULL) {
delete hide_switcher;
hide_switcher = NULL;
}
if (icon_switcher != NULL) {
delete icon_switcher;
icon_switcher = NULL;
}
if (transparency_slider != NULL) {
delete transparency_slider;
transparency_slider = NULL;
}
if (backgound_combo != NULL) {
delete backgound_combo;
backgound_combo = NULL;
}
if (size_top_slider != NULL) {
delete size_top_slider;
size_top_slider = NULL;
}
if (size_bottom_slider != NULL) {
delete size_bottom_slider;
size_bottom_slider = NULL;
}
if (hide_top_switcher != NULL) {
delete hide_top_switcher;
hide_top_switcher = NULL;
}
if (hide_bottom_switcher != NULL) {
delete hide_bottom_switcher;
hide_bottom_switcher = NULL;
}
if (position_combo != NULL) {
delete position_combo;
position_combo = NULL;
}
}
QString MenuWidget::settingModuleName()
{
return "MenuPage";
}
void MenuWidget::setLanguage() {
size_label->setText(tr("Launcher icon size") + ":");
hide_label->setText(tr("Launcher hide mode") + ":");
icon_label->setText(tr("Display desktop icon") + ":");
transparency_label->setText(tr("Launcher Transparency") + ":");
background_label->setText(tr("Icon Background") + ":");
size_top_label->setText(tr("Top panel icon size") + ":");
hide_top_label->setText(tr("Top panel auto hide") + ":");
size_bottom_label->setText(tr("Bottom panel icon size") + ":");
hide_bottom_label->setText(tr("Bottom panel auto hide") + ":");
position_label->setText(tr("Launcher position") + ":");
}
void MenuWidget::initSettingData()
{
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui") {
emit this->requestMateOrUnityMenuData(true);
}
else {
emit this->requestMateOrUnityMenuData(false);
}
this->initConnect();
}
void MenuWidget::onSendMatePanelIconValue(int topIconSize, int bottomIconSize, bool topIconHide, bool bottomIconHide)
{
size_top_slider->setValue(topIconSize);
size_top_value_label->setText(QString::number(topIconSize));
size_bottom_slider->setValue(bottomIconSize);
size_bottom_value_label->setText(QString::number(bottomIconSize));
hide_top_switcher->switchedOn = topIconHide;
hide_bottom_switcher->switchedOn = bottomIconHide;
}
void MenuWidget::onSendUnityIconValue(int iconSize, bool iconHide, bool desktopIconShowed, double launcherTransparency, int iconColourIndex, const QStringList &colourlist)
{
size_slider->setValue(iconSize);
size_value_label->setText(QString::number(iconSize));
hide_switcher->switchedOn = iconHide;
icon_switcher->switchedOn = desktopIconShowed;
transparency_slider->setValue(launcherTransparency);
QString current_icon_colouring = "";
if (iconColourIndex == 0) {
current_icon_colouring = "all programs";
}
else if (iconColourIndex == 1) {
current_icon_colouring = "only run app";
}
else if (iconColourIndex == 2) {
current_icon_colouring = "no coloring";
}
else if (iconColourIndex == 3) {
current_icon_colouring = "edge coloring";
}
else if (iconColourIndex == 4) {
current_icon_colouring = "each workspace alternating coloring";
}
m_colourlist.clear();
m_colourlist = colourlist;
backgound_combo->clearEditText();
backgound_combo->addItems(m_colourlist);
QList::Iterator it = m_colourlist.begin(), itend = m_colourlist.end();
int initIndex = 0;
for(;it != itend; it++,initIndex++)
{
if(*it == current_icon_colouring)
break;
}
backgound_combo->setCurrentIndex(initIndex);
}
void MenuWidget::onSendUnityLauncherPosition(const QString ¤t_position, const QStringList &positionlist)
{
m_positionlist.clear();
m_positionlist = positionlist;
position_combo->clear();
position_combo->clearEditText();
position_combo->addItems(m_positionlist);
QList::Iterator it2 = m_positionlist.begin(), itend2 = m_positionlist.end();
int initIndex = 0;
for(;it2 != itend2; it2++,initIndex++)
{
if(*it2 == current_position)
break;
}
position_combo->setCurrentIndex(initIndex);
}
void MenuWidget::initConnect() {
// connect(back_btn, SIGNAL(clicked()), this, SIGNAL(showSettingMainWidget()));
connect(size_slider, SIGNAL(valueChanged(int)), this, SLOT(setIconSizeValue(int)));
connect(hide_switcher, SIGNAL(clicked()), this, SLOT(setAutoHide()));
connect(icon_switcher, SIGNAL(clicked()), this, SLOT(setDisplayDesktopIcon()));
connect(transparency_slider, SIGNAL(valueChanged(double)), this, SLOT(setTransparencyValue(double)));
connect(backgound_combo, SIGNAL(currentIndexChanged(QString)), this, SLOT(setIconColouring(QString)));
connect(position_combo, SIGNAL(currentIndexChanged(QString)), this, SLOT(setLauncherPosition(QString)));
connect(size_top_slider, SIGNAL(valueChanged(int)), this, SLOT(setTopIconSizeValue(int)));
connect(size_bottom_slider, SIGNAL(valueChanged(int)), this, SLOT(setBottomIconSizeValue(int)));
connect(hide_top_switcher, SIGNAL(clicked()), this, SLOT(setTopAutoHide()));
connect(hide_bottom_switcher, SIGNAL(clicked()), this, SLOT(setBottomAutoHide()));
// connect(sessionproxy, SIGNAL(bool_value_notify(QString, bool)), this, SLOT(launcherwidget_notify_bool(QString, bool)));
// connect(sessionproxy, SIGNAL(double_value_notify(QString, double)), this, SLOT(launcherwidget_notify_double(QString, double)));
// connect(sessionproxy, SIGNAL(int_value_notify(QString, int)), this, SLOT(launcherwidget_notify_int(QString, int)));
// connect(sessionproxy, SIGNAL(string_value_notify(QString, QString)), this, SLOT(launcherwidget_notify_string(QString, QString)));
}
void MenuWidget::launcherwidget_notify_double(QString key, double value)
{
if (key == "launcher-opacity") {
transparency_slider->setValue(value);
}
}
void MenuWidget::launcherwidget_notify_bool(QString key, bool value)
{
if (key == "auto-hide-top") {
hide_top_switcher->switchedOn = value;
}
else if (key == "auto-hide-bottom") {
hide_bottom_switcher->switchedOn = value;
}
}
void MenuWidget::launcherwidget_notify_int(QString key, int value)
{
if (key == "icon-size") {
size_slider->setValue(value);
size_value_label->setText(QString::number(value));
}
if (key == "launcher-hide-mode") {
if (value == 0)
hide_switcher->switchedOn = false;
else if (value == 1)
hide_switcher->switchedOn = true;
}
if (key == "backlight-mode") {
QString current_icon_colouring = "";
if (value == 0) {
current_icon_colouring = "all programs";
}
else if (value == 1) {
current_icon_colouring = "only run app";
}
else if (value == 2) {
current_icon_colouring = "no coloring";
}
else if (value == 3) {
current_icon_colouring = "edge coloring";
}
else if (value == 4) {
current_icon_colouring = "each workspace alternating coloring";
}
QList::Iterator it = m_colourlist.begin(), itend = m_colourlist.end();
int index = -1;
bool exist = false;
for(;it != itend; it++)
{
++index;
if(*it == current_icon_colouring) {
exist = true;
break;
}
}
if (exist) {
exist = false;
backgound_combo->setCurrentIndex(index);
}
else
backgound_combo->setCurrentIndex(-1);
}
if (key == "size-top") {
size_top_slider->setValue(value);
size_top_value_label->setText(QString::number(value));
}
else if (key == "size-bottom") {
size_bottom_slider->setValue(value);
size_bottom_value_label->setText(QString::number(value));
}
}
void MenuWidget::launcherwidget_notify_string(QString key, QString value)
{
if (key == "launcher-position") {
QList::Iterator it = m_positionlist.begin(), itend = m_positionlist.end();
int index = -1;
bool exist = false;
for(;it != itend; it++)
{
++index;
if(*it == value) {
exist = true;
break;
}
}
if (exist) {
exist = false;
position_combo->setCurrentIndex(index);
}
else
position_combo->setCurrentIndex(-1);
}
}
void MenuWidget::setIconSizeValue(int value) {
size_value_label->setText(QString::number(value));
emit resetIconSizeValue(value);
}
void MenuWidget::setTransparencyValue(double value)
{
emit resetTransparencyValue(value);
}
void MenuWidget::setIconColouring(QString selectColour) {
if (selectColour == "all programs") {
emit this->resetIconColouring(0);
}
else if (selectColour == "only run app") {
emit this->resetIconColouring(1);
}
else if (selectColour == "no coloring") {
emit this->resetIconColouring(2);
}
else if (selectColour == "edge coloring") {
emit this->resetIconColouring(3);
}
else if (selectColour == "each workspace alternating coloring") {
emit this->resetIconColouring(4);
}
}
void MenuWidget::setAutoHide() {
emit this->resetAutoHide(hide_switcher->switchedOn);
}
void MenuWidget::setDisplayDesktopIcon() {
emit this->resetDisplayDesktopIcon(icon_switcher->switchedOn);
}
void MenuWidget::setTopIconSizeValue(int value){
size_top_value_label->setText(QString::number(value));
emit this->resetTopIconSizeValue(value);
}
void MenuWidget::setBottomIconSizeValue(int value){
size_bottom_value_label->setText(QString::number(value));
emit this->resetBottomIconSizeValue(value);
}
void MenuWidget::setTopAutoHide() {
emit this->resetTopAutoHide(hide_top_switcher->switchedOn);
}
void MenuWidget::setBottomAutoHide() {
emit this->resetBottomAutoHide(hide_bottom_switcher->switchedOn);
}
void MenuWidget::setLauncherPosition(QString position) {
emit this->resetLauncherPosition(position);
}
youker-assistant/setting/iconwidget.h 0000664 0001750 0001750 00000005102 15227663670 017023 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 ICONWIDGET_H
#define ICONWIDGET_H
#include
#include "../component/kylinswitcher.h"
class QLabel;
class QPushButton;
class QHBoxLayout;
class QComboBox;
#include "settingmodulelpage.h"
class IconWidget : public SettingModulePage
{
Q_OBJECT
public:
explicit IconWidget(QWidget *parent = 0, QString cur_desktop = "");
~IconWidget();
void setLanguage();
void initConnect();
void initSettingData() Q_DECL_OVERRIDE;
QString settingModuleName() Q_DECL_OVERRIDE;
public slots:
void changeSwitcherStatus();
void setIconTheme(QString selectTheme);
// void setShowDesktopIcons();
void setComputerIcon();
void setFolderIcon();
void setNetworkIcon();
void setRecycleBinIcon();
void setDiskIcon();
void iconwidget_notify_string(QString key, QString value);
void iconwidget_notify_bool(QString key, bool value);
void onReceiveIconThemeList(const QString ¤tTheme, const QStringList &themeList);
void onReceiveDisplayIconValue(bool computer, bool folder, bool network, bool recycle, bool disk);
signals:
void requestIconData();
void resetIconTheme(const QString &theme);
void displayComputerIcon(bool b);
void displayFolderIcon(bool b);
void displayNetworkIcon(bool b);
void displayRecycleBinIcon(bool b);
void displayDiskIcon(bool b);
private:
QString desktop;
QStringList iconlist;
QLabel *theme_label;
// QLabel *show_label;
QLabel *computer_label;
QLabel *folder_label;
QLabel *network_label;
QLabel *recycle_label;
QLabel *disk_label;
QComboBox *theme_combo;
// KylinSwitcher *show_switcher;
KylinSwitcher *computer_switcher;
KylinSwitcher *folder_switcher;
KylinSwitcher *network_switcher;
KylinSwitcher *recycle_switcher;
KylinSwitcher *disk_switcher;
};
#endif // ICONWIDGET_H
youker-assistant/setting/fontwidget.cpp 0000664 0001750 0001750 00000060543 15227663670 017406 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 "fontwidget.h"
#include
#include "../component/kylinfontdialog.h"
#include "../src/mainwindow.h"
FontWidget::FontWidget(QWidget *parent, MainWindow *window, QString cur_desktop, QString skin) :
SettingModulePage(parent),
parentWindow(window),
desktop(cur_desktop),
cur_skin(skin)
{
default_font_label = new QLabel();
desktop_font_label = new QLabel();
monospace_font_label = new QLabel();
document_font_label = new QLabel();
titlebar_font_label = new QLabel();
scaling_label = new QLabel();
hinting_label = new QLabel();
antialiasing_label = new QLabel();
default_font_btn = new QPushButton();
desktop_font_btn = new QPushButton();
monospace_font_btn = new QPushButton();
document_font_btn = new QPushButton();
titlebar_font_btn = new QPushButton();
scaling_slider = new QDoubleSpinBox();
scaling_slider->setButtonSymbols(QAbstractSpinBox::PlusMinus);
scaling_slider->setSingleStep(0.1);
scaling_slider->setMinimum(0.5);
scaling_slider->setMaximum(3.0);
hinting_combo = new QComboBox();
antialiasing_combo = new QComboBox();
restore_default_font_btn = new QPushButton();
restore_desktop_font_btn = new QPushButton();
restore_monospace_font_btn = new QPushButton();
restore_document_font_btn = new QPushButton();
restore_titlebar_font_btn = new QPushButton();
restore_default_font_btn->setFixedSize(91, 25);
restore_desktop_font_btn->setFixedSize(91, 25);
restore_monospace_font_btn->setFixedSize(91, 25);
restore_document_font_btn->setFixedSize(91, 25);
restore_titlebar_font_btn->setFixedSize(91, 25);
restore_default_font_btn->setObjectName("blackButton");
restore_desktop_font_btn->setObjectName("blackButton");
restore_monospace_font_btn->setObjectName("blackButton");
restore_document_font_btn->setObjectName("blackButton");
restore_titlebar_font_btn->setObjectName("blackButton");
restore_default_font_btn->setFocusPolicy(Qt::NoFocus);
restore_desktop_font_btn->setFocusPolicy(Qt::NoFocus);
restore_monospace_font_btn->setFocusPolicy(Qt::NoFocus);
restore_document_font_btn->setFocusPolicy(Qt::NoFocus);
restore_titlebar_font_btn->setFocusPolicy(Qt::NoFocus);
default_font_btn->setObjectName("transparentButton");
desktop_font_btn->setObjectName("transparentButton");
monospace_font_btn->setObjectName("transparentButton");
document_font_btn->setObjectName("transparentButton");
titlebar_font_btn->setObjectName("transparentButton");
default_font_btn->setFocusPolicy(Qt::NoFocus);
desktop_font_btn->setFocusPolicy(Qt::NoFocus);
monospace_font_btn->setFocusPolicy(Qt::NoFocus);
document_font_btn->setFocusPolicy(Qt::NoFocus);
titlebar_font_btn->setFocusPolicy(Qt::NoFocus);
default_font_btn->setToolTip(tr("Click here to change font"));
desktop_font_btn->setToolTip(tr("Click here to change font"));
monospace_font_btn->setToolTip(tr("Click here to change font"));
document_font_btn->setToolTip(tr("Click here to change font"));
titlebar_font_btn->setToolTip(tr("Click here to change font"));
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui") {
scaling_label->hide();
scaling_slider->hide();
}
default_font_label->setFixedWidth(150);
desktop_font_label->setFixedWidth(150);
monospace_font_label->setFixedWidth(150);
document_font_label->setFixedWidth(150);
titlebar_font_label->setFixedWidth(150);
scaling_label->setFixedWidth(150);
hinting_label->setFixedWidth(150);
antialiasing_label->setFixedWidth(150);
QHBoxLayout *layout1 = new QHBoxLayout();
layout1->setSpacing(10);
layout1->addWidget(default_font_label);
layout1->addWidget(default_font_btn);
layout1->addStretch();
layout1->addWidget(restore_default_font_btn);
layout1->setContentsMargins(0, 0, 200, 0);
QHBoxLayout *layout2 = new QHBoxLayout();
layout2->setSpacing(10);
layout2->addWidget(desktop_font_label);
layout2->addWidget(desktop_font_btn);
layout2->addStretch();
layout2->addWidget(restore_desktop_font_btn);
layout2->setContentsMargins(0, 0, 200, 0);
QHBoxLayout *layout3 = new QHBoxLayout();
layout3->setSpacing(10);
layout3->addWidget(monospace_font_label);
layout3->addWidget(monospace_font_btn);
layout3->addStretch();
layout3->addWidget(restore_monospace_font_btn);
layout3->setContentsMargins(0, 0, 200, 0);
QHBoxLayout *layout4 = new QHBoxLayout();
layout4->setSpacing(10);
layout4->addWidget(document_font_label);
layout4->addWidget(document_font_btn);
layout4->addStretch();
layout4->addWidget(restore_document_font_btn);
layout4->setContentsMargins(0, 0, 200, 0);
QHBoxLayout *layout5 = new QHBoxLayout();
layout5->setSpacing(10);
layout5->addWidget(titlebar_font_label);
layout5->addWidget(titlebar_font_btn);
layout5->addStretch();
layout5->addWidget(restore_titlebar_font_btn);
layout5->setContentsMargins(0, 0, 200, 0);
QHBoxLayout *layout6 = new QHBoxLayout();
layout6->setSpacing(10);
layout6->addWidget(scaling_label);
layout6->addWidget(scaling_slider);
layout6->addStretch();
QHBoxLayout *layout7 = new QHBoxLayout();
layout7->setSpacing(10);
layout7->addWidget(hinting_label);
layout7->addWidget(hinting_combo);
layout7->addStretch();
QHBoxLayout *layout8 = new QHBoxLayout();
layout8->setSpacing(10);
layout8->addWidget(antialiasing_label);
layout8->addWidget(antialiasing_combo);
layout8->addStretch();
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(layout1);
layout->addLayout(layout2);
layout->addLayout(layout3);
layout->addLayout(layout4);
layout->addLayout(layout5);
layout->addLayout(layout6);
layout->addLayout(layout7);
layout->addLayout(layout8);
layout->addStretch();
// bottom_widget->setLayout(layout);
setLayout(layout);
layout->setSpacing(10);
layout->setContentsMargins(20, 20, 20, 0);
// splitter->addWidget(top_widget);
// splitter->addWidget(bottom_widget);
// QHBoxLayout *main_layout = new QHBoxLayout;
// main_layout->addStretch();
// main_layout->addWidget(splitter);
// main_layout->setSpacing(0);
// main_layout->setContentsMargins(0, 0, 0, 0);
// setLayout(main_layout);
// this->initSettingData();
this->setLanguage();
}
FontWidget::~FontWidget()
{
if (default_font_label != NULL) {
delete default_font_label;
default_font_label = NULL;
}
if (desktop_font_label != NULL) {
delete desktop_font_label;
desktop_font_label = NULL;
}
if (monospace_font_label != NULL) {
delete monospace_font_label;
monospace_font_label = NULL;
}
if (document_font_label != NULL) {
delete document_font_label;
document_font_label = NULL;
}
if (titlebar_font_label != NULL) {
delete titlebar_font_label;
titlebar_font_label = NULL;
}
if (scaling_label != NULL) {
delete scaling_label;
scaling_label = NULL;
}
if (hinting_label != NULL) {
delete hinting_label;
hinting_label = NULL;
}
if (antialiasing_label != NULL) {
delete antialiasing_label;
antialiasing_label = NULL;
}
if (default_font_btn != NULL) {
delete default_font_btn;
default_font_btn = NULL;
}
if (desktop_font_btn != NULL) {
delete desktop_font_btn;
desktop_font_btn = NULL;
}
if (monospace_font_btn != NULL) {
delete monospace_font_btn;
monospace_font_btn = NULL;
}
if (document_font_btn != NULL) {
delete document_font_btn;
document_font_btn = NULL;
}
if (titlebar_font_btn != NULL) {
delete titlebar_font_btn;
titlebar_font_btn = NULL;
}
if (scaling_slider != NULL) {
delete scaling_slider;
scaling_slider = NULL;
}
if (hinting_combo != NULL) {
delete hinting_combo;
hinting_combo = NULL;
}
if (antialiasing_combo != NULL) {
delete antialiasing_combo;
antialiasing_combo = NULL;
}
if (restore_default_font_btn != NULL) {
delete restore_default_font_btn;
restore_default_font_btn = NULL;
}
if (restore_desktop_font_btn != NULL) {
delete restore_desktop_font_btn;
restore_desktop_font_btn = NULL;
}
if (restore_monospace_font_btn != NULL) {
delete restore_monospace_font_btn;
restore_monospace_font_btn = NULL;
}
if (restore_document_font_btn != NULL) {
delete restore_document_font_btn;
restore_document_font_btn = NULL;
}
if (restore_titlebar_font_btn != NULL) {
delete restore_titlebar_font_btn;
restore_titlebar_font_btn = NULL;
}
}
QString FontWidget::settingModuleName()
{
return "FontPage";
}
void FontWidget::setLanguage() {
// title_label->setText(tr("Default font settings"));
// description_label->setText(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."));
// back_btn->setText(tr("Back"));
default_font_label->setText(tr("Default Font") + ":");
desktop_font_label->setText(tr("Desktop Font") + ":");
monospace_font_label->setText(tr("Monospace Font") + ":");
document_font_label->setText(tr("Document Font") + ":");
titlebar_font_label->setText(tr("Titlebar Font") + ":");
scaling_label->setText(tr("Global Font Scaling") + ":");
hinting_label->setText(tr("Hinting") + ":");
antialiasing_label->setText(tr("Antialiasing") + ":");
restore_default_font_btn->setText(tr("Restore"));
restore_desktop_font_btn->setText(tr("Restore"));
restore_monospace_font_btn->setText(tr("Restore"));
restore_document_font_btn->setText(tr("Restore"));
restore_titlebar_font_btn->setText(tr("Restore"));
}
void FontWidget::initSettingData()
{
emit requestFontData();
/*current_font = sessionproxy->get_font_qt();
desktop_font = sessionproxy->get_desktop_font_qt();
if(desktop_font.isEmpty())
{
// sessionproxy->set_desktop_font_qt_default();
if (this->desktop == "mate" || this->desktop == "MATE" || this->desktop == "UKUI" || this->desktop == "ukui")
sessionproxy->set_desktop_font_qt("Sans 10");
else
sessionproxy->set_desktop_font_qt("Ubuntu 11");
}
desktop_font = sessionproxy->get_desktop_font_qt();
monospace_font = sessionproxy->get_monospace_font_qt();
document_font = sessionproxy->get_document_font_qt();
titlebar_font = sessionproxy->get_window_title_font_qt();
default_font_btn->setText(current_font);
desktop_font_btn->setText(desktop_font);
monospace_font_btn->setText(monospace_font);
document_font_btn->setText(document_font);
titlebar_font_btn->setText(titlebar_font);
if (this->desktop != "mate" || this->desktop == "MATE") {
scaling_slider->setValue(sessionproxy->get_font_zoom_qt());
}
QString current_smooth = sessionproxy->get_smooth_style_qt();
m_smoothlist = sessionproxy->get_smooth_style_list_qt();
hinting_combo->clear();
hinting_combo->clearEditText();
hinting_combo->addItems(m_smoothlist);
QList::Iterator it = m_smoothlist.begin(), itend = m_smoothlist.end();
int initIndex = 0;
for(;it != itend; it++,initIndex++)
{
if(*it == current_smooth)
break;
}
hinting_combo->setCurrentIndex(initIndex);
QString current_antialiasing = sessionproxy->get_antialiasing_style_qt();
m_antialiasinglist = sessionproxy->get_antialiasing_style_list_qt();
antialiasing_combo->clear();
antialiasing_combo->clearEditText();
antialiasing_combo->addItems(m_antialiasinglist);
QList::Iterator ite = m_antialiasinglist.begin(), iteend = m_antialiasinglist.end();
int index = 0;
for(;ite != iteend; ite++,index++)
{
if(*ite == current_antialiasing)
break;
}
antialiasing_combo->setCurrentIndex(index);*/
this->initConnect();
}
void FontWidget::onSendFontValue(const QString &curFont)
{
default_font_btn->setText(curFont);
}
void FontWidget::onSendDesktopFontValue(const QString &curFont)
{
desktop_font_btn->setText(curFont);
}
void FontWidget::onSendMonospaceFontValue(const QString &curFont)
{
monospace_font_btn->setText(curFont);
}
void FontWidget::onSendDocumentFontValue(const QString &curFont)
{
document_font_btn->setText(curFont);
}
void FontWidget::onSendTitlebarFontValue(const QString &curFont)
{
titlebar_font_btn->setText(curFont);
}
void FontWidget::onSendFontSmoothAndAntialiasingValue(double fontZoom, const QString ¤t_smooth, const QStringList &smoothlist, const QString ¤t_antialiasing, const QStringList &antialiasinglist)
{
if (this->desktop != "mate" || this->desktop == "MATE") {
scaling_slider->setValue(fontZoom);
}
m_smoothlist.clear();
m_smoothlist = smoothlist;
hinting_combo->clear();
hinting_combo->clearEditText();
hinting_combo->addItems(m_smoothlist);
QList