From 60827322d6895ecd8f31844514ea9fb71afeb049 Mon Sep 17 00:00:00 2001 From: tanyulong2021 Date: Tue, 13 Jul 2021 09:59:57 +0800 Subject: [PATCH 1/2] add title icon --- 0012-window-add-title-icon.patch | 230 +++++++++++++++++++++++++++++++ ukui-control-center.spec | 7 +- 2 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 0012-window-add-title-icon.patch diff --git a/0012-window-add-title-icon.patch b/0012-window-add-title-icon.patch new file mode 100644 index 0000000..beb345c --- /dev/null +++ b/0012-window-add-title-icon.patch @@ -0,0 +1,230 @@ +From 4488d85f9e7326a021ed2bed6811bd20c3c05dba Mon Sep 17 00:00:00 2001 +From: tanyulong +Date: Tue, 13 Jul 2021 09:50:49 +0800 +Subject: [PATCH] window add title icon + +--- + shell/customstyle.cpp | 10 +++++++++- + shell/mainwindow.cpp | 44 +++++++++++++++++++++++++------------------ + shell/mainwindow.h | 1 + + shell/mainwindow.ui | 4 ++-- + shell/prescene.cpp | 14 +++++++++++++- + shell/prescene.h | 1 + + 6 files changed, 52 insertions(+), 22 deletions(-) + +diff --git a/shell/customstyle.cpp b/shell/customstyle.cpp +index 0718c2e..82ae674 100755 +--- a/shell/customstyle.cpp ++++ b/shell/customstyle.cpp +@@ -138,7 +138,6 @@ void InternalStyle::drawComplexControl(QStyle::ComplexControl control, const QSt + void InternalStyle::polish(QPalette &pal) + { + QProxyStyle::polish(pal); +- pal.setColor(QPalette::Window, pal.base().color()); + pal.setColor(QPalette::Inactive, QPalette::Base, pal.base().color()); + // pal.setColor(QPalette::Button, pal.alternateBase().color()); + } +@@ -151,4 +150,13 @@ void InternalStyle::polish(QWidget *widget) + pal.setColor(QPalette::Base, pal.alternateBase().color()); + widget->setPalette(pal); + } ++ ++ // 跳过左侧边栏处理 ++ if (widget && widget->objectName() == "leftsidebarWidget") { ++ ++ } else if (widget){ ++ QPalette paltte = widget->palette(); ++ paltte.setColor(QPalette::Window, paltte.base().color()); ++ widget->setPalette(paltte); ++ } + } +diff --git a/shell/mainwindow.cpp b/shell/mainwindow.cpp +index a85b68a..9a602ef 100755 +--- a/shell/mainwindow.cpp ++++ b/shell/mainwindow.cpp +@@ -368,6 +368,7 @@ void MainWindow::initUI() { + //左上角显示字符/返回按钮 + backBtn->setVisible(index); + titleLabel->setHidden(index); ++ mTitleIcon->setHidden(index); + + if (index){ //首页部分组件样式 + //中部内容区域 +@@ -416,7 +417,8 @@ void MainWindow::initUI() { + + void MainWindow::initTileBar() { + +- ui->titleLayout->setContentsMargins(9, 9, 9, 0); ++ ui->titleLayout->setContentsMargins(4, 4, 4, 0); ++ ui->titleLayout->setSpacing(0); + m_searchWidget = new SearchWidget(this); + // char style[100]; + // sprintf(style, "SearchWidget{border:0px;background-color:palette(base);border-radius:8px;}", +@@ -428,10 +430,9 @@ void MainWindow::initTileBar() { + m_queryWid=new QWidget; + m_queryWid->setParent(m_searchWidget); + m_queryWid->setFocusPolicy(Qt::NoFocus); +-// m_queryWid->setStyleSheet("border:0px;background:transparent"); + + QHBoxLayout* queryWidLayout = new QHBoxLayout; +- queryWidLayout->setContentsMargins(4,4,0,0); ++ queryWidLayout->setContentsMargins(0, 0, 0, 0); + queryWidLayout->setAlignment(Qt::AlignJustify); + queryWidLayout->setSpacing(0); + m_queryWid->setLayout(queryWidLayout); +@@ -463,22 +464,29 @@ void MainWindow::initTileBar() { + backBtn = new QPushButton(this); + minBtn = new QPushButton(this); + maxBtn = new QPushButton(this); +- closeBtn = new QPushButton(this); ++ closeBtn = new QPushButton(this); ++ mTitleIcon = new QLabel(this); + titleLabel = new QLabel(tr("UKCC"), this); + +- backBtn->setFixedSize(32, 32); +- minBtn->setFixedSize(32, 32); +- maxBtn->setFixedSize(32, 32); + // titleLabel->setFixedSize(32, 32); +- titleLabel->setFixedHeight(32); +- titleLabel->setMinimumWidth(32); ++ backBtn->setFixedSize(30, 30); ++ minBtn->setFixedSize(30, 30); ++ maxBtn->setFixedSize(30, 30); ++ closeBtn->setFixedSize(30, 30); ++ mTitleIcon->setFixedSize(30, 30); ++ ++ QIcon titleIcon = QIcon::fromTheme("ukui-control-center"); ++ mTitleIcon->setPixmap(titleIcon.pixmap(titleIcon.actualSize(QSize(24, 24)))); ++ ++ titleLabel->setFixedSize(30, 30); + titleLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + m_searchWidget->setMinimumWidth(350); +- m_searchWidget->setMinimumHeight(40); ++ m_searchWidget->setMinimumHeight(35); + m_searchWidget->setMaximumWidth(350); +- m_searchWidget->setMaximumHeight(40); +- +- ui->titleLayout->addSpacing(9); ++ m_searchWidget->setMaximumHeight(35); ++ ++ ui->titleLayout->addWidget(mTitleIcon); ++ ui->titleLayout->addSpacing(8); + ui->titleLayout->addWidget(titleLabel); + ui->titleLayout->addWidget(backBtn); + ui->titleLayout->addStretch(); +@@ -621,7 +629,7 @@ void MainWindow::initLeftsideBar(){ + connect(hBtn, &QPushButton::clicked, this, [=]{ + ui->stackedWidget->setCurrentIndex(0); + }); +- hBtn->setStyleSheet("QPushButton#homepage{background: palette(button); border: none;}"); ++ hBtn->setStyleSheet("QPushButton#homepage{background: palette(window); border: none;}"); + // hBtn->setStyleSheet("QPushButton#homepage{background: palette(base);}"); + ui->leftsidebarVerLayout->addStretch(); + ui->leftsidebarVerLayout->addWidget(hBtn); +@@ -646,7 +654,7 @@ void MainWindow::initLeftsideBar(){ + // button->setStyleSheet("QPushButton::checked{background: palette(button); border: none; border-image: url('://img/primaryleftmenu/checked.png');}" + // "QPushButton::!checked{background: palette(button);border: none;}"); + button->setStyleSheet("QPushButton::checked{background: palette(base); border-top-left-radius: 6px;border-bottom-left-radius: 6px;}" +- "QPushButton::!checked{background: palette(button);border: none;}"); ++ "QPushButton::!checked{background: palette(window);border: none;}"); + + connect(button, &QPushButton::clicked, this, [=]{ + QPushButton * btn = dynamic_cast(QObject::sender()); +@@ -688,9 +696,9 @@ QPushButton * MainWindow::buildLeftsideBtn(QString bname,QString tipName){ + iconBtn->setFocusPolicy(Qt::NoFocus); + + +- QString iconHomePageBtnQss = QString("QPushButton{background: palette(button); border: none;}"); ++ QString iconHomePageBtnQss = QString("QPushButton{background: palette(window); border: none;}"); + QString iconBtnQss = QString("QPushButton:checked{background: palette(base); border: none;}" +- "QPushButton:!checked{background: palette(button); border: none;}"); ++ "QPushButton:!checked{background: palette(window); border: none;}"); + QString path = QString("://img/primaryleftmenu/%1.svg").arg(iname); + QPixmap pix = ImageUtil::loadSvg(path, "default"); + //单独设置HomePage按钮样式 +@@ -806,7 +814,7 @@ void MainWindow::initStyleSheet() { + closeBtn->setFlat(true); + closeBtn->installEventFilter(this); + +- ui->leftsidebarWidget->setStyleSheet("QWidget#leftsidebarWidget{background-color: palette(button);border: none; border-top-left-radius: 6px; border-bottom-left-radius: 6px;}"); ++ ui->leftsidebarWidget->setStyleSheet("QWidget#leftsidebarWidget{background-color: palette(window);border: none; border-top-left-radius: 6px; border-bottom-left-radius: 6px;}"); + + // 设置左上角按钮图标 + backBtn->setIcon(QIcon("://img/titlebar/back.svg")); +diff --git a/shell/mainwindow.h b/shell/mainwindow.h +index bb44d7e..d01158f 100755 +--- a/shell/mainwindow.h ++++ b/shell/mainwindow.h +@@ -88,6 +88,7 @@ private: + QPushButton * maxBtn; + QPushButton * closeBtn; + QLabel * titleLabel; ++ QLabel * mTitleIcon; + QTimer * timer; + QLabel * logoLabel; + QLabel *m_queryIcon; +diff --git a/shell/mainwindow.ui b/shell/mainwindow.ui +index e1d9b44..1a6cd22 100755 +--- a/shell/mainwindow.ui ++++ b/shell/mainwindow.ui +@@ -66,8 +66,8 @@ + 0 + + +- 3 +- ++ 0 ++ + + 30 + +diff --git a/shell/prescene.cpp b/shell/prescene.cpp +index 7451c2c..dd04531 100755 +--- a/shell/prescene.cpp ++++ b/shell/prescene.cpp +@@ -15,6 +15,14 @@ PreScene::PreScene(QLabel *label, QSize size, QWidget *parent) : titleLabel(labe + m_vlayout = new QVBoxLayout; + m_logoLayout = new QHBoxLayout; + ++ mTitleIcon = new QLabel(this); ++ QIcon titleIcon = QIcon::fromTheme("ukui-control-center"); ++ mTitleIcon->setPixmap(titleIcon.pixmap(titleIcon.actualSize(QSize(24, 24)))); ++ ++ mTitleIcon->setFixedSize(30, 30); ++ titleLabel->setFixedSize(28, 28); ++ ++ + titlebar = new QWidget(this); + logoLabel = new QLabel(this); + logoLabel->setFixedSize(200,200); +@@ -23,10 +31,14 @@ PreScene::PreScene(QLabel *label, QSize size, QWidget *parent) : titleLabel(labe + m_logoLayout->addWidget(logoLabel); + + m_hlayout = new QHBoxLayout; +- m_hlayout->setContentsMargins(9, 9, 9, 0); ++ m_hlayout->setContentsMargins(4, 6, 0, 0); ++ m_hlayout->addWidget(mTitleIcon); + m_hlayout->addWidget(titleLabel); ++ m_hlayout->addStretch(); + titlebar->setLayout(m_hlayout); + ++ m_vlayout->setSpacing(0); ++ m_vlayout->setContentsMargins(0, 0, 0, 0); + m_vlayout->addWidget(titlebar); + m_vlayout->addLayout(m_logoLayout); + m_vlayout->addStretch(); +diff --git a/shell/prescene.h b/shell/prescene.h +index 49e497a..d02650e 100755 +--- a/shell/prescene.h ++++ b/shell/prescene.h +@@ -23,6 +23,7 @@ private: + QVBoxLayout * m_vlayout; + QWidget * titlebar; + ++ QLabel * mTitleIcon; + QLabel * titleLabel; + QLabel * logoLabel; + QHBoxLayout * m_logoLayout = nullptr; +-- +2.23.0 + diff --git a/ukui-control-center.spec b/ukui-control-center.spec index 5c1301a..1f26180 100644 --- a/ukui-control-center.spec +++ b/ukui-control-center.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: ukui-control-center Version: 3.0.1 -Release: 11 +Release: 12 Summary: utilities to configure the UKUI desktop License: GPL-2+ URL: http://www.ukui.org @@ -81,6 +81,7 @@ patch8: 0008-fix-redeclaration-of-QStringList-usergroupList-in-ed.patch patch9: 0009-fix-layout-optimization.patch patch10:0010-Added-translation-using-Weblate-Tibetan.patch patch11:0011-power-add-sleep-function.patch +patch12:0012-window-add-title-icon.patch Recommends: qt5-qtquickcontrols @@ -113,6 +114,7 @@ Suggests: ukui-settings-daemon %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 %build qmake-qt5 @@ -156,6 +158,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy %changelog +* Tue Jul 13 2021 tanyulong - 3.0.1-12 +- window add title icon + * Mon Jul 12 2021 tanyulong - 3.0.1-11 - power add sleep function From 45865de3e83a024408abce9c2aa364f935ccaab4 Mon Sep 17 00:00:00 2001 From: tanyulong2021 Date: Fri, 16 Jul 2021 14:27:17 +0800 Subject: [PATCH 2/2] fix failed to view remote desktop --- 0013-fix-failed-to-view-remote-desktop.patch | 238 +++++++++++++++++++ ukui-control-center.spec | 7 +- 2 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 0013-fix-failed-to-view-remote-desktop.patch diff --git a/0013-fix-failed-to-view-remote-desktop.patch b/0013-fix-failed-to-view-remote-desktop.patch new file mode 100644 index 0000000..9b00d17 --- /dev/null +++ b/0013-fix-failed-to-view-remote-desktop.patch @@ -0,0 +1,238 @@ +From bd8712c40eedb0e5fa065f2619a52afc77885d42 Mon Sep 17 00:00:00 2001 +From: tanyulong +Date: Fri, 16 Jul 2021 14:17:00 +0800 +Subject: [PATCH] fix failed to view remote desktop + +--- + plugins/network/vino/sharemain.cpp | 71 ++++++++++++++++++++++++++---- + plugins/network/vino/sharemain.h | 6 +++ + plugins/network/vino/vino.cpp | 15 ++++--- + plugins/network/vino/vino.h | 1 + + 4 files changed, 79 insertions(+), 14 deletions(-) + +diff --git a/plugins/network/vino/sharemain.cpp b/plugins/network/vino/sharemain.cpp +index c80b9ec..5579c77 100755 +--- a/plugins/network/vino/sharemain.cpp ++++ b/plugins/network/vino/sharemain.cpp +@@ -18,6 +18,7 @@ + * + */ + #include "sharemain.h" ++#include + + #include + #include +@@ -41,6 +42,22 @@ void ShareMain::initUI() { + mShareTitleLabel = new QLabel(tr("Share"), this); + mShareTitleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); + ++ mEnableFrame = new QFrame(this); ++ mEnableFrame->setFrameShape(QFrame::Shape::Box); ++ mEnableFrame->setMinimumSize(550, 50); ++ mEnableFrame->setMaximumSize(960, 50); ++ ++ QHBoxLayout * enableHLayout = new QHBoxLayout(); ++ ++ mEnableBox = new QCheckBox(this); ++ mEnableLabel = new QLabel(tr("Allow others to view your desktop"), this); ++ enableHLayout->addWidget(mEnableBox); ++ enableHLayout->addWidget(mEnableLabel); ++ enableHLayout->addStretch(); ++ ++ mEnableFrame->setLayout(enableHLayout); ++ ++ + mViewFrame = new QFrame(this); + mViewFrame->setFrameShape(QFrame::Shape::Box); + mViewFrame->setMinimumSize(550, 50); +@@ -49,7 +66,8 @@ void ShareMain::initUI() { + QHBoxLayout * viewHLayout = new QHBoxLayout(); + + mViewBox = new QCheckBox(this); +- mViewLabel = new QLabel(tr("Allow others to view your desktop"), this); ++ mViewLabel = new QLabel(tr("Allow connection to control screen"), this); ++ + viewHLayout->addWidget(mViewBox); + viewHLayout->addWidget(mViewLabel); + viewHLayout->addStretch(); +@@ -90,6 +108,7 @@ void ShareMain::initUI() { + mSecurityPwdFrame->setLayout(pwdHLayout); + + mVlayout->addWidget(mShareTitleLabel); ++ mVlayout->addWidget(mEnableFrame); + mVlayout->addWidget(mViewFrame); + + mVlayout->addWidget(mSecurityTitleLabel); +@@ -109,7 +128,14 @@ void ShareMain::initConnection() { + QByteArray id(kVinoSchemas); + if (QGSettings::isSchemaInstalled(id)) { + mVinoGsetting = new QGSettings(kVinoSchemas, QByteArray(), this); ++ ++ bool isShared = mVinoGsetting->get(kVinoViewOnlyKey).toBool(); ++ bool secPwd = mVinoGsetting->get(kVinoPromptKey).toBool(); + ++ initShareStatus(!isShared, secPwd); ++ initEnableStatus(); ++ ++ connect(mEnableBox, &QCheckBox::clicked, this, &ShareMain::enableSlot); + connect(mViewBox, &QCheckBox::clicked, this, &ShareMain::viewBoxSlot); + connect(mPwdLineEdit, &QLineEdit::textChanged, this, &ShareMain::pwdInputSlot); + connect(mBtnGroup, QOverload::of(&QButtonGroup::buttonClicked), +@@ -117,9 +143,6 @@ void ShareMain::initConnection() { + accessSlot(index); + }); + +- bool isShared = mVinoGsetting->get(kVinoViewOnlyKey).toBool(); +- bool secPwd = mVinoGsetting->get(kVinoPromptKey).toBool(); +- initShareStatus(!isShared, secPwd); + } + } + +@@ -132,11 +155,41 @@ void ShareMain::initShareStatus(bool isConnnect, bool isPwd) { + } + } + +-void ShareMain::viewBoxSlot(bool status) { +- Q_UNUSED(status); +- if (status) { +- mVinoGsetting->set(kVinoViewOnlyKey, status); ++void ShareMain::initEnableStatus() { ++ QProcess *process = new QProcess; ++ ++ process->start("systemctl", QStringList() << "--user" << "is-active" << "vino-server.service"); ++ process->waitForFinished(); ++ setFrameVisible((process->readAllStandardOutput().replace("\n","") == "active")); ++ ++ process->close(); ++} ++ ++void ShareMain::setFrameVisible(bool visible) { ++ mEnableBox->setChecked(visible); ++ ++ mViewFrame->setVisible(visible); ++ mSecurityFrame->setVisible(visible); ++ mSecurityPwdFrame->setVisible(visible); ++ mSecurityTitleLabel->setVisible(visible); ++} ++ ++void ShareMain::enableSlot(bool status) { ++ QProcess process; ++ QString cmd; ++ ++ if(status) { ++ cmd = "start"; ++ } else { ++ cmd = "stop"; + } ++ process.startDetached("systemctl", QStringList() << "--user" << cmd << "vino-server.service"); ++ ++ setFrameVisible(status); ++} ++ ++void ShareMain::viewBoxSlot(bool status) { ++ mVinoGsetting->set(kVinoViewOnlyKey, !status); + } + + void ShareMain::accessSlot(int index) { +@@ -151,7 +204,7 @@ void ShareMain::accessSlot(int index) { + mPwdsLabel->setEnabled(true); + mPwdLineEdit->setEnabled(true); + mVinoGsetting->set(kVinoPromptKey, false); +- mVinoGsetting->reset(kAuthenticationKey), 'vnc'; ++ mVinoGsetting->reset(kAuthenticationKey); + } + } + +diff --git a/plugins/network/vino/sharemain.h b/plugins/network/vino/sharemain.h +index e7681c9..49697c4 100755 +--- a/plugins/network/vino/sharemain.h ++++ b/plugins/network/vino/sharemain.h +@@ -51,6 +51,7 @@ public: + ~ShareMain(); + + private: ++ QFrame * mEnableFrame; + QFrame * mViewFrame; + QFrame * mSecurityFrame; + QFrame * mSecurityPwdFrame; +@@ -58,6 +59,7 @@ private: + QFrame * mNoticeOFrame; + QFrame * mNoticeNFrame; + ++ QCheckBox * mEnableBox; + QCheckBox * mViewBox; + QRadioButton * mAccessBox; + QRadioButton * mPwdBox; +@@ -67,6 +69,7 @@ private: + QRadioButton * mNoticeNBtn; + + QLabel * mShareTitleLabel; ++ QLabel * mEnableLabel; + QLabel * mViewLabel; + QLabel * mSecurityTitleLabel; + QLabel * mAccessLabel; +@@ -87,8 +90,11 @@ private: + void initUI(); + void initConnection(); + void initShareStatus(bool isConnnect, bool isPwd); ++ void initEnableStatus(); ++ void setFrameVisible(bool visible); + + private slots: ++ void enableSlot(bool status); + void viewBoxSlot(bool status); + void accessSlot(int index); + void pwdInputSlot(QString pwd); +diff --git a/plugins/network/vino/vino.cpp b/plugins/network/vino/vino.cpp +index 504b6e0..dc16312 100755 +--- a/plugins/network/vino/vino.cpp ++++ b/plugins/network/vino/vino.cpp +@@ -20,16 +20,15 @@ + #include "vino.h" + #include "ui_vino.h" + +-Vino::Vino() : ui(new Ui::Vino) { +- pluginWidget = new ShareMain; +- ui->setupUi(pluginWidget); +- ++Vino::Vino() : ui(new Ui::Vino), mFirstLoad(true) { + pluginName = tr("Vino"); + pluginType = NETWORK; + } + + Vino::~Vino() { +- delete ui; ++ if (!mFirstLoad) { ++ delete ui; ++ } + } + + QString Vino::get_plugin_name() { +@@ -41,6 +40,12 @@ int Vino::get_plugin_type() { + } + + QWidget *Vino::get_plugin_ui() { ++ if (mFirstLoad) { ++ mFirstLoad = false; ++ pluginWidget = new ShareMain; ++ ui->setupUi(pluginWidget); ++ } ++ + return pluginWidget; + } + +diff --git a/plugins/network/vino/vino.h b/plugins/network/vino/vino.h +index 272fa0d..6ea603f 100755 +--- a/plugins/network/vino/vino.h ++++ b/plugins/network/vino/vino.h +@@ -52,6 +52,7 @@ private: + QString pluginName; + int pluginType; + ShareMain* pluginWidget; ++ bool mFirstLoad; + + }; + #endif // VINO_H +-- +2.23.0 + diff --git a/ukui-control-center.spec b/ukui-control-center.spec index 1f26180..1d051d8 100644 --- a/ukui-control-center.spec +++ b/ukui-control-center.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: ukui-control-center Version: 3.0.1 -Release: 12 +Release: 13 Summary: utilities to configure the UKUI desktop License: GPL-2+ URL: http://www.ukui.org @@ -82,6 +82,7 @@ patch9: 0009-fix-layout-optimization.patch patch10:0010-Added-translation-using-Weblate-Tibetan.patch patch11:0011-power-add-sleep-function.patch patch12:0012-window-add-title-icon.patch +patch13:0013-fix-failed-to-view-remote-desktop.patch Recommends: qt5-qtquickcontrols @@ -115,6 +116,7 @@ Suggests: ukui-settings-daemon %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 %build qmake-qt5 @@ -158,6 +160,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy %changelog +* Fri Jul 16 2021 tanyulong - 3.0.1-13 +- fix failed to view remote desktop + * Tue Jul 13 2021 tanyulong - 3.0.1-12 - window add title icon