代码拉取完成,页面将自动刷新
同步操作将从 柚子/Oh my dde 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "systemuipage.h"
#include "ui_systemuipage.h"
#include <QProcess>
#include <QDebug>
SystemUiPage::SystemUiPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::SystemUiPage)
{
ui->setupUi(this);
QString output;
QProcess *m_qprocess=new QProcess;
//启动器图标大小
m_qprocess->start("gsettings get com.deepin.dde.launcher apps-icon-ratio");
m_qprocess->waitForFinished();
output=m_qprocess->readAll();
output.remove("\n");
output.remove(" ");
output.remove("\t");
output.remove("file://");
ui->doubleSpinBox->setValue(output.toDouble());
connect(ui->doubleSpinBox, static_cast<void(QDoubleSpinBox::*)(const QString &)>(&QDoubleSpinBox::valueChanged),[=](const QString &text)
{
m_qprocess->start("gsettings set com.deepin.dde.launcher apps-icon-ratio "+text);
});
//GTK标题栏高度
QString tmp1;
QFile file(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.local/share/deepin/themes/deepin/light/titlebar.ini");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug()<< "无法打开"+QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.local/share/deepin/themes/deepin/light/titlebar.ini";
}
while(!file.atEnd())
{
QByteArray line = file.readLine();
QString str(line);
//qDebug()<< str;
tmp1.append(str);
}
tmp1=tmp1.mid(tmp1.indexOf("height=")+7,2);
ui->spinBox_2->setValue(tmp1.toInt());
connect(ui->spinBox_2, static_cast<void(QSpinBox::*)(const QString &)>(&QSpinBox::valueChanged),[=](const QString &text)
{
m_qprocess->start("/opt/apps/top.yzzi.youjian/files/titlebar.sh "+text);
});
//热区
QSettings *qaq=new QSettings(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/top.yzzi.youjian/setting.qaq", QSettings::IniFormat);
int i=0;
QList<QComboBox*> cl;
cl.append(ui->comboBox_2);
cl.append(ui->comboBox_3);
cl.append(ui->comboBox_4);
cl.append(ui->comboBox_5);
QStringList cln;
cln.append("TopLeftShell");
cln.append("TopRightShell");
cln.append("LowerLeftShell");
cln.append("LowerRightShell");
while (i<4) {
QStringList sl;
sl << ""
<< "dde-launcher -s"
<<"/usr/lib/deepin-daemon/desktop-toggle"
<<"dbus-send --print-reply --dest=com.deepin.dde.shutdownFront /com/deepin/dde/shutdownFront com.deepin.dde.shutdownFront.Show"
<<"xset dpms force off"
<<"dbus-send --session --dest=com.deepin.wm --print-reply /com/deepin/wm com.deepin.wm.PerformAction int32:1";
int t=0;
while (t<=sl.size()) {
if(sl.indexOf(qaq->value(cln[i]).toString()))
{
cl[i]->setCurrentIndex(sl.indexOf(qaq->value(cln[i]).toString()));
}
t++;
}
connect(cl[i], static_cast<void (QComboBox::*)(int index)>(&QComboBox::currentIndexChanged),[=](const int &index)
{
qaq->setValue(cln[i],sl[index]);
m_qprocess->start("killall omd-requ");
m_qprocess->waitForFinished();
m_qprocess->startDetached("/opt/apps/top.yzzi.youjian/files/omd-requ/omd-requ");
});
i++;
}
//dock模式切换
m_qprocess->start("gsettings get com.deepin.dde.dock display-mode");
m_qprocess->waitForFinished();
output=m_qprocess->readAll();
output.remove("\n");
output.remove(" ");
output.remove("\t");
output.remove("file://");
if(output=="'classic'")
{
ui->comboBox->setCurrentIndex(2);
}else if(output=="'fashion'")
{
ui->comboBox->setCurrentIndex(0);
}else if(output=="'efficient'")
{
ui->comboBox->setCurrentIndex(1);
}
connect(ui->comboBox, static_cast<void (QComboBox::*)(int index)>(&QComboBox::currentIndexChanged),[=](const int &index)
{
QFileInfo *file=new QFileInfo(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/autostart/omd-classic.desktop");
switch (index) {
case 0:
if(file->exists()==true)
{
QFile::remove(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/autostart/omd-classic.desktop");
}
m_qprocess->start("gsettings set com.deepin.dde.dock display-mode 'fashion'");
break;
case 1:
if(file->exists()==true)
{
QFile::remove(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/autostart/omd-classic.desktop");
}
m_qprocess->start("gsettings set com.deepin.dde.dock display-mode 'efficient'");
break;
case 2:
if(file->exists()==false)
{
QFile::copy(":/kjfs/omd-classic.desktop",QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/autostart/omd-classic.desktop");
}
m_qprocess->start("gsettings set com.deepin.dde.dock display-mode 'classic'");
break;
}
delete file;
});
//系统圆角大小
m_qprocess->start("gsettings get com.deepin.xsettings dtk-window-radius");
m_qprocess->waitForFinished();
output=m_qprocess->readAll();
output.remove("\n");
output.remove(" ");
output.remove("\t");
output.remove("file://");
ui->spinBox->setValue(output.toDouble());
connect(ui->spinBox, static_cast<void(QSpinBox::*)(const QString &)>(&QSpinBox::valueChanged),[=](const QString &text)
{
m_qprocess->start("gsettings set com.deepin.xsettings dtk-window-radius "+text);
});
//dock多屏横跳
m_qprocess->start("gsettings get com.deepin.dde.dock.mainwindow only-show-primary");
m_qprocess->waitForFinished();
output=m_qprocess->readAll();
output.remove("\n");
output.remove(" ");
output.remove("\t");
output.remove("file://");
if (output=="false")
{
ui->sb2->setChecked(true);
}else if(output=="true")
{
ui->sb2->setChecked(false);
}
connect(ui->sb2, &DSwitchButton::checkedChanged, this, [=](bool tmp)
{
if(tmp==false)
{
m_qprocess->start("gsettings set com.deepin.dde.dock.mainwindow only-show-primary true");
}else{
m_qprocess->start("gsettings set com.deepin.dde.dock.mainwindow only-show-primary false");
}
});
//启动器包名搜索
m_qprocess->start("gsettings get com.deepin.dde.launcher search-package-name");
m_qprocess->waitForFinished();
output=m_qprocess->readAll();
output.remove("\n");
output.remove(" ");
output.remove("\t");
output.remove("file://");
if (output=="false")
{
ui->sb1->setChecked(false);
}else if(output=="true")
{
ui->sb1->setChecked(true);
}
connect(ui->sb1, &DSwitchButton::checkedChanged, this, [=](bool tmp)
{
if(tmp==false)
{
m_qprocess->start("gsettings set com.deepin.dde.launcher search-package-name false");
}else{
m_qprocess->start("gsettings set com.deepin.dde.launcher search-package-name true");
}
});
//关闭通知
m_qprocess->start("gsettings get com.deepin.dde.notifications notifycation-closed");
m_qprocess->waitForFinished();
output=m_qprocess->readAll();
output.remove("\n");
output.remove(" ");
output.remove("\t");
output.remove("file://");
if (output=="false")
{
ui->sb3->setChecked(false);
}else if(output=="true")
{
ui->sb3->setChecked(true);
}
connect(ui->sb3, &DSwitchButton::checkedChanged, this, [=](bool tmp)
{
if(tmp==false)
{
m_qprocess->start("gsettings set com.deepin.dde.notifications notifycation-closed false");
}else{
m_qprocess->start("gsettings set com.deepin.dde.notifications notifycation-closed true");
}
});
//通知图标显示
m_qprocess->start("gsettings get com.deepin.dde.notifications show-icon");
m_qprocess->waitForFinished();
output=m_qprocess->readAll();
output.remove("\n");
output.remove(" ");
output.remove("\t");
output.remove("file://");
if (output=="false")
{
ui->sb4->setChecked(false);
}else if(output=="true")
{
ui->sb4->setChecked(true);
}
connect(ui->sb4, &DSwitchButton::checkedChanged, this, [=](bool tmp)
{
if(tmp==false)
{
m_qprocess->start("gsettings set com.deepin.dde.notifications show-icon false");
}else{
m_qprocess->start("gsettings set com.deepin.dde.notifications show-icon true");
}
});
}
SystemUiPage::~SystemUiPage()
{
delete ui;
}
void SystemUiPage::setTheme(bool isDark,QColor color)
{
// 菜单图标
if(isDark){
// 黑色模式
QPalette *palette = new QPalette;
palette->setColor(QPalette::Window,QColor("#282828"));
palette->setColor(QPalette::Base,QColor("#282828"));
ui->scrollArea->setPalette(*palette);
}else {
// 亮色模式
QPalette *palette = new QPalette;
palette->setColor(QPalette::Window,QColor("#FFFFFF"));
palette->setColor(QPalette::Base,QColor("#FFFFFF"));
ui->scrollArea->setPalette(*palette);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。