diff -Nru ukui-control-center-4.10.0.0/debian/changelog ukui-control-center-4.10.0.0/debian/changelog --- ukui-control-center-4.10.0.0/debian/changelog 2025-01-01 16:22:05.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/changelog 2025-02-07 16:32:50.000000000 +0800 @@ -1,3 +1,12 @@ +ukui-control-center (4.10.0.0-ok54) nile; urgency=medium + + * BUG:#290697 【设置】【字体】字体选择可选字体与要求不一致 + * 需求号: 无 + * 其他改动说明:解决编译问题 + * 其他改动影响域:无 + + -- susidian <susidian@kylinos.cn> Fri, 07 Feb 2025 16:32:50 +0800 + ukui-control-center (4.10.0.0-ok53) nile; urgency=medium * BUG:#277741 【显示器】缩放率修改注销后未生效 @@ -1335,7 +1344,7 @@ * 任务号:无 * 其他改动:无 - -- zhoubin <zhoubin@kylin> Thu, 20 Oct 2022 09:40:39 +0800 + -- zhoubin <zhoubin@kylinos.cn> Thu, 20 Oct 2022 09:40:39 +0800 ukui-control-center (3.22.1.7) v101; urgency=medium diff -Nru ukui-control-center-4.10.0.0/debian/libukcc3.postinst ukui-control-center-4.10.0.0/debian/libukcc3.postinst --- ukui-control-center-4.10.0.0/debian/libukcc3.postinst 2025-01-01 16:22:05.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/libukcc3.postinst 2025-02-07 16:32:50.000000000 +0800 @@ -1,5 +1,14 @@ +#!/bin/bash + is_hwe=$(cat /etc/kylin-build | grep "V10-SP1-hwe") file_path="/usr/lib/x86_64-linux-gnu/libukcc.so.1.0.0.old" if [ -f /usr/sbin/kysec_get ] && [ -n "${is_hwe}" ] && [ -f $file_path ];then kysec_set -n exectl -v verified $file_path fi + +path="/usr/lib/`/usr/bin/dpkg-architecture -qDEB_TARGET_MULTIARCH`/libukcc.so.1.0.0" +path1="/usr/lib/`/usr/bin/dpkg-architecture -qDEB_TARGET_MULTIARCH`/libukcc.so.1" +path2="/usr/lib/`/usr/bin/dpkg-architecture -qDEB_TARGET_MULTIARCH`/libukcc.so.1.0" +dpkg-divert --package libukcc3 --rename --remove "$path"".old" +dpkg-divert --package libukcc3 --rename --remove "$path1"".old" +dpkg-divert --package libukcc3 --rename --remove "$path2"".old" diff -Nru ukui-control-center-4.10.0.0/debian/patches/0111-128-316417.patch ukui-control-center-4.10.0.0/debian/patches/0111-128-316417.patch --- ukui-control-center-4.10.0.0/debian/patches/0111-128-316417.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0111-128-316417.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,217 @@ +From: nil <zhoubin@kylinos.cn> +Date: Fri, 3 Jan 2025 09:43:54 +0000 +Subject: =?utf-8?b?ITEyOCAzMTY0MTcg44CQ5Yy65Z+f6K+t6KiA44CR6L6T5YWl5rOV6K6+?= + =?utf-8?b?572u5omT5LiN5byAIE1lcmdlIHB1bGwgcmVxdWVzdCAhMTI4IGZyb20g6IuP5Zej?= + =?utf-8?b?5YW4L29wZW5reWxpbi9uaWxlLTExMDc=?= + +--- + plugins/system/about/about.cpp | 4 ++ + plugins/system/display/widget.cpp | 1 + + plugins/time-language/area/languageframe.cpp | 50 ++++++++++++++++++++-- + plugins/time-language/area/languageframe.h | 21 +++++++++ + registeredSession/plugins/about/aboutinterface.cpp | 12 ++++-- + shell/mainwindow.cpp | 1 - + 6 files changed, 82 insertions(+), 7 deletions(-) + +diff --git a/plugins/system/about/about.cpp b/plugins/system/about/about.cpp +index 6b8afd1..64cfa1f 100644 +--- a/plugins/system/about/about.cpp ++++ b/plugins/system/about/about.cpp +@@ -45,6 +45,7 @@ + #include <QSvgRenderer> + #include <QSqlQuery> + #include <QSqlRecord> ++#include <QElapsedTimer> + + const QString kAboutFile = "/usr/share/applications/kylin-user-guide.desktop"; + const QString kHPFile = "/usr/share/applications/hp-document.desktop"; +@@ -657,7 +658,10 @@ void About::securityControl() + + void About::compareTime(QString date) + { ++ QElapsedTimer timer; ++ timer.start(); + QString s1 = mAboutDBus->property("netDate").toString(); ++ qDebug() << Q_FUNC_INFO << " ntpTime:" << s1 << timer.elapsed(); + QStringList list_1; + QStringList list_2 = date.split("-"); + int year; +diff --git a/plugins/system/display/widget.cpp b/plugins/system/display/widget.cpp +index 8b331ed..43275c3 100644 +--- a/plugins/system/display/widget.cpp ++++ b/plugins/system/display/widget.cpp +@@ -1972,6 +1972,7 @@ void Widget::initConnection() + }); + + connect(mTemptWidget, &SliderWidget::valueChanged, this, [=]{ ++ qDebug() << Q_FUNC_INFO << "susidian valueChanged" << mTemptWidget->value(); + if (m_colorSettings) { + m_colorSettings->set(NIGHT_TEMPERATURE_KEY, mTemptWidget->value()); + } else { +diff --git a/plugins/time-language/area/languageframe.cpp b/plugins/time-language/area/languageframe.cpp +index 8634356..843cd89 100644 +--- a/plugins/time-language/area/languageframe.cpp ++++ b/plugins/time-language/area/languageframe.cpp +@@ -1,9 +1,29 @@ ++/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- ++ * ++ * Copyright (C) 2019 KylinSoft Co., 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; either version 2 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, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ */ + #include "languageframe.h" + #include <QHBoxLayout> + #include <QMenu> + #include <QProcess> + #include <QDebug> + #include <QTextCodec> ++#include <QFile> + #include "ukcccommon.h" + using namespace ukcc; + +@@ -72,6 +92,12 @@ QToolButton* LanguageFrame::createToolBtn() + menu->addAction(edit); + menu->addAction(del); + ++ QString inputMethodSetCmd = getInputMethodSetCmd(); ++ qDebug() << "input method seting cmd = " << inputMethodSetCmd; ++ if (inputMethodSetCmd.isEmpty()) { ++ edit->setVisible(false); ++ } ++ + connect(menu, &QMenu::aboutToShow, [=](){ + if (selectedIconLabel->isVisible()) { + del->setEnabled(false); +@@ -86,9 +112,7 @@ QToolButton* LanguageFrame::createToolBtn() + }); + + connect(edit, &QAction::triggered, this, [=](){ +- QProcess process; +- process.startDetached("fcitx5-config-qt"); +- ++ editInputMethodSlot(); + }); + + btn->setIcon(QIcon::fromTheme("view-more-horizontal-symbolic")); +@@ -96,6 +120,26 @@ QToolButton* LanguageFrame::createToolBtn() + return btn; + } + ++void LanguageFrame::editInputMethodSlot() { ++ QString cmd = getInputMethodSetCmd(); ++ QProcess process; ++ process.startDetached(cmd); ++} ++ ++QString LanguageFrame::getInputMethodSetCmd() { ++ QFile inputSetCmd("/usr/bin/fcitx5-config-qt"); ++ if (inputSetCmd.exists()) { ++ return "/usr/bin/fcitx5-config-qt"; ++ } ++ ++ QFile inputSetCmd1("/usr/bin/fcitx-config-gtk3"); ++ if (inputSetCmd1.exists()) { ++ return "/usr/bin/fcitx-config-gtk3"; ++ } ++ ++ return ""; ++} ++ + QString LanguageFrame::getShowName() + { + return this->nameLabel->text(); +diff --git a/plugins/time-language/area/languageframe.h b/plugins/time-language/area/languageframe.h +index ea7551d..a0a84b8 100644 +--- a/plugins/time-language/area/languageframe.h ++++ b/plugins/time-language/area/languageframe.h +@@ -1,3 +1,22 @@ ++/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- ++ * ++ * Copyright (C) 2019 KylinSoft Co., 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; either version 2 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, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ */ + #ifndef LANGUAGEFRAME_H + #define LANGUAGEFRAME_H + +@@ -21,6 +40,8 @@ public: + + private: + void mousePressEvent(QMouseEvent *e); ++ void editInputMethodSlot(); ++ QString getInputMethodSetCmd(); + + private: + QLabel *nameLabel = nullptr; +diff --git a/registeredSession/plugins/about/aboutinterface.cpp b/registeredSession/plugins/about/aboutinterface.cpp +index a7d9f52..9a24c5e 100644 +--- a/registeredSession/plugins/about/aboutinterface.cpp ++++ b/registeredSession/plugins/about/aboutinterface.cpp +@@ -294,12 +294,18 @@ QString AboutInterface::getUpgradeDate() + + QString AboutInterface::getNtpTime() + { ++ int count = 0; + for (QString host : mNtphostNameList) { + ipList.clear(); + ntpGethostbyname(host.toLatin1().data()); + for (QString ip : ipList) { +- char *host = ip.toLatin1().data(); +- char *result = ntpdate(host); ++ ++count; ++ qDebug() << Q_FUNC_INFO << host << "---->" << ip << ":" << count; ++ if (count >= 5) { ++ return ""; ++ } ++ char *mIp = ip.toLatin1().data(); ++ char *result = ntpdate(mIp); + if (result != NULL) { + return QString(result); + } +@@ -401,7 +407,7 @@ char *AboutInterface::ntpdate(char *hostname) + // 设置超时 + struct timeval timeout; + timeout.tv_sec = 0; +- timeout.tv_usec = 300000;//微秒 ++ timeout.tv_usec = 280000;//微秒 + if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO_NEW, &timeout, sizeof(timeout)) == -1) { + perror("setsockopt failed:"); + return NULL; +diff --git a/shell/mainwindow.cpp b/shell/mainwindow.cpp +index 8579bc5..aeebab3 100644 +--- a/shell/mainwindow.cpp ++++ b/shell/mainwindow.cpp +@@ -587,7 +587,6 @@ void MainWindow::initUkccAbout() { + connect(ukccExit, SIGNAL(triggered()), this, SLOT(close())); + + connect(ukccAbout, &QAction::triggered, this, [=] { +- kdk::WindowManager::setSkipTaskBar(windowHandle(), true); + KAboutDialog *ukcc = new KAboutDialog(this); + ukcc->setAppIcon(QIcon::fromTheme("ukui-control-center")); + ukcc->setAppName(tr("Settings")); diff -Nru ukui-control-center-4.10.0.0/debian/patches/0112-fix-theme.patch ukui-control-center-4.10.0.0/debian/patches/0112-fix-theme.patch --- ukui-control-center-4.10.0.0/debian/patches/0112-fix-theme.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0112-fix-theme.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,34 @@ +From: hesisheng <hesisheng@kylin.com> +Date: Sat, 4 Jan 2025 12:25:35 +0800 +Subject: fix: theme +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Description: 289673 拖动透明度滑动条不流畅,存在延迟 + +Log: 289673 拖动透明度滑动条不流畅,存在延迟 +Signed-off-by: zhoubin <zhoubin@kylinos.cn> +--- + plugins/personalized/theme/theme.cpp | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/plugins/personalized/theme/theme.cpp b/plugins/personalized/theme/theme.cpp +index 7c2ecfe..6fa7023 100644 +--- a/plugins/personalized/theme/theme.cpp ++++ b/plugins/personalized/theme/theme.cpp +@@ -748,9 +748,12 @@ void Theme::initConnection() + + connect(mTranWidget->slider(), &KSlider::valueChanged, this, [=](int value) { + changeTranpancySlot(value); +- revokeGlobalThemeSlot("getTransparencyBlur", QString::number(value, 10)); ++ }); ++ ++ connect(mTranWidget->slider(), &KSlider::sliderReleased, this, [=]() { ++ revokeGlobalThemeSlot("getTransparencyBlur", QString::number(mTranWidget->slider()->value(), 10)); + revokeGlobalThemeSlot("getSupportTransparency", "true"); +- UkccCommon::buriedSettings(name(), "set transparency", QString("select"), QString::number(value)); ++ UkccCommon::buriedSettings(name(), "set transparency", QString("select"), QString::number(mTranWidget->slider()->value())); + }); + + connect(mCornerWidget, &ComboxWidget::currentIndexChanged, this, [=](int index) { diff -Nru ukui-control-center-4.10.0.0/debian/patches/0113-fix-theme.patch ukui-control-center-4.10.0.0/debian/patches/0113-fix-theme.patch --- ukui-control-center-4.10.0.0/debian/patches/0113-fix-theme.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0113-fix-theme.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,33 @@ +From: zhoubin <zhoubin@kylinos.cn> +Date: Sat, 4 Jan 2025 16:57:28 +0800 +Subject: fix: theme +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + + Description: 289673 拖动透明度滑动条不流畅,存在延迟 + + Log: 289673 拖动透明度滑动条不流畅,存在延迟 +--- + plugins/personalized/theme/theme.cpp | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/plugins/personalized/theme/theme.cpp b/plugins/personalized/theme/theme.cpp +index 6fa7023..31dcc63 100644 +--- a/plugins/personalized/theme/theme.cpp ++++ b/plugins/personalized/theme/theme.cpp +@@ -1363,9 +1363,11 @@ void Theme::changeEffectBtnSlot(bool checked) + + void Theme::changeTranpancySlot(int value) + { +- personliseGsettings->set(PERSONALSIE_TRAN_KEY,(static_cast<int>(value) / 100.0)); +- qtSettings->set(THEME_TRAN_KEY, value); +- qtSettings->set(PEONY_TRAN_KEY, value); ++ if (value % 5 == 0) { ++ personliseGsettings->set(PERSONALSIE_TRAN_KEY,(static_cast<int>(value) / 100.0)); ++ qtSettings->set(THEME_TRAN_KEY, value); ++ qtSettings->set(PEONY_TRAN_KEY, value); ++ } + } + + void Theme::changeTranpancySliderSlot(int value) diff -Nru ukui-control-center-4.10.0.0/debian/patches/0114-127-bug.patch ukui-control-center-4.10.0.0/debian/patches/0114-127-bug.patch --- ukui-control-center-4.10.0.0/debian/patches/0114-127-bug.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0114-127-bug.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,161 @@ +From: nil <zhoubin@kylinos.cn> +Date: Tue, 7 Jan 2025 03:05:40 +0000 +Subject: =?utf-8?b?ITEyNyDkv67lpI1idWcgTWVyZ2UgcHVsbCByZXF1ZXN0ICExMjcgZnJv?= + =?utf-8?b?bSDkvZXmgJ3og5wvbmlsZQ==?= + +--- + plugins/account/userinfo/changeuserlogo.cpp | 2 ++ + plugins/account/userinfo/changeusernickname.cpp | 2 ++ + plugins/account/userinfo/changeuserpwd.cpp | 2 ++ + plugins/account/userinfo/creategroupdialog.cpp | 2 ++ + plugins/account/userinfo/createusernew.cpp | 2 ++ + plugins/account/userinfo/userinfo.cpp | 2 -- + plugins/devices/keyboard/keyboardmain.cpp | 2 +- + plugins/devices/keyboard/keyboardui.cpp | 6 ++++++ + plugins/devices/keyboard/keyboardui.h | 3 ++- + 9 files changed, 19 insertions(+), 4 deletions(-) + +diff --git a/plugins/account/userinfo/changeuserlogo.cpp b/plugins/account/userinfo/changeuserlogo.cpp +index 1982be1..85d09b5 100644 +--- a/plugins/account/userinfo/changeuserlogo.cpp ++++ b/plugins/account/userinfo/changeuserlogo.cpp +@@ -157,9 +157,11 @@ void ChangeUserLogo::initUI() + culCancelBtn = new QPushButton; + culCancelBtn->setText(tr("Cancel")); + culCancelBtn->setFocusPolicy(Qt::NoFocus); ++ culCancelBtn->setProperty("useButtonPalette", true); + culConfirmBtn = new QPushButton; + culConfirmBtn->setText(tr("Confirm")); + culConfirmBtn->setFocusPolicy(Qt::NoFocus); ++ culConfirmBtn->setProperty("isImportant", true); + + culBottomBtnsHorLayout = new QHBoxLayout; + culBottomBtnsHorLayout->setSpacing(16); +diff --git a/plugins/account/userinfo/changeusernickname.cpp b/plugins/account/userinfo/changeusernickname.cpp +index d7d401a..6e8a97d 100644 +--- a/plugins/account/userinfo/changeusernickname.cpp ++++ b/plugins/account/userinfo/changeusernickname.cpp +@@ -111,9 +111,11 @@ void ChangeUserNickname::initUI(){ + cancelBtn = new QPushButton(); + cancelBtn->setMinimumWidth(96); + cancelBtn->setText(tr("Cancel")); ++ cancelBtn->setProperty("useButtonPalette", true); + confirmBtn = new QPushButton(); + confirmBtn->setMinimumWidth(96); + confirmBtn->setText(tr("Confirm")); ++ confirmBtn->setProperty("isImportant", true); + + bottomBtnsHorLayout = new QHBoxLayout; + bottomBtnsHorLayout->setSpacing(16); +diff --git a/plugins/account/userinfo/changeuserpwd.cpp b/plugins/account/userinfo/changeuserpwd.cpp +index 2c4b97b..f56662e 100644 +--- a/plugins/account/userinfo/changeuserpwd.cpp ++++ b/plugins/account/userinfo/changeuserpwd.cpp +@@ -215,10 +215,12 @@ void ChangeUserPwd::initUI(){ + cancelBtn->setMinimumWidth(96); + cancelBtn->setText(tr("Cancel")); + cancelBtn->setFocusPolicy(Qt::FocusPolicy::NoFocus); ++ cancelBtn->setProperty("useButtonPalette", true); + confirmBtn = new QPushButton(); + confirmBtn->setMinimumWidth(96); + confirmBtn->setText(tr("Confirm")); + confirmBtn->setFocusPolicy(Qt::FocusPolicy::NoFocus); ++ confirmBtn->setProperty("isImportant", true); + + bottomBtnsHorLayout = new QHBoxLayout; + bottomBtnsHorLayout->setSpacing(16); +diff --git a/plugins/account/userinfo/creategroupdialog.cpp b/plugins/account/userinfo/creategroupdialog.cpp +index bf896fd..6586c57 100644 +--- a/plugins/account/userinfo/creategroupdialog.cpp ++++ b/plugins/account/userinfo/creategroupdialog.cpp +@@ -89,8 +89,10 @@ void CreateGroupDialog::initUI() + mCancelBtn = new QPushButton(tr("Cancel"), this); + mCancelBtn->setFixedSize(96, 36); + mCancelBtn->setFocusPolicy(Qt::FocusPolicy::NoFocus); ++ mCancelBtn->setProperty("useButtonPalette", true); + mConfirmBtn = new QPushButton(tr("Confirm"), this); + mConfirmBtn->setMinimumSize(96, 36); ++ mConfirmBtn->setProperty("isImportant", true); + + mConfirmHLaout = new QHBoxLayout(this); + mConfirmHLaout->setContentsMargins(0,0,0,0); +diff --git a/plugins/account/userinfo/createusernew.cpp b/plugins/account/userinfo/createusernew.cpp +index 4df7fdd..dff09ca 100644 +--- a/plugins/account/userinfo/createusernew.cpp ++++ b/plugins/account/userinfo/createusernew.cpp +@@ -274,9 +274,11 @@ void CreateUserNew::initUI(){ + cancelBtn = new QPushButton; + cancelBtn->setFocusPolicy(Qt::FocusPolicy::NoFocus); + cancelBtn->setText(tr("Cancel")); ++ cancelBtn->setProperty("useButtonPalette", true); + confirmBtn = new QPushButton; + confirmBtn->setFocusPolicy(Qt::FocusPolicy::NoFocus); + confirmBtn->setText(tr("Confirm")); ++ confirmBtn->setProperty("isImportant", true); + + bottomHorLayout = new QHBoxLayout; + bottomHorLayout->setSpacing(16); +diff --git a/plugins/account/userinfo/userinfo.cpp b/plugins/account/userinfo/userinfo.cpp +index b568abc..10ff4c3 100644 +--- a/plugins/account/userinfo/userinfo.cpp ++++ b/plugins/account/userinfo/userinfo.cpp +@@ -524,8 +524,6 @@ void UserInfo::showCreateUserNewDialog(){ + QMap<QString, UserInfomation>::iterator it = allUserInfoMap.begin(); + for (; it != allUserInfoMap.end(); it++){ + UserInfomation user = it.value(); +- +- usersStringList.append(user.username); + usersStringList.append(user.realname); + } + +diff --git a/plugins/devices/keyboard/keyboardmain.cpp b/plugins/devices/keyboard/keyboardmain.cpp +index 08888f0..a3db782 100644 +--- a/plugins/devices/keyboard/keyboardmain.cpp ++++ b/plugins/devices/keyboard/keyboardmain.cpp +@@ -185,7 +185,7 @@ void KeyboardMain::initInputMethodSet() + { + qDebug() << "input method seting cmd = " << getInputMethodSetCmd(); + if (getInputMethodSetCmd().isEmpty()) { +- keyBoardWidget->inputMethodPushButton()->setVisible(false); ++ keyBoardWidget->setInputMethodVisible(false); + } + } + +diff --git a/plugins/devices/keyboard/keyboardui.cpp b/plugins/devices/keyboard/keyboardui.cpp +index 81d80f2..b40def6 100644 +--- a/plugins/devices/keyboard/keyboardui.cpp ++++ b/plugins/devices/keyboard/keyboardui.cpp +@@ -16,6 +16,12 @@ KeyboardUi::~KeyboardUi() + + } + ++void KeyboardUi::setInputMethodVisible(bool isVisible) ++{ ++ mInputTitleLabel->setVisible(isVisible); ++ mInputMethodSetFrame->setVisible(isVisible); ++} ++ + void KeyboardUi::initUI() + { + mKeyboardFrame = new SettingGroup(this); +diff --git a/plugins/devices/keyboard/keyboardui.h b/plugins/devices/keyboard/keyboardui.h +index fec0d13..a560105 100644 +--- a/plugins/devices/keyboard/keyboardui.h ++++ b/plugins/devices/keyboard/keyboardui.h +@@ -90,6 +90,8 @@ public: + return mSoundEfectsFrame; + } + ++ void setInputMethodVisible(bool isVisible); ++ + private: + QVBoxLayout *mVlayout = nullptr; + +@@ -128,7 +130,6 @@ private: + void setTextSizeFrame(); + void setAnimationFrame(); + void setSoundEfectsFrame(); +- + }; + + #endif // KEYBOARDUI_H diff -Nru ukui-control-center-4.10.0.0/debian/patches/0115-131-290807.patch ukui-control-center-4.10.0.0/debian/patches/0115-131-290807.patch --- ukui-control-center-4.10.0.0/debian/patches/0115-131-290807.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0115-131-290807.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,869 @@ +From: nil <zhoubin@kylinos.cn> +Date: Tue, 7 Jan 2025 04:21:52 +0000 +Subject: =?utf-8?b?ITEzMSAyOTA4MDcg44CQ5pi+56S65Zmo44CR5o6l5YWl56ys5LqM5Liq?= + =?utf-8?b?5bGP5bmV77yM5o6n5Yi26Z2i5p2/6Zeq6YCAIE1lcmdlIHB1bGwgcmVxdWVzdCAh?= + =?utf-8?b?MTMxIGZyb20g6IuP5Zej5YW4L29wZW5reWxpbi9uaWxlLTExMDc=?= + +--- + plugins/system/display/controlpanel.cpp | 9 +- + plugins/system/display/controlpanel.h | 1 + + registeredSession/area/areainterface.cpp | 268 ------------------- + registeredSession/area/areainterface.h | 111 -------- + registeredSession/main.cpp | 2 - + .../plugins/notice/noticeinterface.cpp | 288 --------------------- + registeredSession/plugins/notice/noticeinterface.h | 78 ------ + registeredSession/registeredSession.pro | 2 - + 8 files changed, 9 insertions(+), 750 deletions(-) + delete mode 100644 registeredSession/area/areainterface.cpp + delete mode 100644 registeredSession/area/areainterface.h + delete mode 100644 registeredSession/plugins/notice/noticeinterface.cpp + delete mode 100644 registeredSession/plugins/notice/noticeinterface.h + +diff --git a/plugins/system/display/controlpanel.cpp b/plugins/system/display/controlpanel.cpp +index f05af12..4b78408 100644 +--- a/plugins/system/display/controlpanel.cpp ++++ b/plugins/system/display/controlpanel.cpp +@@ -41,7 +41,7 @@ void ControlPanel::setConfig(const KScreen::ConfigPtr &config) + mConfig = config; + connect(mConfig.data(), &KScreen::Config::outputAdded, + this, [=](const KScreen::OutputPtr &output) { +- addOutput(output, false); ++ addOutputSlot(output); + }); + connect(mConfig.data(), &KScreen::Config::outputRemoved, + this, &ControlPanel::removeOutput); +@@ -51,6 +51,13 @@ void ControlPanel::setConfig(const KScreen::ConfigPtr &config) + } + } + ++void ControlPanel::addOutputSlot(const KScreen::OutputPtr &output) { ++ qDebug() << Q_FUNC_INFO << "wait 100ms for addOutput"; ++ QTimer::singleShot(100, this, [=]() { ++ addOutput(output, false); ++ }); ++} ++ + void ControlPanel::addOutput(const KScreen::OutputPtr &output, bool connectChanged) + { + if (!connectChanged) { +diff --git a/plugins/system/display/controlpanel.h b/plugins/system/display/controlpanel.h +index 345c131..6386531 100644 +--- a/plugins/system/display/controlpanel.h ++++ b/plugins/system/display/controlpanel.h +@@ -33,6 +33,7 @@ public: + + private: + void isWayland(); ++ void addOutputSlot(const KScreen::OutputPtr &output); + + public Q_SLOTS: + void activateOutput(const KScreen::OutputPtr &output); +diff --git a/registeredSession/area/areainterface.cpp b/registeredSession/area/areainterface.cpp +deleted file mode 100644 +index 20518d2..0000000 +--- a/registeredSession/area/areainterface.cpp ++++ /dev/null +@@ -1,268 +0,0 @@ +-#include "areainterface.h" +-#include <unistd.h> +-#include <QDBusConnection> +- +-AreaInterface::AreaInterface() +-{ +- ukccPanelGsettings = UniversalInterface::self()->ukccPanelGsettings(); +- accountInterface = UniversalInterface::self()->accountUserDbus(); +- fcitxInterface = UniversalInterface::self()->fcitxInputMethodDbus(); +- styleGsettings = UniversalInterface::self()->ukuiStyleGsettings(); +- connect(ukccPanelGsettings, &QGSettings::changed, this, [=](QString key) { +- if (key == CALENDAR_KEY) { +- mCalendar.clear(); +- getCalendar(); +- Q_EMIT changed("calendar"); +- } else if (key == FIRST_DAY_KEY) { +- mFirstDay.clear(); +- getFirstDay(); +- Q_EMIT changed("firstDay"); +- } else if (key == DATE_FORMATE_KEY) { +- mDateFormat.clear(); +- getDateFormat(); +- Q_EMIT changed("dateFormat"); +- } else if (key == TIME_FORMAT_KEY) { +- mTimeFormat.clear(); +- getTimeFormat(); +- Q_EMIT changed("timeFormat"); +- } else if (key == SHOW_LANGUAGE_KEY) { +- mShowLanguageList.clear(); +- getShowLanguageList(); +- Q_EMIT changed("showLanguageList"); +- } +- }); +- +- connect(styleGsettings, &QGSettings::changed, this, [=](QString key) { +- if (key == "iconThemeName") { +- Q_EMIT changed("iconThemeName"); +- } +- }); +-} +- +-AreaInterface::~AreaInterface() +-{ +- +-} +- +-const QString AreaInterface::gsettingGet(const QString &key) const +-{ +- if (ukccPanelGsettings->keys().contains(key)) { +- return ukccPanelGsettings->get(key).toString(); +- } else { +- return ""; +- } +-} +- +-void AreaInterface::gsettingSet(const QString &key, const QString &value) +-{ +- if (ukccPanelGsettings->keys().contains(key)) { +- ukccPanelGsettings->set(key, value); +- } +-} +- +-const QStringList AreaInterface::getFormatCountryList() +-{ +- if (mFormatCountryList.isEmpty()) { +- mFormatCountryList.append(QString("en_US.UTF-8")); +- mFormatCountryList.append(QString("zh_CN.UTF-8")); +- mFormatCountryList.append(QString("bo_CN.UTF-8")); +- } +- return mFormatCountryList; +-} +- +-const QStringList AreaInterface::getCalendarList() +-{ +- if (mCalendarList.isEmpty()) { +- mCalendarList.append(QString("solarlunar")); +- QString locale = QLocale::system().name(); +- if ("zh_CN" == locale) { +- mCalendarList.append(QString("lunar")); +- } +- } +- return mCalendarList; +-} +- +-const QStringList AreaInterface::getFirstDayList() +-{ +- if (mFirstDayList.isEmpty()) { +- mFirstDayList.append("monday"); +- mFirstDayList.append("sunday"); +- } +- return mFirstDayList; +-} +- +-const QStringList AreaInterface::getDateFormatList() +-{ +- if (mDateFormatList.isEmpty()) { +- mDateFormatList.append("cn"); +- mDateFormatList.append("en"); +- } +- return mDateFormatList; +-} +- +-const QStringList AreaInterface::getTimeFormatList() +-{ +- if (mtimeFormatList.isEmpty()) { +- mtimeFormatList.append("12"); +- mtimeFormatList.append("24"); +- } +- return mtimeFormatList; +-} +- +-const QStringList AreaInterface::getShowLanguageList() +-{ +- if (mShowLanguageList.isEmpty()) { +- if (ukccPanelGsettings->keys().contains(SHOW_LANGUAGE_KEY)) { +- mShowLanguageList = ukccPanelGsettings->get(SHOW_LANGUAGE_KEY).toStringList(); +- } else { +- qCritical() << "get SHOW_LANGUAGE_KEY error."; +- } +- } +- return mShowLanguageList; +-} +- +-const QStringList AreaInterface::getLanguageList() +-{ +- if (mLanguageList.isEmpty()) { +- mLanguageList.append("zh_CN"); +- mLanguageList.append("en"); +- mLanguageList.append("bo_CN"); +- } +- return mLanguageList; +-} +- +-const QString AreaInterface::getFormatCountry() +-{ +- if (mFormatCountry.isEmpty()) { +- mFormatCountry = accountInterface->property("FormatsLocale").toString(); +- } +- return mFormatCountry; +-} +- +-const QString AreaInterface::getCalendar() +-{ +- if (mCalendar.isEmpty()) { +- mCalendar = gsettingGet(CALENDAR_KEY); +- } +- return mCalendar; +-} +- +-const QString AreaInterface::getFirstDay() +-{ +- if (mFirstDay.isEmpty()) { +- mFirstDay = gsettingGet(FIRST_DAY_KEY); +- } +- return mFirstDay; +-} +- +-const QString AreaInterface::getDateFormat() +-{ +- if (mDateFormat.isEmpty()) { +- mDateFormat = gsettingGet(DATE_FORMATE_KEY); +- } +- return mDateFormat; +-} +- +-const QString AreaInterface::getTimeFormat() +-{ +- if (mTimeFormat.isEmpty()) { +- mTimeFormat = gsettingGet(TIME_FORMAT_KEY); +- } +- return mTimeFormat; +-} +- +-const QString AreaInterface::getLanguage() +-{ +- mLanguage = accountInterface->property("Language").toString(); +- return mLanguage; +-} +- +-void AreaInterface::setFormatCountry(const QString &formatCountry) +-{ +- mFormatCountry = formatCountry; +- accountInterface->call("SetFormatsLocale", formatCountry); +- Q_EMIT changed("formatCountry"); +-} +- +-void AreaInterface::setCalendar(const QString &calendar) +-{ +- gsettingSet(CALENDAR_KEY, calendar); +-} +- +-void AreaInterface::setFirstDay(const QString &firstDay) +-{ +- gsettingSet(FIRST_DAY_KEY, firstDay); +-} +- +-void AreaInterface::setDateFormat(const QString &dateFormat) +-{ +- gsettingSet(DATE_FORMATE_KEY, dateFormat); +-} +- +-void AreaInterface::setTimeFormat(const QString &timeFormat) +-{ +- gsettingSet(TIME_FORMAT_KEY, timeFormat); +-} +- +-void AreaInterface::setShowLanguageList(const QStringList &languageList) +-{ +- if (ukccPanelGsettings->keys().contains(SHOW_LANGUAGE_KEY)) { +- ukccPanelGsettings->set(SHOW_LANGUAGE_KEY, languageList); +- } else { +- qCritical() << "set SHOW_LANGUAGE_KEY error:" << languageList; +- } +-} +- +-void AreaInterface::setLanguage(const QString &languageCode) +-{ +- accountInterface->call("SetLanguage", languageCode); +- Q_EMIT changed("language"); +-} +- +-void AreaInterface::reloadInputMethodConfig() +-{ +- fcitxInterface->call("ReloadConfig"); +-} +- +-void AreaInterface::changeInputMethod(const QString &inputMethod, const bool &add) +-{ +- QString fileTextString; +- QFile configFile(FCITX_CONFIG_FILE); +- if (configFile.open(QIODevice::ReadWrite | QIODevice::Text)) { +- //把文件所有信息读出来 +- QTextStream stream(&configFile); +- fileTextString = stream.readAll(); +- +- if (!fileTextString.contains(inputMethod)) { +- return ; +- } +- QString addString = inputMethod + ":True"; +- QString removeString = inputMethod + ":False"; +- if (add) { +- fileTextString.replace(removeString, addString); +- } else { +- fileTextString.replace(addString, removeString); +- } +- stream << fileTextString; +- configFile.close(); +- reloadInputMethodConfig(); +- } +-} +- +-bool AreaInterface::isAddedInputMethod(const QString &inputMethod) +-{ +- QString fileTextString; +- QFile mFile(FCITX_CONFIG_FILE); +- if (mFile.open(QIODevice::ReadOnly | QIODevice::Text)) { +- QTextStream stream(&mFile); +- fileTextString = stream.readAll(); +- QString string = inputMethod + ":True"; +- if (fileTextString.contains(string)) { +- return true; +- } else { +- return false; +- } +- } +- qCritical()<<"open "<<FCITX_CONFIG_FILE<<" error."; +- return false; +-} +diff --git a/registeredSession/area/areainterface.h b/registeredSession/area/areainterface.h +deleted file mode 100644 +index e586bea..0000000 +--- a/registeredSession/area/areainterface.h ++++ /dev/null +@@ -1,111 +0,0 @@ +-#ifndef AREAINTERFACE_H +-#define AREAINTERFACE_H +- +-#include <QObject> +-#include <QtDBus> +-#include "../universalinterface.h" +- +-class AreaInterface : public QObject +-{ +- Q_OBJECT +- Q_CLASSINFO("D-Bus Interface", "org.ukui.ukcc.session.Area") +- Q_PROPERTY(QStringList formatCountryList READ getFormatCountryList) +- Q_PROPERTY(QStringList calendarList READ getCalendarList) +- Q_PROPERTY(QStringList firstDayList READ getFirstDayList) +- Q_PROPERTY(QStringList dateFormatList READ getDateFormatList) +- Q_PROPERTY(QStringList timeFormatList READ getTimeFormatList) +- Q_PROPERTY(QStringList languageList READ getLanguageList) +- Q_PROPERTY(QStringList showLanguageList READ getShowLanguageList) +- Q_PROPERTY(QString formatCountry READ getFormatCountry) +- Q_PROPERTY(QString calendar READ getCalendar) +- Q_PROPERTY(QString firstDay READ getFirstDay) +- Q_PROPERTY(QString dateFormat READ getDateFormat) +- Q_PROPERTY(QString timeFormat READ getTimeFormat) +- Q_PROPERTY(QString language READ getLanguage) +- +-public: +- AreaInterface(); +- ~AreaInterface(); +- +-protected: +- // 对属性的访问函数 +- const QStringList getFormatCountryList(); +- const QStringList getCalendarList(); +- const QStringList getFirstDayList(); +- const QStringList getDateFormatList(); +- const QStringList getTimeFormatList(); +- const QStringList getLanguageList(); +- const QStringList getShowLanguageList(); +- const QString getFormatCountry(); +- const QString getCalendar(); +- const QString getFirstDay(); +- const QString getDateFormat(); +- const QString getTimeFormat(); +- const QString getLanguage(); +- +-public Q_SLOTS: +- /** +- * @brief 修改输入法 +- * +- * @param inputMethodName 输入法名称 +- * @param add 添加/移除 +- */ +- void changeInputMethod(const QString &inputMethod, const bool &add); +- +- /** +- * @brief 查询输入法是否已经添加 +- * +- * @param inputMethodName 输入法名称 +- * @return bool 返回输入法是否已经添加 +- */ +- bool isAddedInputMethod(const QString &inputMethod); +- +- // 对属性的设置函数 +- void setFormatCountry(const QString &formatCountry); +- void setCalendar(const QString &calendar); +- void setFirstDay(const QString &firstDay); +- void setDateFormat(const QString &dateFormat); +- void setTimeFormat(const QString &timeFormat); +- void setShowLanguageList(const QStringList &languageList); +- void setLanguage(const QString &languageCode); +- +-Q_SIGNALS: +- void changed(QString keyName); +- +-private: +- void reloadInputMethodConfig(); +- +- // 设置和获取gsetting的string类型的键值 +- const QString gsettingGet(const QString &key) const; +- void gsettingSet(const QString &key, const QString &value); +- +-private: +- const QString SHOW_LANGUAGE_KEY = QString("showlanguage"); +- const QString FCITX_CONFIG_FILE = QDir::homePath() + "/.config/fcitx/profile"; +- const QString CALENDAR_KEY = QString("calendar"); +- const QString FIRST_DAY_KEY = QString("firstday"); +- const QString DATE_FORMATE_KEY = QString("date"); +- const QString TIME_FORMAT_KEY = QString("hoursystem"); +- +-private: +- QGSettings *ukccPanelGsettings = nullptr; +- QDBusInterface *accountInterface = nullptr; +- QDBusInterface *fcitxInterface = nullptr; +- QGSettings *styleGsettings = nullptr; +-private: +- QStringList mFormatCountryList = {}; +- QStringList mCalendarList = {}; +- QStringList mFirstDayList = {}; +- QStringList mDateFormatList = {}; +- QStringList mtimeFormatList = {}; +- QStringList mShowLanguageList = {}; +- QStringList mLanguageList = {}; +- QString mLanguage = ""; +- QString mFormatCountry = ""; +- QString mCalendar = ""; +- QString mFirstDay = ""; +- QString mDateFormat = ""; +- QString mTimeFormat = ""; +-}; +- +-#endif // AREAINTERFACE_H +diff --git a/registeredSession/main.cpp b/registeredSession/main.cpp +index e9a688c..b37e031 100644 +--- a/registeredSession/main.cpp ++++ b/registeredSession/main.cpp +@@ -12,7 +12,6 @@ + #include "plugins/area/areainterface.h" + #include "plugins/default/defaultinterface.h" + #include "plugins/autoboot/autostartinterface.h" +-#include "plugins/notice/noticeinterface.h" + #include "plugins/about/aboutinterface.h" + #include "plugins/datetime/datetimeinterface.h" + #include "plugins/wallpaper/wallpaperinterface.h" +@@ -61,7 +60,6 @@ int main(int argc, char *argv[]) + plugins["/Mouse"] = new MouseInterface; + plugins["/Default"] = new DefaultInterface; + plugins["/Autoboot"] = new AutoStartInterface; +- plugins["/Notice"] = new NoticeInterface; + plugins["/About"] = new AboutInterface; + plugins["/Wallpaper"] = new WallpaperInterface; + plugins["/Screenlock"] = new ScreenlockInterface; +diff --git a/registeredSession/plugins/notice/noticeinterface.cpp b/registeredSession/plugins/notice/noticeinterface.cpp +deleted file mode 100644 +index d41e182..0000000 +--- a/registeredSession/plugins/notice/noticeinterface.cpp ++++ /dev/null +@@ -1,288 +0,0 @@ +-#include "noticeinterface.h" +-#include "../../universalinterface.h" +-#include <QDebug> +-#include <QStandardPaths> +-#include <QSettings> +-#include <KApplicationTrader> +-#include <KService> +-#include <KSharedConfig> +-#include <KConfigGroup> +-#include <QFileInfo> +- +-#define NOTICE_SCHEMA "org.ukui.control-center.notice" +-#define ENABLE_NOTICE_KEY "enable-notice" +- +-#define NOTICE_ORIGIN_SCHEMA "org.ukui.control-center.noticeorigin" +-#define NOTICE_ORIGIN_PATH "/org/ukui/control-center/noticeorigin/" +-#define MAX_SHORTCUTS 1000 +-#define MESSAGES_KEY "messages" +-#define VOICE_KEY "voice" +-#define SHOW_SCREENLOCK_KEY "show-on-screenlock" +-#define SHOW_DETAIL_KEY "show-detail" +-#define STYLE_KEY "notification-style" +- +-#define NOTIFICATION_DEMO_SCHEMA "org.ukui.notification.demo" +-#define AUTOSTART_KEY "autostartdisturb" +-#define PROJECTIONSCREEN_KEY "projectionscreendisturb" +-#define FULLSCREEN_KEY "fullscreendisturb" +-#define ALARMCLOCK_KEY "alarmclockdisturb" +-#define TIMESTART_KEY "timestart" +-#define TIMEEND_KEY "timeend" +- +-#define AUTOSTARTDIR "/etc/xdg/autostart/" +- +-NoticeInterface::NoticeInterface() +-{ +- mUkccNoticeGsettings = UniversalInterface::self()->ukccNoticeGsettings(); +- mUkuiNoticeGsettings = UniversalInterface::self()->ukuiNoticeGsettings(); +- mStyleGsettings = UniversalInterface::self()->ukuiStyleGsettings(); +- +- mGsettingMap[ENABLE_NOTICE_KEY] = QString("enableNotice"); +- mGsettingMap[SHOW_SCREENLOCK_KEY] = QString("showOnScreenlock"); +- mGsettingMap[SHOW_DETAIL_KEY] = QString("showDetail"); +- mGsettingMap[STYLE_KEY] = QString("notificationStyle"); +- +- mWhiteList.append("kylin-screenshot.desktop"); +- mWhiteList.append("peony.desktop"); +- mWhiteList.append("kylin-device-daemon.desktop"); +- mWhiteList.append("ukui-power-manager.desktop"); +- mWhiteList.append("kylin-system-update.desktop"); +- mWhiteList.append("ukui-bluetooth.desktop"); +- +- if (mUkccNoticeGsettings) +- connect(mUkccNoticeGsettings, &QGSettings::changed, [=](const QString &key){ +- emit changed(key); +- }); +- if (mUkuiNoticeGsettings) +- connect(mUkuiNoticeGsettings, &QGSettings::changed, [=](const QString &key){ +- emit changed(key); +- }); +- if (mStyleGsettings) +- connect(mStyleGsettings, &QGSettings::changed, [=](const QString &key){ +- emit changed(key); +- }); +- +- +- +-} +- +-bool NoticeInterface::getAutostartDisturb() +-{ +- if (mUkuiNoticeGsettings->keys().contains(AUTOSTART_KEY)) { +- return mUkuiNoticeGsettings->get(AUTOSTART_KEY).toBool(); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << AUTOSTART_KEY; +- } +- return false; +-} +- +-bool NoticeInterface::getProjectionsScreenDisturb() +-{ +- if (mUkuiNoticeGsettings->keys().contains(PROJECTIONSCREEN_KEY)) { +- return mUkuiNoticeGsettings->get(PROJECTIONSCREEN_KEY).toBool(); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << PROJECTIONSCREEN_KEY; +- } +- return false; +-} +- +-bool NoticeInterface::getFullScreenDisturb() +-{ +- if (mUkuiNoticeGsettings->keys().contains(FULLSCREEN_KEY)) { +- return mUkuiNoticeGsettings->get(FULLSCREEN_KEY).toBool(); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << FULLSCREEN_KEY; +- } +- return false; +-} +- +-bool NoticeInterface::getAlarmClockDisturb() +-{ +- if (mUkuiNoticeGsettings->keys().contains(ALARMCLOCK_KEY)) { +- return mUkuiNoticeGsettings->get(ALARMCLOCK_KEY).toBool(); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << ALARMCLOCK_KEY; +- } +- return false; +-} +- +-QString NoticeInterface::getTimeStart() +-{ +- if (mUkuiNoticeGsettings->keys().contains(TIMESTART_KEY)) { +- return mUkuiNoticeGsettings->get(TIMESTART_KEY).toString(); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << TIMESTART_KEY; +- } +- return QString(); +-} +- +-QString NoticeInterface::getTimeEnd() +-{ +- if (mUkuiNoticeGsettings->keys().contains(TIMEEND_KEY)) { +- return mUkuiNoticeGsettings->get(TIMEEND_KEY).toString(); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << TIMEEND_KEY; +- } +- return QString(); +-} +- +-bool NoticeInterface::getNoticeEnable() +-{ +- if (mUkccNoticeGsettings->keys().contains(mGsettingMap[ENABLE_NOTICE_KEY])) { +- return mUkccNoticeGsettings->get(ENABLE_NOTICE_KEY).toBool(); +- } else { +- qCritical() << "mUkccNoticeGsettings not contains the key: " << mUkccNoticeGsettings; +- } +- return false; +-} +- +-QList <QVariant> NoticeInterface::getNoticeAppList() +-{ +- qDBusRegisterMetaType<NoticeApp>(); +- QList <QVariant> list; +- for (QString desktopName : mWhiteList) { +- QFileInfo file(AUTOSTARTDIR + desktopName); +- if (file.exists()) { +- QString mainSection = QStringLiteral("Desktop Entry"); +- KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(AUTOSTARTDIR + desktopName, KConfig::NoGlobals); +- KConfigGroup cfg(sharedConfig, mainSection); +- QString name = cfg.readEntry("Name"); +- QString icon = cfg.readEntry("Icon"); +- QString fileName = desktopName.left(desktopName.indexOf(QLatin1Char('.'))); +- +- if (mApplist.contains(name)) +- continue; +- mApplist.append(name); +- NoticeApp app; +- app.desktop = fileName; +- app.name = name; +- app.icon = icon; +- getAppInfo(app, fileName); +- list.append(QVariant::fromValue(app)); +- } +- } +- +- KApplicationTrader::query([=, &list](const KService::Ptr &service) { +- if (service->exec().isEmpty() || service->noDisplay()) +- return false; +- +- QString appname, desktopEntryName, icon; +- appname = service->name(); +- desktopEntryName = service->desktopEntryName(); +- icon = service->icon(); +- +- if (mApplist.contains(appname)) +- return false; +- +- mApplist.append(appname); +- NoticeApp app; +- app.desktop = desktopEntryName; +- app.name = appname; +- app.icon = icon; +- getAppInfo(app, desktopEntryName); +- list.append(QVariant::fromValue(app)); +- return true; +- }); +- mApplist.clear(); +- return list; +-} +- +-void NoticeInterface::getAppInfo(NoticeApp &app, const QString &desktop) +-{ +- const QByteArray id(NOTICE_ORIGIN_SCHEMA); +- QString path = QString("%1%2%3").arg(NOTICE_ORIGIN_PATH).arg(desktop).arg("/"); +- QGSettings *settings = new QGSettings(id, path.toUtf8().data(), this); +- +- app.status = settings->get(MESSAGES_KEY).toBool(); +- +- app.voice = settings->get(VOICE_KEY).toBool(); +- app.detail = settings->get(SHOW_DETAIL_KEY).toBool(); +- app.show = settings->get(SHOW_SCREENLOCK_KEY).toBool(); +- QString style = settings->get(STYLE_KEY).toString(); +- app.mode = 0; +- if (style == "mutative") { +- app.mode = 0; +- } else if (style == "always") { +- app.mode = 1; +- } else if (style == "none") { +- app.mode = 2; +- } +- mNoticeAppsMap[desktop] = settings; +-} +- +-void NoticeInterface::setNoticeDisturb(const QString &key, bool value) +-{ +- if (mUkuiNoticeGsettings->keys().contains(key)) { +- return mUkuiNoticeGsettings->set(key, value); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << key; +- } +-} +- +-void NoticeInterface::setNoticeDisturb(const QString &key, const QString &value) +-{ +- if (mUkuiNoticeGsettings->keys().contains(key)) { +- return mUkuiNoticeGsettings->set(key, value); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << key; +- } +-} +- +-void NoticeInterface::setUkccNotice(const QString &key, bool value) +-{ +- if (mUkccNoticeGsettings->keys().contains(mGsettingMap[key]) || mUkccNoticeGsettings->keys().contains(key)) { +- return mUkccNoticeGsettings->set(key, value); +- } else { +- qCritical() << "mUkccNoticeGsettings not contains the key: " << key; +- } +-} +- +-void NoticeInterface::setAppInfo(const QString &desktop, const QString &key, bool value) +-{ +- auto iter = mNoticeAppsMap.find(desktop); +- if (iter != mNoticeAppsMap.end()) { +- QGSettings *settings = iter.value(); +- if (settings) +- settings->set(key, value); +- } +-} +- +-void NoticeInterface::setAppInfo(const QString &desktop, const QString &key, const QString &value) +-{ +- auto iter = mNoticeAppsMap.find(desktop); +- if (iter != mNoticeAppsMap.end()) { +- QGSettings *settings = iter.value(); +- if (settings) +- settings->set(key, value); +- } +-} +- +-const QDBusArgument &operator<<(QDBusArgument &argument, const NoticeApp &app) +-{ +- argument.beginStructure(); +- argument << app.desktop; +- argument << app.icon; +- argument << app.name; +- argument << app.status; +- argument << app.voice; +- argument << app.detail; +- argument << app.show; +- argument << app.mode; +- argument.endStructure(); +- return argument; +-} +- +-const QDBusArgument &operator>>(const QDBusArgument &argument, NoticeApp &app) +-{ +- argument.beginStructure(); +- argument >> app.desktop; +- argument >> app.icon; +- argument >> app.name; +- argument >> app.status; +- argument >> app.voice; +- argument >> app.detail; +- argument >> app.show; +- argument >> app.mode; +- argument.endStructure(); +- return argument; +-} +diff --git a/registeredSession/plugins/notice/noticeinterface.h b/registeredSession/plugins/notice/noticeinterface.h +deleted file mode 100644 +index ee37bc8..0000000 +--- a/registeredSession/plugins/notice/noticeinterface.h ++++ /dev/null +@@ -1,78 +0,0 @@ +-#ifndef NOTICEINTERFACE_H +-#define NOTICEINTERFACE_H +- +-#include <QObject> +-#include <QDBusArgument> +-#include <QVariant> +-#include <QDBusMetaType> +-#include <QGSettings> +- +-struct NoticeApp +-{ +- QString desktop; +- QString name; +- QString icon; +- bool status; +- bool voice; +- bool detail; +- bool show; +- int mode; +-}; +-const QDBusArgument &operator<<(QDBusArgument &argument, const NoticeApp &app); +-const QDBusArgument &operator>>(const QDBusArgument &argument, NoticeApp &app); +-Q_DECLARE_METATYPE(NoticeApp) +- +- +-class NoticeInterface : public QObject +-{ +- Q_OBJECT +- Q_CLASSINFO("D-Bus Interface", "org.ukui.ukcc.session.Notice") +- Q_PROPERTY(bool isAutostartDisturb READ getAutostartDisturb) +- Q_PROPERTY(bool isProjectionScreenDisturb READ getProjectionsScreenDisturb) +- Q_PROPERTY(bool isFullScreenDisturb READ getFullScreenDisturb) +- Q_PROPERTY(bool isAlarmClockDisturb READ getAlarmClockDisturb) +- Q_PROPERTY(QString timeStart READ getTimeStart) +- Q_PROPERTY(QString timeEnd READ getTimeEnd) +- Q_PROPERTY(bool isEnable READ getNoticeEnable) +- Q_PROPERTY(QList <QVariant> noticeAppList READ getNoticeAppList) +-// Q_PROPERTY(int cursorSpeed READ getCursorSpeed) +-public: +- NoticeInterface(); +- +-protected: +- bool getAutostartDisturb(); +- bool getProjectionsScreenDisturb(); +- bool getFullScreenDisturb(); +- bool getAlarmClockDisturb(); +- QString getTimeStart(); +- QString getTimeEnd(); +- +- bool getNoticeEnable(); +- QList <QVariant> getNoticeAppList(); +- +-private: +- void getAppInfo(NoticeApp &app,const QString &desktop); +- +-public Q_SLOTS: +- void setNoticeDisturb(const QString &key, bool value); +- void setNoticeDisturb(const QString &key, const QString &value); +- void setUkccNotice(const QString &key, bool value); +- void setAppInfo(const QString &desktop, const QString &key, bool value); +- void setAppInfo(const QString &desktop, const QString &key, const QString &value); +- +-private: +- QGSettings *mUkccNoticeGsettings = nullptr; +- QGSettings *mUkuiNoticeGsettings = nullptr; +- QGSettings *mStyleGsettings = nullptr; +- +- QMap <QString, QString> mGsettingMap; +- QMap <QString, QGSettings *> mNoticeAppsMap; +- +- QStringList mWhiteList; +- QStringList mApplist; +- +-Q_SIGNALS: +- void changed(const QString &key); +-}; +- +-#endif // NOTICEINTERFACE_H +diff --git a/registeredSession/registeredSession.pro b/registeredSession/registeredSession.pro +index 262acfe..ddb17e5 100644 +--- a/registeredSession/registeredSession.pro ++++ b/registeredSession/registeredSession.pro +@@ -49,7 +49,6 @@ SOURCES += \ + plugins/keyboard/keyboardinterface.cpp \ + plugins/mouse/mouseinterface.cpp \ + plugins/default/defaultinterface.cpp \ +- plugins/notice/noticeinterface.cpp \ + plugins/screenlock/screenlockinterface.cpp \ + plugins/screensaver/screensaverinterface.cpp \ + plugins/shortcut/getshortcutworker.cpp \ +@@ -76,7 +75,6 @@ HEADERS += \ + plugins/keyboard/keyboardinterface.h \ + plugins/mouse/mouseinterface.h \ + plugins/default/defaultinterface.h \ +- plugins/notice/noticeinterface.h \ + plugins/screenlock/screenlockinterface.h \ + plugins/screensaver/screensaverinterface.h \ + plugins/shortcut/getshortcutworker.h \ Binary files /tmp/tmpdddpkfao/as7uLa4PN6/ukui-control-center-4.10.0.0/debian/patches/0116-chore-md.patch and /tmp/tmpdddpkfao/liSN4nWT0d/ukui-control-center-4.10.0.0/debian/patches/0116-chore-md.patch differ diff -Nru ukui-control-center-4.10.0.0/debian/patches/0117-133-v11-2501.patch ukui-control-center-4.10.0.0/debian/patches/0117-133-v11-2501.patch --- ukui-control-center-4.10.0.0/debian/patches/0117-133-v11-2501.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0117-133-v11-2501.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,1042 @@ +From: nil <zhoubin@kylinos.cn> +Date: Wed, 8 Jan 2025 07:48:16 +0000 +Subject: =?utf-8?b?ITEzMyDjgJB2MTEtMjUwMeOAkeWNleWFg+a1i+ivlSDmjqfliLbpnaI=?= + =?utf-8?b?5p2/IE1lcmdlIHB1bGwgcmVxdWVzdCAhMTMzIGZyb20g5L2V5oCd6IOcL25pbGU=?= + +--- + registeredSession/json.cpp | 732 -------------------------------- + registeredSession/json.h | 265 ------------ + registeredSession/registeredSession.pro | 2 - + 3 files changed, 999 deletions(-) + delete mode 100644 registeredSession/json.cpp + delete mode 100644 registeredSession/json.h + +diff --git a/registeredSession/json.cpp b/registeredSession/json.cpp +deleted file mode 100644 +index 6f3c0de..0000000 +--- a/registeredSession/json.cpp ++++ /dev/null +@@ -1,732 +0,0 @@ +-/** +- * QtJson - A simple class for parsing JSON data into a QVariant hierarchies and vice-versa. +- * Copyright (C) 2011 Eeli Reilin +- * +- * 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 <http://www.gnu.org/licenses/>. +- */ +- +-/** +- * \file json.cpp +- */ +- +-#include <QDateTime> +-#include <QStringList> +-#include "json.h" +- +-namespace QtJson { +- static QString dateFormat, dateTimeFormat; +- static bool prettySerialize = false; +- +- static QString sanitizeString(QString str); +- static QByteArray join(const QList<QByteArray> &list, const QByteArray &sep); +- static QVariant parseValue(const QString &json, int &index, bool &success); +- static QVariant parseObject(const QString &json, int &index, bool &success); +- static QVariant parseArray(const QString &json, int &index, bool &success); +- static QVariant parseString(const QString &json, int &index, bool &success); +- static QVariant parseNumber(const QString &json, int &index); +- static int lastIndexOfNumber(const QString &json, int index); +- static void eatWhitespace(const QString &json, int &index); +- static int lookAhead(const QString &json, int index); +- static int nextToken(const QString &json, int &index); +- +- template<typename T> +- QByteArray serializeMap(const T &map, bool &success, int _level = 0) { +- QByteArray newline; +- QByteArray tabs; +- QByteArray tabsFields; +- if (prettySerialize && !map.isEmpty()) { +- newline = "\n"; +- for (int l=1; l<_level; l++) { +- tabs += " "; +- } +- tabsFields = tabs + " "; +- } +- +- QByteArray str = "{" + newline; +- QList<QByteArray> pairs; +- for (typename T::const_iterator it = map.begin(), itend = map.end(); it != itend; ++it) { +- bool otherSuccess = true; +- QByteArray serializedValue = serialize(it.value(), otherSuccess, _level); +- if (serializedValue.isNull()) { +- success = false; +- break; +- } +- pairs << tabsFields + sanitizeString(it.key()).toUtf8() + ":" + (prettySerialize ? " " : "") + serializedValue; +- } +- +- str += join(pairs, "," + newline) + newline; +- str += tabs + "}"; +- return str; +- } +- +- void insert(QVariant &v, const QString &key, const QVariant &value); +- void append(QVariant &v, const QVariant &value); +- +- template<typename T> +- void cloneMap(QVariant &json, const T &map) { +- for (typename T::const_iterator it = map.begin(), itend = map.end(); it != itend; ++it) { +- insert(json, it.key(), (*it)); +- } +- } +- +- template<typename T> +- void cloneList(QVariant &json, const T &list) { +- for (typename T::const_iterator it = list.begin(), itend = list.end(); it != itend; ++it) { +- append(json, (*it)); +- } +- } +- +- /** +- * parse +- */ +- QVariant parse(const QString &json) { +- bool success = true; +- return parse(json, success); +- } +- +- /** +- * parse +- */ +- QVariant parse(const QString &json, bool &success) { +- success = true; +- +- // Return an empty QVariant if the JSON data is either null or empty +- if (!json.isNull() || !json.isEmpty()) { +- QString data = json; +- // We'll start from index 0 +- int index = 0; +- +- // Parse the first value +- QVariant value = parseValue(data, index, success); +- +- // Return the parsed value +- return value; +- } else { +- // Return the empty QVariant +- return QVariant(); +- } +- } +- +- /** +- * clone +- */ +- QVariant clone(const QVariant &data) { +- QVariant v; +- +- if (data.type() == QVariant::Map) { +- cloneMap(v, data.toMap()); +- } else if (data.type() == QVariant::Hash) { +- cloneMap(v, data.toHash()); +- } else if (data.type() == QVariant::List) { +- cloneList(v, data.toList()); +- } else if (data.type() == QVariant::StringList) { +- cloneList(v, data.toStringList()); +- } else { +- v = QVariant(data); +- } +- +- return v; +- } +- +- /** +- * insert value (map case) +- */ +- void insert(QVariant &v, const QString &key, const QVariant &value) { +- if (!v.canConvert<QVariantMap>()) v = QVariantMap(); +- QVariantMap *p = (QVariantMap *)v.data(); +- p->insert(key, clone(value)); +- } +- +- /** +- * append value (list case) +- */ +- void append(QVariant &v, const QVariant &value) { +- if (!v.canConvert<QVariantList>()) v = QVariantList(); +- QVariantList *p = (QVariantList *)v.data(); +- p->append(value); +- } +- +- QByteArray serialize(const QVariant &data) { +- bool success = true; +- return serialize(data, success); +- } +- +- QByteArray serialize(const QVariant &data, bool &success, int _level /*= 0*/) { +- QByteArray newline; +- QByteArray tabs; +- QByteArray tabsFields; +- if (prettySerialize) { +- newline = "\n"; +- for (int l=0; l<_level; l++) { +- tabs += " "; +- } +- tabsFields = tabs + " "; +- } +- +- QByteArray str; +- success = true; +- +- if (!data.isValid()) { // invalid or null? +- str = "null"; +- } else if ((data.type() == QVariant::List) || +- (data.type() == QVariant::StringList)) { // variant is a list? +- QList<QByteArray> values; +- const QVariantList list = data.toList(); +- Q_FOREACH(const QVariant& v, list) { +- bool otherSuccess = true; +- QByteArray serializedValue = serialize(v, otherSuccess, _level+1); +- if (serializedValue.isNull()) { +- success = false; +- break; +- } +- values << tabsFields + serializedValue; +- } +- +- if (!values.isEmpty()) { +- str = "[" + newline + join( values, "," + newline ) + newline + tabs + "]"; +- } else { +- str = "[]"; +- } +- } else if (data.type() == QVariant::Hash) { // variant is a hash? +- str = serializeMap<>(data.toHash(), success, _level+1); +- } else if (data.type() == QVariant::Map) { // variant is a map? +- str = serializeMap<>(data.toMap(), success, _level+1); +- } else if ((data.type() == QVariant::String) || +- (data.type() == QVariant::ByteArray)) {// a string or a byte array? +- str = sanitizeString(data.toString()).toUtf8(); +- } else if (data.type() == QVariant::Double) { // double? +- double value = data.toDouble(&success); +- if (success) { +- str = QByteArray::number(value, 'g'); +- if (!str.contains(".") && ! str.contains("e")) { +- str += ".0"; +- } +- } +- } else if (data.type() == QVariant::Bool) { // boolean value? +- str = data.toBool() ? "true" : "false"; +- } else if (data.type() == QVariant::ULongLong) { // large unsigned number? +- str = QByteArray::number(data.value<qulonglong>()); +- } else if (data.canConvert<qlonglong>()) { // any signed number? +- str = QByteArray::number(data.value<qlonglong>()); +- } else if (data.canConvert<long>()) { //TODO: this code is never executed because all smaller types can be converted to qlonglong +- str = QString::number(data.value<long>()).toUtf8(); +- } else if (data.type() == QVariant::DateTime) { // datetime value? +- str = sanitizeString(dateTimeFormat.isEmpty() +- ? data.toDateTime().toString() +- : data.toDateTime().toString(dateTimeFormat)).toUtf8(); +- } else if (data.type() == QVariant::Date) { // date value? +- str = sanitizeString(dateTimeFormat.isEmpty() +- ? data.toDate().toString() +- : data.toDate().toString(dateFormat)).toUtf8(); +- } else if (data.canConvert<QString>()) { // can value be converted to string? +- // this will catch QUrl, ... (all other types which can be converted to string) +- str = sanitizeString(data.toString()).toUtf8(); +- } else { +- success = false; +- } +- +- if (success) { +- return str; +- } +- return QByteArray(); +- } +- +- QString serializeStr(const QVariant &data) { +- return QString::fromUtf8(serialize(data)); +- } +- +- QString serializeStr(const QVariant &data, bool &success) { +- return QString::fromUtf8(serialize(data, success)); +- } +- +- +- /** +- * \enum JsonToken +- */ +- enum JsonToken { +- JsonTokenNone = 0, +- JsonTokenCurlyOpen = 1, +- JsonTokenCurlyClose = 2, +- JsonTokenSquaredOpen = 3, +- JsonTokenSquaredClose = 4, +- JsonTokenColon = 5, +- JsonTokenComma = 6, +- JsonTokenString = 7, +- JsonTokenNumber = 8, +- JsonTokenTrue = 9, +- JsonTokenFalse = 10, +- JsonTokenNull = 11 +- }; +- +- static QString sanitizeString(QString str) { +- str.replace(QLatin1String("\\"), QLatin1String("\\\\")); +- str.replace(QLatin1String("\""), QLatin1String("\\\"")); +- str.replace(QLatin1String("\b"), QLatin1String("\\b")); +- str.replace(QLatin1String("\f"), QLatin1String("\\f")); +- str.replace(QLatin1String("\n"), QLatin1String("\\n")); +- str.replace(QLatin1String("\r"), QLatin1String("\\r")); +- str.replace(QLatin1String("\t"), QLatin1String("\\t")); +- return QString(QLatin1String("\"%1\"")).arg(str); +- } +- +- static QByteArray join(const QList<QByteArray> &list, const QByteArray &sep) { +- QByteArray res; +- Q_FOREACH(const QByteArray &i, list) { +- if (!res.isEmpty()) { +- res += sep; +- } +- res += i; +- } +- return res; +- } +- +- /** +- * parseValue +- */ +- static QVariant parseValue(const QString &json, int &index, bool &success) { +- // Determine what kind of data we should parse by +- // checking out the upcoming token +- switch(lookAhead(json, index)) { +- case JsonTokenString: +- return parseString(json, index, success); +- case JsonTokenNumber: +- return parseNumber(json, index); +- case JsonTokenCurlyOpen: +- return parseObject(json, index, success); +- case JsonTokenSquaredOpen: +- return parseArray(json, index, success); +- case JsonTokenTrue: +- nextToken(json, index); +- return QVariant(true); +- case JsonTokenFalse: +- nextToken(json, index); +- return QVariant(false); +- case JsonTokenNull: +- nextToken(json, index); +- return QVariant(); +- case JsonTokenNone: +- break; +- } +- +- // If there were no tokens, flag the failure and return an empty QVariant +- success = false; +- return QVariant(); +- } +- +- /** +- * parseObject +- */ +- static QVariant parseObject(const QString &json, int &index, bool &success) { +- QVariantMap map; +- int token; +- +- // Get rid of the whitespace and increment index +- nextToken(json, index); +- +- // Loop through all of the key/value pairs of the object +- bool done = false; +- while (!done) { +- // Get the upcoming token +- token = lookAhead(json, index); +- +- if (token == JsonTokenNone) { +- success = false; +- return QVariantMap(); +- } else if (token == JsonTokenComma) { +- nextToken(json, index); +- } else if (token == JsonTokenCurlyClose) { +- nextToken(json, index); +- return map; +- } else { +- // Parse the key/value pair's name +- QString name = parseString(json, index, success).toString(); +- +- if (!success) { +- return QVariantMap(); +- } +- +- // Get the next token +- token = nextToken(json, index); +- +- // If the next token is not a colon, flag the failure +- // return an empty QVariant +- if (token != JsonTokenColon) { +- success = false; +- return QVariant(QVariantMap()); +- } +- +- // Parse the key/value pair's value +- QVariant value = parseValue(json, index, success); +- +- if (!success) { +- return QVariantMap(); +- } +- +- // Assign the value to the key in the map +- map[name] = value; +- } +- } +- +- // Return the map successfully +- return QVariant(map); +- } +- +- /** +- * parseArray +- */ +- static QVariant parseArray(const QString &json, int &index, bool &success) { +- QVariantList list; +- +- nextToken(json, index); +- +- bool done = false; +- while(!done) { +- int token = lookAhead(json, index); +- +- if (token == JsonTokenNone) { +- success = false; +- return QVariantList(); +- } else if (token == JsonTokenComma) { +- nextToken(json, index); +- } else if (token == JsonTokenSquaredClose) { +- nextToken(json, index); +- break; +- } else { +- QVariant value = parseValue(json, index, success); +- if (!success) { +- return QVariantList(); +- } +- list.push_back(value); +- } +- } +- +- return QVariant(list); +- } +- +- /** +- * parseString +- */ +- static QVariant parseString(const QString &json, int &index, bool &success) { +- QString s; +- QChar c; +- +- eatWhitespace(json, index); +- +- c = json[index++]; +- +- bool complete = false; +- while(!complete) { +- if (index == json.size()) { +- break; +- } +- +- c = json[index++]; +- +- if (c == '\"') { +- complete = true; +- break; +- } else if (c == '\\') { +- if (index == json.size()) { +- break; +- } +- +- c = json[index++]; +- +- if (c == '\"') { +- s.append('\"'); +- } else if (c == '\\') { +- s.append('\\'); +- } else if (c == '/') { +- s.append('/'); +- } else if (c == 'b') { +- s.append('\b'); +- } else if (c == 'f') { +- s.append('\f'); +- } else if (c == 'n') { +- s.append('\n'); +- } else if (c == 'r') { +- s.append('\r'); +- } else if (c == 't') { +- s.append('\t'); +- } else if (c == 'u') { +- int remainingLength = json.size() - index; +- if (remainingLength >= 4) { +- QString unicodeStr = json.mid(index, 4); +- +- int symbol = unicodeStr.toInt(0, 16); +- +- s.append(QChar(symbol)); +- +- index += 4; +- } else { +- break; +- } +- } +- } else { +- s.append(c); +- } +- } +- +- if (!complete) { +- success = false; +- return QVariant(); +- } +- +- return QVariant(s); +- } +- +- /** +- * parseNumber +- */ +- static QVariant parseNumber(const QString &json, int &index) { +- eatWhitespace(json, index); +- +- int lastIndex = lastIndexOfNumber(json, index); +- int charLength = (lastIndex - index) + 1; +- QString numberStr; +- +- numberStr = json.mid(index, charLength); +- +- index = lastIndex + 1; +- bool ok; +- +- if (numberStr.contains('.')) { +- return QVariant(numberStr.toDouble(NULL)); +- } else if (numberStr.startsWith('-')) { +- int i = numberStr.toInt(&ok); +- if (!ok) { +- qlonglong ll = numberStr.toLongLong(&ok); +- return ok ? ll : QVariant(numberStr); +- } +- return i; +- } else { +- uint u = numberStr.toUInt(&ok); +- if (!ok) { +- qulonglong ull = numberStr.toULongLong(&ok); +- return ok ? ull : QVariant(numberStr); +- } +- return u; +- } +- } +- +- /** +- * lastIndexOfNumber +- */ +- static int lastIndexOfNumber(const QString &json, int index) { +- int lastIndex; +- +- for(lastIndex = index; lastIndex < json.size(); lastIndex++) { +- if (QString("0123456789+-.eE").indexOf(json[lastIndex]) == -1) { +- break; +- } +- } +- +- return lastIndex -1; +- } +- +- /** +- * eatWhitespace +- */ +- static void eatWhitespace(const QString &json, int &index) { +- for(; index < json.size(); index++) { +- if (QString(" \t\n\r").indexOf(json[index]) == -1) { +- break; +- } +- } +- } +- +- /** +- * lookAhead +- */ +- static int lookAhead(const QString &json, int index) { +- int saveIndex = index; +- return nextToken(json, saveIndex); +- } +- +- /** +- * nextToken +- */ +- static int nextToken(const QString &json, int &index) { +- eatWhitespace(json, index); +- +- if (index == json.size()) { +- return JsonTokenNone; +- } +- +- QChar c = json[index]; +- index++; +- switch(c.toLatin1()) { +- case '{': return JsonTokenCurlyOpen; +- case '}': return JsonTokenCurlyClose; +- case '[': return JsonTokenSquaredOpen; +- case ']': return JsonTokenSquaredClose; +- case ',': return JsonTokenComma; +- case '"': return JsonTokenString; +- case '0': case '1': case '2': case '3': case '4': +- case '5': case '6': case '7': case '8': case '9': +- case '-': return JsonTokenNumber; +- case ':': return JsonTokenColon; +- } +- index--; // ^ WTF? +- +- int remainingLength = json.size() - index; +- +- // True +- if (remainingLength >= 4) { +- if (json[index] == 't' && json[index + 1] == 'r' && +- json[index + 2] == 'u' && json[index + 3] == 'e') { +- index += 4; +- return JsonTokenTrue; +- } +- } +- +- // False +- if (remainingLength >= 5) { +- if (json[index] == 'f' && json[index + 1] == 'a' && +- json[index + 2] == 'l' && json[index + 3] == 's' && +- json[index + 4] == 'e') { +- index += 5; +- return JsonTokenFalse; +- } +- } +- +- // Null +- if (remainingLength >= 4) { +- if (json[index] == 'n' && json[index + 1] == 'u' && +- json[index + 2] == 'l' && json[index + 3] == 'l') { +- index += 4; +- return JsonTokenNull; +- } +- } +- +- return JsonTokenNone; +- } +- +- void setDateTimeFormat(const QString &format) { +- dateTimeFormat = format; +- } +- +- void setDateFormat(const QString &format) { +- dateFormat = format; +- } +- +- QString getDateTimeFormat() { +- return dateTimeFormat; +- } +- +- QString getDateFormat() { +- return dateFormat; +- } +- +- void setPrettySerialize(bool enabled) { +- prettySerialize = enabled; +- } +- +- bool isPrettySerialize() { +- return prettySerialize; +- } +- +- +- +- QQueue<BuilderJsonObject *> BuilderJsonObject::created_list; +- +- BuilderJsonObject::BuilderJsonObject() { +- // clean objects previous "created" +- while (!BuilderJsonObject::created_list.isEmpty()) { +- delete BuilderJsonObject::created_list.dequeue(); +- } +- } +- +- BuilderJsonObject::BuilderJsonObject(JsonObject &json) { +- BuilderJsonObject(); +- +- obj = json; +- } +- +- BuilderJsonObject *BuilderJsonObject::set(const QString &key, const QVariant &value) { +- obj[key] = value; +- +- return this; +- } +- +- BuilderJsonObject *BuilderJsonObject::set(const QString &key, BuilderJsonObject *builder) { +- return set(key, builder->create()); +- } +- +- BuilderJsonObject *BuilderJsonObject::set(const QString &key, BuilderJsonArray *builder) { +- return set(key, builder->create()); +- } +- +- JsonObject BuilderJsonObject::create() { +- BuilderJsonObject::created_list.enqueue(this); +- +- return obj; +- } +- +- +- QQueue<BuilderJsonArray *> BuilderJsonArray::created_list; +- +- BuilderJsonArray::BuilderJsonArray() { +- // clean objects previous "created" +- while (!BuilderJsonArray::created_list.isEmpty()) { +- delete BuilderJsonArray::created_list.dequeue(); +- } +- } +- +- BuilderJsonArray::BuilderJsonArray(JsonArray &json) { +- BuilderJsonArray(); +- +- array = json; +- } +- +- BuilderJsonArray *BuilderJsonArray::add(const QVariant &element) { +- array.append(element); +- +- return this; +- } +- +- BuilderJsonArray *BuilderJsonArray::add(BuilderJsonObject *builder) { +- return add(builder->create()); +- } +- +- BuilderJsonArray *BuilderJsonArray::add(BuilderJsonArray *builder) { +- return add(builder->create()); +- } +- +- JsonArray BuilderJsonArray::create() { +- BuilderJsonArray::created_list.enqueue(this); +- +- return array; +- } +- +- +- +- +- BuilderJsonObject *objectBuilder() { +- return new BuilderJsonObject(); +- } +- +- BuilderJsonObject *objectBuilder(JsonObject &json) { +- return new BuilderJsonObject(json); +- } +- +- BuilderJsonArray *arrayBuilder() { +- return new BuilderJsonArray(); +- } +- +- BuilderJsonArray *arrayBuilder(JsonArray &json) { +- return new BuilderJsonArray(json); +- } +- +-} //end namespace +diff --git a/registeredSession/json.h b/registeredSession/json.h +deleted file mode 100644 +index 74a2c40..0000000 +--- a/registeredSession/json.h ++++ /dev/null +@@ -1,265 +0,0 @@ +-/** +- * QtJson - A simple class for parsing JSON data into a QVariant hierarchies and vice-versa. +- * Copyright (C) 2011 Eeli Reilin +- * +- * 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 <http://www.gnu.org/licenses/>. +- */ +- +-/** +- * \file json.h +- */ +- +-#ifndef JSON_H +-#define JSON_H +- +-#include <QVariant> +-#include <QString> +-#include <QQueue> +- +- +-/** +- * \namespace QtJson +- * \brief A JSON data parser +- * +- * Json parses a JSON data into a QVariant hierarchy. +- */ +-namespace QtJson { +- typedef QVariantMap JsonObject; +- typedef QVariantList JsonArray; +- +- /** +- * Clone a JSON object (makes a deep copy) +- * +- * \param data The JSON object +- */ +- QVariant clone(const QVariant &data); +- +- /** +- * Insert value to JSON object (QVariantMap) +- * +- * \param v The JSON object +- * \param key The key +- * \param value The value +- */ +- void insert(QVariant &v, const QString &key, const QVariant &value); +- +- /** +- * Append value to JSON array (QVariantList) +- * +- * \param v The JSON array +- * \param value The value +- */ +- void append(QVariant &v, const QVariant &value); +- +- /** +- * Parse a JSON string +- * +- * \param json The JSON data +- */ +- QVariant parse(const QString &json); +- +- /** +- * Parse a JSON string +- * +- * \param json The JSON data +- * \param success The success of the parsing +- */ +- QVariant parse(const QString &json, bool &success); +- +- /** +- * This method generates a textual JSON representation +- * +- * \param data The JSON data generated by the parser. +- * +- * \return QByteArray Textual JSON representation in UTF-8 +- */ +- QByteArray serialize(const QVariant &data); +- +- /** +- * This method generates a textual JSON representation +- * +- * \param data The JSON data generated by the parser. +- * \param success The success of the serialization +- * +- * \return QByteArray Textual JSON representation in UTF-8 +- */ +- QByteArray serialize(const QVariant &data, bool &success, int _level = 0); +- +- /** +- * This method generates a textual JSON representation +- * +- * \param data The JSON data generated by the parser. +- * +- * \return QString Textual JSON representation +- */ +- QString serializeStr(const QVariant &data); +- +- /** +- * This method generates a textual JSON representation +- * +- * \param data The JSON data generated by the parser. +- * \param success The success of the serialization +- * +- * \return QString Textual JSON representation +- */ +- QString serializeStr(const QVariant &data, bool &success, int _level = 0); +- +- /** +- * This method sets date(time) format to be used for QDateTime::toString +- * If QString is empty, Qt::TextDate is used. +- * +- * \param format The JSON data generated by the parser. +- */ +- void setDateTimeFormat(const QString& format); +- void setDateFormat(const QString& format); +- +- /** +- * This method gets date(time) format to be used for QDateTime::toString +- * If QString is empty, Qt::TextDate is used. +- */ +- QString getDateTimeFormat(); +- QString getDateFormat(); +- +- /** +- * @brief setPrettySerialize enable/disabled pretty-print when serialize() a json +- * @param enabled +- */ +- void setPrettySerialize(bool enabled); +- +- /** +- * @brief isPrettySerialize check if is enabled pretty-print when serialize() a json +- * @return +- */ +- bool isPrettySerialize(); +- +- +- +- +- /** +- * QVariant based Json object +- */ +- class Object : public QVariant { +- template<typename T> +- Object& insertKey(Object* ptr, const QString& key) { +- T* p = (T*)ptr->data(); +- if (!p->contains(key)) p->insert(key, QVariant()); +- return *reinterpret_cast<Object*>(&p->operator[](key)); +- } +- template<typename T> +- void removeKey(Object *ptr, const QString& key) { +- T* p = (T*)ptr->data(); +- p->remove(key); +- } +- public: +- Object() : QVariant() {} +- Object(const Object& ref) : QVariant(ref) {} +- +- Object& operator=(const QVariant& rhs) { +- /** It maybe more robust when running under Qt versions below 4.7 */ +- QObject * obj = qvariant_cast<QObject *>(rhs); +- // setValue(rhs); +- setValue(obj); +- return *this; +- } +- Object& operator[](const QString& key) { +- if (type() == QVariant::Map) +- return insertKey<QVariantMap>(this, key); +- else if (type() == QVariant::Hash) +- return insertKey<QVariantHash>(this, key); +- +- setValue(QVariantMap()); +- +- return insertKey<QVariantMap>(this, key); +- } +- const Object& operator[](const QString& key) const { +- return const_cast<Object*>(this)->operator[](key); +- } +- void remove(const QString& key) { +- if (type() == QVariant::Map) +- removeKey<QVariantMap>(this, key); +- else if (type() == QVariant::Hash) +- removeKey<QVariantHash>(this, key); +- } +- }; +- +- +- class BuilderJsonArray; +- +- /** +- * @brief The BuilderJsonObject class +- */ +- class BuilderJsonObject { +- +- public: +- BuilderJsonObject(); +- BuilderJsonObject(JsonObject &json); +- +- BuilderJsonObject *set(const QString &key, const QVariant &value); +- BuilderJsonObject *set(const QString &key, BuilderJsonObject *builder); +- BuilderJsonObject *set(const QString &key, BuilderJsonArray *builder); +- JsonObject create(); +- +- private: +- static QQueue<BuilderJsonObject *> created_list; +- +- JsonObject obj; +- }; +- +- /** +- * @brief The BuilderJsonArray class +- */ +- class BuilderJsonArray { +- +- public: +- BuilderJsonArray(); +- BuilderJsonArray(JsonArray &json); +- +- BuilderJsonArray *add(const QVariant &element); +- BuilderJsonArray *add(BuilderJsonObject *builder); +- BuilderJsonArray *add(BuilderJsonArray *builder); +- JsonArray create(); +- +- private: +- static QQueue<BuilderJsonArray *> created_list; +- +- JsonArray array; +- }; +- +- +- /** +- * @brief Create a BuilderJsonObject +- * @return +- */ +- BuilderJsonObject *objectBuilder(); +- +- /** +- * @brief Create a BuilderJsonObject starting from copy of another json +- * @return +- */ +- BuilderJsonObject *objectBuilder(JsonObject &json); +- +- /** +- * @brief Create a BuilderJsonArray +- * @return +- */ +- BuilderJsonArray *arrayBuilder(); +- +- /** +- * @brief Create a BuilderJsonArray starting from copy of another json +- * @return +- */ +- BuilderJsonArray *arrayBuilder(JsonArray &json); +-} +- +-#endif //JSON_H +diff --git a/registeredSession/registeredSession.pro b/registeredSession/registeredSession.pro +index ddb17e5..9189016 100644 +--- a/registeredSession/registeredSession.pro ++++ b/registeredSession/registeredSession.pro +@@ -40,7 +40,6 @@ INSTALLS += inst1 + #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + + SOURCES += \ +- json.cpp \ + main.cpp \ + plugins/about/aboutinterface.cpp \ + plugins/area/areainterface.cpp \ +@@ -67,7 +66,6 @@ target.path = /usr/bin/ + + + HEADERS += \ +- json.h \ + plugins/about/aboutinterface.h \ + plugins/area/areainterface.h \ + plugins/autoboot/autostartinterface.h \ diff -Nru ukui-control-center-4.10.0.0/debian/patches/0118-135-291185.patch ukui-control-center-4.10.0.0/debian/patches/0118-135-291185.patch --- ukui-control-center-4.10.0.0/debian/patches/0118-135-291185.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0118-135-291185.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,28 @@ +From: nil <zhoubin@kylinos.cn> +Date: Wed, 8 Jan 2025 08:09:26 +0000 +Subject: =?utf-8?b?ITEzNSAyOTExODUg44CQ5pe26Ze05LiO5pel5pyf44CR5re75Yqg5paw?= + =?utf-8?b?5pe25Yy677yM5paw5pe25Yy65LiL6Z2i55qE5pe26Ze05pi+56S65byC5bi477yM?= + =?utf-8?b?5q+U5b2T5YmN5pe25Yy65pma55qE5pe26Ze05pi+56S65Li65q+U5LuK5aSp5pep?= + =?utf-8?b?55qE5pe26Ze0IE1lcmdlIHB1bGwgcmVxdWVzdCAhMTM1IGZyb20gbmlsL25pbGUt?= + =?utf-8?b?MDEwNw==?= + +--- + plugins/time-language/datetime/timeBtn.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/plugins/time-language/datetime/timeBtn.cpp b/plugins/time-language/datetime/timeBtn.cpp +index 4b27eaf..cdba347 100644 +--- a/plugins/time-language/datetime/timeBtn.cpp ++++ b/plugins/time-language/datetime/timeBtn.cpp +@@ -103,9 +103,9 @@ void TimeBtn::updateTime(bool hour_24) { + QDateTime thisZoneTime; + const double timeDelta = (thisZone.offsetFromUtc(QDateTime::currentDateTime()) - currentZone.offsetFromUtc(QDateTime::currentDateTime())) / 3600.0; + QString dateLiteral; +- if (QDateTime::currentDateTime().toTimeZone(thisZone).time().hour() + timeDelta >= 24) { ++ if ((QDateTime::currentDateTime().time().hour() + timeDelta) >= 24) { + dateLiteral = tr("Tomorrow"); +- } else if (QDateTime::currentDateTime().toTimeZone(thisZone).time().hour() + timeDelta < 0) { ++ } else if ((QDateTime::currentDateTime().time().hour() + timeDelta) < 0) { + dateLiteral = tr("Yesterday"); + } else { + dateLiteral = tr("Today"); diff -Nru ukui-control-center-4.10.0.0/debian/patches/0119-139-bug.patch ukui-control-center-4.10.0.0/debian/patches/0119-139-bug.patch --- ukui-control-center-4.10.0.0/debian/patches/0119-139-bug.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0119-139-bug.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,107 @@ +From: nil <zhoubin@kylinos.cn> +Date: Fri, 10 Jan 2025 08:53:16 +0000 +Subject: =?utf-8?b?ITEzOSDkv67lpI1idWcgTWVyZ2UgcHVsbCByZXF1ZXN0ICExMzkgZnJv?= + =?utf-8?b?bSDkvZXmgJ3og5wvbmlsZQ==?= + +--- + plugins/account/userinfo/createusernew.cpp | 2 +- + plugins/commoninfo/boot/grubverifydialog.cpp | 4 ++-- + plugins/devices/keyboard/keyboardmain.cpp | 2 ++ + plugins/system/vino/vino.cpp | 20 +++++++++++++++++++- + plugins/system/vino/vino.h | 1 + + 5 files changed, 25 insertions(+), 4 deletions(-) + +diff --git a/plugins/account/userinfo/createusernew.cpp b/plugins/account/userinfo/createusernew.cpp +index dff09ca..e892dec 100644 +--- a/plugins/account/userinfo/createusernew.cpp ++++ b/plugins/account/userinfo/createusernew.cpp +@@ -206,7 +206,7 @@ void CreateUserNew::initUI(){ + typeBtnGroup->addButton(adminRadioBtn, 1); + typeBtnGroup->addButton(standardRadioBtn, 0); + +- adminRadioBtn->setChecked(true); ++ standardRadioBtn->setChecked(true); + + //管理员RadioButton布局 + admin1VerLayout = new QVBoxLayout; +diff --git a/plugins/commoninfo/boot/grubverifydialog.cpp b/plugins/commoninfo/boot/grubverifydialog.cpp +index 0b89e21..0569cd1 100644 +--- a/plugins/commoninfo/boot/grubverifydialog.cpp ++++ b/plugins/commoninfo/boot/grubverifydialog.cpp +@@ -38,7 +38,7 @@ void GrubVerify::initUI() + + //新密码 + newPwdLabel = new QLabel(); +- newPwdLabel->setFixedSize(100,24); ++ newPwdLabel->setFixedWidth(100); + setTextDynamicInPwd(newPwdLabel, tr("Pwd")); + newTipLabel = new QLabel(); + QFont ft; +@@ -81,7 +81,7 @@ void GrubVerify::initUI() + + //确认密码 + surePwdLabel = new QLabel(); +- surePwdLabel->setFixedSize(100,24); ++ surePwdLabel->setFixedWidth(100); + setTextDynamicInPwd(surePwdLabel, tr("Sure Pwd")); + + surePwdLineEdit = new QLineEdit(); +diff --git a/plugins/devices/keyboard/keyboardmain.cpp b/plugins/devices/keyboard/keyboardmain.cpp +index a3db782..e561a03 100644 +--- a/plugins/devices/keyboard/keyboardmain.cpp ++++ b/plugins/devices/keyboard/keyboardmain.cpp +@@ -132,6 +132,8 @@ void KeyboardMain::initKeyboardStatus() + + initShowIconOnDesktop(); + ++ initInputMethodSet(); ++ + initShowIconOnTray(); + + initKeyboardSize(); +diff --git a/plugins/system/vino/vino.cpp b/plugins/system/vino/vino.cpp +index 85c875f..74e23f4 100644 +--- a/plugins/system/vino/vino.cpp ++++ b/plugins/system/vino/vino.cpp +@@ -73,7 +73,10 @@ bool Vino::isEnable() const + if (!UkccCommon::isWayland()) { + return !UkccCommon::isCommunity() && isExistVino(); + } else { +- return true; ++ if (isExistKylinRemote()) { ++ return true; ++ } ++ return false; + } + } + +@@ -81,3 +84,18 @@ bool Vino::isExistVino() const + { + return QGSettings::isSchemaInstalled(QByteArray("org.gnome.Vino")); + } ++ ++bool Vino::isExistKylinRemote() const ++{ ++ QProcess *process = new QProcess; ++ process->start("dpkg -l | grep kylin-remote-desktop-daemon"); ++ process->waitForFinished(); ++ ++ QByteArray ba = process->readAllStandardOutput(); ++ delete process; ++ QString mOutput = QString(ba.data()); ++ if (mOutput.contains("kylin-remote-desktop-daemon")) { ++ return true; ++ } ++ return false; ++} +diff --git a/plugins/system/vino/vino.h b/plugins/system/vino/vino.h +index 9ee60ef..8beaf41 100644 +--- a/plugins/system/vino/vino.h ++++ b/plugins/system/vino/vino.h +@@ -54,5 +54,6 @@ private: + private: + bool isExistVino() const; + ++ bool isExistKylinRemote() const; + }; + #endif // VINO_H Binary files /tmp/tmpdddpkfao/as7uLa4PN6/ukui-control-center-4.10.0.0/debian/patches/0120-140-fix-panel-bug-278913.patch and /tmp/tmpdddpkfao/liSN4nWT0d/ukui-control-center-4.10.0.0/debian/patches/0120-140-fix-panel-bug-278913.patch differ diff -Nru ukui-control-center-4.10.0.0/debian/patches/0121-141-380937-2024-OEM-v11-2501.patch ukui-control-center-4.10.0.0/debian/patches/0121-141-380937-2024-OEM-v11-2501.patch --- ukui-control-center-4.10.0.0/debian/patches/0121-141-380937-2024-OEM-v11-2501.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0121-141-380937-2024-OEM-v11-2501.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,721 @@ +From: nil <zhoubin@kylinos.cn> +Date: Wed, 15 Jan 2025 06:43:14 +0000 +Subject: =?utf-8?b?ITE0MSAzODA5Mzcg5a2QIOOAkDIwMjTjgJHln7rnoYDnu4Tku7bnu4Q=?= + =?utf-8?b?5ZGo5L6L5Lya5b6F5YqeJuW5s+aXtuS7u+WKoSZPRU3kuLTml7bku7vliqEgLyA=?= + =?utf-8?b?44CQdjExLTI1MDHjgJHljZXlhYPmtYvor5Ug5o6n5Yi26Z2i5p2/IOW8gOWPkSBN?= + =?utf-8?b?ZXJnZSBwdWxsIHJlcXVlc3QgITE0MSBmcm9tIOiLj+WXo+WFuC9vcGVua3lsaW4v?= + =?utf-8?b?bmlsZS0xMTA3?= + +--- + registeredSession/main.cpp | 2 - + .../plugins/datetime/datetimeinterface.cpp | 3 +- + .../plugins/datetime/datetimeinterface.h | 2 +- + .../plugins/shortcut/shortcutinterface.cpp | 13 +-- + .../plugins/shortcut/shortcutinterface.h | 2 +- + registeredSession/plugins/shortcut/type.cpp | 51 -------- + registeredSession/plugins/shortcut/type.h | 10 -- + registeredSession/plugins/vino/vinointerface.cpp | 129 --------------------- + registeredSession/plugins/vino/vinointerface.h | 56 --------- + .../plugins/wallpaper/wallpaperinterface.cpp | 5 +- + registeredSession/plugins/wallpaper/xmlhandle.cpp | 51 -------- + registeredSession/plugins/wallpaper/xmlhandle.h | 1 - + registeredSession/registeredSession.pro | 3 - + tests/unit_test_datetime/unit_test_datetime.cpp | 22 ++++ + .../unit_test_screenlock/unit_test_screenlock.cpp | 10 ++ + tests/unit_test_shortcut/unit_test_shortcut.cpp | 11 +- + tests/unit_test_shortcut/unit_test_shortcut.pro | 4 - + tests/unit_test_wallpaper/unit_test_wallpaper.cpp | 44 ++++++- + 18 files changed, 85 insertions(+), 334 deletions(-) + delete mode 100644 registeredSession/plugins/shortcut/type.cpp + delete mode 100644 registeredSession/plugins/vino/vinointerface.cpp + delete mode 100644 registeredSession/plugins/vino/vinointerface.h + +diff --git a/registeredSession/main.cpp b/registeredSession/main.cpp +index b37e031..357580e 100644 +--- a/registeredSession/main.cpp ++++ b/registeredSession/main.cpp +@@ -18,7 +18,6 @@ + #include "plugins/screenlock/screenlockinterface.h" + #include "plugins/shortcut/shortcutinterface.h" + #include "plugins/screensaver/screensaverinterface.h" +-#include "plugins/vino/vinointerface.h" + + void registerPlugins(const QString &path, QObject *object, QDBusConnection &connection) { + if (!connection.registerObject(path, object, QDBusConnection::ExportAllSlots | +@@ -65,7 +64,6 @@ int main(int argc, char *argv[]) + plugins["/Screenlock"] = new ScreenlockInterface; + plugins["/Shortcut"] = new ShortcutInterface; + plugins["/Screensaver"] = new ScreensaverInterface; +- plugins["/Vino"] = new VinoInterface; + + for (std::map<QString, QObject*>::value_type plugin : plugins) + registerPlugins(plugin.first, plugin.second, sessionBus); +diff --git a/registeredSession/plugins/datetime/datetimeinterface.cpp b/registeredSession/plugins/datetime/datetimeinterface.cpp +index 02ad875..51234cc 100644 +--- a/registeredSession/plugins/datetime/datetimeinterface.cpp ++++ b/registeredSession/plugins/datetime/datetimeinterface.cpp +@@ -24,11 +24,12 @@ DatetimeInterface::~DatetimeInterface() + + } + +-void DatetimeInterface::timezoneChanged(QString key) ++bool DatetimeInterface::timezoneChanged(QString key) + { + if (key == "timezone") { + Q_EMIT changed("timezone"); + } ++ return true; + } + + QStringList DatetimeInterface::getTimezone() +diff --git a/registeredSession/plugins/datetime/datetimeinterface.h b/registeredSession/plugins/datetime/datetimeinterface.h +index a98c0c3..78bc727 100644 +--- a/registeredSession/plugins/datetime/datetimeinterface.h ++++ b/registeredSession/plugins/datetime/datetimeinterface.h +@@ -33,7 +33,7 @@ public Q_SLOTS: + QStringList timezoneName(QString timezone); + + private Q_SLOTS: +- void timezoneChanged(QString key); ++ bool timezoneChanged(QString key); + + private: + QDBusInterface *timeDateInterface = nullptr; +diff --git a/registeredSession/plugins/shortcut/shortcutinterface.cpp b/registeredSession/plugins/shortcut/shortcutinterface.cpp +index 8febb69..707fb04 100644 +--- a/registeredSession/plugins/shortcut/shortcutinterface.cpp ++++ b/registeredSession/plugins/shortcut/shortcutinterface.cpp +@@ -3,16 +3,6 @@ + + ShortcutInterface::ShortcutInterface() + { +- qRegisterMetaType<QStringPair>("QStringPair"); +- qDBusRegisterMetaType<QStringPair>(); +- qRegisterMetaType<QStringPairList>("QStringPairList"); +- qDBusRegisterMetaType<QStringPairList>(); +- +- qRegisterMetaType<KeyEntry>("KeyEntry"); +- qDBusRegisterMetaType<KeyEntry>(); +- qRegisterMetaType<KeyEntryList>("KeyEntryList"); +- qDBusRegisterMetaType<KeyEntryList>(); +- + getShortcutThread(); + } + +@@ -109,9 +99,10 @@ QList<QStringPair> ShortcutInterface::getCustomShortcut() + return customShortcutList; + } + +-void ShortcutInterface::updateShortcut() ++bool ShortcutInterface::updateShortcut() + { + getShortcutThread(); ++ return true; + } + + void ShortcutInterface::setSystemShortcut(const QString &key, const QString &value) +diff --git a/registeredSession/plugins/shortcut/shortcutinterface.h b/registeredSession/plugins/shortcut/shortcutinterface.h +index cb80cdc..2946ff8 100644 +--- a/registeredSession/plugins/shortcut/shortcutinterface.h ++++ b/registeredSession/plugins/shortcut/shortcutinterface.h +@@ -24,7 +24,7 @@ public Q_SLOTS: + QList<KeyEntry> getSystemShortcutEntry(); + QList<KeyEntry> getCustomShortcutEntry(); + +- void updateShortcut(); ++ bool updateShortcut(); + void setSystemShortcut(const QString &key, const QString &value); + + private: +diff --git a/registeredSession/plugins/shortcut/type.cpp b/registeredSession/plugins/shortcut/type.cpp +deleted file mode 100644 +index d05fb35..0000000 +--- a/registeredSession/plugins/shortcut/type.cpp ++++ /dev/null +@@ -1,51 +0,0 @@ +-#include "type.h" +- +-const QDBusArgument &operator<<(QDBusArgument &argument, const QStringPair &string) +-{ +- argument.beginStructure(); +- argument << string.name; +- argument << string.key; +- argument << string.mediakey; +- argument.endStructure(); +- return argument; +-} +- +-const QDBusArgument &operator>>(const QDBusArgument &argument, QStringPair &string) +-{ +- argument.beginStructure(); +- argument >> string.name; +- argument >> string.key; +- argument >> string.mediakey; +- argument.endStructure(); +- return argument; +-} +- +-const QDBusArgument &operator<<(QDBusArgument &argument, const KeyEntry &key) +-{ +- argument.beginStructure(); +- argument << key.gsSchema; +- argument << key.keyStr; +- argument << key.valueStr; +- argument << key.descStr; +- argument << key.gsPath; +- argument << key.nameStr; +- argument << key.bindingStr; +- argument << key.actionStr; +- argument.endStructure(); +- return argument; +-} +- +-const QDBusArgument &operator>>(const QDBusArgument &argument, KeyEntry &key) +-{ +- argument.beginStructure(); +- argument >> key.gsSchema; +- argument >> key.keyStr; +- argument >> key.valueStr; +- argument >> key.descStr; +- argument >> key.gsPath; +- argument >> key.nameStr; +- argument >> key.bindingStr; +- argument >> key.actionStr; +- argument.endStructure(); +- return argument; +-} +diff --git a/registeredSession/plugins/shortcut/type.h b/registeredSession/plugins/shortcut/type.h +index 814668a..00aa7a3 100644 +--- a/registeredSession/plugins/shortcut/type.h ++++ b/registeredSession/plugins/shortcut/type.h +@@ -1,9 +1,6 @@ + #ifndef TYPE_H + #define TYPE_H + +-#include <QDBusArgument> +-#include <QDBusMetaType> +- + typedef struct _KeyEntry { + QString gsSchema; + QString keyStr; +@@ -14,9 +11,6 @@ typedef struct _KeyEntry { + QString bindingStr; + QString actionStr; + }KeyEntry; +-const QDBusArgument &operator<<(QDBusArgument &argument, const KeyEntry &key); +-const QDBusArgument &operator>>(const QDBusArgument &argument, KeyEntry &key); +-Q_DECLARE_METATYPE(KeyEntry) + + typedef struct + { +@@ -25,10 +19,6 @@ typedef struct + QString mediakey; + }QStringPair; + +-const QDBusArgument &operator<<(QDBusArgument &argument, const QStringPair &string); +-const QDBusArgument &operator>>(const QDBusArgument &argument, QStringPair &string); +-Q_DECLARE_METATYPE(QStringPair) +- + typedef QList<KeyEntry> KeyEntryList; + typedef QList<QStringPair> QStringPairList; + +diff --git a/registeredSession/plugins/vino/vinointerface.cpp b/registeredSession/plugins/vino/vinointerface.cpp +deleted file mode 100644 +index da94c11..0000000 +--- a/registeredSession/plugins/vino/vinointerface.cpp ++++ /dev/null +@@ -1,129 +0,0 @@ +-#include "vinointerface.h" +-#include <QDebug> +-#include <QProcess> +- +-VinoInterface::VinoInterface() +-{ +- mVinoGsettings = UniversalInterface::self()->gnomeVinoGsettings(); +- mUkuiVinoGsettings = UniversalInterface::self()->ukuiVinoGsettings(); +- +- mGsettingMap[kVinoViewOnlyKey] = QString("viewOnly"); +- mGsettingMap[kVinoPromptKey] = QString("promptEnabled"); +- mGsettingMap[kAuthenticationKey] = QString("authenticationMethods"); +- mGsettingMap[kVncPwdKey] = QString("vncPassword"); +- mGsettingMap[kVinoEnableKey] = QString("vinoEnabled"); +- mGsettingMap[kXrdpEnableKey] = QString("xrdpEnabled"); +- mGsettingMap[kEnableKey] = QString("enabled"); +-} +- +-bool VinoInterface::getViewOnly() +-{ +- if (mVinoGsettings->keys().contains("viewOnly")) { +- return mVinoGsettings->get(kVinoViewOnlyKey).toBool(); +- } else { +- qCritical() << "mVinoGsettings not contains the key: " << kVinoViewOnlyKey; +- } +- return false; +-} +- +-bool VinoInterface::getPromptEnabled() +-{ +- if (mVinoGsettings->keys().contains("promptEnabled")) { +- return mVinoGsettings->get(kVinoPromptKey).toBool(); +- } else { +- qCritical() << "mVinoGsettings not contains the key: " << kVinoPromptKey; +- } +- return false; +-} +- +-QString VinoInterface::getMethod() +-{ +- if (mVinoGsettings->keys().contains("authenticationMethods")) { +- return mVinoGsettings->get(kAuthenticationKey).toString(); +- } else { +- qCritical() << "mVinoGsettings not contains the key: " << kAuthenticationKey; +- } +- return QString(); +-} +- +-QString VinoInterface::getPassword() +-{ +- if (mVinoGsettings->keys().contains("vncPassword")) { +- return mVinoGsettings->get(kVncPwdKey).toString(); +- } else { +- qCritical() << "mVinoGsettings not contains the key: " << kVncPwdKey; +- } +- return QString(); +-} +- +-bool VinoInterface::getVinoServerStatus() +-{ +- QProcess process; +- process.start("systemctl", QStringList() << "--user" << "is-active" << "vino-server.service"); +- process.waitForFinished(); +- bool isActive = process.readAllStandardOutput().replace("\n", "") == "active"; +- return isActive; +-} +- +-bool VinoInterface::getVinoStatus() +-{ +- if (mUkuiVinoGsettings->keys().contains("vinoEnabled")) { +- return mUkuiVinoGsettings->get(kVinoEnableKey).toBool(); +- } else { +- qCritical() << "mUkuiVinoGsettings not contains the key: " << kVinoEnableKey; +- } +- return false; +-} +- +-bool VinoInterface::getXrdpStatus() +-{ +- if (mUkuiVinoGsettings->keys().contains("xrdpEnabled")) { +- return mUkuiVinoGsettings->get(kXrdpEnableKey).toBool(); +- } else { +- qCritical() << "mUkuiVinoGsettings not contains the key: " << kXrdpEnableKey; +- } +- return false; +-} +- +-bool VinoInterface::getEnableStatus() +-{ +- if (mUkuiVinoGsettings->keys().contains("enabled")) { +- return mUkuiVinoGsettings->get(kEnableKey).toBool(); +- } else { +- qCritical() << "mUkuiVinoGsettings not contains the key: " << kEnableKey; +- } +- return false; +-} +- +-void VinoInterface::setVinoKey(const QString &key, bool value) +-{ +- if (mVinoGsettings->keys().contains(mGsettingMap[key])) { +- return mVinoGsettings->set(key, value); +- } else { +- qCritical() << "mVinoGsettings not contains the key: " << key; +- } +- +- if (mUkuiVinoGsettings->keys().contains(mGsettingMap[key])) { +- return mUkuiVinoGsettings->set(key, value); +- } else { +- qCritical() << "mUkuiVinoGsettings not contains the key: " << key; +- } +-} +- +-void VinoInterface::setVinoKey(const QString &key, QString value) +-{ +- if (mVinoGsettings->keys().contains(mGsettingMap[key])) { +- return mVinoGsettings->set(key, value); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << key; +- } +-} +- +-void VinoInterface::setVinoKey(const QString &key, QByteArray value) +-{ +- if (mVinoGsettings->keys().contains(mGsettingMap[key])) { +- return mVinoGsettings->set(key, value); +- } else { +- qCritical() << "ukuiNoticeGsettings not contains the key: " << key; +- } +-} +diff --git a/registeredSession/plugins/vino/vinointerface.h b/registeredSession/plugins/vino/vinointerface.h +deleted file mode 100644 +index 2691edb..0000000 +--- a/registeredSession/plugins/vino/vinointerface.h ++++ /dev/null +@@ -1,56 +0,0 @@ +-#ifndef VINOINTERFACE_H +-#define VINOINTERFACE_H +- +-#include <QObject> +-#include <QDBusArgument> +-#include <QVariant> +-#include <QDBusMetaType> +-#include <QGSettings> +-#include "../../universalinterface.h" +- +-class VinoInterface : public QObject +-{ +- Q_OBJECT +- Q_CLASSINFO("D-Bus Interface", "org.ukui.ukcc.session.Vino") +- Q_PROPERTY(bool isViewOnly READ getViewOnly) +- Q_PROPERTY(bool isPrompt READ getPromptEnabled) +- Q_PROPERTY(QString method READ getMethod) +- Q_PROPERTY(QString password READ getPassword) +- Q_PROPERTY(bool isActive READ getVinoServerStatus) +- Q_PROPERTY(bool isVino READ getVinoStatus) +- Q_PROPERTY(bool isXrdp READ getXrdpStatus) +- Q_PROPERTY(bool isEnable READ getEnableStatus) +- +-public: +- VinoInterface(); +- +-protected: +- bool getViewOnly(); +- bool getPromptEnabled(); +- QString getMethod(); +- QString getPassword(); +- bool getVinoServerStatus(); +- bool getVinoStatus(); +- bool getXrdpStatus(); +- bool getEnableStatus(); +- +-public Q_SLOTS: +- void setVinoKey(const QString &key, bool value); +- void setVinoKey(const QString &key, QString value); +- void setVinoKey(const QString &key, QByteArray value); +- +-private: +- const QString kEnableKey = "enabled"; +- const QString kXrdpEnableKey = "xrdp-enabled"; +- const QString kVinoEnableKey = "vino-enabled"; +- const QString kVinoViewOnlyKey = "view-only"; +- const QString kVinoPromptKey = "prompt-enabled"; +- const QString kAuthenticationKey = "authentication-methods"; +- const QString kVncPwdKey = "vnc-password"; +- +- QGSettings *mVinoGsettings = nullptr; +- QGSettings *mUkuiVinoGsettings = nullptr; +- QMap <QString, QString> mGsettingMap; +-}; +- +-#endif // VINOINTERFACE_H +diff --git a/registeredSession/plugins/wallpaper/wallpaperinterface.cpp b/registeredSession/plugins/wallpaper/wallpaperinterface.cpp +index 1ca44fd..aaf3eba 100644 +--- a/registeredSession/plugins/wallpaper/wallpaperinterface.cpp ++++ b/registeredSession/plugins/wallpaper/wallpaperinterface.cpp +@@ -3,12 +3,12 @@ + WallpaperInterface::WallpaperInterface() + { + WorkerObject *workThread = new WorkerObject(this); ++ workThread->start(); + connect(workThread, &WorkerObject::wallpaperReaded, this, [=](QStringList previewFiles, QStringList sourceFiles) { + previewWallpaperList = previewFiles; + sourceWallpaperList = sourceFiles; + }); +- workThread->start(); +- ++ connect(workThread, &QThread::finished, workThread, &QThread::deleteLater); + mWallpaperMode.clear(); + QString filename = UniversalInterface::self()->mateBackgroundGsettings()->get("picture-filename").toString(); + if (filename.isEmpty()) { +@@ -54,6 +54,7 @@ WallpaperInterface::WallpaperInterface() + Q_EMIT changed("wallpaper"); + } + }); ++ workThread->wait(); + } + + WallpaperInterface::~WallpaperInterface() +diff --git a/registeredSession/plugins/wallpaper/xmlhandle.cpp b/registeredSession/plugins/wallpaper/xmlhandle.cpp +index 34ffea9..8654355 100644 +--- a/registeredSession/plugins/wallpaper/xmlhandle.cpp ++++ b/registeredSession/plugins/wallpaper/xmlhandle.cpp +@@ -245,54 +245,3 @@ void XmlHandle::_xmlGenerate(){ + + file.close(); + } +- +-void XmlHandle::xmlUpdate(QMap<QString, QMap<QString, QString> > wallpaperinfosMap){ +- QFile file(localconf); +- if (!file.open(QFile::WriteOnly | QFile::Text)){ +- qDebug() << "Error Open XML File When Update Local Xml: " << file.errorString(); +- return; +- } +- +- if (0 == wallpaperinfosMap.count()){ +- qDebug() << "Error QMap Empty"; +- return; +- } +- +- QMap<QString, QString> currentheadMap; +- currentheadMap = wallpaperinfosMap.find("head").value(); +- +- QXmlStreamWriter writer; +- writer.setDevice(&file); +- writer.setAutoFormatting(true); //自动格式化 +-// writer.setCodec(headMap.find("encoding")); +- writer.writeStartDocument(QString(currentheadMap.find("version").value()), false); +- +- //DTD +- writer.writeDTD(QString::fromLocal8Bit("<!DOCTYPE %1 SYSTEM \"%2\">").arg(currentheadMap.find("doctype").value()).arg(currentheadMap.find("system").value())); +- +- //BODY +- writer.writeStartElement("wallpapers"); +- QMap<QString, QMap<QString, QString> >::iterator its = wallpaperinfosMap.begin(); +- for (; its != wallpaperinfosMap.end(); its++){ +- if (QString(its.key()) == "head") +- continue; +- +- QMap<QString, QString> sourceMap = (QMap<QString, QString>)its.value(); +- QMap<QString, QString>::iterator it = sourceMap.begin(); +- +- writer.writeStartElement("wallpaper"); +- writer.writeAttribute("deleted", QString(sourceMap.find("deleted").value())); +- +- for(; it != sourceMap.end(); it++){ +- if (it.key() == "deleted") +- continue; +- writer.writeTextElement(QString(it.key()), QString(it.value())); +- } +- +- writer.writeEndElement(); +- } +- writer.writeEndElement(); +- writer.writeEndDocument(); +- +- file.close(); +-} +diff --git a/registeredSession/plugins/wallpaper/xmlhandle.h b/registeredSession/plugins/wallpaper/xmlhandle.h +index 97f4a76..77ac8cf 100644 +--- a/registeredSession/plugins/wallpaper/xmlhandle.h ++++ b/registeredSession/plugins/wallpaper/xmlhandle.h +@@ -38,7 +38,6 @@ public: + public: + void init(); + void xmlreader(QString filename); +- void xmlUpdate(QMap<QString, QMap<QString, QString>> wallpaperinfosMap); + QMap<QString, QMap<QString, QString> > requireXmlData(); + + public: +diff --git a/registeredSession/registeredSession.pro b/registeredSession/registeredSession.pro +index 9189016..b1420dd 100644 +--- a/registeredSession/registeredSession.pro ++++ b/registeredSession/registeredSession.pro +@@ -52,8 +52,6 @@ SOURCES += \ + plugins/screensaver/screensaverinterface.cpp \ + plugins/shortcut/getshortcutworker.cpp \ + plugins/shortcut/shortcutinterface.cpp \ +- plugins/shortcut/type.cpp \ +- plugins/vino/vinointerface.cpp \ + plugins/wallpaper/wallpaperinterface.cpp \ + plugins/wallpaper/workerobject.cpp \ + plugins/wallpaper/xmlhandle.cpp \ +@@ -78,7 +76,6 @@ HEADERS += \ + plugins/shortcut/getshortcutworker.h \ + plugins/shortcut/shortcutinterface.h \ + plugins/shortcut/type.h \ +- plugins/vino/vinointerface.h \ + plugins/wallpaper/wallpaperinterface.h \ + plugins/wallpaper/workerobject.h \ + plugins/wallpaper/xmlhandle.h \ +diff --git a/tests/unit_test_datetime/unit_test_datetime.cpp b/tests/unit_test_datetime/unit_test_datetime.cpp +index 32ae84a..c326b3a 100644 +--- a/tests/unit_test_datetime/unit_test_datetime.cpp ++++ b/tests/unit_test_datetime/unit_test_datetime.cpp +@@ -94,3 +94,25 @@ TEST_F(DatetimeInterfaceTest, getNtpServers) + QStringList ret = m_pDatetimeInterface->getNtpServers(); + ASSERT_STREQ(ret.at(0).toStdString().c_str(), "pool.ntp.org"); + } ++ ++TEST_F(DatetimeInterfaceTest, timezoneChanged) ++{ ++ bool ret = m_pDatetimeInterface->timezoneChanged("timezone"); ++ ASSERT_EQ(ret, true); ++} ++ ++TEST_F(DatetimeInterfaceTest, getTimeMode) ++{ ++ QString ret = m_pDatetimeInterface->getTimeMode(); ++ if (ret == "automatic") { ++ ASSERT_STREQ(ret.toStdString().c_str(), "automatic"); ++ } else { ++ ASSERT_STREQ(ret.toStdString().c_str(), "manual"); ++ } ++} ++ ++TEST_F(DatetimeInterfaceTest, getNtpServer) ++{ ++ QString ret = m_pDatetimeInterface->getNtpServer(); ++ ASSERT_GE(ret.size(), 0); ++} +diff --git a/tests/unit_test_screenlock/unit_test_screenlock.cpp b/tests/unit_test_screenlock/unit_test_screenlock.cpp +index c2bcee4..58f9314 100644 +--- a/tests/unit_test_screenlock/unit_test_screenlock.cpp ++++ b/tests/unit_test_screenlock/unit_test_screenlock.cpp +@@ -32,6 +32,10 @@ protected: + + static void TearDownTestSuite() + { ++ if (m_pScreenlockInterface) { ++ delete m_pScreenlockInterface; ++ m_pScreenlockInterface = nullptr; ++ } + } + + static ScreenlockInterface *m_pScreenlockInterface; +@@ -80,3 +84,9 @@ TEST_F(ScreenlockInterfaceTest, getSourceWallpapers) + int size = m_pScreenlockInterface->getSourceWallpapers().size(); + ASSERT_GE(size, 0); + } ++ ++TEST_F(ScreenlockInterfaceTest, getWallpaper) ++{ ++ int size = m_pScreenlockInterface->getWallpaper().size(); ++ ASSERT_GE(size, 0); ++} +diff --git a/tests/unit_test_shortcut/unit_test_shortcut.cpp b/tests/unit_test_shortcut/unit_test_shortcut.cpp +index 4c38573..8315ff2 100644 +--- a/tests/unit_test_shortcut/unit_test_shortcut.cpp ++++ b/tests/unit_test_shortcut/unit_test_shortcut.cpp +@@ -20,7 +20,6 @@ + #include <gtest/gtest.h> + #include <gtest/gtest-death-test.h> + #include "../../registeredSession/plugins/shortcut/shortcutinterface.h" +-#include "../../registeredSession/plugins/shortcut/type.h" + + class ShortcutInterfaceTest : public testing::Test + { +@@ -33,10 +32,6 @@ protected: + + static void TearDownTestSuite() + { +- if (m_pShortcutInterface) { +- delete m_pShortcutInterface; +- m_pShortcutInterface = nullptr; +- } + } + + static ShortcutInterface *m_pShortcutInterface; +@@ -76,6 +71,12 @@ TEST_F(ShortcutInterfaceTest, getShowShortcutString) + ASSERT_GE(newShortKey.toStdString().c_str(), "Win+A"); + } + ++TEST_F(ShortcutInterfaceTest, updateShortcut) ++{ ++ bool ret = m_pShortcutInterface->updateShortcut(); ++ ASSERT_EQ(ret, true); ++} ++ + TEST_F(ShortcutInterfaceTest, setSystemShortcut) + { + QGSettings generalShort("org.ukui.SettingsDaemon.plugins.media-keys"); +diff --git a/tests/unit_test_shortcut/unit_test_shortcut.pro b/tests/unit_test_shortcut/unit_test_shortcut.pro +index 23bee08..7e0df90 100644 +--- a/tests/unit_test_shortcut/unit_test_shortcut.pro ++++ b/tests/unit_test_shortcut/unit_test_shortcut.pro +@@ -38,13 +38,9 @@ INCLUDEPATH += $$PROJECT_ROOTDIR \ + + SOURCES += ../../registeredSession/plugins/shortcut/shortcutinterface.cpp \ + ../../registeredSession/plugins/shortcut/getshortcutworker.cpp \ +- ../../registeredSession/plugins/shortcut/type.cpp \ +- ../../registeredSession/universalinterface.cpp \ + unit_test_shortcut.cpp \ + main.cpp + + HEADERS += ../../registeredSession/plugins/shortcut/shortcutinterface.h \ + ../../registeredSession/plugins/shortcut/getshortcutworker.h \ + ../../registeredSession/plugins/shortcut/type.h \ +- ../../registeredSession/universalinterface.h +- +diff --git a/tests/unit_test_wallpaper/unit_test_wallpaper.cpp b/tests/unit_test_wallpaper/unit_test_wallpaper.cpp +index b450cd6..142e008 100644 +--- a/tests/unit_test_wallpaper/unit_test_wallpaper.cpp ++++ b/tests/unit_test_wallpaper/unit_test_wallpaper.cpp +@@ -32,6 +32,10 @@ protected: + + static void TearDownTestSuite() + { ++ if (m_pWallpaperInterface) { ++ delete m_pWallpaperInterface; ++ m_pWallpaperInterface = nullptr; ++ } + } + + static WallpaperInterface* m_pWallpaperInterface; +@@ -43,6 +47,7 @@ TEST_F(WallpaperInterfaceTest, getWallpaperMode) + { + QGSettings gset("org.mate.background"); + QString oldValue = gset.get("picture-filename").toString(); ++ m_pWallpaperInterface->getWallpaper(); + std::string curValue = m_pWallpaperInterface->getWallpaperMode().toStdString(); + if (oldValue.isEmpty()) { + ASSERT_STREQ(curValue.c_str(), "color"); +@@ -51,18 +56,45 @@ TEST_F(WallpaperInterfaceTest, getWallpaperMode) + } + } + +-TEST_F(WallpaperInterfaceTest, setWallpaper) ++TEST_F(WallpaperInterfaceTest, setWallpaperPicture) + { + QGSettings gset("org.mate.background"); + QString oldValue = gset.get("picture-filename").toString(); ++ QString mode = "picture"; ++ QString colorData = ""; ++ if (oldValue.isEmpty()) { ++ mode = "color"; ++ colorData = gset.get("primary-color").toString(); ++ } + std::string wallpaperMode = m_pWallpaperInterface->getWallpaperMode().toStdString(); +- if (!oldValue.isEmpty()) { +- m_pWallpaperInterface->setWallpaper("picture", "/usr/share/backgrounds/city.jpg"); +- std::string newValue = gset.get("picture-filename").toString().toStdString(); +- ASSERT_STREQ(newValue.c_str(), "/usr/share/backgrounds/city.jpg"); ++ m_pWallpaperInterface->setWallpaper("picture", "/usr/share/backgrounds/city.jpg"); ++ std::string newValue = gset.get("picture-filename").toString().toStdString(); ++ ASSERT_STREQ(newValue.c_str(), "/usr/share/backgrounds/city.jpg"); ++ if (mode == "color") { ++ m_pWallpaperInterface->setWallpaper("color", colorData.toStdString().c_str()); ++ } else { + m_pWallpaperInterface->setWallpaper("picture", oldValue.toStdString().c_str()); ++ } ++} ++ ++TEST_F(WallpaperInterfaceTest, setWallpaperColor) ++{ ++ QGSettings gset("org.mate.background"); ++ QString oldValue = gset.get("picture-filename").toString(); ++ QString mode = "picture"; ++ QString colorData = ""; ++ if (oldValue.isEmpty()) { ++ mode = "color"; ++ colorData = gset.get("primary-color").toString(); ++ } ++ std::string wallpaperMode = m_pWallpaperInterface->getWallpaperMode().toStdString(); ++ m_pWallpaperInterface->setWallpaper("color", "#2d7d9a"); ++ std::string newValue = gset.get("primary-color").toString().toStdString(); ++ ASSERT_STREQ(newValue.c_str(), "#2d7d9a"); ++ if (mode == "color") { ++ m_pWallpaperInterface->setWallpaper("color", colorData.toStdString().c_str()); + } else { +- ASSERT_STREQ(wallpaperMode.c_str(), "color"); ++ m_pWallpaperInterface->setWallpaper("picture", oldValue.toStdString().c_str()); + } + } + diff -Nru ukui-control-center-4.10.0.0/debian/patches/0122-142-vino.patch ukui-control-center-4.10.0.0/debian/patches/0122-142-vino.patch --- ukui-control-center-4.10.0.0/debian/patches/0122-142-vino.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0122-142-vino.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,251 @@ +From: nil <zhoubin@kylinos.cn> +Date: Wed, 15 Jan 2025 09:11:00 +0000 +Subject: =?utf-8?b?ITE0MiDmm7TmlrB2aW5vIE1lcmdlIHB1bGwgcmVxdWVzdCAhMTQyIGZy?= + =?utf-8?b?b20g6IuP5Zej5YW4L29wZW5reWxpbi9uaWxlLTExMDc=?= + +--- + registeredSession/main.cpp | 2 + + registeredSession/plugins/vino/vinointerface.cpp | 129 +++++++++++++++++++++++ + registeredSession/plugins/vino/vinointerface.h | 56 ++++++++++ + registeredSession/registeredSession.pro | 2 + + 4 files changed, 189 insertions(+) + create mode 100644 registeredSession/plugins/vino/vinointerface.cpp + create mode 100644 registeredSession/plugins/vino/vinointerface.h + +diff --git a/registeredSession/main.cpp b/registeredSession/main.cpp +index 357580e..68f458a 100644 +--- a/registeredSession/main.cpp ++++ b/registeredSession/main.cpp +@@ -9,6 +9,7 @@ + + #include "plugins/keyboard/keyboardinterface.h" + #include "plugins/mouse/mouseinterface.h" ++#include "plugins/vino/vinointerface.h" + #include "plugins/area/areainterface.h" + #include "plugins/default/defaultinterface.h" + #include "plugins/autoboot/autostartinterface.h" +@@ -64,6 +65,7 @@ int main(int argc, char *argv[]) + plugins["/Screenlock"] = new ScreenlockInterface; + plugins["/Shortcut"] = new ShortcutInterface; + plugins["/Screensaver"] = new ScreensaverInterface; ++ plugins["/Vino"] = new VinoInterface; + + for (std::map<QString, QObject*>::value_type plugin : plugins) + registerPlugins(plugin.first, plugin.second, sessionBus); +diff --git a/registeredSession/plugins/vino/vinointerface.cpp b/registeredSession/plugins/vino/vinointerface.cpp +new file mode 100644 +index 0000000..da94c11 +--- /dev/null ++++ b/registeredSession/plugins/vino/vinointerface.cpp +@@ -0,0 +1,129 @@ ++#include "vinointerface.h" ++#include <QDebug> ++#include <QProcess> ++ ++VinoInterface::VinoInterface() ++{ ++ mVinoGsettings = UniversalInterface::self()->gnomeVinoGsettings(); ++ mUkuiVinoGsettings = UniversalInterface::self()->ukuiVinoGsettings(); ++ ++ mGsettingMap[kVinoViewOnlyKey] = QString("viewOnly"); ++ mGsettingMap[kVinoPromptKey] = QString("promptEnabled"); ++ mGsettingMap[kAuthenticationKey] = QString("authenticationMethods"); ++ mGsettingMap[kVncPwdKey] = QString("vncPassword"); ++ mGsettingMap[kVinoEnableKey] = QString("vinoEnabled"); ++ mGsettingMap[kXrdpEnableKey] = QString("xrdpEnabled"); ++ mGsettingMap[kEnableKey] = QString("enabled"); ++} ++ ++bool VinoInterface::getViewOnly() ++{ ++ if (mVinoGsettings->keys().contains("viewOnly")) { ++ return mVinoGsettings->get(kVinoViewOnlyKey).toBool(); ++ } else { ++ qCritical() << "mVinoGsettings not contains the key: " << kVinoViewOnlyKey; ++ } ++ return false; ++} ++ ++bool VinoInterface::getPromptEnabled() ++{ ++ if (mVinoGsettings->keys().contains("promptEnabled")) { ++ return mVinoGsettings->get(kVinoPromptKey).toBool(); ++ } else { ++ qCritical() << "mVinoGsettings not contains the key: " << kVinoPromptKey; ++ } ++ return false; ++} ++ ++QString VinoInterface::getMethod() ++{ ++ if (mVinoGsettings->keys().contains("authenticationMethods")) { ++ return mVinoGsettings->get(kAuthenticationKey).toString(); ++ } else { ++ qCritical() << "mVinoGsettings not contains the key: " << kAuthenticationKey; ++ } ++ return QString(); ++} ++ ++QString VinoInterface::getPassword() ++{ ++ if (mVinoGsettings->keys().contains("vncPassword")) { ++ return mVinoGsettings->get(kVncPwdKey).toString(); ++ } else { ++ qCritical() << "mVinoGsettings not contains the key: " << kVncPwdKey; ++ } ++ return QString(); ++} ++ ++bool VinoInterface::getVinoServerStatus() ++{ ++ QProcess process; ++ process.start("systemctl", QStringList() << "--user" << "is-active" << "vino-server.service"); ++ process.waitForFinished(); ++ bool isActive = process.readAllStandardOutput().replace("\n", "") == "active"; ++ return isActive; ++} ++ ++bool VinoInterface::getVinoStatus() ++{ ++ if (mUkuiVinoGsettings->keys().contains("vinoEnabled")) { ++ return mUkuiVinoGsettings->get(kVinoEnableKey).toBool(); ++ } else { ++ qCritical() << "mUkuiVinoGsettings not contains the key: " << kVinoEnableKey; ++ } ++ return false; ++} ++ ++bool VinoInterface::getXrdpStatus() ++{ ++ if (mUkuiVinoGsettings->keys().contains("xrdpEnabled")) { ++ return mUkuiVinoGsettings->get(kXrdpEnableKey).toBool(); ++ } else { ++ qCritical() << "mUkuiVinoGsettings not contains the key: " << kXrdpEnableKey; ++ } ++ return false; ++} ++ ++bool VinoInterface::getEnableStatus() ++{ ++ if (mUkuiVinoGsettings->keys().contains("enabled")) { ++ return mUkuiVinoGsettings->get(kEnableKey).toBool(); ++ } else { ++ qCritical() << "mUkuiVinoGsettings not contains the key: " << kEnableKey; ++ } ++ return false; ++} ++ ++void VinoInterface::setVinoKey(const QString &key, bool value) ++{ ++ if (mVinoGsettings->keys().contains(mGsettingMap[key])) { ++ return mVinoGsettings->set(key, value); ++ } else { ++ qCritical() << "mVinoGsettings not contains the key: " << key; ++ } ++ ++ if (mUkuiVinoGsettings->keys().contains(mGsettingMap[key])) { ++ return mUkuiVinoGsettings->set(key, value); ++ } else { ++ qCritical() << "mUkuiVinoGsettings not contains the key: " << key; ++ } ++} ++ ++void VinoInterface::setVinoKey(const QString &key, QString value) ++{ ++ if (mVinoGsettings->keys().contains(mGsettingMap[key])) { ++ return mVinoGsettings->set(key, value); ++ } else { ++ qCritical() << "ukuiNoticeGsettings not contains the key: " << key; ++ } ++} ++ ++void VinoInterface::setVinoKey(const QString &key, QByteArray value) ++{ ++ if (mVinoGsettings->keys().contains(mGsettingMap[key])) { ++ return mVinoGsettings->set(key, value); ++ } else { ++ qCritical() << "ukuiNoticeGsettings not contains the key: " << key; ++ } ++} +diff --git a/registeredSession/plugins/vino/vinointerface.h b/registeredSession/plugins/vino/vinointerface.h +new file mode 100644 +index 0000000..2691edb +--- /dev/null ++++ b/registeredSession/plugins/vino/vinointerface.h +@@ -0,0 +1,56 @@ ++#ifndef VINOINTERFACE_H ++#define VINOINTERFACE_H ++ ++#include <QObject> ++#include <QDBusArgument> ++#include <QVariant> ++#include <QDBusMetaType> ++#include <QGSettings> ++#include "../../universalinterface.h" ++ ++class VinoInterface : public QObject ++{ ++ Q_OBJECT ++ Q_CLASSINFO("D-Bus Interface", "org.ukui.ukcc.session.Vino") ++ Q_PROPERTY(bool isViewOnly READ getViewOnly) ++ Q_PROPERTY(bool isPrompt READ getPromptEnabled) ++ Q_PROPERTY(QString method READ getMethod) ++ Q_PROPERTY(QString password READ getPassword) ++ Q_PROPERTY(bool isActive READ getVinoServerStatus) ++ Q_PROPERTY(bool isVino READ getVinoStatus) ++ Q_PROPERTY(bool isXrdp READ getXrdpStatus) ++ Q_PROPERTY(bool isEnable READ getEnableStatus) ++ ++public: ++ VinoInterface(); ++ ++protected: ++ bool getViewOnly(); ++ bool getPromptEnabled(); ++ QString getMethod(); ++ QString getPassword(); ++ bool getVinoServerStatus(); ++ bool getVinoStatus(); ++ bool getXrdpStatus(); ++ bool getEnableStatus(); ++ ++public Q_SLOTS: ++ void setVinoKey(const QString &key, bool value); ++ void setVinoKey(const QString &key, QString value); ++ void setVinoKey(const QString &key, QByteArray value); ++ ++private: ++ const QString kEnableKey = "enabled"; ++ const QString kXrdpEnableKey = "xrdp-enabled"; ++ const QString kVinoEnableKey = "vino-enabled"; ++ const QString kVinoViewOnlyKey = "view-only"; ++ const QString kVinoPromptKey = "prompt-enabled"; ++ const QString kAuthenticationKey = "authentication-methods"; ++ const QString kVncPwdKey = "vnc-password"; ++ ++ QGSettings *mVinoGsettings = nullptr; ++ QGSettings *mUkuiVinoGsettings = nullptr; ++ QMap <QString, QString> mGsettingMap; ++}; ++ ++#endif // VINOINTERFACE_H +diff --git a/registeredSession/registeredSession.pro b/registeredSession/registeredSession.pro +index b1420dd..a2e7b05 100644 +--- a/registeredSession/registeredSession.pro ++++ b/registeredSession/registeredSession.pro +@@ -53,6 +53,7 @@ SOURCES += \ + plugins/shortcut/getshortcutworker.cpp \ + plugins/shortcut/shortcutinterface.cpp \ + plugins/wallpaper/wallpaperinterface.cpp \ ++ plugins/vino/vinointerface.cpp \ + plugins/wallpaper/workerobject.cpp \ + plugins/wallpaper/xmlhandle.cpp \ + ukccsessionserver.cpp \ +@@ -77,6 +78,7 @@ HEADERS += \ + plugins/shortcut/shortcutinterface.h \ + plugins/shortcut/type.h \ + plugins/wallpaper/wallpaperinterface.h \ ++ plugins/vino/vinointerface.h \ + plugins/wallpaper/workerobject.h \ + plugins/wallpaper/xmlhandle.h \ + screenStruct.h \ diff -Nru ukui-control-center-4.10.0.0/debian/patches/0123-143-380927-v11-2501.patch ukui-control-center-4.10.0.0/debian/patches/0123-143-380927-v11-2501.patch --- ukui-control-center-4.10.0.0/debian/patches/0123-143-380927-v11-2501.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0123-143-380927-v11-2501.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,529 @@ +From: nil <zhoubin@kylinos.cn> +Date: Mon, 20 Jan 2025 08:10:02 +0000 +Subject: =?utf-8?b?ITE0MyAzODA5MjfjgJB2MTEtMjUwMeOAkeWNleWFg+a1i+ivlSDmjqc=?= + =?utf-8?b?5Yi26Z2i5p2/IE1lcmdlIHB1bGwgcmVxdWVzdCAhMTQzIGZyb20g5L2V5oCd6IOc?= + =?utf-8?b?L25pbGU=?= + +--- + plugins/devices/mouse/mouse.cpp | 4 +- + registeredSession/plugins/mouse/mouseinterface.cpp | 9 + + registeredSession/plugins/mouse/mouseinterface.h | 2 +- + registeredSession/plugins/vino/vinointerface.cpp | 22 +- + registeredSession/plugins/vino/vinointerface.h | 15 +- + tests/tests.pro | 1 + + tests/unit_test_vino/main.cpp | 8 + + tests/unit_test_vino/unit_test_vino.cpp | 244 +++++++++++++++++++++ + tests/unit_test_vino/unit_test_vino.pro | 40 ++++ + 9 files changed, 323 insertions(+), 22 deletions(-) + create mode 100644 tests/unit_test_vino/main.cpp + create mode 100644 tests/unit_test_vino/unit_test_vino.cpp + create mode 100644 tests/unit_test_vino/unit_test_vino.pro + +diff --git a/plugins/devices/mouse/mouse.cpp b/plugins/devices/mouse/mouse.cpp +index 1983540..63811b3 100644 +--- a/plugins/devices/mouse/mouse.cpp ++++ b/plugins/devices/mouse/mouse.cpp +@@ -320,10 +320,10 @@ void Mouse::blinkCursorOnTextSlot(bool checked) + mouseDbus->call("setCursorBlink", checked); + + if (!checked) { +- mouseDbus->call("setCursorSpeed", 0); ++ mouseDbus->call("setStyleCursorSpeed", 0); + } else { + int mValue = mouseWidget->cursorSpeedWidget()->slider()->maximum() - mouseWidget->cursorSpeedWidget()->slider()->value() + mouseWidget->cursorSpeedWidget()->slider()->minimum(); +- mouseDbus->call("setCursorSpeed", mValue); ++ mouseDbus->call("setStyleCursorSpeed", mValue); + } + + UkccCommon::buriedSettings(name(), mouseWidget->cursorSpeedWidget()->objectName(), QString("settings"), checked ? "true":"false"); +diff --git a/registeredSession/plugins/mouse/mouseinterface.cpp b/registeredSession/plugins/mouse/mouseinterface.cpp +index 78b3fda..dfd16d5 100644 +--- a/registeredSession/plugins/mouse/mouseinterface.cpp ++++ b/registeredSession/plugins/mouse/mouseinterface.cpp +@@ -251,6 +251,15 @@ void MouseInterface::setCursorSpeed(const int value) + } + } + ++void MouseInterface::setStyleCursorSpeed(const int value) ++{ ++ if (ukuiStyleGsettings->keys().contains(CURSOR_BLINK_KEY)) { ++ ukuiStyleGsettings->set("cursor-blink-time", value); ++ } else { ++ qCritical() << "ukuiStyleGsettings not contains the key: " << CURSOR_BLINK_KEY; ++ } ++} ++ + void MouseInterface::resetKey(QString key) + { + if (key == "wheelSpeed") { +diff --git a/registeredSession/plugins/mouse/mouseinterface.h b/registeredSession/plugins/mouse/mouseinterface.h +index 9007ca4..14b9ece 100644 +--- a/registeredSession/plugins/mouse/mouseinterface.h ++++ b/registeredSession/plugins/mouse/mouseinterface.h +@@ -67,9 +67,9 @@ public Q_SLOTS: + void setPointerSize(const int value); + void setCursorBlink(const bool checked); + void setCursorSpeed(const int value); ++ void setStyleCursorSpeed(const int value); + + void resetKey(QString key); +- + Q_SIGNALS: + void changed(QString keyName); + +diff --git a/registeredSession/plugins/vino/vinointerface.cpp b/registeredSession/plugins/vino/vinointerface.cpp +index da94c11..3aad696 100644 +--- a/registeredSession/plugins/vino/vinointerface.cpp ++++ b/registeredSession/plugins/vino/vinointerface.cpp +@@ -18,7 +18,7 @@ VinoInterface::VinoInterface() + + bool VinoInterface::getViewOnly() + { +- if (mVinoGsettings->keys().contains("viewOnly")) { ++ if (mVinoGsettings != nullptr && mVinoGsettings->keys().contains("viewOnly")) { + return mVinoGsettings->get(kVinoViewOnlyKey).toBool(); + } else { + qCritical() << "mVinoGsettings not contains the key: " << kVinoViewOnlyKey; +@@ -28,7 +28,7 @@ bool VinoInterface::getViewOnly() + + bool VinoInterface::getPromptEnabled() + { +- if (mVinoGsettings->keys().contains("promptEnabled")) { ++ if (mVinoGsettings != nullptr && mVinoGsettings->keys().contains("promptEnabled")) { + return mVinoGsettings->get(kVinoPromptKey).toBool(); + } else { + qCritical() << "mVinoGsettings not contains the key: " << kVinoPromptKey; +@@ -38,7 +38,7 @@ bool VinoInterface::getPromptEnabled() + + QString VinoInterface::getMethod() + { +- if (mVinoGsettings->keys().contains("authenticationMethods")) { ++ if (mVinoGsettings != nullptr && mVinoGsettings->keys().contains("authenticationMethods")) { + return mVinoGsettings->get(kAuthenticationKey).toString(); + } else { + qCritical() << "mVinoGsettings not contains the key: " << kAuthenticationKey; +@@ -48,7 +48,7 @@ QString VinoInterface::getMethod() + + QString VinoInterface::getPassword() + { +- if (mVinoGsettings->keys().contains("vncPassword")) { ++ if (mVinoGsettings != nullptr && mVinoGsettings->keys().contains("vncPassword")) { + return mVinoGsettings->get(kVncPwdKey).toString(); + } else { + qCritical() << "mVinoGsettings not contains the key: " << kVncPwdKey; +@@ -67,7 +67,7 @@ bool VinoInterface::getVinoServerStatus() + + bool VinoInterface::getVinoStatus() + { +- if (mUkuiVinoGsettings->keys().contains("vinoEnabled")) { ++ if (mVinoGsettings != nullptr && mUkuiVinoGsettings->keys().contains("vinoEnabled")) { + return mUkuiVinoGsettings->get(kVinoEnableKey).toBool(); + } else { + qCritical() << "mUkuiVinoGsettings not contains the key: " << kVinoEnableKey; +@@ -77,7 +77,7 @@ bool VinoInterface::getVinoStatus() + + bool VinoInterface::getXrdpStatus() + { +- if (mUkuiVinoGsettings->keys().contains("xrdpEnabled")) { ++ if (mVinoGsettings != nullptr && mUkuiVinoGsettings->keys().contains("xrdpEnabled")) { + return mUkuiVinoGsettings->get(kXrdpEnableKey).toBool(); + } else { + qCritical() << "mUkuiVinoGsettings not contains the key: " << kXrdpEnableKey; +@@ -87,7 +87,7 @@ bool VinoInterface::getXrdpStatus() + + bool VinoInterface::getEnableStatus() + { +- if (mUkuiVinoGsettings->keys().contains("enabled")) { ++ if (mVinoGsettings != nullptr && mUkuiVinoGsettings->keys().contains("enabled")) { + return mUkuiVinoGsettings->get(kEnableKey).toBool(); + } else { + qCritical() << "mUkuiVinoGsettings not contains the key: " << kEnableKey; +@@ -97,13 +97,13 @@ bool VinoInterface::getEnableStatus() + + void VinoInterface::setVinoKey(const QString &key, bool value) + { +- if (mVinoGsettings->keys().contains(mGsettingMap[key])) { ++ if (mVinoGsettings != nullptr && mVinoGsettings->keys().contains(mGsettingMap[key])) { + return mVinoGsettings->set(key, value); + } else { + qCritical() << "mVinoGsettings not contains the key: " << key; + } + +- if (mUkuiVinoGsettings->keys().contains(mGsettingMap[key])) { ++ if (mUkuiVinoGsettings != nullptr && mUkuiVinoGsettings->keys().contains(mGsettingMap[key])) { + return mUkuiVinoGsettings->set(key, value); + } else { + qCritical() << "mUkuiVinoGsettings not contains the key: " << key; +@@ -112,7 +112,7 @@ void VinoInterface::setVinoKey(const QString &key, bool value) + + void VinoInterface::setVinoKey(const QString &key, QString value) + { +- if (mVinoGsettings->keys().contains(mGsettingMap[key])) { ++ if (mVinoGsettings != nullptr && mVinoGsettings->keys().contains(mGsettingMap[key])) { + return mVinoGsettings->set(key, value); + } else { + qCritical() << "ukuiNoticeGsettings not contains the key: " << key; +@@ -121,7 +121,7 @@ void VinoInterface::setVinoKey(const QString &key, QString value) + + void VinoInterface::setVinoKey(const QString &key, QByteArray value) + { +- if (mVinoGsettings->keys().contains(mGsettingMap[key])) { ++ if (mVinoGsettings != nullptr && mVinoGsettings->keys().contains(mGsettingMap[key])) { + return mVinoGsettings->set(key, value); + } else { + qCritical() << "ukuiNoticeGsettings not contains the key: " << key; +diff --git a/registeredSession/plugins/vino/vinointerface.h b/registeredSession/plugins/vino/vinointerface.h +index 2691edb..83252b8 100644 +--- a/registeredSession/plugins/vino/vinointerface.h ++++ b/registeredSession/plugins/vino/vinointerface.h +@@ -5,7 +5,6 @@ + #include <QDBusArgument> + #include <QVariant> + #include <QDBusMetaType> +-#include <QGSettings> + #include "../../universalinterface.h" + + class VinoInterface : public QObject +@@ -40,13 +39,13 @@ public Q_SLOTS: + void setVinoKey(const QString &key, QByteArray value); + + private: +- const QString kEnableKey = "enabled"; +- const QString kXrdpEnableKey = "xrdp-enabled"; +- const QString kVinoEnableKey = "vino-enabled"; +- const QString kVinoViewOnlyKey = "view-only"; +- const QString kVinoPromptKey = "prompt-enabled"; +- const QString kAuthenticationKey = "authentication-methods"; +- const QString kVncPwdKey = "vnc-password"; ++ QString kEnableKey = "enabled"; ++ QString kXrdpEnableKey = "xrdp-enabled"; ++ QString kVinoEnableKey = "vino-enabled"; ++ QString kVinoViewOnlyKey = "view-only"; ++ QString kVinoPromptKey = "prompt-enabled"; ++ QString kAuthenticationKey = "authentication-methods"; ++ QString kVncPwdKey = "vnc-password"; + + QGSettings *mVinoGsettings = nullptr; + QGSettings *mUkuiVinoGsettings = nullptr; +diff --git a/tests/tests.pro b/tests/tests.pro +index 7f1158d..31ce3a6 100644 +--- a/tests/tests.pro ++++ b/tests/tests.pro +@@ -11,6 +11,7 @@ SUBDIRS = unit_test_keyboard \ + unit_test_screensaver \ + unit_test_shortcut \ + unit_test_wallpaper \ ++ unit_test_vino \ + + + # 打桩工具 +diff --git a/tests/unit_test_vino/main.cpp b/tests/unit_test_vino/main.cpp +new file mode 100644 +index 0000000..9250f9b +--- /dev/null ++++ b/tests/unit_test_vino/main.cpp +@@ -0,0 +1,8 @@ ++#include <gtest/gtest.h> ++ ++int main(int argc, char **argv) ++{ ++ testing::InitGoogleTest(&argc, argv); ++ ++ return RUN_ALL_TESTS(); ++} +diff --git a/tests/unit_test_vino/unit_test_vino.cpp b/tests/unit_test_vino/unit_test_vino.cpp +new file mode 100644 +index 0000000..320819c +--- /dev/null ++++ b/tests/unit_test_vino/unit_test_vino.cpp +@@ -0,0 +1,244 @@ ++/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- ++ * ++ * Copyright (C) 2024 KylinSoft Co., 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; either version 2 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, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ */ ++#include <gtest/gtest.h> ++#include <gtest/gtest-death-test.h> ++ ++#include "../../registeredSession/plugins/vino/vinointerface.h" ++ ++#include "stubext.h" ++using namespace stub_ext; ++ ++class VinoInterfaceTest : public testing::Test ++{ ++protected: ++ static void SetUpTestSuite() ++ { ++ m_pVinoDbus = new VinoInterface(); ++ } ++ ++ static void TearDownTestSuite() ++ { ++ delete m_pVinoDbus; ++ m_pVinoDbus = nullptr; ++ } ++ ++ static VinoInterface *m_pVinoDbus; ++}; ++ ++VinoInterface *VinoInterfaceTest::m_pVinoDbus = nullptr; ++ ++TEST_F(VinoInterfaceTest, viewOnly) ++{ ++ // get current value ++ bool repeatKeyValue = m_pVinoDbus->getViewOnly(); ++ ++ // call setKeyRepeat function to set different value ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoViewOnlyKey, !repeatKeyValue); ++ ++ // test the current value and the value you have set ++ ASSERT_EQ(!repeatKeyValue, m_pVinoDbus->getViewOnly()); ++ ++ // restore the value before test ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoViewOnlyKey, repeatKeyValue); ++} ++ ++TEST_F(VinoInterfaceTest, noViewOnly) ++{ ++ // get current value ++ QString originKey = m_pVinoDbus->kVinoViewOnlyKey; ++ m_pVinoDbus->kVinoViewOnlyKey = ""; ++ ++ bool repeatKeyValue = m_pVinoDbus->getViewOnly(); ++ ++ // call setKeyRepeat function to set different value ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoViewOnlyKey, !repeatKeyValue); ++ ++ // test the current value and the value you have set ++ ASSERT_EQ(!repeatKeyValue, m_pVinoDbus->getViewOnly()); ++ ++ // restore the value before test ++ m_pVinoDbus->kVinoViewOnlyKey = originKey; ++} ++ ++TEST_F(VinoInterfaceTest, PromptEnabled) ++{ ++ bool promptKeyValue = m_pVinoDbus->getPromptEnabled(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoPromptKey, !promptKeyValue); ++ ++ ASSERT_EQ(promptKeyValue, m_pVinoDbus->getPromptEnabled()); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoPromptKey, promptKeyValue); ++} ++ ++TEST_F(VinoInterfaceTest, noPromptEnabled) ++{ ++ // get current value ++ QString originKey = m_pVinoDbus->kVinoPromptKey; ++ m_pVinoDbus->kVinoPromptKey = ""; ++ ++ bool promptKeyValue = m_pVinoDbus->getPromptEnabled(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoPromptKey, !promptKeyValue); ++ ++ ASSERT_EQ(promptKeyValue, m_pVinoDbus->getPromptEnabled()); ++ ++ // restore the value before test ++ m_pVinoDbus->kVinoPromptKey = originKey; ++} ++ ++TEST_F(VinoInterfaceTest, Method) ++{ ++ QString methodKeyValue = m_pVinoDbus->getMethod(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kAuthenticationKey, methodKeyValue); ++ ++ ASSERT_EQ(methodKeyValue, m_pVinoDbus->getMethod()); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kAuthenticationKey, methodKeyValue); ++} ++ ++TEST_F(VinoInterfaceTest, noMethod) ++{ ++ // get current value ++ QString originKey = m_pVinoDbus->kAuthenticationKey; ++ m_pVinoDbus->kAuthenticationKey = ""; ++ ++ QString methodKeyValue = m_pVinoDbus->getMethod(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kAuthenticationKey, methodKeyValue); ++ ++ ASSERT_EQ(methodKeyValue, m_pVinoDbus->getMethod()); ++ ++ // restore the value before test ++ m_pVinoDbus->kAuthenticationKey = originKey; ++} ++ ++ ++TEST_F(VinoInterfaceTest, Password) ++{ ++ QString passwordKeyValue = m_pVinoDbus->getPassword(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVncPwdKey, passwordKeyValue); ++ ++ ASSERT_EQ(passwordKeyValue, m_pVinoDbus->getPassword()); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVncPwdKey, passwordKeyValue); ++} ++ ++TEST_F(VinoInterfaceTest, noPassword) ++{ ++ // get current value ++ QString originKey = m_pVinoDbus->kVncPwdKey; ++ m_pVinoDbus->kVncPwdKey = ""; ++ ++ QString passwordKeyValue = m_pVinoDbus->getPassword(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVncPwdKey, passwordKeyValue); ++ ++ ASSERT_EQ(passwordKeyValue, m_pVinoDbus->getPassword()); ++ ++ // restore the value before test ++ m_pVinoDbus->kVncPwdKey = originKey; ++} ++ ++TEST_F(VinoInterfaceTest, VinoServerStatus) ++{ ++ bool currentValue = m_pVinoDbus->getVinoServerStatus(); ++} ++ ++TEST_F(VinoInterfaceTest, VinoStatus) ++{ ++ bool currentValue = m_pVinoDbus->getVinoStatus(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoEnableKey, !currentValue); ++ ++ ASSERT_EQ(!currentValue, m_pVinoDbus->getVinoStatus()); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoEnableKey, currentValue); ++} ++ ++TEST_F(VinoInterfaceTest, noVinoStatus) ++{ ++ // get current value ++ QString originKey = m_pVinoDbus->kVinoEnableKey; ++ m_pVinoDbus->kVinoEnableKey = ""; ++ ++ bool currentValue = m_pVinoDbus->getVinoStatus(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kVinoEnableKey, !currentValue); ++ ++ ASSERT_EQ(!currentValue, m_pVinoDbus->getVinoStatus()); ++ ++ // restore the value before test ++ m_pVinoDbus->kVinoEnableKey = originKey; ++} ++ ++TEST_F(VinoInterfaceTest, XrdpStatus) ++{ ++ bool currentValue = m_pVinoDbus->getXrdpStatus(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kXrdpEnableKey, !currentValue); ++ ++ ASSERT_EQ(!currentValue, m_pVinoDbus->getXrdpStatus()); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kXrdpEnableKey, currentValue); ++} ++ ++TEST_F(VinoInterfaceTest, noXrdpStatus) ++{ ++ // get current value ++ QString originKey = m_pVinoDbus->kXrdpEnableKey; ++ m_pVinoDbus->kXrdpEnableKey = ""; ++ ++ int currentValue = m_pVinoDbus->getXrdpStatus(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kXrdpEnableKey, currentValue); ++ ++ // restore the value before test ++ m_pVinoDbus->kXrdpEnableKey = originKey; ++} ++ ++TEST_F(VinoInterfaceTest, noEnableStatus) ++{ ++ bool currentValue = m_pVinoDbus->getEnableStatus(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kEnableKey, !currentValue); ++ ++ ASSERT_EQ(currentValue, m_pVinoDbus->getEnableStatus()); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kEnableKey, currentValue); ++} ++ ++TEST_F(VinoInterfaceTest, EnableStatus) ++{ ++ // get current value ++ QString originKey = m_pVinoDbus->kEnableKey; ++ m_pVinoDbus->kEnableKey = ""; ++ ++ bool currentValue = m_pVinoDbus->getEnableStatus(); ++ ++ m_pVinoDbus->setVinoKey(m_pVinoDbus->kEnableKey, !currentValue); ++ ++ ASSERT_EQ(currentValue, m_pVinoDbus->getEnableStatus()); ++ ++ // restore the value before test ++ m_pVinoDbus->kEnableKey = originKey; ++} +diff --git a/tests/unit_test_vino/unit_test_vino.pro b/tests/unit_test_vino/unit_test_vino.pro +new file mode 100644 +index 0000000..8147c7d +--- /dev/null ++++ b/tests/unit_test_vino/unit_test_vino.pro +@@ -0,0 +1,40 @@ ++#------------------------------------------------- ++# ++# Project created by QtCreator 2019-08-22T11:12:59 ++# ++#------------------------------------------------- ++QT += dbus ++QT -= gui ++#greaterThan(QT_MAJOR_VERSION, 4): QT += widgets ++TEMPLATE = app ++ ++TARGET = unit_test_vino ++target.source += $$TARGET ++target.path = ./ ++ ++#代码覆盖率工具gcov ++QMAKE_LFLAGS +=-fprofile-arcs -ftest-coverage ++QMAKE_CXXFLAGS += --coverage -fno-inline -fno-access-control ++ ++LIBS += -lgtest_main -lpthread ++LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt -lgtest -lgcov ++ ++#OBJECTS_DIR = ./obj ++#MOC_DIR = ./moc ++ ++#打桩工具 ++TEST_UTILS_PATH = $$PWD/../kt-test-utils ++ ++# Include directories ++INCLUDEPATH += $$PROJECT_ROOTDIR \ ++ $$TEST_UTILS_PATH/cpp-stub \ ++ $$TEST_UTILS_PATH/cpp-stub-ext \ ++ ++SOURCES += ../../registeredSession/plugins/vino/vinointerface.cpp \ ++ ../../registeredSession/universalinterface.cpp \ ++ unit_test_vino.cpp \ ++ main.cpp ++ ++HEADERS += ../../registeredSession/plugins/vino/vinointerface.h \ ++ ../../registeredSession/universalinterface.h ++ diff -Nru ukui-control-center-4.10.0.0/debian/patches/0124-146-326999-core.patch ukui-control-center-4.10.0.0/debian/patches/0124-146-326999-core.patch --- ukui-control-center-4.10.0.0/debian/patches/0124-146-326999-core.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0124-146-326999-core.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,68 @@ +From: nil <zhoubin@kylinos.cn> +Date: Mon, 20 Jan 2025 08:45:14 +0000 +Subject: =?utf-8?b?ITE0NiAzMjY5OTkg44CQ6K6+572u44CR57O757uf5a6J6KOF5oiQ5Yqf?= + =?utf-8?b?77yM56ys5LiA5qyh6L+b5YWl57O757uf77yM5pyq5pON5L2c5pe25by55Ye65byC?= + =?utf-8?b?5bi45oql6ZSZ77yM5a2Y5ZyoY29yZeaWh+S7tiBNZXJnZSBwdWxsIHJlcXVlc3Qg?= + =?utf-8?b?ITE0NiBmcm9tIOiLj+WXo+WFuC9vcGVua3lsaW4vbmlsZS0xMjEw?= + +--- + plugins/personalized/wallpaper/wallpaper.cpp | 9 +++++---- + plugins/personalized/wallpaper/wallpaper.h | 4 +--- + 2 files changed, 6 insertions(+), 7 deletions(-) + +diff --git a/plugins/personalized/wallpaper/wallpaper.cpp b/plugins/personalized/wallpaper/wallpaper.cpp +index a07ddcf..7c7675f 100644 +--- a/plugins/personalized/wallpaper/wallpaper.cpp ++++ b/plugins/personalized/wallpaper/wallpaper.cpp +@@ -48,9 +48,6 @@ Wallpaper::Wallpaper() + pluginName = tr("Background"); + pluginType = PERSONALIZED; + picInfoList.clear(); +- QtConcurrent::run([=]{ +- preInitialize(); +- }); + } + + Wallpaper::~Wallpaper() +@@ -69,7 +66,7 @@ int Wallpaper::pluginTypes() { + return pluginType; + } + +-void Wallpaper::preInitialize() { ++void Wallpaper::loadPictureInfo() { + wallpaperInterface = new QDBusInterface("org.ukui.ukcc.session", + "/Wallpaper", + "org.ukui.ukcc.session.Wallpaper", +@@ -115,6 +112,9 @@ void Wallpaper::preInitialize() { + file.close(); + } + } ++ if (qPixmap.isNull()) { ++ qDebug() << Q_FUNC_INFO << "filename" << filename << "to pixmap is null"; ++ } + QPixmap pixmap = qPixmap.scaled(IMAGE_SIZE); + + QFile wallpaperFile; +@@ -181,6 +181,7 @@ void Wallpaper::dataChanged(const QString &key) + + void Wallpaper::initContent() + { ++ loadPictureInfo(); + initModes(); + initTypes(); + initMode(); +diff --git a/plugins/personalized/wallpaper/wallpaper.h b/plugins/personalized/wallpaper/wallpaper.h +index c7e5fe7..042422e 100644 +--- a/plugins/personalized/wallpaper/wallpaper.h ++++ b/plugins/personalized/wallpaper/wallpaper.h +@@ -65,9 +65,7 @@ public: + void initPictures(); + void connectUiSignals(); + void showLocalWpDialog(); +- +-private: +- void preInitialize(); ++ void loadPictureInfo(); + + private: + bool mFirstLoad; diff -Nru ukui-control-center-4.10.0.0/debian/patches/0125-145-update-display-log.patch ukui-control-center-4.10.0.0/debian/patches/0125-145-update-display-log.patch --- ukui-control-center-4.10.0.0/debian/patches/0125-145-update-display-log.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0125-145-update-display-log.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,15119 @@ +From: nil <zhoubin@kylinos.cn> +Date: Mon, 20 Jan 2025 09:19:03 +0000 +Subject: =?utf-8?q?!145_update_display_log_Merge_pull_request_!145_from_?= + =?utf-8?q?=E8=8B=8F=E5=97=A3=E5=85=B8/openkylin/nile-1107?= + +--- + plugins/application/autoboot/addautoboot.cpp | 344 --- + plugins/application/autoboot/addautoboot.h | 98 - + plugins/application/autoboot/autoboot.cpp | 1 - + plugins/application/autoboot/autoboot.h | 1 - + plugins/application/autoboot/autoboot.pro | 2 - + plugins/application/autoboot/autobootui.cpp | 3 +- + plugins/application/autoboot/autobootui.h | 4 +- + plugins/application/defaultapp/defaultapp.h | 2 - + plugins/application/defaultapp/defaultappui.cpp | 3 +- + plugins/application/defaultapp/defaultappui.h | 5 +- + plugins/devices/printer/printer.cpp | 3 +- + plugins/devices/printer/printer.h | 8 +- + plugins/devices/printer/printer.pro | 2 - + plugins/devices/printer/printerbtn.cpp | 3 +- + plugins/devices/printer/printerbtn.h | 4 + + plugins/devices/shortcut/addshortcutdialog.cpp | 1 - + plugins/devices/shortcut/addshortcutdialog.h | 2 + + plugins/devices/shortcut/addshortcutdialog.ui | 16 +- + plugins/devices/shortcut/shortcut.pro | 2 - + plugins/devices/shortcut/shortcut.ui | 160 -- + plugins/devices/shortcut/shortcutui.cpp | 10 +- + plugins/devices/shortcut/shortcutui.h | 9 +- + plugins/personalized/fonts/fonts.cpp | 2 +- + plugins/personalized/fonts/fonts.h | 1 + + plugins/personalized/fonts/fonts.ui | 17 +- + plugins/personalized/screenlock/screenlock.ui | 275 --- + plugins/personalized/screenlock/screenlockui.cpp | 6 +- + plugins/personalized/screenlock/screenlockui.h | 8 +- + plugins/personalized/screensaver/screensaver.pro | 1 - + plugins/personalized/screensaver/screensaver.ui | 254 -- + plugins/personalized/screensaver/screensaverui.cpp | 17 +- + plugins/personalized/screensaver/screensaverui.h | 6 +- + plugins/personalized/theme/theme.cpp | 24 +- + plugins/personalized/theme/theme.h | 17 +- + plugins/personalized/theme/theme.pro | 1 - + plugins/personalized/theme/themewidget.cpp | 4 +- + plugins/personalized/theme/themewidget.h | 4 +- + plugins/personalized/wallpaper/colordialog.cpp | 1 - + plugins/personalized/wallpaper/wallpaper.pro | 2 - + plugins/personalized/wallpaper/wallpaper.ui | 387 ---- + plugins/personalized/wallpaper/wallpaperui.cpp | 3 +- + plugins/personalized/wallpaper/wallpaperui.h | 7 +- + plugins/plugins.pro | 4 - + plugins/system/about/about.cpp | 4 +- + plugins/system/about/about.h | 2 - + plugins/system/about/aboutui.cpp | 64 +- + plugins/system/about/aboutui.h | 59 +- + plugins/system/about/privacydialog.cpp | 1 + + plugins/system/about/privacydialog.h | 1 - + plugins/system/about/statusdialog.cpp | 13 +- + plugins/system/about/statusdialog.h | 15 +- + plugins/system/about/trialdialog.cpp | 3 +- + plugins/system/about/trialdialog.h | 6 +- + plugins/system/display/brightnessFrame.cpp | 2 +- + plugins/system/display/brightnessFrame.h | 5 +- + plugins/system/display/display.pro | 9 +- + plugins/system/display/display.ui | 6 +- + .../system/display/displayperformancedialog.cpp | 213 -- + plugins/system/display/displayperformancedialog.h | 58 - + plugins/system/display/displayperformancedialog.ui | 818 ------- + plugins/system/display/widget.cpp | 18 +- + plugins/system/display/widget.h | 18 +- + plugins/system/display_hw/brightnessFrame.cpp | 42 - + plugins/system/display_hw/brightnessFrame.h | 26 - + plugins/system/display_hw/colorinfo.h | 32 - + plugins/system/display_hw/controlpanel.cpp | 175 -- + plugins/system/display_hw/controlpanel.h | 62 - + .../system/display_hw/declarative/qmloutput.cpp | 606 ----- + plugins/system/display_hw/declarative/qmloutput.h | 217 -- + .../display_hw/declarative/qmloutputcomponent.cpp | 63 - + .../display_hw/declarative/qmloutputcomponent.h | 43 - + .../system/display_hw/declarative/qmlscreen.cpp | 708 ------ + plugins/system/display_hw/declarative/qmlscreen.h | 133 -- + plugins/system/display_hw/display_hw.cpp | 105 - + plugins/system/display_hw/display_hw.h | 64 - + plugins/system/display_hw/display_hw.pro | 70 - + plugins/system/display_hw/display_hw.ui | 931 -------- + .../system/display_hw/displayperformancedialog.cpp | 213 -- + .../system/display_hw/displayperformancedialog.h | 58 - + .../system/display_hw/displayperformancedialog.ui | 813 ------- + plugins/system/display_hw/outputconfig.cpp | 439 ---- + plugins/system/display_hw/outputconfig.h | 88 - + plugins/system/display_hw/qml.qrc | 6 - + plugins/system/display_hw/qml/Output.qml | 277 --- + plugins/system/display_hw/qml/main.qml | 75 - + plugins/system/display_hw/resolutionslider.cpp | 206 -- + plugins/system/display_hw/resolutionslider.h | 53 - + plugins/system/display_hw/scalesize.h | 42 - + plugins/system/display_hw/screenConfig.h | 35 - + plugins/system/display_hw/unifiedoutputconfig.cpp | 489 ---- + plugins/system/display_hw/unifiedoutputconfig.h | 46 - + plugins/system/display_hw/utils.cpp | 24 - + plugins/system/display_hw/utils.h | 36 - + plugins/system/display_hw/widget.cpp | 2440 -------------------- + plugins/system/display_hw/widget.h | 260 --- + plugins/system/notice/notice.h | 1 - + plugins/system/notice/noticeui.h | 1 - + plugins/system/power/power.h | 2 - + plugins/time-language/area/area.pro | 1 - + plugins/time-language/area/area.ui | 184 -- + plugins/time-language/area/areaui.cpp | 11 +- + plugins/time-language/area/areaui.h | 14 +- + plugins/time-language/datetime/changtime.cpp | 1 - + plugins/time-language/datetime/changtime.ui | 627 ----- + plugins/time-language/datetime/datetime.pro | 2 - + plugins/time-language/datetime/datetime.ui | 342 --- + plugins/time-language/datetime/datetimeui.cpp | 24 +- + plugins/time-language/datetime/datetimeui.h | 25 +- + plugins/time-language/datetime/timeBtn.cpp | 2 +- + plugins/time-language/datetime/timeBtn.h | 6 +- + plugins/time-language/datetime/timelabel.cpp | 2 +- + plugins/time-language/datetime/timelabel.h | 6 +- + .../datetime/worldMap/timezonechooser.cpp | 1 - + 113 files changed, 276 insertions(+), 12892 deletions(-) + delete mode 100644 plugins/application/autoboot/addautoboot.cpp + delete mode 100644 plugins/application/autoboot/addautoboot.h + delete mode 100644 plugins/devices/shortcut/shortcut.ui + delete mode 100644 plugins/personalized/screenlock/screenlock.ui + delete mode 100644 plugins/personalized/screensaver/screensaver.ui + delete mode 100644 plugins/personalized/wallpaper/wallpaper.ui + delete mode 100644 plugins/system/display/displayperformancedialog.cpp + delete mode 100644 plugins/system/display/displayperformancedialog.h + delete mode 100644 plugins/system/display/displayperformancedialog.ui + delete mode 100644 plugins/system/display_hw/brightnessFrame.cpp + delete mode 100644 plugins/system/display_hw/brightnessFrame.h + delete mode 100644 plugins/system/display_hw/colorinfo.h + delete mode 100644 plugins/system/display_hw/controlpanel.cpp + delete mode 100644 plugins/system/display_hw/controlpanel.h + delete mode 100644 plugins/system/display_hw/declarative/qmloutput.cpp + delete mode 100644 plugins/system/display_hw/declarative/qmloutput.h + delete mode 100644 plugins/system/display_hw/declarative/qmloutputcomponent.cpp + delete mode 100644 plugins/system/display_hw/declarative/qmloutputcomponent.h + delete mode 100644 plugins/system/display_hw/declarative/qmlscreen.cpp + delete mode 100644 plugins/system/display_hw/declarative/qmlscreen.h + delete mode 100644 plugins/system/display_hw/display_hw.cpp + delete mode 100644 plugins/system/display_hw/display_hw.h + delete mode 100644 plugins/system/display_hw/display_hw.pro + delete mode 100644 plugins/system/display_hw/display_hw.ui + delete mode 100644 plugins/system/display_hw/displayperformancedialog.cpp + delete mode 100644 plugins/system/display_hw/displayperformancedialog.h + delete mode 100644 plugins/system/display_hw/displayperformancedialog.ui + delete mode 100644 plugins/system/display_hw/outputconfig.cpp + delete mode 100644 plugins/system/display_hw/outputconfig.h + delete mode 100644 plugins/system/display_hw/qml.qrc + delete mode 100644 plugins/system/display_hw/qml/Output.qml + delete mode 100644 plugins/system/display_hw/qml/main.qml + delete mode 100644 plugins/system/display_hw/resolutionslider.cpp + delete mode 100644 plugins/system/display_hw/resolutionslider.h + delete mode 100644 plugins/system/display_hw/scalesize.h + delete mode 100644 plugins/system/display_hw/screenConfig.h + delete mode 100644 plugins/system/display_hw/unifiedoutputconfig.cpp + delete mode 100644 plugins/system/display_hw/unifiedoutputconfig.h + delete mode 100644 plugins/system/display_hw/utils.cpp + delete mode 100644 plugins/system/display_hw/utils.h + delete mode 100644 plugins/system/display_hw/widget.cpp + delete mode 100644 plugins/system/display_hw/widget.h + delete mode 100644 plugins/time-language/area/area.ui + delete mode 100644 plugins/time-language/datetime/changtime.ui + delete mode 100644 plugins/time-language/datetime/datetime.ui + +diff --git a/plugins/application/autoboot/addautoboot.cpp b/plugins/application/autoboot/addautoboot.cpp +deleted file mode 100644 +index 2f6eda4..0000000 +--- a/plugins/application/autoboot/addautoboot.cpp ++++ /dev/null +@@ -1,344 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "addautoboot.h" +-#include "closebutton.h" +- +-#include <QDebug> +-#include <QFileInfo> +-#include <QSettings> +-#include <QPushButton> +-#include <QApplication> +- +-// #define DESKTOPPATH "/etc/xdg/autostart/" +-#define DESKTOPPATH "/usr/share/applications/" +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-AddAutoBoot::AddAutoBoot(QWidget *parent) : +- QDialog(parent) +-{ +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- +- initUi(this); +- initStyle(); +- initConnection(); +-} +- +-void AddAutoBoot::resetBeforeClose() +-{ +- userEditNameFlag = false; +- userEditCommentFlag = false; +- mCertainBtn->setEnabled(false); +- mHintLabel->clear(); +- mAppNameEdit->setToolTip(""); +- mAppBewriteEdit->setToolTip(""); +- mAppPathEdit->setToolTip(""); +- mAppNameEdit->setText(QString()); +- mAppBewriteEdit->setText(QString()); +- mAppPathEdit->setText(QString()); +- close(); +-} +- +-void AddAutoBoot::paintEvent(QPaintEvent *event) +-{ +- Q_UNUSED(event); +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 10, 10); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath, palette().color(QPalette::Base)); +- p.restore(); +-} +-void AddAutoBoot::initUi(QDialog *AddAutoBoot) +-{ +- AddAutoBoot->resize(420, 308); +- QVBoxLayout *mverticalLayout = new QVBoxLayout(AddAutoBoot); +- mverticalLayout->setSpacing(16); +- mverticalLayout->setContentsMargins(32, 32, 32, 24); +- +- mTitleLabel = new QLabel(AddAutoBoot); +- +- mAppFrame = new QFrame(AddAutoBoot); +- mAppFrame->setFixedSize(356,160); +- mAppFrame->setFrameShape(QFrame::NoFrame); +- mAppFrame->setFrameShadow(QFrame::Raised); +- +- QGridLayout *mAppLayout = new QGridLayout(mAppFrame); +- mAppLayout->setHorizontalSpacing(8); +- mAppLayout->setVerticalSpacing(4); +- mAppNameLabel = new FixLabel(mAppFrame); +- mAppPathLabel = new FixLabel(mAppFrame); +- mAppBewriteLabel = new FixLabel(mAppFrame); +- mAppNameEdit = new QLineEdit(mAppFrame); +- mAppPathEdit = new QLineEdit(mAppFrame); +- mAppBewriteEdit = new QLineEdit(mAppFrame); +- mOpenBtn = new QPushButton(mAppFrame); +- mHintLabel = new QLabel(mAppFrame); +- +- mOpenBtn->setContentsMargins(8, 0, 8, 0); +- mAppLayout->addWidget(mAppNameLabel,0,0,1,2); +- mAppLayout->addWidget(mAppNameEdit,0,2,1,3); +- mAppLayout->addWidget(mAppPathLabel,1,0,1,2); +- mAppLayout->addWidget(mAppPathEdit,1,2,1,2); +- mAppLayout->addWidget(mOpenBtn,1,4,1,1); +- mAppLayout->addWidget(mAppBewriteLabel,2,0,1,2); +- mAppLayout->addWidget(mAppBewriteEdit,2,2,1,3); +- mAppLayout->addWidget(mHintLabel,3,2,1,3); +- +- mBtnFrame = new QFrame(AddAutoBoot); +- mBtnFrame->setFixedSize(356,36); +- mBtnFrame->setFrameShape(QFrame::NoFrame); +- +- QHBoxLayout *mBtnLayout = new QHBoxLayout(mBtnFrame); +- mBtnLayout->setContentsMargins(0,0,0,0); +- mBtnLayout->setSpacing(16); +- mCancelBtn = new QPushButton(mBtnFrame); +- mCancelBtn->setFixedSize(100,36); +- mCertainBtn = new QPushButton(mBtnFrame); +- mCertainBtn->setFixedSize(100,36); +- +- mBtnLayout->addStretch(); +- mBtnLayout->addWidget(mCancelBtn); +- mBtnLayout->addWidget(mCertainBtn); +- +- mverticalLayout->addWidget(mTitleLabel); +- mverticalLayout->addWidget(mAppFrame); +- mverticalLayout->addSpacing(8); +- mverticalLayout->addWidget(mBtnFrame); +- +- retranslateUi(); +-} +- +-void AddAutoBoot::initStyle() +-{ +- mTitleLabel->setStyleSheet("QLabel{color: palette(windowText);}"); +- +- selectFile = ""; +- +- mAppNameEdit->setPlaceholderText(tr("Name")); +- mAppPathEdit->setPlaceholderText(tr("Exec")); +- mAppBewriteEdit->setPlaceholderText(tr("Comment")); +- +- mHintLabel->setAlignment(Qt::AlignLeft); +- mHintLabel->setStyleSheet("color:red;"); +- mCertainBtn->setEnabled(false); +- +-} +- +-void AddAutoBoot::initConnection() +-{ +- connect(mOpenBtn, SIGNAL(clicked(bool)), this, SLOT(open_desktop_dir_slots())); +- connect(mCancelBtn, SIGNAL(clicked(bool)), this, SLOT(close())); +- connect(mAppPathEdit, SIGNAL(textEdited(QString)), this, SLOT(execLinEditSlot(QString))); +- +- connect(mCancelBtn, &QPushButton::clicked, [=] { +- resetBeforeClose(); +- }); +- connect(mCertainBtn, &QPushButton::clicked, this, [=] { +- emit autoboot_adding_signals(selectFile, mAppNameEdit->text(), mDesktopExec, +- mAppBewriteEdit->text(), mDesktopIcon); +- resetBeforeClose(); +- }); +- +- connect(mAppNameEdit, &QLineEdit::editingFinished, this, [=](){ +- if (mAppNameEdit->text().isEmpty()) { +- userEditNameFlag = false; +- } else { // 用户输入了程序名 +- userEditNameFlag = true; +- } +- }); +- connect(mAppBewriteEdit, &QLineEdit::editingFinished, this, [=](){ +- if (mAppBewriteEdit->text().isEmpty()) { +- userEditCommentFlag = false; +- } else { // 用户输入了描述 +- userEditCommentFlag = true; +- } +- }); +- +- connect(mAppNameEdit, &QLineEdit::textChanged, this, [=](){ +- mAppNameEdit->setToolTip(mAppNameEdit->text()); +- }); +- connect(mAppBewriteEdit, &QLineEdit::textChanged, this, [=](){ +- mAppBewriteEdit->setToolTip(mAppBewriteEdit->text()); +- }); +- connect(mAppPathEdit, &QLineEdit::textChanged, this, [=](){ +- mAppPathEdit->setToolTip(mAppPathEdit->text()); +- }); +-} +- +-void AddAutoBoot::retranslateUi() +-{ +- mHintLabel->setText(QString()); +- mTitleLabel->setText(QApplication::translate("AddAutoBoot", "Add autoboot program", nullptr)); +- mAppNameLabel->setText(QApplication::translate("AddAutoBoot", "Name", nullptr)); +- mAppPathLabel->setText(QApplication::translate("AddAutoBoot", "Exec", nullptr)); +- mAppBewriteLabel->setText(QApplication::translate("AddAutoBoot", "Comment", nullptr)); +- mOpenBtn->setText(QApplication::translate("AddAutoBoot", "Open", nullptr)); +- mCancelBtn->setText(QApplication::translate("AddAutoBoot", "Cancel", nullptr)); +- mCertainBtn->setText(QApplication::translate("AddAutoBoot", "Certain", nullptr)); +-} +- +-AddAutoBoot::~AddAutoBoot() +-{ +- +-} +- +-void AddAutoBoot::open_desktop_dir_slots() +-{ +- QString filters = tr("Desktop files(*.desktop)"); +- QFileDialog fd(this); +- fd.setDirectory(DESKTOPPATH); +- fd.setAcceptMode(QFileDialog::AcceptOpen); +- fd.setViewMode(QFileDialog::List); +- fd.setNameFilter(filters); +- fd.setFileMode(QFileDialog::ExistingFile); +- fd.setWindowTitle(tr("select autoboot desktop")); +- fd.setLabelText(QFileDialog::Accept, tr("Select")); +- fd.setLabelText(QFileDialog::Reject, tr("Cancel")); +- if (fd.exec() != QDialog::Accepted) +- return; +- +- QString selectedfile; +- selectedfile = fd.selectedFiles().first(); +- selectFile = selectedfile; +- +- QByteArray ba; +- ba = selectedfile.toUtf8(); +- +- // 解析desktop文件 +- GKeyFile *keyfile; +- char *name, *comment,*mname; +- bool no_display; +- +- keyfile = g_key_file_new(); +- if (!g_key_file_load_from_file(keyfile, ba.data(), G_KEY_FILE_NONE, NULL)) { +- g_key_file_free(keyfile); +- return; +- } +- no_display = g_key_file_get_boolean(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, FALSE); +- name = g_key_file_get_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_NAME, NULL); +- mname = g_key_file_get_locale_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL); +- comment = g_key_file_get_locale_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL); +- mDesktopExec = g_key_file_get_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_EXEC, NULL); +- mDesktopIcon = g_key_file_get_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_ICON, NULL); +- +- if (userEditNameFlag == false) { // 用户输入了程序名,以用户输入为准,否则以自带的为准 +- mAppNameEdit->setText(QString(mname)); +- } +- +- mAppPathEdit->setText(QString(selectedfile)); +- if (userEditCommentFlag == false) { // 用户输入了程序描述,以用户输入为准,否则以自带的为准 +- mAppBewriteEdit->setText(QString(comment)); +- } +- +- emit mAppPathEdit->textEdited(QString(selectedfile)); +- +- if (no_display) { +- mHintLabel->setText(tr("desktop file not allowed add")); +- mHintLabel->setStyleSheet("color:red;"); +- mCertainBtn->setEnabled(false); +- } +- +- g_key_file_free(keyfile); +-} +- +-void AddAutoBoot::execLinEditSlot(const QString &fileName) +-{ +- selectFile = fileName; +- QFileInfo fileInfo(fileName); +- if (fileInfo.isFile() && fileName.endsWith("desktop")) { +- mHintLabel->clear(); +- mCertainBtn->setEnabled(true); +- +- QByteArray ba; +- ba = fileName.toUtf8(); +- +- // 解析desktop文件 +- GKeyFile *keyfile; +- char *name, *comment; +- +- keyfile = g_key_file_new(); +- if (!g_key_file_load_from_file(keyfile, ba.data(), G_KEY_FILE_NONE, NULL)) { +- g_key_file_free(keyfile); +- return; +- } +- +- name = g_key_file_get_locale_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL); +- mDesktopExec = g_key_file_get_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_EXEC, NULL); +- mDesktopIcon = g_key_file_get_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_ICON, NULL); +- comment = g_key_file_get_locale_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, +- G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL); +- +- if (userEditNameFlag == false) { // 用户输入了程序名,以用户输入为准,否则以自带的为准 +- mAppNameEdit->setText(QString(name)); +- } +- +- mAppPathEdit->setText(fileName); +- if (userEditCommentFlag == false) { // 用户输入了程序描述,以用户输入为准,否则以自带的为准 +- mAppBewriteEdit->setText(QString(comment)); +- } +- +- g_key_file_free(keyfile); +- } else { +- mHintLabel->setText(tr("desktop file not exist")); +- mHintLabel->setStyleSheet("color:red;"); +- mCertainBtn->setEnabled(false); +- } +-} +diff --git a/plugins/application/autoboot/addautoboot.h b/plugins/application/autoboot/addautoboot.h +deleted file mode 100644 +index 220fd0a..0000000 +--- a/plugins/application/autoboot/addautoboot.h ++++ /dev/null +@@ -1,98 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef ADDAUTOBOOT_H +-#define ADDAUTOBOOT_H +- +-#include <QDialog> +-#include <QFileDialog> +-#include <QPainter> +-#include <QPainterPath> +-#include <QLineEdit> +-#include <QLabel> +-#include <QVBoxLayout> +-#include "fixlabel.h" +-/* qt会将glib里的signals成员识别为宏,所以取消该宏 +- * 后面如果用到signals时,使用Q_SIGNALS代替即可 +- **/ +-#ifdef signals +-#undef signals +-#endif +- +-#include <glib.h> +-#include <glib/gstdio.h> +-#include <gio/gio.h> +-#include <gio/gdesktopappinfo.h> +- +-namespace Ui { +-class AddAutoBoot; +-} +- +-class AddAutoBoot : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit AddAutoBoot(QWidget *parent = 0); +- ~AddAutoBoot(); +- +- void resetBeforeClose(); +- +-protected: +- void paintEvent(QPaintEvent *); +- +-private: +- QString selectFile; +- QString mDesktopExec; +- QString mDesktopIcon; +- bool userEditNameFlag = false; +- bool userEditCommentFlag = false; +- +- QFrame *mAppFrame; +- QFrame *mBtnFrame; +- +- QLabel *mTitleLabel; +- FixLabel *mAppNameLabel; +- FixLabel *mAppPathLabel; +- FixLabel *mAppBewriteLabel; +- QLabel *mHintLabel; +- +- QLineEdit *mAppNameEdit; +- QLineEdit *mAppPathEdit; +- QLineEdit *mAppBewriteEdit; +- +- QPushButton *mOpenBtn; +- QPushButton *mCancelBtn; +- QPushButton *mCertainBtn; +- +-private: +- void initUi(QDialog *AddAutoBoot); +- void initStyle(); +- void initConnection(); +- void retranslateUi(); +- +-private slots: +- void open_desktop_dir_slots(); +- void execLinEditSlot(const QString &fileName); +- +-Q_SIGNALS: +- void autoboot_adding_signals(QString path, QString name, QString exec, QString comment, QString icon); +-}; +- +-#endif // ADDAUTOBOOT_H +diff --git a/plugins/application/autoboot/autoboot.cpp b/plugins/application/autoboot/autoboot.cpp +index 5e77fd8..7492a30 100644 +--- a/plugins/application/autoboot/autoboot.cpp ++++ b/plugins/application/autoboot/autoboot.cpp +@@ -31,7 +31,6 @@ + #include <QFileDialog> + #include <QMessageBox> + #include "rmenu.h" +-#include "imageutil.h" + #include "mthread.h" + + /* qt会将glib里的signals成员识别为宏,所以取消该宏 +diff --git a/plugins/application/autoboot/autoboot.h b/plugins/application/autoboot/autoboot.h +index ff3b8f8..9cebdb2 100644 +--- a/plugins/application/autoboot/autoboot.h ++++ b/plugins/application/autoboot/autoboot.h +@@ -26,7 +26,6 @@ + #include "shell/interface.h" + #include "ukcccommon.h" + using namespace ukcc; +-#include "titlelabel.h" + #include "hoverwidget.h" + #include "switchwidget.h" + #include "settinggroup.h" +diff --git a/plugins/application/autoboot/autoboot.pro b/plugins/application/autoboot/autoboot.pro +index 344233a..bbceb83 100644 +--- a/plugins/application/autoboot/autoboot.pro ++++ b/plugins/application/autoboot/autoboot.pro +@@ -4,9 +4,7 @@ + # + #------------------------------------------------- + include(../../../env.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/CloseButton/closebutton.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/AddBtn/addbtn.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) +diff --git a/plugins/application/autoboot/autobootui.cpp b/plugins/application/autoboot/autobootui.cpp +index efe6d30..08ccbf9 100644 +--- a/plugins/application/autoboot/autobootui.cpp ++++ b/plugins/application/autoboot/autobootui.cpp +@@ -12,7 +12,8 @@ void AutoBootUi::initUi() + vLyt->setSpacing(8); + vLyt->setContentsMargins(0, 0, 0, 0); + +- TitleLabel *mTitleLabel = new TitleLabel(this); ++ KLabel *mTitleLabel = new KLabel(this); ++ mTitleLabel->setContentsMargins(16, 0, 0, 0); + //~ contents_path /Autostart/Autostart Settings + mTitleLabel->setText(tr("Autostart Settings")); + +diff --git a/plugins/application/autoboot/autobootui.h b/plugins/application/autoboot/autobootui.h +index 97c2eac..74e564e 100644 +--- a/plugins/application/autoboot/autobootui.h ++++ b/plugins/application/autoboot/autobootui.h +@@ -4,12 +4,14 @@ + #include <QObject> + #include <QWidget> + +-#include "titlelabel.h" + #include "hoverwidget.h" + #include "addbutton.h" + #include "switchwidget.h" + #include "settinggroup.h" + #include "ukccframe.h" ++#include <klabel.h> ++ ++using namespace kdk; + + class AutoBootUi : public QWidget + { +diff --git a/plugins/application/defaultapp/defaultapp.h b/plugins/application/defaultapp/defaultapp.h +index b3cd5d5..9ec0518 100644 +--- a/plugins/application/defaultapp/defaultapp.h ++++ b/plugins/application/defaultapp/defaultapp.h +@@ -36,8 +36,6 @@ + + + #include "shell/interface.h" +-#include "fixlabel.h" +-#include "titlelabel.h" + #include "mthread.h" + #include "comboxwidget.h" + #include "settinggroup.h" +diff --git a/plugins/application/defaultapp/defaultappui.cpp b/plugins/application/defaultapp/defaultappui.cpp +index 0592ab8..b60a52c 100644 +--- a/plugins/application/defaultapp/defaultappui.cpp ++++ b/plugins/application/defaultapp/defaultappui.cpp +@@ -12,7 +12,8 @@ void DefaultAppUi::initUi() + vLyt->setSpacing(8); + vLyt->setContentsMargins(0, 0, 0, 0); + +- TitleLabel *mTitleLabel = new TitleLabel(this); ++ KLabel *mTitleLabel = new KLabel(this); ++ mTitleLabel->setContentsMargins(16, 0, 0, 0); + //~ contents_path /Defaultapp/Select Default Application + mTitleLabel->setText(tr("DefaultAppWindow", "Select Default Application")); + SettingGroup *mDefaultFrame = new SettingGroup(this); +diff --git a/plugins/application/defaultapp/defaultappui.h b/plugins/application/defaultapp/defaultappui.h +index ae0b9af..c6de9fb 100644 +--- a/plugins/application/defaultapp/defaultappui.h ++++ b/plugins/application/defaultapp/defaultappui.h +@@ -5,12 +5,13 @@ + #include <QWidget> + + #include "shell/interface.h" +-#include "fixlabel.h" +-#include "titlelabel.h" + #include "mthread.h" + #include "comboxwidget.h" + #include "settinggroup.h" + #include "pushbuttonwidget.h" ++#include <klabel.h> ++ ++using namespace kdk; + + class DefaultAppUi : public QWidget + { +diff --git a/plugins/devices/printer/printer.cpp b/plugins/devices/printer/printer.cpp +index c3d0868..f96af46 100644 +--- a/plugins/devices/printer/printer.cpp ++++ b/plugins/devices/printer/printer.cpp +@@ -117,7 +117,8 @@ void Printer::initUi(QWidget *widget) + QVBoxLayout *verticaLyt = new QVBoxLayout(widget); + verticaLyt->setSpacing(8); + verticaLyt->setContentsMargins(0, 0, 0, 0); +- mPrinterLabel = new TitleLabel; ++ mPrinterLabel = new KLabel; ++ mPrinterLabel->setContentsMargins(16, 0, 0, 0); + mPrinterLabel->setText(tr("Printers")); + + mPrinterWidget = new SettingGroup(widget); +diff --git a/plugins/devices/printer/printer.h b/plugins/devices/printer/printer.h +index a3a1707..b117ae1 100644 +--- a/plugins/devices/printer/printer.h ++++ b/plugins/devices/printer/printer.h +@@ -28,15 +28,13 @@ + + #include "shell/interface.h" + #include "hoverwidget.h" +-#include "imageutil.h" +-#include "hoverbtn.h" +-#include "titlelabel.h" +-#include "fixlabel.h" + #include "settinggroup.h" + #include "ukccframe.h" + #include "printerbtn.h" + #include "addbutton.h" ++#include <klabel.h> + ++using namespace kdk; + + namespace Ui { + class Printer; +@@ -74,7 +72,7 @@ private: + QWidget *pluginWidget; + SettingGroup *mPrinterWidget; + UkccFrame *mAddWidget; +- TitleLabel *mPrinterLabel; ++ KLabel *mPrinterLabel; + QStringList mPrinterList; + QVector <PrinterInfo> mPrinters; + +diff --git a/plugins/devices/printer/printer.pro b/plugins/devices/printer/printer.pro +index f8b5e76..5673ac7 100644 +--- a/plugins/devices/printer/printer.pro ++++ b/plugins/devices/printer/printer.pro +@@ -6,11 +6,9 @@ + + include(../../../env.pri) + +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/AddBtn/addbtn.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/HoverWidget/hoverwidget.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/HoverBtn/hoverbtn.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) + +diff --git a/plugins/devices/printer/printerbtn.cpp b/plugins/devices/printer/printerbtn.cpp +index 8eaba78..4c6dcf5 100644 +--- a/plugins/devices/printer/printerbtn.cpp ++++ b/plugins/devices/printer/printerbtn.cpp +@@ -5,7 +5,6 @@ + #include <QGSettings> + #include <QProcess> + +-#include "widgets/Label/fixlabel.h" + #define THEME_QT_SCHEMA "org.ukui.style" + + #define ICON_QT_KEY "icon-theme-name" +@@ -47,7 +46,7 @@ PrinterBtn::PrinterBtn(const PrinterInfo &printer, QWidget *parent): + } + }); + +- FixLabel *textLabel = new FixLabel(this); ++ KLabel *textLabel = new KLabel(this); + textLabel->setText(printerinfo.name); + + mPrinterLyt->addWidget(iconLabel); +diff --git a/plugins/devices/printer/printerbtn.h b/plugins/devices/printer/printerbtn.h +index 1a68388..d895721 100644 +--- a/plugins/devices/printer/printerbtn.h ++++ b/plugins/devices/printer/printerbtn.h +@@ -3,6 +3,10 @@ + + #include <QObject> + #include <QPushButton> ++#include <klabel.h> ++ ++using namespace kdk; ++ + struct PrinterInfo + { + QString name; +diff --git a/plugins/devices/shortcut/addshortcutdialog.cpp b/plugins/devices/shortcut/addshortcutdialog.cpp +index 9a47c7b..5b76588 100644 +--- a/plugins/devices/shortcut/addshortcutdialog.cpp ++++ b/plugins/devices/shortcut/addshortcutdialog.cpp +@@ -20,7 +20,6 @@ + + #include "addshortcutdialog.h" + #include "ui_addshortcutdialog.h" +-#include "closebutton.h" + #include "realizeshortcutwheel.h" + #include <QApplication> + #include <glib.h> +diff --git a/plugins/devices/shortcut/addshortcutdialog.h b/plugins/devices/shortcut/addshortcutdialog.h +index ebcc468..ec4f9a6 100644 +--- a/plugins/devices/shortcut/addshortcutdialog.h ++++ b/plugins/devices/shortcut/addshortcutdialog.h +@@ -29,6 +29,8 @@ + #include <QDebug> + #include "shortcutline.h" + #include <QLabel> ++#include <klabel.h> ++using namespace kdk; + + namespace Ui { + class AddShortcutDialog; +diff --git a/plugins/devices/shortcut/addshortcutdialog.ui b/plugins/devices/shortcut/addshortcutdialog.ui +index fca9575..75f392f 100644 +--- a/plugins/devices/shortcut/addshortcutdialog.ui ++++ b/plugins/devices/shortcut/addshortcutdialog.ui +@@ -71,7 +71,7 @@ + <number>8</number> + </property> + <item> +- <widget class="FixLabel" name="label_3"> ++ <widget class="KLabel" name="label_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> +@@ -157,7 +157,7 @@ + <number>8</number> + </property> + <item> +- <widget class="FixLabel" name="label_2"> ++ <widget class="KLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> +@@ -237,7 +237,7 @@ + <number>8</number> + </property> + <item> +- <widget class="FixLabel" name="label"> ++ <widget class="KLabel" name="label"> + <property name="minimumSize"> + <size> + <width>48</width> +@@ -376,16 +376,16 @@ + </layout> + </widget> + <customwidgets> +- <customwidget> +- <class>FixLabel</class> +- <extends>QLabel</extends> +- <header location="global">fixlabel.h</header> +- </customwidget> + <customwidget> + <class>kdk::KPushButton</class> + <extends>QPushButton</extends> + <header>kysdk/applications/kpushbutton.h</header> + </customwidget> ++ <customwidget> ++ <class>KLabel</class> ++ <extends>QLabel</extends> ++ <header>klabel.h</header> ++ </customwidget> + </customwidgets> + <resources/> + <connections/> +diff --git a/plugins/devices/shortcut/shortcut.pro b/plugins/devices/shortcut/shortcut.pro +index ce5c719..1d03eec 100644 +--- a/plugins/devices/shortcut/shortcut.pro ++++ b/plugins/devices/shortcut/shortcut.pro +@@ -1,10 +1,8 @@ + include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/HoverWidget/hoverwidget.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/AddBtn/addbtn.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Frame/frame.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/CloseButton/closebutton.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) + +diff --git a/plugins/devices/shortcut/shortcut.ui b/plugins/devices/shortcut/shortcut.ui +deleted file mode 100644 +index 3ac2642..0000000 +--- a/plugins/devices/shortcut/shortcut.ui ++++ /dev/null +@@ -1,160 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>Shortcut</class> +- <widget class="QWidget" name="Shortcut"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>683</width> +- <height>459</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Shortcut</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="systemLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>System Shortcut</string> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="systemLayout"/> +- </item> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>24</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="TitleLabel" name="customLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Custom Shortcut</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="verticalFrame"> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="lineWidth"> +- <number>0</number> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>1</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="customLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- </layout> +- </item> +- <item> +- <layout class="QHBoxLayout" name="addLyt"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>0</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/devices/shortcut/shortcutui.cpp b/plugins/devices/shortcut/shortcutui.cpp +index a19127b..c0d00ee 100644 +--- a/plugins/devices/shortcut/shortcutui.cpp ++++ b/plugins/devices/shortcut/shortcutui.cpp +@@ -27,7 +27,8 @@ void ShortcutUi::initUi() + + void ShortcutUi::initSystem() + { +- systemTitle = new TitleLabel(this); ++ systemTitle = new KLabel(this); ++ systemTitle->setContentsMargins(16, 0, 0, 0); + systemShortcutGroup = new SettingGroup(this); + //~ contents_path /Shortcut/System Shortcut + systemTitle->setText(tr("System Shortcut")); +@@ -38,12 +39,13 @@ void ShortcutUi::initSystem() + + void ShortcutUi::initCustom() + { +- customTitle = new TitleLabel(this); ++ customTitle = new KLabel(this); + customShortcutGroup = new SettingGroup(this); + addButton = new AddButton(this); + QHBoxLayout *layout = new QHBoxLayout(this); + //~ contents_path /Shortcut/Customize Shortcut + customTitle->setText(tr("Customize Shortcut")); ++ customTitle->setContentsMargins(16, 0, 0, 0); + customLayout->setSpacing(0); + customLayout->addWidget(customTitle); + customLayout->addSpacing(8); +@@ -139,7 +141,7 @@ void ShortcutUi::addSystemShortcut(const QString &name, const QString &shortcut, + + UkccFrame *shortCutFrame = new UkccFrame(this); + +- FixLabel *nameLabel = new FixLabel(shortCutFrame); ++ KLabel *nameLabel = new KLabel(shortCutFrame); + ClickFixLabel *bingdingLabel = new ClickFixLabel(shortCutFrame); + ClickFixLabel *bingdingLabelTwice = nullptr; + +@@ -151,7 +153,7 @@ void ShortcutUi::addSystemShortcut(const QString &name, const QString &shortcut, + QHBoxLayout *lineEditLayoutTwice = new QHBoxLayout; + + #ifndef Nile +- FixLabel *bindingLabel = new FixLabel(shortCutFrame); ++ KLabel *bindingLabel = new KLabel(shortCutFrame); + bindingLabel->setText(getShowShortcutString(shortcut)); + bindingLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + #endif +diff --git a/plugins/devices/shortcut/shortcutui.h b/plugins/devices/shortcut/shortcutui.h +index b2baadc..29369e3 100644 +--- a/plugins/devices/shortcut/shortcutui.h ++++ b/plugins/devices/shortcut/shortcutui.h +@@ -3,8 +3,6 @@ + + #include "settinggroup.h" + #include "addbutton.h" +-#include "fixlabel.h" +-#include "titlelabel.h" + #include "doubleclicklineedit.h" + #include "clickfixlabel.h" + #include "addshortcutdialog.h" +@@ -13,6 +11,9 @@ + #include <QWidget> + #include <QMenu> + #include <QMessageBox> ++#include <klabel.h> ++ ++using namespace kdk; + + class ShortcutUi : public QWidget + { +@@ -39,11 +40,11 @@ private: + QVBoxLayout *customLayout = nullptr; + + private: +- TitleLabel *systemTitle = nullptr; ++ KLabel *systemTitle = nullptr; + SettingGroup *systemShortcutGroup = nullptr; + + private: +- TitleLabel *customTitle = nullptr; ++ KLabel *customTitle = nullptr; + SettingGroup *customShortcutGroup = nullptr; + AddButton *addButton = nullptr; + +diff --git a/plugins/personalized/fonts/fonts.cpp b/plugins/personalized/fonts/fonts.cpp +index cad1b68..a70b539 100644 +--- a/plugins/personalized/fonts/fonts.cpp ++++ b/plugins/personalized/fonts/fonts.cpp +@@ -71,7 +71,7 @@ QWidget *Fonts::pluginUi() { + pluginWidget = new QWidget; + pluginWidget->setAttribute(Qt::WA_DeleteOnClose); + ui->setupUi(pluginWidget); +- ui->titleLabel->setContentsMargins(14, 0, 0, 0); ++ ui->titleLabel->setContentsMargins(16, 0, 0, 0); + + initSearchText(); + +diff --git a/plugins/personalized/fonts/fonts.h b/plugins/personalized/fonts/fonts.h +index 8c6ce38..b7038f5 100644 +--- a/plugins/personalized/fonts/fonts.h ++++ b/plugins/personalized/fonts/fonts.h +@@ -34,6 +34,7 @@ + + #include "shell/interface.h" + #include "ukcccommon.h" ++#include <klabel.h> + using namespace ukcc; + + using namespace kdk; +diff --git a/plugins/personalized/fonts/fonts.ui b/plugins/personalized/fonts/fonts.ui +index fa3c661..f758ae1 100644 +--- a/plugins/personalized/fonts/fonts.ui ++++ b/plugins/personalized/fonts/fonts.ui +@@ -39,7 +39,7 @@ + <number>0</number> + </property> + <item> +- <widget class="TitleLabel" name="titleLabel"> ++ <widget class="KLabel" name="titleLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> +@@ -123,7 +123,7 @@ + <number>0</number> + </property> + <item> +- <widget class="FixLabel" name="fontSizeLabel"> ++ <widget class="KLabel" name="fontSizeLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> +@@ -241,7 +241,7 @@ + <number>0</number> + </property> + <item> +- <widget class="FixLabel" name="fontSelectLabel"> ++ <widget class="KLabel" name="fontSelectLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> +@@ -347,7 +347,7 @@ + <number>0</number> + </property> + <item> +- <widget class="FixLabel" name="monoSelectLabel"> ++ <widget class="KLabel" name="monoSelectLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> +@@ -455,14 +455,9 @@ + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> +- <class>TitleLabel</class> ++ <class>KLabel</class> + <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- <customwidget> +- <class>FixLabel</class> +- <extends>QLabel</extends> +- <header>fixlabel.h</header> ++ <header>klabel.h</header> + </customwidget> + </customwidgets> + <resources/> +diff --git a/plugins/personalized/screenlock/screenlock.ui b/plugins/personalized/screenlock/screenlock.ui +deleted file mode 100644 +index 9e77862..0000000 +--- a/plugins/personalized/screenlock/screenlock.ui ++++ /dev/null +@@ -1,275 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>Screenlock</class> +- <widget class="QWidget" name="Screenlock"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>550</width> +- <height>700</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Screenlock</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="frame_1"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Screenlock Interface</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="previewFrame"> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QLabel" name="previewLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>300</width> +- <height>180</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>300</width> +- <height>180</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <property name="scaledContents"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="centerLayout"/> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>32</number> +- </property> +- <property name="leftMargin"> +- <number>4</number> +- </property> +- <property name="topMargin"> +- <number>8</number> +- </property> +- <property name="rightMargin"> +- <number>4</number> +- </property> +- <item> +- <widget class="QPushButton" name="browserLocalwpBtn"> +- <property name="minimumSize"> +- <size> +- <width>110</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>110</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>Browse</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="onlineBtn"> +- <property name="text"> +- <string>Online Picture</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="resetBtn"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>Reset To Default</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="topMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>8</number> +- </property> +- <item> +- <widget class="TitleLabel" name="setLabel"> +- <property name="text"> +- <string>Related Settings</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="relatedLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>0</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- <layoutdefault spacing="6" margin="11"/> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/personalized/screenlock/screenlockui.cpp b/plugins/personalized/screenlock/screenlockui.cpp +index bb525f4..8d868c8 100644 +--- a/plugins/personalized/screenlock/screenlockui.cpp ++++ b/plugins/personalized/screenlock/screenlockui.cpp +@@ -32,7 +32,8 @@ void ScreenlockUi::initUi() + + void ScreenlockUi::initScreenLock() + { +- wallpaperTitleLabel = new TitleLabel(this); ++ wallpaperTitleLabel = new KLabel(this); ++ wallpaperTitleLabel->setContentsMargins(16, 0, 0, 0); + previewFrame = new UkccFrame(this); + previewLayout = new QHBoxLayout(previewFrame); + previewLabel = new QLabel(this); +@@ -130,7 +131,8 @@ void ScreenlockUi::initScreenLock() + + void ScreenlockUi::initRelateSet() + { +- relateTitleLabel = new TitleLabel(this); ++ relateTitleLabel = new KLabel(this); ++ relateTitleLabel->setContentsMargins(16, 0, 0, 0); + relatedGroup = new SettingGroup(this); + //~ contents_path /Screenlock/Monitor Off + monitorWidget = new PushButtonWidget(tr("Monitor Off"), relatedGroup); +diff --git a/plugins/personalized/screenlock/screenlockui.h b/plugins/personalized/screenlock/screenlockui.h +index a848d99..fb3ee13 100644 +--- a/plugins/personalized/screenlock/screenlockui.h ++++ b/plugins/personalized/screenlock/screenlockui.h +@@ -1,7 +1,6 @@ + #ifndef SCREENLOCKUI_H + #define SCREENLOCKUI_H + +-#include "titlelabel.h" + #include "settinggroup.h" + #include "flowlayout.h" + #include "switchwidget.h" +@@ -11,6 +10,9 @@ + #include "pictureunit.h" + #include <QHBoxLayout> + #include <QWidget> ++#include <klabel.h> ++ ++using namespace kdk; + + class ScreenlockUi : public QWidget + { +@@ -50,7 +52,7 @@ private: + QVBoxLayout *relateLayout = nullptr; + + private: +- TitleLabel *wallpaperTitleLabel = nullptr; ++ KLabel *wallpaperTitleLabel = nullptr; + UkccFrame *previewFrame = nullptr; + QHBoxLayout *previewLayout = nullptr; + QLabel *previewLabel = nullptr; +@@ -71,7 +73,7 @@ private: + QPushButton *resetBtn = nullptr; + + private: +- TitleLabel *relateTitleLabel = nullptr; ++ KLabel *relateTitleLabel = nullptr; + SettingGroup *relatedGroup = nullptr; + PushButtonWidget *monitorWidget = nullptr; + PushButtonWidget *screensaverWidget = nullptr; +diff --git a/plugins/personalized/screensaver/screensaver.pro b/plugins/personalized/screensaver/screensaver.pro +index 1e6ed21..856f330 100644 +--- a/plugins/personalized/screensaver/screensaver.pro ++++ b/plugins/personalized/screensaver/screensaver.pro +@@ -8,7 +8,6 @@ include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/ComboBox/combobox.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Frame/frame.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/Uslider/uslider.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) + +diff --git a/plugins/personalized/screensaver/screensaver.ui b/plugins/personalized/screensaver/screensaver.ui +deleted file mode 100644 +index 9bbdfdf..0000000 +--- a/plugins/personalized/screensaver/screensaver.ui ++++ /dev/null +@@ -1,254 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>Screensaver</class> +- <widget class="QWidget" name="Screensaver"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>684</width> +- <height>560</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="sizeIncrement"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Screensaver</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Screensaver</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="viewFrame"> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="PreviewWidget" name="previewWidget" native="true"> +- <property name="minimumSize"> +- <size> +- <width>300</width> +- <height>180</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>300</width> +- <height>180</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Expanding</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="screensaverLayout"/> +- </item> +- <item> +- <widget class="QFrame" name="enableFrame"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>960</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="lineWidth"> +- <number>0</number> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="enableHorLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="FixLabel" name="enableLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>196</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>220</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>Lock screen when activating screensaver</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="comboBox"> +- <property name="minimumSize"> +- <size> +- <width>300</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>30</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>0</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- <layoutdefault spacing="6" margin="11"/> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- <customwidget> +- <class>FixLabel</class> +- <extends>QLabel</extends> +- <header>fixlabel.h</header> +- </customwidget> +- <customwidget> +- <class>PreviewWidget</class> +- <extends>QWidget</extends> +- <header>previewwidget.h</header> +- <container>1</container> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/personalized/screensaver/screensaverui.cpp b/plugins/personalized/screensaver/screensaverui.cpp +index 0c23bc1..f45526c 100644 +--- a/plugins/personalized/screensaver/screensaverui.cpp ++++ b/plugins/personalized/screensaver/screensaverui.cpp +@@ -26,7 +26,8 @@ void ScreensaverUi::initUi() + + void ScreensaverUi::initPreview() + { +- screensaverTitle = new TitleLabel(this); ++ screensaverTitle = new KLabel(this); ++ screensaverTitle->setContentsMargins(16, 0, 0, 0); + previewFrame = new UkccFrame(this); + previewLayout = new QHBoxLayout(previewFrame); + previewWidget = new PreviewWidget(this); +@@ -74,7 +75,7 @@ void ScreensaverUi::initSourceFrame() + { + UkccFrame *screensaverSourceFrame = new UkccFrame(customizeGroup, UkccFrame::BorderRadiusStyle::Around, true); + QHBoxLayout *sourceLayout = new QHBoxLayout(screensaverSourceFrame); +- FixLabel *sourceLabel = new FixLabel(); ++ KLabel *sourceLabel = new KLabel(); + + sourcePathLine = new QLineEdit(); + sourceButton = new QPushButton(); +@@ -99,7 +100,7 @@ void ScreensaverUi::initSwitchModeFrame() + { + UkccFrame *pictureSwitchFrame = new UkccFrame(customizeGroup, UkccFrame::BorderRadiusStyle::Around, true); + QHBoxLayout *randomLayout = new QHBoxLayout(pictureSwitchFrame); +- FixLabel *randomLabel = new FixLabel(); ++ KLabel *randomLabel = new KLabel(); + QRadioButton *radioOrder = new QRadioButton(); + QRadioButton *radioRand = new QRadioButton(); + +@@ -129,7 +130,7 @@ void ScreensaverUi::initSwitchTimeFrame() + { + UkccFrame *timeSetFrame = new UkccFrame(customizeGroup, UkccFrame::BorderRadiusStyle::Around, true); + QHBoxLayout *timeSetLayout = new QHBoxLayout(); +- FixLabel *timeSetLabel = new FixLabel(); ++ KLabel *timeSetLabel = new KLabel(); + + switchTimeComboBox = new QComboBox(); + +@@ -149,7 +150,7 @@ void ScreensaverUi::initCustomTextFrame() + { + UkccFrame *showTextFrame = new UkccFrame(customizeGroup, UkccFrame::BorderRadiusStyle::Around, true); + QHBoxLayout *showTextLayout = new QHBoxLayout(); +- FixLabel *showLabel = new FixLabel(); ++ KLabel *showLabel = new KLabel(); + + textLineEdit = new QLineEdit(); //用户输入文字 + showTextFrame->setLayout(showTextLayout); +@@ -168,7 +169,7 @@ void ScreensaverUi::initTextPositionFrame() + { + UkccFrame *showTextSetFrame = new UkccFrame(customizeGroup, UkccFrame::BorderRadiusStyle::Around, true); + QHBoxLayout *textSetLayout = new QHBoxLayout(showTextSetFrame); +- FixLabel *textSetLabel = new FixLabel(); ++ KLabel *textSetLabel = new KLabel(); + QRadioButton *radioRandom = new QRadioButton(this); + QRadioButton *radioCenter = new QRadioButton(this); + +@@ -198,7 +199,7 @@ void ScreensaverUi::initBreakTimeFrame() + { + UkccFrame *showTimeFrame = new UkccFrame(screensaverGroup, UkccFrame::BorderRadiusStyle::Around, true); + QHBoxLayout *showTimeLayout = new QHBoxLayout(showTimeFrame); +- FixLabel *showTimeLabel = new FixLabel(); ++ KLabel *showTimeLabel = new KLabel(); + + showTimeLayout->setContentsMargins(16,0,16,0); + showTimeLayout->addWidget(showTimeLabel); +@@ -219,7 +220,7 @@ void ScreensaverUi::initScreenlockFrame() + { + UkccFrame *lockFrame = new UkccFrame(screensaverGroup, UkccFrame::BorderRadiusStyle::Around, true);; + QHBoxLayout *lockLayout = new QHBoxLayout(lockFrame); +- FixLabel *lockLabel = new FixLabel(); ++ KLabel *lockLabel = new KLabel(); + //~ contents_path /Screensaver/Lock screen when screensaver boot + lockLabel->setText(tr("Lock screen when screensaver boot")); + lockLabel->setFixedWidth(400); +diff --git a/plugins/personalized/screensaver/screensaverui.h b/plugins/personalized/screensaver/screensaverui.h +index 5cf7461..fd36cf9 100644 +--- a/plugins/personalized/screensaver/screensaverui.h ++++ b/plugins/personalized/screensaver/screensaverui.h +@@ -1,7 +1,6 @@ + #ifndef SCREENSAVERUI_H + #define SCREENSAVERUI_H + +-#include "titlelabel.h" + #include "settinggroup.h" + #include "switchwidget.h" + #include "pushbuttonwidget.h" +@@ -15,6 +14,9 @@ + #include <QFileDialog> + #include <QButtonGroup> + #include <QFileSystemWatcher> ++#include <klabel.h> ++ ++using namespace kdk; + + class ScreensaverUi : public QWidget + { +@@ -56,7 +58,7 @@ private: + QVBoxLayout *uiLayout = nullptr; + + private: +- TitleLabel *screensaverTitle = nullptr; ++ KLabel *screensaverTitle = nullptr; + UkccFrame *previewFrame = nullptr; + QHBoxLayout *previewLayout = nullptr; + PreviewWidget *previewWidget = nullptr; +diff --git a/plugins/personalized/theme/theme.cpp b/plugins/personalized/theme/theme.cpp +index 31dcc63..8e65b3e 100644 +--- a/plugins/personalized/theme/theme.cpp ++++ b/plugins/personalized/theme/theme.cpp +@@ -26,9 +26,6 @@ + #include <QtDBus/QDBusConnection> + #include <QtConcurrent> + #include <QRadioButton> +- +-#include "iconlabel.h" +- + #include "cursor/xcursortheme.h" + #include "../../../shell/customstyle.h" + #include "ukcccommon.h" +@@ -179,7 +176,8 @@ void Theme::initThemeUi() + mThemeModeFrame->setFrameShape(QFrame::Shape::Box); + + FlowLayout *hLyt = new FlowLayout(mThemeModeFrame, 20, 40, 24); +- mThemeModeLabel = new TitleLabel(mThemeModeFrame); ++ mThemeModeLabel = new KLabel(mThemeModeFrame); ++ mThemeModeLabel->setContentsMargins(16, 0, 0, 0); + + mLightBtn = new ThemeButton(tr("Light"), QPixmap(QString("://img/plugins/theme/%1.png").arg("light")), mThemeModeFrame); + mLightBtn->setObjectName("lighttheme"); +@@ -210,7 +208,8 @@ void Theme::initThemeUi() + ui->thememodeLayout->addSpacing(8); + ui->thememodeLayout->addWidget(mThemeModeFrame); + +- mEffectLabel = new TitleLabel(pluginWidget); ++ mEffectLabel = new KLabel(pluginWidget); ++ mEffectLabel->setContentsMargins(16, 0, 0, 0); + //~ contents_path /Theme/Effect setting + mEffectLabel->setText(tr("Effect setting")); + +@@ -355,7 +354,8 @@ void Theme::initIconTheme() { + + FlowLayout *fLyt = new FlowLayout(mThemeIconFrame, 0, 40, 0); + fLyt->setContentsMargins(16, 16, 0, 4); +- mThemeIconLabel = new TitleLabel(); ++ mThemeIconLabel = new KLabel(); ++ mThemeIconLabel->setContentsMargins(16, 0, 0, 0); + + // 构建图标主题Widget Group,方便更新选中/非选中状态 + mThemeIconBtnGroup = new QButtonGroup; +@@ -419,7 +419,8 @@ void Theme::initControlTheme() + mControlMap.insert("dustGold", QColor(255, 217, 102)); + mControlMap.insert("polarGreen", QColor(82, 196, 41)); + +- mControlLabel = new TitleLabel(); ++ mControlLabel = new KLabel(); ++ mControlLabel->setContentsMargins(16, 0, 0, 0); + mControlLabel->setMaximumWidth(100); + //~ contents_path /Theme/Corlor + mControlLabel->setText(tr("Corlor")); +@@ -477,7 +478,8 @@ void Theme::initCursorTheme(){ + FlowLayout *fLyt = new FlowLayout(mThemeCursorFrame, 0, 40, 0); + fLyt->setContentsMargins(16, 16, 0, 4); + +- mThemeCursorLabel = new TitleLabel(mThemeCursorFrame); ++ mThemeCursorLabel = new KLabel(mThemeCursorFrame); ++ mThemeCursorLabel->setContentsMargins(16, 0, 0, 0); + + QStringList cursorThemes = getSystemCursorThemes(); + +@@ -532,7 +534,8 @@ void Theme::initGlobalTheme() + + mFLyt = new FlowLayout(mSwitchFrame, 0, 40, 0); + mFLyt->setContentsMargins(16, 16, 0, 4); +- mSwitchLabel = new TitleLabel(); ++ mSwitchLabel = new KLabel(); ++ mSwitchLabel->setContentsMargins(16, 0, 0, 0); + mSwitchLabel->setText(tr("Theme")); + + ui->switchLyt->addWidget(mSwitchLabel); +@@ -604,7 +607,8 @@ QList<GlobalTheme *> Theme::sortGlobalTheme(const QList<GlobalTheme *> &globalTh + + void Theme::initJumpTheme() + { +- mJumpLabel = new TitleLabel(pluginWidget); ++ mJumpLabel = new KLabel(pluginWidget); ++ mJumpLabel->setContentsMargins(16, 0, 0, 0); + + //~ contents_path /Theme/Other + mJumpLabel->setText(tr("Other")); +diff --git a/plugins/personalized/theme/theme.h b/plugins/personalized/theme/theme.h +index 9366e81..47cf994 100644 +--- a/plugins/personalized/theme/theme.h ++++ b/plugins/personalized/theme/theme.h +@@ -38,8 +38,6 @@ + #include <libkysettings.h> + #endif + +-#include "uslider.h" +-#include "titlelabel.h" + #include "flowlayout.h" + #include "icontheme.h" + +@@ -56,6 +54,7 @@ + #include "switchwidget.h" + #include "sliderwidget.h" + #include "comboxwidget.h" ++#include <klabel.h> + + using namespace kdk; + +@@ -99,13 +98,13 @@ private: + WidgetGroup *cursorThemeWidgetGroup; + WidgetGroup *iconThemeWidgetGroup; + +- TitleLabel *mSwitchLabel; +- TitleLabel *mControlLabel; +- TitleLabel *mJumpLabel; +- TitleLabel *mThemeModeLabel; +- TitleLabel *mThemeIconLabel; +- TitleLabel *mThemeCursorLabel = nullptr; +- TitleLabel *mEffectLabel; ++ KLabel *mSwitchLabel; ++ KLabel *mControlLabel; ++ KLabel *mJumpLabel; ++ KLabel *mThemeModeLabel; ++ KLabel *mThemeIconLabel; ++ KLabel *mThemeCursorLabel = nullptr; ++ KLabel *mEffectLabel; + + ThemeButton *mCustomPicUnit = nullptr; + ThemeButton *mPrePicUnit = nullptr; +diff --git a/plugins/personalized/theme/theme.pro b/plugins/personalized/theme/theme.pro +index 7bc7af4..fef836a 100644 +--- a/plugins/personalized/theme/theme.pro ++++ b/plugins/personalized/theme/theme.pro +@@ -6,7 +6,6 @@ + include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/FlowLayout/flowlayout.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/Uslider/uslider.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) + +diff --git a/plugins/personalized/theme/themewidget.cpp b/plugins/personalized/theme/themewidget.cpp +index 137a431..a95284b 100644 +--- a/plugins/personalized/theme/themewidget.cpp ++++ b/plugins/personalized/theme/themewidget.cpp +@@ -65,7 +65,7 @@ ThemeWidget::ThemeWidget(QSize iSize, QString name, QStringList iStringList, QWi + selectedLabel->setPixmap(selectIcon.pixmap(selectIcon.actualSize(QSize(16, 16)))); + }); + +- FixLabel * nameLabel = new FixLabel(this); ++ KLabel * nameLabel = new KLabel(this); + QSizePolicy nameSizePolicy = nameLabel->sizePolicy(); + nameSizePolicy.setHorizontalPolicy(QSizePolicy::Fixed); + nameSizePolicy.setVerticalPolicy(QSizePolicy::Fixed); +@@ -132,7 +132,7 @@ ThemeWidget::ThemeWidget(QSize iSize, QString name, const QList<QPixmap> &listMa + selectedLabel->setPixmap(selectIcon.pixmap(selectIcon.actualSize(QSize(16, 16)))); + }); + +- FixLabel * nameLabel = new FixLabel(this); ++ KLabel * nameLabel = new KLabel(this); + QSizePolicy nameSizePolicy = nameLabel->sizePolicy(); + nameSizePolicy.setHorizontalPolicy(QSizePolicy::Preferred); + nameSizePolicy.setVerticalPolicy(QSizePolicy::Fixed); +diff --git a/plugins/personalized/theme/themewidget.h b/plugins/personalized/theme/themewidget.h +index aa66bb2..008016b 100644 +--- a/plugins/personalized/theme/themewidget.h ++++ b/plugins/personalized/theme/themewidget.h +@@ -27,7 +27,9 @@ + #include <QRadioButton> + #include <QFrame> + #include <QGSettings> +-#include "fixlabel.h" ++#include <klabel.h> ++ ++using namespace kdk; + + #define THEME_QT_SCHEMA "org.ukui.style" + +diff --git a/plugins/personalized/wallpaper/colordialog.cpp b/plugins/personalized/wallpaper/colordialog.cpp +index 5d305cc..492007b 100644 +--- a/plugins/personalized/wallpaper/colordialog.cpp ++++ b/plugins/personalized/wallpaper/colordialog.cpp +@@ -21,7 +21,6 @@ + #include "ui_colordialog.h" + #include "colorsquare.h" + #include "maskwidget.h" +-#include "closebutton.h" + #include <QRegExp> + + extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +diff --git a/plugins/personalized/wallpaper/wallpaper.pro b/plugins/personalized/wallpaper/wallpaper.pro +index 553a482..51f972a 100644 +--- a/plugins/personalized/wallpaper/wallpaper.pro ++++ b/plugins/personalized/wallpaper/wallpaper.pro +@@ -7,9 +7,7 @@ include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/AddBtn/addbtn.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/MaskWidget/maskwidget.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/CloseButton/closebutton.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/FlowLayout/flowlayout.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/HoverWidget/hoverwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) +diff --git a/plugins/personalized/wallpaper/wallpaper.ui b/plugins/personalized/wallpaper/wallpaper.ui +deleted file mode 100644 +index 6d5ef7f..0000000 +--- a/plugins/personalized/wallpaper/wallpaper.ui ++++ /dev/null +@@ -1,387 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>Wallpaper</class> +- <widget class="QWidget" name="Wallpaper"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>846</width> +- <height>479</height> +- </rect> +- </property> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Wallpaper</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QWidget" name="wallpaperWidget" native="true"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Desktop Background</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QStackedWidget" name="previewStackedWidget"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>212</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>212</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="currentIndex"> +- <number>0</number> +- </property> +- <widget class="QWidget" name="pPicturePage"> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="PictureLabel" name="previewLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>300</width> +- <height>180</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>300</width> +- <height>180</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- <widget class="QWidget" name="pColorPage"> +- <layout class="QHBoxLayout" name="horizontalLayout_10"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_9"> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QWidget" name="previewWidget" native="true"> +- <property name="minimumSize"> +- <size> +- <width>300</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>300</width> +- <height>16777215</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="centerLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="bottomWidget" native="true"> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <property name="spacing"> +- <number>32</number> +- </property> +- <property name="leftMargin"> +- <number>4</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>4</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QPushButton" name="browserLocalwpBtn"> +- <property name="minimumSize"> +- <size> +- <width>110</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>110</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>Browse</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="onlineBtn"> +- <property name="text"> +- <string>Online Picture</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="resetBtn"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>Reset To Default</string> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>0</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- <layoutdefault spacing="6" margin="11"/> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- <customwidget> +- <class>PictureLabel</class> +- <extends>QLabel</extends> +- <header>picturelabel.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/personalized/wallpaper/wallpaperui.cpp b/plugins/personalized/wallpaper/wallpaperui.cpp +index 6c3eb18..8a9a212 100644 +--- a/plugins/personalized/wallpaper/wallpaperui.cpp ++++ b/plugins/personalized/wallpaper/wallpaperui.cpp +@@ -21,7 +21,8 @@ WallpaperUi::~WallpaperUi() + + void WallpaperUi::createObject() + { +- wallpaperTitleLabel = new TitleLabel(this); ++ wallpaperTitleLabel = new KLabel(this); ++ wallpaperTitleLabel->setContentsMargins(16, 0, 0, 0); + previewLabel = new PreviewLabel(this); + settingGroup = new SettingGroup(this); + //~ contents_path /Wallpaper/Background +diff --git a/plugins/personalized/wallpaper/wallpaperui.h b/plugins/personalized/wallpaper/wallpaperui.h +index 13bf97c..3af4f4a 100644 +--- a/plugins/personalized/wallpaper/wallpaperui.h ++++ b/plugins/personalized/wallpaper/wallpaperui.h +@@ -2,8 +2,6 @@ + #define WALLPAPERUI_H + + #include "previewlabel.h" +-#include "titlelabel.h" +-#include "fixlabel.h" + #include "settinggroup.h" + #include "ukccframe.h" + #include "addbutton.h" +@@ -16,6 +14,9 @@ + #include <QLineEdit> + #include <QRadioButton> + #include <QButtonGroup> ++#include <klabel.h> ++ ++using namespace kdk; + + class WallpaperUi : public QWidget + { +@@ -48,7 +49,7 @@ private: + QVBoxLayout *uiLayout = nullptr; + + private: +- TitleLabel *wallpaperTitleLabel = nullptr; ++ KLabel *wallpaperTitleLabel = nullptr; + PreviewLabel *previewLabel = nullptr; + + private: +diff --git a/plugins/plugins.pro b/plugins/plugins.pro +index 1c4881d..5be6ac0 100644 +--- a/plugins/plugins.pro ++++ b/plugins/plugins.pro +@@ -25,10 +25,6 @@ SUBDIRS += devices/shortcut \ + security-updates/backup \ + } + +-if(contains(DEFINES, PANGUW)){ +-SUBDIRS += system/display_hw \ +-} +- + if(contains(DEFINES, MAVIS)){ + SUBDIRS += system/display \ + system/backup_intel \ +diff --git a/plugins/system/about/about.cpp b/plugins/system/about/about.cpp +index 64cfa1f..05965c7 100644 +--- a/plugins/system/about/about.cpp ++++ b/plugins/system/about/about.cpp +@@ -405,9 +405,9 @@ void About::setupDiskCompenet() + mAboutWidget->getDiskLabel()->hide(); + mAboutWidget->getDiskContent()->hide(); + QHBoxLayout * layout = new QHBoxLayout; +- QLabel *label = new FixLabel; ++ QLabel *label = new KLabel; + label->setText(tr("Disk") + QString::number(count + 1)); +- QLabel *diskLabel = new FixLabel; ++ QLabel *diskLabel = new KLabel; + diskLabel->setText(iter.value().at(0) + "B (" + iter.value().at(1) + "B "+ tr("avaliable") +")"); + + layout->addWidget(label); +diff --git a/plugins/system/about/about.h b/plugins/system/about/about.h +index 7fbcd5b..82f5575 100644 +--- a/plugins/system/about/about.h ++++ b/plugins/system/about/about.h +@@ -47,8 +47,6 @@ using namespace ukcc; + #include "statusdialog.h" + + #include "shell/interface.h" +-#include "titlelabel.h" +-#include "fixlabel.h" + #include "lightlabel.h" + #include "kswitchbutton.h" + #include <kysdk/kysdk-system/libkysysinfo.h> +diff --git a/plugins/system/about/aboutui.cpp b/plugins/system/about/aboutui.cpp +index cb6f456..104950c 100644 +--- a/plugins/system/about/aboutui.cpp ++++ b/plugins/system/about/aboutui.cpp +@@ -27,13 +27,16 @@ void AboutUi::initUi() + AboutLayout->setContentsMargins(0, 0, 0, 0); + AboutLayout->setSpacing(8); + +- mTitleLabel = new TitleLabel(Aboutwidget); ++ mTitleLabel = new KLabel(Aboutwidget); ++ mTitleLabel->setContentsMargins(16, 0, 0, 0); + //~ contents_path /About/System Summary + mTitleLabel->setText(tr("System Summary")); +- mPriTitleLabel = new TitleLabel(Aboutwidget); ++ mPriTitleLabel = new KLabel(Aboutwidget); ++ mPriTitleLabel->setContentsMargins(16, 0, 0, 0); + //~ contents_path /About/Privacy and agreement + mPriTitleLabel->setText(tr("Privacy and agreement")); +- mHoldTitleLabel = new TitleLabel(Aboutwidget); ++ mHoldTitleLabel = new KLabel(Aboutwidget); ++ mHoldTitleLabel->setContentsMargins(16, 0, 0, 0); + mHoldTitleLabel->setText(tr("Support")); + + mInformationFrame = new QFrame(Aboutwidget); +@@ -44,38 +47,44 @@ void AboutUi::initUi() + mInformationLayout->setContentsMargins(space, space, space, space); + + /* LOGO */ +- mLogoLabel = new FixLabel(mInformationFrame); ++ mLogoLabel = new QLabel(mInformationFrame); + mLogoLabel->setFixedSize(130, 50); + + /* 版本名称 */ +- mVersionLabel_1 = new FixLabel(tr("Version")); ++ mVersionLabel_1 = new KLabel(this); ++ mVersionLabel_1->setText(tr("Version")); + mVersionLabel_2 = new LightLabel; + mVersionFrame = createFrame(mVersionLabel_1, mVersionLabel_2); + + /* 版本号 */ +- mVersionNumberLabel_1 = new FixLabel(tr("Version Number")); ++ mVersionNumberLabel_1 = new KLabel(this); ++ mVersionNumberLabel_1->setText(tr("Version Number")); + mVersionNumberLabel_2 = new LightLabel; + mVersionNumberFrame = createFrame(mVersionNumberLabel_1, mVersionNumberLabel_2); + + /* 系统补丁版本号 */ +- mPatchVersionLabel_1 = new FixLabel(tr("Patch Version")); ++ mPatchVersionLabel_1 = new KLabel(this); ++ mPatchVersionLabel_1->setText(tr("Patch Version")); + mPatchVersionLabel_2 = new LightLabel; + mPatchVersionFrame = createFrame(mPatchVersionLabel_1, mPatchVersionLabel_2); + + /* 安装日期 */ +- mInstallDateLabel_1 = new FixLabel(tr("Installed Date")); ++ mInstallDateLabel_1 = new KLabel(this); ++ mInstallDateLabel_1->setText(tr("Installed Date")); + mInstallDateLabel_2 = new LightLabel; + mInstallDateFrame = createFrame(mInstallDateLabel_1, mInstallDateLabel_2); + + /* 系统更新时间 */ +- mUpgradeDateLabel_1 = new FixLabel(tr("Upgrade Date")); ++ mUpgradeDateLabel_1 = new KLabel(this); ++ mUpgradeDateLabel_1->setText(tr("Upgrade Date")); + mUpgradeDateLabel_2 = new LightLabel; + mUpgradeDateFrame = createFrame(mUpgradeDateLabel_1, mUpgradeDateLabel_2); + + + /* 主机名 */ + //~ contents_path /About/HostName +- mHostNameLabel_1 = new FixLabel(tr("HostName")); ++ mHostNameLabel_1 = new KLabel(this); ++ mHostNameLabel_1->setText(tr("HostName")); + mHostNameLabel_2 = new LightLabel; + mHostNameLabel_3 = new LightLabel; + mHostNameLabel_3->setFixedSize(16, 16); +@@ -87,32 +96,38 @@ void AboutUi::initUi() + mHostNameFrame = createFrame(mHostNameLabel_1, mHostNameLabel_2, mHostNameLabel_3); + + /* 内核 */ +- mKernelLabel_1 = new FixLabel(tr("Kernel")); ++ mKernelLabel_1 = new KLabel(this); ++ mKernelLabel_1->setText(tr("Kernel")); + mKernelLabel_2 = new LightLabel; + mKernelFrame = createFrame(mKernelLabel_1, mKernelLabel_2); + + /* CPU */ +- mCpuLabel_1 = new FixLabel(tr("CPU")); ++ mCpuLabel_1 = new KLabel(this); ++ mCpuLabel_1->setText(tr("CPU")); + mCpuLabel_2 = new LightLabel; + mCpuFrame = createFrame(mCpuLabel_1, mCpuLabel_2); + + /* 内存 */ +- mMemoryLabel_1 = new FixLabel(tr("Memory")); ++ mMemoryLabel_1 = new KLabel(this); ++ mMemoryLabel_1->setText(tr("Memory")); + mMemoryLabel_2 = new LightLabel; + mMemoryFrame = createFrame(mMemoryLabel_1, mMemoryLabel_2); + + /* 硬盘 */ +- mDiskLabel_1 = new FixLabel(tr("Disk")); ++ mDiskLabel_1 = new KLabel(this); ++ mDiskLabel_1->setText(tr("Disk")); + mDiskLabel_2 = new LightLabel; + mDiskFrame = createFrame(mDiskLabel_1, mDiskLabel_2); + + /* 桌面 */ +- mDesktopLabel_1 = new FixLabel(tr("Desktop")); ++ mDesktopLabel_1 = new KLabel(this); ++ mDesktopLabel_1->setText(tr("Desktop")); + mDesktopLabel_2 = new LightLabel; + mDesktopFrame = createFrame(mDesktopLabel_1, mDesktopLabel_2); + + /* 用户名 */ +- mUsernameLabel_1 = new FixLabel(tr("User")); ++ mUsernameLabel_1 = new KLabel(this); ++ mUsernameLabel_1->setText(tr("User")); + mUsernameLabel_2 = new LightLabel; + mUsernameFrame = createFrame(mUsernameLabel_1, mUsernameLabel_2); + +@@ -120,7 +135,8 @@ void AboutUi::initUi() + mActivationFrame = initActiveUi(); + + /* 版权所有 */ +- mTipLabel = new FixLabel(QString(tr("Copyright ©%1 %2. All rights reserved.").arg(mCopyRightYear).arg(mCopyRightName)), Aboutwidget); ++ mTipLabel = new KLabel(Aboutwidget); ++ mTipLabel->setText(QString(tr("Copyright ©%1 %2. All rights reserved.").arg(mCopyRightYear).arg(mCopyRightName))); + mTipLabel->setContentsMargins(16, 0, 0, 0); + + /* 隐私和协议 */ +@@ -174,7 +190,7 @@ void AboutUi::initCopyRightName() + } + } + +-QFrame *AboutUi::createFrame(FixLabel *label_1, LightLabel *label_2, LightLabel *label_3) ++QFrame *AboutUi::createFrame(KLabel *label_1, LightLabel *label_2, LightLabel *label_3) + { + QFrame *frame = new QFrame; + frame->installEventFilter(this); +@@ -227,7 +243,7 @@ QFrame *AboutUi::initHoldUi() + + mHpLabel = new QLabel; + mEducateLabel = new QLabel; +- mEducateIconLabel = new FixLabel; ++ mEducateIconLabel = new KLabel; + mEducateIconLabel->setFixedSize(96,96); + + mHpLabel->setWordWrap(true); +@@ -301,10 +317,10 @@ QFrame *AboutUi::initActiveUi() + QGridLayout *mActivationLayout = new QGridLayout(); + mActivationLayout->setVerticalSpacing(8); + +- mStatusLabel_1 = new FixLabel; ++ mStatusLabel_1 = new KLabel; + mStatusLabel_1->setFixedSize(196, 30); + mStatusLabel_2 = new LightLabel; +- mSequenceLabel_1 = new FixLabel; ++ mSequenceLabel_1 = new KLabel; + mSequenceLabel_1->setFixedSize(196, 30); + mSequenceLabel_2 = new KBorderlessButton; + mSequenceLabel_2->setObjectName("sequence"); +@@ -336,7 +352,8 @@ QFrame *AboutUi::initPrivacyUi() + mPriBtn = new KSwitchButton(frame); + mPriBtn->setObjectName("privacysettings"); + //~ contents_path /About/Send optional diagnostic data +- FixLabel *mPriLabel_1 = new FixLabel(tr("Send optional diagnostic data")); ++ KLabel *mPriLabel_1 = new KLabel(this); ++ mPriLabel_1->setText(tr("Send optional diagnostic data")); + LightLabel *mPriLabel_2 = new LightLabel(tr("By sending us diagnostic data, improve the system experience and solve your problems faster")); + QVBoxLayout *mverticalLayout_2 = new QVBoxLayout; + mverticalLayout_2->setSpacing(0); +@@ -361,7 +378,8 @@ QFrame *AboutUi::initInfoBtnUi() + mBtnLyt->setContentsMargins(16, 0, 0, 0); + //~ contents_path /About/<<Protocol>> + mTrialBtn = new KBorderlessButton(tr("<<Protocol>>")); +- mAndLabel = new FixLabel(tr("and")); ++ mAndLabel = new KLabel(this); ++ mAndLabel->setText(tr("and")); + //~ contents_path /About/<<Privacy>> + mAgreeBtn = new KBorderlessButton(tr("<<Privacy>>")); + mTrialBtn->setStyleSheet("text-decoration:underline"); +diff --git a/plugins/system/about/aboutui.h b/plugins/system/about/aboutui.h +index 504c133..bed61a9 100644 +--- a/plugins/system/about/aboutui.h ++++ b/plugins/system/about/aboutui.h +@@ -11,12 +11,11 @@ + #include "privacydialog.h" + #include "statusdialog.h" + #include "shell/interface.h" +-#include "titlelabel.h" +-#include "fixlabel.h" + #include "lightlabel.h" + #include "kswitchbutton.h" + #include <kysdk/kysdk-system/libkysysinfo.h> + #include <kborderlessbutton.h> ++#include <klabel.h> + + using namespace ukcc; + using namespace kdk; +@@ -63,9 +62,9 @@ public: + LightLabel *getUpgradeDate() {return mUpgradeDateLabel_2;} + LightLabel *getEditHost() {return mHostNameLabel_3;} + +- FixLabel *getSequence() {return mSequenceLabel_1;} ++ KLabel *getSequence() {return mSequenceLabel_1;} + KBorderlessButton *getSequenceContent() {return mSequenceLabel_2;} +- FixLabel *getDiskLabel() {return mDiskLabel_1;} ++ KLabel *getDiskLabel() {return mDiskLabel_1;} + + QFrame *getBuildFrame() {return mVersionNumberFrame;} + QFrame *getPatchFrame() {return mPatchVersionFrame;} +@@ -79,7 +78,7 @@ public: + + + private: +- QFrame *createFrame(FixLabel *label_1, LightLabel *label_2, LightLabel *label_3 = nullptr); ++ QFrame *createFrame(KLabel *label_1, LightLabel *label_2, LightLabel *label_3 = nullptr); + void setShape(QFrame *frame, QFrame::Shape shape); + QPixmap loadSvg(const QString &path, int width, int height); + +@@ -87,9 +86,9 @@ private: + QFrame *mHoldWidget; + QWidget *mQrCodeWidget; + +- TitleLabel *mTitleLabel; +- TitleLabel *mPriTitleLabel; +- TitleLabel *mHoldTitleLabel; ++ KLabel *mTitleLabel; ++ KLabel *mPriTitleLabel; ++ KLabel *mHoldTitleLabel; + + QFrame *mInformationFrame; + QFrame *mActivationFrame; +@@ -112,21 +111,21 @@ private: + + QHBoxLayout *mDiskLayout; + +- FixLabel *mLogoLabel; +- FixLabel *mVersionLabel_1; +- FixLabel *mVersionNumLabel_1; +- FixLabel *mVersionNumberLabel_1; +- FixLabel *mPatchVersionLabel_1; +- FixLabel *mInstallDateLabel_1; +- FixLabel *mUpgradeDateLabel_1; +- FixLabel *mInterVersionLabel_1; +- FixLabel *mHostNameLabel_1; +- FixLabel *mKernelLabel_1; +- FixLabel *mCpuLabel_1; +- FixLabel *mMemoryLabel_1; +- FixLabel *mDiskLabel_1; +- FixLabel *mDesktopLabel_1; +- FixLabel *mUsernameLabel_1; ++ QLabel *mLogoLabel; ++ KLabel *mVersionLabel_1; ++ KLabel *mVersionNumLabel_1; ++ KLabel *mVersionNumberLabel_1; ++ KLabel *mPatchVersionLabel_1; ++ KLabel *mInstallDateLabel_1; ++ KLabel *mUpgradeDateLabel_1; ++ KLabel *mInterVersionLabel_1; ++ KLabel *mHostNameLabel_1; ++ KLabel *mKernelLabel_1; ++ KLabel *mCpuLabel_1; ++ KLabel *mMemoryLabel_1; ++ KLabel *mDiskLabel_1; ++ KLabel *mDesktopLabel_1; ++ KLabel *mUsernameLabel_1; + LightLabel *mVersionLabel_2; + LightLabel *mVersionNumLabel_2; + LightLabel *mVersionNumberLabel_2; +@@ -144,17 +143,17 @@ private: + LightLabel *mUsernameLabel_2; + + +- FixLabel *mStatusLabel_1; ++ KLabel *mStatusLabel_1; + LightLabel *mStatusLabel_2; +- FixLabel *mSequenceLabel_1; ++ KLabel *mSequenceLabel_1; + KBorderlessButton *mSequenceLabel_2; +- FixLabel *mTrialLabel; +- FixLabel *mAndLabel; +- FixLabel *mAgreeLabel; ++ KLabel *mTrialLabel; ++ KLabel *mAndLabel; ++ KLabel *mAgreeLabel; + QLabel *mHpLabel; +- FixLabel *mEducateIconLabel; ++ KLabel *mEducateIconLabel; + QLabel *mEducateLabel; +- FixLabel *mTipLabel; ++ KLabel *mTipLabel; + + QPushButton *mActivationBtn; + QPushButton *mHpBtn; +diff --git a/plugins/system/about/privacydialog.cpp b/plugins/system/about/privacydialog.cpp +index 05e628d..3716733 100644 +--- a/plugins/system/about/privacydialog.cpp ++++ b/plugins/system/about/privacydialog.cpp +@@ -3,6 +3,7 @@ + #include <QDebug> + #include <QVBoxLayout> + #include <QHBoxLayout> ++#include <QLabel> + + PrivacyDialog::PrivacyDialog(QWidget *parent) : + QDialog(parent) +diff --git a/plugins/system/about/privacydialog.h b/plugins/system/about/privacydialog.h +index 9fbc823..95f7d7d 100644 +--- a/plugins/system/about/privacydialog.h ++++ b/plugins/system/about/privacydialog.h +@@ -8,7 +8,6 @@ + #include <QString> + #include <QTextBrowser> + +-#include "titlelabel.h" + #include "ukcccommon.h" + + using namespace ukcc; +diff --git a/plugins/system/about/statusdialog.cpp b/plugins/system/about/statusdialog.cpp +index 4060c82..1e4704f 100644 +--- a/plugins/system/about/statusdialog.cpp ++++ b/plugins/system/about/statusdialog.cpp +@@ -33,7 +33,7 @@ void StatusDialog::initUI() + mVersionFrame->setFixedHeight(36); + mVersionFrame->setFrameShape(QFrame::NoFrame); + mVersionLabel_1 = new QLabel(mVersionFrame); +- mVersionLabel_2 = new FixLabel(mVersionFrame); ++ mVersionLabel_2 = new KLabel(mVersionFrame); + mVersionLabel_1->setFixedWidth(100); + mVersionLyt->addWidget(mVersionLabel_1); + mVersionLyt->addWidget(mVersionLabel_2); +@@ -44,7 +44,7 @@ void StatusDialog::initUI() + mStatusLyt->setSpacing(16); + mStatusFrame->setFixedHeight(36); + mStatusFrame->setFrameShape(QFrame::NoFrame); +- mStatusLabel_1 = new FixLabel(mStatusFrame); ++ mStatusLabel_1 = new KLabel(mStatusFrame); + mStatusLabel_2 = new QLabel(mStatusFrame); + mStatusLabel_1->setFixedWidth(100); + mStatusLyt->addWidget(mStatusLabel_1); +@@ -56,8 +56,9 @@ void StatusDialog::initUI() + mActivationLyt->setSpacing(16); + mActivationFrame->setFixedHeight(36); + mActivationFrame->setFrameShape(QFrame::NoFrame); +- mActivationCodeLabel_1 = new FixLabel(tr("Activation Code"), mActivationFrame); +- mActivationCodeLabel_2 = new FixLabel(mActivationFrame); ++ mActivationCodeLabel_1 = new KLabel(mActivationFrame); ++ mActivationCodeLabel_1->setText(tr("Activation Code")); ++ mActivationCodeLabel_2 = new KLabel(mActivationFrame); + mActivationCodeLabel_1->setFixedWidth(100); + mActivationLyt->addWidget(mActivationCodeLabel_1); + mActivationLyt->addWidget(mActivationCodeLabel_2); +@@ -69,7 +70,7 @@ void StatusDialog::initUI() + mSerialFrame->setFixedHeight(36); + mSerialFrame->setFrameShape(QFrame::NoFrame); + mSerialLabel_1 = new QLabel(mSerialFrame); +- mSerialLabel_2 = new FixLabel(mSerialFrame); ++ mSerialLabel_2 = new KLabel(mSerialFrame); + mSerialLabel_1->setFixedWidth(100); + mSerialLyt->addWidget(mSerialLabel_1); + mSerialLyt->addWidget(mSerialLabel_2); +@@ -80,7 +81,7 @@ void StatusDialog::initUI() + mTimeLyt->setSpacing(16); + mTimeFrame->setFixedHeight(36); + mTimeFrame->setFrameShape(QFrame::NoFrame); +- mTimeLabel_1 = new FixLabel(mTimeFrame); ++ mTimeLabel_1 = new KLabel(mTimeFrame); + mTimeLabel_2 = new QLabel(mTimeFrame); + mTimeLabel_1->setFixedWidth(100); + mTimeLyt->addWidget(mTimeLabel_1); +diff --git a/plugins/system/about/statusdialog.h b/plugins/system/about/statusdialog.h +index 5d8ec5d..351096d 100644 +--- a/plugins/system/about/statusdialog.h ++++ b/plugins/system/about/statusdialog.h +@@ -5,8 +5,9 @@ + #include <QDialog> + #include <QLabel> + #include <QPushButton> ++#include <klabel.h> + +-#include "fixlabel.h" ++using namespace kdk; + + const QString vTen = "v10"; + const QString vTenEnhance = "v10.1"; +@@ -33,15 +34,15 @@ private: + public: + QLabel *mLogoLabel; + QLabel *mVersionLabel_1; +- FixLabel *mVersionLabel_2; +- FixLabel *mStatusLabel_1; ++ KLabel *mVersionLabel_2; ++ KLabel *mStatusLabel_1; + QLabel *mStatusLabel_2; + QLabel *mSerialLabel_1; +- FixLabel *mSerialLabel_2; +- FixLabel *mTimeLabel_1; ++ KLabel *mSerialLabel_2; ++ KLabel *mTimeLabel_1; + QLabel *mTimeLabel_2; +- FixLabel *mActivationCodeLabel_1; +- FixLabel *mActivationCodeLabel_2; ++ KLabel *mActivationCodeLabel_1; ++ KLabel *mActivationCodeLabel_2; + QPushButton *mExtentBtn; + + private: +diff --git a/plugins/system/about/trialdialog.cpp b/plugins/system/about/trialdialog.cpp +index 709a297..545d9f4 100644 +--- a/plugins/system/about/trialdialog.cpp ++++ b/plugins/system/about/trialdialog.cpp +@@ -29,7 +29,8 @@ void TrialDialog::initUi(QDialog *mTrialDialog) + QHBoxLayout *mTitleLayout = new QHBoxLayout; + + +- mTitleLabel = new TitleLabel(mTrialDialog); ++ mTitleLabel = new KLabel(mTrialDialog); ++ mTitleLabel->setContentsMargins(16, 0, 0, 0); + mTitleLabel->setFixedHeight(30); + mTitleLayout->addStretch(); + mTitleLayout->addWidget(mTitleLabel); +diff --git a/plugins/system/about/trialdialog.h b/plugins/system/about/trialdialog.h +index e4462d5..7bd4fcc 100644 +--- a/plugins/system/about/trialdialog.h ++++ b/plugins/system/about/trialdialog.h +@@ -3,7 +3,9 @@ + + #include <QDialog> + #include <QTextBrowser> +-#include "titlelabel.h" ++#include <klabel.h> ++ ++using namespace kdk; + + class TrialDialog : public QDialog + { +@@ -16,7 +18,7 @@ private: + void initUi(QDialog *mTrialDialog); + + private: +- TitleLabel *mTitleLabel; ++ KLabel *mTitleLabel; + + QLabel *mContentLabel_1; + QTextBrowser *mContentLabel_2; +diff --git a/plugins/system/display/brightnessFrame.cpp b/plugins/system/display/brightnessFrame.cpp +index 919914e..d563d34 100644 +--- a/plugins/system/display/brightnessFrame.cpp ++++ b/plugins/system/display/brightnessFrame.cpp +@@ -65,7 +65,7 @@ BrightnessFrame::BrightnessFrame(const QString &name, const bool &isBattery, con + labelMsg->setDisabled(true); + labelMsg->setText(tr("Failed to get the brightness information of this monitor"));//未能获得该显示器的亮度信息 + +- labelName = new FixLabel(this); ++ labelName = new KLabel(this); + labelName->setFixedWidth(118); + + slider = new KSlider(Qt::Horizontal, this); +diff --git a/plugins/system/display/brightnessFrame.h b/plugins/system/display/brightnessFrame.h +index 5fa8c27..e201750 100644 +--- a/plugins/system/display/brightnessFrame.h ++++ b/plugins/system/display/brightnessFrame.h +@@ -24,7 +24,6 @@ + #include <QLabel> + #include <QWidget> + #include <QLabel> +-#include "uslider.h" + #include <QMutex> + #include <QFuture> + #include <QDBusInterface> +@@ -33,12 +32,12 @@ + #include <kslider.h> + #include <KF5/KScreen/kscreen/output.h> + #include <KF5/KScreen/kscreen/types.h> +-#include "fixlabel.h" + #include "getBrightnessThread.h" + #include "ukccframe.h" + #include "lightlabel.h" + #include <kslider.h> + #include "ukcccommon.h" ++#include <klabel.h> + + using namespace ukcc; + using namespace kdk; +@@ -77,7 +76,7 @@ private: + void sliderValueChangeSlot(QString outputName); + + private: +- FixLabel *labelName = nullptr; ++ KLabel *labelName = nullptr; + QLabel *labelValue = nullptr; + KSlider *slider = nullptr; + QString outputName; //屏幕名 +diff --git a/plugins/system/display/display.pro b/plugins/system/display/display.pro +index 7b02f0d..d29d6b5 100644 +--- a/plugins/system/display/display.pro ++++ b/plugins/system/display/display.pro +@@ -5,8 +5,6 @@ + #------------------------------------------------- + include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/Uslider/uslider.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/CloseButton/closebutton.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/ComboBox/combobox.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) +@@ -43,8 +41,7 @@ SOURCES += \ + splicedialog.cpp \ + unifiedoutputconfig.cpp \ + utils.cpp \ +- widget.cpp \ +- displayperformancedialog.cpp ++ widget.cpp + + HEADERS += \ + brightnessFrame.h \ +@@ -61,12 +58,10 @@ HEADERS += \ + splicedialog.h \ + unifiedoutputconfig.h \ + utils.h \ +- widget.h \ +- displayperformancedialog.h ++ widget.h + + FORMS += \ + display.ui \ +- displayperformancedialog.ui \ + splicedialog.ui + + #DISTFILES += \ +diff --git a/plugins/system/display/display.ui b/plugins/system/display/display.ui +index 658c01f..51738bf 100644 +--- a/plugins/system/display/display.ui ++++ b/plugins/system/display/display.ui +@@ -27,7 +27,7 @@ + <number>0</number> + </property> + <item> +- <widget class="TitleLabel" name="titleLabel"> ++ <widget class="KLabel" name="titleLabel"> + <property name="text"> + <string>Display</string> + </property> +@@ -140,9 +140,9 @@ + <header location="global">QtQuickWidgets/QQuickWidget</header> + </customwidget> + <customwidget> +- <class>TitleLabel</class> ++ <class>KLabel</class> + <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> ++ <header>klabel.h</header> + </customwidget> + </customwidgets> + <resources/> +diff --git a/plugins/system/display/displayperformancedialog.cpp b/plugins/system/display/displayperformancedialog.cpp +deleted file mode 100644 +index b1bf29f..0000000 +--- a/plugins/system/display/displayperformancedialog.cpp ++++ /dev/null +@@ -1,213 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "displayperformancedialog.h" +-#include "ui_displayperformancedialog.h" +-#include "closebutton.h" +- +-#include <QFile> +-#include <QDBusReply> +-#include <QDBusInterface> +-#include <QPainter> +-#include <QPainterPath> +-#include <QProcess> +-#include <QDebug> +- +-#define ADVANCED_SCHEMAS "org.ukui.session.required-components" +-#define ADVANCED_KEY "windowmanager" +- +-#define WM_CHOOSER_CONF "/etc/kylin-wm-chooser/default.conf" +-#define WM_CHOOSER_CONF_TMP "/tmp/default.conf" +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-DisplayPerformanceDialog::DisplayPerformanceDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::DisplayPerformanceDialog) +-{ +- ui->setupUi(this); +- +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- ui->titleLabel->setStyleSheet("QLabel{color: palette(windowText);}"); +- +- ui->label->setAlignment(Qt::AlignTop); +- ui->label_2->setAlignment(Qt::AlignTop); +- ui->label_3->setAlignment(Qt::AlignTop); +- ui->label_4->setAlignment(Qt::AlignTop); +- ui->label_5->setAlignment(Qt::AlignTop); +- ui->label_6->setAlignment(Qt::AlignTop); +- +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- const QByteArray id(ADVANCED_SCHEMAS); +- settings = new QGSettings(id); +- +- confSettings = new QSettings(WM_CHOOSER_CONF, QSettings::NativeFormat); +- +- setupComponent(); +- setupConnect(); +- initModeStatus(); +- initThresholdStatus(); +- +-} +- +-DisplayPerformanceDialog::~DisplayPerformanceDialog() +-{ +- delete ui; +- ui = nullptr; +- delete settings; +- settings = nullptr; +- delete confSettings; +- confSettings = nullptr; +-} +- +-void DisplayPerformanceDialog::setupComponent(){ +- ui->performanceRadioBtn->setProperty("wm", "mutter"); +- ui->compatibleRadioBtn->setProperty("wm", "marco"); +- ui->autoRadioBtn->setProperty("wm", "kylin-wm-chooser"); +-} +- +-void DisplayPerformanceDialog::setupConnect(){ +- connect(ui->closeBtn, &CloseButton::clicked, [=]{ +- close(); +- }); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- connect(ui->buttonGroup, static_cast<void (QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), [=](QAbstractButton * button){ +-#else +- connect(ui->buttonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), [=](QAbstractButton * button){ +-#endif +- QString mode = button->property("wm").toString(); +- settings->set(ADVANCED_KEY, mode); +- }); +- +- connect(ui->autoRadioBtn, &QRadioButton::toggled, this, [=](bool checked){ +- ui->lineEdit->setEnabled(checked); +- ui->applyBtn->setEnabled(checked); +- ui->resetBtn->setEnabled(checked); +- }); +- +- connect(ui->applyBtn, &QPushButton::clicked, this, [=]{ +- changeConfValue(); +- }); +- +- connect(ui->resetBtn, &QPushButton::clicked, this, [=]{ +- ui->lineEdit->setText("256"); +- changeConfValue(); +- }); +-} +- +-void DisplayPerformanceDialog::initModeStatus(){ +- QString mode = settings->get(ADVANCED_KEY).toString(); +- +- if (mode == ui->performanceRadioBtn->property("wm").toString()){ +- ui->performanceRadioBtn->blockSignals(true); +- ui->performanceRadioBtn->setChecked(true); +- ui->performanceRadioBtn->blockSignals(false); +- } else if (mode == ui->compatibleRadioBtn->property("wm").toString()){ +- ui->compatibleRadioBtn->blockSignals(true); +- ui->compatibleRadioBtn->setChecked(true); +- ui->compatibleRadioBtn->blockSignals(false); +- } else{ +- ui->autoRadioBtn->blockSignals(true); +- ui->autoRadioBtn->setChecked(true); +- ui->autoRadioBtn->blockSignals(false); +- } +-} +- +-void DisplayPerformanceDialog::initThresholdStatus(){ +- confSettings->beginGroup("mutter"); +- QString value = confSettings->value("threshold").toString(); +- ui->lineEdit->blockSignals(true); +- ui->lineEdit->setText(value); +- ui->lineEdit->blockSignals(false); +- confSettings->endGroup(); +-} +- +-void DisplayPerformanceDialog::changeConfValue(){ +- if (!QFile::copy(WM_CHOOSER_CONF, WM_CHOOSER_CONF_TMP)) +- return; +- +- QSettings * tempSettings = new QSettings(WM_CHOOSER_CONF_TMP, QSettings::NativeFormat); +- tempSettings->beginGroup("mutter"); +- tempSettings->setValue("threshold", ui->lineEdit->text()); +- tempSettings->endGroup(); +- +- delete tempSettings; +- tempSettings = nullptr; +- +- //替换kylin-wm-chooser +- QDBusInterface * sysinterface = new QDBusInterface("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- if (!sysinterface->isValid()){ +- qCritical() << "Create Client Interface Failed When Copy Face File: " << QDBusConnection::systemBus().lastError(); +- return; +- } +- +- QString cmd = QString("mv %1 %2").arg(WM_CHOOSER_CONF_TMP).arg(WM_CHOOSER_CONF); +- +- QProcess::execute(cmd); +- delete sysinterface; +- sysinterface = nullptr; +-} +- +-void DisplayPerformanceDialog::paintEvent(QPaintEvent *event){ +- Q_UNUSED(event); +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 6, 6); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- +- p.restore(); +-} +diff --git a/plugins/system/display/displayperformancedialog.h b/plugins/system/display/displayperformancedialog.h +deleted file mode 100644 +index 4d03ccc..0000000 +--- a/plugins/system/display/displayperformancedialog.h ++++ /dev/null +@@ -1,58 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef DISPLAYPERFORMANCEDIALOG_H +-#define DISPLAYPERFORMANCEDIALOG_H +- +-#include <QDialog> +-#include <QSettings> +-#include <QGSettings> +- +-namespace Ui { +-class DisplayPerformanceDialog; +-} +- +-class DisplayPerformanceDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit DisplayPerformanceDialog(QWidget *parent = 0); +- ~DisplayPerformanceDialog(); +- +-public: +- void setupComponent(); +- void setupConnect(); +- void initModeStatus(); +- void initThresholdStatus(); +- +- void changeConfValue(); +- +-private: +- void paintEvent(QPaintEvent *event); +- +-private: +- Ui::DisplayPerformanceDialog *ui; +- +-private: +- QGSettings *settings; +- QSettings *confSettings; +-}; +- +-#endif // DISPLAYPERFORMANCEDIALOG_H +diff --git a/plugins/system/display/displayperformancedialog.ui b/plugins/system/display/displayperformancedialog.ui +deleted file mode 100644 +index a901710..0000000 +--- a/plugins/system/display/displayperformancedialog.ui ++++ /dev/null +@@ -1,818 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>DisplayPerformanceDialog</class> +- <widget class="QDialog" name="DisplayPerformanceDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>580</width> +- <height>646</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>580</width> +- <height>646</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>580</width> +- <height>646</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>9</number> +- </property> +- <property name="rightMargin"> +- <number>9</number> +- </property> +- <property name="bottomMargin"> +- <number>9</number> +- </property> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="sizeConstraint"> +- <enum>QLayout::SetDefaultConstraint</enum> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="closeFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>36</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="CloseButton" name="closeBtn"> +- <property name="minimumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="widget" native="true"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="sizeConstraint"> +- <enum>QLayout::SetDefaultConstraint</enum> +- </property> +- <property name="leftMargin"> +- <number>32</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>32</number> +- </property> +- <property name="bottomMargin"> +- <number>32</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Display Advanced Settings</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QScrollArea" name="scrollArea"> +- <property name="verticalScrollBarPolicy"> +- <enum>Qt::ScrollBarAsNeeded</enum> +- </property> +- <property name="horizontalScrollBarPolicy"> +- <enum>Qt::ScrollBarAlwaysOff</enum> +- </property> +- <property name="widgetResizable"> +- <bool>true</bool> +- </property> +- <widget class="QWidget" name="scrollAreaWidgetContents"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>489</width> +- <height>556</height> +- </rect> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_32"> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QFrame" name="performanceFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="performanceRadioBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Performance</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="performanceTipFrame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_11"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="autoFillBackground"> +- <bool>false</bool> +- </property> +- <property name="text"> +- <string>Applicable to machine with discrete graphics, which can accelerate the rendering of 3D graphics.</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>(Note: not support connect graphical with xmanager on windows.)</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_8"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QFrame" name="compatibleFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="compatibleRadioBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Compatible</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="compatibleTipFrame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_12"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label_3"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Applicable to machine with integrated graphics, there is no 3D graphics acceleration. </string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_4"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>(Note: need connect graphical with xmanager on windows, use this option.)</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_9"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QFrame" name="automaticFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="autoRadioBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Automatic</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="automaticTipFrame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label_5"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Auto select according to environment, delay the login time (about 0.5 sec).</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="autoHorLayout"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <item> +- <widget class="QLabel" name="label_7"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Threshold:</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLineEdit" name="lineEdit"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="applyBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Apply</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="resetBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Reset</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLabel" name="label_6"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>(Note: select this option to use 3D graphics acceleration and xmanager.)</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- <zorder></zorder> +- <zorder></zorder> +- <zorder></zorder> +- </widget> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- <customwidget> +- <class>CloseButton</class> +- <extends>QPushButton</extends> +- <header location="global">closebutton.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +- <buttongroups> +- <buttongroup name="buttonGroup"/> +- </buttongroups> +-</ui> +diff --git a/plugins/system/display/widget.cpp b/plugins/system/display/widget.cpp +index 43275c3..05a296d 100644 +--- a/plugins/system/display/widget.cpp ++++ b/plugins/system/display/widget.cpp +@@ -23,7 +23,6 @@ + #include "declarative/qmlscreen.h" + #include "utils.h" + #include "ui_display.h" +-#include "displayperformancedialog.h" + #include "colorinfo.h" + #include "scalesize.h" + #include "ukcccommon.h" +@@ -133,6 +132,7 @@ Widget::Widget(QWidget *parent) : + qRegisterMetaType<QQuickView *>(); + + ui->setupUi(this); ++ ui->titleLabel->setContentsMargins(16, 0, 0, 0); + initUi(); + initNightModeUi(); + initAutoBrihgtUI(); +@@ -202,6 +202,7 @@ void Widget::setConfig(const KScreen::ConfigPtr &config) + mConfig = config; + mPrevConfig = config->clone(); + if (mMultiScreenFrame) { ++ qDebug() << Q_FUNC_INFO << "connetedOutputs count" << mConfig->connectedOutputs().size(); + mMultiScreenFrame->setVisible(mConfig->connectedOutputs().size() > 1); + } + updateMultiScreen(); +@@ -281,7 +282,8 @@ KScreen::ConfigPtr Widget::currentConfig() const + void Widget::initNightModeUi() + { + ui->verticalLayout->setSpacing(8); +- mNightModeLabel = new TitleLabel(this); ++ mNightModeLabel = new KLabel(this); ++ mNightModeLabel->setContentsMargins(16, 0, 0, 0); + //~ contents_path /Display/Night Mode + mNightModeLabel->setText(tr("Night Mode")); + mNightModeFrame = new SettingGroup(this); +@@ -527,7 +529,7 @@ void Widget::slotUnifyOutputs() + if (!mIscloneMode) { + + unifySetconfig = true; +- ++ qDebug() << Q_FUNC_INFO << "is not clone Mode, setConfig"; + setConfig(mPrevConfig); + + monitorComboBox->setEnabled(isExtendMode); +@@ -1053,6 +1055,7 @@ int Widget::updateScreenConfig() + auto *preOp = new KScreen::GetConfigOperation(); + preOp->exec(); + mPrevConfig = preOp->config()->clone(); //重新获取屏幕当前状态,通过mconfig未必能获取到正确的状态 ++ qDebug() << Q_FUNC_INFO << "updateScreenConfig connectedOutput count" << mPrevConfig->connectedOutputs().size(); + preOp->deleteLater(); + return 0; + } +@@ -1870,6 +1873,7 @@ void Widget::usdScreenModeChangedSlot(int status) + mIscloneMode = false; + } + ++ qDebug() << Q_FUNC_INFO << "screenMode" << status << "mIscloneMode:" << mIscloneMode; + int time = 1500; + if (mIscloneMode) { + time = 0; +@@ -1972,7 +1976,7 @@ void Widget::initConnection() + }); + + connect(mTemptWidget, &SliderWidget::valueChanged, this, [=]{ +- qDebug() << Q_FUNC_INFO << "susidian valueChanged" << mTemptWidget->value(); ++ qDebug() << Q_FUNC_INFO << "TemptWidget valueChanged" << mTemptWidget->value(); + if (m_colorSettings) { + m_colorSettings->set(NIGHT_TEMPERATURE_KEY, mTemptWidget->value()); + } else { +@@ -2826,15 +2830,15 @@ void Widget::initUi() + spliceFrame = new UkccFrame(modeGroup, UkccFrame::BorderRadiusStyle::Around, true); + configGroup = new SettingGroup(this); + monitorFrame = new UkccFrame(configGroup, UkccFrame::BorderRadiusStyle::Around, true); +- monitorLabel = new FixLabel(monitorFrame); ++ monitorLabel = new KLabel(monitorFrame); + monitorComboBox = new QComboBox(monitorFrame); + monitorBtn = new QPushButton(monitorFrame); + mControlPanel = new ControlPanel(configGroup); + scaleFrame = new UkccFrame(configGroup, UkccFrame::BorderRadiusStyle::Around, true); +- scaleLabel = new FixLabel(scaleFrame); ++ scaleLabel = new KLabel(scaleFrame); + scaleComboBox = new QComboBox(scaleFrame); + openMonitorFrame = new UkccFrame(configGroup, UkccFrame::BorderRadiusStyle::Around, true); +- openMonitorLabel = new FixLabel(openMonitorFrame); ++ openMonitorLabel = new KLabel(openMonitorFrame); + openMonitorButton = new KSwitchButton(openMonitorFrame); + //~ contents_path /Display/Auto Brightness + mAutoBrightFrame = new SwitchWidget(tr("Auto Brightness")); +diff --git a/plugins/system/display/widget.h b/plugins/system/display/widget.h +index d43e1a1..738c743 100644 +--- a/plugins/system/display/widget.h ++++ b/plugins/system/display/widget.h +@@ -48,16 +48,14 @@ + #include "outputconfig.h" + #include "brightnessFrame.h" + #include "screenConfig.h" +-#include "titlelabel.h" +-#include "fixlabel.h" + #include "lightlabel.h" +-#include "uslider.h" + #include "switchwidget.h" + #include "kswitchbutton.h" + #include "ukccframe.h" + #include "settinggroup.h" + #include "comboxwidget.h" + #include "sliderwidget.h" ++#include <klabel.h> + + using namespace kdk; + +@@ -262,13 +260,13 @@ private: + KSwitchButton *mAutoBrightBtn = nullptr; + KSwitchButton *mBackBrightBtn = nullptr; + +- TitleLabel *mNightModeLabel = nullptr; ++ KLabel *mNightModeLabel = nullptr; + QLabel *mOpenLabel = nullptr; + QLabel *mTimeModeLabel = nullptr; + QLabel *mCustomTimeLabel = nullptr; +- FixLabel *mTemptLabel = nullptr; +- FixLabel *mWarmLabel = nullptr; +- FixLabel *mColdLabel = nullptr; ++ KLabel *mTemptLabel = nullptr; ++ KLabel *mWarmLabel = nullptr; ++ KLabel *mColdLabel = nullptr; + QLabel *mLabel_1 = nullptr; + + QLabel *nightLabel = nullptr; +@@ -355,15 +353,15 @@ private: + UkccFrame *spliceFrame = nullptr; + SettingGroup *configGroup = nullptr; + UkccFrame *monitorFrame = nullptr; +- FixLabel *monitorLabel = nullptr; ++ KLabel *monitorLabel = nullptr; + QComboBox *monitorComboBox = nullptr; + QPushButton *monitorBtn = nullptr; + ControlPanel *mControlPanel = nullptr; + UkccFrame *scaleFrame = nullptr; +- FixLabel *scaleLabel = nullptr; ++ KLabel *scaleLabel = nullptr; + QComboBox *scaleComboBox = nullptr; + UkccFrame *openMonitorFrame = nullptr; +- FixLabel *openMonitorLabel = nullptr; ++ KLabel *openMonitorLabel = nullptr; + KSwitchButton *openMonitorButton = nullptr; + UkccFrame *mbrightnessFrame = nullptr; + QVBoxLayout *mbrightnesslayout = nullptr; +diff --git a/plugins/system/display_hw/brightnessFrame.cpp b/plugins/system/display_hw/brightnessFrame.cpp +deleted file mode 100644 +index b5b5761..0000000 +--- a/plugins/system/display_hw/brightnessFrame.cpp ++++ /dev/null +@@ -1,42 +0,0 @@ +-#include "brightnessFrame.h" +-#include <QHBoxLayout> +- +-BrightnessFrame::BrightnessFrame(QWidget *parent) : +- QFrame(parent) +-{ +- this->setFixedHeight(50); +- this->setMinimumWidth(550); +- this->setFrameShape(QFrame::Shape::Box); +- QHBoxLayout *layout = new QHBoxLayout(this); +- layout->setSpacing(6); +- layout->setMargin(9); +- +- labelName = new QLabel(this); +- labelName->setFixedWidth(118); +- +- slider = new Uslider(Qt::Horizontal, this); +- slider->setRange(10, 100); +- +- labelValue = new QLabel(this); +- labelValue->setAlignment(Qt::AlignRight); +- +- layout->addWidget(labelName); +- layout->addWidget(slider); +- layout->addWidget(labelValue); +- +-} +- +-BrightnessFrame::~BrightnessFrame() +-{ +- +-} +- +-void BrightnessFrame::setTextLableName(QString text) +-{ +- this->labelName->setText(text); +-} +- +-void BrightnessFrame::setTextLableValue(QString text) +-{ +- this->labelValue->setText(text + "%"); +-} +diff --git a/plugins/system/display_hw/brightnessFrame.h b/plugins/system/display_hw/brightnessFrame.h +deleted file mode 100644 +index 565d52e..0000000 +--- a/plugins/system/display_hw/brightnessFrame.h ++++ /dev/null +@@ -1,26 +0,0 @@ +-#ifndef BRIGHTNESSFRAME_H +-#define BRIGHTNESSFRAME_H +- +-#include <QFrame> +-#include <QLabel> +-#include <QWidget> +-#include <QLabel> +-#include "uslider.h" +- +-class BrightnessFrame : public QFrame +-{ +- Q_OBJECT +-public: +- BrightnessFrame(QWidget *parent = nullptr); +- ~BrightnessFrame(); +- void setTextLableName(QString text); +- void setTextLableValue(QString text); +- Uslider *slider = nullptr; +- QString outputName; +- bool openFlag = true; +-private: +- QLabel *labelName = nullptr; +- QLabel *labelValue = nullptr; +-}; +- +-#endif // BRIGHTNESSFRAME_H +diff --git a/plugins/system/display_hw/colorinfo.h b/plugins/system/display_hw/colorinfo.h +deleted file mode 100644 +index b8551f1..0000000 +--- a/plugins/system/display_hw/colorinfo.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-#ifndef COLORINFO_H +-#define COLORINFO_H +- +-#include <QHash> +-#include <QVariant> +-#include <QString> +-#include <QDBusArgument> +- +-struct ColorInfo { +- QString arg; +- QDBusVariant out; +-}; +- +-QDBusArgument &operator<<(QDBusArgument &argument, const ColorInfo &mystruct) +-{ +- argument.beginStructure(); +- argument << mystruct.arg << mystruct.out; +- argument.endStructure(); +- return argument; +-} +- +-const QDBusArgument &operator>>(const QDBusArgument &argument, ColorInfo &mystruct) +-{ +- argument.beginStructure(); +- argument >> mystruct.arg >> mystruct.out; +- argument.endStructure(); +- return argument; +-} +- +-Q_DECLARE_METATYPE(ColorInfo) +- +-#endif // COLORINFO_H +diff --git a/plugins/system/display_hw/controlpanel.cpp b/plugins/system/display_hw/controlpanel.cpp +deleted file mode 100644 +index 16c74b1..0000000 +--- a/plugins/system/display_hw/controlpanel.cpp ++++ /dev/null +@@ -1,175 +0,0 @@ +-#include "controlpanel.h" +-#include "outputconfig.h" +-#include "unifiedoutputconfig.h" +-#include "utils.h" +-#include "scalesize.h" +- +-#include <QVBoxLayout> +-#include <QDebug> +-#include <QLabel> +-#include <QDBusInterface> +-#include <KF5/KScreen/kscreen/config.h> +- +-QSize mScaleSize = QSize(); +- +-ControlPanel::ControlPanel(QWidget *parent) : +- QFrame(parent), +- mUnifiedOutputCfg(nullptr) +-{ +- setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); +- mLayout = new QVBoxLayout(this); +- mLayout->setContentsMargins(0, 0, 0, 0); +- +- isWayland(); +-} +- +-ControlPanel::~ControlPanel() +-{ +-} +- +-void ControlPanel::setConfig(const KScreen::ConfigPtr &config) +-{ +- qDeleteAll(mOutputConfigs); +- mOutputConfigs.clear(); +- delete mUnifiedOutputCfg; +- mUnifiedOutputCfg = nullptr; +- +- if (mConfig) { +- mConfig->disconnect(this); +- } +- +- mConfig = config; +- connect(mConfig.data(), &KScreen::Config::outputAdded, +- this, [=](const KScreen::OutputPtr &output){ +- addOutput(output); +- }); +- connect(mConfig.data(), &KScreen::Config::outputRemoved, +- this, &ControlPanel::removeOutput); +- +- for (const KScreen::OutputPtr &output : mConfig->outputs()) { +- addOutput(output); +- } +-} +- +-void ControlPanel::addOutput(const KScreen::OutputPtr &output) +-{ +- OutputConfig *outputCfg = new OutputConfig(this); +- outputCfg->setVisible(false); +- outputCfg->setShowScaleOption(mConfig->supportedFeatures().testFlag(KScreen::Config::Feature::PerOutputScaling)); +- +- outputCfg->setOutput(output); +- connect(outputCfg, &OutputConfig::changed, +- this, &ControlPanel::changed); +- +- connect(outputCfg, &OutputConfig::scaleChanged, +- this, &ControlPanel::scaleChanged); +- +- mLayout->addWidget(outputCfg); +- +- mOutputConfigs << outputCfg; +- +- if (mIsWayland) { +- activateOutput(mCurrentOutput); +- } +-} +- +-void ControlPanel::removeOutput(int outputId) +-{ +- if (mUnifiedOutputCfg) { +- mUnifiedOutputCfg->setVisible(false); +- mIsCloneMode = false; +- } +- +- for (OutputConfig *outputCfg : mOutputConfigs) { +- if (outputCfg->output()->id() == outputId) { +- mOutputConfigs.removeOne(outputCfg); +- delete outputCfg; +- outputCfg = nullptr; +- } else { +- outputCfg->setVisible(true); +- } +- } +-} +- +-void ControlPanel::activateOutput(const KScreen::OutputPtr &output) +-{ +- // Ignore activateOutput when in unified mode +- if ((mUnifiedOutputCfg && mIsCloneMode) || output.isNull()) { +- return; +- } +- +- mCurrentOutput = output; +- +- Q_FOREACH (OutputConfig *cfg, mOutputConfigs) { +- cfg->setVisible(cfg->output()->id() == output->id()); +- } +-} +- +-void ControlPanel::activateOutputNoParam() +-{ +- // Ignore activateOutput when in unified mode +- if (mUnifiedOutputCfg) { +- return; +- } +- +- Q_FOREACH (OutputConfig *cfg, mOutputConfigs) { +- cfg->setVisible(cfg->output()->id() == 66); +- } +-} +- +-void ControlPanel::changescalemax(const KScreen::OutputPtr &output) +-{ +- QSize sizescale = QSize(); +- Q_FOREACH (const KScreen::ModePtr &mode, output->modes()) { +- if (sizescale.width() <= mode->size().width()) { +- sizescale = mode->size(); +- } +- } +- if (mScaleSize == QSize() || mScaleSize.width() > sizescale.width()) { +- mScaleSize = sizescale; +- } +-} +- +-void ControlPanel::isWayland() +-{ +- QString sessionType = getenv("XDG_SESSION_TYPE"); +- +- if (!sessionType.compare(kSession, Qt::CaseSensitive)) { +- mIsWayland = true; +- } else { +- mIsWayland = false; +- } +-} +- +-void ControlPanel::setUnifiedOutput(const KScreen::OutputPtr &output) +-{ +- Q_FOREACH (OutputConfig *config, mOutputConfigs) { +- if (!config->output()->isConnected()) { +- continue; +- } +- +- // 隐藏下面控制 +- config->setVisible(output == nullptr); +- } +- +- if (output.isNull()) { +- mUnifiedOutputCfg->deleteLater(); +- mUnifiedOutputCfg = nullptr; +- } else { +- mUnifiedOutputCfg = new UnifiedOutputConfig(mConfig, this); +- mUnifiedOutputCfg->setOutput(output); +- mUnifiedOutputCfg->setVisible(true); +- mIsCloneMode = true; +- mLayout->insertWidget(mLayout->count() - 2, mUnifiedOutputCfg); +- connect(mUnifiedOutputCfg, &UnifiedOutputConfig::changed, +- this, &ControlPanel::changed); +- } +-} +- +-void ControlPanel::deleteUnifiedOutputCfg() +-{ +- if (mUnifiedOutputCfg) { +- delete mUnifiedOutputCfg; +- mUnifiedOutputCfg = nullptr; +- } +-} +diff --git a/plugins/system/display_hw/controlpanel.h b/plugins/system/display_hw/controlpanel.h +deleted file mode 100644 +index b127567..0000000 +--- a/plugins/system/display_hw/controlpanel.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-#ifndef CONTROLPANEL_H +-#define CONTROLPANEL_H +- +-#include <QFrame> +- +-#include <KF5/KScreen/kscreen/output.h> +- +-class QVBoxLayout; +-class OutputConfig; +-class UnifiedOutputConfig; +- +-class QLabel; +-class QCheckBox; +-class QSlider; +-class QComboBox; +- +-const QString kSession = "wayland"; +- +-class ControlPanel : public QFrame +-{ +- Q_OBJECT +- +-public: +- explicit ControlPanel(QWidget *parent = nullptr); +- ~ControlPanel() override; +- +- void setConfig(const KScreen::ConfigPtr &config); +- void setUnifiedOutput(const KScreen::OutputPtr &output); +- void activateOutputNoParam(); +- void changescalemax(const KScreen::OutputPtr &output); +- void deleteUnifiedOutputCfg(); +- +-private: +- void isWayland(); +- +-public Q_SLOTS: +- void activateOutput(const KScreen::OutputPtr &output); +- +-Q_SIGNALS: +- void changed(); +- void scaleChanged(double scale); +- +-private Q_SLOTS: +- void addOutput(const KScreen::OutputPtr &output); +- void removeOutput(int outputId); +- +-public: +- QVBoxLayout *mLayout; +- +-private: +- KScreen::ConfigPtr mConfig; +- QList<OutputConfig *> mOutputConfigs; +- +- UnifiedOutputConfig *mUnifiedOutputCfg; +- +- KScreen::OutputPtr mCurrentOutput; +- +- bool mIsWayland; +- bool mIsCloneMode = false; +-}; +- +-#endif // CONTROLPANEL_H +diff --git a/plugins/system/display_hw/declarative/qmloutput.cpp b/plugins/system/display_hw/declarative/qmloutput.cpp +deleted file mode 100644 +index 9c0f4a1..0000000 +--- a/plugins/system/display_hw/declarative/qmloutput.cpp ++++ /dev/null +@@ -1,606 +0,0 @@ +-/* +- Copyright (C) 2012 Dan Vratil <dvratil@redhat.com> +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- This library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +-*/ +- +-#include "qmloutput.h" +-#include "qmlscreen.h" +- +-#include <KF5/KScreen/kscreen/output.h> +-#include <KF5/KScreen/kscreen/config.h> +- +-#include <QStandardItem> +-#include <QStandardItemModel> +-#include <qquickitem.h> +-#include <QRect> +- +-const static int sMargin = 0; +-const static int sSnapArea = 20; +-const static int sSnapAlignArea = 6; +- +-Q_DECLARE_METATYPE(KScreen::ModePtr) +- +-bool operator>(const QSize &sizeA, const QSize &sizeB) +-{ +- return ((sizeA.width() > sizeB.width()) && (sizeA.height() > sizeB.height())); +-} +- +-QMLOutput::QMLOutput(QQuickItem *parent): +- QQuickItem(parent), +- m_screen(nullptr), +- m_cloneOf(nullptr), +- m_leftDock(nullptr), +- m_topDock(nullptr), +- m_rightDock(nullptr), +- m_bottomDock(nullptr), +- pos_clicked(QPointF(0.0,0.0)), +- m_isCloneMode(false) +-{ +- connect(this, &QMLOutput::xChanged, +- this, static_cast<void(QMLOutput::*)()>(&QMLOutput::moved)); +- connect(this, &QMLOutput::yChanged, +- this, static_cast<void(QMLOutput::*)()>(&QMLOutput::moved)); +-} +- +-KScreen::Output* QMLOutput::output() const +-{ +- return m_output.data(); +-} +- +-KScreen::OutputPtr QMLOutput::outputPtr() const +-{ +- return m_output; +-} +- +-void QMLOutput::setOutputPtr(const KScreen::OutputPtr &output) +-{ +- Q_ASSERT(m_output.isNull()); +- +- m_output = output; +- Q_EMIT outputChanged(); +- +- connect(m_output.data(), &KScreen::Output::rotationChanged, +- this, &QMLOutput::updateRootProperties); +- connect(m_output.data(), &KScreen::Output::currentModeIdChanged, +- this, &QMLOutput::currentModeIdChanged); +-} +- +-QMLScreen *QMLOutput::screen() const +-{ +- return m_screen; +-} +- +-void QMLOutput::setScreen(QMLScreen *screen) +-{ +- Q_ASSERT(m_screen == nullptr); +- +- m_screen = screen; +- Q_EMIT screenChanged(); +-} +- +-void QMLOutput::setLeftDockedTo(QMLOutput *output) +-{ +- if (m_leftDock == output) { +- return; +- } +- +- m_leftDock = output; +- Q_EMIT leftDockedToChanged(); +-} +- +-QMLOutput *QMLOutput::leftDockedTo() const +-{ +- return m_leftDock; +-} +- +-void QMLOutput::undockLeft() +-{ +- setLeftDockedTo(nullptr); +-} +- +-void QMLOutput::setTopDockedTo(QMLOutput *output) +-{ +- if (m_topDock == output) { +- return; +- } +- +- m_topDock = output; +- Q_EMIT topDockedToChanged(); +-} +- +-QMLOutput *QMLOutput::topDockedTo() const +-{ +- return m_topDock; +-} +- +-void QMLOutput::undockTop() +-{ +- setTopDockedTo(nullptr); +-} +- +-void QMLOutput::setRightDockedTo(QMLOutput *output) +-{ +- if (m_rightDock == output) { +- return; +- } +- +- m_rightDock = output; +- Q_EMIT rightDockedToChanged(); +-} +- +-QMLOutput *QMLOutput::rightDockedTo() const +-{ +- return m_rightDock; +-} +- +-void QMLOutput::undockRight() +-{ +- setRightDockedTo(nullptr); +-} +- +-void QMLOutput::setBottomDockedTo(QMLOutput *output) +-{ +- if (m_bottomDock == output) { +- return; +- } +- +- m_bottomDock = output; +- Q_EMIT bottomDockedToChanged(); +-} +- +-QMLOutput *QMLOutput::bottomDockedTo() const +-{ +- return m_bottomDock; +-} +- +-void QMLOutput::undockBottom() +-{ +- setBottomDockedTo(nullptr); +-} +- +-void QMLOutput::setCloneOf(QMLOutput* other) +-{ +- if (m_cloneOf == other) { +- return; +- } +- +- m_cloneOf = other; +- Q_EMIT cloneOfChanged(); +-} +- +-QMLOutput* QMLOutput::cloneOf() const +-{ +- return m_cloneOf; +-} +- +-int QMLOutput::currentOutputHeight() const +-{ +- if (!m_output) { +- return 0; +- } +- +- KScreen::ModePtr mode = m_output->currentMode(); +- if (!mode) { +- if (m_output->isConnected()) { +- mode = bestMode(); +- if (!mode) { +- return 1000; +- } +- m_output->setCurrentModeId(mode->id()); +- } else { +- return 1000; +- } +- } +- return mode->size().height() / m_output->scale(); +-} +- +-int QMLOutput::currentOutputWidth() const +-{ +- if (!m_output) { +- return 0; +- } +- +- KScreen::ModePtr mode = m_output->currentMode(); +- if (!mode) { +- if (m_output->isConnected()) { +- mode = bestMode(); +- if (!mode) { +- return 1000; +- } +- m_output->setCurrentModeId(mode->id()); +- } else { +- return 1000; +- } +- } +- return mode->size().width() / m_output->scale(); +-} +- +-void QMLOutput::currentModeIdChanged() +-{ +- if (!m_output) { +- return; +- } +- +- if (isCloneMode()) { +- const float newWidth = currentOutputWidth() * m_screen->outputScale(); +- setX((m_screen->width() - newWidth) / 2); +- const float newHeight = currentOutputHeight() * m_screen->outputScale(); +- setY((m_screen->height() - newHeight) / 2); +- } else { +- if (m_rightDock) { +- QMLOutput *rightDock = m_rightDock; +- float newWidth = currentOutputWidth() * m_screen->outputScale(); +- setX(rightDock->x() - newWidth); +- setRightDockedTo(rightDock); +- } +- +- if (m_bottomDock) { +- QMLOutput *bottomDock = m_bottomDock; +- float newHeight = currentOutputHeight() * m_screen->outputScale(); +- setY(bottomDock->y() - newHeight); +- setBottomDockedTo(bottomDock); +- } +- } +- +- Q_EMIT currentOutputSizeChanged(); +-} +- +- +-int QMLOutput::outputX() const +-{ +- return m_output->pos().x(); +-} +- +-void QMLOutput::setOutputX(int x) +-{ +- if (m_output->pos().rx() == x) { +- return; +- } +- +- QPoint pos = m_output->pos(); +- pos.setX(x); +- m_output->setPos(pos); +- Q_EMIT outputXChanged(); +-} +- +-int QMLOutput::outputY() const +-{ +- return m_output->pos().y(); +-} +- +-void QMLOutput::setOutputY(int y) +-{ +- if (m_output->pos().ry() == y) { +- return; +- } +- +- QPoint pos = m_output->pos(); +- pos.setY(y); +- m_output->setPos(pos); +- Q_EMIT outputYChanged(); +-} +- +-bool QMLOutput::isCloneMode() const +-{ +- return m_isCloneMode; +-} +- +-void QMLOutput::setIsCloneMode(bool isCloneMode) +-{ +- if (m_isCloneMode == isCloneMode) { +- return; +- } +- +- m_isCloneMode = isCloneMode; +- Q_EMIT isCloneModeChanged(); +-} +- +-void QMLOutput::dockToNeighbours() +-{ +- Q_FOREACH (QMLOutput *otherQmlOutput, m_screen->outputs()) { +- if (otherQmlOutput == this) { +- continue; +- } +- +- if (!otherQmlOutput->output()->isConnected() || !otherQmlOutput->output()->isEnabled()) { +- continue; +- } +- +- const QRect geom = m_output->geometry(); +- +- const QRect otherGeom = otherQmlOutput->output()->geometry(); +- +- //qDebug()<<"geom is ------>"<<geom<<" other:"<<otherGeom<<endl; +- +- if (geom.left() - 1 == otherGeom.right()) { +- setLeftDockedTo(otherQmlOutput); +- continue; +- } +- if (geom.right() + 1 == otherGeom.left()) { +- setRightDockedTo(otherQmlOutput); +- continue; +- } +- if (geom.top() - 1 == otherGeom.bottom()) { +- setTopDockedTo(otherQmlOutput); +- continue; +- } +- if (geom.bottom() + 1 == otherGeom.top()) { +- setBottomDockedTo(otherQmlOutput); +- continue; +- } +- } +-} +- +-int QMLOutput::enableCount() const +-{ +- return m_enableCount; +-} +- +-void QMLOutput::setEnableCount(int count) +-{ +- Q_UNUSED(count); +- m_enableCount = count; +- Q_EMIT enableCountChanged(); +-} +- +-KScreen::ModePtr QMLOutput::bestMode() const +-{ +- if (!m_output) { +- return KScreen::ModePtr(); +- } +- +- KScreen::ModeList modes = m_output->modes(); +- KScreen::ModePtr bestMode; +- Q_FOREACH (const KScreen::ModePtr &mode, modes) { +- if (!bestMode || (mode->size() > bestMode->size())) { +- bestMode = mode; +- } +- } +- +- return bestMode; +-} +- +-bool QMLOutput::collidesWithOutput(QObject *other) +-{ +- QQuickItem* otherItem = qobject_cast<QQuickItem*>(other); +- return boundingRect().intersects(otherItem->boundingRect()); +-} +- +-bool QMLOutput::maybeSnapTo(QMLOutput *other) +-{ +- qreal centerX = x() + (width() / 2.0); +- qreal centerY = y() + (height() / 2.0); +- +- const qreal x2 = other->x(); +- const qreal y2 = other->y(); +- const qreal height2 = other->height(); +- const qreal width2 = other->width(); +- const qreal centerX2 = x2 + (width2 / 2.0); +- const qreal centerY2 = y2 + (height2 / 2.0); +- +- /* left of other */ +- if ((x() + width() > x2 - sSnapArea) && (x() + width() < x2 + sSnapArea) && +- (y() + height() > y2) && (y() < y2 + height2)) +- { +- setX(x2 - width() + sMargin); +- centerX = x() + (width() / 2.0); +- setRightDockedTo(other); +- other->setLeftDockedTo(this); +- //output.cloneOf = null; +- +- /* output is snapped to other on left and their +- * upper sides are aligned */ +- if ((y() < y2 + sSnapAlignArea) && (y() > y2 - sSnapAlignArea)) { +- setY(y2); +- return true; +- } +- +- /* output is snapped to other on left and they +- * are centered */ +- if ((centerY < centerY2 + sSnapAlignArea) && (centerY > centerY2 - sSnapAlignArea)) { +- setY(centerY2 - (height() / 2.0)); +- return true; +- } +- +- /* output is snapped to other on left and their +- * bottom sides are aligned */ +- if ((y() + height() < y2 + height2 + sSnapAlignArea) && +- (y() + height() > y2 + height2 - sSnapAlignArea)) +- { +- setY(y2 + height2 - height()); +- return true; +- } +- +- return true; +- } +- +- /* output is right of other */ +- if ((x() > x2 + width2 - sSnapArea) && (x() < x2 + width2 + sSnapArea) && +- (y() + height() > y2) && (y() < y2 + height2)) +- { +- setX(x2 + width2 - sMargin); +- centerX = x() + (width() / 2.0); +- setLeftDockedTo(other); +- other->setRightDockedTo(this); +- //output.cloneOf = null; +- +- /* output is snapped to other on right and their +- * upper sides are aligned */ +- if ((y() < y2 + sSnapAlignArea) && (y() > y2 - sSnapAlignArea)) { +- setY(y2); +- return true; +- } +- +- /* output is snapped to other on right and they +- * are centered */ +- if ((centerY < centerY2 + sSnapAlignArea) && (centerY > centerY2 - sSnapAlignArea)) { +- setY(centerY2 - (height() / 2.0)); +- return true; +- } +- +- /* output is snapped to other on right and their +- * bottom sides are aligned */ +- if ((y() + height() < y2 + height2 + sSnapAlignArea) && +- (y() + height() > y2 + height2 - sSnapAlignArea)) +- { +- setY(y2 + height2 - height()); +- return true; +- } +- +- return true; +- } +- +- /* output is above other */ +- if ((y() + height() > y2 - sSnapArea) && (y() + height() < y2 + sSnapArea) && +- (x() + width() > x2) && (x() < x2 + width2)) +- { +- setY(y2 - height() + sMargin); +- centerY = y() + (height() / 2.0); +- setBottomDockedTo(other); +- other->setTopDockedTo(this); +- //output.cloneOf = null; +- +- /* output is snapped to other on top and their +- * left sides are aligned */ +- if ((x() < x2 + sSnapAlignArea) && (x() > x2 - sSnapAlignArea)) { +- setX(x2); +- return true; +- } +- +- /* output is snapped to other on top and they +- * are centered */ +- if ((centerX < centerX2 + sSnapAlignArea) && (centerX > centerX2 - sSnapAlignArea)) { +- setX(centerX2 - (width() / 2.0)); +- return true; +- } +- +- /* output is snapped to other on top and their +- * right sides are aligned */ +- if ((x() + width() < x2 + width2 + sSnapAlignArea) && +- (x() + width() > x2 + width2 - sSnapAlignArea)) +- { +- setX(x2 + width2 - width()); +- return true; +- } +- +- return true; +- } +- +- /* output is below other */ +- if ((y() > y2 + height2 - sSnapArea) && (y() < y2 + height2 + sSnapArea) && +- (x() + width() > x2) && (x() < x2 + width2)) +- { +- setY(y2 + height2 - sMargin); +- centerY = y() + (height() / 2.0); +- setTopDockedTo(other); +- other->setBottomDockedTo(this); +- //output.cloneOf = null; +- +- /* output is snapped to other on bottom and their +- * left sides are aligned */ +- if ((x() < x2 + sSnapAlignArea) && (x() > x2 - sSnapAlignArea)) { +- setX(x2); +- return true; +- } +- +- /* output is snapped to other on bottom and they +- * are centered */ +- if ((centerX < centerX2 + sSnapAlignArea) && (centerX > centerX2 - sSnapAlignArea)) { +- setX(centerX2 - (width() / 2.0)); +- return true; +- } +- +- /* output is snapped to other on bottom and their +- * right sides are aligned */ +- if ((x() + width() < x2 + width2 + sSnapAlignArea) && +- (x() + width() > x2 + width2 - sSnapAlignArea)) +- { +- setX(x2 + width2 - width()); +- return true; +- } +- +- return true; +- } +- return false; +-} +- +-void QMLOutput::moved() +-{ +- const QList<QQuickItem*> siblings = screen()->childItems(); +- +- // First, if we have moved, then unset the "cloneOf" flag +- setCloneOf(nullptr); +- +- disconnect(this, &QMLOutput::xChanged, this, static_cast<void(QMLOutput::*)()>(&QMLOutput::moved)); +- disconnect(this, &QMLOutput::yChanged, this, static_cast<void(QMLOutput::*)()>(&QMLOutput::moved)); +- Q_FOREACH (QQuickItem *sibling, siblings) { +- QMLOutput *otherOutput = qobject_cast<QMLOutput*>(sibling); +- if (!otherOutput || otherOutput == this) { +- continue; +- } +- +- if (!maybeSnapTo(otherOutput)) { +- if (m_leftDock == otherOutput) { +- m_leftDock->undockRight(); +- undockLeft(); +- } +- if (m_topDock == otherOutput) { +- m_topDock->undockBottom(); +- undockTop(); +- } +- if (m_rightDock == otherOutput) { +- m_rightDock->undockLeft(); +- undockRight(); +- } +- if (m_bottomDock == otherOutput) { +- m_bottomDock->undockTop(); +- undockBottom(); +- } +- } +- } +- connect(this, &QMLOutput::xChanged, this, static_cast<void(QMLOutput::*)()>(&QMLOutput::moved)); +- connect(this, &QMLOutput::yChanged, this, static_cast<void(QMLOutput::*)()>(&QMLOutput::moved)); +- +- Q_EMIT moved(m_output->name()); +-} +- +- +-/* Transformation of an item (rotation of the MouseArea) is only visual. +- * The coordinates and dimensions are still the same (when you rotated +- * 100x500 rectangle by 90 deg, it will still be 100x500, although +- * visually it will be 500x100). +- * +- * This method calculates the real-visual coordinates and dimensions of +- * the MouseArea and updates root item to match them. This makes snapping +- * work correctly regardless off visual rotation of the output +- */ +- +-//旋转时计算坐标更改方向 +-void QMLOutput::updateRootProperties() +-{ +- const float transformedWidth = (m_output->isHorizontal() ? currentOutputWidth() : currentOutputHeight()) * m_screen->outputScale(); +- const float transformedHeight = (m_output->isHorizontal() ? currentOutputHeight() : currentOutputWidth()) * m_screen->outputScale(); +- +- setSize(QSizeF(transformedWidth, transformedHeight)); +-} +- +-void QMLOutput::setPosClicked(QPointF pos) { +- this->pos_clicked = pos; +-} +- +-QPointF QMLOutput::posClicked() { +- return this->pos_clicked; +-} +diff --git a/plugins/system/display_hw/declarative/qmloutput.h b/plugins/system/display_hw/declarative/qmloutput.h +deleted file mode 100644 +index edd751d..0000000 +--- a/plugins/system/display_hw/declarative/qmloutput.h ++++ /dev/null +@@ -1,217 +0,0 @@ +-/* +- Copyright (C) 2012 Dan Vratil <dvratil@redhat.com> +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- This library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +-*/ +- +-#ifndef QMLOUTPUT_H +-#define QMLOUTPUT_H +- +-#include <QQuickItem> +-#include <KF5/KScreen/kscreen/mode.h> +- +-class QStandardItemModel; +-class QAbstractItemModel; +- +-class ModesProxyModel; +-class QMLScreen; +- +-class QMLOutput : public QQuickItem +-{ +- Q_OBJECT +- +- Q_PROPERTY(KScreen::Output *output +- READ output +- NOTIFY outputChanged) +- +- Q_PROPERTY(KScreen::OutputPtr outputPtr +- READ outputPtr +- WRITE setOutputPtr +- NOTIFY outputChanged) +- +- Q_PROPERTY(bool isCloneMode +- READ isCloneMode +- WRITE setIsCloneMode +- NOTIFY isCloneModeChanged) +- +- Q_PROPERTY(int enableCount +- READ enableCount +- WRITE setEnableCount +- NOTIFY enableCountChanged) +- +- Q_PROPERTY(QMLScreen* screen +- READ screen +- WRITE setScreen +- NOTIFY screenChanged) +- +- Q_PROPERTY(QMLOutput* cloneOf +- READ cloneOf +- WRITE setCloneOf +- NOTIFY cloneOfChanged) +- +- Q_PROPERTY(QMLOutput* leftDockedTo +- READ leftDockedTo +- WRITE setLeftDockedTo +- RESET undockLeft +- NOTIFY leftDockedToChanged) +- +- Q_PROPERTY(QMLOutput* topDockedTo +- READ topDockedTo +- WRITE setTopDockedTo +- RESET undockTop +- NOTIFY topDockedToChanged) +- +- Q_PROPERTY(QMLOutput* rightDockedTo +- READ rightDockedTo +- WRITE setRightDockedTo +- RESET undockRight +- NOTIFY rightDockedToChanged) +- +- Q_PROPERTY(QMLOutput* bottomDockedTo +- READ bottomDockedTo +- WRITE setBottomDockedTo +- RESET undockBottom +- NOTIFY bottomDockedToChanged) +- +- Q_PROPERTY(int currentOutputHeight +- READ currentOutputHeight +- NOTIFY currentOutputSizeChanged) +- +- Q_PROPERTY(int currentOutputWidth +- READ currentOutputWidth +- NOTIFY currentOutputSizeChanged) +- +- /* Workaround for possible QML bug when calling output.pos.y = VALUE works, +- * but output.pos.x = VALUE has no effect */ +- Q_PROPERTY(int outputX +- READ outputX +- WRITE setOutputX +- NOTIFY outputXChanged) +- +- Q_PROPERTY(int outputY +- READ outputY +- WRITE setOutputY +- NOTIFY outputYChanged) +- +-public: +- enum { +- ModeRole = Qt::UserRole, +- ModeIdRole, +- SizeRole, +- RefreshRateRole +- }; +- +- explicit QMLOutput(QQuickItem *parent = nullptr); +- +- KScreen::Output *output() const; // For QML +- +- KScreen::OutputPtr outputPtr() const; +- void setOutputPtr(const KScreen::OutputPtr &output); +- +- QMLScreen *screen() const; +- void setScreen(QMLScreen *screen); +- +- QMLOutput *leftDockedTo() const; +- void setLeftDockedTo(QMLOutput *output); +- void undockLeft(); +- +- QMLOutput *topDockedTo() const; +- void setTopDockedTo(QMLOutput *output); +- void undockTop(); +- +- QMLOutput *rightDockedTo() const; +- void setRightDockedTo(QMLOutput *output); +- void undockRight(); +- +- QMLOutput *bottomDockedTo() const; +- void setBottomDockedTo(QMLOutput *output); +- void undockBottom(); +- +- Q_INVOKABLE bool collidesWithOutput(QObject *other); +- Q_INVOKABLE bool maybeSnapTo(QMLOutput *other); +- +- void setCloneOf(QMLOutput *other); +- QMLOutput *cloneOf() const; +- +- int currentOutputHeight() const; +- int currentOutputWidth() const; +- +- int outputX() const; +- void setOutputX(int x); +- +- int outputY() const; +- void setOutputY(int y); +- +- void setIsCloneMode(bool isCloneMode); +- bool isCloneMode() const; +- +- void dockToNeighbours(); +- +- int enableCount() const; +- void setEnableCount(int count = 0); +- void setPosClicked(QPointF pos); +- QPointF posClicked(); +- +-public Q_SLOTS: +- void updateRootProperties(); +- +-Q_SIGNALS: +- void changed(); +- +- void moved(const QString &self); +- +- /* Property notifications */ +- void outputChanged(); +- void screenChanged(); +- void cloneOfChanged(); +- void currentOutputSizeChanged(); +- +- void leftDockedToChanged(); +- void topDockedToChanged(); +- void rightDockedToChanged(); +- void bottomDockedToChanged(); +- +- void outputYChanged(); +- void outputXChanged(); +- +- void isCloneModeChanged(); +- +- void enableCountChanged(); +- +-private Q_SLOTS: +- void moved(); +- void currentModeIdChanged(); +- +-private: +- /** +- * Returns the biggest resolution available assuming it's the preferred one +- */ +- KScreen::ModePtr bestMode() const; +- +- KScreen::OutputPtr m_output; +- QMLScreen *m_screen; +- +- QMLOutput *m_cloneOf; +- QMLOutput *m_leftDock; +- QMLOutput *m_topDock; +- QMLOutput *m_rightDock; +- QMLOutput *m_bottomDock; +- QPointF pos_clicked; +- +- bool m_isCloneMode; +- int m_enableCount; +-}; +- +-#endif // QMLOUTPUT_H +diff --git a/plugins/system/display_hw/declarative/qmloutputcomponent.cpp b/plugins/system/display_hw/declarative/qmloutputcomponent.cpp +deleted file mode 100644 +index cdfe186..0000000 +--- a/plugins/system/display_hw/declarative/qmloutputcomponent.cpp ++++ /dev/null +@@ -1,63 +0,0 @@ +-/* +- Copyright (C) 2012 Dan Vratil <dvratil@redhat.com> +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- This library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +-*/ +- +-#include "qmloutputcomponent.h" +-#include "qmloutput.h" +-#include "qmlscreen.h" +- +-#include <KF5/KScreen/kscreen/output.h> +- +-#include <QDir> +-#include <QStandardPaths> +-#include <QQmlEngine> +-#include <QDebug> +-#include <KF5/KScreen/kscreen/types.h> +- +-Q_DECLARE_METATYPE(KScreen::OutputPtr) +-Q_DECLARE_METATYPE(QMLScreen*) +- +-QMLOutputComponent::QMLOutputComponent(QQmlEngine *engine, QMLScreen *parent): +- QQmlComponent(engine, parent), +- m_engine(engine) +-{ +- loadUrl(QUrl("qrc:/qml/Output.qml")); +-} +- +-QMLOutputComponent::~QMLOutputComponent() +-{ +-} +- +-QMLOutput* QMLOutputComponent::createForOutput(const KScreen::OutputPtr &output) +-{ +- QObject *instance = beginCreate(m_engine->rootContext()); +- if (!instance) { +- qWarning() << errorString(); +- return nullptr; +- } +- +- bool success = instance->setProperty("outputPtr", QVariant::fromValue(qobject_cast<KScreen::OutputPtr>(output))); +- +- Q_ASSERT(success); +- success = instance->setProperty("screen", QVariant::fromValue(qobject_cast<QMLScreen*>(parent()))); +- Q_ASSERT(success); +- Q_UNUSED(success); +- +- completeCreate(); +- +- return qobject_cast<QMLOutput*>(instance); +-} +diff --git a/plugins/system/display_hw/declarative/qmloutputcomponent.h b/plugins/system/display_hw/declarative/qmloutputcomponent.h +deleted file mode 100644 +index cf38ab3..0000000 +--- a/plugins/system/display_hw/declarative/qmloutputcomponent.h ++++ /dev/null +@@ -1,43 +0,0 @@ +-/* +- Copyright (C) 2012 Dan Vratil <dvratil@redhat.com> +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- This library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +-*/ +- +-#ifndef QMLOUTPUTCOMPONENT_H +-#define QMLOUTPUTCOMPONENT_H +- +-#include <QQmlComponent> +- +-#include <KF5/KScreen/kscreen/output.h> +- +-class QMLScreen; +-class QMLOutput; +- +-class QMLOutputComponent : public QQmlComponent +-{ +- Q_OBJECT +- +-public: +- explicit QMLOutputComponent(QQmlEngine *engine, QMLScreen *parent); +- ~QMLOutputComponent() override; +- +- QMLOutput *createForOutput(const KScreen::OutputPtr &output); +- +-private: +- QQmlEngine *m_engine; +-}; +- +-#endif // QMLOUTPUTCOMPONENT_H +diff --git a/plugins/system/display_hw/declarative/qmlscreen.cpp b/plugins/system/display_hw/declarative/qmlscreen.cpp +deleted file mode 100644 +index ae469d9..0000000 +--- a/plugins/system/display_hw/declarative/qmlscreen.cpp ++++ /dev/null +@@ -1,708 +0,0 @@ +-/* +- Copyright (C) 2012 Dan Vratil <dvratil@redhat.com> +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- This library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +-*/ +- +-#include "qmlscreen.h" +-#include "qmloutputcomponent.h" +-#include "qmloutput.h" +- +-#include "screenConfig.h" +- +-#include <KF5/KScreen/kscreen/output.h> +-#include <KF5/KScreen/kscreen/config.h> +- +-#include <QDBusMessage> +-#include <QDBusArgument> +-#include <QDBusInterface> +- +-#include <QTimer> +-#include <sys/socket.h> +- +-Q_DECLARE_METATYPE(KScreen::OutputPtr) +- +-static bool sizeLessThan(ScreenConfig posxA, ScreenConfig posxB) +-{ +- return posxA.screenPosX > posxB.screenPosY; +-} +- +-static bool sizeLessThanQml(QPointF posxA, QPointF posxB) +-{ +- return posxA.x() > posxB.x(); +-} +- +-QMLScreen::QMLScreen(QQuickItem *parent) : +- QQuickItem(parent) +-{ +- connect(this, &QMLScreen::widthChanged, this, &QMLScreen::viewSizeChanged); +- connect(this, &QMLScreen::heightChanged, this, &QMLScreen::viewSizeChanged); +-} +- +-QMLScreen::~QMLScreen() +-{ +- qDeleteAll(m_outputMap); +- m_outputMap.clear(); +-} +- +-KScreen::ConfigPtr QMLScreen::config() const +-{ +- return m_config; +-} +- +-void QMLScreen::setConfig(const KScreen::ConfigPtr &config) +-{ +- qDeleteAll(m_outputMap); +- m_outputMap.clear(); +- m_manuallyMovedOutputs.clear(); +- m_bottommost = m_leftmost = m_rightmost = m_topmost = nullptr; +- m_connectedOutputsCount = 0; +- m_enabledOutputsCount = 0; +- +- if (m_config) { +- m_config->disconnect(this); +- } +- +- m_config = config; +- connect(m_config.data(), &KScreen::Config::outputAdded, +- this, [this](const KScreen::OutputPtr &output) { +- addOutput(output); +- m_manuallyMovedOutputs.clear(); +- updateOutputsPlacement(); +- enableChangedSlot(); +- }); +- connect(m_config.data(), &KScreen::Config::outputRemoved, +- this, &QMLScreen::removeOutput); +- +- for (const KScreen::OutputPtr &output : m_config->outputs()) { +- addOutput(output); +- } +- +- updateOutputsPlacement(); +- +- for (QMLOutput *qmlOutput : m_outputMap) { +- if (qmlOutput->output()->isConnected() && qmlOutput->output()->isEnabled()) { +- qmlOutput->dockToNeighbours(); +- } +- } +-} +- +-void QMLScreen::addOutput(const KScreen::OutputPtr &output) +-{ +- QMLOutputComponent comp(qmlEngine(this), this); +- +- QMLOutput *qmloutput = comp.createForOutput(output); +- if (!qmloutput) { +- qWarning() << "Failed to create QMLOutput"; +- return; +- } +- +- m_outputMap.insert(output, qmloutput); +- +- qmloutput->setParentItem(this); +- qmloutput->setZ(m_outputMap.count()); +- +- connect(output.data(), &KScreen::Output::isConnectedChanged, +- this, &QMLScreen::outputConnectedChanged); +- connect(output.data(), &KScreen::Output::isEnabledChanged, +- this, &QMLScreen::outputEnabledChanged); +- connect(output.data(), &KScreen::Output::posChanged, +- this, &QMLScreen::outputPositionChanged); +- connect(qmloutput, &QMLOutput::yChanged, +- [this, qmloutput]() { +- qmlOutputMoved(qmloutput); +- }); +- connect(qmloutput, &QMLOutput::xChanged, +- [this, qmloutput]() { +- qmlOutputMoved(qmloutput); +- }); +- // 在这里点击上面小屏幕 +- connect(qmloutput, SIGNAL(clicked()), +- this, SLOT(setActiveOutput())); +- +- connect(qmloutput, SIGNAL(mouseReleased(bool)), +- this, SLOT(setScreenPos(bool))); +- +- connect(qmloutput, SIGNAL(rotationChanged(bool)), +- this, SLOT(setScreenPos(bool))); +- +- connect(qmloutput, SIGNAL(widthChanged(bool)), +- this, SLOT(setScreenPos(bool))); +- +- connect(qmloutput, SIGNAL(heightChanged(bool)), +- this, SLOT(setScreenPos(bool))); +- +- // bug#65441 +- // qmloutput->updateRootProperties(); +-} +- +-void QMLScreen::removeOutput(int outputId) +-{ +- for (const KScreen::OutputPtr &output : m_outputMap.keys()) { +- if (output->id() == outputId) { +- QMLOutput *qmlOutput = m_outputMap.take(output); +- qmlOutput->setParentItem(nullptr); +- qmlOutput->setParent(nullptr); +- // TODO:bug51346 +- // qmlOutput->deleteLater(); +- return; +- } +- } +- enableChangedSlot(); +-} +- +-int QMLScreen::connectedOutputsCount() const +-{ +- return m_connectedOutputsCount; +-} +- +-int QMLScreen::enabledOutputsCount() const +-{ +- return m_enabledOutputsCount; +-} +- +-QMLOutput *QMLScreen::primaryOutput() const +-{ +- Q_FOREACH (QMLOutput *qmlOutput, m_outputMap) { +- if (qmlOutput->output()->isPrimary()) { +- return qmlOutput; +- } +- } +- +- return nullptr; +-} +- +-QList<QMLOutput *> QMLScreen::outputs() const +-{ +- return m_outputMap.values(); +-} +- +-void QMLScreen::setActiveOutput(QMLOutput *output) +-{ +- output->setPosClicked(output->position()); +- Q_FOREACH (QMLOutput *qmlOutput, m_outputMap) { +- if (qmlOutput->z() > output->z()) { +- qmlOutput->setZ(qmlOutput->z() - 1); +- } +- } +- +- output->setZ(m_outputMap.count()); +- // 中屏幕 +- output->setFocus(true); +- Q_EMIT focusedOutputChanged(output); +-} +- +-void QMLScreen::setScreenCenterPos() +-{ +- // 组成最大矩形四个边的位置,分别对应左上(1),右下(2)的xy坐标值 +- qreal localX1 = -1, localX2 = -1, localY1 = -1, localY2 = -1; +- qreal mX1 = 0, mY1 = 0, mX2 = 0, mY2 = 0; // 矩形中点坐标 +- qreal moveX = 0, moveY = 0;// 移动的值 +- bool firstFlag = true; +- bool unifyFlag = false; +- Q_FOREACH (QMLOutput *qmlOutput, m_outputMap) { +- if (qmlOutput->output()->isConnected()) { +- if (qmlOutput->isCloneMode()) { +- localX1 = qmlOutput->x(); +- localX2 = qmlOutput->x() + qmlOutput->width(); +- localY1 = qmlOutput->y(); +- localY2 = qmlOutput->y() + qmlOutput->height(); +- unifyFlag = true; +- break; +- } +- +- if (firstFlag == true || localX1 > qmlOutput->x()) { +- localX1 = qmlOutput->x(); +- } +- if (firstFlag == true || localX2 < qmlOutput->x() + qmlOutput->width()) { +- localX2 = qmlOutput->x() + qmlOutput->width(); +- } +- if (firstFlag == true || localY1 > qmlOutput->y()) { +- localY1 = qmlOutput->y(); +- } +- if (firstFlag == true || localY2 < qmlOutput->y() + qmlOutput->height()) { +- localY2 = qmlOutput->y() + qmlOutput->height(); +- } +- firstFlag = false; +- } +- } +- +- mX1 = localX1 + (localX2-localX1)/2; +- mY1 = localY1 + (localY2-localY1)/2; +- +- mX2 = (width() - (localX2 - localX1))/2 + (localX2-localX1)/2; +- mY2 = (height() - (localY2 - localY1))/2 + (localY2-localY1)/2; +- +- moveX = mX2 - mX1; +- moveY = mY2 - mY1; +- +- Q_FOREACH (QMLOutput *qmlOutput, m_outputMap) { +- if (false == unifyFlag) { +- qmlOutput->setX(qmlOutput->x() + moveX); +- qmlOutput->setY(qmlOutput->y() + moveY); +- } else { +- if (qmlOutput->isCloneMode()) { +- qmlOutput->blockSignals(true); +- qmlOutput->setX(qmlOutput->x() + moveX); +- qmlOutput->setY(qmlOutput->y() + moveY); +- qmlOutput->blockSignals(false); +- break; +- } +- } +- } +-} +- +-void QMLScreen::setScreenPosCenter(QMLOutput *output, bool isReleased) +-{ +- if (output == nullptr) { +- return; +- } +- QPointF posBefore = output->posClicked(); +- if ((output->outputPtr()->rotation() == KScreen::Output::Left || output->outputPtr()->rotation() == KScreen::Output::Right) +- && (output->width() > output->height())) { +- qreal fwidth = output->size().width(); +- qreal fheight = output->size().height(); +- output->setSize(QSizeF(fheight, fwidth)); +- } +- // 镜像模式下跳过屏幕旋转处理 +- if (this->primaryOutput() && isCloneMode()) { +- return; +- } +- +- qreal x1 = 0, y1 = 0; +- qreal width1 = 0, height1 = 0; +- qreal x2 = 0, y2 = 0; +- qreal width2 = 0, height2 = 0; +- +- x1 = output->x(); +- y1 = output->y(); +- width1 = output->width(); +- height1 = output->height(); +- +- int connectedScreen = 0; +- +- QMLOutput *other = NULL; +- Q_FOREACH (QMLOutput *qmlOutput, m_outputMap) { +- if (qmlOutput->output()->isConnected()) { +- connectedScreen++; +- } +- if (qmlOutput != output && qmlOutput->output()->isConnected()) { +- other = qmlOutput; +- x2 = other->x(); +- y2 = other->y(); +- if ((other->outputPtr()->rotation() == KScreen::Output::Left || other->outputPtr()->rotation() == KScreen::Output::Right) && +- (other->width() > other->height())) { +- qreal swidth = qmlOutput->width(); +- qreal sheigth = qmlOutput->height(); +- qmlOutput->setSize(QSizeF(sheigth, swidth)); +- } +- width2 = other->width(); +- height2 = other->height(); +- } +- } +- +- // 坐标为负的情况,bug#76350 +- if (x1 < 0 || y1 < 0 || x2 < 0 || y2 < 0) { +- return; +- } +- +- if (connectedScreen < 2) { +- setScreenCenterPos(); +- return; +- } +- +- if (!((x1 + width1 == x2) +- || (y1 == y2 + height2) +- || (x1 == x2 + width2) +- || (y1 + height1 == y2))) { +- if (x1 + width1 < x2) { +- output->setX(x2 - width1); +- output->setY(y2); +- } else if (y1 > y2 + height2) { +- output->setX(x2); +- output->setY(y2 + height2); +- } else if (x1 > x2 + width2) { +- output->setX(x2 + width2); +- output->setY(y2); +- } else if (y1 + height1 < y2) { +- output->setX(x2); +- output->setY(y2 - height1); +- } +- +- +- +- // 矩形是否相交 +- if (!(x1 + width1 <= x2 || x2 + width2 <= x1 +- || y1 >= y2 +height2 || y2 >= y1 + height1) +- && (x1 != x2 || y1 != y2) && other != NULL +- && other->output()->isConnected()) { +- if ((x1 + width1 > x2) && (x1 < x2)) { +- output->setX(x2 - width1); +- } else if ((x1 < x2 + width2) && (x1 + width1 > x2 + width2)) { +- output->setX(x2 + width2); +- } else if ((y1 + height() > y2) && (y1 < y2 + height2)) { +- output->setY(y2 - height1); +- } else if ((y1 < y2 + height2) && (y1 + height1 > y2 + height2)) { +- output->setY(y2 + height2); +- } +- } +- } +- +- setScreenCenterPos(); +- QPointF posAfter = output->position(); +- if (isReleased && (posBefore != posAfter)) { +- Q_EMIT released(); +- } +-} +- +-void QMLScreen::setActiveOutputByCombox(int screenId) +-{ +- QHash<KScreen::OutputPtr, QMLOutput *>::const_iterator it = m_outputMap.constBegin(); +- while (it != m_outputMap.constEnd()) { +- if (screenId == it.key()->id()) { +- setActiveOutput(it.value()); +- return; +- } +- it++; +- } +-} +- +-void QMLScreen::enableChangedSlot() +-{ +- int count = 0; +- for (KScreen::OutputPtr output : m_config->connectedOutputs()) { +- if (output->isEnabled()) { +- count++; +- } +- } +- +- Q_FOREACH (QQuickItem *item, childItems()) { +- QMLOutput *qmlOutput = qobject_cast<QMLOutput *>(item); +- qmlOutput->setEnableCount(count); +- } +-} +- +-QSize QMLScreen::maxScreenSize() const +-{ +- return m_config->screen()->maxSize(); +-} +- +-float QMLScreen::outputScale() const +-{ +- return m_outputScale; +-} +- +-void QMLScreen::outputConnectedChanged() +-{ +- int connectedCount = 0; +- +- Q_FOREACH (const KScreen::OutputPtr &output, m_outputMap.keys()) { +- if (output->isConnected()) { +- ++connectedCount; +- } +- } +- +- if (connectedCount != m_connectedOutputsCount) { +- m_connectedOutputsCount = connectedCount; +- Q_EMIT connectedOutputsCountChanged(); +- updateOutputsPlacement(); +- } +-} +- +-void QMLScreen::outputEnabledChanged() +-{ +- const KScreen::OutputPtr output(qobject_cast<KScreen::Output *>(sender()), [](void *){}); +- +- int enabledCount = 0; +- +- Q_FOREACH (const KScreen::OutputPtr &output, m_outputMap.keys()) { +- if (output->isEnabled()) { +- ++enabledCount; +- } +- } +- +- if (enabledCount == m_enabledOutputsCount) { +- m_enabledOutputsCount = enabledCount; +- Q_EMIT enabledOutputsCountChanged(); +- } +-} +- +-void QMLScreen::outputPositionChanged() +-{ +- /* TODO: Reposition the QMLOutputs */ +-} +- +-void QMLScreen::qmlOutputMoved(QMLOutput *qmlOutput) +-{ +- if (qmlOutput->isCloneMode()) { +- return; +- } +- +- if (!m_manuallyMovedOutputs.contains(qmlOutput)) +- m_manuallyMovedOutputs.append(qmlOutput); +- +- updateCornerOutputs(); +- +- if (m_leftmost) { +- m_leftmost->setOutputX(0); +- } +- if (m_topmost) { +- m_topmost->setOutputY(0); +- } +- +- if (qmlOutput == m_leftmost) { +- Q_FOREACH (QMLOutput *other, m_outputMap) { +- if (other == m_leftmost) { +- continue; +- } +- +- if (!other->output()->isConnected() || !other->output()->isEnabled()) { +- continue; +- } +- +- other->setOutputX(float(other->x() - m_leftmost->x()) / outputScale()); +- } +- } else if (m_leftmost) { +- qmlOutput->setOutputX(float(qmlOutput->x() - m_leftmost->x()) / outputScale()); +- } +- +- if (qmlOutput == m_topmost) { +- Q_FOREACH (QMLOutput *other, m_outputMap) { +- if (other == m_topmost) { +- continue; +- } +- +- if (!other->output()->isConnected() || !other->output()->isEnabled()) { +- continue; +- } +- +- other->setOutputY(float(other->y() - m_topmost->y()) / outputScale()); +- } +- } else if (m_topmost) { +- qmlOutput->setOutputY(float(qmlOutput->y() - m_topmost->y()) / outputScale()); +- } +-} +- +-void QMLScreen::viewSizeChanged() +-{ +- updateOutputsPlacement(); +- setScreenCenterPos(); +-} +- +-void QMLScreen::updateCornerOutputs() +-{ +- m_leftmost = nullptr; +- m_topmost = nullptr; +- m_rightmost = nullptr; +- m_bottommost = nullptr; +- +- Q_FOREACH (QMLOutput *output, m_outputMap) { +- if (!output->output()->isConnected() || !output->output()->isEnabled()) { +- continue; +- } +- +- QMLOutput *other = m_leftmost; +- if (!other || output->x() < other->x()) { +- m_leftmost = output; +- } +- +- if (!other || output->y() < other->y()) { +- m_topmost = output; +- } +- +- if (!other || output->x() + output->width() > other->x() + other->width()) { +- m_rightmost = output; +- } +- +- if (!other || output->y() + output->height() > other->y() + other->height()) { +- m_bottommost = output; +- } +- } +-} +- +-void QMLScreen::setOutputScale(float scale) +-{ +- if (qFuzzyCompare(scale, m_outputScale)) +- return; +- m_outputScale = scale; +- emit outputScaleChanged(); +-} +- +-bool QMLScreen::isCloneMode() +-{ +- KScreen::OutputPtr output = m_config->primaryOutput(); +- if (m_config->connectedOutputs().count() >= 2) { +- foreach (KScreen::OutputPtr secOutput, m_config->connectedOutputs()) { +- if (secOutput->geometry() != output->geometry() || !secOutput->isEnabled()) { +- return false; +- } +- } +- } else { +- return false; +- } +- return true; +-} +- +-// 画坐标 +-void QMLScreen::updateOutputsPlacement() +-{ +- if (width() <= 0) +- return; +- +- QSizeF initialActiveScreenSize; +- +- Q_FOREACH (QQuickItem *item, childItems()) { +- QMLOutput *qmlOutput = qobject_cast<QMLOutput *>(item); +- if (!qmlOutput->output()->isConnected() || !qmlOutput->output()->isEnabled()) { +- continue; +- } +- +- if (qmlOutput->outputX() + qmlOutput->currentOutputWidth() +- > initialActiveScreenSize.width()) { +- initialActiveScreenSize.setWidth(qmlOutput->outputX() +- + qmlOutput->currentOutputWidth()); +- } +- if (qmlOutput->outputY() + qmlOutput->currentOutputHeight() +- > initialActiveScreenSize.height()) { +- initialActiveScreenSize.setHeight( +- qmlOutput->outputY() + qmlOutput->currentOutputHeight()); +- } +- } +- +- auto initialScale = outputScale(); +- +- auto scale = initialScale; +- qreal lastX = -1.0; +- int enableCount; +- do { +- auto activeScreenSize = initialActiveScreenSize * scale; +- +- const QPointF offset((width() - activeScreenSize.width()) / 2.0, +- (height() - activeScreenSize.height()) / 2.0); +- +- lastX = -1.0; +- qreal lastY = -1.0; +- enableCount = 0; +- Q_FOREACH (QQuickItem *item, childItems()) { +- QMLOutput *qmlOutput = qobject_cast<QMLOutput *>(item); +- if (m_config->connectedOutputs().count() >= 2 && qmlOutput->outputPtr()->isEnabled()) { +- enableCount++; +- } +- // 连接 +- if ((!qmlOutput->output()->isConnected() || !qmlOutput->output()->isEnabled() +- || m_manuallyMovedOutputs.contains(qmlOutput)) && !qmlOutput->isCloneMode()) { +- continue; +- } +- +- qmlOutput->blockSignals(true); +- qmlOutput->setPosition(QPointF(offset.x() + (qmlOutput->outputX() * scale), +- offset.y() + (qmlOutput->outputY() * scale))); +- lastX = qMax(lastX, +- qmlOutput->position().x() + qmlOutput->width() / initialScale * scale); +- lastY = qMax(lastY, qmlOutput->position().y()); +- qmlOutput->blockSignals(false); +- } +- +- Q_FOREACH (QQuickItem *item, childItems()) { +- QMLOutput *qmlOutput = qobject_cast<QMLOutput *>(item); +- if (qmlOutput->output()->isConnected() && !qmlOutput->output()->isEnabled() +- && !m_manuallyMovedOutputs.contains(qmlOutput)) { +- qmlOutput->blockSignals(true); +- qmlOutput->setPosition(QPointF(lastX, lastY)); +- lastX += qmlOutput->width() / initialScale * scale; +- qmlOutput->blockSignals(false); +- } +- } +- // calculate the scale dynamically, so all screens fit to the dialog +- if (lastX > width()) { +- scale *= 0.8; +- } +- } while (lastX > width()); +- +- if (enableCount == 1) { +- setPosByConfig(); +- } +- +- // Use a timer to avoid binding loop on width() +- QTimer::singleShot(0, this, [scale, this] { +- setOutputScale(scale); +- }); +-} +- +-void QMLScreen::setPosByConfig() +-{ +- if (!m_config.isNull()) { +- +- QDBusInterface mUkccInterface("org.ukui.ukcc.session", +- "/", +- "org.ukui.ukcc.session.interface", +- QDBusConnection::sessionBus()); +- +- QDBusMessage msg = mUkccInterface.call("getPreScreenCfg"); +- if (msg.type() == QDBusMessage::ErrorMessage) { +- qWarning() << "get pre screen cfg failed"; +- } +- QDBusArgument argument = msg.arguments().at(0).value<QDBusArgument>(); +- QList<QVariant> infos; +- argument >> infos; +- +- QList<QPointF> qmlScreens; +- QList<ScreenConfig> preScreenCfg; +- +- +- QList<QPoint> points; +- for (int i = 0; i < infos.size(); i++) { +- ScreenConfig cfg; +- infos.at(i).value<QDBusArgument>() >> cfg; +- preScreenCfg.append(cfg); +- // 坐标相同不做处理 +- if (points.contains(QPoint(cfg.screenPosX, cfg.screenPosY))) { +- return; +- } +- points.append(QPoint(cfg.screenPosX, cfg.screenPosY)); +- } +- +- // 配置文件为空跳过处理 +- if (preScreenCfg.isEmpty()) { +- return; +- } +- +- std::sort(preScreenCfg.begin(), preScreenCfg.end(), sizeLessThan); +- +- Q_FOREACH (QQuickItem *item, childItems()) { +- QMLOutput *qmlOutput = qobject_cast<QMLOutput *>(item); +- qmlScreens.append(qmlOutput->position()); +- } +- std::sort(qmlScreens.begin(), qmlScreens.end(), sizeLessThanQml); +- +- QMLOutput *adjustOutput; +- for (int i = 0; i < preScreenCfg.count(); i++) { +- for (int j = 0; j < childItems().count(); j++) { +- QMLOutput *qmlOutput = qobject_cast<QMLOutput *>(childItems().at(j)); +- if (qmlOutput != nullptr) { +- adjustOutput = qmlOutput; +- } +- +- if (!qmlOutput->outputPtr()->name().compare(preScreenCfg.at(i).screenId)) { +- qmlOutput->blockSignals(true); +- qmlOutput->setPosition(qmlScreens.at(i)); +- qmlOutput->blockSignals(false); +- } +- } +- } +- +- setScreenPosCenter(adjustOutput, false); +- } +-} +diff --git a/plugins/system/display_hw/declarative/qmlscreen.h b/plugins/system/display_hw/declarative/qmlscreen.h +deleted file mode 100644 +index 66f4b7a..0000000 +--- a/plugins/system/display_hw/declarative/qmlscreen.h ++++ /dev/null +@@ -1,133 +0,0 @@ +-/* +- Copyright (C) 2012 Dan Vratil <dvratil@redhat.com> +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- This library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +-*/ +- +-#ifndef QMLSCREEN_H +-#define QMLSCREEN_H +- +-#include <QQuickItem> +- +-#include <KF5/KScreen/kscreen/output.h> +-#include "qmloutput.h" +- +-class QQmlEngine; +- +-namespace KScreen { +-class Output; +-class Config; +-} +- +-class QMLScreen : public QQuickItem +-{ +- Q_OBJECT +- +- Q_PROPERTY(QSize maxScreenSize +- READ maxScreenSize +- CONSTANT) +- +- Q_PROPERTY(int connectedOutputsCount +- READ connectedOutputsCount +- NOTIFY connectedOutputsCountChanged) +- +- Q_PROPERTY(int enabledOutputsCount +- READ enabledOutputsCount +- NOTIFY enabledOutputsCountChanged) +- +- Q_PROPERTY(float outputScale +- READ outputScale +- NOTIFY outputScaleChanged) +- +-public: +- explicit QMLScreen(QQuickItem *parent = nullptr); +- ~QMLScreen() override; +- +- int connectedOutputsCount() const; +- int enabledOutputsCount() const; +- +- QMLOutput *primaryOutput() const; +- QList<QMLOutput*> outputs() const; +- +- QSize maxScreenSize() const; +- +- float outputScale() const; +- +- KScreen::ConfigPtr config() const; +- void setConfig(const KScreen::ConfigPtr &config); +- +- void updateOutputsPlacement(); +- void setPosByConfig(); +- +- void setActiveOutput(QMLOutput *output); +- +- void setScreenPosCenter(QMLOutput *output, bool isReleased); +- +- void setScreenCenterPos(); +-public Q_SLOTS: +- void setActiveOutput() +- { +- setActiveOutput(qobject_cast<QMLOutput *>(sender())); +- } +- +- void setActiveOutputByCombox(int screenId); +- void setScreenPos(bool isReleased) +- { +- setScreenPosCenter(qobject_cast<QMLOutput*>(sender()), isReleased); +- } +- +- // 是否禁用小屏幕拖动 +- void enableChangedSlot(); +- +-Q_SIGNALS: +- void connectedOutputsCountChanged(); +- void enabledOutputsCountChanged(); +- +- void outputScaleChanged(); +- +- void focusedOutputChanged(QMLOutput *output); +- void released(); +- +-private Q_SLOTS: +- void addOutput(const KScreen::OutputPtr &output); +- void removeOutput(int outputId); +- +- void outputConnectedChanged(); +- void outputEnabledChanged(); +- void outputPositionChanged(); +- +- void viewSizeChanged(); +- +-private: +- void qmlOutputMoved(QMLOutput *qmlOutput); +- void updateCornerOutputs(); +- void setOutputScale(float scale); +- bool isCloneMode(); +- +- KScreen::ConfigPtr m_config; +- QHash<KScreen::OutputPtr, QMLOutput *> m_outputMap; +- QVector<QMLOutput*> m_manuallyMovedOutputs; +- int m_connectedOutputsCount = 0; +- int m_enabledOutputsCount = 0; +- +- float m_outputScale = 1.0 / 14.0;// 缩放比例 +- +- QMLOutput *m_leftmost = nullptr; +- QMLOutput *m_topmost = nullptr; +- QMLOutput *m_rightmost = nullptr; +- QMLOutput *m_bottommost = nullptr; +-}; +- +-#endif // QMLSCREEN_H +diff --git a/plugins/system/display_hw/display_hw.cpp b/plugins/system/display_hw/display_hw.cpp +deleted file mode 100644 +index e11f9c0..0000000 +--- a/plugins/system/display_hw/display_hw.cpp ++++ /dev/null +@@ -1,105 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include <QtWidgets> +- +-#include "display_hw.h" +-#include "ui_display_hw.h" +-#include "ukcccommon.h" +-using namespace ukcc; +- +-#include <KF5/KScreen/kscreen/getconfigoperation.h> +-#include <KF5/KScreen/kscreen/output.h> +-#include <QDebug> +-#include <QDBusInterface> +-#include <QDBusConnection> +- +-DisplaySet::DisplaySet() : mFirstLoad(true) +-{ +- pluginName = tr("Display"); +- pluginType = SYSTEM; +-} +- +-DisplaySet::~DisplaySet() +-{ +-} +- +-QString DisplaySet::plugini18nName() +-{ +- return pluginName; +-} +- +-int DisplaySet::pluginTypes() +-{ +- return pluginType; +-} +- +-QWidget *DisplaySet::pluginUi() +-{ +- if (mFirstLoad) { +- requestBackend(); +- mFirstLoad = false; +- pluginWidget = new Widget; +- pluginWidget->adjustSize(); +- QObject::connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, +- [&](KScreen::ConfigOperation *op) { +- pluginWidget->setConfig(qobject_cast<KScreen::GetConfigOperation *>(op)->config(), true); +- }); +- } +- return pluginWidget; +-} +- +-const QString DisplaySet::name() const +-{ +- return QStringLiteral("Display"); +-} +- +-bool DisplaySet::isShowOnHomePage() const +-{ +- return UkccCommon::isWayland(); +-} +- +-QIcon DisplaySet::icon() const +-{ +- return QIcon::fromTheme("system-computer-symbolic"); +-} +- +-bool DisplaySet::isEnable() const +-{ +- return UkccCommon::isWayland(); +-} +- +-void DisplaySet::requestBackend() +-{ +- QDBusInterface screenIft("org.kde.KScreen", +- "/", +- "org.kde.KScreen", +- QDBusConnection::sessionBus()); +- if (!screenIft.isValid()) { +- QProcess process; +- process.start("uname -m"); +- process.waitForFinished(); +- QString output = process.readAll(); +- output = output.simplified(); +- +- QString command = "/usr/lib/" + output + "-linux-gnu" +- +"/libexec/kf5/kscreen_backend_launcher"; +- QProcess::startDetached(command); +- } +-} +diff --git a/plugins/system/display_hw/display_hw.h b/plugins/system/display_hw/display_hw.h +deleted file mode 100644 +index 6ca40d4..0000000 +--- a/plugins/system/display_hw/display_hw.h ++++ /dev/null +@@ -1,64 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef DISPLAYSET_H +-#define DISPLAYSET_H +- +-#include <QObject> +-#include <QtPlugin> +- +-#include <QGSettings> +- +-#include "shell/interface.h" +-#include "widget.h" +- +-namespace Ui { +-class DisplayWindow; +-} +- +-class DisplaySet : public QObject, CommonInterface +-{ +- Q_OBJECT +- Q_PLUGIN_METADATA(IID "org.kycc.CommonInterface") +- Q_INTERFACES(CommonInterface) +- +-public: +- DisplaySet(); +- ~DisplaySet(); +- +- QString plugini18nName() Q_DECL_OVERRIDE; +- int pluginTypes() Q_DECL_OVERRIDE; +- QWidget *pluginUi() Q_DECL_OVERRIDE; +- const QString name() const Q_DECL_OVERRIDE; +- bool isShowOnHomePage() const Q_DECL_OVERRIDE; +- QIcon icon() const Q_DECL_OVERRIDE; +- bool isEnable() const Q_DECL_OVERRIDE; +- +-private: +- void requestBackend(); +-private: +- Ui::DisplayWindow *ui; +- QString pluginName; +- int pluginType; +- Widget *pluginWidget; +- +- bool mFirstLoad; +-}; +- +-#endif // DISPLAYSET_H +diff --git a/plugins/system/display_hw/display_hw.pro b/plugins/system/display_hw/display_hw.pro +deleted file mode 100644 +index b1f341d..0000000 +--- a/plugins/system/display_hw/display_hw.pro ++++ /dev/null +@@ -1,70 +0,0 @@ +-#------------------------------------------------- +-# +-# Project created by QtCreator 2019-02-20T15:36:43 +-# +-#------------------------------------------------- +-include(../../../env.pri) +-include($$PROJECT_ROOTDIR/libukcc/interface.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/Uslider/uslider.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/CloseButton/closebutton.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ComboBox/combobox.pri) +- +-QT += widgets core gui quickwidgets quick xml KScreen dbus concurrent KConfigCore +-TEMPLATE = lib +-CONFIG += c++11 link_pkgconfig plugin +- +-TARGET = $$qtLibraryTarget(display_hw) +-DESTDIR = ../.. +-target.path = $${PLUGIN_INSTALL_DIRS} +-INSTALLS += target +- +-INCLUDEPATH += \ +- $$PROJECT_ROOTDIR \ +- +-LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt +- +-PKGCONFIG += gsettings-qt \ +- kysdk-qtwidgets +- +-QMAKE_CXXFLAGS *= -D_FORTIFY_SOURCE=2 -O2 +- +-SOURCES += \ +- brightnessFrame.cpp \ +- declarative/qmloutput.cpp \ +- declarative/qmloutputcomponent.cpp \ +- declarative/qmlscreen.cpp \ +- controlpanel.cpp \ +- display_hw.cpp \ +- outputconfig.cpp \ +- resolutionslider.cpp \ +- unifiedoutputconfig.cpp \ +- utils.cpp \ +- widget.cpp \ +- displayperformancedialog.cpp +- +-HEADERS += \ +- brightnessFrame.h \ +- colorinfo.h \ +- declarative/qmloutput.h \ +- declarative/qmloutputcomponent.h \ +- declarative/qmlscreen.h \ +- controlpanel.h \ +- display_hw.h \ +- outputconfig.h \ +- resolutionslider.h \ +- scalesize.h \ +- unifiedoutputconfig.h \ +- utils.h \ +- widget.h \ +- displayperformancedialog.h +- +-FORMS += \ +- display_hw.ui \ +- displayperformancedialog.ui +- +-#DISTFILES += \ +-# qml/main.qml \ +-# qml/Output.qml +- +-RESOURCES += \ +- qml.qrc +diff --git a/plugins/system/display_hw/display_hw.ui b/plugins/system/display_hw/display_hw.ui +deleted file mode 100644 +index 3d62dce..0000000 +--- a/plugins/system/display_hw/display_hw.ui ++++ /dev/null +@@ -1,931 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>DisplayWindow</class> +- <widget class="QWidget" name="DisplayWindow"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>945</width> +- <height>1260</height> +- </rect> +- </property> +- <property name="windowTitle"> +- <string>Form</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="text"> +- <string>Display</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>12</width> +- <height>12</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QFrame" name="mainframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QQuickWidget" name="quickWidget"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>300</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>300</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QFrame" name="screenframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <item> +- <widget class="QLabel" name="primaryLabel"> +- <property name="minimumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>monitor</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="primaryCombo"> +- <property name="minimumSize"> +- <size> +- <width>200</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>30</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="mainScreenButton"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>150</width> +- <height>30</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <pointsize>11</pointsize> +- </font> +- </property> +- <property name="focusPolicy"> +- <enum>Qt::NoFocus</enum> +- </property> +- <property name="text"> +- <string>as main</string> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="controlPanelLayout"> +- <property name="spacing"> +- <number>1</number> +- </property> +- <property name="sizeConstraint"> +- <enum>QLayout::SetNoConstraint</enum> +- </property> +- </layout> +- </item> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <item> +- <widget class="QLabel" name="scaleLabel"> +- <property name="minimumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>screen zoom</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="scaleCombo"> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>30</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="showMonitorframe"> +- <property name="enabled"> +- <bool>true</bool> +- </property> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <item> +- <layout class="QHBoxLayout" name="showScreenLayout"> +- <item> +- <widget class="QLabel" name="label"> +- <property name="minimumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>open monitor</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_6"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>78</width> +- <height>29</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="advancedHorLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>9</number> +- </property> +- <property name="topMargin"> +- <number>8</number> +- </property> +- <property name="rightMargin"> +- <number>9</number> +- </property> +- <property name="bottomMargin"> +- <number>32</number> +- </property> +- <item> +- <widget class="QPushButton" name="advancedBtn"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Advanced</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_8"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QFrame" name="unionframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <item> +- <layout class="QHBoxLayout" name="unionLayout"> +- <item> +- <widget class="QLabel" name="unifyLabel"> +- <property name="text"> +- <string>Mirror Display</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>98</width> +- <height>17</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QFrame" name="unifyBrightFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>106</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="unifyBrightLayout"> +- <property name="spacing"> +- <number>2</number> +- </property> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QFrame" name="nightframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="themeFrame"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>960</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="sunframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_9"> +- <item> +- <widget class="QLabel" name="label_6"> +- <property name="minimumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>follow the sunrise and sunset(17:55-05:04)</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QRadioButton" name="sunradioBtn"> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="customframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_12"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_13"> +- <item> +- <widget class="QLabel" name="label_12"> +- <property name="minimumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>custom time</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QRadioButton" name="customradioBtn"> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="opframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_18"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_19"> +- <item> +- <widget class="QLabel" name="label_21"> +- <property name="minimumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>opening time</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_5"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QComboBox" name="opHourCom"> +- <property name="minimumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="opMinCom"> +- <property name="minimumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="clsframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_10"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_11"> +- <item> +- <widget class="QLabel" name="label_10"> +- <property name="text"> +- <string>closing time</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_7"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QComboBox" name="clHourCom"> +- <property name="minimumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="clMinCom"> +- <property name="minimumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="temptframe"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_16"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_17"> +- <item> +- <widget class="QLabel" name="label_18"> +- <property name="minimumSize"> +- <size> +- <width>118</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>color temperature</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_19"> +- <property name="text"> +- <string>warm</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="Uslider" name="temptSlider"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_20"> +- <property name="text"> +- <string>cold</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>6</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- <zorder>mainframe</zorder> +- <zorder>unifyBrightFrame</zorder> +- <zorder>titleLabel</zorder> +- </widget> +- <customwidgets> +- <customwidget> +- <class>QQuickWidget</class> +- <extends>QWidget</extends> +- <header location="global">QtQuickWidgets/QQuickWidget</header> +- </customwidget> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- <customwidget> +- <class>Uslider</class> +- <extends>QSlider</extends> +- <header>uslider.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/system/display_hw/displayperformancedialog.cpp b/plugins/system/display_hw/displayperformancedialog.cpp +deleted file mode 100644 +index bb31e33..0000000 +--- a/plugins/system/display_hw/displayperformancedialog.cpp ++++ /dev/null +@@ -1,213 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "displayperformancedialog.h" +-#include "ui_displayperformancedialog.h" +-#include "closebutton.h" +- +-#include <QFile> +-#include <QDBusReply> +-#include <QDBusInterface> +-#include <QPainter> +-#include <QPainterPath> +-#include <QProcess> +-#include <QDebug> +- +-#define ADVANCED_SCHEMAS "org.ukui.session.required-components" +-#define ADVANCED_KEY "windowmanager" +- +-#define WM_CHOOSER_CONF "/etc/kylin-wm-chooser/default.conf" +-#define WM_CHOOSER_CONF_TMP "/tmp/default.conf" +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-DisplayPerformanceDialog::DisplayPerformanceDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::DisplayPerformanceDialog) +-{ +- ui->setupUi(this); +- +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- ui->titleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); +- +- ui->label->setAlignment(Qt::AlignTop); +- ui->label_2->setAlignment(Qt::AlignTop); +- ui->label_3->setAlignment(Qt::AlignTop); +- ui->label_4->setAlignment(Qt::AlignTop); +- ui->label_5->setAlignment(Qt::AlignTop); +- ui->label_6->setAlignment(Qt::AlignTop); +- +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- const QByteArray id(ADVANCED_SCHEMAS); +- settings = new QGSettings(id); +- +- confSettings = new QSettings(WM_CHOOSER_CONF, QSettings::NativeFormat); +- +- setupComponent(); +- setupConnect(); +- initModeStatus(); +- initThresholdStatus(); +- +-} +- +-DisplayPerformanceDialog::~DisplayPerformanceDialog() +-{ +- delete ui; +- ui = nullptr; +- delete settings; +- settings = nullptr; +- delete confSettings; +- confSettings = nullptr; +-} +- +-void DisplayPerformanceDialog::setupComponent(){ +- ui->performanceRadioBtn->setProperty("wm", "mutter"); +- ui->compatibleRadioBtn->setProperty("wm", "marco"); +- ui->autoRadioBtn->setProperty("wm", "kylin-wm-chooser"); +-} +- +-void DisplayPerformanceDialog::setupConnect(){ +- connect(ui->closeBtn, &CloseButton::clicked, [=]{ +- close(); +- }); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- connect(ui->buttonGroup, static_cast<void (QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), [=](QAbstractButton * button){ +-#else +- connect(ui->buttonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), [=](QAbstractButton * button){ +-#endif +- QString mode = button->property("wm").toString(); +- settings->set(ADVANCED_KEY, mode); +- }); +- +- connect(ui->autoRadioBtn, &QRadioButton::toggled, this, [=](bool checked){ +- ui->lineEdit->setEnabled(checked); +- ui->applyBtn->setEnabled(checked); +- ui->resetBtn->setEnabled(checked); +- }); +- +- connect(ui->applyBtn, &QPushButton::clicked, this, [=]{ +- changeConfValue(); +- }); +- +- connect(ui->resetBtn, &QPushButton::clicked, this, [=]{ +- ui->lineEdit->setText("256"); +- changeConfValue(); +- }); +-} +- +-void DisplayPerformanceDialog::initModeStatus(){ +- QString mode = settings->get(ADVANCED_KEY).toString(); +- +- if (mode == ui->performanceRadioBtn->property("wm").toString()){ +- ui->performanceRadioBtn->blockSignals(true); +- ui->performanceRadioBtn->setChecked(true); +- ui->performanceRadioBtn->blockSignals(false); +- } else if (mode == ui->compatibleRadioBtn->property("wm").toString()){ +- ui->compatibleRadioBtn->blockSignals(true); +- ui->compatibleRadioBtn->setChecked(true); +- ui->compatibleRadioBtn->blockSignals(false); +- } else{ +- ui->autoRadioBtn->blockSignals(true); +- ui->autoRadioBtn->setChecked(true); +- ui->autoRadioBtn->blockSignals(false); +- } +-} +- +-void DisplayPerformanceDialog::initThresholdStatus(){ +- confSettings->beginGroup("mutter"); +- QString value = confSettings->value("threshold").toString(); +- ui->lineEdit->blockSignals(true); +- ui->lineEdit->setText(value); +- ui->lineEdit->blockSignals(false); +- confSettings->endGroup(); +-} +- +-void DisplayPerformanceDialog::changeConfValue(){ +- if (!QFile::copy(WM_CHOOSER_CONF, WM_CHOOSER_CONF_TMP)) +- return; +- +- QSettings * tempSettings = new QSettings(WM_CHOOSER_CONF_TMP, QSettings::NativeFormat); +- tempSettings->beginGroup("mutter"); +- tempSettings->setValue("threshold", ui->lineEdit->text()); +- tempSettings->endGroup(); +- +- delete tempSettings; +- tempSettings = nullptr; +- +- //替换kylin-wm-chooser +- QDBusInterface * sysinterface = new QDBusInterface("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- if (!sysinterface->isValid()){ +- qCritical() << "Create Client Interface Failed When Copy Face File: " << QDBusConnection::systemBus().lastError(); +- return; +- } +- +- QString cmd = QString("mv %1 %2").arg(WM_CHOOSER_CONF_TMP).arg(WM_CHOOSER_CONF); +- +- QProcess::execute(cmd); +- delete sysinterface; +- sysinterface = nullptr; +-} +- +-void DisplayPerformanceDialog::paintEvent(QPaintEvent *event){ +- Q_UNUSED(event); +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 6, 6); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- +- p.restore(); +-} +diff --git a/plugins/system/display_hw/displayperformancedialog.h b/plugins/system/display_hw/displayperformancedialog.h +deleted file mode 100644 +index 4d03ccc..0000000 +--- a/plugins/system/display_hw/displayperformancedialog.h ++++ /dev/null +@@ -1,58 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef DISPLAYPERFORMANCEDIALOG_H +-#define DISPLAYPERFORMANCEDIALOG_H +- +-#include <QDialog> +-#include <QSettings> +-#include <QGSettings> +- +-namespace Ui { +-class DisplayPerformanceDialog; +-} +- +-class DisplayPerformanceDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit DisplayPerformanceDialog(QWidget *parent = 0); +- ~DisplayPerformanceDialog(); +- +-public: +- void setupComponent(); +- void setupConnect(); +- void initModeStatus(); +- void initThresholdStatus(); +- +- void changeConfValue(); +- +-private: +- void paintEvent(QPaintEvent *event); +- +-private: +- Ui::DisplayPerformanceDialog *ui; +- +-private: +- QGSettings *settings; +- QSettings *confSettings; +-}; +- +-#endif // DISPLAYPERFORMANCEDIALOG_H +diff --git a/plugins/system/display_hw/displayperformancedialog.ui b/plugins/system/display_hw/displayperformancedialog.ui +deleted file mode 100644 +index 5c587f0..0000000 +--- a/plugins/system/display_hw/displayperformancedialog.ui ++++ /dev/null +@@ -1,813 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>DisplayPerformanceDialog</class> +- <widget class="QDialog" name="DisplayPerformanceDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>580</width> +- <height>646</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>580</width> +- <height>646</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>580</width> +- <height>646</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>9</number> +- </property> +- <property name="rightMargin"> +- <number>9</number> +- </property> +- <property name="bottomMargin"> +- <number>9</number> +- </property> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="sizeConstraint"> +- <enum>QLayout::SetDefaultConstraint</enum> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="closeFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>36</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="CloseButton" name="closeBtn"> +- <property name="minimumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="widget" native="true"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="sizeConstraint"> +- <enum>QLayout::SetDefaultConstraint</enum> +- </property> +- <property name="leftMargin"> +- <number>32</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>32</number> +- </property> +- <property name="bottomMargin"> +- <number>32</number> +- </property> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Display Advanced Settings</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QScrollArea" name="scrollArea"> +- <property name="verticalScrollBarPolicy"> +- <enum>Qt::ScrollBarAsNeeded</enum> +- </property> +- <property name="horizontalScrollBarPolicy"> +- <enum>Qt::ScrollBarAlwaysOff</enum> +- </property> +- <property name="widgetResizable"> +- <bool>true</bool> +- </property> +- <widget class="QWidget" name="scrollAreaWidgetContents"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>526</width> +- <height>564</height> +- </rect> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_32"> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QFrame" name="performanceFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="performanceRadioBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Performance</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="performanceTipFrame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_11"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="autoFillBackground"> +- <bool>false</bool> +- </property> +- <property name="text"> +- <string>Applicable to machine with discrete graphics, which can accelerate the rendering of 3D graphics.</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>(Note: not support connect graphical with xmanager on windows.)</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_8"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QFrame" name="compatibleFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="compatibleRadioBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Compatible</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="compatibleTipFrame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_12"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label_3"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Applicable to machine with integrated graphics, there is no 3D graphics acceleration. </string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_4"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>(Note: need connect graphical with xmanager on windows, use this option.)</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_9"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QFrame" name="automaticFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="autoRadioBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Automatic</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="automaticTipFrame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label_5"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Auto select according to environment, delay the login time (about 0.5 sec).</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="autoHorLayout"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <item> +- <widget class="QLabel" name="label_7"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Threshold:</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLineEdit" name="lineEdit"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="applyBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Apply</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="resetBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Reset</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLabel" name="label_6"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>(Note: select this option to use 3D graphics acceleration and xmanager.)</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- <zorder></zorder> +- <zorder></zorder> +- <zorder></zorder> +- </widget> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <customwidgets> +- <customwidget> +- <class>CloseButton</class> +- <extends>QPushButton</extends> +- <header location="global">../../../libukcc/widgets/CloseButton/closebutton.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +- <buttongroups> +- <buttongroup name="buttonGroup"/> +- </buttongroups> +-</ui> +diff --git a/plugins/system/display_hw/outputconfig.cpp b/plugins/system/display_hw/outputconfig.cpp +deleted file mode 100644 +index 375e7a8..0000000 +--- a/plugins/system/display_hw/outputconfig.cpp ++++ /dev/null +@@ -1,439 +0,0 @@ +-#include "outputconfig.h" +-#include "resolutionslider.h" +-#include "utils.h" +- +-#include <QStringBuilder> +-#include <QFormLayout> +-#include <QComboBox> +-#include <QCheckBox> +-#include <QHBoxLayout> +-#include <QLabel> +-#include <QPushButton> +-#include <QGroupBox> +-#include <QMessageBox> +- +-#include <QComboBox> +-#include <QGSettings> +-#include <QDBusInterface> +- +-#include <KF5/KScreen/kscreen/output.h> +-#include <KF5/KScreen/kscreen/edid.h> +- +-#include "combobox.h" +- +-double mScreenScale = 1.0; +-int changeItm = -1; +- +-OutputConfig::OutputConfig(QWidget *parent) : +- QWidget(parent), +- mOutput(nullptr) +-{ +- initDpiConnection(); +-} +- +-OutputConfig::OutputConfig(const KScreen::OutputPtr &output, QWidget *parent) : +- QWidget(parent) +-{ +- initDpiConnection(); +- setOutput(output); +-} +- +-OutputConfig::~OutputConfig() +-{ +-} +- +-void OutputConfig::setTitle(const QString &title) +-{ +- mTitle->setText(title); +-} +- +-void OutputConfig::initUi() +-{ +- connect(mOutput.data(), &KScreen::Output::isConnectedChanged, +- this, [=]() { +- if (!mOutput->isConnected()) { +- setVisible(false); +- } +- }); +- +- connect(mOutput.data(), &KScreen::Output::rotationChanged, +- this, [=]() { +- const int index = mRotation->findData(mOutput->rotation()); +- mRotation->blockSignals(true); +- mRotation->setCurrentIndex(index); +- mRotation->blockSignals(false); +- }); +- +- connect(mOutput.data(), &KScreen::Output::currentModeIdChanged, +- this, [=]() { +- if (mOutput->currentMode()) { +- if (mRefreshRate) { +- mRefreshRate->blockSignals(true); +- slotResolutionChanged(mOutput->currentMode()->size(), false); +- mRefreshRate->blockSignals(false); +- } +- } +- }); +- +- connect(mOutput.data(), &KScreen::Output::isEnabledChanged, this, [=](){ +- slotEnableWidget(); +- }); +- +- setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); +- +- QVBoxLayout *vbox = new QVBoxLayout(this); +- vbox->setContentsMargins(0, 0, 0, 0); +- vbox->setSpacing(2); +- +- // 分辨率下拉框 +- mResolution = new ResolutionSlider(mOutput, this); +- mResolution->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- +- QLabel *resLabel = new QLabel(this); +- //~ contents_path /display/resolution +- resLabel->setText(tr("resolution")); +- resLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- resLabel->setFixedSize(118, 30); +- +- QHBoxLayout *resLayout = new QHBoxLayout(); +- resLayout->addWidget(resLabel); +- resLayout->addWidget(mResolution); +- +- QFrame *resFrame = new QFrame(this); +- resFrame->setFrameShape(QFrame::Shape::Box); +- resFrame->setLayout(resLayout); +- +- resFrame->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- resFrame->setMinimumSize(552, 50); +- resFrame->setMaximumSize(16777215, 50); +- +- vbox->addWidget(resFrame); +- +- connect(mResolution, &ResolutionSlider::resolutionChanged, +- this, [=](QSize size){ +- slotResolutionChanged(size, true); +- }); +- +- // 方向下拉框 +- mRotation = new QComboBox(this); +- mRotation->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- +- QLabel *rotateLabel = new QLabel(this); +- // ~contents_path /display/orientation +- rotateLabel->setText(tr("orientation")); +- rotateLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- rotateLabel->setFixedSize(118, 30); +- +- QHBoxLayout *rotateLayout = new QHBoxLayout(); +- rotateLayout->addWidget(rotateLabel); +- +- rotateLayout->addWidget(mRotation); +- +- QFrame *rotateFrame = new QFrame(this); +- rotateFrame->setFrameShape(QFrame::Shape::Box); +- rotateFrame->setLayout(rotateLayout); +- +- rotateFrame->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- rotateFrame->setMinimumSize(550, 50); +- rotateFrame->setMaximumSize(16777215, 50); +- +- mRotation->addItem(tr("arrow-up"), KScreen::Output::None); +- mRotation->addItem(tr("90° arrow-right"), KScreen::Output::Right); +- mRotation->addItem(tr("90° arrow-left"), KScreen::Output::Left); +- mRotation->addItem(tr("arrow-down"), KScreen::Output::Inverted); +- connect(mRotation, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), +- this, &OutputConfig::slotRotationChanged); +- mRotation->setCurrentIndex(mRotation->findData(mOutput->rotation())); +- +- vbox->addWidget(rotateFrame); +- +- // 刷新率下拉框 +- mRefreshRate = new QComboBox(this); +- +- QLabel *freshLabel = new QLabel(this); +- // ~contents_path /display/frequency +- freshLabel->setText(tr("frequency")); +- freshLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- freshLabel->setFixedSize(118, 30); +- +- QHBoxLayout *freshLayout = new QHBoxLayout(); +- freshLayout->addWidget(freshLabel); +- freshLayout->addWidget(mRefreshRate); +- +- QFrame *freshFrame = new QFrame(this); +- freshFrame->setFrameShape(QFrame::Shape::Box); +- freshFrame->setLayout(freshLayout); +- +- freshFrame->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- freshFrame->setMinimumSize(550, 50); +- freshFrame->setMaximumSize(16777215, 50); +- +- vbox->addWidget(freshFrame); +- +- slotResolutionChanged(mResolution->currentResolution(), true); +- connect(mRefreshRate, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), +- this, &OutputConfig::slotRefreshRateChanged); +- +- mScaleCombox = new QComboBox(this); +- mScaleCombox->setObjectName("scaleCombox"); +- +- double scale = getScreenScale(); +- +- mScaleCombox->setCurrentText(scaleToString(scale)); +- +- if (mScaleCombox->findData(scale) == -1) { +- mScaleCombox->addItem(scaleToString(scale), scale); +- mScaleCombox->setCurrentText(scaleToString(scale)); +- } +- +- QLabel *scaleLabel = new QLabel(this); +- //~ contents_path /display/screen zoom +- scaleLabel->setText(tr("screen zoom")); +- scaleLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- scaleLabel->setFixedSize(118, 30); +- +- QHBoxLayout *scaleLayout = new QHBoxLayout(); +- scaleLayout->addWidget(scaleLabel); +- scaleLayout->addWidget(mScaleCombox); +- +- QFrame *scaleFrame = new QFrame(this); +- scaleFrame->setFrameShape(QFrame::Shape::Box); +- scaleFrame->setLayout(scaleLayout); +- +- scaleFrame->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- scaleFrame->setMinimumSize(550, 50); +- scaleFrame->setMaximumSize(16777215, 50); +- vbox->addWidget(scaleFrame); +- scaleFrame->hide(); +- +- slotEnableWidget(); +-} +- +-double OutputConfig::getScreenScale() +-{ +- double scale = 1.0; +- if (QGSettings::isSchemaInstalled(SCALE_SCHEMAS)) { +- if (mDpiSettings->keys().contains("scalingFactor")) { +- scale = mDpiSettings->get(SCALE_KEY).toDouble(); +- } +- } +- return scale; +-} +- +-void OutputConfig::initDpiConnection() +-{ +- QByteArray id(SCALE_SCHEMAS); +- if (QGSettings::isSchemaInstalled(SCALE_SCHEMAS)) { +- mDpiSettings = new QGSettings(id, QByteArray(), this); +- connect(mDpiSettings, &QGSettings::changed, this, [=](QString key) { +- slotDPIChanged(key); +- }); +- } +-} +- +-QString OutputConfig::scaleToString(double scale) +-{ +- return QString::number(scale * 100) + "%"; +-} +- +-KScreen::ModePtr OutputConfig::findBestMode(const QSize &size) +-{ +- KScreen::ModePtr m_mode; +- float refreshRate = 0; +- Q_FOREACH (const KScreen::ModePtr &mode, mOutput->modes()) { +- if (mode->size() == size && mode->refreshRate() > refreshRate) { +- refreshRate = mode->refreshRate(); +- m_mode = mode; +- } +- } +- return m_mode; +-} +- +-void OutputConfig::setOutput(const KScreen::OutputPtr &output) +-{ +- mOutput = output; +- initUi(); +-} +- +-KScreen::OutputPtr OutputConfig::output() const +-{ +- return mOutput; +-} +- +-void OutputConfig::slotResolutionChanged(const QSize &size, bool emitFlag) +-{ +- // Ignore disconnected outputs +- if (!size.isValid()) { +- return; +- } +- bool mIsModeInit = false; +- QString modeID; +- KScreen::ModePtr selectMode; +- KScreen::ModePtr currentMode = mOutput->currentMode(); +- QList<KScreen::ModePtr> modes; +- Q_FOREACH (const KScreen::ModePtr &mode, mOutput->modes()) { +- //初始化时,currentMode可能为空(比如刚插上屏幕) +- if (!currentMode || (currentMode && currentMode->size() == size)) { +- if (currentMode) { +- selectMode = currentMode; +- } +- mIsModeInit = true; +- } +- if (mode->size() == size) { +- if (!mIsModeInit || !currentMode) { +- selectMode = mode; +- } +- modes << mode; +- } +- } +- //非初始化,则设置选中(用户设置)的mode为该分辨率下刷新率最大的mode +- if (!mIsModeInit) { +- selectMode = findBestMode(selectMode->size()); +- } +- modeID = selectMode->id(); +- mRefreshRate->blockSignals(true); +- mRefreshRate->clear(); +- mRefreshRate->blockSignals(false); +- +- for (int i = 0, total = modes.count(); i < total; ++i) { +- const KScreen::ModePtr mode = modes.at(i); +- QString comText = refreshRateToText(mode->refreshRate()); +- int comIndex = 0; +- bool alreadyExisted = false; +- for (int j = 0; j < mRefreshRate->count(); ++j) { +- if (comText == mRefreshRate->itemText(j)) { +- alreadyExisted = true; +- break; +- } +- } +- +- if (alreadyExisted == false) { //不添加已经存在的项 +- if (mRefreshRate->count() > 0) { +- for (int r = 0; r < mRefreshRate->count(); ++r) { +- if (comText.compare(mRefreshRate->itemText(r)) < 0) { +- comIndex = r + 1; +- } else { +- break; +- } +- } +- } +- mRefreshRate->blockSignals(true); +- mRefreshRate->insertItem(comIndex, comText, mode->id()); +- mRefreshRate->blockSignals(false); +- } +- +- //mode是选中的mode,则设置 +- if (mode == selectMode && mRefreshRate->count() > 0) { +- mRefreshRate->blockSignals(true); +- mRefreshRate->setCurrentIndex(comIndex); +- mRefreshRate->blockSignals(false); +- } +- } +- +- if (mRefreshRate->count() == 0) { +- mRefreshRate->blockSignals(true); +- mRefreshRate->addItem(tr("auto"), -1); +- mRefreshRate->blockSignals(false); +- } else { +- if (-1 == mRefreshRate->currentIndex()) { +- modeID = mRefreshRate->itemData(0).toString(); +- // 避免选择50hz以下刷新率为空 +- mRefreshRate->blockSignals(true); +- mRefreshRate->setCurrentIndex(0); +- mRefreshRate->blockSignals(false); +- } +- } +- +- mOutput->setCurrentModeId(modeID); +- +- if (!mIsModeInit) { +- if (emitFlag) { +- changeItm = RESOLUTION; +- Q_EMIT changed(); +- } +- } +-} +- +-void OutputConfig::slotRotationChanged(int index) +-{ +- KScreen::Output::Rotation rotation +- = static_cast<KScreen::Output::Rotation>(mRotation->itemData(index).toInt()); +- mOutput->setRotation(rotation); +- +- changeItm = ORIENTATION; +- Q_EMIT changed(); +-} +- +-void OutputConfig::slotRefreshRateChanged(int index) +-{ +- QString modeId; +- if (index < 0) { +- // Item 0 is "Auto" - "Auto" is equal to highest refresh rate (at least +- // that's how I understand it, and since the combobox is sorted in descending +- // order, we just pick the second item from top +- modeId = mRefreshRate->itemData(0).toString(); +- } else { +- modeId = mRefreshRate->itemData(index).toString(); +- } +- qDebug() << "modeId is:" << modeId << endl; +- mOutput->setCurrentModeId(modeId); +- changeItm = FREQUENCY; +- Q_EMIT changed(); +-} +- +-void OutputConfig::slotScaleChanged(int index) +-{ +- Q_EMIT scaleChanged(mScaleCombox->itemData(index).toDouble()); +-} +- +-void OutputConfig::slotDPIChanged(QString key) +-{ +- if (mScaleCombox == nullptr) +- return; +- if (!key.compare("scalingFactor", Qt::CaseSensitive)) { +- double scale = mDpiSettings->get(key).toDouble(); +- if (mScaleCombox->findData(scale) == -1) { +- mScaleCombox->addItem(scaleToString(scale), scale); +- } +- mScaleCombox->blockSignals(true); +- mScaleCombox->setCurrentText(scaleToString(scale)); +- mScaleCombox->blockSignals(false); +- } +-} +- +-void OutputConfig::slotEnableWidget() +-{ +- if (mOutput.data()->isEnabled()) { +- mResolution->setEnabled(true); +- mRotation->setEnabled(true); +- mRefreshRate->setEnabled(true); +- } else { +- mResolution->setEnabled(false); +- mRotation->setEnabled(false); +- mRefreshRate->setEnabled(false); +- } +-} +- +-void OutputConfig::setShowScaleOption(bool showScaleOption) +-{ +- mShowScaleOption = showScaleOption; +- if (mOutput) { +- initUi(); +- } +-} +- +-bool OutputConfig::showScaleOption() const +-{ +- return mShowScaleOption; +-} +- +-// 拿取配置 +-void OutputConfig::initConfig(const KScreen::ConfigPtr &config) +-{ +- mConfig = config; +-} +- +-QString OutputConfig::refreshRateToText(float refreshRate) +-{ +- return tr("%1 Hz").arg(QLocale().toString(refreshRate)); +-} +diff --git a/plugins/system/display_hw/outputconfig.h b/plugins/system/display_hw/outputconfig.h +deleted file mode 100644 +index 3a09a2c..0000000 +--- a/plugins/system/display_hw/outputconfig.h ++++ /dev/null +@@ -1,88 +0,0 @@ +-#ifndef OUTPUTCONFIG_H +-#define OUTPUTCONFIG_H +- +-#include <QGroupBox> +-#include <QComboBox> +-#include <QWidget> +- +-#include <KF5/KScreen/kscreen/output.h> +- +-#include <QGSettings> +- +-#include "scalesize.h" +- +-class QCheckBox; +-class ResolutionSlider; +-class QLabel; +-class QStyledItemDelegate; +- +-namespace Ui { +-class KScreenWidget; +-} +- +-class OutputConfig : public QWidget +-{ +- Q_OBJECT +- +-public: +- explicit OutputConfig(QWidget *parent); +- explicit OutputConfig(const KScreen::OutputPtr &output, QWidget *parent = nullptr); +- ~OutputConfig() override; +- +- virtual void setOutput(const KScreen::OutputPtr &output); +- KScreen::OutputPtr output() const; +- +- void setTitle(const QString &title); +- void setShowScaleOption(bool showScaleOption); +- bool showScaleOption() const; +- +- void initConfig(const KScreen::ConfigPtr &config); +- QString refreshRateToText(float refreshRate); +- +-protected Q_SLOTS: +- void slotResolutionChanged(const QSize &size, bool emitFlag); +- void slotRotationChanged(int index); +- void slotRefreshRateChanged(int index); +- void slotScaleChanged(int index); +- void slotDPIChanged(QString key); +- void slotEnableWidget(); +- +-Q_SIGNALS: +- void changed(); +- void scaleChanged(double scale); +- +-protected: +- virtual void initUi(); +- double getScreenScale(); +- +-private: +- void initDpiConnection(); +- QString scaleToString(double scale); +- KScreen::ModePtr findBestMode(const QSize &size); +- +-protected: +- KScreen::OutputPtr mOutput; +- QLabel *mTitle = nullptr; +- QCheckBox *mEnabled = nullptr; +- ResolutionSlider *mResolution = nullptr; +- +- QComboBox *mRotation = nullptr; +- QComboBox *mScale = nullptr; +- QComboBox *mRefreshRate = nullptr; +- QComboBox *mMonitor = nullptr; +- QComboBox *mScaleCombox = nullptr; +- +- bool mShowScaleOption = false; +- bool mIsWayland = false; +- bool mIsFirstLoad = true; +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- KScreen::ConfigPtr mConfig; +-#else +- KScreen::ConfigPtr mConfig = nullptr; +-#endif +- +- QGSettings *mDpiSettings = nullptr; +-}; +- +-#endif // OUTPUTCONFIG_H +diff --git a/plugins/system/display_hw/qml.qrc b/plugins/system/display_hw/qml.qrc +deleted file mode 100644 +index 1ffe197..0000000 +--- a/plugins/system/display_hw/qml.qrc ++++ /dev/null +@@ -1,6 +0,0 @@ +-<RCC> +- <qresource prefix="/"> +- <file>qml/Output.qml</file> +- <file>qml/main.qml</file> +- </qresource> +-</RCC> +diff --git a/plugins/system/display_hw/qml/Output.qml b/plugins/system/display_hw/qml/Output.qml +deleted file mode 100644 +index d6ae382..0000000 +--- a/plugins/system/display_hw/qml/Output.qml ++++ /dev/null +@@ -1,277 +0,0 @@ +-/* +- Copyright (C) 2012 Dan Vratil <dvratil@redhat.com> +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- This library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +-*/ +- +-import QtQuick 2.1 +-import QtGraphicalEffects 1.0 +-import org.kde.kscreen 1.0 +- +-QMLOutput { +- +- id: root; +- +- signal clicked(); +- signal primaryTriggered(string self); +- signal enabledToggled(string self); +- signal mousePressed(); +- signal mouseReleased(bool isReleased); +- signal positionChanged(bool isReleased); +- signal rotationChanged(bool isReleased); +- signal widthChanged(bool isReleased); +- signal heightChanged(bool isReleased); +- +- property bool isDragged: monitorMouseArea.drag.active; +- property bool isDragEnabled: true; +- property bool isToggleButtonVisible: false; +- property bool hasMoved: false; +- +- property var screenName:[ +- "Unknown", +- "VGA", +- "DVI", +- "DVII", +- "DVIA", +- "DVID", +- "HDMI", +- "eDP", +- "TV", +- "TVComposite", +- "TVSVideo", +- "TVComponent", +- "TVSCART", +- "TVC4", +- "DP" +- ]; +- +- width: monitorMouseArea.width; +- height: monitorMouseArea.height; +- +- visible: (opacity > 0); +- opacity: output.connected ? 1.0 : 0.0; +- +- Component.onCompleted: { +- root.updateRootProperties(); +- } +- +- SystemPalette { +- id: palette; +- } +- +- MouseArea { +- id: monitorMouseArea; +- width: root.currentOutputWidth * screen.outputScale; +- height: root.currentOutputHeight * screen.outputScale +- anchors.centerIn: parent; +- //是否激活时的透明度 +- opacity: root.output.enabled ? 1.0 : 0.3; +- transformOrigin: Item.Center; +- rotation: { +- if (output.rotation === KScreenOutput.None) { +- return 0; +- } else if (output.rotation === KScreenOutput.Left) { +- return 270; +- } else if (output.rotation === KScreenOutput.Inverted) { +- return 180; +- } else { +- return 90; +- } +- } +- +- hoverEnabled: true; +- preventStealing: true; +- +- drag { +- target: root.isDragEnabled && !root.isCloneMode && (root.enableCount >= 2) ? root : null; +- axis: Drag.XandYAxis; +- minimumX: 0; +- maximumX: screen.maxScreenSize.width - root.width; +- minimumY: 0; +- maximumY: screen.maxScreenSize.height - root.height; +- +- filterChildren: false; +- } +- +- drag.onActiveChanged: { +- /* If the drag is shorter then the animation then make sure +- * we won't end up in an inconsistent state */ +- if (dragActiveChangedAnimation.running) { +- dragActiveChangedAnimation.complete(); +- } +- +- dragActiveChangedAnimation.running = true; +- } +- +- onPressed: root.clicked(); +- onReleased: root.mouseReleased(true) +- onRotationChanged: root.rotationChanged(false); +- onWidthChanged: root.widthChanged(false); +- onHeightChanged: root.heightChanged(false); +- +- /* FIXME: This could be in 'Behavior', but MouseArea had +- * some complaints...to tired to investigate */ +- PropertyAnimation { +- id: dragActiveChangedAnimation; +- +- target: monitor; +- property: "opacity"; +- from: monitorMouseArea.drag.active ? 0.7 : 1.0 +- to: monitorMouseArea.drag.active ? 1.0 : 0.7 +- duration: 100; +- easing.type: "OutCubic"; +- } +- +- Behavior on opacity { +- PropertyAnimation { +- property: "opacity"; +- easing.type: "OutCubic"; +- duration: 250; +- } +- } +- +- Behavior on rotation { +- RotationAnimation { +- easing.type: "OutCubic" +- duration: 250; +- direction: RotationAnimation.Shortest; +- } +- } +- +- Behavior on width { +- PropertyAnimation { +- property: "width"; +- easing.type: "OutCubic"; +- duration: 150; +- } +- } +- +- Behavior on height { +- PropertyAnimation { +- property: "height"; +- easing.type: "OutCubic"; +- duration: 150; +- } +- } +- +- Rectangle { +- id: monitor; +- anchors.fill: parent; +- //圆角 +- radius: 8; +- //是否点击到屏幕 +- color: root.focus? "#3D6BE5" : "#AEACAD"; +- smooth: true; +- clip: true; +- +- border { +- color: root.focus ? "#3498DB" : "#AED6F1"; +- width: 1; +- +- Behavior on color { +- PropertyAnimation { +- duration: 150; +- } +- } +- } +- +- Rectangle { +- id: posLabel; +- y: 4; +- x: 4; +- width: childrenRect.width + 5; +- height: childrenRect.height + 2; +- radius: 8; +- opacity: root.output.enabled && monitorMouseArea.drag.active ? 1.0 : 0.0; +- visible: opacity != 0.0; +- +- color: "#101010"; +- +- Text { +- id: posLabelText; +- text: root.outputX + "," + root.outputY; +- color: "white"; +- y: 2; +- x: 2; +- } +- } +- +- Item { +- //文字位置 +- y: ((parent.height - orientationPanel.height) / 2) - (implicitHeight / 2) +- +- anchors { +- left: parent.left; +- right: parent.right; +- leftMargin: 5; +- rightMargin: 5; +- } +- +- Text { +- id: labelVendor; +- text: if (root.isCloneMode) { +- return ("Unity"); +- } else { +- return screenName[root.output.type]; +- } +- +- anchors { +- verticalCenter: parent.verticalCenter; +- left: parent.left; +- right: parent.right; +- } +- horizontalAlignment: Text.AlignHCenter; +- color: "#FFFFFF"; +- font.pixelSize: 12; +- elide: Text.ElideRight; +- } +- } +- } +- Item { +- id: orientationPanelContainer; +- +- anchors.fill: monitor; +- +- visible: false +- +- Rectangle { +- id: orientationPanel; +- height: 10; +- //底部颜色 +- color: palette.highlight ; +- smooth: true; +- +- Behavior on color { +- PropertyAnimation { +- duration: 150; +- } +- } +- } +- } +- +- OpacityMask { +- anchors.fill: orientationPanelContainer; +- source: orientationPanelContainer; +- maskSource: monitor; +- } +- } +- +- Behavior on opacity { +- PropertyAnimation { +- duration: 200; +- easing.type: "OutCubic"; +- } +- } +-} +diff --git a/plugins/system/display_hw/qml/main.qml b/plugins/system/display_hw/qml/main.qml +deleted file mode 100644 +index 2c93116..0000000 +--- a/plugins/system/display_hw/qml/main.qml ++++ /dev/null +@@ -1,75 +0,0 @@ +-/* +- Copyright (C) 2012 Dan Vratil <dvratil@redhat.com> +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- This library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +- +-*/ +- +-import QtQuick 2.1 +-import QtQuick.Controls 1.1 as Controls +-import org.kde.kscreen 1.0 +- +-Item { +- id: root; +- +- property variant virtualScreen: null; +- +- objectName: "root"; +- focus: true; +- +- SystemPalette { +- id: palette; +- } +- +- MouseArea { +- anchors.fill: parent; +- focus: true; +- +- Rectangle { +- id: background; +- +- anchors.fill: parent; +- focus: true; +- +- color: "transparent"; +- +- FocusScope { +- +- id: outputViewFocusScope; +- +- anchors.fill: parent; +- focus: true; +- +- QMLScreen { +- id: outputView; +- anchors.fill: parent; +- clip: true; +- objectName: "outputView"; +- } +- } +- +- Column { +- anchors { +- left: parent.left; +- bottom: parent.bottom; +- margins: 5; +- } +- spacing: 5; +- } +- } +- +- } +- +-} +diff --git a/plugins/system/display_hw/resolutionslider.cpp b/plugins/system/display_hw/resolutionslider.cpp +deleted file mode 100644 +index 1e93606..0000000 +--- a/plugins/system/display_hw/resolutionslider.cpp ++++ /dev/null +@@ -1,206 +0,0 @@ +-#include "resolutionslider.h" +-#include "utils.h" +- +-#include <QGridLayout> +-#include <QLabel> +-#include <QSlider> +-#include <QComboBox> +-#include <QFile> +-#include <QStyledItemDelegate> +- +-#include <QDBusInterface> +- +-#include <KF5/KScreen/kscreen/output.h> +- +-static bool sizeLessThan(const QSize &sizeA, const QSize &sizeB) +-{ +- return sizeA.width() * sizeA.height() < sizeB.width() * sizeB.height(); +-} +- +-ResolutionSlider::ResolutionSlider(const KScreen::OutputPtr &output, QWidget *parent) : +- QWidget(parent), +- mOutput(output) +-{ +- QString sessionType = getenv("XDG_SESSION_TYPE"); +- if (sessionType.compare("wayland", Qt::CaseSensitive)) { +- mExcludeModes.push_back(QSize(1152, 864)); +- } +- +- connect(output.data(), &KScreen::Output::currentModeIdChanged, +- this, &ResolutionSlider::slotOutputModeChanged); +- connect(output.data(), &KScreen::Output::modesChanged, +- this, &ResolutionSlider::init); +- init(); +-} +- +-ResolutionSlider::~ResolutionSlider() +-{ +-} +- +-void ResolutionSlider::init() +-{ +- this->setMinimumSize(402, 30); +- this->setMaximumSize(1677215, 30); +- mModes.clear(); +- Q_FOREACH (const KScreen::ModePtr &mode, mOutput->modes()) { +- if (mModes.contains(mode->size()) +- || (mode->size().width() * mode->size().height()) < (1024 * 768) +- || mExcludeModes.contains(mode->size())) { +- continue; +- } +- mModes << mode->size(); +- } +- std::sort(mModes.begin(), mModes.end(), sizeLessThan); +- +- delete layout(); +- delete mSmallestLabel; +- mSmallestLabel = nullptr; +- delete mBiggestLabel; +- mBiggestLabel = nullptr; +- delete mCurrentLabel; +- mCurrentLabel = nullptr; +- delete mSlider; +- mSlider = nullptr; +- delete mComboBox; +- mComboBox = nullptr; +- +- QGridLayout *layout = new QGridLayout(this); +- int margin = layout->margin(); +- // Avoid double margins +- layout->setContentsMargins(0, 0, 0, 0); +- if (!mModes.empty()) { +- std::reverse(mModes.begin(), mModes.end()); +- mComboBox = new QComboBox(this); +- mComboBox->setMinimumSize(402, 30); +- mComboBox->setMaximumSize(1677215, 30); +- +- int currentModeIndex = -1; +- int preferredModeIndex = -1; +- Q_FOREACH (const QSize &size, mModes) { +-#ifdef __sw_64__ +- if (size.width() < int(1920)) { +- continue; +- } +-#endif +- mComboBox->addItem(Utils::sizeToString(size)); +- +- if (mOutput->currentMode() && (mOutput->currentMode()->size() == size)) { +- currentModeIndex = mComboBox->count() - 1; +- } else if (mOutput->preferredMode() && (mOutput->preferredMode()->size() == size)) { +- preferredModeIndex = mComboBox->count() - 1; +- } +- } +- if (currentModeIndex != -1) { +- mComboBox->setCurrentIndex(currentModeIndex); +- } else if (preferredModeIndex != -1) { +- mComboBox->setCurrentIndex(preferredModeIndex); +- } +- +- layout->addWidget(mComboBox, 0, 0, 1, 1); +- connect(mComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), +- this, &ResolutionSlider::slotValueChanged, Qt::UniqueConnection); +- // bug#75687触发两次应用信号 +- // Q_EMIT resolutionChanged(mModes.at(mComboBox->currentIndex())); +- } else { +- mCurrentLabel = new QLabel(this); +- mCurrentLabel->setAlignment(Qt::AlignCenter); +- layout->addWidget(mCurrentLabel, 1, 0, 1, 3); +- +- if (mModes.isEmpty()) { +- mCurrentLabel->setText(tr("No available resolutions")); +- } else if (mModes.count() == 1) { +- mCurrentLabel->setText(Utils::sizeToString(mModes.first())); +- } else { +- // No double margins left and right, but they are needed on top and bottom +- layout->setContentsMargins(0, margin, 0, margin); +- mSlider = new Uslider(Qt::Horizontal, this); +- mSlider->setTickInterval(1); +- mSlider->setTickPosition(QSlider::TicksBelow); +- mSlider->setSingleStep(1); +- mSlider->setPageStep(1); +- mSlider->setMinimum(0); +- mSlider->setMaximum(mModes.size() - 1); +- mSlider->setSingleStep(1); +- if (mOutput->currentMode()) { +- mSlider->setValue(mModes.indexOf(mOutput->currentMode()->size())); +- } else if (mOutput->preferredMode()) { +- mSlider->setValue(mModes.indexOf(mOutput->preferredMode()->size())); +- } else { +- mSlider->setValue(mSlider->maximum()); +- } +- layout->addWidget(mSlider, 0, 1); +- connect(mSlider, &QSlider::valueChanged, +- this, &ResolutionSlider::slotValueChanged); +- +- mSmallestLabel = new QLabel(this); +- mSmallestLabel->setText(Utils::sizeToString(mModes.first())); +- layout->addWidget(mSmallestLabel, 0, 0); +- mBiggestLabel = new QLabel(this); +- mBiggestLabel->setText(Utils::sizeToString(mModes.last())); +- layout->addWidget(mBiggestLabel, 0, 2); +- +- const auto size = mModes.at(mSlider->value()); +- mCurrentLabel->setText(Utils::sizeToString(size)); +- Q_EMIT resolutionChanged(size); +- } +- } +-} +- +-QSize ResolutionSlider::currentResolution() const +-{ +- if (mModes.isEmpty()) { +- return QSize(); +- } +- +- if (mModes.size() < 2) { +- return mModes.first(); +- } +- +- if (mSlider) { +- return mModes.at(mSlider->value()); +- } else { +- const int i = mComboBox->currentIndex(); +- return i > -1 ? mModes.at(i) : QSize(); +- } +-} +- +-QSize ResolutionSlider::getMaxResolution() const +-{ +- if (mModes.isEmpty()) { +- return QSize(); +- } +- return mModes.first(); +-} +- +-void ResolutionSlider::setResolution(const QSize &size) +-{ +- mComboBox->blockSignals(true); +- mComboBox->setCurrentIndex(mModes.indexOf(size)); +- mComboBox->blockSignals(false); +-} +- +-void ResolutionSlider::slotOutputModeChanged() +-{ +- if (!mOutput->currentMode()) { +- return; +- } +- +- if (mSlider) { +- mSlider->blockSignals(true); +- mSlider->setValue(mModes.indexOf(mOutput->currentMode()->size())); +- mSlider->blockSignals(false); +- } else if (mComboBox) { +- mComboBox->blockSignals(true); +- mComboBox->setCurrentIndex(mModes.indexOf(mOutput->currentMode()->size())); +- mComboBox->blockSignals(false); +- } +-} +- +-void ResolutionSlider::slotValueChanged(int value) +-{ +- const QSize &size = mModes.at(value); +- if (mCurrentLabel) { +- mCurrentLabel->setText(Utils::sizeToString(size)); +- } +- Q_EMIT resolutionChanged(size); +-} +diff --git a/plugins/system/display_hw/resolutionslider.h b/plugins/system/display_hw/resolutionslider.h +deleted file mode 100644 +index 9f870b7..0000000 +--- a/plugins/system/display_hw/resolutionslider.h ++++ /dev/null +@@ -1,53 +0,0 @@ +-#ifndef RESOLUTIONSLIDER_H +-#define RESOLUTIONSLIDER_H +- +-#include <QWidget> +-#include <QSet> +- +-#include <KF5/KScreen/kscreen/output.h> +-#include "uslider.h" +- +-class QSlider; +-class QLabel; +-class QComboBox; +-class QStyledItemDelegate; +- +-class ResolutionSlider : public QWidget +-{ +- Q_OBJECT +- +-public: +- explicit ResolutionSlider(const KScreen::OutputPtr &output, QWidget *parent = nullptr); +- ~ResolutionSlider() override; +- +- QSize currentResolution() const; +- QSize getMaxResolution() const; +- +- void setResolution(const QSize &size); +- +-Q_SIGNALS: +- void resolutionChanged(const QSize &size, bool emitFlag = true); +- +-public Q_SLOTS: +- void slotValueChanged(int); +- void slotOutputModeChanged(); +- +-private: +- void init(); +- +-private: +- KScreen::OutputPtr mOutput; +- +- QList<QSize> mModes; +- QList<QSize> mExcludeModes; +- +- QLabel *mSmallestLabel = nullptr; +- QLabel *mBiggestLabel = nullptr; +- QLabel *mCurrentLabel = nullptr; +- Uslider *mSlider = nullptr; +- QComboBox *mComboBox = nullptr; +- +- bool mIsWayland = false; +-}; +- +-#endif // RESOLUTIONSLIDER_H +diff --git a/plugins/system/display_hw/scalesize.h b/plugins/system/display_hw/scalesize.h +deleted file mode 100644 +index e75c410..0000000 +--- a/plugins/system/display_hw/scalesize.h ++++ /dev/null +@@ -1,42 +0,0 @@ +-#ifndef SCALESIZE_H +-#define SCALESIZE_H +- +-#include <QSize> +-typedef enum{ +- RESOLUTION, +- ORIENTATION, +- FREQUENCY +-}CONFIG; +- +-#define SCALE_SCHEMAS "org.ukui.SettingsDaemon.plugins.xsettings" +-#define SCALE_KEY "scaling-factor" +- +-const QSize KRsolution(1920, 1080); +- +-const QVector<QSize> k125Scale{QSize(1280, 1024), QSize(1440, 900), QSize(1600, 900), +- QSize(1680, 1050)}; +- +-const QVector<QSize> k150Scale{ QSize(1920, 1080), QSize(1920, 1200), +- QSize(1920, 1280), QSize(2048, 1080), QSize(2048, 1280), +- QSize(2160, 1440), QSize(2560, 1440),QSize(3840, 2160)}; +- +-const QVector<QSize> k175Scale{QSize(2048, 1080), QSize(2048, 1280), QSize(2160, 1440), +- QSize(2560, 1440), QSize(3840, 2160)}; +- +-const QVector<QSize> k200Scale{QSize(2048, 1080), QSize(2048, 1280), QSize(2160, 1440), +- QSize(2560, 1440), QSize(3840, 2160)}; +- +-const QVector<QSize> k250Scale{QSize(2560, 1440), QSize(3840, 2160)}; +- +-const QVector<QSize> k275Scale{QSize(3840, 2160)}; +- +- +-extern QSize mScaleSize; +- +-extern QSize mScaleSizeRes; +- +-extern double mScreenScale; +- +-extern int changeItm; +- +-#endif // SCALESIZE_H +diff --git a/plugins/system/display_hw/screenConfig.h b/plugins/system/display_hw/screenConfig.h +deleted file mode 100644 +index 82f0672..0000000 +--- a/plugins/system/display_hw/screenConfig.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-#ifndef SCREENCONFIG_H +-#define SCREENCONFIG_H +- +-#include <QDBusArgument> +-#include <QString> +- +-struct ScreenConfig +-{ +- QString screenId; +- QString screenModeId; +- int screenPosX; +- int screenPosY; +- bool primary; +- +- friend QDBusArgument &operator<<(QDBusArgument &argument, const ScreenConfig &screenStruct) +- { +- argument.beginStructure(); +- argument << screenStruct.screenId << screenStruct.screenModeId << screenStruct.screenPosX +- << screenStruct.screenPosY << screenStruct.primary; +- argument.endStructure(); +- return argument; +- } +- +- friend const QDBusArgument &operator>>(const QDBusArgument &argument, ScreenConfig &screenStruct) +- { +- argument.beginStructure(); +- argument >> screenStruct.screenId >> screenStruct.screenModeId +- >> screenStruct.screenPosX >> screenStruct.screenPosY >> screenStruct.primary; +- argument.endStructure(); +- return argument; +- } +-}; +-Q_DECLARE_METATYPE(ScreenConfig) +- +-#endif // SCREENCONFIG_H +diff --git a/plugins/system/display_hw/unifiedoutputconfig.cpp b/plugins/system/display_hw/unifiedoutputconfig.cpp +deleted file mode 100644 +index a8f8e3b..0000000 +--- a/plugins/system/display_hw/unifiedoutputconfig.cpp ++++ /dev/null +@@ -1,489 +0,0 @@ +-#include "unifiedoutputconfig.h" +-#include "resolutionslider.h" +-#include "utils.h" +- +-#include <QComboBox> +-#include <QIcon> +-#include <QLabel> +-#include <QGridLayout> +-#include <QSpacerItem> +-#include <QCheckBox> +-#include <QGroupBox> +-#include <QFormLayout> +-#include <QStyledItemDelegate> +-#include <QFile> +-#include <QVector> +-#include <QCryptographicHash> +- +-#include <KF5/KScreen/kscreen/output.h> +-#include <KF5/KScreen/kscreen/config.h> +-#include <KF5/KScreen/kscreen/getconfigoperation.h> +- +-#include <KF5/KConfigCore/KSharedConfig> +-#include <KF5/KConfigCore/KConfigGroup> +- +-bool operator<(const QSize &s1, const QSize &s2) +-{ +- return s1.width() * s1.height() < s2.width() * s2.height(); +-} +- +-template<> +-bool qMapLessThanKey(const QSize &s1, const QSize &s2) +-{ +- return s1 < s2; +-} +- +-UnifiedOutputConfig::UnifiedOutputConfig(const KScreen::ConfigPtr &config, QWidget *parent) : +- OutputConfig(parent), +- mConfig(config) +-{ +- +-} +- +-UnifiedOutputConfig::~UnifiedOutputConfig() +-{ +-} +- +-void UnifiedOutputConfig::setOutput(const KScreen::OutputPtr &output) +-{ +- mOutput = output; +- +- mClones.clear(); +- mClones.reserve(mOutput->clones().count()); +- Q_FOREACH (int id, mOutput->clones()) { +- mClones << mConfig->output(id); +- } +- mClones << mOutput; +- +- OutputConfig::setOutput(output); +-} +- +-void UnifiedOutputConfig::initUi() +-{ +- QVBoxLayout *vbox = new QVBoxLayout(this); +- vbox->setContentsMargins(0, 0, 0, 0); +- setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); +- +- KScreen::OutputPtr fakeOutput = createFakeOutput(); +- mResolution = new ResolutionSlider(fakeOutput, this); +- +- mResolution->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- mResolution->setMinimumSize(402, 30); +- +- //监听,否则无法处理修改分辨率/刷新率未保存 +- connect(mOutput.data(), &KScreen::Output::currentModeIdChanged, +- this, &UnifiedOutputConfig::slotRestoreResoltion); +- +- connect(mOutput.data(), &KScreen::Output::rotationChanged, +- this, &UnifiedOutputConfig::slotRestoreRatation); +- +- QLabel *resLabel = new QLabel(this); +- resLabel->setText(tr("resolution")); +- resLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- resLabel->setMinimumSize(118, 30); +- resLabel->setMaximumSize(118, 30); +- +- QHBoxLayout *resLayout = new QHBoxLayout(); +- resLayout->addWidget(resLabel); +- resLayout->addWidget(mResolution); +- +- QFrame *resFrame = new QFrame(this); +- resFrame->setFrameShape(QFrame::Shape::Box); +- resFrame->setLayout(resLayout); +- +- resFrame->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- resFrame->setMinimumSize(552, 50); +- resFrame->setMaximumSize(16777215, 50); +- +- vbox->addWidget(resFrame); +- connect(mResolution, &ResolutionSlider::resolutionChanged, +- this, [=](QSize size, bool emitFlag){ +- slotResolutionChanged(size, emitFlag); +- }); +- +- // 方向下拉框 +- mRotation = new QComboBox(this); +- +- mRotation->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- mRotation->setMinimumSize(402, 30); +- mRotation->setMaximumSize(16777215, 30); +- +- QLabel *rotateLabel = new QLabel(this); +- rotateLabel->setText(tr("orientation")); +- rotateLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- rotateLabel->setMinimumSize(118, 30); +- rotateLabel->setMaximumSize(118, 30); +- +- mRotation->addItem(tr("arrow-up"), KScreen::Output::None); +- mRotation->addItem(tr("90° arrow-right"), KScreen::Output::Right); +- mRotation->addItem(tr("90° arrow-left"), KScreen::Output::Left); +- mRotation->addItem(tr("arrow-down"), KScreen::Output::Inverted); +- +- int index = mRotation->findData(mOutput->rotation()); +- mRotation->setCurrentIndex(index); +- +- connect(mRotation, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), +- this, &UnifiedOutputConfig::slotRotationChangedDerived); +- +- QHBoxLayout *roatateLayout = new QHBoxLayout(); +- roatateLayout->addWidget(rotateLabel); +- roatateLayout->addWidget(mRotation); +- +- QFrame *rotateFrame = new QFrame(this); +- rotateFrame->setFrameShape(QFrame::Shape::Box); +- rotateFrame->setLayout(roatateLayout); +- +- rotateFrame->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- rotateFrame->setMinimumSize(552, 50); +- rotateFrame->setMaximumSize(16777215, 50); +- +- vbox->addWidget(rotateFrame); +- +- // 统一输出刷新率下拉框 +- mRefreshRate = new QComboBox(this); +- mRefreshRate->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- mRefreshRate->setMinimumSize(402, 30); +- mRefreshRate->setMaximumSize(16777215, 30); +- +- QLabel *freshLabel = new QLabel(this); +- freshLabel->setText(tr("frequency")); +- freshLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- freshLabel->setMinimumSize(118, 30); +- freshLabel->setMaximumSize(118, 30); +- +- mRefreshRate->addItem(tr("auto"), -1); +- +- QHBoxLayout *freshLayout = new QHBoxLayout(); +- freshLayout->addWidget(freshLabel); +- freshLayout->addWidget(mRefreshRate); +- +- QFrame *freshFrame = new QFrame(this); +- freshFrame->setFrameShape(QFrame::Shape::Box); +- freshFrame->setLayout(freshLayout); +- +- vbox->addWidget(freshFrame); +- +- freshFrame->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +- freshFrame->setMinimumSize(552, 50); +- freshFrame->setMaximumSize(16777215, 50); +- +- slotResolutionChanged(mResolution->currentResolution(), false); +- connect(mRefreshRate, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), +- this, &UnifiedOutputConfig::slotRefreshRateChanged); +- QObject::connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, +- [&](KScreen::ConfigOperation *op) { +- KScreen::ConfigPtr sConfig = qobject_cast<KScreen::GetConfigOperation *>(op)->config(); +- KScreen::OutputPtr sOutput = sConfig -> primaryOutput(); +- +- for (int i = 0; i < mRefreshRate->count(); ++i) { +- if (!sOutput.isNull() && !sOutput->currentMode().isNull() && mRefreshRate->itemText(i) == refreshRateToText(sOutput->currentMode()->refreshRate())) { +- mRefreshRate->setCurrentIndex(i); +- } +- } +- }); +- initscale(vbox); +-} +- +-void UnifiedOutputConfig::initscale(QVBoxLayout *vbox) +-{ +- QFrame *scaleFrame = new QFrame(this); +- vbox->addWidget(scaleFrame); +- scaleFrame->hide(); +-} +- +-void UnifiedOutputConfig::slotScaleChanged(int index) +-{ +- Q_EMIT scaleChanged(mScaleCombox->itemData(index).toDouble()); +-} +- +-KScreen::OutputPtr UnifiedOutputConfig::createFakeOutput() +-{ +- // Find set of common resolutions +- QMap<QSize, int> commonSizes; +- Q_FOREACH (const KScreen::OutputPtr &clone, mClones) { +- QList<QSize> processedSizes; +- Q_FOREACH (const KScreen::ModePtr &mode, clone->modes()) { +- // Make sure we don't count some modes multiple times because of different +- // refresh rates +- if (processedSizes.contains(mode->size())) { +- continue; +- } +- +- processedSizes << mode->size(); +- +- if (commonSizes.contains(mode->size())) { +- commonSizes[mode->size()]++; +- } else { +- commonSizes.insert(mode->size(), 1); +- } +- } +- } +- +- KScreen::OutputPtr fakeOutput(new KScreen::Output); +- +- // This will give us list of resolution that are shared by all outputs +- QList<QSize> commonResults = commonSizes.keys(mClones.count()); +- // If there are no common resolution, fallback to smallest preferred mode +- if (commonResults.isEmpty()) { +- QSize smallestMode; +- Q_FOREACH (const KScreen::OutputPtr &clone, mClones) { +- if (!smallestMode.isValid() || clone->preferredMode()->size() < smallestMode) { +- smallestMode = clone->preferredMode()->size(); +- } +- } +- commonResults << smallestMode; +- } +- std::sort(commonResults.begin(), commonResults.end()); +- +- KScreen::ModeList modes; +- Q_FOREACH (const QSize &size, commonResults) { +- KScreen::ModePtr mode(new KScreen::Mode); +- mode->setSize(size); +- mode->setId(Utils::sizeToString(size)); +- mode->setName(mode->id()); +- modes.insert(mode->id(), mode); +- } +- fakeOutput->setModes(modes); +- if (!mOutput->currentModeId().isEmpty()) { +- fakeOutput->setCurrentModeId(Utils::sizeToString(mOutput->currentMode()->size())); +- } else { +- fakeOutput->setCurrentModeId(Utils::sizeToString(commonResults.last())); +- } +- +- return fakeOutput; +-} +- +-void UnifiedOutputConfig::slotResolutionChanged(const QSize &size, bool emitFlag = false) +-{ +- // Ignore disconnected outputs +- if (!size.isValid()) { +- return; +- } +- bool mIsModeInit = true; +- QVector<QString>Vrefresh; +- bool mIsCloneMode = isCloneMode(); +- mRefreshRate->blockSignals(true); +- mRefreshRate->clear(); +- mRefreshRate->blockSignals(false); +- Q_FOREACH (const KScreen::OutputPtr &clone, mClones) { +- const QString &id = findBestMode(clone, size, emitFlag); +- if (id.isEmpty() || id == "auto-fill") { +- // FIXME: Error? +- return; +- } +- //本来就是镜像模式且当前分辨率就是选中分辨率,就不需要重新设置显示参数 +- //用于镜像模式下刚打开控制面板时的显示,否则显示的不是实际刷新率而是findBestMode +- if (!mIsCloneMode || size != clone->currentMode()->size()) { +- mIsModeInit = false; +- clone->blockSignals(true); //必须加blockSignals,否则在这里就会触发currentModeIdChanged的信号 +- clone->setCurrentModeId(id); +- clone->setPos(QPoint(0, 0)); +- clone->blockSignals(false); +- } +- +- QList<KScreen::ModePtr> modes; +- Q_FOREACH (const KScreen::ModePtr &mode, clone->modes()) { +- if (mode->size() == size) { +- modes << mode; +- } +- } +- +- QVector<QString>VrefreshTemp; +- for (int i = 0, total = modes.count(); i < total; ++i) { +- const KScreen::ModePtr mode = modes.at(i); +- +- bool alreadyExisted = false; //判断该显示器的刷新率是否有重复的,确保同一刷新率在一个屏幕上只出现一次 +- for (int j = 0; j < VrefreshTemp.size(); ++j) { +- if (refreshRateToText(mode->refreshRate()) == VrefreshTemp[j]) { +- alreadyExisted = true; +- break; +- } +- } +- if (alreadyExisted == false) { //不添加重复的项 +- VrefreshTemp.append(refreshRateToText(mode->refreshRate())); +- } +- } +- +- for (int i = 0; i < VrefreshTemp.size(); ++i) { +- Vrefresh.append(VrefreshTemp[i]); +- } +- } +- +- for (int i = 0; i < Vrefresh.size(); ++i) { +- if (Vrefresh.count(Vrefresh[i]) == mClones.size()) { //该刷新率出现次数等于屏幕数,即每个屏幕都有该刷新率 +- bool existFlag = false; +- for (int j = 0; j < mRefreshRate->count(); ++j) { //已经存在就不再添加 +- if (Vrefresh[i] == mRefreshRate->itemText(j)) { +- existFlag = true; +- break; +- } +- } +- if (existFlag == false) { //不存在添加到容器中 +- mRefreshRate->blockSignals(true); +- mRefreshRate->addItem(Vrefresh[i]); +- mRefreshRate->blockSignals(false); +- } +- } +- } +- +- if (mRefreshRate->count() > 1) { +- float currentRereshRate = mClones[0]->currentMode()->refreshRate(); +- for (int i = 0; i < mRefreshRate->count(); i++) { +- if (refreshRateToText(currentRereshRate) == mRefreshRate->itemText(i)) { +- mRefreshRate->blockSignals(true); +- mRefreshRate->setCurrentIndex(i); +- mRefreshRate->blockSignals(false); +- break; +- } +- } +- } +- +- if (mRefreshRate->count() == 0) { +- mRefreshRate->blockSignals(true); +- mRefreshRate->addItem(tr("auto"), -1); +- mRefreshRate->blockSignals(false); +- } +- if (emitFlag && !mIsModeInit){ +- changeItm = RESOLUTION; +- Q_EMIT changed(); +- } +-} +- +-void UnifiedOutputConfig::slotRefreshRateChanged(int index) +-{ +- Q_FOREACH (const KScreen::OutputPtr &clone, mClones) { +- Q_FOREACH (const KScreen::ModePtr &mode, clone->modes()) { +- if (mode->size() == mResolution->currentResolution() && \ +- refreshRateToText(mode->refreshRate()) == mRefreshRate->itemText(index)) { +- clone->blockSignals(true); +- clone->setCurrentModeId(mode->id()); +- clone->blockSignals(false); +- } +- } +- } +- changeItm = FREQUENCY; +- Q_EMIT changed(); +-} +- +-QString UnifiedOutputConfig::findBestMode(const KScreen::OutputPtr &output, const QSize &size, bool isUser) +-{ +- float refreshRate = 0; +- QString id = "auto-fill"; +- Q_FOREACH (const KScreen::ModePtr &mode, output->modes()) { +- if (mode->size() == size && mode->refreshRate() > refreshRate) { +- refreshRate = mode->refreshRate(); +- id = mode->id(); +- } +- } +- +- // 第一次开启镜像模式读取kwin配置 +- if (!isUser) { +- QVector<KScreen::Output *> outputs; +- Q_FOREACH (const auto &output, mConfig->outputs()) { +- outputs << output.data(); +- } +- +- QCryptographicHash hash(QCryptographicHash::Md5); +- Q_FOREACH (const KScreen::Output *output, outputs) { +- hash.addData(output->uuid()); +- } +- QByteArray groupUuid = QByteArray(1, '1').append(hash.result().toHex()).left(15); +- const auto config = KSharedConfig::openConfig(QLatin1String("ukui-kwinrc")); +- const auto outputGroup = config->group("DrmOutputs"); +- const auto configGroup = outputGroup.group(groupUuid); +- +- QSize outputSize; +- Q_FOREACH (const auto &aimOutput, outputs) { +- const auto outputConfig = configGroup.group(output->uuid()); +- QString res = outputConfig.readEntry("Mode"); +- // don't change mode if cannot found config +- if (outputConfig.hasKey("Mode")) { +- QStringList list = res.split(QLatin1String("_")); +- QStringList size = list[0].split(QLatin1String("x")); +- if (list.size() > 1 && size.size() > 1) { +- outputSize = QSize(size[0].toInt(), size[1].toInt()); +- int refreshRate = list[1].toInt(); +- Q_FOREACH (const auto &m, output->modes()) { +- if (m->size() == outputSize && m->refreshRate() * 1000 == refreshRate && output == aimOutput) { +- id = m->id(); +- } +- } +- } +- } +- } +- if (outputSize.isValid()) { +- mResolution->setResolution(outputSize); +- if (outputSize != size) { +- slotResolutionChanged(outputSize, false); //重新填充刷新率 +- id = "auto-fill"; //已经填充了刷新率 +- } +- } +- } +- return id; +-} +- +-// 统一输出方向信号改变 +-void UnifiedOutputConfig::slotRotationChangedDerived(int index) +-{ +- KScreen::Output::Rotation rotation = static_cast<KScreen::Output::Rotation>(mRotation->itemData(index).toInt()); +- Q_FOREACH (const KScreen::OutputPtr &clone, mClones) { +- if (clone->isConnected() && clone->isEnabled()) { +- clone->setRotation(rotation); +- clone->setPos(QPoint(0, 0)); +- } +- } +- changeItm = ORIENTATION; +- Q_EMIT changed(); +-} +- +-void UnifiedOutputConfig::slotRestoreResoltion() +-{ +- if (!mOutput->currentMode()) { +- return; +- } +- if (mResolution->currentResolution() != mOutput->currentMode()->size()) { //分辨率改变时,触发该信号重新加载刷新率,用于修改分辨率之后但未保存 +- mResolution->setResolution(mOutput->currentMode()->size()); //这里面不会触发分辨率改变信号 +- slotResolutionChanged(mOutput->currentMode()->size(), false); +- } else { //分辨率未修改,刷新率修改,用于修改刷新率之后但未保存 +- for (int i = 0; i < mRefreshRate->count(); i++) { +- if (refreshRateToText(mOutput->currentMode()->refreshRate()) == mRefreshRate->itemText(i)\ +- || mRefreshRate->count() == 1) { +- mRefreshRate->blockSignals(true); +- mRefreshRate->setCurrentIndex(i); +- mRefreshRate->blockSignals(false); +- break; +- } +- } +- } +-} +- +-void UnifiedOutputConfig::slotRestoreRatation() +-{ +- mRotation->blockSignals(true); +- mRotation->setCurrentIndex(mRotation->findData(mOutput->rotation())); +- mRotation->blockSignals(false); +-} +- +-bool UnifiedOutputConfig::isCloneMode() +-{ +- /* +- *不能直接用isVisible判断是否为镜像模式 +- *设置镜像模式时,visiable总是true,但此时还未设置currentMode +- *导致某些情况异常 +- */ +- //return this->isVisible(); //显示则表示是统一输出 +- if (!mClones.isEmpty() && mClones[0] && mClones[0]->currentMode()) { +- QSize cloneSize(mClones[0]->currentMode()->size()); +- QPoint clonePos(mClones[0]->pos()); +- Q_FOREACH (const KScreen::OutputPtr &clone, mClones) { +- if (clone->currentMode() && (clone->currentMode()->size() != cloneSize || clone->pos() != clonePos)) { +- return false; +- } +- } +- return true; +- } else { +- return false; +- } +- +-} +- +diff --git a/plugins/system/display_hw/unifiedoutputconfig.h b/plugins/system/display_hw/unifiedoutputconfig.h +deleted file mode 100644 +index 9260417..0000000 +--- a/plugins/system/display_hw/unifiedoutputconfig.h ++++ /dev/null +@@ -1,46 +0,0 @@ +-#ifndef UNIFIEDOUTPUTCONFIG_H +-#define UNIFIEDOUTPUTCONFIG_H +- +-#include "outputconfig.h" +-#include <QVBoxLayout> +- +-namespace KScreen { +-class Output; +-class Config; +-} +- +-class UnifiedOutputConfig : public OutputConfig +-{ +- Q_OBJECT +-public: +- explicit UnifiedOutputConfig(const KScreen::ConfigPtr &config, QWidget *parent); +- ~UnifiedOutputConfig() override; +- +- void setOutput(const KScreen::OutputPtr &output) override; +- bool isCloneMode(); +-private Q_SLOTS: +- void slotResolutionChanged(const QSize &size, bool emitFlag); +- +- // 统一输出后调整屏幕方向统一代码 +- void slotRotationChangedDerived(int index); +- void slotRestoreResoltion(); +- void slotRestoreRatation(); +- void slotRefreshRateChanged(int index); +- void slotScaleChanged(int index); +- +-Q_SIGNALS: +- void scaleChanged(double scale); +- +-private: +- void initUi() override; +- void initscale(QVBoxLayout *vbox); +- KScreen::OutputPtr createFakeOutput(); +- QString findBestMode(const KScreen::OutputPtr &output, const QSize &size, bool isUser); +- +-private: +- KScreen::ConfigPtr mConfig; +- QList<KScreen::OutputPtr> mClones; +- QComboBox *mScaleCombox = nullptr; +-}; +- +-#endif // UNIFIEDOUTPUTCONFIG_H +diff --git a/plugins/system/display_hw/utils.cpp b/plugins/system/display_hw/utils.cpp +deleted file mode 100644 +index e075c90..0000000 +--- a/plugins/system/display_hw/utils.cpp ++++ /dev/null +@@ -1,24 +0,0 @@ +-#include "utils.h" +- +-#include <KF5/KScreen/kscreen/output.h> +-#include <KF5/KScreen/kscreen/edid.h> +- +-QString Utils::outputName(const KScreen::OutputPtr &output) +-{ +- return outputName(output.data()); +-} +- +-QString Utils::outputName(const KScreen::Output *output) +-{ +- if (output != nullptr) { +- return kOutput.at(output->type()); +- } +- +- return kOutput.at(0); +-} +- +-QString Utils::sizeToString(const QSize &size) +-{ +- return QStringLiteral("%1x%2").arg(size.width()).arg(size.height()); +-} +- +diff --git a/plugins/system/display_hw/utils.h b/plugins/system/display_hw/utils.h +deleted file mode 100644 +index d1a3be6..0000000 +--- a/plugins/system/display_hw/utils.h ++++ /dev/null +@@ -1,36 +0,0 @@ +-#ifndef KSCREEN_KCM_UTILS_H +-#define KSCREEN_KCM_UTILS_H +- +-#include <QString> +-#include <QSize> +-#include <QStringList> +- +-#include <KF5/KScreen/kscreen/types.h> +-#include <KF5/KScreen/kscreen/output.h> +- +-const QStringList kOutput { +- "Unknown", +- "VGA", +- "DVI", +- "DVII", +- "DVIA", +- "DVID", +- "HDMI", +- "eDP", +- "TV", +- "TVComposite", +- "TVSVideo", +- "TVComponent", +- "TVSCART", +- "TVC4", +- "DP" +-}; +- +-namespace Utils { +-QString outputName(const KScreen::Output *output); +-QString outputName(const KScreen::OutputPtr &output); +- +-QString sizeToString(const QSize &size); +-} +- +-#endif +diff --git a/plugins/system/display_hw/widget.cpp b/plugins/system/display_hw/widget.cpp +deleted file mode 100644 +index 22e014b..0000000 +--- a/plugins/system/display_hw/widget.cpp ++++ /dev/null +@@ -1,2440 +0,0 @@ +-#include "widget.h" +-#include "controlpanel.h" +-#include "declarative/qmloutput.h" +-#include "declarative/qmlscreen.h" +-#include "utils.h" +-#include "ui_display_hw.h" +-#include "displayperformancedialog.h" +-#include "colorinfo.h" +-#include "ukcccommon.h" +-using namespace ukcc; +-#include "../../../shell/mainwindow.h" +- +-#include <QHBoxLayout> +-#include <QTimer> +-#include <QLabel> +-#include <QVBoxLayout> +-#include <QSplitter> +-#include <QtGlobal> +-#include <QQuickView> +-#include <qquickitem.h> +-#include <QDebug> +-#include <QPushButton> +-#include <QProcess> +-#include <QtAlgorithms> +-#include <QtXml> +-#include <QDomDocument> +-#include <QDir> +-#include <QStandardPaths> +-#include <QComboBox> +-#include <QQuickWidget> +-#include <QMessageBox> +-#include <QDBusConnection> +-#include <QJsonDocument> +-#include <QtConcurrent> +-#include <QDBusMetaType> +- +-#include <KF5/KScreen/kscreen/output.h> +-#include <KF5/KScreen/kscreen/edid.h> +-#include <KF5/KScreen/kscreen/mode.h> +-#include <KF5/KScreen/kscreen/config.h> +-#include <KF5/KScreen/kscreen/getconfigoperation.h> +-#include <KF5/KScreen/kscreen/configmonitor.h> +-#include <KF5/KScreen/kscreen/setconfigoperation.h> +-#include <KF5/KScreen/kscreen/edid.h> +-#include <KF5/KScreen/kscreen/types.h> +- +-#include <KF5/KConfigCore/KSharedConfig> +-#include <KF5/KConfigCore/KConfigGroup> +- +-#ifdef signals +-#undef signals +-#endif +- +-#define QML_PATH "kcm_kscreen/qml/" +- +-#define UKUI_CONTORLCENTER_PANEL_SCHEMAS "org.ukui.control-center.panel.plugins" +-#define THEME_NIGHT_KEY "themebynight" +- +-#define FONT_RENDERING_DPI "org.ukui.SettingsDaemon.plugins.xsettings" +-#define SCALE_KEY "scaling-factor" +- +-#define MOUSE_SIZE_SCHEMAS "org.ukui.peripherals-mouse" +-#define CURSOR_SIZE_KEY "cursor-size" +- +-#define POWER_SCHMES "org.ukui.power-manager" +-#define POWER_KEY "brightness-ac" +- +-#define ADVANCED_SCHEMAS "org.ukui.session.required-components" +-#define ADVANCED_KEY "windowmanager" +- +-const QString kCpu = "ZHAOXIN"; +-const QString kLoong = "Loongson"; +-const QString tempDayBrig = "6500"; +- +-QSize mScaleSizeRes = QSize(); +- +-Q_DECLARE_METATYPE(KScreen::OutputPtr) +- +-Widget::Widget(QWidget *parent) : +- QWidget(parent), +- ui(new Ui::DisplayWindow()) +-{ +- qRegisterMetaType<QQuickView *>(); +- +- ui->setupUi(this); +- ui->quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView); +- ui->quickWidget->setContentsMargins(0, 0, 0, 9); +- +- mCloseScreenButton = new KSwitchButton(this); +- ui->showScreenLayout->addWidget(mCloseScreenButton); +- +- mUnifyButton = new KSwitchButton(this); +- ui->unionLayout->addWidget(mUnifyButton); +- +- qDBusRegisterMetaType<ScreenConfig>(); +- +- setHideModuleInfo(); +- initNightUI(); +- isWayland(); +- +- QProcess *process = new QProcess; +- process->start("lsb_release -r"); +- process->waitForFinished(); +- +- QByteArray ba = process->readAllStandardOutput(); +- QString osReleaseCrude = QString(ba.data()); +- QStringList res = osReleaseCrude.split(":"); +- QString osRelease = res.length() >= 2 ? res.at(1) : ""; +- osRelease = osRelease.simplified(); +- +- const QByteArray idd(ADVANCED_SCHEMAS); +- if (QGSettings::isSchemaInstalled(idd) && osRelease == "V10") { +- ui->advancedBtn->show(); +- ui->advancedHorLayout->setContentsMargins(9, 8, 9, 32); +- } else { +- ui->advancedBtn->hide(); +- ui->advancedHorLayout->setContentsMargins(9, 0, 9, 0); +- } +- +- setTitleLabel(); +- initGSettings(); +- initTemptSlider(); +- initUiComponent(); +- initNightStatus(); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- ui->nightframe->setVisible(false); +-#else +- ui->nightframe->setVisible(this->mRedshiftIsValid); +-#endif +- +- mNightButton->setChecked(this->mIsNightMode); +- showNightWidget(mNightButton->isChecked()); +- +- initConnection(); +- loadQml(); +- +- connect(ui->scaleCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), +- this, [=](int index){ +- scaleChangedSlot(ui->scaleCombo->itemData(index).toDouble()); +- }); +-} +- +-Widget::~Widget() +-{ +- exitFlag = true; +- clearOutputIdentifiers(); +- delete ui; +- ui = nullptr; +-} +- +-bool Widget::eventFilter(QObject *object, QEvent *event) +-{ +- if (event->type() == QEvent::Resize) { +- if (mOutputIdentifiers.contains(qobject_cast<QQuickView *>(object))) { +- QResizeEvent *e = static_cast<QResizeEvent *>(event); +- const QRect screenSize = object->property("screenSize").toRect(); +- QRect geometry(QPoint(0, 0), e->size()); +- geometry.moveCenter(screenSize.center()); +- static_cast<QQuickView *>(object)->setGeometry(geometry); +- // Pass the event further +- } +- } +- return QObject::eventFilter(object, event); +-} +- +-void Widget::setConfig(const KScreen::ConfigPtr &config, bool showBrightnessFrameFlag) +-{ +- if (mConfig) { +- KScreen::ConfigMonitor::instance()->removeConfig(mConfig); +- for (const KScreen::OutputPtr &output : mConfig->outputs()) { +- output->disconnect(this); +- } +- mConfig->disconnect(this); +- } +- mConfig = config; +- mPrevConfig = config->clone(); +- mPreScreenConfig = config->clone(); +- for (int i = 0; i < BrightnessFrameV.size(); i = 0) { +- BrightnessFrameV[BrightnessFrameV.size() - 1]->deleteLater(); +- BrightnessFrameV[BrightnessFrameV.size() - 1] = nullptr; +- BrightnessFrameV.pop_back(); +- } +- +- changescale(); +- KScreen::ConfigMonitor::instance()->addConfig(mConfig); +- resetPrimaryCombo(); +- connect(mConfig.data(), &KScreen::Config::outputAdded, +- this, &Widget::outputAdded); +- connect(mConfig.data(), &KScreen::Config::outputRemoved, +- this, &Widget::outputRemoved); +- for (const KScreen::OutputPtr &output : mConfig->outputs()) { +- if (output->isConnected()) { +- connect(output.data(), &KScreen::Output::currentModeIdChanged, +- this, [=]() { +- if (output->currentMode()) { +- if (ui->scaleCombo) { +- changescale(); +- } +- } +- }); +- } +- +- } +- +- if (!mIsWayland) { +- connect(mConfig.data(), &KScreen::Config::primaryOutputChanged, +- this, &Widget::primaryOutputChanged); +- } +- +- // 上面屏幕拿取配置 +- mScreen->setConfig(mConfig); +- mControlPanel->setConfig(mConfig); +- mUnifyButton->setEnabled(mConfig->connectedOutputs().count() > 1); +- ui->unionframe->setVisible(mConfig->outputs().count() > 1); +- +- for (const KScreen::OutputPtr &output : mConfig->outputs()) { +- outputAdded(output); +- } +- +- // 择主屏幕输出 +- QMLOutput *qmlOutput = mScreen->primaryOutput(); +- +- if (qmlOutput) { +- mScreen->setActiveOutput(qmlOutput); +- } else { +- if (!mScreen->outputs().isEmpty()) { +- mScreen->setActiveOutput(mScreen->outputs().at(0)); +- // 择一个主屏幕,避免闪退现象 +- primaryButtonEnable(true); +- } +- } +- slotOutputEnabledChanged(); +- +- if (mFirstLoad && isCloneMode()) { +- mUnifyButton->blockSignals(true); +- mUnifyButton->setChecked(true); +- mUnifyButton->blockSignals(false); +- slotUnifyOutputs(); +- } +- mFirstLoad = false; +- +- if (showBrightnessFrameFlag == true) { +- showBrightnessFrame(); //初始化的时候,显示 +- } +- +- enableChangedSlot(); +-} +- +-KScreen::ConfigPtr Widget::currentConfig() const +-{ +- return mConfig; +-} +- +-void Widget::loadQml() +-{ +- qmlRegisterType<QMLOutput>("org.kde.kscreen", 1, 0, "QMLOutput"); +- qmlRegisterType<QMLScreen>("org.kde.kscreen", 1, 0, "QMLScreen"); +- +- qmlRegisterType<KScreen::Output>("org.kde.kscreen", 1, 0, "KScreenOutput"); +- qmlRegisterType<KScreen::Edid>("org.kde.kscreen", 1, 0, "KScreenEdid"); +- qmlRegisterType<KScreen::Mode>("org.kde.kscreen", 1, 0, "KScreenMode"); +- +- ui->quickWidget->setSource(QUrl("qrc:/qml/main.qml")); +- +- QQuickItem *rootObject = ui->quickWidget->rootObject(); +- mScreen = rootObject->findChild<QMLScreen *>(QStringLiteral("outputView")); +- +- connect(mScreen, &QMLScreen::released, this, [=] { +- delayApply(); +- }); +- +- if (!mScreen) { +- return; +- } +- connect(mScreen, &QMLScreen::focusedOutputChanged, +- this, &Widget::slotFocusedOutputChanged); +-} +- +-void Widget::resetPrimaryCombo() +-{ +- // Don't emit currentIndexChanged when resetting +- bool blocked = ui->primaryCombo->blockSignals(true); +- ui->primaryCombo->clear(); +- ui->primaryCombo->blockSignals(blocked); +- +- if (!mConfig) { +- return; +- } +- +- for (auto &output: mConfig->outputs()) { +- addOutputToPrimaryCombo(output); +- } +-} +- +-void Widget::addOutputToPrimaryCombo(const KScreen::OutputPtr &output) +-{ +- // 注释后让他显示全部屏幕下拉框 +- if (!output->isConnected()) { +- return; +- } +- +- ui->primaryCombo->addItem(Utils::outputName(output), output->id()); +- if (output->isPrimary() && !mIsWayland) { +- Q_ASSERT(mConfig); +- int lastIndex = ui->primaryCombo->count() - 1; +- ui->primaryCombo->setCurrentIndex(lastIndex); +- } +-} +- +-// 这里从屏幕点击来读取输出 +-void Widget::slotFocusedOutputChanged(QMLOutput *output) +-{ +- mControlPanel->activateOutput(output->outputPtr()); +- +- // 读取屏幕点击选择下拉框 +- Q_ASSERT(mConfig); +- int index = output->outputPtr().isNull() ? 0 : ui->primaryCombo->findData(output->outputPtr()->id()); +- if (index == -1 || index == ui->primaryCombo->currentIndex()) { +- return; +- } +- ui->primaryCombo->setCurrentIndex(index); +-} +- +-void Widget::slotOutputEnabledChanged() +-{ +- // 点击禁用屏幕输出后的改变 +- resetPrimaryCombo(); +- setActiveScreen(mKDSCfg); +- int enabledOutputsCount = 0; +- Q_FOREACH (const KScreen::OutputPtr &output, mConfig->outputs()) { +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { +- if (BrightnessFrameV[i]->outputName == Utils::outputName(output)){ +- if (!output->isEnabled()) +- BrightnessFrameV[i]->openFlag = false; +- else +- BrightnessFrameV[i]->openFlag = true; +- } +- } +- if (output->isEnabled()) { +- ++enabledOutputsCount; +- } +- if (enabledOutputsCount > 1) { +- break; +- } +- } +- mUnifyButton->setEnabled(screenEnableCount() > 1); +- ui->unionframe->setVisible(screenEnableCount() > 1); +- showBrightnessFrame(10); +-} +- +-void Widget::slotOutputConnectedChanged() +-{ +- resetPrimaryCombo(); +-} +- +-// 更改方向,再更改分辨率重叠问题 +-void Widget::slotQmloutOutChanged() +-{ +- QMLOutput *output = mScreen->primaryOutput(); +- if (output != nullptr && !output->outputPtr().isNull()) { +- mScreen->setScreenPosCenter(output, false); +- } +- +-} +- +-void Widget::slotUnifyOutputs() +-{ +- QMLOutput *base = mScreen->primaryOutput(); +- +- QList<int> clones; +- +- if (!base) { +- for (QMLOutput *output: mScreen->outputs()) { +- if (output->output()->isConnected() && output->output()->isEnabled()) { +- base = output; +- break; +- } +- } +- if (!base) { +- // WTF? +- return; +- } +- } +- +- // 取消统一输出 +- if (!mUnifyButton->isChecked()) { +- KScreen::OutputList screens = mPrevConfig->connectedOutputs(); +- if (mKDSCfg.isEmpty()) { +- if (!getPreScreenCfg().isEmpty()) { +- QList<ScreenConfig> preScreenCfg = getPreScreenCfg(); +- int posX = preScreenCfg.at(0).screenPosX; +- bool isOverlap = false; +- for (int i = 1; i< preScreenCfg.count(); i++) { +- if (posX == preScreenCfg.at(i).screenPosX) { +- isOverlap = true; +- setScreenKDS("expand"); +- break; +- } +- } +- Q_FOREACH(ScreenConfig cfg, preScreenCfg) { +- Q_FOREACH(KScreen::OutputPtr output, screens) { +- if (!cfg.screenId.compare(output->name()) && !isOverlap) { +- output->setCurrentModeId(cfg.screenModeId); +- output->setPos(QPoint(cfg.screenPosX, cfg.screenPosY)); +- } +- } +- } +- } +- +- QPoint raw(0,0); +- int originCount = 0; +- Q_FOREACH(KScreen::OutputPtr output, screens) { +- if (output->pos() == raw) { +- originCount++; +- } +- if (originCount >= 2) { +- setScreenKDS("expand"); +- } +- } +- } +- +- setConfig(mPrevConfig); +- +- ui->primaryCombo->setEnabled(true); +- mCloseScreenButton->setEnabled(true); +- ui->showMonitorframe->setVisible(true); +- ui->primaryCombo->setEnabled(true); +- } else if (mUnifyButton->isChecked()) { +- // Clone the current config, so that we can restore it in case user +- // breaks the cloning +- mPrevConfig = mConfig->clone(); +- +- if (!mFirstLoad && !mIsOutputAdd && mKDSCfg.isEmpty()) { +- setPreScreenCfg(mPrevConfig->connectedOutputs()); +- } +- +- for (QMLOutput *output: mScreen->outputs()) { +- if (output != mScreen->primaryOutput() && mScreen->primaryOutput()) { +- output->output()->setRotation(mScreen->primaryOutput()->output()->rotation()); +- } +- +- if (!output->output()->isConnected()) { +- continue; +- } +- +- if (!output->output()->isEnabled()) { +- output->setVisible(false); +- continue; +- } +- +- if (!base) { +- base = output; +- } +- +- output->setOutputX(0); +- output->setOutputY(0); +- output->output()->setPos(QPoint(0, 0)); +- output->output()->setClones(QList<int>()); +- +- if (base != output) { +- clones << output->output()->id(); +- output->setCloneOf(base); +- output->setVisible(false); +- } +- } +- +- base->output()->setClones(clones); +- +- base->setIsCloneMode(true); +- +- mScreen->updateOutputsPlacement(); +- +- // 关闭开关 +- mCloseScreenButton->setEnabled(false); +- ui->showMonitorframe->setVisible(false); +- ui->primaryCombo->setEnabled(false); +- ui->mainScreenButton->setEnabled(false); +- mControlPanel->setUnifiedOutput(base->outputPtr()); +- } +-} +- +-// FIXME: Copy-pasted from KDED's Serializer::findOutput() +-KScreen::OutputPtr Widget::findOutput(const KScreen::ConfigPtr &config, const QVariantMap &info) +-{ +- KScreen::OutputList outputs = config->outputs(); +- Q_FOREACH (const KScreen::OutputPtr &output, outputs) { +- if (!output->isConnected()) { +- continue; +- } +- +- const QString outputId +- = (output->edid() +- && output->edid()->isValid()) ? output->edid()->hash() : output->name(); +- if (outputId != info[QStringLiteral("id")].toString()) { +- continue; +- } +- +- QVariantMap posInfo = info[QStringLiteral("pos")].toMap(); +- QPoint point(posInfo[QStringLiteral("x")].toInt(), posInfo[QStringLiteral("y")].toInt()); +- output->setPos(point); +- output->setPrimary(info[QStringLiteral("primary")].toBool()); +- output->setEnabled(info[QStringLiteral("enabled")].toBool()); +- output->setRotation(static_cast<KScreen::Output::Rotation>(info[QStringLiteral("rotation")]. +- toInt())); +- +- QVariantMap modeInfo = info[QStringLiteral("mode")].toMap(); +- QVariantMap modeSize = modeInfo[QStringLiteral("size")].toMap(); +- QSize size(modeSize[QStringLiteral("width")].toInt(), +- modeSize[QStringLiteral("height")].toInt()); +- +- const KScreen::ModeList modes = output->modes(); +- Q_FOREACH (const KScreen::ModePtr &mode, modes) { +- if (mode->size() != size) { +- continue; +- } +- if (QString::number(mode->refreshRate()) +- != modeInfo[QStringLiteral("refresh")].toString()) { +- continue; +- } +- +- output->setCurrentModeId(mode->id()); +- break; +- } +- return output; +- } +- +- return KScreen::OutputPtr(); +-} +- +-void Widget::setHideModuleInfo() +-{ +- mCPU = getCpuInfo(); +- if (!mCPU.startsWith(kCpu, Qt::CaseInsensitive)) { +- ui->quickWidget->setAttribute(Qt::WA_AlwaysStackOnTop); +- ui->quickWidget->setClearColor(Qt::transparent); +- } +-} +- +-void Widget::setTitleLabel() +-{ +- +- //~ contents_path /display/monitor +- ui->primaryLabel->setText(tr("monitor")); +- +- //~ contents_path /display/screen zoom +- ui->scaleLabel->setText(tr("screen zoom")); +-} +-void Widget::writeScale(double scale) +-{ +- if (scale != scaleGSettings->get(SCALE_KEY).toDouble()) { +- mIsScaleChanged = true; +- } +- +- if (mIsScaleChanged) { +- if (!mIsChange) { +- showZoomtips(); +- } else { +- // 非主动切换缩放率,则不弹提示弹窗 +- mIsChange = false; +- } +- } else { +- return; +- } +- +- mIsScaleChanged = false; +- int cursize; +- QByteArray iid(MOUSE_SIZE_SCHEMAS); +- if (QGSettings::isSchemaInstalled(MOUSE_SIZE_SCHEMAS)) { +- QGSettings cursorSettings(iid); +- +- if (1.0 == scale) { +- cursize = 24; +- } else if (2.0 == scale) { +- cursize = 48; +- } else if (3.0 == scale) { +- cursize = 96; +- } else { +- cursize = 24; +- } +- +- QStringList keys = scaleGSettings->keys(); +- if (keys.contains("scalingFactor")) { +- +- scaleGSettings->set(SCALE_KEY, scale); +- } +- cursorSettings.set(CURSOR_SIZE_KEY, cursize); +- UkccCommon::setKwinMouseSize(cursize); +- } +-} +- +-void Widget::initGSettings() +-{ +- QByteArray id(UKUI_CONTORLCENTER_PANEL_SCHEMAS); +- if (QGSettings::isSchemaInstalled(id)) { +- mGsettings = new QGSettings(id, QByteArray(), this); +- if (mGsettings->keys().contains(THEME_NIGHT_KEY)) { +- mThemeButton->setChecked(mGsettings->get(THEME_NIGHT_KEY).toBool()); +- } +- } else { +- qDebug() << Q_FUNC_INFO << "org.ukui.control-center.panel.plugins not install"; +- return; +- } +- +- QByteArray powerId(POWER_SCHMES); +- if (QGSettings::isSchemaInstalled(powerId)) { +- mPowerGSettings = new QGSettings(powerId, QByteArray(), this); +- mPowerKeys = mPowerGSettings->keys(); +- connect(mPowerGSettings, &QGSettings::changed, this, [=](QString key) { +- if ("brightnessAc" == key || "brightnessBat" == key) { +- int value = mPowerGSettings->get(key).toInt(); +- if (mIsWayland && !mIsBattery) { +- value = (value == 0 ? 0 : value / 10); +- } +- +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { +- if (BrightnessFrameV[i]->outputName == "eDP") { +- BrightnessFrameV[i]->slider->blockSignals(true); +- BrightnessFrameV[i]->setTextLableValue(QString::number(value)); +- BrightnessFrameV[i]->slider->setValue(value); +- BrightnessFrameV[i]->slider->blockSignals(false); +- } +- } +- } +- }); +- } +- +- QByteArray scaleId(FONT_RENDERING_DPI); +- if (QGSettings::isSchemaInstalled(scaleId)) { +- scaleGSettings = new QGSettings(scaleId, QByteArray(), this); +- } +-} +- +-void Widget::initNightUI() +-{ +- //~ contents_path /display/unify output +- ui->unifyLabel->setText(tr("Mirror Display")); +- +- QHBoxLayout *nightLayout = new QHBoxLayout(ui->nightframe); +- //~ contents_path /display/night mode +- nightLabel = new QLabel(tr("night mode"), this); +- mNightButton = new KSwitchButton(this); +- nightLayout->addWidget(nightLabel); +- nightLayout->addStretch(); +- nightLayout->addWidget(mNightButton); +- +- QHBoxLayout *themeLayout = new QHBoxLayout(ui->themeFrame); +- mThemeButton = new KSwitchButton(this); +- themeLayout->addWidget(new QLabel(tr("Theme follow night mode"))); +- themeLayout->addStretch(); +- themeLayout->addWidget(mThemeButton); +-} +- +-bool Widget::isRestoreConfig() +-{ +- int cnt = 30; +- int ret; +- MainWindow *mainWindow = static_cast<MainWindow*>(this->topLevelWidget()); +- QMessageBox msg; +- QPushButton *saveBtn = msg.addButton(tr("Save"), QMessageBox::AcceptRole); +- QPushButton *canelBtn = msg.addButton(tr("Not Save"), QMessageBox::RejectRole); +- msg.setDefaultButton(saveBtn); +- saveBtn->setFocusPolicy(Qt::TabFocus); +- canelBtn->setFocusPolicy(Qt::TabFocus); +- connect(mainWindow, &MainWindow::posChanged, this, [=,&msg]() { +- QTimer::singleShot(8, this, [=,&msg]() { //窗管会移动窗口,等待8ms,确保在窗管移动之后再move,时间不能太长,否则会看到移动的路径 +- QRect rect = this->topLevelWidget()->geometry(); +- int msgX = 0, msgY = 0; +- msgX = rect.x() + rect.width()/2 - msg.width()/2; +- msgY = rect.y() + rect.height()/2 - (msg.height()+40)/2; +- msg.move(msgX, msgY); +- }); +- }); +- +- if (mConfigChanged && !mIsUnifyChanged) { +- QString config_name; +- switch (changeItm) { +- case 0: +- config_name = tr("resolution"); +- break; +- case 1: +- config_name = tr("orientation"); +- break; +- case 2: +- config_name = tr("frequency"); +- break; +- } +- msg.setIcon(QMessageBox::Warning); +- msg.setText(QString(tr("The screen %1 has been modified, whether to save it ? " +- "<br/>" +- "<font style= 'color:#626c6e'>the settings will be saved after 29 seconds</font>")).arg(config_name)); +- +- QTimer cntDown; +- QObject::connect(&cntDown, &QTimer::timeout, [&msg, &cnt, &cntDown, &ret ,&config_name]()->void { +- if (--cnt < 0) { +- cntDown.stop(); +- msg.hide(); +- msg.close(); +- } else { +- msg.setText(QString(tr("The screen %1 has been modified, whether to save it ? " +- "<br/>" +- "<font style= 'color:#626c6e'>the settings will be saved after %2 seconds</font>")).arg(config_name).arg(cnt)); +- msg.show(); +- } +- }); +- cntDown.start(1000); +- QTimer::singleShot(100, this, [=,&msg]() { //延时获取msg的size +- QRect rect = this->topLevelWidget()->geometry(); +- int msgX = 0, msgY = 0; +- msgX = rect.x() + rect.width()/2 - msg.width()/2; +- msgY = rect.y() + rect.height()/2 - (msg.height()+40)/2; +- msg.move(msgX, msgY); +- }); +- ret = msg.exec(); +- } +- disconnect(mainWindow, &MainWindow::posChanged, 0, 0); +- +- bool res = false; +- switch (ret) { +- case QMessageBox::AcceptRole: +- res = false; +- break; +- case QMessageBox::RejectRole: +- if (mIsSCaleRes) { +- QStringList keys = scaleGSettings->keys(); +- if (keys.contains("scalingFactor")) { +- scaleGSettings->set(SCALE_KEY,scaleres); +- } +- mIsSCaleRes = false; +- } +- res = true; +- break; +- } +- return res; +-} +- +-QString Widget::getCpuInfo() +-{ +- return Utils::getCpuInfo(); +-} +- +-bool Widget::isCloneMode() +-{ +- KScreen::OutputPtr output = mConfig->primaryOutput(); +- if (mConfig->connectedOutputs().count() >= 2) { +- foreach (KScreen::OutputPtr secOutput, mConfig->connectedOutputs()) { +- if (secOutput->geometry() != output->geometry() || !secOutput->isEnabled()) { +- return false; +- } +- } +- } else { +- return false; +- } +- return true; +-} +- +-bool Widget::isBacklight() +-{ +- QString cmd = "ukui-power-backlight-helper --get-max-brightness"; +- QProcess process; +- process.start(cmd); +- process.waitForFinished(); +- QString result = process.readAllStandardOutput().trimmed(); +- +- QString pattern("^[0-9]*$"); +- QRegExp reg(pattern); +- +- return reg.exactMatch(result); +-} +- +-QString Widget::getMonitorType() +-{ +- QString monitor = ui->primaryCombo->currentText(); +- QString type; +- if (monitor.contains("VGA", Qt::CaseInsensitive)) { +- type = "4"; +- } else { +- type = "8"; +- } +- return type; +-} +- +-bool Widget::isLaptopScreen() +-{ +- const QString &monitor = ui->primaryCombo->currentText(); +- if (monitor == "eDP") { +- return true; +- } +- return false; +-} +- +-bool Widget::isVisibleBrightness() +-{ +- if ((mIsBattery && isLaptopScreen()) +- || (mIsWayland && !mIsBattery) +- || (!mIsWayland && mIsBattery)) { +- return true; +- } +- return false; +-} +- +-int Widget::getDDCBrighthess() +-{ +- QString type = getMonitorType(); +- QDBusInterface ukccIfc("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- QDBusReply<int> reply = ukccIfc.call("getDDCBrightness", type); +- +- if (reply.isValid()) { +- return reply.value(); +- } +- return 0; +-} +- +-int Widget::getDDCBrighthess(QString name) +-{ +- QString type; +- int times = 100; +- if (name.contains("VGA", Qt::CaseInsensitive)) { +- type = "4"; +- } else { +- type = "8"; +- } +- QDBusInterface ukccIfc("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- while (--times) { +- if (exitFlag == true) +- return -1; +- for (int i = 0; i < deleteFrameNameV.size(); ++i) { +- if (name == deleteFrameNameV[i]) { //该屏幕已经被remove +- deleteFrameNameV.remove(i); +- return -1; +- } +- } +- QDBusReply<int> reply = ukccIfc.call("getDDCBrightness", type); +- if (reply.isValid() && reply.value() > 0) { +- return reply.value(); +- } +- usleep(80000); +- } +- return 0; +-} +- +-int Widget::getDDCBrighthess(QString edidHash, QString i2cBus) { +- int times = 600; +- QDBusInterface ukccIfc("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- QDBusReply<int> reply; +- while (times) { +- //防止调用terminate不会结束线程,锁屏在龙芯架构上出现过 +- if (exitFlag) { +- return -1; +- } +- if (times %10 != 0) { +- times--; +- usleep(100000); +- continue; +- } +- if (i2cBus == "") { +- return -1; +- } +- reply = ukccIfc.call("getDisplayBrightness", edidHash, i2cBus); +- if (reply.isValid() && reply.value() >= 0 && reply.value() <= 100) { +- return reply.value(); +- } +- times--; +- usleep(100000); +- } +- return -1; +-} +- +-int Widget::getLaptopBrightness() const +-{ +- return mPowerGSettings->get(POWER_KEY).toInt(); +-} +- +-void Widget::showNightWidget(bool judge) +-{ +- if (judge) { +- ui->sunframe->setVisible(true); +- ui->customframe->setVisible(true); +- ui->temptframe->setVisible(true); +- ui->themeFrame->setVisible(false); +- } else { +- ui->sunframe->setVisible(false); +- ui->customframe->setVisible(false); +- ui->temptframe->setVisible(false); +- ui->themeFrame->setVisible(false); +- } +- +- if (judge && ui->customradioBtn->isChecked()) { +- showCustomWiget(CUSTOM); +- } else { +- showCustomWiget(SUN); +- } +-} +- +-void Widget::showCustomWiget(int index) +-{ +- if (SUN == index) { +- ui->opframe->setVisible(false); +- ui->clsframe->setVisible(false); +- } else if (CUSTOM == index) { +- ui->opframe->setVisible(true); +- ui->clsframe->setVisible(true); +- } +-} +- +-void Widget::slotThemeChanged(bool judge) +-{ +- if (mGsettings->keys().contains(THEME_NIGHT_KEY)) { +- mGsettings->set(THEME_NIGHT_KEY, judge); +- } +-} +- +-void Widget::clearOutputIdentifiers() +-{ +- mOutputTimer->stop(); +- qDeleteAll(mOutputIdentifiers); +- mOutputIdentifiers.clear(); +-} +- +-void Widget::addBrightnessFrame(QString name, bool openFlag, const KScreen::OutputPtr &output, QString i2cBus) +-{ +- if (mIsBattery && name != "eDP") //笔记本非内置 +- return; +- +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { //已经有了 +- if (name == BrightnessFrameV[i]->outputName ) +- return; +- } +- BrightnessFrame *frame = new BrightnessFrame; +- frame->openFlag = openFlag; +- frame->setTextLableValue("0"); //最低亮度10,获取前为0 +- BrightnessFrameV.push_back(frame); +- +- for (int i = 0; i < deleteFrameNameV.size(); ++i) { +- if (deleteFrameNameV[i] == name) { +- deleteFrameNameV.remove(i); +- } +- } +- if (mIsBattery && name == "eDP") { +- frame->outputName = name; +- int initValue = mPowerGSettings->get(POWER_KEY).toInt(); +- frame->setTextLableValue(QString::number(initValue)); +- frame->slider->setValue(initValue); +- ui->unifyBrightLayout->addWidget(frame); +- connect(frame->slider, &QSlider::valueChanged, this, [=](){ +- qDebug()<<name<<"brightness"<<" is changed, value = "<<frame->slider->value(); +- mPowerGSettings->set(POWER_KEY, frame->slider->value()); +- frame->setTextLableValue(QString::number(mPowerGSettings->get(POWER_KEY).toInt())); +- }); +- } else if(!mIsBattery && output) { +- frame->outputName = name; +- ui->unifyBrightLayout->addWidget(frame); +- frame->slider->setValue(10); +- if (output->supportBrightness()) { +- QtConcurrent::run([=]{ +- int initValue = output->brightness(); +- if (initValue == -1 || frame == nullptr) +- return; +- frame->slider->setValue(initValue); +- frame->setTextLableValue(QString::number(initValue)); +- connect(frame->slider, &QSlider::valueChanged, this, [=](){ +- qDebug()<<name<<"brightness"<<" is changed, value = "<<frame->slider->value(); +- frame->setTextLableValue(QString::number(frame->slider->value())); +- output->setBrightness(frame->slider->value()); +- setKscreenConfig(this->currentConfig()); +- Q_FOREACH (const KScreen::OutputPtr &pOutput, mPrevConfig->outputs()) { +- if (Utils::outputName(pOutput) == name) { +- pOutput->setBrightness(frame->slider->value()); +- } +- } +- }); +- }); +- } else { +- frame->slider->setEnabled(false); +- //使用DDC +- QtConcurrent::run([=]{ +- if (openFlag == false) +- return; +- +- int initValue = getDDCBrighthess("", i2cBus); +- if (initValue == -1 || frame == nullptr) +- return; +- +- frame->slider->setEnabled(true); +- frame->slider->setValue(initValue); +- frame->setTextLableValue(QString::number(initValue)); +- connect(frame->slider, &QSlider::valueChanged, this, [=](){ +- qDebug()<<name<<"brightness"<<" is changed, value = "<<frame->slider->value(); +- frame->setTextLableValue(QString::number(frame->slider->value())); +- setDDCBrightnessN(frame->slider->value(), "", i2cBus); +- }); +- }); +- } +- } +-} +- +-void Widget::outputAdded(const KScreen::OutputPtr &output) +-{ +- getAllI2Cbus(); +- mPreScreenConfig = mConfig->clone(); +- QString name = Utils::outputName(output); +- QMap<QString, QString>::iterator it; +- QString outPutI2cBus = ""; +- for (it = I2CbusMap.begin(); it != I2CbusMap.end(); it++) { +- if (name.contains(it.key(), Qt::CaseInsensitive)) { +- outPutI2cBus = it.value(); +- break; +- } +- } +- addBrightnessFrame(name, output->isEnabled(), output, outPutI2cBus); +- // 刷新缩放选项,监听新增显示屏的mode变化 +- changescale(); +- if (output->isConnected()) { +- connect(output.data(), &KScreen::Output::currentModeIdChanged, +- this, [=]() { +- if (output->currentMode()) { +- if (ui->scaleCombo) { +- ui->scaleCombo->blockSignals(true); +- changescale(); +- ui->scaleCombo->blockSignals(false); +- } +- } +- }); +- } +- +- // 刷新缩放选项,监听新增显示屏的mode变化 +- changescale(); +- if (output->isConnected()) { +- connect(output.data(), &KScreen::Output::currentModeIdChanged, +- this, [=]() { +- if (output->currentMode()) { +- if (ui->scaleCombo) { +- ui->scaleCombo->blockSignals(true); +- changescale(); +- ui->scaleCombo->blockSignals(false); +- } +- } +- }); +- } +- +- connect(output.data(), &KScreen::Output::isConnectedChanged, +- this, &Widget::slotOutputConnectedChanged); +- connect(output.data(), &KScreen::Output::isEnabledChanged, +- this, &Widget::slotOutputEnabledChanged); +- +- addOutputToPrimaryCombo(output); +- +- // 检查统一输出-防止多显示屏幕 +- if (mUnifyButton->isChecked()) { +- for (QMLOutput *qmlOutput: mScreen->outputs()) { +- if (!qmlOutput->output()->isConnected()) { +- continue; +- } +- if (!qmlOutput->isCloneMode()) { +- qmlOutput->blockSignals(true); +- qmlOutput->setVisible(false); +- qmlOutput->blockSignals(false); +- } +- } +- } +- +- ui->unionframe->setVisible(screenEnableCount() > 1); +- mUnifyButton->setEnabled(screenEnableCount() > 1); +- +- if (!mFirstLoad) { +- QTimer::singleShot(1500, this, [=] { +- mIsOutputAdd = true; +- mainScreenButtonSelect(ui->primaryCombo->currentIndex()); +- mUnifyButton->setChecked(isCloneMode()); +- mIsOutputAdd = false; +- }); +- } +- showBrightnessFrame(); +-} +- +-void Widget::outputRemoved(int outputId) +-{ +- // 刷新缩放选项 +- changescale(); +- +- KScreen::OutputPtr output = mConfig->output(outputId); +- if (!output.isNull()) { +- output->disconnect(this); +- } +- +- const int index = ui->primaryCombo->findData(outputId); +- if (index == -1) { +- return; +- } +- +- if (index == ui->primaryCombo->currentIndex()) { +- // We'll get the actual primary update signal eventually +- // Don't emit currentIndexChanged +- const bool blocked = ui->primaryCombo->blockSignals(true); +- ui->primaryCombo->setCurrentIndex(0); +- ui->primaryCombo->blockSignals(blocked); +- } +- +- QString name = ui->primaryCombo->itemText(index); +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { +- if (BrightnessFrameV[i]->outputName == name) { +- delete BrightnessFrameV[i]; +- BrightnessFrameV[i] = nullptr; +- BrightnessFrameV.remove(i); +- bool existFlag = false; +- for (int i = 0; i < deleteFrameNameV.size(); ++i) { +- if (deleteFrameNameV[i] == name) { +- existFlag = true; +- break; +- } +- } +- if (existFlag == false) +- deleteFrameNameV.push_back(name); +- } +- } +- ui->primaryCombo->removeItem(index); +- +- // 检查统一输出-防止移除后没有屏幕可显示 +- if (mUnifyButton->isChecked()) { +- for (QMLOutput *qmlOutput: mScreen->outputs()) { +- if (!qmlOutput->output()->isConnected()) { +- continue; +- } +- qmlOutput->setIsCloneMode(false); +- qmlOutput->blockSignals(true); +- qmlOutput->setVisible(true); +- qmlOutput->blockSignals(false); +- } +- } +- ui->unionframe->setVisible(mConfig->connectedOutputs().count() > 1); +- mUnifyButton->blockSignals(true); +- mUnifyButton->setChecked(mConfig->connectedOutputs().count() > 1); +- mUnifyButton->blockSignals(false); +- mainScreenButtonSelect(ui->primaryCombo->currentIndex()); +- // 在双屏下拔掉显示器,然后更改配置应用,恢复到原来配置崩溃 +- mPreScreenConfig = mConfig->clone(); +- showBrightnessFrame(); +-} +- +-void Widget::primaryOutputSelected(int index) +-{ +- if (!mConfig) { +- return; +- } +- +- const KScreen::OutputPtr newPrimary = index == 0 ? KScreen::OutputPtr() : mConfig->output(ui->primaryCombo->itemData(index).toInt()); +- if (newPrimary == mConfig->primaryOutput()) { +- return; +- } +- +- mConfig->setPrimaryOutput(newPrimary); +-} +- +-// 主输出 +-void Widget::primaryOutputChanged(const KScreen::OutputPtr &output) +-{ +- Q_ASSERT(mConfig); +- int index = output.isNull() ? 0 : ui->primaryCombo->findData(output->id()); +- if (index == -1 || index == ui->primaryCombo->currentIndex()) { +- return; +- } +- ui->primaryCombo->setCurrentIndex(index); +-} +- +-void Widget::slotIdentifyButtonClicked(bool checked) +-{ +- Q_UNUSED(checked); +- connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, +- this, &Widget::slotIdentifyOutputs); +-} +- +-void Widget::slotIdentifyOutputs(KScreen::ConfigOperation *op) +-{ +- if (op->hasError()) { +- return; +- } +- +- const KScreen::ConfigPtr config = qobject_cast<KScreen::GetConfigOperation *>(op)->config(); +- +- const QString qmlPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(QML_PATH "OutputIdentifier.qml")); +- +- mOutputTimer->stop(); +- clearOutputIdentifiers(); +- +- /* Obtain the current active configuration from KScreen */ +- Q_FOREACH (const KScreen::OutputPtr &output, config->outputs()) { +- if (!output->isConnected() || !output->currentMode()) { +- continue; +- } +- +- const KScreen::ModePtr mode = output->currentMode(); +- +- QQuickView *view = new QQuickView(); +- +- view->setFlags(Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint); +- view->setResizeMode(QQuickView::SizeViewToRootObject); +- view->setSource(QUrl::fromLocalFile(qmlPath)); +- view->installEventFilter(this); +- +- QQuickItem *rootObj = view->rootObject(); +- if (!rootObj) { +- qWarning() << "Failed to obtain root item"; +- continue; +- } +- +- QSize deviceSize, logicalSize; +- if (output->isHorizontal()) { +- deviceSize = mode->size(); +- } else { +- deviceSize = QSize(mode->size().height(), mode->size().width()); +- } +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +-#else +- if (config->supportedFeatures() & KScreen::Config::Feature::PerOutputScaling) { +- // no scale adjustment needed on Wayland +- logicalSize = deviceSize; +- } else { +- logicalSize = deviceSize / devicePixelRatioF(); +- } +-#endif +- +- rootObj->setProperty("outputName", Utils::outputName(output)); +- rootObj->setProperty("modeName", Utils::sizeToString(deviceSize)); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- view->setProperty("screenSize", QRect(output->pos(), deviceSize)); +-#else +- view->setProperty("screenSize", QRect(output->pos(), logicalSize)); +-#endif +- +- mOutputIdentifiers << view; +- } +- +- for (QQuickView *view: mOutputIdentifiers) { +- view->show(); +- } +- +- mOutputTimer->start(2500); +-} +- +-void Widget::isWayland() +-{ +- QString sessionType = getenv("XDG_SESSION_TYPE"); +- +- if (!sessionType.compare(kSession, Qt::CaseSensitive)) { +- mIsWayland = true; +- } else { +- mIsWayland = false; +- } +-} +- +- +-void Widget::setDDCBrightnessN(int value, QString screenName) +-{ +- QString type; +- if (screenName.contains("VGA", Qt::CaseInsensitive)) { +- type = "4"; +- } else { +- type = "8"; +- } +- QDBusInterface ukccIfc("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- +- if (mLock.tryLock()) { +- ukccIfc.call("setDDCBrightness", QString::number(value), type); +- mLock.unlock(); +- } +-} +- +-void Widget::setDDCBrightnessN(int value, QString edidHash, QString i2cBus) +-{ +- if (i2cBus == "") +- return; +- +- QDBusInterface ukccIfc("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- +- if (mLock.tryLock()) { +- ukccIfc.call("setDisplayBrightness", QString::number(value), edidHash, i2cBus); +- mLock.unlock(); +- } +- +-} +- +-void Widget::setScreenKDS(QString kdsConfig) +-{ +- KScreen::OutputList screens = mConfig->connectedOutputs(); +- int firstScreenID = screens.begin().key(); +- int endScreenID = screens.end().key(); +- if (kdsConfig == "expand") { +- Q_FOREACH(KScreen::OutputPtr output, screens) { +- if (!output.isNull() && !mUnifyButton->isChecked()) { +- output->setEnabled(true); +- output->setCurrentModeId("0"); +- } +- } +- +- KScreen::OutputList screensPre = mPrevConfig->connectedOutputs(); +- +- KScreen::OutputPtr mainScreen = mPrevConfig->primaryOutput(); +- if (!mainScreen.isNull()) { +- mainScreen->setPos(QPoint(0, 0)); +- } +- +- KScreen::OutputPtr preIt = mainScreen; +- QMap<int, KScreen::OutputPtr>::iterator nowIt = screensPre.begin(); +- +- while (nowIt != screensPre.end()) { +- if (nowIt.value() != mainScreen) { +- nowIt.value()->setPos(QPoint(preIt->pos().x() + preIt->size().width(), 0)); +- KScreen::ModeList modes = preIt->modes(); +- Q_FOREACH (const KScreen::ModePtr &mode, modes) { +- if (preIt->currentModeId() == mode->id()) { +- if (preIt->rotation() != KScreen::Output::Rotation::Left && preIt->rotation() != KScreen::Output::Rotation::Right) { +- nowIt.value()->setPos(QPoint(preIt->pos().x() + mode->size().width(), 0)); +- } else { +- nowIt.value()->setPos(QPoint(preIt->pos().x() + mode->size().height(), 0)); +- } +- } +- } +- preIt = nowIt.value(); +- } +- nowIt++; +- } +- } else if (kdsConfig == "first") { +- QMapIterator<int, KScreen::OutputPtr> firstIt(screens); +- while (firstIt.hasNext()) { +- firstIt.next(); +- firstIt.value()->setEnabled(firstIt.key() == firstScreenID); +- } +- } else if (kdsConfig == "second") { +- QMapIterator<int, KScreen::OutputPtr> endIt(screens); +- while (endIt.hasNext()) { +- endIt.next(); +- endIt.value()->setEnabled(endIt.key() == endScreenID); +- } +- } else { +- Q_FOREACH(KScreen::OutputPtr output, screens) { +- if (!output.isNull()) { +- output->setEnabled(true); +- } +- } +- } +- delayApply(); +-} +- +-void Widget::setActiveScreen(QString status) +-{ +- int activeScreenId = 1; +- int enableCount = 0; +- int connectCount = 0; +- Q_FOREACH(const KScreen::OutputPtr &output, mConfig->connectedOutputs()) { +- connectCount++; +- enableCount = (output->isEnabled() ? (++enableCount) : enableCount); +- } +- +- if (status == "second") { +- activeScreenId = connectCount; +- } +- +- for (int index = 0; index <= ui->primaryCombo->count(); index++) { +- KScreen::OutputPtr output = mConfig->output(ui->primaryCombo->itemData(index).toInt()); +- if (status.isEmpty() && connectCount > enableCount && !output.isNull() && output->isEnabled()) { +- ui->primaryCombo->setCurrentIndex(index); +- } +- +- if (!status.isEmpty() && !output.isNull() && activeScreenId == output->id()) { +- ui->primaryCombo->setCurrentIndex(index); +- } +- } +-} +- +-QList<ScreenConfig> Widget::getPreScreenCfg() +-{ +- QDBusMessage msg = mUkccInterface.get()->call("getPreScreenCfg"); +- if(msg.type() == QDBusMessage::ErrorMessage) { +- qWarning() << "get pre screen cfg failed"; +- } +- QDBusArgument argument = msg.arguments().at(0).value<QDBusArgument>(); +- QList<QVariant> infos; +- argument >> infos; +- +- QList<ScreenConfig> preScreenCfg; +- for (int i = 0; i < infos.size(); i++){ +- ScreenConfig cfg; +- infos.at(i).value<QDBusArgument>() >> cfg; +- preScreenCfg.append(cfg); +- } +- +- return preScreenCfg; +-} +- +-void Widget::setPreScreenCfg(KScreen::OutputList screens) +-{ +- QMap<int, KScreen::OutputPtr>::iterator nowIt = screens.begin(); +- +- QVariantList retlist; +- int enableCount = 0; +- while (nowIt != screens.end()) { +- ScreenConfig cfg; +- cfg.screenId = nowIt.value()->name(); +- cfg.screenModeId = nowIt.value()->currentModeId(); +- cfg.screenPosX = nowIt.value()->pos().x(); +- cfg.screenPosY = nowIt.value()->pos().y(); +- cfg.primary = nowIt.value()->isPrimary(); +- +- QVariant variant = QVariant::fromValue(cfg); +- retlist << variant; +- if (nowIt.value()->isEnabled()) { +- enableCount++; +- } +- nowIt++; +- } +- if (enableCount < 2) { +- return; +- } +- +- mUkccInterface.get()->call("setPreScreenCfg", retlist); +- +- QVariantList outputList; +- Q_FOREACH(QVariant variant, retlist) { +- ScreenConfig screenCfg = variant.value<ScreenConfig>(); +- QVariantMap map; +- map["id"] = screenCfg.screenId; +- map["modeid"] = screenCfg.screenModeId; +- map["x"] = screenCfg.screenPosX; +- map["y"] = screenCfg.screenPosY; +- map["primary"] = screenCfg.primary; +- outputList << map; +- } +- +- QString filePath = QDir::homePath() + "/.config/ukui/ukcc-screenPreCfg.json"; +- QFile file(filePath); +- if (!file.open(QIODevice::WriteOnly)) { +- qWarning() << "Failed to open config file for writing! " << file.errorString(); +- +- } +- file.write(QJsonDocument::fromVariant(outputList).toJson()); +-} +- +-void Widget::setScreenIsApply(bool isApply) +-{ +- mIsScreenAdd = !isApply; +-} +- +-int Widget::screenEnableCount() +-{ +- int enableCount = 0; +- Q_FOREACH(KScreen::OutputPtr output, mConfig->connectedOutputs()) { +- if (output->isEnabled()) { +- enableCount++; +- } +- } +- return enableCount; +-} +- +-void Widget::setExtendPrimaryScreen() +-{ +- QVector<KScreen::Output *> outputs; +- Q_FOREACH (const auto &output, mConfig->outputs()) { +- outputs << output.data(); +- } +- +- QCryptographicHash hash(QCryptographicHash::Md5); +- Q_FOREACH (const KScreen::Output *output, outputs) { +- hash.addData(output->uuid()); +- } +- QByteArray groupUuid = QByteArray(1, '0').append(hash.result().toHex()).left(15); +- const auto config = KSharedConfig::openConfig(QLatin1String("ukui-kwinrc")); +- const auto outputGroup = config->group("DrmOutputs"); +- const auto configGroup = outputGroup.group(groupUuid); +- +- Q_FOREACH (const auto &output, outputs) { +- const auto outputConfig = configGroup.group(output->uuid()); +- bool primary = outputConfig.readEntry<bool>("Primary", false); +- if (primary) { +- output->setPrimary(true); +- } +- } +-} +- +-void Widget::showZoomtips() +-{ +- int ret; +- QMessageBox msg(this->topLevelWidget()); +- msg.setWindowTitle(tr("Hint")); +- msg.setIcon(QMessageBox::Warning); +- msg.setText(tr("The zoom has been modified, it will take effect after you log off")); +- msg.addButton(tr("Log out now"), QMessageBox::AcceptRole); +- msg.addButton(tr("Later"), QMessageBox::RejectRole); +- +- ret = msg.exec(); +- +- switch (ret) { +- case QMessageBox::AcceptRole: +- system("ukui-session-tools --logout"); +- break; +- case QMessageBox::RejectRole: +- break; +- } +-} +- +-//通过win+p修改,不存在按钮影响亮度显示的情况,直接就应用了,此时每个屏幕的openFlag是没有修改的,需要单独处理(setScreenKDS) +-void Widget::kdsScreenchangeSlot(QString status) +-{ +- qDebug() << Q_FUNC_INFO << "changed by kds"; +- if (!status.compare(mPreKDSCfg)) { +- return; +- } +- if (!mUnifyButton->isChecked()) { +- setPreScreenCfg(mConfig->connectedOutputs()); +- } +- //fix bug#107519,由于从镜像变为扩展之后,UnifiedOutputCfg监听到currentModeId改变从而修改了分辨率导致 +- if (status != "copy") { +- mControlPanel->deleteUnifiedOutputCfg(); +- } +- QTimer::singleShot(2500, this, [=] { +- bool isPreChecked = mUnifyButton->isChecked(); +- bool isCheck = (status == "copy") ? true : false; +- mKDSCfg = status; +- mPreKDSCfg = status; +- mPrevConfig = mConfig->clone(); +- if (mConfig->connectedOutputs().count() >= 2) { +- mUnifyButton->setChecked(isCheck); +- } +- bool afterChecked = mUnifyButton->isChecked(); +- +- Q_FOREACH(KScreen::OutputPtr output, mConfig->connectedOutputs()) { +- if (output.isNull()) +- continue; +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { +- if (BrightnessFrameV[i]->outputName == Utils::outputName(output)) { +- BrightnessFrameV[i]->openFlag = output->isEnabled(); +- } +- } +- } +- if (isCheck == true) { +- showBrightnessFrame(1); +- } else { +- showBrightnessFrame(2); +- } +- // 统一输出按钮状态未改变,清除标志位 +- if (isPreChecked == afterChecked) { +- mKDSCfg.clear(); +- } +- enableChangedSlot(); +- mainScreenButtonSelect(ui->primaryCombo->currentIndex()); +- }); +-} +- +-void Widget::delayApply() +-{ +- QTimer::singleShot(500, this, [=] { +- if (mKDSCfg.isEmpty() && !mIsScreenAdd) { +- slotQmloutOutChanged(); +- save(); +- enableChangedSlot(); +- } +- mIsUnifyChanged = false; +- mKDSCfg.clear(); +- mIsScreenAdd = false; +- }); +-} +- +-void Widget::enableChangedSlot() +-{ +- int count = 0; +- for (KScreen::OutputPtr output : mConfig->connectedOutputs()) { +- if (output->isEnabled()) { +- count++; +- } +- } +- +- for (QMLOutput *output: mScreen->outputs()) { +- output->setEnableCount(count); +- } +-} +- +-void Widget::setKscreenConfig(const KScreen::ConfigPtr &config) +-{ +- /* Store the current config, apply settings */ +- auto *op = new KScreen::SetConfigOperation(config); +- +- /* Block until the operation is completed, otherwise KCMShell will terminate +- * before we get to execute the Operation */ +- op->exec(); +- op->deleteLater(); +- op = nullptr; +-} +- +-void Widget::save() +-{ +- qDebug() << Q_FUNC_INFO << "apply config"; +- if (!this) { +- return; +- } +- +- const KScreen::ConfigPtr &config = this->currentConfig(); +- +- Q_FOREACH (const KScreen::OutputPtr &output, config->outputs()) { +- if (!output->isConnected()) +- continue; +- +- QMLOutput *base = mScreen->primaryOutput(); +- if (!base) { +- for (QMLOutput *output: mScreen->outputs()) { +- if (output->output()->isConnected() && output->output()->isEnabled()) { +- base = output; +- break; +- } +- } +- +- if (!base) { +- // WTF? +- return; +- } +- } +- } +- +- if (((ui->opHourCom->currentIndex() < ui->clHourCom->currentIndex()) +- || (ui->opHourCom->currentIndex() == ui->clHourCom->currentIndex() +- && ui->opMinCom->currentIndex() <= ui->clMinCom->currentIndex())) +- && CUSTOM == singleButton->checkedId() && mNightButton->isChecked()) { +- QMessageBox::warning(this, tr("Warning"), +- tr("Open time should be earlier than close time!")); +- mCloseScreenButton->setChecked(true); +- return; +- } +- +- setNightMode(mNightButton->isChecked()); +- +- if (!KScreen::Config::canBeApplied(config)) { +- QMessageBox::information(this, +- tr("Warnning"), +- tr("Sorry, your configuration could not be applied.\nCommon reasons are that the overall screen size is too big, or you enabled more displays than supported by your GPU.")); +- return; +- } +- +- int enableScreenCount = 0; +- KScreen::OutputPtr enableOutput; +- for (const KScreen::OutputPtr &output : mConfig->outputs()) { +- if (output->isEnabled()) { +- enableOutput = output; +- enableScreenCount++; +- } +- } +- KScreen::ConfigPtr mPrevConfig = mPreScreenConfig->clone(); +- if (enableScreenCount > 0) { +- auto *preOp = new KScreen::GetConfigOperation(); +- preOp->exec(); +- mPrevConfig = preOp->config()->clone(); //重新获取屏幕当前状态 +- preOp->deleteLater(); +- } +- +- setKscreenConfig(config); +- +- // The 1000ms is a bit "random" here, it's what works on the systems I've tested, but ultimately, this is a hack +- // due to the fact that we just can't be sure when xrandr is done changing things, 1000 doesn't seem to get in the way +- QTimer::singleShot(1000, this, +- [=]() { +- if (mIsWayland) { +- QString hash = config->connectedOutputsHash(); +- writeFile(mDir % hash); +- } +- mIsUnifyChanged = false; +- mConfigChanged = false; +- mainScreenButtonSelect(ui->primaryCombo->currentIndex()); +- }); +- +- if (isRestoreConfig()) { +- auto *op = new KScreen::SetConfigOperation(mPrevConfig); +- op->exec(); +- // 无法知道什么时候执行完操作 +- QTimer::singleShot(1000, this, [=]() { +- writeFile(mDir % mPrevConfig->connectedOutputsHash()); +- }); +- } else { +- mPreKDSCfg.clear(); // 控制面板主动操作,清除win+p标志位 +- mPreScreenConfig = mConfig->clone(); +- } +- +- if (enableScreenCount >= 2 && !mUnifyButton->isChecked()) { +- setPreScreenCfg(mConfig->connectedOutputs()); +- } +- +- setActiveScreen(); +- +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { //应用成功再更新屏幕是否开启的状态,判断亮度条是否打开 +- for (KScreen::OutputPtr output : mConfig->outputs()) { +- if (BrightnessFrameV[i]->outputName == Utils::outputName(output)) { +- BrightnessFrameV[i]->openFlag = output->isEnabled(); +- } +- } +- } +- int flag = mUnifyButton->isChecked() ? 1 : 2; +- showBrightnessFrame(flag); //成功应用之后,重新显示亮度条,传入是否统一输出,1表示打开,2表示关闭 +-} +- +-QVariantMap metadata(const KScreen::OutputPtr &output) +-{ +- QVariantMap metadata; +- metadata[QStringLiteral("name")] = output->name(); +- if (!output->edid() || !output->edid()->isValid()) { +- return metadata; +- } +- +- metadata[QStringLiteral("fullname")] = output->edid()->deviceId(); +- return metadata; +-} +- +-QString Widget::globalFileName(const QString &hash) +-{ +- QString s_dirPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +- %QStringLiteral("/kscreen/"); +- QString dir = s_dirPath % QStringLiteral("outputs/"); +- if (!QDir().mkpath(dir)) { +- return QString(); +- } +- return QString(); +-} +- +-QVariantMap Widget::getGlobalData(KScreen::OutputPtr output) +-{ +- QFile file(globalFileName(output->hashMd5())); +- if (!file.open(QIODevice::ReadOnly)) { +- qDebug() << "Failed to open file" << file.fileName(); +- return QVariantMap(); +- } +- QJsonDocument parser; +- return parser.fromJson(file.readAll()).toVariant().toMap(); +-} +- +-void Widget::writeGlobal(const KScreen::OutputPtr &output) +-{ +- // get old values and subsequently override +- QVariantMap info = getGlobalData(output); +- if (!writeGlobalPart(output, info, nullptr)) { +- return; +- } +- QFile file(globalFileName(output->hashMd5())); +- if (!file.open(QIODevice::WriteOnly)) { +- qWarning() << "Failed to open global output file for writing! " << file.errorString(); +- return; +- } +- +- file.write(QJsonDocument::fromVariant(info).toJson()); +- return; +-} +- +-bool Widget::writeGlobalPart(const KScreen::OutputPtr &output, QVariantMap &info, +- const KScreen::OutputPtr &fallback) +-{ +- info[QStringLiteral("id")] = output->hash(); +- info[QStringLiteral("metadata")] = metadata(output); +- info[QStringLiteral("rotation")] = output->rotation(); +- +- // Round scale to four digits +- info[QStringLiteral("scale")] = int(output->scale() * 10000 + 0.5) / 10000.; +- +- QVariantMap modeInfo; +- float refreshRate = -1.; +- QSize modeSize; +- if (output->currentMode() && output->isEnabled()) { +- refreshRate = output->currentMode()->refreshRate(); +- modeSize = output->currentMode()->size(); +- } else if (fallback && fallback->currentMode()) { +- refreshRate = fallback->currentMode()->refreshRate(); +- modeSize = fallback->currentMode()->size(); +- } +- +- if (refreshRate < 0 || !modeSize.isValid()) { +- return false; +- } +- +- modeInfo[QStringLiteral("refresh")] = refreshRate; +- +- QVariantMap modeSizeMap; +- modeSizeMap[QStringLiteral("width")] = modeSize.width(); +- modeSizeMap[QStringLiteral("height")] = modeSize.height(); +- modeInfo[QStringLiteral("size")] = modeSizeMap; +- +- info[QStringLiteral("mode")] = modeInfo; +- +- return true; +-} +- +-bool Widget::writeFile(const QString &filePath) +-{ +- const KScreen::OutputList outputs = mConfig->outputs(); +- const auto oldConfig = mPreScreenConfig; +- KScreen::OutputList oldOutputs; +- if (oldConfig) { +- oldOutputs = oldConfig->outputs(); +- } +- QVariantList outputList; +- for (const KScreen::OutputPtr &output : outputs) { +- QVariantMap info; +- const auto oldOutputIt = std::find_if(oldOutputs.constBegin(), oldOutputs.constEnd(), +- [output](const KScreen::OutputPtr &out) { +- return out->hashMd5() == output->hashMd5(); +- }); +- const KScreen::OutputPtr oldOutput = oldOutputIt != oldOutputs.constEnd() ? *oldOutputIt +- : nullptr; +- if (!output->isConnected()) { +- continue; +- } +- +- writeGlobalPart(output, info, oldOutput); +- info[QStringLiteral("primary")] = output->isPrimary(); +- info[QStringLiteral("enabled")] = output->isEnabled(); +- +- auto setOutputConfigInfo = [&info](const KScreen::OutputPtr &out) { +- if (!out) { +- return; +- } +- +- QVariantMap pos; +- pos[QStringLiteral("x")] = out->pos().x(); +- pos[QStringLiteral("y")] = out->pos().y(); +- info[QStringLiteral("pos")] = pos; +- }; +- setOutputConfigInfo(output->isEnabled() ? output : oldOutput); +- +- if (output->isEnabled()) { +- // try to update global output data +- writeGlobal(output); +- } +- outputList.append(info); +- } +- +- QFile file(filePath); +- if (!file.open(QIODevice::WriteOnly)) { +- qWarning() << "Failed to open config file for writing! " << file.errorString(); +- return false; +- } +- file.write(QJsonDocument::fromVariant(outputList).toJson()); +- qDebug() << "Config saved on: " << file.fileName(); +- +- return true; +-} +- +-void Widget::scaleChangedSlot(double scale) +-{ +- if (scaleGSettings->get(SCALE_KEY).toDouble() != scale) { +- mIsScaleChanged = true; +- } else { +- mIsScaleChanged = false; +- } +- writeScale(scale); +-} +- +-void Widget::changedSlot() +-{ +- mConfigChanged = true; +-} +- +-void Widget::propertiesChangedSlot(QString property, QMap<QString, QVariant> propertyMap, +- QStringList propertyList) +-{ +- Q_UNUSED(property); +- Q_UNUSED(propertyList); +- if (propertyMap.keys().contains("OnBattery")) { +- mOnBattery = propertyMap.value("OnBattery").toBool(); +- } +-} +- +-// 是否禁用主屏按钮 +-void Widget::mainScreenButtonSelect(int index) +-{ +- if (!mConfig || ui->primaryCombo->count() <= 0) { +- return; +- } +- +- const KScreen::OutputPtr newPrimary = mConfig->output(ui->primaryCombo->itemData(index).toInt()); +- +- if (!newPrimary->isEnabled()) { +- ui->scaleCombo->setEnabled(false); +- } else { +- ui->scaleCombo->setEnabled(true); +- } +- +- int connectCount = mConfig->connectedOutputs().count(); +- +- if (newPrimary == mConfig->primaryOutput() || mUnifyButton->isChecked() || (mConfig->connectedOutputs().count() == 1) || !newPrimary->isEnabled()) { +- ui->mainScreenButton->setEnabled(false); +- } else { +- ui->mainScreenButton->setEnabled(true); +- } +- +- // 设置是否勾选 +- mCloseScreenButton->setEnabled(true); +- ui->showMonitorframe->setVisible(connectCount > 1 && !mUnifyButton->isChecked()); +- +- // 初始化时不要发射信号 +- mCloseScreenButton->blockSignals(true); +- mCloseScreenButton->setChecked(newPrimary->isEnabled()); +- mCloseScreenButton->blockSignals(false); +- mControlPanel->activateOutput(newPrimary); +- +- mScreen->setActiveOutputByCombox(newPrimary->id()); +-} +- +-// 设置主屏按钮 +-void Widget::primaryButtonEnable(bool status) +-{ +- Q_UNUSED(status); +- if (!mConfig) { +- return; +- } +- int index = ui->primaryCombo->currentIndex(); +- ui->mainScreenButton->setEnabled(false); +- const KScreen::OutputPtr newPrimary = mConfig->output(ui->primaryCombo->itemData(index).toInt()); +- mConfig->setPrimaryOutput(newPrimary); +-} +- +-void Widget::checkOutputScreen(bool judge) +-{ +- const KScreen::ConfigPtr &config = this->currentConfig(); +- +- int enableOutputCount = 0; +- Q_FOREACH (const KScreen::OutputPtr &output, config->outputs()) { +- if (output->isEnabled()) { +- enableOutputCount++; +- } +- } +- if (enableOutputCount < 2 && !judge) { +- QMessageBox::warning(this, tr("Warning"), tr("please insure at least one output!")); +- mCloseScreenButton->blockSignals(true); +- mCloseScreenButton->setChecked(true); +- mCloseScreenButton->blockSignals(false); +- return; +- } +- +- int index = ui->primaryCombo->currentIndex(); +- KScreen::OutputPtr newPrimary = mConfig->output(ui->primaryCombo->itemData(index).toInt()); +- +- KScreen::OutputPtr mainScreen = mConfig->primaryOutput(); +- +- if (!mainScreen) { +- mConfig->setPrimaryOutput(newPrimary); +- } +- mainScreen = mConfig->primaryOutput(); +- +- if (!judge) { +- setPreScreenCfg(mConfig->connectedOutputs()); +- } else { +- QList<ScreenConfig> preScreenCfg = getPreScreenCfg(); +- KScreen::OutputList screens = mConfig->connectedOutputs(); +- +- if (!preScreenCfg.isEmpty()) { +- Q_FOREACH(ScreenConfig cfg, preScreenCfg) { +- Q_FOREACH(KScreen::OutputPtr output, screens) { +- if (!cfg.screenId.compare(output->name())) { +- output->setPos(QPoint(cfg.screenPosX, cfg.screenPosY)); +- } +- } +- } +- } else { +- KScreen::OutputPtr enableOutput; +- Q_FOREACH(KScreen::OutputPtr output, screens) { +- if (output->isEnabled()) { +- enableOutput = output; +- break; +- } +- } +- newPrimary->setEnabled(judge); +- newPrimary->setPos(QPoint(enableOutput->size().width(), 0)); +- } +- setExtendPrimaryScreen(); +- } +- +- newPrimary->setEnabled(judge); +- +- +- ui->primaryCombo->blockSignals(true); +- ui->primaryCombo->setCurrentIndex(index); +- ui->primaryCombo->blockSignals(false); +- mainScreenButtonSelect(index); +-} +- +- +-void Widget::initConnection() +-{ +- connect(mNightButton, SIGNAL(checkedChanged(bool)), this, SLOT(showNightWidget(bool))); +- connect(mThemeButton, SIGNAL(checkedChanged(bool)), this, SLOT(slotThemeChanged(bool))); +- connect(singleButton, SIGNAL(buttonClicked(int)), this, SLOT(showCustomWiget(int))); +- +- connect(ui->mainScreenButton, &QPushButton::clicked, this, [=](bool status) { +- primaryButtonEnable(status); +- delayApply(); +- }); +- +- mControlPanel = new ControlPanel(this); +- connect(mControlPanel, &ControlPanel::changed, this, &Widget::changed); +- connect(this, &Widget::changed, this, &Widget::changedSlot); +- connect(mControlPanel, &ControlPanel::scaleChanged, this, &Widget::scaleChangedSlot); +- +- connect(this, &Widget::changed, this, [=](){ +- changedSlot(); +- delayApply(); +- }); +- +- ui->controlPanelLayout->addWidget(mControlPanel); +- +- connect(mCloseScreenButton, &KSwitchButton::stateChanged, this, [this](bool checked){ +- checkOutputScreen(checked); +- delayApply(); +- changescale(); +- }); +- +- connect(ui->advancedBtn, &QPushButton::clicked, this, [=] { +- DisplayPerformanceDialog *dialog = new DisplayPerformanceDialog; +- dialog->exec(); +- }); +- +- connect(mUnifyButton, &KSwitchButton::stateChanged, +- [this] { +- mIsUnifyChanged = true; +- slotUnifyOutputs(); +- setScreenIsApply(true); +- delayApply(); +- }); +- +- QDBusConnection::sessionBus().connect(QString(), +- QString("/"), +- "org.ukui.ukcc.session.interface", +- "screenChanged", +- this, +- SLOT(kdsScreenchangeSlot(QString))); +- +- QDBusConnection::sessionBus().connect(QString(), +- QString("/ColorCorrect"), +- "org.ukui.kwin.ColorCorrect", +- "nightColorConfigChanged", +- this, +- SLOT(nightChangedSlot(QHash<QString,QVariant>))); +- +- mOutputTimer = new QTimer(this); +- connect(mOutputTimer, &QTimer::timeout, +- this, &Widget::clearOutputIdentifiers); +- +- mApplyShortcut = new QShortcut(QKeySequence("Ctrl+A"), this); +- connect(mApplyShortcut, SIGNAL(activated()), this, SLOT(save())); +- +- connect(ui->primaryCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), +- this, [=](int index) { +- mainScreenButtonSelect(index); +- showBrightnessFrame(); //当前屏幕框变化的时候,显示,此时不判断 +- +- }); +-} +- +- +-void Widget::initTemptSlider() +-{ +- ui->temptSlider->setRange(1.1*1000, 6500); +- ui->temptSlider->setTracking(true); +- +- for (int i = 0; i < 24; i++) { +- ui->opHourCom->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0'))); +- ui->clHourCom->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0'))); +- } +- +- for (int i = 0; i < 60; i++) { +- ui->opMinCom->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0'))); +- ui->clMinCom->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0'))); +- } +-} +- +-void Widget::setNightMode(const bool nightMode) +-{ +- QDBusInterface colorIft("org.ukui.KWin", +- "/ColorCorrect", +- "org.ukui.kwin.ColorCorrect", +- QDBusConnection::sessionBus()); +- if (!colorIft.isValid()) { +- qWarning() << "create org.ukui.kwin.ColorCorrect failed"; +- return; +- } +- +- if (!nightMode) { +- mNightConfig["Active"] = false; +- } else { +- mNightConfig["Active"] = true; +- mNightConfig["Mode"] = 2; +- +- if (ui->sunradioBtn->isChecked()) { +- mNightConfig["EveningBeginFixed"] = "17:55:00"; +- mNightConfig["MorningBeginFixed"] = "05:55:04"; +- } else if (ui->customradioBtn->isChecked()) { +- mNightConfig["EveningBeginFixed"] = ui->opHourCom->currentText() + ":" +- + ui->opMinCom->currentText() + ":00"; +- mNightConfig["MorningBeginFixed"] = ui->clHourCom->currentText() + ":" +- + ui->clMinCom->currentText() + ":00"; +- } +- mNightConfig["NightTemperature"] = ui->temptSlider->value(); +- } +- +- colorIft.call("setNightColorConfig", mNightConfig); +-} +- +-void Widget::initUiComponent() +-{ +- mDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +- %QStringLiteral("/kscreen/") +- %QStringLiteral("" /*"configs/"*/); +- +- singleButton = new QButtonGroup(); +- singleButton->addButton(ui->sunradioBtn); +- singleButton->addButton(ui->customradioBtn); +- +- singleButton->setId(ui->sunradioBtn, SUN); +- singleButton->setId(ui->customradioBtn, CUSTOM); +- +- MODE value = ui->customradioBtn->isChecked() == SUN ? SUN : CUSTOM; +- showNightWidget(mNightButton->isChecked()); +- if (mNightButton->isChecked()) { +- showCustomWiget(value); +- } +- +- QDBusInterface brightnessInterface("org.freedesktop.UPower", +- "/org/freedesktop/UPower/devices/DisplayDevice", +- "org.freedesktop.DBus.Properties", +- QDBusConnection::systemBus()); +- if (!brightnessInterface.isValid()) { +- qDebug() << "Create UPower Interface Failed : " << QDBusConnection::systemBus().lastError(); +- return; +- } +- +- QDBusReply<QVariant> briginfo; +- briginfo = brightnessInterface.call("Get", "org.freedesktop.UPower.Device", "PowerSupply"); +- mIsBattery = briginfo.value().toBool(); +- +- mUPowerInterface = QSharedPointer<QDBusInterface>( +- new QDBusInterface("org.freedesktop.UPower", +- "/org/freedesktop/UPower", +- "org.freedesktop.DBus.Properties", +- QDBusConnection::systemBus())); +- +- if (!mUPowerInterface.get()->isValid()) { +- qDebug() << "Create UPower Battery Interface Failed : " << +- QDBusConnection::systemBus().lastError(); +- return; +- } +- +- QDBusReply<QVariant> batteryInfo; +- batteryInfo = mUPowerInterface.get()->call("Get", "org.freedesktop.UPower", "OnBattery"); +- if (batteryInfo.isValid()) { +- mOnBattery = batteryInfo.value().toBool(); +- } +- +- mUPowerInterface.get()->connection().connect("org.freedesktop.UPower", +- "/org/freedesktop/UPower", +- "org.freedesktop.DBus.Properties", +- "PropertiesChanged", +- this, +- SLOT(propertiesChangedSlot(QString,QMap<QString, QVariant>, +- QStringList))); +- mUkccInterface = QSharedPointer<QDBusInterface>( +- new QDBusInterface("org.ukui.ukcc.session", +- "/", +- "org.ukui.ukcc.session.interface", +- QDBusConnection::sessionBus())); +-} +- +-void Widget::initNightStatus() +-{ +- QDBusInterface colorIft("org.ukui.KWin", +- "/ColorCorrect", +- "org.ukui.kwin.ColorCorrect", +- QDBusConnection::sessionBus()); +- if (colorIft.isValid() && UkccCommon::isExistEffect() && !mIsWayland) { +- this->mRedshiftIsValid = true; +- } else { +- qWarning() << "create org.ukui.kwin.ColorCorrect failed"; +- return; +- } +- +- QDBusMessage result = colorIft.call("nightColorInfo"); +- +- QList<QVariant> outArgs = result.arguments(); +- QVariant first = outArgs.at(0); +- QDBusArgument dbvFirst = first.value<QDBusArgument>(); +- QVariant vFirst = dbvFirst.asVariant(); +- const QDBusArgument &dbusArgs = vFirst.value<QDBusArgument>(); +- +- QVector<ColorInfo> nightColor; +- +- dbusArgs.beginArray(); +- while (!dbusArgs.atEnd()) { +- ColorInfo color; +- dbusArgs >> color; +- nightColor.push_back(color); +- } +- dbusArgs.endArray(); +- +- for (ColorInfo it : nightColor) { +- mNightConfig.insert(it.arg, it.out.variant()); +- } +- +- this->mIsNightMode = mNightConfig["Active"].toBool(); +- ui->temptSlider->setValue(mNightConfig["CurrentColorTemperature"].toInt()); +- if (0 == mNightConfig["Mode"].toInt()) { +- ui->sunradioBtn->setChecked(true); +- } else if (2 == mNightConfig["Mode"].toInt()) { +- ui->customradioBtn->setChecked(true); +- QString openTime = mNightConfig["EveningBeginFixed"].toString(); +- QString ophour = openTime.split(":").at(0); +- QString opmin = openTime.split(":").at(1); +- +- ui->opHourCom->setCurrentIndex(ophour.toInt()); +- ui->opMinCom->setCurrentIndex(opmin.toInt()); +- +- QString cltime = mNightConfig["MorningBeginFixed"].toString(); +- QString clhour = cltime.split(":").at(0); +- QString clmin = cltime.split(":").at(1); +- +- ui->clHourCom->setCurrentIndex(clhour.toInt()); +- ui->clMinCom->setCurrentIndex(clmin.toInt()); +- } +-} +- +-void Widget::nightChangedSlot(QHash<QString, QVariant> nightArg) +-{ +- if (this->mRedshiftIsValid) { +- mNightButton->setChecked(nightArg["Active"].toBool()); +- } +-} +- +- +-/* 总结: 亮度条怎么显示和实际的屏幕状态有关,与按钮选择状态关系不大: +- * 实际为镜像模式,就显示所有屏幕的亮度(笔记本外显除外,笔记本外显任何情况均隐藏,这里未涉及)。 +- * 实际为扩展模式,就显示当前选中的屏幕亮度,如果当前选中复制模式,则亮度条隐藏不显示,应用之后再显示所有亮度条; +- * 实际为单屏模式,即另一个屏幕关闭,则显示打开屏幕的亮度,关闭的显示器不显示亮度 +- * +- *ps: by feng chao +-*/ +- +-void Widget::showBrightnessFrame(const int flag) +-{ +- QTimer::singleShot(0, this, [=]{ +- int *pFlag = new int(flag); +- QObject::connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, +- [&, pFlag](KScreen::ConfigOperation *op) { +- bool allShowFlag = true; +- +- KScreen::ConfigPtr config = this->currentConfig(); +- +- KScreen::OutputPtr output = config->primaryOutput(); +- if (mConfig->connectedOutputs().count() >= 2 && !output.isNull()) { +- foreach (KScreen::OutputPtr secOutput, config->connectedOutputs()) { +- if (secOutput->geometry() != output->geometry() || !secOutput->isEnabled()) { +- allShowFlag = false; +- } +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { //检查其它显示屏是否实际打开,否则关闭,适用于显示器插拔 +- if (BrightnessFrameV[i]->outputName == Utils::outputName(secOutput)){ +- if (!secOutput->isEnabled()) +- BrightnessFrameV[i]->openFlag = false; +- else +- BrightnessFrameV[i]->openFlag = true; +- } +- } +- } +- } else { //只有一个屏幕,把它亮度条打开,防止remove出问题 +- allShowFlag = false; +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { +- if (BrightnessFrameV[i]->outputName == Utils::outputName(output)) { +- BrightnessFrameV[i]->openFlag = true; +- } +- } +- } +- +- ui->unifyBrightFrame->setFixedHeight(0); +- if (*pFlag == 0 && allShowFlag == false && mUnifyButton->isChecked()) { //选中了镜像模式,实际是扩展模式 +- +- } else if ((allShowFlag == true && *pFlag == 0) || *pFlag == 1) { //镜像模式/即将成为镜像模式 +- ui->unifyBrightFrame->setFixedHeight(BrightnessFrameV.size() * (50 + 2 + 2)); +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { +- BrightnessFrameV[i]->openFlag = true; +- BrightnessFrameV[i]->setTextLableName(tr("Brightness") + QString("(") + BrightnessFrameV[i]->outputName + QString(")")); +- BrightnessFrameV[i]->setVisible(true); +- } +- } else { +- for (int i = 0; i < BrightnessFrameV.size(); ++i) { +- if (ui->primaryCombo->currentText() == BrightnessFrameV[i]->outputName && BrightnessFrameV[i]->openFlag) { +- ui->unifyBrightFrame->setFixedHeight(52); +- BrightnessFrameV[i]->setTextLableName(tr("Brightness")); +- BrightnessFrameV[i]->setVisible(true); +- //不能break,要把其他的frame隐藏 +- } else { +- BrightnessFrameV[i]->setVisible(false); +- } +- } +- } +- if (ui->unifyBrightFrame->height() > 0) { +- ui->unifyBrightFrame->setVisible(true); +- } else { +- ui->unifyBrightFrame->setVisible(false); +- } +- delete pFlag; +- }); +- }); +-} +- +-void Widget::changescale() +-{ +- mScaleSizeRes = QSize(); +- for (const KScreen::OutputPtr &output : mConfig->outputs()) { +- if (output->isEnabled()) { +- if (output->currentMode()) { +- if (mScaleSizeRes == QSize()) { +- mScaleSizeRes = output->currentMode()->size(); +- } else { +- mScaleSizeRes = mScaleSizeRes.width() < output->currentMode()->size().width()?mScaleSizeRes:output->currentMode()->size(); +- } +- } else { +- return; +- } +- +- } +- } +- if (mScaleSizeRes != QSize(0,0)) { +- QSize scalesize = mScaleSizeRes; +- ui->scaleCombo->blockSignals(true); +- ui->scaleCombo->clear(); +- ui->scaleCombo->addItem("100%", 1.0); +- +- if (scalesize.width() > 1024 ) { +- ui->scaleCombo->addItem("125%", 1.25); +- } +- if (scalesize.width() == 1920 ) { +- ui->scaleCombo->addItem("150%", 1.5); +- } +- if (scalesize.width() > 1920) { +- ui->scaleCombo->addItem("150%", 1.5); +- ui->scaleCombo->addItem("175%", 1.75); +- } +- if (scalesize.width() >= 2160) { +- ui->scaleCombo->addItem("200%", 2.0); +- } +- if (scalesize.width() > 2560) { +- ui->scaleCombo->addItem("225%", 2.25); +- } +- if (scalesize.width() > 3072) { +- ui->scaleCombo->addItem("250%", 2.5); +- } +- if (scalesize.width() > 3840) { +- ui->scaleCombo->addItem("275%", 2.75); +- } +- +- double scale; +- QStringList keys = scaleGSettings->keys(); +- if (keys.contains("scalingFactor")) { +- scale = scaleGSettings->get(SCALE_KEY).toDouble(); +- } +- if (ui->scaleCombo->findData(scale) == -1) { +- //记录分辨率切换时,新分辨率不存在的缩放率,在用户点击恢复设置时写入 +- mIsSCaleRes = true; +- //记录是否因分辨率导致的缩放率变化 +- mIsChange = true; +- scaleres = scale; +- scale = 1.0; +- } +- ui->scaleCombo->setCurrentText(QString::number(scale * 100) + "%"); +- scaleChangedSlot(scale); +- ui->scaleCombo->blockSignals(false); +- mScaleSizeRes = QSize(); +- +- } +-} +- +-void Widget::getAllI2Cbus() +-{ +- I2CbusMap.clear(); +- QMap<QString, QString> msg; +- QString cmd = "find /sys/class/drm/card0-*/*/ -name '*i2c-[0-9]*'"; +- QProcess process; +- process.start("bash", QStringList() <<"-c"<<cmd); +- process.waitForFinished(); +- QString strResult = process.readAllStandardOutput(); +- QStringList resultList = strResult.split("\n"); //所有结果 +- +- qDebug()<<"read i2c process result = "<<resultList; +- for (int i = 0; i < resultList.size(); i++) { +- QStringList i2cList = resultList.at(i).split("/"); //切割每一行结果 +- if (i2cList.size() >= 5) { +- if (!msg.keys().contains(i2cList.at(4))) { +- //当不存在时就添加 +- msg.insert(i2cList.at(4), resultList.at(i)); +- } else { +- //已经存在,但是内容更少时也重新替换,drm中文件是嵌套的,可能存在包含关系,故做此处理 +- if (msg[i2cList.at(4)].size() > resultList.at(i).size()) { +- msg[i2cList.at(4)] = resultList.at(i); +- } +- } +- } +- } +- QMap<QString, QString>::const_iterator it; +- for (it = msg.constBegin(); it != msg.constEnd(); ++it) { +- qDebug()<<" ----------MAP-MSG--------- "<<it.key()<<" "<<it.value(); +- //显示器名只取中间的(HDMI\VGA...),因为后面的内容kscreen和内核提供的不一定一致 +- //因此当有多个HDMI接口时此方式并不适用 +- QString name = it.key().split("-").at(1); +- QStringList i2cList = it.value().split("/"); +- QString i2cStr = i2cList.at(i2cList.size() - 1); +- if (!i2cStr.contains("i2c-",Qt::CaseInsensitive)) { +- i2cStr = i2cList.at(i2cList.size() - 2); +- } +- +- QString busNum = i2cStr.split("-").at(1); +- if (QString::number(busNum.toInt()) == busNum) { +- if (I2CbusMap.keys().contains(name)) { +- qDebug()<<"Unable to get the correct bus number from the kernel ... "<<name; +- I2CbusMap.clear(); //如果出现了一样的,表明有重复的接口,舍弃使用内核提供的bus号 +- return; +- } +- qDebug()<<" i2c-name = "<<name<<" *** "<<"i2c-bus="<<busNum; +- I2CbusMap.insert(name, busNum); +- } +- } +- return; +-} +diff --git a/plugins/system/display_hw/widget.h b/plugins/system/display_hw/widget.h +deleted file mode 100644 +index 77aad33..0000000 +--- a/plugins/system/display_hw/widget.h ++++ /dev/null +@@ -1,260 +0,0 @@ +-#ifndef WIDGET_H +-#define WIDGET_H +- +-#include <QMutex> +-#include <QWidget> +-#include <QVariantMap> +-#include <QGSettings> +-#include <QSettings> +-#include <QButtonGroup> +-#include <QDBusInterface> +-#include <QDBusConnection> +-#include <QDBusError> +-#include <QDBusReply> +-#include <QStringList> +-#include <QSharedPointer> +-#include <QHash> +-#include <QVariant> +-#include <QScreen> +-#include <QMultiMap> +-#include <QShortcut> +-#include <QFuture> +- +-#include <KF5/KScreen/kscreen/config.h> +-#include <unistd.h> +- +-#include "outputconfig.h" +-#include "brightnessFrame.h" +-#include "screenConfig.h" +-#include "scalesize.h" +-#include "kswitchbutton.h" +-using namespace kdk; +- +-class QLabel; +-class QMLOutput; +-class QMLScreen; +-class ControlPanel; +-class PrimaryOutputCombo; +- +-class QPushButton; +-class QComboBox; +- +-class QQuickView; +-class QQuickWidget; +-class QStyledItemDelegate; +- +-typedef enum { +- SUN, +- CUSTOM, +-}MODE; +- +-namespace KScreen { +-class ConfigOperation; +-} +- +-namespace Ui { +-class DisplayWindow; +-} +- +-class Widget : public QWidget +-{ +- Q_OBJECT +- +-public: +- explicit Widget(QWidget *parent = nullptr); +- ~Widget() override; +- +- void setConfig(const KScreen::ConfigPtr &config, bool showBrightnessFrameFlag = false); +- KScreen::ConfigPtr currentConfig() const; +- +- void initConnection(); +- QString getScreenName(QString name = ""); +- void initTemptSlider(); +- +- bool writeFile(const QString &filePath); +- void writeGlobal(const KScreen::OutputPtr &output); +- bool writeGlobalPart(const KScreen::OutputPtr &output, QVariantMap &info, +- const KScreen::OutputPtr &fallback); +- QString globalFileName(const QString &hash); +- QVariantMap getGlobalData(KScreen::OutputPtr output); +- +- float converToScale(const int value); +- int scaleToSlider(const float value); +- +- void initUiComponent(); +- void addBrightnessFrame(QString name, bool openFlag, const KScreen::OutputPtr &output = nullptr, QString i2cBus = ""); +- void showBrightnessFrame(const int flag = 0); +- void getAllI2Cbus(); +- +- void changescale(); +- void setKscreenConfig(const KScreen::ConfigPtr &config); +-protected: +- bool eventFilter(QObject *object, QEvent *event) override; +- +-Q_SIGNALS: +- void changed(); +- +- void nightModeChanged(const bool nightMode) const; +- void redShiftValidChanged(const bool isValid) const; +- +-private Q_SLOTS: +- void slotFocusedOutputChanged(QMLOutput *output); +- +- void slotOutputEnabledChanged(); +- void slotOutputConnectedChanged(); +- void slotQmloutOutChanged(); +- +- void slotUnifyOutputs(); +- +- void slotIdentifyButtonClicked(bool checked = true); +- void slotIdentifyOutputs(KScreen::ConfigOperation *op); +- void clearOutputIdentifiers(); +- +- void outputAdded(const KScreen::OutputPtr &output); +- void outputRemoved(int outputId); +- void primaryOutputSelected(int index); +- void primaryOutputChanged(const KScreen::OutputPtr &output); +- +- void showNightWidget(bool judge); +- void showCustomWiget(int index); +- +- void slotThemeChanged(bool judge); +- +- void primaryButtonEnable(bool); // 按钮选择主屏确认按钮 +- void mainScreenButtonSelect(int index); // 是否禁用设置主屏按钮 +- void checkOutputScreen(bool judge); // 是否禁用屏幕 +- +- void setNightMode(const bool nightMode); // 设置夜间模式 +- +- void initNightStatus(); // 初始化夜间模式 +- void nightChangedSlot(QHash<QString, QVariant> nightArg); +- +- void isWayland(); +- +- void kdsScreenchangeSlot(QString status); +- void delayApply(); +- +- void enableChangedSlot(); // 是否禁用小屏幕拖动 +- +-public Q_SLOTS: +- void save(); +- void scaleChangedSlot(double scale); +- void changedSlot(); +- void propertiesChangedSlot(QString, QMap<QString, QVariant>, QStringList); +- +-private: +- void loadQml(); +- void resetPrimaryCombo(); +- void addOutputToPrimaryCombo(const KScreen::OutputPtr &output); +- KScreen::OutputPtr findOutput(const KScreen::ConfigPtr &config, const QVariantMap &info); +- +- void setHideModuleInfo(); +- void setTitleLabel(); +- void writeScale(double scale); +- void initGSettings(); +- void initNightUI(); +- +- bool isRestoreConfig(); // 是否恢复应用之前的配置 +- bool isCloneMode(); +- bool isBacklight(); +- bool isLaptopScreen(); +- bool isVisibleBrightness(); +- +- QString getCpuInfo(); +- QString getMonitorType(); +- +- int getDDCBrighthess(); +- int getDDCBrighthess(QString name); +- int getDDCBrighthess(QString edidHash, QString i2cBus); +- int getLaptopBrightness() const; +- +- void setDDCBrightnessN(int value, QString screenName); +- void setDDCBrightnessN(int value, QString edidHash, QString i2cBus); +- void setScreenKDS(QString kdsConfig); +- void setActiveScreen(QString status = ""); +- +- QList<ScreenConfig> getPreScreenCfg(); +- void setPreScreenCfg(KScreen::OutputList screens); +- +- void setScreenIsApply(bool isApply); +- +- int screenEnableCount(); +- +- void setExtendPrimaryScreen(); +- +- void showZoomtips(); +- +-private: +- Ui::DisplayWindow *ui; +- QMLScreen *mScreen = nullptr; +- +- KScreen::ConfigPtr mConfig = nullptr; +- KScreen::ConfigPtr mPrevConfig = nullptr; +- KScreen::ConfigPtr mPreScreenConfig = nullptr; +- +- ControlPanel *mControlPanel = nullptr; +- +- OutputConfig *mOutputConfig = nullptr; // 设置主显示器相关控件 +- +- QList<QQuickView *> mOutputIdentifiers; +- QTimer *mOutputTimer = nullptr; +- +- QMutex mLock; +- +- QString mCPU; +- QString mDir; +- QStringList mPowerKeys; +- QString mKDSCfg; +- QString mPreKDSCfg; +- +- KSwitchButton *mNightButton = nullptr; +- KSwitchButton *mCloseScreenButton = nullptr; +- KSwitchButton *mUnifyButton = nullptr; +- KSwitchButton *mThemeButton = nullptr; +- +- QLabel *nightLabel = nullptr; +- +- QGSettings *mGsettings = nullptr; +- QGSettings *scaleGSettings = nullptr; +- QGSettings *mPowerGSettings = nullptr; +- +- QSettings *mQsettings = nullptr; +- +- QButtonGroup *singleButton; +- +- QSharedPointer<QDBusInterface> mUPowerInterface; +- QSharedPointer<QDBusInterface> mUkccInterface; +- +- QHash<QString, QVariant> mNightConfig; +- +- double scaleres = 1.0; +- +- bool mIsNightMode = false; +- bool mRedshiftIsValid = false; +- bool mIsScaleChanged = false; +- bool mConfigChanged = false; +- bool mOnBattery = false; +- bool mIsUnifyChanged = false; +- bool mFirstLoad = true; +- bool mIsWayland = false; +- bool mIsBattery = false; +- bool mIsOutputAdd = false; +- bool mIsScreenAdd = false; +- bool mIsSCaleRes = false; +- bool mIsChange = false; +- +- QSize mScaleSizeRes = QSize(); +- +- bool threadRunExit = false; +- QFuture<void> threadRun; +- +- QShortcut *mApplyShortcut; +- QVector<BrightnessFrame*> BrightnessFrameV; +- QVector<QString> deleteFrameNameV; //用二级指针判断null出现问题,只想到这种方式排除段错误 +- BrightnessFrame *currentBrightnessFrame; +- bool exitFlag = false; +- QMap<QString, QString> I2CbusMap; +- +-}; +- +-#endif // WIDGET_H +diff --git a/plugins/system/notice/notice.h b/plugins/system/notice/notice.h +index 10e0db7..d3e48c4 100644 +--- a/plugins/system/notice/notice.h ++++ b/plugins/system/notice/notice.h +@@ -31,7 +31,6 @@ + #include <QComboBox> + + #include <shell/interface.h> +-#include "titlelabel.h" + #include "lightlabel.h" + #include "kswitchbutton.h" + #include "switchwidget.h" +diff --git a/plugins/system/notice/noticeui.h b/plugins/system/notice/noticeui.h +index 1d80044..bd460e9 100644 +--- a/plugins/system/notice/noticeui.h ++++ b/plugins/system/notice/noticeui.h +@@ -6,7 +6,6 @@ + #include <QComboBox> + + #include <shell/interface.h> +-#include "titlelabel.h" + #include "lightlabel.h" + #include "kswitchbutton.h" + #include "switchwidget.h" +diff --git a/plugins/system/power/power.h b/plugins/system/power/power.h +index 19baca7..20dc70b 100644 +--- a/plugins/system/power/power.h ++++ b/plugins/system/power/power.h +@@ -30,9 +30,7 @@ + #include <QButtonGroup> + + #include "shell/interface.h" +-#include "widgets/Label/titlelabel.h" + #include "widgets/ComboxFrame/comboxframe.h" +-#include "widgets/Label/fixlabel.h" + #include <kysdk/kysdk-system/libkysysinfo.h> + #include "kswitchbutton.h" + using namespace kdk; +diff --git a/plugins/time-language/area/area.pro b/plugins/time-language/area/area.pro +index 5d3e1b5..680f604 100644 +--- a/plugins/time-language/area/area.pro ++++ b/plugins/time-language/area/area.pro +@@ -6,7 +6,6 @@ + include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/AddBtn/addbtn.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/HoverWidget/hoverwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Frame/frame.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) +diff --git a/plugins/time-language/area/area.ui b/plugins/time-language/area/area.ui +deleted file mode 100644 +index 55e5dca..0000000 +--- a/plugins/time-language/area/area.ui ++++ /dev/null +@@ -1,184 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>Area</class> +- <widget class="QWidget" name="Area"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>700</width> +- <height>551</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Area</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>Language Format</string> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="formatLayout"/> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_11"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>32</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="title3Label"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>System Language</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_10"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <widget class="LightLabel" name="summaryLabel"> +- <property name="minimumSize"> +- <size> +- <width>550</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>960</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>TextLabel</string> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>1</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="languageLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="addLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- </layout> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>0</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- <layoutdefault spacing="6" margin="11"/> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- <customwidget> +- <class>LightLabel</class> +- <extends>QLabel</extends> +- <header>lightlabel.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/time-language/area/areaui.cpp b/plugins/time-language/area/areaui.cpp +index 72cb73c..c767fea 100644 +--- a/plugins/time-language/area/areaui.cpp ++++ b/plugins/time-language/area/areaui.cpp +@@ -32,7 +32,8 @@ void AreaUi::initUi() + + void AreaUi::initLanguageFormat() + { +- formatTitleLabel = new TitleLabel(this); ++ formatTitleLabel = new KLabel(this); ++ formatTitleLabel->setContentsMargins(16, 0, 0, 0); + formatGroup = new SettingGroup(this); + //~ contents_path /Area/Regional Format + countryWidget = new ComboxWidget(tr("Regional Format"), formatGroup, UkccFrame::BorderRadiusStyle::Top); +@@ -71,10 +72,11 @@ void AreaUi::initLanguageFormat() + QHBoxLayout* formatDateLayout = new QHBoxLayout(); + formatDateLayout->setContentsMargins(16, 0, 16, 0); + //~ contents_path /Area/Language Format Example +- m_formatDateNameLabel = new FixLabel(tr("Language Format Example"), m_formatDateFrame); ++ m_formatDateNameLabel = new KLabel(m_formatDateFrame); ++ m_formatDateNameLabel->setText(tr("Language Format Example")); + m_formatDateNameLabel->setFixedSize(214, 59); + +- m_formatDateValueLabel = new FixLabel(m_formatDateFrame); ++ m_formatDateValueLabel = new KLabel(m_formatDateFrame); + + formatDateLayout->addWidget(m_formatDateNameLabel); + formatDateLayout->setSpacing(16); +@@ -87,7 +89,8 @@ void AreaUi::initLanguageFormat() + + void AreaUi::initSystemLanguage() + { +- languageTitleLable = new TitleLabel(this); ++ languageTitleLable = new KLabel(this); ++ languageTitleLable->setContentsMargins(16, 0, 0, 0); + languageGroup = new SettingGroup(this); + addLanguageBtn = new AddButton(this, UkccFrame::BorderRadiusStyle::Bottom); + addLanguageDialog = new AddLanguageDialog(this); +diff --git a/plugins/time-language/area/areaui.h b/plugins/time-language/area/areaui.h +index 7774dda..bc5a805 100644 +--- a/plugins/time-language/area/areaui.h ++++ b/plugins/time-language/area/areaui.h +@@ -4,14 +4,16 @@ + #include "languageframe.h" + #include "addlanguagedialog.h" + #include "addinputmethoddialog.h" +-#include "libukcc/widgets/Label/titlelabel.h" + #include "addbutton.h" + #include "settinggroup.h" + #include "comboxwidget.h" + #include <QWidget> + #include <QVBoxLayout> + #include "ukcccommon.h" ++#include <klabel.h> ++ + using namespace ukcc; ++using namespace kdk; + + class AreaUi : public QWidget + { +@@ -119,7 +121,7 @@ public: + return m_formatDateFrame; + } + +- inline FixLabel* formatDateValueLabel() { ++ inline KLabel* formatDateValueLabel() { + return m_formatDateValueLabel; + } + +@@ -137,7 +139,7 @@ private: + QVBoxLayout *LanguageLayout = nullptr; + + private: +- TitleLabel *formatTitleLabel = nullptr; ++ KLabel *formatTitleLabel = nullptr; + SettingGroup *formatGroup = nullptr; + ComboxWidget *countryWidget = nullptr; + ComboxWidget *calendarWidget = nullptr; +@@ -147,14 +149,14 @@ private: + ComboxWidget *timeWidget = nullptr; + + private: +- TitleLabel *languageTitleLable = nullptr; ++ KLabel *languageTitleLable = nullptr; + AddButton *addLanguageBtn = nullptr; + SettingGroup *languageGroup = nullptr; + AddLanguageDialog *addLanguageDialog = nullptr; + AddInputMethodDialog *addInputMehtodDialog = nullptr; + UkccFrame* m_formatDateFrame = nullptr; +- FixLabel* m_formatDateNameLabel = nullptr; +- FixLabel* m_formatDateValueLabel = nullptr; ++ KLabel* m_formatDateNameLabel = nullptr; ++ KLabel* m_formatDateValueLabel = nullptr; + + private: + QList<LanguageFrame*> languageFrameList = {}; +diff --git a/plugins/time-language/datetime/changtime.cpp b/plugins/time-language/datetime/changtime.cpp +index 209b0ce..dbcc081 100644 +--- a/plugins/time-language/datetime/changtime.cpp ++++ b/plugins/time-language/datetime/changtime.cpp +@@ -19,7 +19,6 @@ + */ + #include "changtime.h" + #include "ui_changtime.h" +-#include "closebutton.h" + + #include <QDebug> + #include <QStringList> +diff --git a/plugins/time-language/datetime/changtime.ui b/plugins/time-language/datetime/changtime.ui +deleted file mode 100644 +index 24ddd27..0000000 +--- a/plugins/time-language/datetime/changtime.ui ++++ /dev/null +@@ -1,627 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>changtimedialog</class> +- <widget class="QDialog" name="changtimedialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>421</width> +- <height>425</height> +- </rect> +- </property> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>421</width> +- <height>412</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>421</width> +- <height>425</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <property name="midLineWidth"> +- <number>0</number> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>9</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="leftMargin"> +- <number>20</number> +- </property> +- <property name="topMargin"> +- <number>4</number> +- </property> +- <property name="rightMargin"> +- <number>8</number> +- </property> +- <property name="bottomMargin"> +- <number>4</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>190</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>190</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>current date</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>41</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>1</number> +- </property> +- <property name="leftMargin"> +- <number>20</number> +- </property> +- <property name="rightMargin"> +- <number>31</number> +- </property> +- <item> +- <widget class="QFrame" name="timeframe"> +- <property name="minimumSize"> +- <size> +- <width>336</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>336</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="timelabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>50</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>time</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="hourcomboBox"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>83</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>84</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="mincomboBox"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>80</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>84</width> +- <height>32</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="seccomboBox"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>80</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>84</width> +- <height>32</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="yearframe"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>336</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>336</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <item> +- <widget class="QLabel" name="yearlabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>50</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>year</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="yearcomboBox"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>258</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>257</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="monthframe"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>336</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>336</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <item> +- <widget class="QLabel" name="monthlabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>27</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>50</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>month</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="monthcomboBox"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>258</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>258</width> +- <height>16777215</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="dayframe"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>336</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>336</width> +- <height>50</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <item> +- <widget class="QLabel" name="daylabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>50</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>day</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="daycomboBox"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>258</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>258</width> +- <height>16777215</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>17</width> +- <height>14</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QWidget" name="widget" native="true"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>345</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>50</height> +- </size> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="rightMargin"> +- <number>32</number> +- </property> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="cancelButton"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>30</height> +- </size> +- </property> +- <property name="sizeIncrement"> +- <size> +- <width>120</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>cancel</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="confirmButton"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>30</height> +- </size> +- </property> +- <property name="text"> +- <string>confirm</string> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>17</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/time-language/datetime/datetime.pro b/plugins/time-language/datetime/datetime.pro +index 3cb2b3a..0931be9 100644 +--- a/plugins/time-language/datetime/datetime.pro ++++ b/plugins/time-language/datetime/datetime.pro +@@ -13,10 +13,8 @@ CONFIG += plugin \ + + include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/FlowLayout/flowlayout.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/AddBtn/addbtn.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/CloseButton/closebutton.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/HoverWidget/hoverwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Frame/frame.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) +diff --git a/plugins/time-language/datetime/datetime.ui b/plugins/time-language/datetime/datetime.ui +deleted file mode 100644 +index 859b056..0000000 +--- a/plugins/time-language/datetime/datetime.ui ++++ /dev/null +@@ -1,342 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>DateTime</class> +- <widget class="QWidget" name="DateTime"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>684</width> +- <height>669</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>DateTime</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>current date</string> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="currentDateLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>32</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QVBoxLayout" name="timeLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="TilleFrame"> +- <property name="minimumSize"> +- <size> +- <width>552</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <property name="lineWidth"> +- <number>1</number> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel_2"> +- <property name="text"> +- <string>titleLabel</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>4</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="UkccFrame" name="frame_7"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <property name="lineWidth"> +- <number>0</number> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_11"> +- <property name="spacing"> +- <number>1</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="SettingGroup" name="showFrame"> +- <property name="minimumSize"> +- <size> +- <width>552</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <property name="lineWidth"> +- <number>0</number> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="UkccFrame" name="addFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Plain</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="addLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QFrame" name="hourFrame"> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Expanding</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>0</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- <layoutdefault spacing="6" margin="11"/> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- <customwidget> +- <class>UkccFrame</class> +- <extends>QFrame</extends> +- <header location="global">ukccframe.h</header> +- <container>1</container> +- </customwidget> +- <customwidget> +- <class>SettingGroup</class> +- <extends>QFrame</extends> +- <header location="global">settinggroup.h</header> +- <container>1</container> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/time-language/datetime/datetimeui.cpp b/plugins/time-language/datetime/datetimeui.cpp +index 6a86da9..14d7811 100644 +--- a/plugins/time-language/datetime/datetimeui.cpp ++++ b/plugins/time-language/datetime/datetimeui.cpp +@@ -37,29 +37,31 @@ void DatetimeUi::initUi() + void DatetimeUi::initObject() + { + // 当前时间 +- currentTitleLabel = new TitleLabel(this); // 标题 ++ currentTitleLabel = new KLabel(this); // 标题 ++ currentTitleLabel->setContentsMargins(16, 0, 0, 0); + clockWidget = new ClockWidget(); // 时钟 + timeLabel = new TimeLabel(this); // 时间 +- mDateLabel = new FixLabel(this); // 日期 +- changeTZbutton = new FixButton(this); // 修改时区 +- setTimeModeLabel = new FixLabel(this); // 设置时间 ++ mDateLabel = new KLabel(this); // 日期 ++ changeTZbutton = new KPushButton(this); // 修改时区 ++ setTimeModeLabel = new KLabel(this); // 设置时间 + manualRadioButton = new QRadioButton(this); // 手动设置时间 + syncRadioButton = new QRadioButton(this); // 自动同步时间 +- syncResultLabel = new FixLabel(); // 同步时间结果 +- setDateLabel = new FixLabel(this); // 手动设置日期 ++ syncResultLabel = new KLabel(); // 同步时间结果 ++ setDateLabel = new KLabel(this); // 手动设置日期 + dategroupWidget = new DategroupWidget(this); + timeBtnGroup = new QButtonGroup(this); + //~ contents_path /Date/Sync Server + ntpSerWidget = new ComboxWidget(tr("Sync Server"), this); +- setNtpLabel = new FixLabel(this); ++ setNtpLabel = new KLabel(this); + setNtpLineEdit = new QLineEdit(this); +- setNtpButton = new FixButton(this); ++ setNtpButton = new KPushButton(this); + + timeBtnGroup->addButton(manualRadioButton, 0); + timeBtnGroup->addButton(syncRadioButton, 1); + syncResultLabel->setStyleSheet("QLabel{color: #D9F82929;}"); + +- otherTimezoneTitleLabel = new TitleLabel(this); ++ otherTimezoneTitleLabel = new KLabel(this); ++ otherTimezoneTitleLabel->setContentsMargins(16, 0, 0, 0); + addTimezoneButton = new AddButton(this, UkccFrame::BorderRadiusStyle::Around); + } + +@@ -214,7 +216,7 @@ void DatetimeUi::initSignals() + Q_EMIT timeModeChanged(toggledBtn, "automatic"); + } + }); +- connect(changeTZbutton, &FixButton::clicked, this, &DatetimeUi::timezoneButtonClicked); ++ connect(changeTZbutton, &KPushButton::clicked, this, &DatetimeUi::timezoneButtonClicked); + connect(ntpSerWidget->comboBox(), QOverload<const QString&>::of(&QComboBox::activated), this, [=](QString server){ + if (ntpSerWidget->comboBox()->currentIndex() == 0) { + server = "default"; +@@ -225,7 +227,7 @@ void DatetimeUi::initSignals() + Q_EMIT ntpServerChanged(server); + } + }); +- connect(setNtpButton, &FixButton::clicked, this, [=](){ ++ connect(setNtpButton, &KPushButton::clicked, this, [=](){ + Q_EMIT ntpServerChanged(setNtpLineEdit->text()); + }); + connect(addTimezoneButton, &AddButton::clicked, this, &DatetimeUi::addTimezoneButtonClicked); +diff --git a/plugins/time-language/datetime/datetimeui.h b/plugins/time-language/datetime/datetimeui.h +index c232da7..13141d4 100644 +--- a/plugins/time-language/datetime/datetimeui.h ++++ b/plugins/time-language/datetime/datetimeui.h +@@ -1,17 +1,14 @@ + #ifndef DATETIMEUI_H + #define DATETIMEUI_H + +-#include "titlelabel.h" + #include "timeBtn.h" + #include "timelabel.h" + #include "clockwidget.h" + #include "calendarwidget.h" + #include "dategroupwidget.h" + #include "dateedit.h" +-#include "fixlabel.h" + #include "settinggroup.h" + #include "ukccframe.h" +-#include "fixbutton.h" + #include "addbutton.h" + #include "comboxwidget.h" + #include <QWidget> +@@ -19,6 +16,10 @@ + #include <QLineEdit> + #include <QRadioButton> + #include <QButtonGroup> ++#include <kpushbutton.h> ++#include <klabel.h> ++ ++using namespace kdk; + + class DatetimeUi : public QWidget + { +@@ -54,23 +55,23 @@ private: + + private: + // 当前时间 +- TitleLabel *currentTitleLabel = nullptr; ++ KLabel *currentTitleLabel = nullptr; + ClockWidget *clockWidget = nullptr; + TimeLabel *timeLabel = nullptr; +- FixLabel *mDateLabel = nullptr; +- FixButton *changeTZbutton = nullptr; +- FixLabel *setTimeModeLabel = nullptr; ++ KLabel *mDateLabel = nullptr; ++ KPushButton *changeTZbutton = nullptr; ++ KLabel *setTimeModeLabel = nullptr; + QRadioButton *manualRadioButton = nullptr; + QRadioButton *syncRadioButton = nullptr; +- FixLabel *syncResultLabel = nullptr; +- FixLabel *setDateLabel = nullptr; ++ KLabel *syncResultLabel = nullptr; ++ KLabel *setDateLabel = nullptr; + DategroupWidget *dategroupWidget = nullptr; + ComboxWidget *ntpSerWidget = nullptr; +- FixLabel *setNtpLabel = nullptr; ++ KLabel *setNtpLabel = nullptr; + QLineEdit *setNtpLineEdit = nullptr; +- FixButton *setNtpButton = nullptr; ++ KPushButton *setNtpButton = nullptr; + // 其他时区时间 +- TitleLabel *otherTimezoneTitleLabel = nullptr; ++ KLabel *otherTimezoneTitleLabel = nullptr; + AddButton *addTimezoneButton = nullptr; + + private: +diff --git a/plugins/time-language/datetime/timeBtn.cpp b/plugins/time-language/datetime/timeBtn.cpp +index cdba347..2314751 100644 +--- a/plugins/time-language/datetime/timeBtn.cpp ++++ b/plugins/time-language/datetime/timeBtn.cpp +@@ -13,7 +13,7 @@ TimeBtn::TimeBtn(const QString &timezone, const QString &kyTimezone) + QHBoxLayout *timeShowLayout = new QHBoxLayout(this); + QWidget *timeWid = new QWidget(this); + QVBoxLayout *timeLayout = new QVBoxLayout(timeWid); +- labelInfo = new FixLabel(this); //时间,和标题字号一致 ++ labelInfo = new KLabel(this); //时间,和标题字号一致 + labelTime = new LightLabel(this); //日期 + deleteBtn = new QPushButton(this); + +diff --git a/plugins/time-language/datetime/timeBtn.h b/plugins/time-language/datetime/timeBtn.h +index ad4f499..affa3d1 100644 +--- a/plugins/time-language/datetime/timeBtn.h ++++ b/plugins/time-language/datetime/timeBtn.h +@@ -1,13 +1,15 @@ + #ifndef TIMEBTN_H + #define TIMEBTN_H + #include <QPushButton> +-#include "fixlabel.h" + #include "lightlabel.h" + #include <QGSettings> + #include <QTimeZone> + #include <QLabel> + #include "ukccframe.h" + #include <QTimerEvent> ++#include <klabel.h> ++ ++using namespace kdk; + + class TimeBtn : public UkccFrame + { +@@ -25,7 +27,7 @@ protected: + private: + QTimeZone thisZone; + int timerId = 0; +- FixLabel *labelInfo = nullptr; ++ KLabel *labelInfo = nullptr; + LightLabel *labelTime = nullptr; + QDBusInterface *areaInterface = nullptr; + QPushButton *deleteBtn = nullptr; +diff --git a/plugins/time-language/datetime/timelabel.cpp b/plugins/time-language/datetime/timelabel.cpp +index a7f2883..98915f8 100644 +--- a/plugins/time-language/datetime/timelabel.cpp ++++ b/plugins/time-language/datetime/timelabel.cpp +@@ -4,7 +4,7 @@ + #include <QDateTime> + + TimeLabel::TimeLabel(QWidget *parent) : +- FixLabel(parent) ++ KLabel(parent) + { + QFont font = QApplication::font(); + if (QLocale::system().amText() == "སྔ་དྲོ་") { +diff --git a/plugins/time-language/datetime/timelabel.h b/plugins/time-language/datetime/timelabel.h +index 746fe3c..70b4cb1 100644 +--- a/plugins/time-language/datetime/timelabel.h ++++ b/plugins/time-language/datetime/timelabel.h +@@ -1,10 +1,12 @@ + #ifndef TIMELABEL_H + #define TIMELABEL_H + +-#include "fixlabel.h" + #include <QDBusInterface> ++#include <klabel.h> + +-class TimeLabel : public FixLabel ++using namespace kdk; ++ ++class TimeLabel : public KLabel + { + Q_OBJECT + +diff --git a/plugins/time-language/datetime/worldMap/timezonechooser.cpp b/plugins/time-language/datetime/worldMap/timezonechooser.cpp +index 32c212b..b95da08 100644 +--- a/plugins/time-language/datetime/worldMap/timezonechooser.cpp ++++ b/plugins/time-language/datetime/worldMap/timezonechooser.cpp +@@ -15,7 +15,6 @@ + #include <QtCore/qmath.h> + #include <QDialog> + #include <QGSettings> +-#include "imageutil.h" + + const QString kcnBj = "北京"; + const QString kenBj = "Asia/Beijing"; diff -Nru ukui-control-center-4.10.0.0/debian/patches/0126-152-sdk.patch ukui-control-center-4.10.0.0/debian/patches/0126-152-sdk.patch --- ukui-control-center-4.10.0.0/debian/patches/0126-152-sdk.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0126-152-sdk.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,197 @@ +From: =?utf-8?b?6IuP5Zej5YW4?= <susidian@kylinos.cn> +Date: Wed, 22 Jan 2025 01:25:21 +0000 +Subject: =?utf-8?b?ITE1MiDpgILphY1zZGsgTWVyZ2UgcHVsbCByZXF1ZXN0ICExNTIgZnJv?= + =?utf-8?b?bSDkvZXmgJ3og5wvbmlsZQ==?= + +--- + plugins/account/userinfo/creategroupdialog.cpp | 9 +++++---- + plugins/account/userinfo/creategroupdialog.h | 9 +++++---- + plugins/account/userinfo/deleteuserexists.cpp | 6 ++++-- + plugins/account/userinfo/deleteuserexists.h | 7 ++++--- + plugins/account/userinfo/userinfo.cpp | 1 - + plugins/account/userinfo/userinfo.pro | 2 -- + plugins/devices/keyboard/keyboard.pro | 1 - + shell/mainwindow.cpp | 1 - + shell/shell.pro | 1 - + 9 files changed, 18 insertions(+), 19 deletions(-) + +diff --git a/plugins/account/userinfo/creategroupdialog.cpp b/plugins/account/userinfo/creategroupdialog.cpp +index 6586c57..5c5728e 100644 +--- a/plugins/account/userinfo/creategroupdialog.cpp ++++ b/plugins/account/userinfo/creategroupdialog.cpp +@@ -20,7 +20,6 @@ + + #include "creategroupdialog.h" + #include "userinfo.h" +-#include "closebutton.h" + #include "changeusergroup.h" + + #define GROUPNAME_LENGTH 32 +@@ -51,7 +50,8 @@ void CreateGroupDialog::initUI() + this->setFixedSize(480, 214); + setAttribute(Qt::WA_DeleteOnClose); + +- mGroupNameLabel = new FixLabel(tr("Name"), this); ++ mGroupNameLabel = new KLabel(this); ++ mGroupNameLabel->setText(tr("Name")); + mGroupNameLabel->setFixedSize(62, 36); + mGroupNameEdit = new QLineEdit(this); + mGroupNameEdit->installEventFilter(this); +@@ -63,7 +63,7 @@ void CreateGroupDialog::initUI() + mGroupNameHLayout->addWidget(mGroupNameLabel); + mGroupNameHLayout->addWidget(mGroupNameEdit); + +- mGroupNameTipLabel = new FixLabel(); ++ mGroupNameTipLabel = new KLabel(this); + mGroupNameTipLabel->setFixedWidth(370); + QFont ft; + ft.setPixelSize(14); +@@ -75,7 +75,8 @@ void CreateGroupDialog::initUI() + mGroupNameTipHLayout->addStretch(); + mGroupNameTipHLayout->addWidget(mGroupNameTipLabel); + +- mGroupIdLabel = new FixLabel(tr("Id"), this); ++ mGroupIdLabel = new KLabel(this); ++ mGroupIdLabel->setText(tr("Id")); + mGroupIdLabel->setFixedSize(62, 36); + mGroupIdEdit = new QLineEdit(this); + mGroupIdEdit->setFixedSize(370, 36); +diff --git a/plugins/account/userinfo/creategroupdialog.h b/plugins/account/userinfo/creategroupdialog.h +index 0c0e6b8..90cbda8 100644 +--- a/plugins/account/userinfo/creategroupdialog.h ++++ b/plugins/account/userinfo/creategroupdialog.h +@@ -34,7 +34,8 @@ + #include <QLabel> + #include <QPushButton> + +-#include "widgets/Label/fixlabel.h" ++#include <kysdk/applications/klabel.h> ++using namespace kdk; + + class changeUserGroup; + namespace Ui { +@@ -64,8 +65,8 @@ private: + QFrame *mGroupIdFrame; + QFrame *mConfirmFrame; + +- QLabel *mGroupNameLabel; +- QLabel *mGroupIdLabel; ++ KLabel *mGroupNameLabel; ++ KLabel *mGroupIdLabel; + + QLineEdit *mGroupNameEdit; + QLineEdit *mGroupIdEdit; +@@ -82,7 +83,7 @@ private: + bool _idHasModified; + + QString oldGroupName; +- FixLabel *mGroupNameTipLabel; ++ KLabel *mGroupNameTipLabel; + QString mGroupNameTip; + + void initUI(); +diff --git a/plugins/account/userinfo/deleteuserexists.cpp b/plugins/account/userinfo/deleteuserexists.cpp +index a425bce..732090a 100644 +--- a/plugins/account/userinfo/deleteuserexists.cpp ++++ b/plugins/account/userinfo/deleteuserexists.cpp +@@ -62,8 +62,10 @@ void DeleteUserExists::initUI() + removeBtnGroup->addButton(removeWholeRadioBtn, 1); + removeWholeRadioBtn->setChecked(true); + +- removeButKeepFilesLabel = new FixLabel(tr("Keep desktop, files, favorites, music of the user")); +- removeWholeLabel = new FixLabel(tr("Delete whole data belong user")); ++ removeButKeepFilesLabel = new KLabel(this); ++ removeButKeepFilesLabel->setText(tr("Keep desktop, files, favorites, music of the user")); ++ removeWholeLabel = new KLabel(this); ++ removeWholeLabel->setText(tr("Delete whole data belong user")); + + removeButKeepFilesHorLayout = new QHBoxLayout; + removeButKeepFilesHorLayout->setSpacing(9); +diff --git a/plugins/account/userinfo/deleteuserexists.h b/plugins/account/userinfo/deleteuserexists.h +index aeeb37e..bfde175 100644 +--- a/plugins/account/userinfo/deleteuserexists.h ++++ b/plugins/account/userinfo/deleteuserexists.h +@@ -2,7 +2,8 @@ + #define DELETEUSEREXISTS_H + + #include <QDialog> +-#include "fixlabel.h" ++#include <kysdk/applications/klabel.h> ++using namespace kdk; + + class QHBoxLayout; + class QVBoxLayout; +@@ -40,8 +41,8 @@ public: + QRadioButton * removeWholeRadioBtn; + + QLabel *noteLabel; +- FixLabel *removeButKeepFilesLabel; +- FixLabel *removeWholeLabel; ++ KLabel *removeButKeepFilesLabel; ++ KLabel *removeWholeLabel; + + QPushButton * cancelBtn; + QPushButton * confirmBtn; +diff --git a/plugins/account/userinfo/userinfo.cpp b/plugins/account/userinfo/userinfo.cpp +index 10ff4c3..c939fa9 100644 +--- a/plugins/account/userinfo/userinfo.cpp ++++ b/plugins/account/userinfo/userinfo.cpp +@@ -49,7 +49,6 @@ + + #include "ukcccommon.h" + using namespace ukcc; +-#include "imageutil.h" + + /* qt会将glib里的signals成员识别为宏,所以取消该宏 + * 后面如果用到signals时,使用Q_SIGNALS代替即可 +diff --git a/plugins/account/userinfo/userinfo.pro b/plugins/account/userinfo/userinfo.pro +index 5ead1f4..1b1939f 100644 +--- a/plugins/account/userinfo/userinfo.pro ++++ b/plugins/account/userinfo/userinfo.pro +@@ -5,10 +5,8 @@ + #------------------------------------------------- + include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/FlowLayout/flowlayout.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/AddBtn/addbtn.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/CloseButton/closebutton.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) + +diff --git a/plugins/devices/keyboard/keyboard.pro b/plugins/devices/keyboard/keyboard.pro +index aaaf50e..77015a8 100644 +--- a/plugins/devices/keyboard/keyboard.pro ++++ b/plugins/devices/keyboard/keyboard.pro +@@ -6,7 +6,6 @@ + + include(../../../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/CloseButton/closebutton.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/SettingWidget/settingwidget.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) + +diff --git a/shell/mainwindow.cpp b/shell/mainwindow.cpp +index aeebab3..469a417 100644 +--- a/shell/mainwindow.cpp ++++ b/shell/mainwindow.cpp +@@ -21,7 +21,6 @@ + #include "ui_mainwindow.h" + #include "interface/ukcccommon.h" + using namespace ukcc; +-#include "imageutil.h" + #include "ukccabout.h" + + #include <QLabel> +diff --git a/shell/shell.pro b/shell/shell.pro +index 3ec42ad..fa1880d 100644 +--- a/shell/shell.pro ++++ b/shell/shell.pro +@@ -19,7 +19,6 @@ DEFINES += QT_DEPRECATED_WARNINGS + include(../env.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/Label/label.pri) + include($$PROJECT_ROOTDIR/libukcc/widgets/FlowLayout/flowlayout.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) + include($$PROJECT_ROOTDIR/libukcc/interface.pri) + + DEFINES += PLUGIN_INSTALL_DIRS='\\"$${PLUGIN_INSTALL_DIRS}\\"' diff -Nru ukui-control-center-4.10.0.0/debian/patches/0127-154-fix-ukui-control-center-update-agreement.patch ukui-control-center-4.10.0.0/debian/patches/0127-154-fix-ukui-control-center-update-agreement.patch --- ukui-control-center-4.10.0.0/debian/patches/0127-154-fix-ukui-control-center-update-agreement.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0127-154-fix-ukui-control-center-update-agreement.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,23 @@ +From: nil <zhoubin@kylinos.cn> +Date: Fri, 7 Feb 2025 07:31:59 +0000 +Subject: =?utf-8?q?!154_fix=28ukui-control-center=29=3A_update_agreement_Me?= + =?utf-8?q?rge_pull_request_!154_from_=E8=8B=8F=E5=97=A3=E5=85=B8/nile-0122?= + +--- + plugins/system/about/res/Ukcc-Agreement-zh_CN.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/plugins/system/about/res/Ukcc-Agreement-zh_CN.txt b/plugins/system/about/res/Ukcc-Agreement-zh_CN.txt +index c710b44..b388699 100644 +--- a/plugins/system/about/res/Ukcc-Agreement-zh_CN.txt ++++ b/plugins/system/about/res/Ukcc-Agreement-zh_CN.txt +@@ -104,7 +104,8 @@ + 5)本产品的生物特征管理工具支持系统组件使用生物特征进行认证,包括指纹、指静脉、虹膜、声纹等。您录入的生物特征信息将储存在本地计算机,这部分信息我们仅接收验证结果,不会收集和上传。如您不需要使用生物特征进行系统认证,可以在生物特征管理工具中关闭该功能。 + 6)本产品提供录音功能,您在使用本产品录音软件中,我们仅会将您使用录音时的音频内容存储在本地计算机中,不会进行收集和上传。 + 7)本产品的服务与支持功能会收集由您提供给我们的日志、电子邮箱、电话、姓名等信息,便于提供技术服务,我们将妥善保管您的个人信息。 +- 8)本产品升级过程中,如需新增收集您的个人信息,我们将及时更新本部分内容。 ++ 8)为了确保您的账户安全和提供个性化的服务,本产品可能会收集您用于登录计算机系统的用户名和密码信息。这些信息将经过加密处理,并仅用于身份验证和账户管理目的。我们承诺不会以明文形式存储或传输您的密码,并采取严格的安全措施保护您的个人信息。 ++ 9)本产品升级过程中,如需新增收集您的个人信息,我们将及时更新本部分内容。 + 2.使用个人信息的情况 + 我们严格遵守法律法规的规定及与您的约定,将收集的信息用于以下用途。若我们超出以下用途,我们将再次向您进行说明,并征得您的同意。 + 1)涉及产品许可机制、软件商店使用、系统更新维护、生物识别、在线服务等需要; diff -Nru ukui-control-center-4.10.0.0/debian/patches/0128-155-fix-font.patch ukui-control-center-4.10.0.0/debian/patches/0128-155-fix-font.patch --- ukui-control-center-4.10.0.0/debian/patches/0128-155-fix-font.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0128-155-fix-font.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,91 @@ +From: =?utf-8?b?6IuP5Zej5YW4?= <susidian@kylinos.cn> +Date: Fri, 7 Feb 2025 08:47:59 +0000 +Subject: !155 fix: font Merge pull request !155 from nil/nile-25-0205 + +--- + data/org.ukui.control-center.gschema.xml | 2 +- + shell/searchwidget.cpp | 16 +--------------- + shell/searchwidget.h | 2 -- + 3 files changed, 2 insertions(+), 18 deletions(-) + +diff --git a/data/org.ukui.control-center.gschema.xml b/data/org.ukui.control-center.gschema.xml +index 6bbcb0b..275b25a 100644 +--- a/data/org.ukui.control-center.gschema.xml ++++ b/data/org.ukui.control-center.gschema.xml +@@ -1,7 +1,7 @@ + <schemalist gettext-domain="ukui-control-center"> + <schema id="org.ukui.control-center" path="/org/ukui/control-center/"> + <key name="fonts-list" type="as"> +- <default>['CESI仿宋-GB13000','CESI_FS_GB13000', 'CESI仿宋-GB18030','CESI_FS_GB18030', 'CESI仿宋-GB2312','CESI_FS_GB2312', 'CESI宋体-GB13000','CESI_SS_GB13000', 'CESI宋体-GB18030','CESI_SS_GB18030', 'CESI宋体-GB2312','CESI_SS_GB2312', 'CESI小标宋-GB13000','CESI_XBS_GB13000', 'CESI小标宋-GB18030','CESI_XBS_GB18030', 'CESI小标宋-GB2312','CESI_XBS_GB2312', 'CESI楷体-GB13000','CESI_KT_GB13000', 'CESI楷体-GB18030','CESI_KT_GB18030', 'CESI楷体-GB2312','CESI_KT_GB2312', 'CESI黑体-GB13000','CESI_HT_GB13000', 'CESI黑体-GB18030','CESI_HT_GB18030', 'CESI黑体-GB2312','CESI_HT_GB2312', '仿宋', '黑体', '楷体', '宋体', '华文彩云','STCaiyun', '华文仿宋','STFangsong', '华文琥珀','STHupo', '华文楷体','STKaiti', '华文隶书','STLiti', '华文宋体','STSong', '华文细黑','STXihei', '华文行楷','STXingkai', '华文新魏','STXinwei', 'Noto Sans CJK SC', 'Noto Sans CJK SC Black', 'Noto Sans Mono CJK SC', 'Noto Sans CJK SC DemiLight', 'Noto Sans CJK SC Light', 'Noto Sans CJK SC Medium', 'Noto Sans CJK SC', 'Noto Sans CJK SC Thin','Dotted Songti Square','WenQuanYi Bitmap Song','国标仿宋', '国标宋体-超大字符集', '国标仿宋-GB/T 2312', '国标黑体', '国标黑体-GB/T 2312', '国标楷体', '国标楷体-GB/T 2312', '国标宋体', '国标宋体-GB/T 2312', '国标小标宋', '国标小标宋-GB/T 2312']</default> ++ <default>['CESI仿宋-GB13000','CESI_FS_GB13000', 'CESI仿宋-GB18030','CESI_FS_GB18030', 'CESI仿宋-GB2312','CESI_FS_GB2312', 'CESI宋体-GB13000','CESI_SS_GB13000', 'CESI宋体-GB18030','CESI_SS_GB18030', 'CESI宋体-GB2312','CESI_SS_GB2312', 'CESI小标宋-GB13000','CESI_XBS_GB13000', 'CESI小标宋-GB18030','CESI_XBS_GB18030', 'CESI小标宋-GB2312','CESI_XBS_GB2312', 'CESI楷体-GB13000','CESI_KT_GB13000', 'CESI楷体-GB18030','CESI_KT_GB18030', 'CESI楷体-GB2312','CESI_KT_GB2312', 'CESI黑体-GB13000','CESI_HT_GB13000', 'CESI黑体-GB18030','CESI_HT_GB18030', 'CESI黑体-GB2312','CESI_HT_GB2312', '仿宋', '黑体', '楷体', '宋体', '华文仿宋','STFangsong', '华文楷体','STKaiti', '华文隶书','STLiti', '华文宋体','STSong', '华文细黑','STXihei', '华文行楷','STXingkai', '华文新魏','STXinwei', 'Noto Sans CJK SC', 'Noto Sans CJK SC Black', 'Noto Sans Mono CJK SC', 'Noto Sans CJK SC DemiLight', 'Noto Sans CJK SC Light', 'Noto Sans CJK SC Medium', 'Noto Sans CJK SC', 'Noto Sans CJK SC Thin','Dotted Songti Square','WenQuanYi Bitmap Song','国标仿宋','GB_FS_GB18030', '国标宋体-超大字符集','GB_SS_GB18030_ExtendedK', '国标仿宋-GB/T 2312','GB_FS_GBT2312', '国标黑体','GB_HT_GB18030', '国标黑体-GB/T 2312','GB_HT_GBT2312', '国标楷体', 'GB_KT_GB18030','国标楷体-GB/T 2312', 'GB_KT_GBT2312','国标宋体', 'GB_SS_GB18030','国标宋体-GB/T 2312','GB_SS_GBT2312', '国标小标宋','GB_XBS_GB18030','国标小标宋-GB/T 2312','GB_XBS_GBT2312']</default> + <summary>Control panel default font list</summary> + <description>Control panel default font list</description> + </key> +diff --git a/shell/searchwidget.cpp b/shell/searchwidget.cpp +index 06a7b2a..3be58d6 100644 +--- a/shell/searchwidget.cpp ++++ b/shell/searchwidget.cpp +@@ -438,18 +438,6 @@ void SearchWidget::addShortcutSearch() { + clearSearchData(); + } + +-void SearchWidget::removeRepeatItems() +-{ +- for (int index = 0 ; index < m_model->rowCount() ; index++) { +- QString text = m_model->item(index)->text(); +- if (m_repeatlist.contains(text)) { +- m_model->removeRow(index); +- index--; +- } +- m_repeatlist.append(text); +- } +-} +- + void SearchWidget::appendShortcutSearch() { + typedef QList<QStringPair> QStringPairList; + QDBusReply<QStringPairList> systemEntryReply = m_shortcutInterface->call("getSystemShortcut"); +@@ -611,7 +599,7 @@ void SearchWidget::appendChineseData(SearchWidget::SearchBoxStruct data) { + + for (auto datas : m_TxtList) { + for (int i = 0; i < datas.count(); i++) { +- if( data.translateContent == datas){ ++ if (data.translateContent == datas){ + return; + } + } +@@ -736,7 +724,6 @@ void SearchWidget::setLanguage(QString type) { + loadxml(); + //记录搜索项总数 + count = m_model->rowCount(); +- removeRepeatItems(); + } + + //save all modules moduleInteface name and actual moduleName +@@ -751,7 +738,6 @@ void SearchWidget::addModulesName(QString moduleName, QString searchName, QStrin + if (!translation.isEmpty()) { + m_xmlFilePath.insert(translation); + } +- + } + + void SearchWidget::onCompleterActivated(QString value) { +diff --git a/shell/searchwidget.h b/shell/searchwidget.h +index 734665c..8752ab0 100644 +--- a/shell/searchwidget.h ++++ b/shell/searchwidget.h +@@ -76,7 +76,6 @@ private: + SearchBoxStruct *data = nullptr); + void appendShortcutSearch(); + void addShortcutSearch(); +- void removeRepeatItems(); + + private: + QStandardItemModel *m_model; +@@ -96,7 +95,6 @@ private: + QList<QString> m_TxtList; + + QStringList mExcludeList; +- QStringList m_repeatlist; + int count; + QVariantMap searchMap; + bool m_shortcutInterfaceValid = true; diff -Nru ukui-control-center-4.10.0.0/debian/patches/0129-fix-sonar-security.patch ukui-control-center-4.10.0.0/debian/patches/0129-fix-sonar-security.patch --- ukui-control-center-4.10.0.0/debian/patches/0129-fix-sonar-security.patch 1970-01-01 08:00:00.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/0129-fix-sonar-security.patch 2025-02-07 16:32:50.000000000 +0800 @@ -0,0 +1,25390 @@ +From: hesisheng <hesisheng@kylinos.cn> +Date: Thu, 13 Feb 2025 11:11:06 +0800 +Subject: fix(sonar): security +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Description: solve security + +Log: 【sonar问题整改 控制面板】 +Task: https://pm.kylin.com/task-view-428183.html +--- + changeOtherUserPwd/changeOtherUserPwd.pro | 7 +- + changeOtherUserPwd/main.cpp | 61 +- + changeOtherUserPwd/run-passwd2.cpp | 712 ---------- + changeOtherUserPwd/run-passwd2.h | 35 - + changeUserPwd/changeUserPwd.pro | 7 +- + changeUserPwd/main.cpp | 84 +- + changeUserPwd/run-passwd.cpp | 808 ------------ + changeUserPwd/run-passwd.h | 34 - + checkUserPwdWithPAM/checkUserPwd/auth-pam.cpp | 6 +- + checkUserPwdWithPAM/childCheckPwdWithPAM/main.cpp | 8 +- + plugins/account/userinfo/kylin-chkname.cpp | 6 +- + plugins/account/userinfo_intel/auth-pam.cpp | 337 ----- + plugins/account/userinfo_intel/auth-pam.h | 59 - + plugins/account/userinfo_intel/auth.h | 62 - + .../userinfo_intel/changefaceinteldialog.cpp | 471 ------- + .../account/userinfo_intel/changefaceinteldialog.h | 101 -- + .../userinfo_intel/changefaceinteldialog.ui | 531 -------- + .../userinfo_intel/changegroupinteldialog.cpp | 223 ---- + .../userinfo_intel/changegroupinteldialog.h | 74 -- + .../userinfo_intel/changegroupinteldialog.ui | 237 ---- + plugins/account/userinfo_intel/changepasswd.cpp | 126 -- + plugins/account/userinfo_intel/changepasswd.h | 50 - + .../userinfo_intel/changephoneinteldialog.cpp | 485 ------- + .../userinfo_intel/changephoneinteldialog.h | 80 -- + .../userinfo_intel/changephoneinteldialog.ui | 600 --------- + .../userinfo_intel/changepininteldialog.cpp | 125 -- + .../account/userinfo_intel/changepininteldialog.h | 57 - + .../account/userinfo_intel/changepininteldialog.ui | 105 -- + plugins/account/userinfo_intel/changepwd.qrc | 5 - + .../userinfo_intel/changepwdinteldialog.cpp | 582 --------- + .../account/userinfo_intel/changepwdinteldialog.h | 110 -- + .../account/userinfo_intel/changepwdinteldialog.ui | 661 ---------- + .../userinfo_intel/changetypeinteldialog.cpp | 168 --- + .../account/userinfo_intel/changetypeinteldialog.h | 62 - + .../userinfo_intel/changetypeinteldialog.ui | 672 ---------- + .../userinfo_intel/changevalidinteldialog.cpp | 306 ----- + .../userinfo_intel/changevalidinteldialog.h | 72 -- + .../userinfo_intel/changevalidinteldialog.ui | 520 -------- + .../userinfo_intel/creategroupinteldialog.cpp | 168 --- + .../userinfo_intel/creategroupinteldialog.h | 59 - + .../userinfo_intel/creategroupinteldialog.ui | 380 ------ + .../userinfo_intel/createuserinteldialog.cpp | 567 -------- + .../account/userinfo_intel/createuserinteldialog.h | 109 -- + .../userinfo_intel/createuserinteldialog.ui | 778 ----------- + .../userinfo_intel/definegroupitemintel.cpp | 139 -- + .../account/userinfo_intel/definegroupitemintel.h | 74 -- + .../account/userinfo_intel/delgroupinteldialog.cpp | 41 - + .../account/userinfo_intel/delgroupinteldialog.h | 47 - + .../account/userinfo_intel/delgroupinteldialog.ui | 154 --- + .../account/userinfo_intel/deluserinteldialog.cpp | 156 --- + .../account/userinfo_intel/deluserinteldialog.h | 66 - + .../account/userinfo_intel/deluserinteldialog.ui | 259 ---- + .../userinfo_intel/digitalauthinteldialog.cpp | 421 ------ + .../userinfo_intel/digitalauthinteldialog.h | 98 -- + .../userinfo_intel/digitalphoneinteldialog.cpp | 268 ---- + .../userinfo_intel/digitalphoneinteldialog.h | 95 -- + .../account/userinfo_intel/elipsemaskwidget.cpp | 60 - + plugins/account/userinfo_intel/elipsemaskwidget.h | 48 - + .../userinfo_intel/messageboxpowerintel.cpp | 208 --- + .../account/userinfo_intel/messageboxpowerintel.h | 61 - + .../account/userinfo_intel/numbersbuttonintel.cpp | 131 -- + .../account/userinfo_intel/numbersbuttonintel.h | 34 - + plugins/account/userinfo_intel/passwdcheckutil.cpp | 47 - + plugins/account/userinfo_intel/passwdcheckutil.h | 35 - + plugins/account/userinfo_intel/passwordbar.cpp | 118 -- + plugins/account/userinfo_intel/passwordbar.h | 42 - + .../userinfo_intel/phoneauthinteldialog.cpp | 702 ---------- + .../account/userinfo_intel/phoneauthinteldialog.h | 80 -- + .../userinfo_intel/phoneauthinteldialog.qss | 33 - + plugins/account/userinfo_intel/picturetowhite.cpp | 74 -- + plugins/account/userinfo_intel/picturetowhite.h | 52 - + .../userinfo_intel/qtdbus/systemdbusdispatcher.cpp | 68 - + .../userinfo_intel/qtdbus/systemdbusdispatcher.h | 56 - + .../userinfo_intel/qtdbus/userdispatcher.cpp | 116 -- + .../account/userinfo_intel/qtdbus/userdispatcher.h | 70 - + plugins/account/userinfo_intel/res/img.qrc | 3 - + plugins/account/userinfo_intel/userinfo_intel.cpp | 1358 -------------------- + plugins/account/userinfo_intel/userinfo_intel.h | 276 ---- + plugins/account/userinfo_intel/userinfo_intel.pro | 110 -- + plugins/account/userinfo_intel/userinfo_intel.ui | 728 ----------- + plugins/devices/keyboard/kbdlayoutmanager.cpp | 367 ------ + plugins/devices/keyboard/kbdlayoutmanager.h | 82 -- + plugins/devices/keyboard/kbdlayoutmanager.ui | 298 ----- + plugins/devices/keyboard/keyboardcontrol.cpp | 70 - + plugins/devices/keyboard/keyboardcontrol.h | 55 - + plugins/devices/keyboard/keyboardlayout.cpp | 111 -- + plugins/devices/keyboard/keyboardlayout.h | 55 - + plugins/devices/keyboard/layoutmanager.ui | 480 ------- + .../org.ukui.control-center.keybinding.gschema.xml | 19 - + plugins/devices/keyboard/preview/config-keyboard.h | 9 - + .../devices/keyboard/preview/config-workspace.h | 166 --- + plugins/devices/keyboard/preview/debug.cpp | 11 - + plugins/devices/keyboard/preview/debug.h | 11 - + .../keyboard/preview/geometry_components.cpp | 245 ---- + .../devices/keyboard/preview/geometry_components.h | 362 ------ + .../devices/keyboard/preview/geometry_parser.cpp | 593 --------- + plugins/devices/keyboard/preview/geometry_parser.h | 161 --- + .../devices/keyboard/preview/kbpreviewframe.cpp | 374 ------ + plugins/devices/keyboard/preview/kbpreviewframe.h | 95 -- + plugins/devices/keyboard/preview/keyaliases.cpp | 128 -- + plugins/devices/keyboard/preview/keyaliases.h | 36 - + .../devices/keyboard/preview/keyboard_config.cpp | 208 --- + plugins/devices/keyboard/preview/keyboard_config.h | 91 -- + .../devices/keyboard/preview/keyboardlayout.cpp | 133 -- + plugins/devices/keyboard/preview/keyboardlayout.h | 115 -- + .../devices/keyboard/preview/keyboardpainter.cpp | 103 -- + plugins/devices/keyboard/preview/keyboardpainter.h | 51 - + plugins/devices/keyboard/preview/keysym2ucs.cpp | 901 ------------- + plugins/devices/keyboard/preview/keysym2ucs.h | 27 - + plugins/devices/keyboard/preview/keysymhelper.cpp | 84 -- + plugins/devices/keyboard/preview/keysymhelper.h | 41 - + plugins/devices/keyboard/preview/symbol_parser.cpp | 288 ----- + plugins/devices/keyboard/preview/symbol_parser.h | 93 -- + plugins/devices/keyboard/preview/x11_helper.cpp | 453 ------- + plugins/devices/keyboard/preview/x11_helper.h | 260 ---- + plugins/devices/keyboard/preview/xkb_rules.cpp | 497 ------- + plugins/devices/keyboard/preview/xkb_rules.h | 142 -- + plugins/devices/keyboard/tastenbrett.cpp | 63 - + plugins/devices/keyboard/tastenbrett.h | 32 - + 119 files changed, 21 insertions(+), 24327 deletions(-) + delete mode 100644 changeOtherUserPwd/run-passwd2.cpp + delete mode 100644 changeOtherUserPwd/run-passwd2.h + delete mode 100644 changeUserPwd/run-passwd.cpp + delete mode 100644 changeUserPwd/run-passwd.h + delete mode 100644 plugins/account/userinfo_intel/auth-pam.cpp + delete mode 100644 plugins/account/userinfo_intel/auth-pam.h + delete mode 100644 plugins/account/userinfo_intel/auth.h + delete mode 100644 plugins/account/userinfo_intel/changefaceinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/changefaceinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/changefaceinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/changegroupinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/changegroupinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/changegroupinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/changepasswd.cpp + delete mode 100644 plugins/account/userinfo_intel/changepasswd.h + delete mode 100644 plugins/account/userinfo_intel/changephoneinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/changephoneinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/changephoneinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/changepininteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/changepininteldialog.h + delete mode 100644 plugins/account/userinfo_intel/changepininteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/changepwd.qrc + delete mode 100644 plugins/account/userinfo_intel/changepwdinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/changepwdinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/changepwdinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/changetypeinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/changetypeinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/changetypeinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/changevalidinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/changevalidinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/changevalidinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/creategroupinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/creategroupinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/creategroupinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/createuserinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/createuserinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/createuserinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/definegroupitemintel.cpp + delete mode 100644 plugins/account/userinfo_intel/definegroupitemintel.h + delete mode 100644 plugins/account/userinfo_intel/delgroupinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/delgroupinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/delgroupinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/deluserinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/deluserinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/deluserinteldialog.ui + delete mode 100644 plugins/account/userinfo_intel/digitalauthinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/digitalauthinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/digitalphoneinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/digitalphoneinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/elipsemaskwidget.cpp + delete mode 100644 plugins/account/userinfo_intel/elipsemaskwidget.h + delete mode 100644 plugins/account/userinfo_intel/messageboxpowerintel.cpp + delete mode 100644 plugins/account/userinfo_intel/messageboxpowerintel.h + delete mode 100644 plugins/account/userinfo_intel/numbersbuttonintel.cpp + delete mode 100644 plugins/account/userinfo_intel/numbersbuttonintel.h + delete mode 100644 plugins/account/userinfo_intel/passwdcheckutil.cpp + delete mode 100644 plugins/account/userinfo_intel/passwdcheckutil.h + delete mode 100644 plugins/account/userinfo_intel/passwordbar.cpp + delete mode 100644 plugins/account/userinfo_intel/passwordbar.h + delete mode 100644 plugins/account/userinfo_intel/phoneauthinteldialog.cpp + delete mode 100644 plugins/account/userinfo_intel/phoneauthinteldialog.h + delete mode 100644 plugins/account/userinfo_intel/phoneauthinteldialog.qss + delete mode 100644 plugins/account/userinfo_intel/picturetowhite.cpp + delete mode 100644 plugins/account/userinfo_intel/picturetowhite.h + delete mode 100644 plugins/account/userinfo_intel/qtdbus/systemdbusdispatcher.cpp + delete mode 100644 plugins/account/userinfo_intel/qtdbus/systemdbusdispatcher.h + delete mode 100644 plugins/account/userinfo_intel/qtdbus/userdispatcher.cpp + delete mode 100644 plugins/account/userinfo_intel/qtdbus/userdispatcher.h + delete mode 100644 plugins/account/userinfo_intel/res/img.qrc + delete mode 100644 plugins/account/userinfo_intel/userinfo_intel.cpp + delete mode 100644 plugins/account/userinfo_intel/userinfo_intel.h + delete mode 100644 plugins/account/userinfo_intel/userinfo_intel.pro + delete mode 100644 plugins/account/userinfo_intel/userinfo_intel.ui + delete mode 100644 plugins/devices/keyboard/kbdlayoutmanager.cpp + delete mode 100644 plugins/devices/keyboard/kbdlayoutmanager.h + delete mode 100644 plugins/devices/keyboard/kbdlayoutmanager.ui + delete mode 100644 plugins/devices/keyboard/keyboardcontrol.cpp + delete mode 100644 plugins/devices/keyboard/keyboardcontrol.h + delete mode 100644 plugins/devices/keyboard/keyboardlayout.cpp + delete mode 100644 plugins/devices/keyboard/keyboardlayout.h + delete mode 100644 plugins/devices/keyboard/layoutmanager.ui + delete mode 100644 plugins/devices/keyboard/org.ukui.control-center.keybinding.gschema.xml + delete mode 100644 plugins/devices/keyboard/preview/config-keyboard.h + delete mode 100644 plugins/devices/keyboard/preview/config-workspace.h + delete mode 100644 plugins/devices/keyboard/preview/debug.cpp + delete mode 100644 plugins/devices/keyboard/preview/debug.h + delete mode 100644 plugins/devices/keyboard/preview/geometry_components.cpp + delete mode 100644 plugins/devices/keyboard/preview/geometry_components.h + delete mode 100644 plugins/devices/keyboard/preview/geometry_parser.cpp + delete mode 100644 plugins/devices/keyboard/preview/geometry_parser.h + delete mode 100644 plugins/devices/keyboard/preview/kbpreviewframe.cpp + delete mode 100644 plugins/devices/keyboard/preview/kbpreviewframe.h + delete mode 100644 plugins/devices/keyboard/preview/keyaliases.cpp + delete mode 100644 plugins/devices/keyboard/preview/keyaliases.h + delete mode 100644 plugins/devices/keyboard/preview/keyboard_config.cpp + delete mode 100644 plugins/devices/keyboard/preview/keyboard_config.h + delete mode 100644 plugins/devices/keyboard/preview/keyboardlayout.cpp + delete mode 100644 plugins/devices/keyboard/preview/keyboardlayout.h + delete mode 100644 plugins/devices/keyboard/preview/keyboardpainter.cpp + delete mode 100644 plugins/devices/keyboard/preview/keyboardpainter.h + delete mode 100644 plugins/devices/keyboard/preview/keysym2ucs.cpp + delete mode 100644 plugins/devices/keyboard/preview/keysym2ucs.h + delete mode 100644 plugins/devices/keyboard/preview/keysymhelper.cpp + delete mode 100644 plugins/devices/keyboard/preview/keysymhelper.h + delete mode 100644 plugins/devices/keyboard/preview/symbol_parser.cpp + delete mode 100644 plugins/devices/keyboard/preview/symbol_parser.h + delete mode 100644 plugins/devices/keyboard/preview/x11_helper.cpp + delete mode 100644 plugins/devices/keyboard/preview/x11_helper.h + delete mode 100644 plugins/devices/keyboard/preview/xkb_rules.cpp + delete mode 100644 plugins/devices/keyboard/preview/xkb_rules.h + delete mode 100644 plugins/devices/keyboard/tastenbrett.cpp + delete mode 100644 plugins/devices/keyboard/tastenbrett.h + +diff --git a/changeOtherUserPwd/changeOtherUserPwd.pro b/changeOtherUserPwd/changeOtherUserPwd.pro +index f0e3f54..da33e59 100644 +--- a/changeOtherUserPwd/changeOtherUserPwd.pro ++++ b/changeOtherUserPwd/changeOtherUserPwd.pro +@@ -32,9 +32,4 @@ INSTALLS += \ + target \ + + +-SOURCES += \ +- main.cpp \ +- run-passwd2.cpp +- +-HEADERS += \ +- run-passwd2.h ++SOURCES += main.cpp +diff --git a/changeOtherUserPwd/main.cpp b/changeOtherUserPwd/main.cpp +index 869d82a..24c23ec 100644 +--- a/changeOtherUserPwd/main.cpp ++++ b/changeOtherUserPwd/main.cpp +@@ -1,4 +1,5 @@ + /*change otheruser password on pam*/ ++#include <QCoreApplication> + #include <stdio.h> + #include <security/pam_appl.h> + #include <security/pam_misc.h> +@@ -83,7 +84,7 @@ static int ni_conv (int num_msg, const struct pam_message **msg, struct pam_resp + failed_conversation: + for (count=0; count < num_msg; count++) { + if (NULL != responses[count].resp) { +- memset (responses[count].resp, 0, strlen (responses[count].resp)); ++ memset (responses[count].resp, 0, strnlen(responses[count].resp, sizeof(responses[count].resp)); + free (responses[count].resp); + responses[count].resp = NULL; + } +@@ -142,61 +143,3 @@ int main(int argc, char *argv[]) + } + + /*end pam*/ +- +-#include <QCoreApplication> +- +-#include <glib.h> +-#include "run-passwd2.h" +- +-PasswdHandler *passwd_handler = NULL; +- +-static void auth_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data); +-static void chpasswd_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data); +- +-//int main(int argc, char *argv[]) +-//{ +- +-// if (argc != 3) +-// { +-// return -1; +-// } +- +-// QCoreApplication a(argc, argv); +- +-// passwd_handler = passwd_init(); +- +-// passwd_change_password(passwd_handler, argv[1], argv[2], chpasswd_cb, NULL); +- +-// return a.exec(); +-//} +- +-static void +-auth_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data) +-{ +- +-} +- +-/** +- * @brief chpasswd_cb +- * @param passwd_handler +- * @param error +- * @param user_data +- */ +-static void +-chpasswd_cb (PasswdHandler *passwd_handler, +- GError *error, +- gpointer user_data) +-{ +- +- +- if (!error) { +- +- qApp->exit(0); +- } else { +- +- passwd_destroy (passwd_handler); +- +- qApp->exit(1); +- } +- +-} +diff --git a/changeOtherUserPwd/run-passwd2.cpp b/changeOtherUserPwd/run-passwd2.cpp +deleted file mode 100644 +index 29c1901..0000000 +--- a/changeOtherUserPwd/run-passwd2.cpp ++++ /dev/null +@@ -1,712 +0,0 @@ +- +- +-/* qt会将glib里的signals成员识别为宏,所以取消该宏 +- * 后面如果用到signals时,使用Q_SIGNALS代替即可 +- **/ +-#ifdef signals +-#undef signals +-#endif +- +-#include <glib.h> +-#include <gio/gio.h> +- +-#include <unistd.h> +-#include <string.h> +-#include <errno.h> +-#include <sys/wait.h> +- +-#include "run-passwd2.h" +- +-/* Buffer size for backend output */ +-#define BUFSIZE 64 +- +-/* Passwd states */ +-//后端passwd的状态,NONE应该是passwd还没有启动,ERROR表示报错但还没退出 +-typedef enum { +- PASSWD_STATE_NONE, /* Passwd is not asking for anything */ +- PASSWD_STATE_AUTH, /* Passwd is asking for our current password */ +- PASSWD_STATE_NEW, /* Passwd is asking for our new password */ +- PASSWD_STATE_RETYPE, /* Passwd is asking for our retyped new password */ +- PASSWD_STATE_ERR /* Passwd reported an error but has not yet exited */ +-} PasswdState; +- +-struct PasswdHandler { +-// GtkBuilder *ui; +- +- const char *current_password; +- const char *new_password; +- const char *retyped_password; +- +- /* Communication with the passwd program */ +- GPid backend_pid; +- +- GIOChannel *backend_stdin; +- GIOChannel *backend_stdout; +- +- GQueue *backend_stdin_queue; /* Write queue to backend_stdin */ +- +- /* GMainLoop IDs */ +- guint backend_child_watch_id; /* g_child_watch_add (PID) */ +- guint backend_stdout_watch_id; /* g_io_add_watch (stdout) */ +- +- /* State of the passwd program */ +- PasswdState backend_state; +- gboolean changing_password; +- +- PasswdCallback auth_cb; +- gpointer auth_cb_data; +- +- PasswdCallback chpasswd_cb; +- gpointer chpasswd_cb_data; +-}; +- +-//GQuark是一个guint32 +-static GQuark +-passwd_error_quark (void) +-{ +- static GQuark q = 0; +- +- //返回错误的标识码 +- if (q == 0) { +- q = g_quark_from_static_string("passwd_error"); +- } +- +- return q; +-} +- +-/* Error handling */ +-#define PASSWD_ERROR (passwd_error_quark ()) +- +-static void stop_passwd (PasswdHandler *passwd_handler); +- +-static void free_passwd_resources (PasswdHandler *passwd_handler); +- +-static gboolean io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *passwd_handler); +- +- +-static void free_passwd_resources (PasswdHandler *passwd_handler) +-{ +- GError *error = NULL; +- +- /* Remove the child watcher */ +- if (passwd_handler->backend_child_watch_id != 0) { +- +- g_source_remove (passwd_handler->backend_child_watch_id); +- +- passwd_handler->backend_child_watch_id = 0; +- } +- +- +- /* Close IO channels (internal file descriptors are automatically closed) */ +- if (passwd_handler->backend_stdin != NULL) { +- +- if (g_io_channel_shutdown (passwd_handler->backend_stdin, TRUE, &error) != G_IO_STATUS_NORMAL) { +- g_warning ("Could not shutdown backend_stdin IO channel: %s", error->message); +- g_error_free (error); +- error = NULL; +- } +- +- g_io_channel_unref (passwd_handler->backend_stdin); +- passwd_handler->backend_stdin = NULL; +- } +- +- if (passwd_handler->backend_stdout != NULL) { +- +- if (g_io_channel_shutdown (passwd_handler->backend_stdout, TRUE, &error) != G_IO_STATUS_NORMAL) { +- g_warning ("Could not shutdown backend_stdout IO channel: %s", error->message); +- g_error_free (error); +- error = NULL; +- } +- +- g_io_channel_unref (passwd_handler->backend_stdout); +- +- passwd_handler->backend_stdout = NULL; +- } +- +- /* Remove IO watcher */ +- if (passwd_handler->backend_stdout_watch_id != 0) { +- +- g_source_remove (passwd_handler->backend_stdout_watch_id); +- +- passwd_handler->backend_stdout_watch_id = 0; +- } +- +- /* Close PID */ +- //因为flag为G_SPAWN_DO_NOT_REAP_CHILD,所以child不会自动的被reap掉,需要在子进程上free +- if (passwd_handler->backend_pid != -1) { +- +- g_spawn_close_pid (passwd_handler->backend_pid); +- +- passwd_handler->backend_pid = -1; +- } +- +- /* Clear backend state */ +- passwd_handler->backend_state = PASSWD_STATE_NONE; +-} +- +-static void authenticate (PasswdHandler *passwd_handler) +-{ +- gchar *s; +- +- s = g_strdup_printf ("%s\n", passwd_handler->current_password); +- g_queue_push_tail (passwd_handler->backend_stdin_queue, s); +-} +- +-static void io_queue_pop (GQueue *queue, GIOChannel *channel) +-{ +- gchar *buf; +- gsize bytes_written; +- GError *error = NULL; +- +- buf = (gchar *)g_queue_pop_head (queue); +- +- if (buf != NULL) { +- //将队列中的首元素写入到channel中 +- if (g_io_channel_write_chars (channel, buf, -1, &bytes_written, &error) != G_IO_STATUS_NORMAL) { +- g_warning ("Could not write queue element \"%s\" to channel: %s", buf, error->message); +- g_error_free (error); +- } +- +- /* Ensure passwords are cleared from memory */ +- //清除内存中的passwords +- memset (buf, 0, strlen (buf)); +- g_free (buf); +- } +- +-} +- +-static gboolean is_string_complete (gchar *str, ...) +-{ +- va_list ap; +- gchar *arg; +- +- if (strlen (str) == 0) { +- return FALSE; +- } +- +- va_start (ap, str); +- +- while ((arg = va_arg (ap, char *)) != NULL) { +- if (g_strrstr (str, arg) != NULL) { +- va_end (ap); +- return TRUE; +- } +- } +- +- va_end (ap); +- +- return FALSE; +-} +- +-static gboolean io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *passwd_handler) +-{ +- static GString *str = NULL; /* Persistent buffer */ +- +- gchar buf[BUFSIZE]; /* Temporary buffer */ +- gsize bytes_read; +- GError *gio_error = NULL; /* Error returned by functions */ +- GError *error = NULL; /* Error sent to callbacks */ +- +- //GtkBuilder *dialog; +- +- gboolean reinit = FALSE; +- +- /* Initialize buffer */ +- if (str == NULL) { +- str = g_string_new (""); +- } +- +- //dialog = passwd_handler->ui; +- //buf将保存从channel中读取到的数据,bytes_read表示从buf中读取的数据长度 +- if (g_io_channel_read_chars (source, buf, BUFSIZE, &bytes_read, &gio_error) +- != G_IO_STATUS_NORMAL) { +- g_warning ("IO Channel read error: %s", gio_error->message); +- g_error_free (gio_error); +- +- return TRUE; +- } +- +- // g_warning("----------bytes_read=%d",bytes_read); +- // g_warning("----------io_watch_buf=%s-------",buf); +- +- str = g_string_append_len (str, buf, bytes_read); +- +- /* In which state is the backend? */ +- switch (passwd_handler->backend_state) { +- case PASSWD_STATE_AUTH: +- /* Passwd is asking for our current password */ +- +- if (is_string_complete (str->str, "assword: ", "failure", "wrong", "error", NULL)) { +- +- if (g_strrstr (str->str, "assword: ") != NULL) { +- /* Authentication successful */ +- +- passwd_handler->backend_state = PASSWD_STATE_NEW; +- +- /* Trigger callback to update authentication status */ +- if (passwd_handler->auth_cb) +- passwd_handler->auth_cb (passwd_handler, +- NULL, +- passwd_handler->auth_cb_data); +- +- } else { +- /* Authentication failed */ +- +- error = g_error_new_literal (PASSWD_ERROR, PASSWD_ERROR_AUTH_FAILED, +- "Authentication failure!"); +- +- passwd_handler->changing_password = FALSE; +- +- /* This error can happen both while authenticating or while changing password: +- * if chpasswd_cb is set, this means we're already changing password */ +- if (passwd_handler->chpasswd_cb) +- passwd_handler->chpasswd_cb (passwd_handler, +- error, +- passwd_handler->auth_cb_data); +- else if (passwd_handler->auth_cb) +- passwd_handler->auth_cb (passwd_handler, +- error, +- passwd_handler->auth_cb_data); +- +- g_error_free (error); +- } +- +- reinit = TRUE; +- } +- break; +- case PASSWD_STATE_NEW: +- /* Passwd is asking for our new password */ +- +- if (is_string_complete (str->str, "assword: ", NULL)) { +- /* Advance to next state */ +- passwd_handler->backend_state = PASSWD_STATE_RETYPE; +- +- /* Pop retyped password from queue and into IO channel */ +- io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin); +- +- reinit = TRUE; +- } +- break; +- case PASSWD_STATE_RETYPE: +- /* Passwd is asking for our retyped new password */ +- +- // if (is_string_complete (str->str, +- // "successfully", +- // "short", +- // "longer", +- // "palindrome", +- // "dictionary", +- // "simple", +- // "simplistic", +- // "similar", +- // "different", +- // "case", +- // "wrapped", +- // "recovered", +- // "recent", +- // "unchanged", +- // "match", +- // "1 numeric or special", +- // "failure", +- // "length", +- // NULL)) { +- if (TRUE){ +- +- if (g_strrstr (str->str, "successfully") != NULL) { +- /* Hooray! */ +- +- /* Trigger callback to update status */ +- if (passwd_handler->chpasswd_cb) +- passwd_handler->chpasswd_cb (passwd_handler, +- NULL, +- passwd_handler->chpasswd_cb_data); +- } +- else { +- /* Ohnoes! */ +- +- if (g_strrstr (str->str, "recovered") != NULL) { +- /* What does this indicate? +- * "Authentication information cannot be recovered?" from libpam? */ +- error = g_error_new_literal (PASSWD_ERROR, PASSWD_ERROR_UNKNOWN, +- str->str); +- } else if (g_strrstr (str->str, "short") != NULL || +- g_strrstr (str->str, "longer") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "New password length is too short!"); +- } else if (g_strrstr (str->str, "palindrome") != NULL || +- g_strrstr (str->str, "simple") != NULL || +- g_strrstr (str->str, "simplistic") != NULL || +- g_strrstr (str->str, "dictionary") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password is too simple!"); +- } else if (g_strrstr (str->str, "similar") != NULL || +- g_strrstr (str->str, "different") != NULL || +- g_strrstr (str->str, "case") != NULL || +- g_strrstr (str->str, "wrapped") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password is too similar to the old one!"); +- } else if (g_strrstr (str->str, "1 numeric or special") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password must contain numbers or special characters!"); +- } else if (g_strrstr (str->str, "unchanged") != NULL || +- g_strrstr (str->str, "match") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password is the same as the old one!"); +- } else if (g_strrstr (str->str, "recent") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password has been used recently!"); +- } else if (g_strrstr (str->str, "failure") != NULL) { +- /* Authentication failure */ +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_AUTH_FAILED, +- "Your password has been changed after you verify!"); +- } +- else { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_UNKNOWN, +- "Unknown error"); +- } +- +- /* At this point, passwd might have exited, in which case +- * child_watch_cb should clean up for us and remove this watcher. +- * On some error conditions though, passwd just re-prompts us +- * for our new password. */ +- passwd_handler->backend_state = PASSWD_STATE_ERR; +- +- passwd_handler->changing_password = FALSE; +- +- /* Trigger callback to update status */ +- if (passwd_handler->chpasswd_cb) +- passwd_handler->chpasswd_cb (passwd_handler, +- error, +- passwd_handler->chpasswd_cb_data); +- +- g_error_free (error); +- +- } +- +- reinit = TRUE; +- +- /* child_watch_cb should clean up for us now */ +- } +- break; +- case PASSWD_STATE_NONE: +- /* Passwd is not asking for anything yet */ +- if (is_string_complete (str->str, "assword: ", NULL)) { +- +- /* If the user does not have a password set, +- * passwd will immediately ask for the new password, +- * so skip the AUTH phase */ +- if (is_string_complete (str->str, "new", "New", NULL)) { +- gchar *pw; +- +- passwd_handler->backend_state = PASSWD_STATE_NEW; +- +- /* since passwd didn't ask for our old password +- * in this case, simply remove it from the queue */ +- pw = (gchar *)g_queue_pop_head (passwd_handler->backend_stdin_queue); +- g_free (pw); +- +- /* Pop the IO queue, i.e. send new password */ +- io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin); +- } else { +- +- passwd_handler->backend_state = PASSWD_STATE_AUTH; +- +- /* Pop the IO queue, i.e. send current password */ +- io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin); +- } +- +- reinit = TRUE; +- } +- break; +- default: +- /* Passwd has returned an error */ +- reinit = TRUE; +- break; +- } +- +- if (reinit) { +- g_string_free (str, TRUE); +- str = NULL; +- } +- +- /* Continue calling us */ +- return TRUE; +-} +- +-/* Child watcher */ +-static void child_watch_cb (GPid pid, gint status, PasswdHandler *passwd_handler) +-{ +- //子进程正常结束为非0 +- if (WIFEXITED (status)) { +- //取得子进程正常退出时返回的结束代码 +- if (WEXITSTATUS (status) >= 255) { +- g_warning ("Child exited unexpectedly"); +- } +- } +- +- free_passwd_resources (passwd_handler); +-} +- +-static void stop_passwd (PasswdHandler *passwd_handler) +-{ +- /* This is the standard way of returning from the dialog with passwd. +- * If we return this way we can safely kill passwd as it has completed +- * its task. +- */ +- +- if (passwd_handler->backend_pid != -1) { +- kill (passwd_handler->backend_pid, 9); +- } +- +- /* We must run free_passwd_resources here and not let our child +- * watcher do it, since it will access invalid memory after the +- * dialog has been closed and cleaned up. +- * +- * If we had more than a single thread we'd need to remove +- * the child watch before trying to kill the child. +- */ +- free_passwd_resources (passwd_handler); +-} +- +-static gboolean spawn_passwd (PasswdHandler *passwd_handler, const char * user_name, GError **error) +-{ +- gchar *argv[3]; +- gchar *envp[1]; +- gint my_stdin, my_stdout, my_stderr; +- +- argv[0] = "/usr/bin/passwd"; /* Is it safe to rely on a hard-coded path? */ +- argv[1] = g_strdup_printf ("%s", user_name); +- argv[2] = NULL; +- +-// g_warning("spawn_passwd: %s %s", argv[0], argv[1]); +- +- envp[0] = NULL; /* If we pass an empty array as the environment, +- * will the childs environment be empty, and the +- * locales set to the C default? From the manual: +- * "If envp is NULL, the child inherits its +- * parent'senvironment." +- * If I'm wrong here, we somehow have to set +- * the locales here. +- */ +- +- //创建一个管道,进行通信,子进程执行passwd命令 +- if (!g_spawn_async_with_pipes (NULL, /* Working directory */ +- argv, /* Argument vector */ +- envp, /* Environment */ +- G_SPAWN_DO_NOT_REAP_CHILD, /* Flags */ +- NULL, /* Child setup (在子进程调用exec()之前,该函数会被调用)*/ +- NULL, /* Data to child setup */ +- &passwd_handler->backend_pid, /* PID */ +- &my_stdin, /* Stdin */ +- &my_stdout, /* Stdout */ +- &my_stderr, /* Stderr */ +- error)) { /* GError */ +- +- /* An error occured */ +- free_passwd_resources (passwd_handler); +- +- return FALSE; +- } +- +- /* 2>&1 */ +- //复制文件描述符,也就是将stderr重定向到stdout +- if (dup2 (my_stderr, my_stdout) == -1) { +- /* Failed! */ +- g_set_error_literal (error, +- PASSWD_ERROR, +- PASSWD_ERROR_BACKEND, +- strerror (errno)); +- +- /* Clean up */ +- stop_passwd (passwd_handler); +- +- return FALSE; +- } +- +- /* Open IO Channels */ +- //指定一个文件描述符,创建一个IO Channel,默认使用UTF-8编码格式 +- passwd_handler->backend_stdin = g_io_channel_unix_new (my_stdin); +- passwd_handler->backend_stdout = g_io_channel_unix_new (my_stdout); +- +- /* Set raw encoding */ +- /* Set nonblocking mode */ +- //设置通道的编码方式为NULL,设置为非阻塞的方式 +- if (g_io_channel_set_encoding (passwd_handler->backend_stdin, NULL, error) != G_IO_STATUS_NORMAL || +- g_io_channel_set_encoding (passwd_handler->backend_stdout, NULL, error) != G_IO_STATUS_NORMAL || +- g_io_channel_set_flags (passwd_handler->backend_stdin, G_IO_FLAG_NONBLOCK, error) != G_IO_STATUS_NORMAL || +- g_io_channel_set_flags (passwd_handler->backend_stdout, G_IO_FLAG_NONBLOCK, error) != G_IO_STATUS_NORMAL ) { +- +- /* Clean up */ +- stop_passwd (passwd_handler); +- return FALSE; +- } +- +- /* Turn off buffering */ +- //只有通道的编码方式为NULL,才能设置缓冲状态为FASLE,其他任何编码,通道必须被缓冲,这里是为了清掉上次的密码 +- g_io_channel_set_buffered (passwd_handler->backend_stdin, FALSE); +- g_io_channel_set_buffered (passwd_handler->backend_stdout, FALSE); +- +- /* Add IO Channel watcher */ +- //当IO通道的状态为G_IO_IN(从IO通道读数据时)或者G_IO_PRI(读紧急数据时)时,调用io_watch_stdout +- passwd_handler->backend_stdout_watch_id = g_io_add_watch (passwd_handler->backend_stdout, +- G_IO_IN /*| G_IO_PRI*/, +- (GIOFunc) io_watch_stdout, passwd_handler); +- +- /* Add child watcher */ +- //在指定pid的进程退出时,调用child_watch_cb(),进行错误检查,以及资源回收 +- passwd_handler->backend_child_watch_id = g_child_watch_add (passwd_handler->backend_pid, (GChildWatchFunc) child_watch_cb, passwd_handler); +- +- /* Success! */ +- +- return TRUE; +-} +- +-static void update_password (PasswdHandler *passwd_handler) +-{ +- gchar *s; +- +- s = g_strdup_printf ("%s\n", passwd_handler->new_password); +- +- g_queue_push_tail (passwd_handler->backend_stdin_queue, s); +- /* We need to allocate new space because io_queue_pop() g_free()s +- * every element of the queue after it's done */ +- g_queue_push_tail (passwd_handler->backend_stdin_queue, g_strdup (s)); +-} +- +-gboolean passwd_change_password (PasswdHandler *passwd_handler, const char *user_name, +- const char *new_password, +- PasswdCallback cb, +- const gpointer user_data) +-{ +- GError *error = NULL; +- +- passwd_handler->changing_password = TRUE; +- +- passwd_handler->new_password = new_password; +- passwd_handler->chpasswd_cb = cb; +- passwd_handler->chpasswd_cb_data = user_data; +- +- /* Stop passwd if an error occured and it is still running */ +- if (passwd_handler->backend_state == PASSWD_STATE_ERR) { +- +- /* Stop passwd, free resources */ +- stop_passwd (passwd_handler); +- } +- +- /* Check that the backend is still running, or that an error +- * has occured but it has not yet exited */ +- +- g_warning("passwd pid is: %d", passwd_handler->backend_pid); +- if (passwd_handler->backend_pid == -1) { +- /* If it is not, re-run authentication */ +- +- /* Spawn backend */ +- stop_passwd (passwd_handler); +- +- if (!spawn_passwd (passwd_handler, user_name, &error)) { +- g_error_free (error); +- +- return FALSE; +- } +- +- g_warning("------------1----------------------"); +- +- /* Add current and new passwords to queue */ +- //将当前的密码和新密码入队,新密码会入队两次 +- authenticate (passwd_handler); +- update_password (passwd_handler); +- } else { +- g_warning("-----2-----------"); +- /* Only add new passwords to queue */ +- update_password (passwd_handler); +- } +- +- /* Pop new password through the backend. If user has no password, popping the queue +- would output current password, while 'passwd' is waiting for the new one. So wait +- for io_watch_stdout() to remove current password from the queue, and output +- the new one for us.*/ +- //如果密码为空,将新进队列的密码,作为current_passwd弹出 +- if (passwd_handler->current_password) +- { +- io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin); +- } +- +- /* Our IO watcher should now handle the rest */ +- +- return TRUE; +-} +- +-//void passwd_authenticate (PasswdHandler *passwd_handler, +-// const char *current_password, +-// PasswdCallback cb, +-// const gpointer user_data) +-//{ +-// GError *error = NULL; +- +-// /* Don't stop if we've already started chaging password */ +-// if (passwd_handler->changing_password) +-// return; +- +-// /* Clear data from possible previous attempts to change password */ +-// passwd_handler->new_password = NULL; +-// passwd_handler->chpasswd_cb = NULL; +-// passwd_handler->chpasswd_cb_data = NULL; +-// g_queue_foreach (passwd_handler->backend_stdin_queue, (GFunc) g_free, NULL); +-// g_queue_clear (passwd_handler->backend_stdin_queue); +- +-// passwd_handler->current_password = current_password; +-// passwd_handler->auth_cb = cb; +-// passwd_handler->auth_cb_data = user_data; +- +-// /* Spawn backend */ +-// //重新启动后台passwd +-// stop_passwd (passwd_handler); +- +-// if (!spawn_passwd (passwd_handler, &error)) { +-// g_warning ("%s", error->message); +-// g_error_free (error); +-// return; +-// } +- +-// //将current passwd从尾部插入队列 +-// authenticate (passwd_handler); +- +-// /* Our IO watcher should now handle the rest */ +-//} +- +- +-PasswdHandler * passwd_init () +-{ +- PasswdHandler *passwd_handler; +- +- passwd_handler = g_new0 (PasswdHandler, 1); +- +- /* Initialize backend_pid. -1 means the backend is not running */ +- //-1代表后台还没启动 +- passwd_handler->backend_pid = -1; +- +- /* Initialize IO Channels */ +- passwd_handler->backend_stdin = NULL; +- passwd_handler->backend_stdout = NULL; +- +- /* Initialize write queue */ +- passwd_handler->backend_stdin_queue = g_queue_new (); +- +- /* Initialize watchers */ +- passwd_handler->backend_child_watch_id = 0; +- passwd_handler->backend_stdout_watch_id = 0; +- +- /* Initialize backend state */ +- passwd_handler->backend_state = PASSWD_STATE_NONE; +- passwd_handler->changing_password = FALSE; +- +- return passwd_handler; +-} +- +- +-void passwd_destroy (PasswdHandler *passwd_handler) +-{ +- g_queue_free (passwd_handler->backend_stdin_queue); +- stop_passwd (passwd_handler); +- g_free (passwd_handler); +-} +diff --git a/changeOtherUserPwd/run-passwd2.h b/changeOtherUserPwd/run-passwd2.h +deleted file mode 100644 +index c333762..0000000 +--- a/changeOtherUserPwd/run-passwd2.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-#ifndef RUNPASSWD_H +-#define RUNPASSWD_H +- +- +-struct PasswdHandler; +- +-typedef struct PasswdHandler PasswdHandler; +- +-typedef void (*PasswdCallback) (PasswdHandler * passwd_handler, GError * error, const gpointer user_data); +- +-/* Error codes */ +-typedef enum { +- PASSWD_ERROR_REJECTED, /* New password is not secure enough */ +- PASSWD_ERROR_AUTH_FAILED, /* Wrong old password, or PAM failure */ +- PASSWD_ERROR_REAUTH_FAILED, /* Password has changed since first authentication */ +- PASSWD_ERROR_BACKEND, /* Backend error */ +- PASSWD_ERROR_UNKNOWN /* General error */ +-} PasswdError; +- +-PasswdHandler *passwd_init (); +- +-void passwd_destroy (PasswdHandler *passwd_handler); +- +-void passwd_authenticate (PasswdHandler *passwd_handler, +- const char *current_password, +- PasswdCallback cb, +- gpointer user_data); +- +-gboolean passwd_change_password (PasswdHandler *passwd_handler, +- const char *user_name, +- const char *new_password, +- PasswdCallback cb, +- const gpointer user_data); +- +-#endif // RUNPASSWD_H +diff --git a/changeUserPwd/changeUserPwd.pro b/changeUserPwd/changeUserPwd.pro +index 7d80db4..e5d50a6 100644 +--- a/changeUserPwd/changeUserPwd.pro ++++ b/changeUserPwd/changeUserPwd.pro +@@ -32,9 +32,4 @@ INSTALLS += \ + target \ + + +-SOURCES += \ +- main.cpp \ +- run-passwd.cpp +- +-HEADERS += \ +- run-passwd.h ++SOURCES += main.cpp +diff --git a/changeUserPwd/main.cpp b/changeUserPwd/main.cpp +index 6602a1d..487a80d 100644 +--- a/changeUserPwd/main.cpp ++++ b/changeUserPwd/main.cpp +@@ -1,7 +1,5 @@ + #include <QCoreApplication> +- + #include <glib.h> +-#include "run-passwd.h" + + /*using pam change password*/ + #include <stdio.h> +@@ -94,7 +92,7 @@ static int changeCurrent_conv (int num_msg, const struct pam_message **msg, stru + failed_conversation: + for (count=0; count < num_msg; count++) { + if (NULL != responses[count].resp) { +- memset (responses[count].resp, 0, strlen (responses[count].resp)); ++ memset (responses[count].resp, 0, strnlen(responses[count].resp, sizeof(responses[count].resp))); + free (responses[count].resp); + responses[count].resp = NULL; + } +@@ -106,6 +104,7 @@ failed_conversation: + return PAM_CONV_ERR; + } + ++ + int main(int argc, char *argv[]) + { + struct pam_conv conv; +@@ -152,82 +151,3 @@ int main(int argc, char *argv[]) + } + + /*end pam*/ +- +- +-PasswdHandler *passwd_handler = NULL; +- +-static void auth_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data); +-static void chpasswd_cb (PasswdHandler *passwd_handler, GError *error, gpointer user_data); +- +-//int main(int argc, char *argv[]) +-//{ +- +-// if (argc != 3) +-// { +-// return -1; +-// } +- +-// QCoreApplication a(argc, argv); +- +-// passwd_handler = passwd_init (); +- +-// passwd_authenticate (passwd_handler, argv[1], auth_cb, argv[2]); +- +-// return a.exec(); +-//} +- +-static void +-auth_cb (PasswdHandler *passwd_handler, +- GError *error, +- gpointer user_data) +-{ +- char *secondary_text; +- char * pwd = (char*) user_data; +- +- if (error){ +- secondary_text = error->message; +- char ** lines = g_strsplit(secondary_text, "\n", -1); +- printf("%s\n", lines[0]); +- qApp->exit(1); +- } else { +- passwd_change_password (passwd_handler, pwd, chpasswd_cb, NULL); +- } +- +-} +- +-/** +- * @brief chpasswd_cb +- * @param passwd_handler +- * @param error +- * @param user_data +- */ +-static void +-chpasswd_cb (PasswdHandler *passwd_handler, +- GError *error, +- gpointer user_data) +-{ +-// char *primary_text; +- char *secondary_text; +- +- if (!error) { +- //finish_password_change (TRUE); +-// primary_text = "Success"; +- secondary_text = ""; +- +- printf("%s\n", secondary_text); +- +- qApp->exit(0); +- } else { +-// primary_text = "Failed"; +- secondary_text = error->message; +- +- char ** lines = g_strsplit(secondary_text, "\n", -1); +- +- printf("%s\n", lines[0]); +- +- passwd_destroy (passwd_handler); +- +- qApp->exit(1); +- } +- +-} +diff --git a/changeUserPwd/run-passwd.cpp b/changeUserPwd/run-passwd.cpp +deleted file mode 100644 +index 6b74b43..0000000 +--- a/changeUserPwd/run-passwd.cpp ++++ /dev/null +@@ -1,808 +0,0 @@ +- +- +-/* qt会将glib里的signals成员识别为宏,所以取消该宏 +- * 后面如果用到signals时,使用Q_SIGNALS代替即可 +- **/ +-#ifdef signals +-#undef signals +-#endif +- +-#include <glib.h> +-#include <gio/gio.h> +- +-#include <unistd.h> +-#include <string.h> +-#include <errno.h> +-#include <sys/wait.h> +-#include <stdio.h> +- +-#include "run-passwd.h" +- +- +-/* Buffer size for backend output */ +-#define BUFSIZE 1024 +- +-/* Passwd states */ +-//后端passwd的状态,NONE应该是passwd还没有启动,ERROR表示报错但还没退出 +-typedef enum { +- PASSWD_STATE_NONE, /* Passwd is not asking for anything */ +- PASSWD_STATE_AUTH, /* Passwd is asking for our current password */ +- PASSWD_STATE_NEW, /* Passwd is asking for our new password */ +- PASSWD_STATE_RETYPE, /* Passwd is asking for our retyped new password */ +- PASSWD_STATE_ERR /* Passwd reported an error but has not yet exited */ +-} PasswdState; +- +-struct PasswdHandler { +-// GtkBuilder *ui; +- +- const char *current_password; +- const char *new_password; +- const char *retyped_password; +- +- /* Communication with the passwd program */ +- GPid backend_pid; +- +- GIOChannel *backend_stdin; +- GIOChannel *backend_stdout; +- GIOChannel *backend_stderr; +- +- GQueue *backend_stdin_queue; /* Write queue to backend_stdin */ +- +- /* GMainLoop IDs */ +- guint backend_child_watch_id; /* g_child_watch_add (PID) */ +- guint backend_stdout_watch_id; /* g_io_add_watch (stdout) */ +- +- +- /* State of the passwd program */ +- PasswdState backend_state; +- gboolean changing_password; +- +- PasswdCallback auth_cb; +- gpointer auth_cb_data; +- +- PasswdCallback chpasswd_cb; +- gpointer chpasswd_cb_data; +-}; +- +-//GQuark是一个guint32 +-static GQuark +-passwd_error_quark (void) +-{ +- static GQuark q = 0; +- +- //返回错误的标识码 +- if (q == 0) { +- q = g_quark_from_static_string("passwd_error"); +- } +- +- return q; +-} +- +-/* Error handling */ +-#define PASSWD_ERROR (passwd_error_quark ()) +- +-static void stop_passwd (PasswdHandler *passwd_handler); +- +-static void free_passwd_resources (PasswdHandler *passwd_handler); +- +-static gboolean io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *passwd_handler); +- +-static gboolean io_watch_stdout2 (GIOChannel *source, GIOCondition condition, PasswdHandler *passwd_handler); +-static void free_passwd_resources (PasswdHandler *passwd_handler) +-{ +- GError *error = NULL; +- +- /* Remove the child watcher */ +- if (passwd_handler->backend_child_watch_id != 0) { +- +- g_source_remove (passwd_handler->backend_child_watch_id); +- +- passwd_handler->backend_child_watch_id = 0; +- } +- +- +- /* Close IO channels (internal file descriptors are automatically closed) */ +- if (passwd_handler->backend_stdin != NULL) { +- +- if (g_io_channel_shutdown (passwd_handler->backend_stdin, TRUE, &error) != G_IO_STATUS_NORMAL) { +- g_warning ("Could not shutdown backend_stdin IO channel: %s", error->message); +- g_error_free (error); +- error = NULL; +- } +- +- g_io_channel_unref (passwd_handler->backend_stdin); +- passwd_handler->backend_stdin = NULL; +- } +- +- if (passwd_handler->backend_stdout != NULL) { +- +- if (g_io_channel_shutdown (passwd_handler->backend_stdout, TRUE, &error) != G_IO_STATUS_NORMAL) { +- g_warning ("Could not shutdown backend_stdout IO channel: %s", error->message); +- g_error_free (error); +- error = NULL; +- } +- +- g_io_channel_unref (passwd_handler->backend_stdout); +- +- passwd_handler->backend_stdout = NULL; +- } +- +- /* Remove IO watcher */ +- if (passwd_handler->backend_stdout_watch_id != 0) { +- +- g_source_remove (passwd_handler->backend_stdout_watch_id); +- +- passwd_handler->backend_stdout_watch_id = 0; +- } +- +- /* Close PID */ +- //因为flag为G_SPAWN_DO_NOT_REAP_CHILD,所以child不会自动的被reap掉,需要在子进程上free +- if (passwd_handler->backend_pid != -1) { +- +- g_spawn_close_pid (passwd_handler->backend_pid); +- +- passwd_handler->backend_pid = -1; +- } +- +- /* Clear backend state */ +- passwd_handler->backend_state = PASSWD_STATE_NONE; +-} +- +-static void authenticate (PasswdHandler *passwd_handler) +-{ +- gchar *s; +- +- s = g_strdup_printf ("%s\n", passwd_handler->current_password); +- g_queue_push_tail (passwd_handler->backend_stdin_queue, s); +-} +- +-static void io_queue_pop (GQueue *queue, GIOChannel *channel) +-{ +- gchar *buf; +- gsize bytes_written; +- GError *error = NULL; +- +- buf = (gchar *)g_queue_pop_head (queue); +- +- if (buf != NULL) { +- //将队列中的首元素写入到channel中 +- if (g_io_channel_write_chars (channel, buf, -1, &bytes_written, &error) != G_IO_STATUS_NORMAL) { +- g_warning ("Could not write queue element \"%s\" to channel: %s", buf, error->message); +- g_error_free (error); +- } +- +- /* Ensure passwords are cleared from memory */ +- //清除内存中的passwords +- memset (buf, 0, strlen (buf)); +- g_free (buf); +- } +- +-} +- +-static gboolean is_string_complete (gchar *str, ...) +-{ +- va_list ap; +- gchar *arg; +- +- if (strlen (str) == 0) { +- return FALSE; +- } +- +- va_start (ap, str); +- +- while ((arg = va_arg (ap, char *)) != NULL) { +- if (g_strrstr (str, arg) != NULL) { +- va_end (ap); +- return TRUE; +- } +- } +- +- va_end (ap); +- +- return FALSE; +-} +- +-int isDomainUser(const char* username) +-{ +- FILE *fp; +- fp=fopen("/etc/passwd","r"); +- if(fp == NULL) +- { +- return 1; +- } +- char buf[1024], name[128]; +- while(!feof(fp)) +- { +- if(fgets(buf,sizeof (buf),fp) == NULL) +- { +- break; +- } +- sscanf(buf,"%[^:]",name); +- if(strcmp(name,username) == 0) +- { +- fclose(fp); +- return 0; +- } +- } +- fclose(fp); +- return 1; +-} +- +- +-static gboolean io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *passwd_handler) +-{ +- static GString *str = NULL; /* Persistent buffer */ +- +- gchar buf[BUFSIZE]; /* Temporary buffer */ +- gsize bytes_read; +- GError *gio_error = NULL; /* Error returned by functions */ +- GError *error = NULL; /* Error sent to callbacks */ +- +- //GtkBuilder *dialog; +- +- gboolean reinit = FALSE; +- +- /* Initialize buffer */ +- if (str == NULL) { +- str = g_string_new (""); +- } +- +- //dialog = passwd_handler->ui; +- //buf将保存从channel中读取到的数据,bytes_read表示从buf中读取的数据长度 +- if (g_io_channel_read_chars (source, buf, BUFSIZE, &bytes_read, &gio_error) +- != G_IO_STATUS_NORMAL) { +- g_warning ("IO Channel read error: %s", gio_error->message); +- g_error_free (gio_error); +- +- return TRUE; +- } +- +- str = g_string_append_len (str, buf, bytes_read); +- +- g_warning("----io_watch_stdout DEBUG#msg: %s\n", str->str); +- g_warning("----io_watch_stdout DEBUG#0msg: %d\n", passwd_handler->backend_state); +- +- /* In which state is the backend? */ +- switch (passwd_handler->backend_state) { +- case PASSWD_STATE_AUTH: +- /* Passwd is asking for our current password */ +- if (is_string_complete (str->str, "assword: ", "failure", "wrong", "error", "failed", NULL)) { +- +- if (g_strrstr (str->str, "New password: ") != NULL || g_strrstr (str->str, "New Password: ") != NULL) { +- /* Authentication successful */ +- +- passwd_handler->backend_state = PASSWD_STATE_NEW; +- +- /* Trigger callback to update authentication status */ +- if (passwd_handler->auth_cb) +- passwd_handler->auth_cb (passwd_handler, +- NULL, +- passwd_handler->auth_cb_data); +- +- } else { +- /* Authentication failed */ +- +- // 域用户出错只关注服务器消息(stdout),sdterr消息不关注 +- if (isDomainUser(g_get_user_name())) { +- break; +- } +- +- error = g_error_new_literal (PASSWD_ERROR, PASSWD_ERROR_AUTH_FAILED, +- "Authentication token manipulation error!"); +- +- g_warning ("Change password failed: %s", error->message); +- passwd_handler->changing_password = FALSE; +- +- /* This error can happen both while authenticating or while changing password: +- * if chpasswd_cb is set, this means we're already changing password */ +- if (passwd_handler->chpasswd_cb) +- passwd_handler->chpasswd_cb (passwd_handler, +- error, +- passwd_handler->auth_cb_data); +- else if (passwd_handler->auth_cb) +- passwd_handler->auth_cb (passwd_handler, +- error, +- passwd_handler->auth_cb_data); +- +- g_error_free (error); +- } +- +- reinit = TRUE; +- } +- break; +- case PASSWD_STATE_NEW: +- /* Passwd is asking for our new password */ +- if (is_string_complete (str->str, "assword: ", NULL)) { +- /* Advance to next state */ +- passwd_handler->backend_state = PASSWD_STATE_RETYPE; +- +- /* Pop retyped password from queue and into IO channel */ +- io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin); +- +- reinit = TRUE; +- } +- break; +- case PASSWD_STATE_RETYPE: +- /* Passwd is asking for our retyped new password */ +- +- // if (is_string_complete (str->str, +- // "successfully", +- // "short", +- // "longer", +- // "palindrome", +- // "dictionary", +- // "simple", +- // "simplistic", +- // "similar", +- // "different", +- // "case", +- // "wrapped", +- // "recovered", +- // "recent", +- // "unchanged", +- // "match", +- // "1 numeric or special", +- // "failure", +- // "length", +- // NULL)) { +- if (TRUE){ +- +- if (g_strrstr (str->str, "successfully") != NULL) { +- /* Hooray! */ +- +- /* Trigger callback to update status */ +- if (passwd_handler->chpasswd_cb) +- passwd_handler->chpasswd_cb (passwd_handler, +- NULL, +- passwd_handler->chpasswd_cb_data); +- } else { +- /* Ohnoes! */ +- +- // 域用户出错只关注服务器消息(stdout),sdterr消息不关注 +- if (isDomainUser(g_get_user_name())) { +- break; +- } +- +- if (g_strrstr (str->str, "recovered") != NULL) { +- /* What does this indicate? +- * "Authentication information cannot be recovered?" from libpam? */ +- error = g_error_new_literal (PASSWD_ERROR, PASSWD_ERROR_UNKNOWN, +- str->str); +- }/* else if (g_strrstr (str->str, "short") != NULL || +- g_strrstr (str->str, "longer") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "New password length is too short!"); +- } else if (g_strrstr (str->str, "palindrome") != NULL || +- g_strrstr (str->str, "simple") != NULL || +- g_strrstr (str->str, "simplistic") != NULL || +- g_strrstr (str->str, "dictionary") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password is too simple!"); +- } else if (g_strrstr (str->str, "similar") != NULL || +- g_strrstr (str->str, "different") != NULL || +- g_strrstr (str->str, "case") != NULL || +- g_strrstr (str->str, "wrapped") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password is too similar to the old one!"); +- } else if (g_strrstr (str->str, "1 numeric or special") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password must contain numbers or special characters!"); +- } else if (g_strrstr (str->str, "unchanged") != NULL || +- g_strrstr (str->str, "match") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password is the same as the old one!"); +- } else if (g_strrstr (str->str, "recent") != NULL) { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED, +- "The new password has been used recently!"); +- } else if (g_strrstr (str->str, "failure") != NULL) { +- //Authentication failure +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_AUTH_FAILED, +- "Your password has been changed after you verify!"); +- } */else { +- error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_UNKNOWN, +- str->str); +- } +- +- /* At this point, passwd might have exited, in which case +- * child_watch_cb should clean up for us and remove this watcher. +- * On some error conditions though, passwd just re-prompts us +- * for our new password. */ +- passwd_handler->backend_state = PASSWD_STATE_ERR; +- +- passwd_handler->changing_password = FALSE; +- +- /* Trigger callback to update status */ +- if (passwd_handler->chpasswd_cb) +- passwd_handler->chpasswd_cb (passwd_handler, +- error, +- passwd_handler->chpasswd_cb_data); +- +- g_error_free (error); +- +- } +- +- reinit = TRUE; +- +- /* child_watch_cb should clean up for us now */ +- } +- break; +- case PASSWD_STATE_NONE: +- /* Passwd is not asking for anything yet */ +- if (is_string_complete (str->str, "assword: ", NULL)) { +- +- /* If the user does not have a password set, +- * passwd will immediately ask for the new password, +- * so skip the AUTH phase */ +- if (is_string_complete (str->str, "new", "New", NULL)) { +- gchar *pw; +- +- passwd_handler->backend_state = PASSWD_STATE_NEW; +- +- /* since passwd didn't ask for our old password +- * in this case, simply remove it from the queue */ +- pw = (gchar *)g_queue_pop_head (passwd_handler->backend_stdin_queue); +- g_free (pw); +- +- /* Pop the IO queue, i.e. send new password */ +- io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin); +- } else { +- +- passwd_handler->backend_state = PASSWD_STATE_AUTH; +- +- /* Pop the IO queue, i.e. send current password */ +- io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin); +- } +- +- reinit = TRUE; +- } +- break; +- default: +- /* Passwd has returned an error */ +- reinit = TRUE; +- break; +- } +- +- if (reinit) { +- g_string_free (str, TRUE); +- str = NULL; +- } +- +- /* Continue calling us */ +- return TRUE; +-} +- +-static gboolean io_watch_stdout2 (GIOChannel *source, GIOCondition condition, PasswdHandler *passwd_handler) +-{ +- g_warning("----io_watch_stdout2 revieve server message"); +- static GString *str = NULL; /* Persistent buffer */ +- +- gchar buf[BUFSIZE]; /* Temporary buffer */ +- gsize bytes_read; +- GError *gio_error = NULL; /* Error returned by functions */ +- GError *error = NULL; /* Error sent to callbacks */ +- +- //GtkBuilder *dialog; +- +- gboolean reinit = FALSE; +- +- /* Initialize buffer */ +- if (str == NULL) { +- str = g_string_new (""); +- } +- +- //dialog = passwd_handler->ui; +- //buf将保存从channel中读取到的数据,bytes_read表示从buf中读取的数据长度 +- if (g_io_channel_read_chars (source, buf, BUFSIZE, &bytes_read, &gio_error) +- != G_IO_STATUS_NORMAL) { +- g_warning ("IO Channel read error: %s", gio_error->message); +- g_error_free (gio_error); +- +- return TRUE; +- } +- +- str = g_string_append_len (str, buf, bytes_read); +- +- g_warning("----io_watch_stdout2 DEBUG#msg2: %s\n", str->str); +- +- if (is_string_complete (str->str, "Server message", "System is offline", NULL)) { +- error = g_error_new_literal (PASSWD_ERROR, PASSWD_ERROR_UNKNOWN, +- str->str); +- +- g_warning ("Change password failed: %s", error->message); +- passwd_handler->changing_password = FALSE; +- +- /* This error can happen both while authenticating or while changing password: +- * if chpasswd_cb is set, this means we're already changing password */ +- if (passwd_handler->chpasswd_cb) +- passwd_handler->chpasswd_cb (passwd_handler, +- error, +- passwd_handler->auth_cb_data); +- else if (passwd_handler->auth_cb) +- passwd_handler->auth_cb (passwd_handler, +- error, +- passwd_handler->auth_cb_data); +- +- g_error_free (error); +- } +- +- return TRUE; +-} +- +-/* Child watcher */ +-static void child_watch_cb (GPid pid, gint status, PasswdHandler *passwd_handler) +-{ +- //子进程正常结束为非0 +- if (WIFEXITED (status)) { +- //取得子进程正常退出时返回的结束代码 +- if (WEXITSTATUS (status) >= 255) { +- g_warning ("Child exited unexpectedly"); +- } +- } +- +- free_passwd_resources (passwd_handler); +-} +- +-static void stop_passwd (PasswdHandler *passwd_handler) +-{ +- /* This is the standard way of returning from the dialog with passwd. +- * If we return this way we can safely kill passwd as it has completed +- * its task. +- */ +- +- if (passwd_handler->backend_pid != -1) { +- kill (passwd_handler->backend_pid, 9); +- } +- +- /* We must run free_passwd_resources here and not let our child +- * watcher do it, since it will access invalid memory after the +- * dialog has been closed and cleaned up. +- * +- * If we had more than a single thread we'd need to remove +- * the child watch before trying to kill the child. +- */ +- free_passwd_resources (passwd_handler); +-} +- +-static gboolean spawn_passwd (PasswdHandler *passwd_handler, GError **error) +-{ +- gchar *argv[2]; +- gchar *envp[1]; +- gint my_stdin, my_stdout, my_stderr; +- +- argv[0] = "/usr/bin/passwd"; /* Is it safe to rely on a hard-coded path? */ +- argv[1] = NULL; +- +- envp[0] = NULL; /* If we pass an empty array as the environment, +- * will the childs environment be empty, and the +- * locales set to the C default? From the manual: +- * "If envp is NULL, the child inherits its +- * parent'senvironment." +- * If I'm wrong here, we somehow have to set +- * the locales here. +- */ +- +- //创建一个管道,进行通信,子进程执行passwd命令 +- if (!g_spawn_async_with_pipes (NULL, /* Working directory */ +- argv, /* Argument vector */ +- envp, /* Environment */ +- G_SPAWN_DO_NOT_REAP_CHILD, /* Flags */ +- NULL, /* Child setup (在子进程调用exec()之前,该函数会被调用)*/ +- NULL, /* Data to child setup */ +- &passwd_handler->backend_pid, /* PID */ +- &my_stdin, /* Stdin */ +- &my_stdout, /* Stdout */ +- &my_stderr, /* Stderr */ +- error)) { /* GError */ +- +- /* An error occured */ +- free_passwd_resources (passwd_handler); +- +- return FALSE; +- } +- +- /* 2>&1 */ +- //复制文件描述符,也就是将stderr重定向到stdout +-// if (dup2 (my_stderr, my_stdout) == -1) { +-// /* Failed! */ +-// g_set_error_literal (error, +-// PASSWD_ERROR, +-// PASSWD_ERROR_BACKEND, +-// strerror (errno)); +- +-// /* Clean up */ +-// stop_passwd (passwd_handler); +- +-// return FALSE; +-// } +- +- /* Open IO Channels */ +- //指定一个文件描述符,创建一个IO Channel,默认使用UTF-8编码格式 +- passwd_handler->backend_stdin = g_io_channel_unix_new (my_stdin); +- passwd_handler->backend_stdout = g_io_channel_unix_new (my_stdout); +- passwd_handler->backend_stderr = g_io_channel_unix_new(my_stderr); +- +- /* Set raw encoding */ +- /* Set nonblocking mode */ +- //设置通道的编码方式为NULL,设置为非阻塞的方式 +- if (g_io_channel_set_encoding (passwd_handler->backend_stdin, NULL, error) != G_IO_STATUS_NORMAL || +- g_io_channel_set_encoding (passwd_handler->backend_stdout, NULL, error) != G_IO_STATUS_NORMAL || +- g_io_channel_set_encoding (passwd_handler->backend_stderr, NULL, error) != G_IO_STATUS_NORMAL || +- g_io_channel_set_flags (passwd_handler->backend_stdin, G_IO_FLAG_NONBLOCK, error) != G_IO_STATUS_NORMAL || +- g_io_channel_set_flags (passwd_handler->backend_stdout, G_IO_FLAG_NONBLOCK, error) != G_IO_STATUS_NORMAL || +- g_io_channel_set_flags (passwd_handler->backend_stderr, G_IO_FLAG_NONBLOCK, error) != G_IO_STATUS_NORMAL ) { +- +- /* Clean up */ +- stop_passwd (passwd_handler); +- return FALSE; +- } +- +- /* Turn off buffering */ +- //只有通道的编码方式为NULL,才能设置缓冲状态为FASLE,其他任何编码,通道必须被缓冲,这里是为了清掉上次的密码 +- g_io_channel_set_buffered (passwd_handler->backend_stdin, FALSE); +- g_io_channel_set_buffered (passwd_handler->backend_stdout, FALSE); +- g_io_channel_set_buffered (passwd_handler->backend_stderr, FALSE); +- +- /* Add IO Channel watcher */ +- passwd_handler->backend_stdout_watch_id = g_io_add_watch (passwd_handler->backend_stdout, +- G_IO_IN, +- (GIOFunc) io_watch_stdout2, passwd_handler); +- +- //当IO通道的状态为G_IO_IN(从IO通道读数据时)或者G_IO_PRI(读紧急数据时)时,调用io_watch_stdout +- passwd_handler->backend_stdout_watch_id = g_io_add_watch (passwd_handler->backend_stderr, +- G_IO_IN /*| G_IO_PRI*/ , +- (GIOFunc) io_watch_stdout, passwd_handler); +- +- +- /* Add child watcher */ +- //在指定pid的进程退出时,调用child_watch_cb(),进行错误检查,以及资源回收 +- passwd_handler->backend_child_watch_id = g_child_watch_add (passwd_handler->backend_pid, (GChildWatchFunc) child_watch_cb, passwd_handler); +- +- /* Success! */ +- +- return TRUE; +-} +- +-static void update_password (PasswdHandler *passwd_handler) +-{ +- gchar *s; +- +- s = g_strdup_printf ("%s\n", passwd_handler->new_password); +- +- g_queue_push_tail (passwd_handler->backend_stdin_queue, s); +- /* We need to allocate new space because io_queue_pop() g_free()s +- * every element of the queue after it's done */ +- g_queue_push_tail (passwd_handler->backend_stdin_queue, g_strdup (s)); +-} +- +-gboolean passwd_change_password (PasswdHandler *passwd_handler, +- const char *new_password, +- PasswdCallback cb, +- const gpointer user_data) +-{ +- GError *error = NULL; +- +- passwd_handler->changing_password = TRUE; +- +- passwd_handler->new_password = new_password; +- passwd_handler->chpasswd_cb = cb; +- passwd_handler->chpasswd_cb_data = user_data; +- +- /* Stop passwd if an error occured and it is still running */ +- if (passwd_handler->backend_state == PASSWD_STATE_ERR) { +- +- /* Stop passwd, free resources */ +- stop_passwd (passwd_handler); +- } +- +- /* Check that the backend is still running, or that an error +- * has occured but it has not yet exited */ +- if (passwd_handler->backend_pid == -1) { +- /* If it is not, re-run authentication */ +- +- /* Spawn backend */ +- stop_passwd (passwd_handler); +- +- if (!spawn_passwd (passwd_handler, &error)) { +- g_error_free (error); +- +- return FALSE; +- } +- +- /* Add current and new passwords to queue */ +- //将当前的密码和新密码入队,新密码会入队两次 +- authenticate (passwd_handler); +- update_password (passwd_handler); +- } else { +- /* Only add new passwords to queue */ +- update_password (passwd_handler); +- } +- +- /* Pop new password through the backend. If user has no password, popping the queue +- would output current password, while 'passwd' is waiting for the new one. So wait +- for io_watch_stdout() to remove current password from the queue, and output +- the new one for us.*/ +- //如果密码为空,将新进队列的密码,作为current_passwd弹出 +- if (passwd_handler->current_password) +- { +- io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin); +- } +- +- /* Our IO watcher should now handle the rest */ +- +- return TRUE; +-} +- +-void passwd_authenticate (PasswdHandler *passwd_handler, +- const char *current_password, +- PasswdCallback cb, +- const gpointer user_data) +-{ +- GError *error = NULL; +- +- /* Don't stop if we've already started chaging password */ +- if (passwd_handler->changing_password) +- return; +- +- /* Clear data from possible previous attempts to change password */ +- passwd_handler->new_password = NULL; +- passwd_handler->chpasswd_cb = NULL; +- passwd_handler->chpasswd_cb_data = NULL; +- g_queue_foreach (passwd_handler->backend_stdin_queue, (GFunc) g_free, NULL); +- g_queue_clear (passwd_handler->backend_stdin_queue); +- +- passwd_handler->current_password = current_password; +- passwd_handler->auth_cb = cb; +- passwd_handler->auth_cb_data = user_data; +- +- /* Spawn backend */ +- //重新启动后台passwd +- stop_passwd (passwd_handler); +- +- if (!spawn_passwd (passwd_handler, &error)) { +- g_warning ("%s", error->message); +- g_error_free (error); +- return; +- } +- +- //将current passwd从尾部插入队列 +- authenticate (passwd_handler); +- +- /* Our IO watcher should now handle the rest */ +-} +- +- +-PasswdHandler * passwd_init () +-{ +- PasswdHandler *passwd_handler; +- +- passwd_handler = g_new0 (PasswdHandler, 1); +- +- /* Initialize backend_pid. -1 means the backend is not running */ +- //-1代表后台还没启动 +- passwd_handler->backend_pid = -1; +- +- /* Initialize IO Channels */ +- passwd_handler->backend_stdin = NULL; +- passwd_handler->backend_stdout = NULL; +- +- /* Initialize write queue */ +- passwd_handler->backend_stdin_queue = g_queue_new (); +- +- /* Initialize watchers */ +- passwd_handler->backend_child_watch_id = 0; +- passwd_handler->backend_stdout_watch_id = 0; +- +- /* Initialize backend state */ +- passwd_handler->backend_state = PASSWD_STATE_NONE; +- passwd_handler->changing_password = FALSE; +- +- return passwd_handler; +-} +- +- +-void passwd_destroy (PasswdHandler *passwd_handler) +-{ +- g_queue_free (passwd_handler->backend_stdin_queue); +- stop_passwd (passwd_handler); +- g_free (passwd_handler); +-} +diff --git a/changeUserPwd/run-passwd.h b/changeUserPwd/run-passwd.h +deleted file mode 100644 +index 513d05b..0000000 +--- a/changeUserPwd/run-passwd.h ++++ /dev/null +@@ -1,34 +0,0 @@ +-#ifndef RUNPASSWD_H +-#define RUNPASSWD_H +- +- +-struct PasswdHandler; +- +-typedef struct PasswdHandler PasswdHandler; +- +-typedef void (*PasswdCallback) (PasswdHandler * passwd_handler, GError * error, const gpointer user_data); +- +-/* Error codes */ +-typedef enum { +- PASSWD_ERROR_REJECTED, /* New password is not secure enough */ +- PASSWD_ERROR_AUTH_FAILED, /* Wrong old password, or PAM failure */ +- PASSWD_ERROR_REAUTH_FAILED, /* Password has changed since first authentication */ +- PASSWD_ERROR_BACKEND, /* Backend error */ +- PASSWD_ERROR_UNKNOWN /* General error */ +-} PasswdError; +- +-PasswdHandler *passwd_init (); +- +-void passwd_destroy (PasswdHandler *passwd_handler); +- +-void passwd_authenticate (PasswdHandler *passwd_handler, +- const char *current_password, +- PasswdCallback cb, +- gpointer user_data); +- +-gboolean passwd_change_password (PasswdHandler *passwd_handler, +- const char *new_password, +- PasswdCallback cb, +- const gpointer user_data); +- +-#endif // RUNPASSWD_H +diff --git a/checkUserPwdWithPAM/checkUserPwd/auth-pam.cpp b/checkUserPwdWithPAM/checkUserPwd/auth-pam.cpp +index 7a2059d..c044ca8 100644 +--- a/checkUserPwdWithPAM/checkUserPwd/auth-pam.cpp ++++ b/checkUserPwdWithPAM/checkUserPwd/auth-pam.cpp +@@ -224,7 +224,7 @@ writeData(int fd, const void *buf, ssize_t count) + static void + writeString(int fd, const char *data) + { +- int length = data ? strlen(data) : -1; ++ int length = data ? strnlen(data, sizeof(data)) : -1; + writeData(fd, &length, sizeof(length)); + if(data) + writeData(fd, data, sizeof(char) * length); +@@ -277,6 +277,10 @@ void AuthPAM::_authenticate(const char *userName) + + authRet = pam_authenticate(pamh, 0); + ++ if (pam_acct_mgmt(pamh, 0) != PAM_SUCCESS) { ++ printf("pam_acct_mgmt failed\n"); ++ } ++ + ret = pam_get_item(pamh, PAM_USER, (const void **)&newUser); + if(ret != PAM_SUCCESS) + { +diff --git a/checkUserPwdWithPAM/childCheckPwdWithPAM/main.cpp b/checkUserPwdWithPAM/childCheckPwdWithPAM/main.cpp +index ed9d883..e8b3646 100644 +--- a/checkUserPwdWithPAM/childCheckPwdWithPAM/main.cpp ++++ b/checkUserPwdWithPAM/childCheckPwdWithPAM/main.cpp +@@ -43,7 +43,7 @@ writeData(int fd, const void *buf, ssize_t count) + static void + writeString(int fd, const char *data) + { +- int length = data ? strlen(data) : -1; ++ int length = data ? strnlen(data, sizeof(data)) : -1; + writeData(fd, &length, sizeof(length)); + if(data) + writeData(fd, data, sizeof(char) * length); +@@ -124,12 +124,18 @@ _authenticate(const char *userName) + + authRet = pam_authenticate(pamh, 0); + ++ if (pam_acct_mgmt(pamh, 0) != PAM_SUCCESS) { ++ printf("pam_acct_mgmt failed\n"); ++ } ++ + ret = pam_get_item(pamh, PAM_USER, (const void **)&newUser); + if(ret != PAM_SUCCESS) + { + pam_end(pamh, 0); + printf("failed to get username\n"); + } ++ ++ + free(newUser); + newUser = NULL; + // fprintf(stderr, "authentication result: %d\n", authRet); +diff --git a/plugins/account/userinfo/kylin-chkname.cpp b/plugins/account/userinfo/kylin-chkname.cpp +index 59477a7..85861ed 100644 +--- a/plugins/account/userinfo/kylin-chkname.cpp ++++ b/plugins/account/userinfo/kylin-chkname.cpp +@@ -26,9 +26,9 @@ static int reserve_check(const char *name) + } + + while (fgets(buf, USERNAME_MAXLEN+2, fp) != NULL) { +- if (!strlen(buf) || !strncmp(buf, "#", 1)) ++ if (!strnlen(buf, sizeof(buf)) || !strncmp(buf, "#", 1)) + continue; +- buf[strlen(buf) - 1] = '\0'; ++ buf[strnlen(buf, sizeof(buf)) - 1] = '\0'; + if (!strcmp(name, buf)) { + find = 1; + break; +@@ -54,7 +54,7 @@ int kylin_username_check(const char *name, int reserve) + if (name == NULL) + return NAME_ERROR; + +- if (strlen(name) == 0 || strlen(name) > USERNAME_MAXLEN) ++ if (strnlen(name, sizeof(name)) == 0 || strnlen(name, sizeof(name)) > USERNAME_MAXLEN) + return LENGTH_ERROR; + + if (reserve && reserve_check(name)) { +diff --git a/plugins/account/userinfo_intel/auth-pam.cpp b/plugins/account/userinfo_intel/auth-pam.cpp +deleted file mode 100644 +index 495710c..0000000 +--- a/plugins/account/userinfo_intel/auth-pam.cpp ++++ /dev/null +@@ -1,337 +0,0 @@ +-/* +- * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +- * +-**/ +-#include "auth-pam.h" +- +-#include <QDebug> +- +-#include <unistd.h> +-#include <wait.h> +-#include <sys/prctl.h> +-#define PAM_SERVICE_NAME "ukui-screensaver-qt" +- +-//通信管道的文件描述符 +-int toParent[2], toChild[2]; +- +-static void writeData(int fd, const void *buf, ssize_t count); +-static void writeString(int fd, const char *data); +-static int readData(int fd, void *buf, size_t count); +-static char * readString(int fd); +-static int pam_conversation(int msgLength, const struct pam_message **msg, +- PAM_RESPONSE **resp, void *appData); +-static void sigchld_handler(int signo); +- +-AuthPAM::AuthPAM(QObject *parent) +- : Auth(parent), +- pid(0), +- nPrompts(0), +- _isAuthenticated(false), +- _isAuthenticating(false) +-{ +- signal(SIGCHLD, sigchld_handler); +-} +- +-void AuthPAM::authenticate(const QString &userName) +-{ +- stopAuth(); +- +- if(pipe(toParent) || pipe(toChild)) +- qDebug()<< "create pipe failed: " << strerror(errno); +- if((pid = fork()) < 0) +- { +- qDebug() << "fork error: " << strerror(errno); +- } +- else if(pid == 0) +- { +- prctl(PR_SET_PDEATHSIG, SIGHUP); +- close(toParent[0]); +- close(toChild[1]); +- _authenticate(userName.toLocal8Bit().data()); +- } +- else +- { +- close(toParent[1]); +- close(toChild[0]); +- _isAuthenticating = true; +- notifier = new QSocketNotifier(toParent[0], QSocketNotifier::Read); +- connect(notifier, &QSocketNotifier::activated, this, &AuthPAM::onSockRead); +- } +-} +- +-void AuthPAM::stopAuth() +-{ +- if(pid != 0) +- { +- messageList.clear(); +- responseList.clear(); +- _isAuthenticating = false; +- _isAuthenticated = false; +- nPrompts = 0; +- +- ::kill(pid, SIGKILL); +- +- close(toParent[0]); +- close(toChild[1]); +- if(notifier){ +- notifier->deleteLater(); +- notifier = nullptr; +- } +- pid = 0; +- } +-} +- +-void AuthPAM::respond(const QString &response) +-{ +- nPrompts--; +- responseList.push_back(response); +- +-// for(auto msg : messageList) +-// qDebug() << msg.msg; +-// qDebug() << responseList; +- qDebug() << nPrompts; +- +- if(nPrompts == 0) +- { +- //发送响应到子进程 +- int j = 0; +- PAM_RESPONSE *resp = (PAM_RESPONSE*)calloc(messageList.size(), sizeof(PAM_RESPONSE)); +- //响应的数量和消息的数量一致,如果消息类型不是PROMPT,则响应是空的 +- for(int i = 0; i < messageList.size(); i++) +- { +- struct pam_message message = messageList[i]; +- PAM_RESPONSE *r = &resp[i]; +- if(message.msg_style == PAM_PROMPT_ECHO_OFF +- || message.msg_style == PAM_PROMPT_ECHO_ON) +- { +- int respLength = responseList[j].length() + 1; +- r->resp = (char *)malloc(sizeof(char) * respLength); +- memcpy(r->resp, responseList[j].toLocal8Bit().data(), respLength); +- j++; +- } +- } +- _respond(resp); +- free(resp); +- messageList.clear(); +- responseList.clear(); +- } +-} +- +-bool AuthPAM::isAuthenticated() +-{ +- return _isAuthenticated; +-} +- +-bool AuthPAM::isAuthenticating() +-{ +- return _isAuthenticating; +-} +- +- +-void AuthPAM::onSockRead() +-{ +-// qDebug() << "has message"; +- int msgLength; +- int authComplete; +- readData(toParent[0], &authComplete, sizeof(authComplete)); +- +- if(authComplete) +- { +- int authRet; +- if(readData(toParent[0], (void*)&authRet, sizeof(authRet)) <= 0) +- qDebug() << "get authentication result failed: " << strerror(errno); +- qDebug() << "result: " << authRet; +- _isAuthenticated = (authRet == PAM_SUCCESS); +- _isAuthenticating = false; +- if(notifier){ +- notifier->deleteLater(); +- notifier = nullptr; +- } +- Q_EMIT authenticateComplete(); +- +- } +- else +- { +- readData(toParent[0], &msgLength, sizeof(msgLength)); +-// qDebug() << "message length: " << msgLength; +- +- for(int i = 0; i < msgLength; i++) +- { +- //读取message +- struct pam_message message; +- readData(toParent[0], &message.msg_style, sizeof(message.msg_style)); +- message.msg = readString(toParent[0]); +- +- qDebug() << message.msg; +- +- messageList.push_back(message); +- +- switch (message.msg_style) +- { +- case PAM_PROMPT_ECHO_OFF: +- nPrompts++; +- Q_EMIT showPrompt(message.msg, Auth::PromptTypeSecret); +- break; +- case PAM_PROMPT_ECHO_ON: +- nPrompts++; +- Q_EMIT showPrompt(message.msg, Auth::PromptTypeQuestion); +- break; +- case PAM_ERROR_MSG: +- Q_EMIT showMessage(message.msg, Auth::MessageTypeInfo); +- break; +- case PAM_TEXT_INFO: +- Q_EMIT showMessage(message.msg, Auth::MessageTypeError); +- break; +- } +- } +- +- if(nPrompts == 0) +- { +- //不需要响应,发送一个空的 +- PAM_RESPONSE *response = (PAM_RESPONSE*)calloc(messageList.size(), sizeof(PAM_RESPONSE)); +- _respond(response); +- free(response); +- messageList.clear(); +- } +- } +-} +- +-static void +-writeData(int fd, const void *buf, ssize_t count) +-{ +- if(write(fd, buf, count) != count) +- qDebug() << "write to parent failed: " << strerror(errno); +-} +- +-static void +-writeString(int fd, const char *data) +-{ +- int length = data ? strlen(data) : -1; +- writeData(fd, &length, sizeof(length)); +- if(data) +- writeData(fd, data, sizeof(char) * length); +-} +- +-static int +-readData(int fd, void *buf, size_t count) +-{ +- ssize_t nRead = read(fd, buf, count); +- if(nRead < 0) +- qDebug() << "read data failed: " << strerror(errno); +- return nRead; +-} +- +-static char * +-readString(int fd) +-{ +- int length; +- +- if(readData(fd, &length, sizeof(length)) <= 0) +- return NULL; +- if(length <= 0) +- return NULL; +- +- char *value = (char *)malloc(sizeof(char) * (length + 1)); +- readData(fd, value, length); +- value[length] = '\0'; +- +- return value; +-} +- +-void AuthPAM::_authenticate(const char *userName) +-{ +- qDebug() << "authenticate " << userName; +- +- pam_handle_t *pamh = NULL; +- char *newUser; +- int ret; +- int authRet; +- struct pam_conv conv; +- +- conv.conv = pam_conversation; +- conv.appdata_ptr = NULL; +- +- ret = pam_start(PAM_SERVICE_NAME, userName, &conv, &pamh); +- if(ret != PAM_SUCCESS) +- { +- qDebug() << "failed to start PAM: " << pam_strerror(NULL, ret); +- } +- +- authRet = pam_authenticate(pamh, 0); +- +- ret = pam_get_item(pamh, PAM_USER, (const void **)&newUser); +- if(ret != PAM_SUCCESS) +- { +- pam_end(pamh, 0); +- qDebug() << "failed to get username"; +- } +- free(newUser); +- fprintf(stderr, "authentication result: %d\n", authRet); +- +- // 发送认证结果 +- int authComplete = 1; +- writeData(toParent[1], (const void*)&authComplete, sizeof(authComplete)); +- writeData(toParent[1], (const void *)&authRet, sizeof(authRet)); +- qDebug() << "--- 认证完成"; +- _exit(EXIT_SUCCESS); +-} +- +-void AuthPAM::_respond(const PAM_RESPONSE *response) +-{ +- for(int i = 0; i < messageList.size(); i++) +- { +- const PAM_RESPONSE *resp = &response[i]; +- writeData(toChild[1], (const void *)&resp->resp_retcode, +- sizeof(resp->resp_retcode)); +- writeString(toChild[1], resp->resp); +- } +-} +- +- +-static int +-pam_conversation(int msgLength, const struct pam_message **msg, +- PAM_RESPONSE **resp, void */*appData*/) +-{ +- PAM_RESPONSE *response = (PAM_RESPONSE*)calloc(msgLength,sizeof(PAM_RESPONSE)); +- +- int authComplete = 0; +- writeData(toParent[1], (const void*)&authComplete, sizeof(authComplete)); +- writeData(toParent[1], (const void*)&msgLength, sizeof(msgLength)); +- //发送pam消息 +- for(int i = 0; i < msgLength; i++) +- { +- const struct pam_message *m = msg[i]; +- writeData(toParent[1], (const void *)&m->msg_style, sizeof(m->msg_style)); +- writeString(toParent[1], m->msg); +- } +- //读取响应 +- for(int i = 0; i < msgLength; i++) +- { +- PAM_RESPONSE *r = &response[i]; +- readData(toChild[0], &r->resp_retcode, sizeof(r->resp_retcode)); +- r->resp = readString(toChild[0]); +- } +- *resp = response; +- return PAM_SUCCESS; +-} +- +-void sigchld_handler(int signo) +-{ +- if(signo == SIGCHLD) +- { +- ::waitpid(-1, NULL, WNOHANG); +- } +-} +diff --git a/plugins/account/userinfo_intel/auth-pam.h b/plugins/account/userinfo_intel/auth-pam.h +deleted file mode 100644 +index 3fba36c..0000000 +--- a/plugins/account/userinfo_intel/auth-pam.h ++++ /dev/null +@@ -1,59 +0,0 @@ +-/* +- * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +- * +-**/ +-#ifndef AUTHPAM_H +-#define AUTHPAM_H +-#include "auth.h" +-#include <QSocketNotifier> +-#include <QList> +- +-#include <security/pam_appl.h> +- +-typedef struct pam_message PAM_MESSAGE; +-typedef struct pam_response PAM_RESPONSE; +- +-class AuthPAM : public Auth +-{ +- Q_OBJECT +-public: +- AuthPAM(QObject *parent = nullptr); +- +- void authenticate(const QString &userName); +- void stopAuth(); +- void respond(const QString &response); +- bool isAuthenticated(); +- bool isAuthenticating(); +- +-private: +- void _authenticate(const char *userName); +- void _respond(const struct pam_response *response); +- +-private Q_SLOTS: +- void onSockRead(); +- +-private: +- QString userName; +- pid_t pid; +- QSocketNotifier *notifier; +- int nPrompts; +- QStringList responseList; +- QList<PAM_MESSAGE> messageList; +- bool _isAuthenticated; //认证结果 +- bool _isAuthenticating; +-}; +- +-#endif // AUTHPAM_H +diff --git a/plugins/account/userinfo_intel/auth.h b/plugins/account/userinfo_intel/auth.h +deleted file mode 100644 +index b2f8193..0000000 +--- a/plugins/account/userinfo_intel/auth.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* +- * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +- * +-**/ +-#ifndef AUTH_H +-#define AUTH_H +- +-#ifndef QT_NO_KEYWORDS +-#define QT_NO_KEYWORDS +-#endif +- +-#include <QObject> +- +-class Auth : public QObject +-{ +- Q_OBJECT +- +- Q_ENUMS(PromptType MessageType) +-public: +- explicit Auth(QObject *parent = nullptr) +- : QObject(parent) +- { +- +- } +- +- enum PromptType { +- PromptTypeQuestion, +- PromptTypeSecret +- }; +- enum MessageType { +- MessageTypeInfo, +- MessageTypeError +- }; +- +- +-Q_SIGNALS: +- void showPrompt(const QString &prompt, Auth::PromptType type); +- void showMessage(const QString &message, Auth::MessageType type); +- void authenticateComplete(); +- +-public: +- virtual void authenticate(const QString &userName) = 0; +- virtual void stopAuth() = 0; +- virtual void respond(const QString &response) = 0; +- virtual bool isAuthenticating() = 0; +- virtual bool isAuthenticated() = 0; +-}; +- +-#endif // AUTH_H +diff --git a/plugins/account/userinfo_intel/changefaceinteldialog.cpp b/plugins/account/userinfo_intel/changefaceinteldialog.cpp +deleted file mode 100644 +index 1bf77c8..0000000 +--- a/plugins/account/userinfo_intel/changefaceinteldialog.cpp ++++ /dev/null +@@ -1,471 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "changefaceinteldialog.h" +-#include "ui_changefaceinteldialog.h" +- +-#include "flowlayout.h" +-#include "elipsemaskwidget.h" +- +-#include <QDebug> +-#include <QMessageBox> +-#include <QFile> +- +-#define FACEPATH "/usr/share/ukui/faces/" +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-ChangeFaceIntelDialog::ChangeFaceIntelDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::ChangeFaceIntelDialog) +-{ +- ui->setupUi(this); +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- //~ contents_path /UserinfoIntel/Change User Face +- ui->titleLabel->setText(tr("Change User Face")); +- +- ui->titleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); +- m_closeBtn = new QPushButton(this); +- m_closeBtn->setProperty("useIconHighlightEffect", true); +- m_closeBtn->setProperty("iconHighlightEffectMode", 1); +- m_closeBtn->setFlat(true); +- m_closeBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/close.svg")); +- m_closeBtn->setFixedSize(36, 36); +- m_closeBtn->setAutoDefault(false); +- ui->horizontalLayout_2->addWidget(m_closeBtn); +- +-// //分割线,其颜色应由主题控制,此处设置样式仅为预览布局效果 +-// ui->line_1->setStyleSheet(".QWidget{background: rgba(66,77,89,1); ipacity: 0.1;}"); +-// ui->line_2->setStyleSheet(".QWidget{background: rgba(66,77,89,1); ipacity: 0.1;}"); +- +-// ui->frame->setStyleSheet("QFrame{background: #ffffff; border: none; border-radius: 6px;}"); +-// ui->closeBtn->setStyleSheet("QPushButton{background: #ffffff; border: none;}"); +- +- ui->historyFacesWidget->setContentsMargins(2,0,0,0); +- +- historyFacesFlowLayout = new FlowLayout(ui->historyFacesWidget); +- ui->historyFacesWidget->setLayout(historyFacesFlowLayout); +- +- const QByteArray id_1(UKUI_QT_STYLE); +- if (QGSettings::isSchemaInstalled(id_1)) { +- m_style = new QGSettings(id_1); +- QString themeName = m_style->get(UKUI_STYLE_KEY).toString(); +- if( themeName == "ukui-light" || themeName == "ukui-default" | themeName == "ukui" ) +- m_isNightMode = false; +- else +- m_isNightMode = true; +- qDebug() << "m_isNightMode = " << m_isNightMode; +- connect(m_style, &QGSettings::changed, this, &ChangeFaceIntelDialog::getThemeStyle); +- } +- +- btnsGroup = new QButtonGroup; +-// ElipseMaskWidget * cfMaskWidget = new ElipseMaskWidget(ui->faceLabel); +-//// cfMaskWidget->setBgColor("#F4F4F4"); +-// cfMaskWidget->setGeometry(0, 0, ui->faceLabel->width(), ui->faceLabel->height()); +- +- loadSystemFaces(); +- +- connect(m_closeBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +- connect(ui->cancelBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +-// connect(ui->customfaceBtn, &QPushButton::clicked, [=]{ +-// showLocalFaceDialog(); +-// }); +-} +- +-ChangeFaceIntelDialog::~ChangeFaceIntelDialog() +-{ +- delete ui; +-} +- +-void ChangeFaceIntelDialog::getThemeStyle(QString key) +-{ +- if(key == "styleName") { +- QString themeName = m_style->get(UKUI_STYLE_KEY).toString(); +- if( themeName == "ukui-light" || themeName == "ukui-default" | themeName == "ukui" ) +- m_isNightMode = false; +- else +- m_isNightMode = true; +- qDebug() << "m_isNightMode = " << m_isNightMode; +- update(); +- } +-} +- +-void ChangeFaceIntelDialog::loadSystemFaces(){ +- +- ui->facesWidget->setContentsMargins(0,4,0,0); +- +- FlowLayout * facesFlowLayout = new FlowLayout(ui->facesWidget); +- ui->facesWidget->setLayout(facesFlowLayout); +- +- //遍历头像目录 +- QStringList facesList; +- QDir facesDir = QDir(FACEPATH); +- foreach (QString filename, facesDir.entryList(QDir::Files)){ +-// facesList.append(FACEPATH + filename); +- QString fullface = QString("%1%2").arg(FACEPATH).arg(filename); +- +- if (fullface.endsWith("commercial.png") || fullface.endsWith("community.png")) +- continue; +- +- QPushButton * button = new QPushButton; +- button->setStyleSheet("background-color:transparent"); +- button->setCheckable(true); +- button->setAttribute(Qt::WA_DeleteOnClose); +- button->setFixedSize(QSize(56, 56)); +-// button->setStyleSheet("QPushButton{border: none;}"); +- button->setAutoDefault(false); +- btnsGroup->addButton(button); +- +- QHBoxLayout * mainHorLayout = new QHBoxLayout(button); +- mainHorLayout->setSpacing(0); +- mainHorLayout->setMargin(0); +- QLabel * iconLabel = new QLabel(button); +- iconLabel->setScaledContents(true); +- iconLabel->setPixmap(QPixmap(fullface)); +- +- mainHorLayout->addWidget(iconLabel); +- +- button->setLayout(mainHorLayout); +- +- connect(button, &QPushButton::clicked, [=]{ +- //show dialog更新头像 +- setFace(fullface); +- confirmFile = fullface; +- ui->confirmBtn->setStyleSheet("background-color:#2FB3EB"); +-// emit face_file_send(fullface, m_username); +- }); +- connect(ui->confirmBtn, &QPushButton::clicked, [=]{ +-// qDebug()<<confirmFile; +- if (confirmFile != "") { +- emit face_file_send(confirmFile, m_username); +- this->close(); +- } +- }); +- +- facesFlowLayout->addWidget(button); +- } +-} +- +-void ChangeFaceIntelDialog::loadHistoryFaces(){ +- if (historyFacesFlowLayout->layout() != NULL) { +- QLayoutItem* item; +- while ((item = historyFacesFlowLayout->layout()->takeAt( 0 )) != NULL ) +- { +- delete item->widget(); +- delete item; +- } +-// delete ui->availableLayout->layout(); +- } +- //给每个历史头像创建组件 +- for(int i = historyCount; i > 0; i--){ +- QString historyface = QString("%1/%2.face").arg(historyFacesPath).arg(i); +-// qDebug()<<"load:"<<historyface; +- QPushButton * button = new QPushButton; +- button->setAttribute(Qt::WA_DeleteOnClose); +- button->setFixedSize(QSize(56, 56)); +-// button->setStyleSheet("QPushButton{border: none;}"); +- +- QHBoxLayout * mainHorLayout = new QHBoxLayout(button); +- mainHorLayout->setSpacing(0); +- mainHorLayout->setMargin(0); +- QLabel * iconLabel = new QLabel(button); +- iconLabel->setScaledContents(true); +-// iconLabel->setPixmap(QPixmap(historyface)); +- button->setStyleSheet(QString("QPushButton{border-radius: 4px; border-image:url(%1);}").arg(historyface)); +-// ElipseMaskWidget * cpMaskWidget = new ElipseMaskWidget(button); +-// cpMaskWidget->setGeometry(0, 0, 56, 56); +- QPushButton * delBtn = new QPushButton; +- delBtn->setFixedSize(16,16); +- //delBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/delete.png")); +- QHBoxLayout * delBtnLayout = new QHBoxLayout(iconLabel); +- delBtnLayout->setSpacing(0); +- +- QHBoxLayout * delBtnHorLayout = new QHBoxLayout(button); +- delBtnHorLayout->setSpacing(0); +- delBtnHorLayout->setMargin(0); +- QLabel * delBtnLabel = new QLabel(delBtn); +- delBtnLabel->setScaledContents(true); +- delBtnLabel->setPixmap(QPixmap(":/img/plugins/userinfo_intel/delete.png")); +- +- delBtnLayout->addStretch(); +- delBtnLayout->addWidget(delBtn); +- delBtnLayout->setContentsMargins(0,0,0,50); +- +- mainHorLayout->addWidget(iconLabel); +- iconLabel->setLayout(delBtnLayout); +- delBtn->hide(); +- connect(delBtn, &QPushButton::clicked, this, [=]{ +- sysinterface = new QDBusInterface("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- if (!sysinterface->isValid()){ +- qCritical() << "Create Client Interface Failed When Copy Face File: " << QDBusConnection::systemBus().lastError(); +- return; +- } +- QString cmd = QString("rm %1/%2.face").arg(historyFacesPath).arg(i); +- historyCount--; +- sysinterface->call("systemRun", QVariant(cmd)); +- for(int j = i + 1; j <= 4; j++){ +- qDebug()<<j<<" to "<<j-1; +- cmd = QString("mv %1/%2.face %1/%3.face").arg(historyFacesPath).arg(j).arg(j-1); +- sysinterface->call("systemRun", QVariant(cmd)); +- } +- loadHistoryFaces(); +- +- old_delBtn = nullptr; +- }); +- if (m_isNightMode) { +- ui->confirmBtn->setStyleSheet("background-color:#404040"); +- } else { +- ui->confirmBtn->setStyleSheet("background-color:#DDDDDD"); +- } +- button->setLayout(mainHorLayout); +- historyFacesFlowLayout->addWidget(button); +- connect(button, &QPushButton::clicked, this, [=]{ +- setFace(historyface); +- confirmFile = historyface; +- +- delBtn->show(); +- ui->confirmBtn->setStyleSheet("background-color:#2FB3EB"); +- if (old_delBtn != nullptr && old_delBtn != delBtn) { +- old_delBtn->hide(); +- old_delBtn = delBtn; +- } +- +- if (old_delBtn == nullptr) { +- old_delBtn = delBtn; +- } +- +- }); +- } +- +- //添加本地头像按钮 +- QPushButton * addBtn = new QPushButton; +- addBtn->setAttribute(Qt::WA_DeleteOnClose); +- addBtn->setFixedSize(QSize(56, 56)); +- QPixmap addpix; +- if (m_isNightMode) { +- addpix = ImageUtil::loadSvg("://img/titlebar/add.svg", "white", 16); +- } else { +- addpix = ImageUtil::loadSvg("://img/titlebar/add.svg", "black", 16); +- } +- +- QIcon ButtonIcon(addpix); +- addBtn->setIcon(QIcon(ButtonIcon)); +- addBtn->setAutoDefault(false); +- historyFacesFlowLayout->addWidget(addBtn); +- connect(addBtn, &QPushButton::clicked, this, [=]{ +- showLocalFaceDialog(); +- old_delBtn = nullptr; +- }); +-} +- +-void ChangeFaceIntelDialog::setFace(QString iconfile){ +- QPixmap rect = pixmapAdjustLabel(iconfile); +- ui->faceLabel->setPixmap(PixmapToRound(rect, ui->faceLabel->width()/2)); +-} +- +-QPixmap ChangeFaceIntelDialog::pixmapAdjustLabel(QString iconfile) +-{ +- //设置用户头像 +- QPixmap iconcop = QPixmap(iconfile); +- if (iconcop.width() > iconcop.height()) { +- QPixmap iconPixmap = iconcop.copy((iconcop.width() - iconcop.height())/2, 0, iconcop.height(), iconcop.height()); +- // 根据label高度等比例缩放图片 +- QPixmap rectPixmap = iconPixmap.scaledToHeight(ui->faceLabel->height()); +- return rectPixmap; +- } else { +- QPixmap iconPixmap = iconcop.copy(0, (iconcop.height() - iconcop.width())/2, iconcop.width(), iconcop.width()); +- // 根据label宽度等比例缩放图片 +- QPixmap rectPixmap = iconPixmap.scaledToWidth(ui->faceLabel->width()); +- return rectPixmap; +- } +-} +- +-void ChangeFaceIntelDialog::setRealname(QString realname){ +- QFontMetrics fontMetrics1(ui->usernameLabel->font()); +- QString formatRealName = fontMetrics1.elidedText(realname, Qt::ElideRight, 230); +- ui->usernameLabel->setText(formatRealName); +-} +- +-void ChangeFaceIntelDialog::setUsername(QString username){ +- m_username = username; +-} +- +-void ChangeFaceIntelDialog::setAccountType(QString atype){ +- ui->typeLabel->setText(atype); +-} +- +-void ChangeFaceIntelDialog::setHistoryFacesPath(QString path){ +- historyFacesPath = path; +- QDir historyFacesDir; +- historyFacesDir.setPath(historyFacesPath); +- if (historyFacesDir.exists("4.face")){ +- qDebug()<<"4 hisotry faces"; +- historyCount = 4; +- } else if(historyFacesDir.exists("3.face")) { +- qDebug()<<"3 hisotry faces"; +- historyCount = 3; +- } else if(historyFacesDir.exists("2.face")) { +- qDebug()<<"2 hisotry faces"; +- historyCount = 2; +- } else if(historyFacesDir.exists("1.face")) { +- qDebug()<<"1 hisotry faces"; +- historyCount = 1; +- } else { +- qDebug()<<"0 hisotry faces"; +- historyCount = 0; +- } +- loadHistoryFaces(); +-} +- +-void ChangeFaceIntelDialog::showLocalFaceDialog(){ +- QString filters = "Face files(*.png *.jpg *.svg)"; +- QFileDialog fd; +- fd.setDirectory(QString(const_cast<char *>(g_get_user_special_dir(G_USER_DIRECTORY_PICTURES)))); +- fd.setAcceptMode(QFileDialog::AcceptOpen); +- fd.setViewMode(QFileDialog::List); +- fd.setNameFilter(filters); +- fd.setFileMode(QFileDialog::ExistingFile); +- fd.setWindowTitle(tr("select custom face file")); +- fd.setLabelText(QFileDialog::Accept, tr("Select")); +- fd.setLabelText(QFileDialog::LookIn, tr("Position: ")); +- fd.setLabelText(QFileDialog::FileName, tr("FileName: ")); +- fd.setLabelText(QFileDialog::FileType, tr("FileType: ")); +- fd.setLabelText(QFileDialog::Reject, tr("Cancel")); +- +- if (fd.exec() != QDialog::Accepted) +- return; +- +- QString selectedfile; +- selectedfile = fd.selectedFiles().first();; +-// QString fileurl = fd.selectedUrls().first().toEncoded(); +-// QString filepath = fileurl.right(fileurl.length() - 7); +- +- QFile pic(selectedfile); +- int size = pic.size(); +- +- if (size >= 2097152) { +- QMessageBox::warning(this, tr("Warning"), tr("The avatar is larger than 2M, please choose again")); +- return; +- } +- +- setFace(selectedfile); +- confirmFile = selectedfile; +- //emit face_file_send(selectedfile, m_username); +- +- //添加本地头像后,将此头像copy到历史头像文件夹,再自动刷新历史头像列表 +- sysinterface = new QDBusInterface("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- if (!sysinterface->isValid()){ +- qCritical() << "Create Client Interface Failed When Copy Face File: " << QDBusConnection::systemBus().lastError(); +- return; +- } +- +- if(historyCount < 4){ +- historyCount ++; +- } else { +- //删除最早添加的1.face文件,把2、3、4重命名为1、2、3, +- QString cmd = QString("rm %1/1.face").arg(historyFacesPath); +- sysinterface->call("systemRun", QVariant(cmd)); +- cmd = QString("mv %1/2.face %1/1.face").arg(historyFacesPath); +- sysinterface->call("systemRun", QVariant(cmd)); +- cmd = QString("mv %1/3.face %1/2.face").arg(historyFacesPath); +- sysinterface->call("systemRun", QVariant(cmd)); +- cmd = QString("mv %1/4.face %1/3.face").arg(historyFacesPath); +- sysinterface->call("systemRun", QVariant(cmd)); +- } +-// QString cp_cmd = QString("cp %1 %2/%3.face").arg(selectedfile).arg(historyFacesPath).arg(historyCount); +-// qDebug()<<cp_cmd; +-// qDebug()<<QVariant(cp_cmd); +-// sysinterface->call("systemRun", QVariant(cp_cmd)); +- //由于systemRun方法传输的指令不支持中文路径,换用QFile的copy方法执行文件拷贝 +- QFile *cp_file = new QFile(); +- cp_file->copy(selectedfile, QString("%2/%3.face").arg(historyFacesPath).arg(historyCount)); +- loadHistoryFaces(); +-} +- +-QPixmap ChangeFaceIntelDialog::PixmapToRound(const QPixmap &src, int radius) { +- if (src.isNull()) { +- return QPixmap(); +- } +- QPixmap pixmapa(src); +- QPixmap pixmap(radius*2,radius*2); +- pixmap.fill(Qt::transparent); +- QPainter painter(&pixmap); +- painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- QPainterPath path; +- path.addEllipse(0, 0, radius*2, radius*2); +- painter.setClipPath(path); +- painter.drawPixmap(0, 0, radius*2, radius*2, pixmapa); +- return pixmap; +-} +- +-void ChangeFaceIntelDialog::paintEvent(QPaintEvent *event) { +- Q_UNUSED(event) +- +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 16, 16); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 16, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +-} +diff --git a/plugins/account/userinfo_intel/changefaceinteldialog.h b/plugins/account/userinfo_intel/changefaceinteldialog.h +deleted file mode 100644 +index d4e73c6..0000000 +--- a/plugins/account/userinfo_intel/changefaceinteldialog.h ++++ /dev/null +@@ -1,101 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef CHANGEFACEINTELDIALOG_H +-#define CHANGEFACEINTELDIALOG_H +- +-#include <QDialog> +-#include <QObject> +-#include <QDir> +-#include <QListWidgetItem> +-#include <QFileDialog> +-#include <QPainter> +-#include <QPainterPath> +-#include <QDBusInterface> +-#include <QDBusReply> +-#include "flowlayout.h" +-#include <QButtonGroup> +-#include <QGSettings/QGSettings> +-#include "imageutil.h" +- +-#define UKUI_QT_STYLE "org.ukui.style" +-#define UKUI_STYLE_KEY "style-name" +- +-/* qt会将glib里的signals成员识别为宏,所以取消该宏 +- * 后面如果用到signals时,使用Q_SIGNALS代替即可 +- **/ +-#ifdef signals +-#undef signals +-#endif +- +-extern "C" { +-#include <glib.h> +-#include <gio/gio.h> +-} +- +-namespace Ui { +-class ChangeFaceIntelDialog; +-} +- +-class ChangeFaceIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit ChangeFaceIntelDialog(QWidget *parent = 0); +- ~ChangeFaceIntelDialog(); +- +- void setFace(QString iconfile); +- void setUsername(QString username); +- void setRealname(QString realname); +- void setAccountType(QString atype); +- void setHistoryFacesPath(QString path); +- +- void loadSystemFaces(); +- +- void showLocalFaceDialog(); +- +- QMap<QString, QListWidgetItem *> delitemMap; +- +- QString confirmFile; +- void loadHistoryFaces(); +- QString historyFacesPath; +- QDBusInterface * sysinterface; +- int historyCount; +- FlowLayout * historyFacesFlowLayout; +- +-protected: +- void paintEvent(QPaintEvent *); +- +-private: +- Ui::ChangeFaceIntelDialog *ui; +- QString m_username; +- QPixmap PixmapToRound(const QPixmap &src, int radius); +- QButtonGroup *btnsGroup; +- QPushButton *old_delBtn = nullptr; +- QPixmap pixmapAdjustLabel(QString iconfile); +- QPushButton *m_closeBtn; +- bool m_isNightMode; +- QGSettings *m_style = nullptr; +- void getThemeStyle(QString key); +-Q_SIGNALS: +- void face_file_send(QString file, QString username); +-}; +- +-#endif // CHANGEFACEINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/changefaceinteldialog.ui b/plugins/account/userinfo_intel/changefaceinteldialog.ui +deleted file mode 100644 +index 8a749a1..0000000 +--- a/plugins/account/userinfo_intel/changefaceinteldialog.ui ++++ /dev/null +@@ -1,531 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>ChangeFaceIntelDialog</class> +- <widget class="QDialog" name="ChangeFaceIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>380</width> +- <height>530</height> +- </rect> +- </property> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>380</width> +- <height>530</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>380</width> +- <height>530</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Change Face</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="leftMargin"> +- <number>9</number> +- </property> +- <property name="rightMargin"> +- <number>9</number> +- </property> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>24</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>24</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <pointsize>13</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>Change User Face</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>193</width> +- <height>13</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="minimumSize"> +- <size> +- <width>362</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>362</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>15</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>15</number> +- </property> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="leftMargin"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="faceLabel"> +- <property name="minimumSize"> +- <size> +- <width>56</width> +- <height>56</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>56</width> +- <height>56</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <property name="scaledContents"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_8"> +- <property name="spacing"> +- <number>2</number> +- </property> +- <item> +- <widget class="QLabel" name="usernameLabel"> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="typeLabel"> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>24</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>8</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>64</width> +- <height>18</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>64</width> +- <height>18</height> +- </size> +- </property> +- <property name="text"> +- <string>History</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="Line" name="line_2"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>1</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>1</height> +- </size> +- </property> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>8</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QWidget" name="historyFacesWidget" native="true"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>330</width> +- <height>70</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>330</width> +- <height>70</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>16</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>8</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>64</width> +- <height>18</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>64</width> +- <height>18</height> +- </size> +- </property> +- <property name="text"> +- <string>System</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="Line" name="line"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>1</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>1</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>1</height> +- </size> +- </property> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QWidget" name="facesWidget" native="true"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>330</width> +- <height>136</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>330</width> +- <height>136</height> +- </size> +- </property> +- <property name="layoutDirection"> +- <enum>Qt::LeftToRight</enum> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>9</number> +- </property> +- <property name="topMargin"> +- <number>40</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>9</number> +- </property> +- <item> +- <widget class="QPushButton" name="cancelBtn"> +- <property name="minimumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>Cancel</string> +- </property> +- <property name="autoDefault"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>24</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="confirmBtn"> +- <property name="minimumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>Confirm</string> +- </property> +- <property name="autoDefault"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/account/userinfo_intel/changegroupinteldialog.cpp b/plugins/account/userinfo_intel/changegroupinteldialog.cpp +deleted file mode 100644 +index 4446fc9..0000000 +--- a/plugins/account/userinfo_intel/changegroupinteldialog.cpp ++++ /dev/null +@@ -1,223 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2020 KYLINOS Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +- +-#include "changegroupinteldialog.h" +-#include "ui_changegroupinteldialog.h" +-#include "definegroupitemintel.h" +-#include "imageutil.h" +-//#include "group_manager_client.h" +-#include "creategroupinteldialog.h" +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-ChangeGroupIntelDialog::ChangeGroupIntelDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::ChangeGroupIntelDialog) +-{ +- ui->setupUi(this); +- setupInit(); +- signalsBind(); +-} +- +-ChangeGroupIntelDialog::~ChangeGroupIntelDialog() +-{ +- delete ui; +-} +- +-void ChangeGroupIntelDialog::showCreateGroupDialog() +-{ +- CreateGroupIntelDialog *dialog = new CreateGroupIntelDialog; +- dialog->exec(); +- +-} +- +-void ChangeGroupIntelDialog::loadGroupInfo() +-{ +-// group_manager_client demo; +-// demo.value = demo.get_group_info(); +-// qDebug() << "load group info" << demo.value->at(0)->groupname << demo.value->at(0)->groupid; +- //设置ListWidget是否可以自动排序,默认是false +- //list_widget->setSortingEnabled(true); +-} +- +-void ChangeGroupIntelDialog::setupInit() +-{ +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- initNewGroupBtn(); +- +- loadGroupInfo(); +- +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- ui->titleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); +- //ui->titleLabel_2->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); +- ui->closeBtn->setProperty("useIconHighlightEffect", true); +- ui->closeBtn->setProperty("iconHighlightEffectMode", 1); +- ui->closeBtn->setFlat(true); +- +- ui->closeBtn->setStyleSheet("QPushButton:hover:!pressed#closeBtn{background: #FA6056; border-radius: 4px;}" +- "QPushButton:hover:pressed#closeBtn{background: #E54A50; border-radius: 4px;}"); +- +- +- ui->listWidget->setFocusPolicy(Qt::NoFocus); +- ui->listWidget->setSelectionMode(QAbstractItemView::NoSelection); +- ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +- ui->listWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +- ui->listWidget->setSpacing(1); +- +- DefineGroupItemIntel * singleWidget = new DefineGroupItemIntel("aaa"); +- singleWidget->setDeleteable(true); +- singleWidget->setUpdateable(true); +- singleWidget->setEditable(true); +- singleWidget->setFrameShape(QFrame::Shape::Box); +- singleWidget->setProperty("userData", true); +- +- QListWidgetItem * item = new QListWidgetItem(ui->listWidget); +- item->setSizeHint(QSize(ui->listWidget->width() - 5, 50)); +- item->setData(Qt::UserRole, ""); +- ui->listWidget->setItemWidget(item, singleWidget); +-} +- +-void ChangeGroupIntelDialog::signalsBind() +-{ +- connect(ui->closeBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +-} +- +-void ChangeGroupIntelDialog::initNewGroupBtn() +-{ +- addWgt = new HoverWidget(""); +- addWgt->setObjectName("addwgt"); +- addWgt->setMinimumSize(QSize(454, 50)); +- addWgt->setMaximumSize(QSize(454, 50)); +- addWgt->setStyleSheet("HoverWidget#addwgt{background: palette(base); border-radius: 4px;}HoverWidget:hover:!pressed#addwgt{background: #2FB3E8; border-radius: 4px;}"); +- +- QHBoxLayout *addLyt = new QHBoxLayout; +- +- QLabel * iconLabel = new QLabel(); +- QLabel * textLabel = new QLabel(tr("Add user group")); +- QPixmap pixgray = ImageUtil::loadSvg(":/img/titlebar/add.svg", "black", 12); +- iconLabel->setPixmap(pixgray); +- addLyt->addWidget(iconLabel); +- addLyt->addWidget(textLabel); +- addLyt->addStretch(); +- addWgt->setLayout(addLyt); +- +- // 悬浮改变Widget状态 +- connect(addWgt, &HoverWidget::enterWidget, this, [=](QString mname){ +- QPixmap pixgray = ImageUtil::loadSvg(":/img/titlebar/add.svg", "white", 12); +- iconLabel->setPixmap(pixgray); +- textLabel->setStyleSheet("color: palette(base);"); +- +- }); +- // 还原状态 +- connect(addWgt, &HoverWidget::leaveWidget, this, [=](QString mname){ +- QPixmap pixgray = ImageUtil::loadSvg(":/img/titlebar/add.svg", "black", 12); +- iconLabel->setPixmap(pixgray); +- textLabel->setStyleSheet("color: palette(windowText);"); +- }); +- +- connect(addWgt, &HoverWidget::widgetClicked, this, [=](QString mname){ +- showCreateGroupDialog(); +- }); +- ui->addLyt->addWidget(addWgt); +-} +- +-void ChangeGroupIntelDialog::initGeneralItemsStyle(){ +- initItemsStyle(ui->listWidget); +-} +- +-void ChangeGroupIntelDialog::initItemsStyle(QListWidget *listWidget){ +- int total = listWidget->count(); +- for (int row = 0; row < total; row++){ +- QString style; +- QString subStyle; +- if (1 == total){ //总数为1 +- style = "QWidget{background: #F4F4F4; border: none; border-radius: 6px;}"; +- subStyle = "background: #F4F4F4; border: none; border-radius: 4px;"; +- } else if (0 == row && (row % 2 == 0)){ //首位 +- style = "QWidget{background: #F4F4F4; border: none; border-top-left-radius: 6px; border-top-right-radius: 6px;}"; +- subStyle = "background: #F4F4F4; border: none; border-radius: 4px;"; +- } else if (total - 1 == row){ //末位 +- if (0 == row % 2){ +- style = "QWidget{background: #F4F4F4; border: none; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px;}"; +- subStyle = "background: #F4F4F4; border: none; border-radius: 4px;"; +- } else { +- style = "QWidget{background: #EEEEEE; border: none; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px;}"; +- subStyle = "background: #EEEEEE; border: none; border-radius: 4px;"; +- } +- } else if (row % 2 == 0){ +- style = "QWidget{background: #F4F4F4; border: none;}"; +- subStyle = "background: #F4F4F4; border: none; border-radius: 4px;"; +- } else if (row % 2 != 0){ +- style = "QWidget{background: #EEEEEE; border: none;}"; +- subStyle = "background: #EEEEEE; border: none; border-radius: 4px;"; +- } +- +- QWidget * widget = listWidget->itemWidget(listWidget->item(row)); +- DefineGroupItemIntel * pShortcutItem = dynamic_cast<DefineGroupItemIntel *>(widget); +-// pShortcutItem->widgetComponent()->setStyleSheet(style); +-// pShortcutItem->btnComponent()->setStyleSheet(subStyle); +- } +-} +- +-void ChangeGroupIntelDialog::paintEvent(QPaintEvent * event){ +- Q_UNUSED(event) +- +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 6, 6); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +-} +diff --git a/plugins/account/userinfo_intel/changegroupinteldialog.h b/plugins/account/userinfo_intel/changegroupinteldialog.h +deleted file mode 100644 +index 933ce68..0000000 +--- a/plugins/account/userinfo_intel/changegroupinteldialog.h ++++ /dev/null +@@ -1,74 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2020 KYLINOS Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +- +-#ifndef CHANGEGROUPINTELDIALOG_H +-#define CHANGEGROUPINTELDIALOG_H +- +-#include <QDialog> +-#include <QPainter> +-#include <QPainterPath> +-#include <QListWidget> +-#include <QDebug> +- +-#include "hoverwidget.h" +- +-//struct custom_struct +-//{ +-// QString groupname; +-// QString passphrase; +-// QString groupid; +-// QString usergroup; +-//}; +- +-namespace Ui { +-class ChangeGroupIntelDialog; +-} +- +-class ChangeGroupIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit ChangeGroupIntelDialog(QWidget *parent = nullptr); +- ~ChangeGroupIntelDialog(); +- +-public: +- void initGeneralItemsStyle(); +- void initItemsStyle(QListWidget * listWidget); +- void initNewGroupBtn(); +- void loadGroupInfo(); +- void showCreateGroupDialog(); +- +-protected: +- void paintEvent(QPaintEvent * event); +- +-private: +- Ui::ChangeGroupIntelDialog *ui; +- +- HoverWidget *addWgt; +- //QList<custom_struct *> *value; +- +- void setupInit(); +- void signalsBind(); +- +- +-}; +- +-#endif // CHANGEGROUPINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/changegroupinteldialog.ui b/plugins/account/userinfo_intel/changegroupinteldialog.ui +deleted file mode 100644 +index 6af4554..0000000 +--- a/plugins/account/userinfo_intel/changegroupinteldialog.ui ++++ /dev/null +@@ -1,237 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>ChangeGroupIntelDialog</class> +- <widget class="QDialog" name="ChangeGroupIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>540</width> +- <height>645</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>540</width> +- <height>645</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>540</width> +- <height>645</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <widget class="QFrame" name="frame"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>1</y> +- <width>541</width> +- <height>641</height> +- </rect> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <widget class="QWidget" name="layoutWidget"> +- <property name="geometry"> +- <rect> +- <x>1</x> +- <y>10</y> +- <width>541</width> +- <height>632</height> +- </rect> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="leftMargin"> +- <number>32</number> +- </property> +- <property name="rightMargin"> +- <number>15</number> +- </property> +- <property name="bottomMargin"> +- <number>49</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="closeBtn"> +- <property name="minimumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="rightMargin"> +- <number>33</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>24</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>User Group Settings</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <item> +- <widget class="QLabel" name="titleLabel_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>User groups available in the system</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QListWidget" name="listWidget"> +- <property name="minimumSize"> +- <size> +- <width>455</width> +- <height>400</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>455</width> +- <height>400</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="addUserWidget" native="true"> +- <property name="minimumSize"> +- <size> +- <width>454</width> +- <height>50</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>454</width> +- <height>50</height> +- </size> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="addLyt"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </widget> +- </widget> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/account/userinfo_intel/changepasswd.cpp b/plugins/account/userinfo_intel/changepasswd.cpp +deleted file mode 100644 +index 6fffc52..0000000 +--- a/plugins/account/userinfo_intel/changepasswd.cpp ++++ /dev/null +@@ -1,126 +0,0 @@ +-#include "changepasswd.h" +-#include <QLabel> +-#include <QPushButton> +-#include <QHBoxLayout> +-#include <QVBoxLayout> +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-changepasswd::changepasswd(QString username,QWidget *parent) : QDialog(parent) +-{ +- this->resize(360, 576); +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- initUI(username); +- setQSS(); +- +- connect(m_pdigitalAuthWidget, &DigitalAuthDialog::forgetpassword, [=](){ +- m_pStackedWidget->setCurrentIndex(1); +- }); +- connect(m_pPhoneAuthWidget, &PhoneAuthDialog::returnSignal, [=](){ +- m_pStackedWidget->setCurrentIndex(0); +- }); +- connect(m_pPhoneAuthWidget, &PhoneAuthDialog::confirmSignal, [=](){ +- m_pdigitalAuthWidget->gotonext(); +- m_pStackedWidget->setCurrentIndex(0); +- }); +- connect(m_pdigitalAuthWidget, &DigitalAuthDialog::ended, [=](){ +- emit changepwd(); +- close(); +- }); +-} +- +-void changepasswd::initUI(QString username){ +- QWidget * titleWidget = new QWidget(this); +- titleWidget->resize(360, 47); +-// titleWidget->move(0, 0); +- +- title_label = new QLabel(this); +- title_label->setText(tr("Change Password")); +- title_label->setObjectName("titleLabel"); +- closeBtn = new QPushButton(this); +- closeBtn->setProperty("useIconHighlightEffect", true); +- closeBtn->setProperty("iconHighlightEffectMode", 1); +- closeBtn->setFlat(true); +- closeBtn->setIcon(QIcon(":/img/plugins/userinfo/close.svg")); +- connect(closeBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +- const QByteArray id_1(UKUI_QT_STYLE); +- if (QGSettings::isSchemaInstalled(id_1)) { +- m_style =new QGSettings(id_1); +- connect(m_style, &QGSettings::changed, this, &changepasswd::setpwdstyle); +- } +- QHBoxLayout *hlayout = new QHBoxLayout(titleWidget); +-// hlayout->setContentsMargins(0,0,0,0); +- hlayout->addWidget(title_label); +- hlayout->addStretch(); +- hlayout->addWidget(closeBtn); +- +- m_pdigitalAuthWidget = new DigitalAuthDialog(username); +- m_pPhoneAuthWidget = new PhoneAuthDialog(username); +- m_pStackedWidget = new QStackedWidget(this); +- m_pStackedWidget->addWidget(m_pdigitalAuthWidget); +- m_pStackedWidget->addWidget(m_pPhoneAuthWidget); +- +- QVBoxLayout *mainLayout = new QVBoxLayout(this); +- mainLayout->addWidget(titleWidget); +- mainLayout->addWidget(m_pStackedWidget); +-} +- +-void changepasswd::setQSS(){ +-} +-void changepasswd::setpwdstyle(QString key) +-{ +- if(key == "styleName") { +- update(); +- } +-} +-void changepasswd::paintEvent(QPaintEvent *event) +-{ +- Q_UNUSED(event) +- +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 16, 16); +-// rectPath.addRoundedRect(this->rect(), 16, 16); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 16, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +-} +- +-changepasswd::~changepasswd(){ +- delete m_style; +-} +diff --git a/plugins/account/userinfo_intel/changepasswd.h b/plugins/account/userinfo_intel/changepasswd.h +deleted file mode 100644 +index 4497315..0000000 +--- a/plugins/account/userinfo_intel/changepasswd.h ++++ /dev/null +@@ -1,50 +0,0 @@ +-#ifndef CHANGEPASSWD_H +-#define CHANGEPASSWD_H +- +-#include <QWidget> +-#include <QDialog> +-#include <QDebug> +-#include <QStackedWidget> +-#include <QPainter> +-#include <QPainterPath> +-#include "QGSettings/QGSettings" +-#include "digitalauthdialog.h" +-#include "phoneauthdialog.h" +-#include "changepwddialog.h" +-#define UKUI_QT_STYLE "org.ukui.style" +-#define UKUI_STYLE_KEY "style-name" +- +-class QLabel; +-class QPushButton; +- +- +-class changepasswd : public QDialog +-{ +- Q_OBJECT +-public: +- explicit changepasswd(QString username, QWidget *parent = nullptr); +- ~changepasswd(); +- +- void initUI(QString username); +- void setQSS(); +- +-Q_SIGNALS: +- void newpdSignal(); +- void changepwd(); +- +-protected: +- void paintEvent(QPaintEvent *event) override; +- +-private: +- QLabel *title_label; +- QPushButton *closeBtn; +- QStackedWidget *m_pStackedWidget; +- DigitalAuthDialog *m_pdigitalAuthWidget; +- PhoneAuthDialog *m_pPhoneAuthWidget; +- ChangePwdDialog *m_pChangePwdDialog; +- QGSettings *m_style = nullptr; +-private slots: +- void setpwdstyle(QString key); +-}; +- +-#endif // CHANGEPASSWD_H +diff --git a/plugins/account/userinfo_intel/changephoneinteldialog.cpp b/plugins/account/userinfo_intel/changephoneinteldialog.cpp +deleted file mode 100644 +index 1ec0b04..0000000 +--- a/plugins/account/userinfo_intel/changephoneinteldialog.cpp ++++ /dev/null +@@ -1,485 +0,0 @@ +-#include "changephoneinteldialog.h" +-#include "ui_changephoneinteldialog.h" +- +-#include <QLabel> +-#include <QPushButton> +-#include <QHBoxLayout> +-#include <QVBoxLayout> +-#include <QAction> +-#include <QDebug> +- +-#define KYLIN_WIFI_GSETTING_VALUE "org.kylinnm.settings" +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-ChangePhoneIntelDialog::ChangePhoneIntelDialog(QString username, QWidget *parent) : +- QDialog(parent), +- ui(new Ui::ChangePhoneIntelDialog), +- m_interface1(NULL), +- m_interface2(NULL), +- m_isNightMode(NULL) +-{ +- ui->setupUi(this); +- qDebug() << "test3" << username; +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- initDbus(); +- initUI(username); +- initConnect(); +-} +- +-void ChangePhoneIntelDialog::initDbus(){ +- m_interface1 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.eduplatform", +- QDBusConnection::systemBus()); +- m_interface2 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- const QByteArray id(KYLIN_WIFI_GSETTING_VALUE); +- if (QGSettings::isSchemaInstalled(id)){ +- m_wifi = new QGSettings(id); +- } +-} +- +-void ChangePhoneIntelDialog::initUI(QString username){ +- m_username = username; +- QFont ft, ft1; +- ft.setPointSize(16); +- ft1.setPointSize(10); +- ui->title_label->setText(tr("Change Phone")); +- ui->title_label->setObjectName("titleLabel"); +- ui->title_label->setFont(ft); +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- ui->label_3->setPalette(pa); +- ui->label_3->setFont(ft1); +- ui->label_3->hide(); +- closeBtn = new QPushButton(this); +- closeBtn->setFixedSize(36, 36); +- closeBtn->setProperty("useIconHighlightEffect", true); +- closeBtn->setProperty("iconHighlightEffectMode", 1); +- closeBtn->setFlat(true); +- closeBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/close.svg")); +- closeBtn->setAutoDefault(false); +- ui->horizontalLayout->addWidget(closeBtn); +- ui->phoneNumLine->setStyleSheet("QLineEdit{background-color: #F6F6F6; border: 0px;" +- "border-radius:8px;" +- "}"); +- ui->verifyCodeLine->setStyleSheet("QLineEdit{background-color: #F6F6F6; border: 0px}"); +- connect(closeBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +- const QByteArray id_1(UKUI_QT_STYLE); +- if (QGSettings::isSchemaInstalled(id_1)) { +- m_style = new QGSettings(id_1); +- QString themeName = m_style->get(UKUI_STYLE_KEY).toString(); +- if( themeName == "ukui-light" || themeName == "ukui-default" | themeName == "ukui" ) +- m_isNightMode = false; +- else +- m_isNightMode = true; +- qDebug() << "m_isNightMode = " << m_isNightMode; +- connect(m_style, &QGSettings::changed, this, &ChangePhoneIntelDialog::setphonestyle); +- } +- +- phonePicture = new QAction(this); +- smsPicture = new QAction(this); +- phonePicture->setIcon(QIcon(":/img/plugins/userinfo_intel/phonenum.svg")); +- smsPicture->setIcon(QIcon(":/img/plugins/userinfo_intel/smscode.svg")); +- ui->phoneNumLine->setPlaceholderText(tr("Phone number")); +- ui->verifyCodeLine->setPlaceholderText(tr("SMS verification code")); +- ui->phoneNumLine->addAction(phonePicture, QLineEdit::LeadingPosition); +- ui->verifyCodeLine->addAction(smsPicture, QLineEdit::LeadingPosition); +- +- /* +- * 输入手机号界面 +- */ +- QRegExp regx_DeviceID1("^[0-9]{1,11}$"); +- QRegExp regx_DeviceID2("^[0-9]{1,6}$"); +- QValidator *validator_DeviceID1 = new QRegExpValidator(regx_DeviceID1, ui->phoneNumLine); +- QValidator *validator_DeviceID2 = new QRegExpValidator(regx_DeviceID2, ui->verifyCodeLine); +- ui->phoneNumLine->setTextMargins(10, 0, 0, 0); +- ui->verifyCodeLine->setTextMargins(10, 0, 0, 0); +- ui->phoneNumLine->setValidator(validator_DeviceID1); +- ui->verifyCodeLine->setValidator(validator_DeviceID2); +- +- +- QDBusMessage result1 = m_interface1->call("CheckPhoneNumBind", m_username); +- QList<QVariant> outArgs1 = result1.arguments(); +- int status1 = outArgs1.at(0).value<int>(); +- if (status1 == 1) { +- oldphonestatus = true; +- QDBusMessage result2 = m_interface2->call("GetAccountBasicInfo", m_username); +- if (QDBusMessage::ErrorMessage == result2.type()) { +- qDebug() << "result2.type() = " << result2.type(); +- qDebug() << "QDBusMessage::ErrorMessage = " << QDBusMessage::ErrorMessage; +- qDebug()<<"error"; +- oldphone = "error"; +- } else { +- QList<QVariant> outArgs2 = result2.arguments(); +- oldphone = outArgs2.at(5).value<QString>(); +- } +- ui->m_pTitle->setText(tr("Please input old phone number")); +- ui->submitButton->setText(tr("Next")); +- } else { +- oldphonestatus =false; // 该微信号没有绑定手机号 +- ui->m_pTitle->setText(tr("Please enter new mobile number")); +- ui->submitButton->setText(tr("Submit")); +- } +- phonechangestatus = false; +- phonestatus = false; +- codestatus = false; +- phoneNumChangeSuccess = false; +- ui->submitButton->setEnabled(false); +- //ui->getVerifyCode->setEnabled(false); +- +- /* +- * 修改成功界面 +- */ +- QFont ft2; +- ft2.setPointSize(18); +- ui->label->setFont(ft); +- ui->label->setProperty("class", "titleLB"); +- ui->label->setText(tr("changed success")); +- ui->label_2->setText(tr("You have successfully modified your phone")); +- ui->successicon->setPixmap(QPixmap(":/img/plugins/userinfo_intel/successed.png")); +-} +- +-void ChangePhoneIntelDialog::initConnect(){ +- connect(ui->getVerifyCode, SIGNAL(clicked(bool)), this, SLOT(slotGetVerifyCode(bool))); +- if (oldphonestatus) { +- QString m_clonephone = oldphone.mid(0,3)+"****"+oldphone.mid(7,4); +- ui->phoneNumLine->setText(m_clonephone); +- ui->phoneNumLine->setReadOnly(true); +- phonestatus = true; +- } else { +- phonestatus = false; +- } +- connect(ui->phoneNumLine, &QLineEdit::textChanged, this, [=](){ +- ui->label_3->hide(); +- if (ui->phoneNumLine->text().count() == 11) { +- ui->getVerifyCode->setEnabled(true); +- phonestatus = true; +- } else { +- ui->getVerifyCode->setEnabled(false); +- phonestatus = false; +- } +- if (phonestatus && codestatus) { +- ui->submitButton->setEnabled(true); +- } else { +- ui->submitButton->setEnabled(false); +- } +- }); +- +- connect(ui->verifyCodeLine, &QLineEdit::textChanged, this, [=](){ +- if (ui->verifyCodeLine->text().count() == 6) { +- codestatus =true; +- } else { +- ui->submitButton->setEnabled(false); +- codestatus =false; +- } +- if (phonestatus && codestatus) { +- ui->submitButton->setEnabled(true); +- } else { +- ui->submitButton->setEnabled(false); +- } +- }); +- +- connect(ui->submitButton, &QPushButton::clicked, this, &ChangePhoneIntelDialog::slotSubmitClicked); +-} +- +-void ChangePhoneIntelDialog::slotGetVerifyCode(bool clicked){ +- Q_UNUSED(clicked); +- start_timer = new QTimer(); +- countdown = 60; +- QString s = tr("Recapture"); +- QString s1 = QString::number(countdown); +- QString s2 = "("+s1+")"; +- QString s3 = s+s2; +- QDBusMessage result; +- if (phonechangestatus || !oldphonestatus) { +- result = m_interface1->call("GetVerifyCode",ui->phoneNumLine->text()); +- } else { +- result = m_interface1->call("GetVerifyCode",oldphone); +- } +- ui->label_3->hide(); +- QList<QVariant> outArgs = result.arguments(); +- int codestatus = outArgs.at(0).value<int>(); +- if (codestatus == 6 || codestatus == 28) { +- ui->label_3->setText(tr("Network connection failure, please check")); +- if(!(ui->label_3->isVisible())){ +- ui->label_3->show(); +- } +- return; +- } +- ui->getVerifyCode->setEnabled(false); +- ui->getVerifyCode->setText(s3); +- start_timer->start(1000); +- connect(start_timer,&QTimer::timeout,this,[=](){ +- QString s = tr("Recapture"); +- if (countdown > 0){ +- countdown--; +- qDebug() << countdown; +- QString s1 = QString::number(countdown); +- QString s2 = "("+s1+")"; +- QString s3 = s+s2; +- qDebug() << s3; +- ui->getVerifyCode->setText(s3); +- } else { +- ui->getVerifyCode->setText(tr("GetCode")); +- ui->getVerifyCode->setEnabled(true); +- start_timer->stop(); +- } +- }); +-} +- +-void ChangePhoneIntelDialog::slotSubmitClicked(bool clicked){ +- Q_UNUSED(clicked) +- if ( phoneNumChangeSuccess == true ){ +- close(); +- } +- if (oldphonestatus == true) { // 微信已经绑定过手机号 +- if (phonechangestatus == false) { +- QDBusMessage result3 = m_interface1->call("ApplyChangeInfoToken",m_username, oldphone, ui->verifyCodeLine->text()); +- QList<QVariant> outArgs3 = result3.arguments(); +- temptoken = outArgs3.at(0).value<QString>(); +- int status = outArgs3.at(1).value<int>(); +- if (status == 0) { +- ui->label_3->hide(); +- ui->m_pTitle->setText(tr("Please enter new mobile number")); +- ui->submitButton->setText(tr("Submit")); +- if (start_timer->isActive()){ +- start_timer->stop(); +- } +- ui->getVerifyCode->setText(tr("GetCode")); +- oldcode = ui->verifyCodeLine->text(); +- qDebug() << oldcode; +- ui->phoneNumLine->setReadOnly(false); +- ui->phoneNumLine->clear(); +- ui->verifyCodeLine->clear(); +- phonechangestatus = true; +- } else if (status == 9014) { +- ui->label_3->setText(tr("Phone is lock,try again in an hour")); +- ui->label_3->show(); +- } else if (status == 9000) { +- ui->label_3->setText(tr("Phone code is wrong")); +- ui->label_3->show(); +- ui->verifyCodeLine->clear(); +- } else if (status == 6 || status == 28) { +- ui->label_3->setText(tr("Network connection failure, please check")); +- ui->label_3->show(); +- } else if (status == 2300) { +- ui->label_3->setText(tr("Current login expired,using wechat code!")); +- ui->label_3->show(); +- } else { +- ui->label_3->setText(tr("Unknown error, please try again later")); +- ui->verifyCodeLine->clear(); +- ui->label_3->show(); +- } +- +- } else { +- if (oldphone == ui->phoneNumLine->text()) { +- ui->label_3->setText(tr("Phone can not same")); +- ui->label_3->show(); +- } else { +- QDBusMessage result3 = m_interface1->call("ReBindPhone", m_username, ui->phoneNumLine->text(),ui->verifyCodeLine->text(),temptoken); +- QList<QVariant> outArgs3 = result3.arguments(); +- int status = outArgs3.at(0).value<int>(); +- if (status == 0) { +- phoneNumChangeSuccess = true; +- ui->label_3->hide(); +- ui->submitButton->setText(tr("finished")); +- ui->m_pStackedWidget->setCurrentIndex(1); +- } else if (status == 9014) { +- ui->label_3->setText(tr("Phone is lock,try again in an hour")); +- ui->label_3->show(); +- } else if (status == 9000) { +- ui->label_3->setText(tr("Phone code is wrong")); +- ui->label_3->show(); +- ui->verifyCodeLine->clear(); +- } else if (status == 9009) { +- ui->label_3->setText(tr("Phone number already in used!")); +- ui->label_3->show(); +- } else if (status == 6 || status == 28) { +- ui->label_3->setText(tr("Network connection failure, please check")); +- ui->label_3->show(); +- } else { +- ui->label_3->setText(tr("Unknown error, please try again later")); +- ui->verifyCodeLine->clear(); +- ui->label_3->show(); +- } +- } +- } +- } else { // 微信没有绑定手机号,直接绑定即可 +- QDBusMessage result4 = m_interface1->call("BindPhoneNum", m_username, ui->phoneNumLine->text(), ui->verifyCodeLine->text()); +- QList<QVariant> outArgs4 = result4.arguments(); +- int status = outArgs4.at(0).value<int>(); +- if (status == 0) { +- phoneNumChangeSuccess = true; +- ui->submitButton->setText(tr("finished")); +- ui->label_3->setText(tr("You have successfully modified your phone")); +- ui->m_pStackedWidget->setCurrentIndex(1); +- } else if (status == 9014) { +- ui->label_3->setText(tr("Phone is lock,try again in an hour")); +- ui->label_3->show(); +- } else if (status == 9000) { +- ui->label_3->setText(tr("Phone code is wrong")); +- ui->label_3->show(); +- ui->verifyCodeLine->clear(); +- } else if (status == 9009) { +- ui->label_3->setText(tr("Phone number already in used!")); +- ui->label_3->show(); +- } else { +- ui->label_3->setText(tr("Unknown error, please try again later")); +- ui->label_3->show(); +- ui->verifyCodeLine->clear(); +- } +- } +-} +- +-void ChangePhoneIntelDialog::setphonestyle(QString key) +-{ +- if(key == "styleName") { +- QString themeName = m_style->get(UKUI_STYLE_KEY).toString(); +- if( themeName == "ukui-light" || themeName == "ukui-default" | themeName == "ukui" ) +- m_isNightMode = false; +- else +- m_isNightMode = true; +- qDebug() << "m_isNightMode = " << m_isNightMode; +- update(); +- } +-} +-void ChangePhoneIntelDialog::paintEvent(QPaintEvent *event) +-{ +- Q_UNUSED(event) +- +- /* +- * 由于设置了窗口透明,所以对QLineEdit的背景设置会因为border没有设置而不生效 +- * 圆角设置只有在paintEvent里才可以生效 +- */ +- if(!m_isNightMode){ +- ui->phoneNumLine->setStyleSheet("QLineEdit{background-color: #F6F6F6; border: 0px;" +- "border-top-left-radius:8px;" +- "border-top-right-radius:8px;" +- "}"); +- ui->verifyCodeLine->setStyleSheet("QLineEdit{background-color: #F6F6F6; border: 0px;" +- "border-bottom-left-radius:8px" +- "}"); +- if (ui->getVerifyCode->isEnabled()) { +- ui->getVerifyCode->setStyleSheet("QPushButton{background-color:#F6F6F6;" +- "selection-background-color:#F6F6F6;" +- "border-bottom-right-radius:8px;" +- "color:#2FB3EB" +- "}"); +- } else { +- ui->getVerifyCode->setStyleSheet("QPushButton{background-color:#F6F6F6;" +- "selection-background-color:#F6F6F6;" +- "border-bottom-right-radius:8px;" +- "color:#DDDDDD" +- "}"); +- } +- ui->submitButton->setStyleSheet("QPushButton{border-radius:8px;background-color:#DDDDDD;}" +- "QPushButton:hover{border-radius:8px;background-color:#2FB3EB;}" +- "QPushButton:clicked{border-radius:8px;background-color:#2FB3EB;}"); +- } +- else{ +- ui->phoneNumLine->setStyleSheet("QLineEdit{background-color: #030303; border: 0px;" +- "border-top-left-radius:8px;" +- "border-top-right-radius:8px;" +- "}"); +- ui->verifyCodeLine->setStyleSheet("QLineEdit{background-color: #030303; border: 0px;" +- "border-bottom-left-radius:8px" +- "}"); +- if (ui->getVerifyCode->isEnabled()) { +- ui->getVerifyCode->setStyleSheet("QPushButton{background-color:#030303;" +- "selection-background-color:#030303;" +- "border-bottom-right-radius:8px;" +- "color:#2FB3EB" +- "}"); +- } else { +- ui->getVerifyCode->setStyleSheet("QPushButton{background-color:#030303;" +- "selection-background-color:#030303;" +- "border-bottom-right-radius:8px;" +- "color:#DDDDDD" +- "}"); +- } +- ui->submitButton->setStyleSheet("QPushButton{border-radius:8px;background-color:#31373F;}" +- "QPushButton:hover{border-radius:8px;background-color:#2FB3EB;}" +- "QPushButton:clicked{border-radius:8px;background-color:#2FB3EB;}"); +- } +- +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 16, 16); +-// rectPath.addRoundedRect(this->rect(), 16, 16); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 16, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +- /* +- +- int width = this->width(); +- int height = this->height(); +- +- QPainter painter(this); +- painter.setRenderHint(QPainter::Antialiasing); +- painter.setPen(Qt::NoPen); +- QString s = m_style->get(UKUI_STYLE_KEY).toString(); +- if (s=="ukui-dark" || s == "ukui-black") { +- QColor m_bgColor("grey"); +- m_bgColor.setAlpha(255); +- painter.setBrush(m_bgColor); +- painter.drawRoundRect(0, 0, width, height, 5*height/width, 5); +- } else { +- QColor m_bgColor("#FFFFFF"); +- m_bgColor.setAlpha(255); +- painter.setBrush(m_bgColor); +- painter.drawRoundRect(0, 0, width, height, 5*height/width, 5); +- } +- */ +-} +- +-ChangePhoneIntelDialog::~ChangePhoneIntelDialog(){ +- qDebug() << "调用析构函数"; +- delete m_style; +- if(m_interface1){ +- delete m_interface1; +- m_interface1 = NULL; +- } +- if(m_interface2){ +- delete m_interface2; +- m_interface2 = NULL; +- } +-} +diff --git a/plugins/account/userinfo_intel/changephoneinteldialog.h b/plugins/account/userinfo_intel/changephoneinteldialog.h +deleted file mode 100644 +index e69d971..0000000 +--- a/plugins/account/userinfo_intel/changephoneinteldialog.h ++++ /dev/null +@@ -1,80 +0,0 @@ +-#ifndef CHANGEPHONEINTELDIALOG_H +-#define CHANGEPHONEINTELDIALOG_H +- +-#include <QWidget> +-#include <QDialog> +-#include <QStackedWidget> +-#include <QPainterPath> +-#include "QGSettings/QGSettings" +-#include "digitalauthinteldialog.h" +-#include "phoneauthinteldialog.h" +-#include "digitalphoneinteldialog.h" +-#define UKUI_QT_STYLE "org.ukui.style" +-#define UKUI_STYLE_KEY "style-name" +- +- +-class QLabel; +-class QPushButton; +- +-namespace Ui { +-class ChangePhoneIntelDialog; +-} +- +- +-class ChangePhoneIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit ChangePhoneIntelDialog(QString username, QWidget *parent = nullptr); +- ~ChangePhoneIntelDialog(); +- +- void initUI(QString username); +- void initDbus(); +- void initConnect(); +- +-protected: +- void paintEvent(QPaintEvent *event) override; +- +-private: +- Ui::ChangePhoneIntelDialog *ui; +- +- int countdown; +- QLabel *title_label; +- QLabel * getVerifiedCodeLabel; +- QPushButton *closeBtn; +- QStackedWidget *m_pStackedWidget; +- DigitalAuthIntelDialog *m_pdigitalAuthWidget; +- PhoneAuthIntelDialog *m_pPhoneAuthWidget; +- DigitalPhoneIntelDialog *m_pdigitalPhoneWidget; +- QGSettings *m_style = nullptr; +- +- QAction *phonePicture; +- QAction *smsPicture; +- +- QDBusInterface *m_interface1; +- QDBusInterface *m_interface2; +- +- QTimer *start_timer; +- +- QGSettings *m_wifi; +- +- bool m_isNightMode; +- bool oldphonestatus; +- bool phonechangestatus; +- bool phonestatus; +- bool codestatus; +- bool phoneNumChangeSuccess; +- QString oldphone; +- QString oldcode; +- QString m_username; +- QString temptoken; +- +-private slots: +- void setphonestyle(QString key); +- void slotGetVerifyCode(bool clicked); +- void slotSubmitClicked(bool clicked); +- +-}; +- +-#endif // CHANGEPHONEDIALOD_H +diff --git a/plugins/account/userinfo_intel/changephoneinteldialog.ui b/plugins/account/userinfo_intel/changephoneinteldialog.ui +deleted file mode 100644 +index 5b9ffbd..0000000 +--- a/plugins/account/userinfo_intel/changephoneinteldialog.ui ++++ /dev/null +@@ -1,600 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>ChangePhoneIntelDialog</class> +- <widget class="QDialog" name="ChangePhoneIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>380</width> +- <height>596</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>380</width> +- <height>596</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>380</width> +- <height>596</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <property name="layoutDirection"> +- <enum>Qt::LeftToRight</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>10</number> +- </property> +- <property name="topMargin"> +- <number>10</number> +- </property> +- <property name="rightMargin"> +- <number>10</number> +- </property> +- <property name="bottomMargin"> +- <number>10</number> +- </property> +- <item> +- <widget class="QWidget" name="widget" native="true"> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>47</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>47</height> +- </size> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="leftMargin"> +- <number>9</number> +- </property> +- <property name="rightMargin"> +- <number>9</number> +- </property> +- <item> +- <widget class="QLabel" name="title_label"> +- <property name="font"> +- <font> +- <family>Noto Sans CJK SC</family> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>changephone</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>205</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QStackedWidget" name="m_pStackedWidget"> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>430</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>430</height> +- </size> +- </property> +- <property name="currentIndex"> +- <number>0</number> +- </property> +- <widget class="QWidget" name="page"> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QWidget" name="widget_2" native="true"> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>89</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>89</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>6</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>18</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QLabel" name="m_pTitle"> +- <property name="font"> +- <font> +- <pointsize>16</pointsize> +- </font> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- <property name="text"> +- <string>Please input old phone num</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QLabel" name="label_3"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="styleSheet"> +- <string notr="true"/> +- </property> +- <property name="text"> +- <string>TextLabel</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_5"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>18</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="widget_3" native="true"> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>129</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>129</height> +- </size> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLineEdit" name="phoneNumLine"> +- <property name="minimumSize"> +- <size> +- <width>312</width> +- <height>64</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>312</width> +- <height>64</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLineEdit" name="verifyCodeLine"> +- <property name="minimumSize"> +- <size> +- <width>184</width> +- <height>64</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>184</width> +- <height>64</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="getVerifyCode"> +- <property name="minimumSize"> +- <size> +- <width>128</width> +- <height>64</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>128</width> +- <height>64</height> +- </size> +- </property> +- <property name="layoutDirection"> +- <enum>Qt::LeftToRight</enum> +- </property> +- <property name="styleSheet"> +- <string notr="true">background-color:transparent; +-selection-background-color: transparent;</string> +- </property> +- <property name="text"> +- <string>GetVerifyCode</string> +- </property> +- <property name="autoDefault"> +- <bool>false</bool> +- </property> +- <property name="default"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>212</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- <widget class="QWidget" name="page_2"> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <spacer name="verticalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>52</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QLabel" name="label"> +- <property name="text"> +- <string>TextLabel</string> +- </property> +- <property name="alignment"> +- <set>Qt::AlignCenter</set> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>54</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QLabel" name="label_2"> +- <property name="text"> +- <string>TextLabel</string> +- </property> +- <property name="alignment"> +- <set>Qt::AlignCenter</set> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_5"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>52</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <item> +- <spacer name="horizontalSpacer_6"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QLabel" name="successicon"> +- <property name="minimumSize"> +- <size> +- <width>222</width> +- <height>159</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>222</width> +- <height>159</height> +- </size> +- </property> +- <property name="layoutDirection"> +- <enum>Qt::LeftToRight</enum> +- </property> +- <property name="text"> +- <string/> +- </property> +- <property name="alignment"> +- <set>Qt::AlignCenter</set> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_7"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_6"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>53</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="widget_4" native="true"> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>96</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>96</height> +- </size> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>24</number> +- </property> +- <property name="rightMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>24</number> +- </property> +- <item> +- <widget class="QPushButton" name="submitButton"> +- <property name="minimumSize"> +- <size> +- <width>312</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>312</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>submit</string> +- </property> +- <property name="autoDefault"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/account/userinfo_intel/changepininteldialog.cpp b/plugins/account/userinfo_intel/changepininteldialog.cpp +deleted file mode 100644 +index 07e6bce..0000000 +--- a/plugins/account/userinfo_intel/changepininteldialog.cpp ++++ /dev/null +@@ -1,125 +0,0 @@ +-#include "changepininteldialog.h" +-#include "ui_changepininteldialog.h" +-#include <QDebug> +- +-#define INPUT_OLD_PWD 1 +-#define INPUT_NEW_PWD 2 +-#define REPEAT_NEW_PWD 3 +- +-int ChangePinIntelDialog::m_isThemeChanged = 0; +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-ChangePinIntelDialog::ChangePinIntelDialog(QString username, QWidget *parent) : +- QDialog(parent), +- ui(new Ui::ChangePinIntelDialog) +-{ +- ui->setupUi(this); +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- closeBtn = new QPushButton(this); +- closeBtn->setFixedSize(36, 36); +- ui->horizontalLayout->addWidget(closeBtn); +- closeBtn->setProperty("useIconHighlightEffect", true); +- closeBtn->setProperty("iconHighlightEffectMode", 1); +- closeBtn->setFlat(true); +- closeBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/close.svg")); +- closeBtn->setAutoDefault(false); +- connect(closeBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +- +- m_pdigitalAuthWidget = new DigitalAuthIntelDialog(username); +- m_pPhoneAuthWidget = new PhoneAuthIntelDialog(username); +- ui->stackedWidget->addWidget(m_pdigitalAuthWidget); +- ui->stackedWidget->addWidget(m_pPhoneAuthWidget); +- ui->stackedWidget->setCurrentIndex(0); +- +- +- connect(m_pdigitalAuthWidget, &DigitalAuthIntelDialog::forgetpassword, [=](){ +- ui->stackedWidget->setCurrentIndex(1); +- }); +- connect(m_pPhoneAuthWidget, &PhoneAuthIntelDialog::returnSignal, [=](){ +- ui->stackedWidget->setCurrentIndex(0); +- }); +- connect(m_pPhoneAuthWidget, &PhoneAuthIntelDialog::confirmSignal, [=](){ +- m_pdigitalAuthWidget->gotonext(); +- ui->stackedWidget->setCurrentIndex(0); +- }); +- connect(m_pdigitalAuthWidget, &DigitalAuthIntelDialog::ended, [=](){ +- emit changepwd(); +- close(); +- }); +- connect(this, &ChangePinIntelDialog::EmitThemeChanged, m_pPhoneAuthWidget, &PhoneAuthIntelDialog::themeChanged); +- +- const QByteArray id_1(UKUI_QT_STYLE); +- if (QGSettings::isSchemaInstalled(id_1)) { +- m_style =new QGSettings(id_1); +- connect(m_style, &QGSettings::changed, this, &ChangePinIntelDialog::setpwdstyle); +- } +- setpwdstyle("styleName"); +-} +- +-ChangePinIntelDialog::~ChangePinIntelDialog() +-{ +- delete ui; +- delete m_style; +-} +- +-void ChangePinIntelDialog::paintEvent(QPaintEvent *event) { +- Q_UNUSED(event) +- +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 16, 16); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 16, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +- +-} +- +-void ChangePinIntelDialog::setpwdstyle(QString key){ +- if(key == "styleName") { +- QString currentTheme = m_style->get(UKUI_STYLE_KEY).toString(); +- if(currentTheme == "ukui-default" || currentTheme == "ukui-white" +- || currentTheme == "ukui-light" || currentTheme == "ukui"){ +- ChangePinIntelDialog::m_isThemeChanged = 0; +- }else if(currentTheme == "ukui-dark" || currentTheme == "ukui-black"){ +- ChangePinIntelDialog::m_isThemeChanged = 1; +- } +- emit EmitThemeChanged(ChangePinIntelDialog::m_isThemeChanged); +- update(); +- } +-} +diff --git a/plugins/account/userinfo_intel/changepininteldialog.h b/plugins/account/userinfo_intel/changepininteldialog.h +deleted file mode 100644 +index 4ea090e..0000000 +--- a/plugins/account/userinfo_intel/changepininteldialog.h ++++ /dev/null +@@ -1,57 +0,0 @@ +-#ifndef CHANGEPININTELDIALOG_H +-#define CHANGEPININTELDIALOG_H +- +-#include <QDialog> +-#include <QWidget> +-#include <QPaintEvent> +-#include <QPainter> +-#include <QPainterPath> +-#include <QMouseEvent> +-#include <QSharedPointer> +-#include <QVBoxLayout> +-#include <QFrame> +-#include <QHBoxLayout> +-#include <QString> +-#include <QGSettings/QGSettings> +-#include "digitalauthinteldialog.h" +-#include "phoneauthinteldialog.h" +-#include "changepwdinteldialog.h" +-#define UKUI_QT_STYLE "org.ukui.style" +-#define UKUI_STYLE_KEY "style-name" +- +-class QLabel; +-class QPushButton; +- +-namespace Ui { +-class ChangePinIntelDialog; +-} +- +-class ChangePinIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit ChangePinIntelDialog(QString username, QWidget *parent = nullptr); +- ~ChangePinIntelDialog(); +- static int m_isThemeChanged; //主题 +- +-protected: +- void paintEvent(QPaintEvent *); +- +-private: +- Ui::ChangePinIntelDialog *ui; +- QPushButton *closeBtn; +- DigitalAuthIntelDialog *m_pdigitalAuthWidget; +- PhoneAuthIntelDialog *m_pPhoneAuthWidget; +- ChangePwdIntelDialog *m_pChangePwdDialog; +- QGSettings *m_style = nullptr; +- +-Q_SIGNALS: +- void EmitThemeChanged(int theme); +- void changepwd(); +- +-private slots: +- void setpwdstyle(QString key); +-}; +- +-#endif // CHANGEPININTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/changepininteldialog.ui b/plugins/account/userinfo_intel/changepininteldialog.ui +deleted file mode 100644 +index 14b2c1a..0000000 +--- a/plugins/account/userinfo_intel/changepininteldialog.ui ++++ /dev/null +@@ -1,105 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>ChangePinIntelDialog</class> +- <widget class="QDialog" name="ChangePinIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>380</width> +- <height>596</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>380</width> +- <height>596</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>380</width> +- <height>596</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <property name="layoutDirection"> +- <enum>Qt::LeftToRight</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="leftMargin"> +- <number>10</number> +- </property> +- <property name="topMargin"> +- <number>10</number> +- </property> +- <property name="rightMargin"> +- <number>10</number> +- </property> +- <property name="bottomMargin"> +- <number>10</number> +- </property> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>47</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>47</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="text"> +- <string>Change Password</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>205</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QStackedWidget" name="stackedWidget"> +- <property name="currentIndex"> +- <number>-1</number> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/account/userinfo_intel/changepwd.qrc b/plugins/account/userinfo_intel/changepwd.qrc +deleted file mode 100644 +index 5667106..0000000 +--- a/plugins/account/userinfo_intel/changepwd.qrc ++++ /dev/null +@@ -1,5 +0,0 @@ +-<RCC> +- <qresource prefix="/"> +- <file>phoneauthinteldialog.qss</file> +- </qresource> +-</RCC> +diff --git a/plugins/account/userinfo_intel/changepwdinteldialog.cpp b/plugins/account/userinfo_intel/changepwdinteldialog.cpp +deleted file mode 100644 +index 3223909..0000000 +--- a/plugins/account/userinfo_intel/changepwdinteldialog.cpp ++++ /dev/null +@@ -1,582 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "changepwdinteldialog.h" +-#include "ui_changepwdinteldialog.h" +-#include "userinfo_intel.h" +- +-#include "elipsemaskwidget.h" +-#include "passwdcheckutil.h" +- +-#include <QStyledItemDelegate> +-#include <QGraphicsDropShadowEffect> +- +-#include <QDebug> +- +-#define PWD_LOW_LENGTH 6 +-#define PWD_HIGH_LENGTH 20 +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-ChangePwdIntelDialog::ChangePwdIntelDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::ChangePwdIntelDialog) +-{ +- ui->setupUi(this); +- +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- ui->oldPwdLineEdit->hide(); +- ui->pwdFrame->show(); +- +-// ui->frame->setStyleSheet(".QFrame{background:rgba(255,255,255,1); border:1px solid rgba(201,201,201,1); border-radius:16px;}"); +-// QGraphicsDropShadowEffect *frame_shadow = new QGraphicsDropShadowEffect(this); +-// frame_shadow->setYOffset(0); +-// frame_shadow->setColor("rgba(47,56,64,0.15)"); +-// frame_shadow->setBlurRadius(16); +-// ui->frame->setGraphicsEffect(frame_shadow); +- +-// 顶边栏样式,此控件样式应由主题控制 +-// ui->topWidget->setStyleSheet(".QWidget{background:rgba(246,246,246,1);}"); +- +-// ui->titleLabel->setStyleSheet("QLabel{font-size: 14px; color: palette(windowText);}"); +-// ui->label_5->setStyleSheet("QLabel{font-size: 16px; color: palette(windowText);}"); +-// ui->pwdLabel->setStyleSheet("QLabel{font-size: 16px; color: palette(windowText);}"); +-// ui->pwdsureLabel->setStyleSheet("QLabel{font-size: 16px; color: palette(windowText);}"); +-// ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius:12px;background:rgba(245,245,245,1);}"); +-// ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius:12px;background:rgba(245,245,245,1);}"); +-// ui->pwdFrame->setStyleSheet("QFrame{border: 0px; border-radius:12px;background:rgba(235,235,235,1);}"); +-// ui->cancelPushBtn->setStyleSheet(ui->cancelPushBtn->styleSheet().append(QString("border-radius:12px;"))); +-// ui->confirmPushBtn->setStyleSheet("QPushButton{border-radius:12px;}"); +- +- ui->closeBtn->setProperty("useIconHighlightEffect", true); +- ui->closeBtn->setProperty("iconHighlightEffectMode", 1); +- ui->closeBtn->setFlat(true); +- ui->closeBtn->setStyleSheet("QPushButton:hover:!pressed#closeBtn{background: #FA6056; border-radius: 4px;}" +- "QPushButton:hover:pressed#closeBtn{background: #E54A50; border-radius: 4px;}"); +- +- ui->pwdFrame->setFrameShape(QFrame::Shape::Box); +- +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- ui->oldPwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->oldPwdLineEdit->installEventFilter(this); +- ui->pwdLineEdit->installEventFilter(this); +- ui->pwdsureLineEdit->installEventFilter(this); +- +- isOldPwdVisibel = false; +- isNewPwdVisibel = false; +- isSurePwdVisibel = false; +- +- cmd = new QProcess(this); +- cmd->setProgram("passwd"); +-// cmd->start(); +- +- initPwdChecked(); +- setupComponent(); +- setupConnect(); +-} +- +-ChangePwdIntelDialog::~ChangePwdIntelDialog() +-{ +- delete ui; +- if (cmd->state() == QProcess::Running) { +- cmd->terminate(); +- cmd->waitForFinished(); +- } +-} +- +-bool ChangePwdIntelDialog::eventFilter(QObject *w, QEvent *e) { +- if(w == ui->oldPwdLineEdit) { +- if(e->type() == QEvent::MouseButtonPress) { +- ui->oldPwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- } +- } +- if(w == ui->pwdLineEdit) { +- if(e->type() == QEvent::MouseButtonPress) { +- ui->oldPwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- } +- } +- if(w == ui->pwdsureLineEdit) { +- if(e->type() == QEvent::MouseButtonPress) { +- ui->oldPwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- } +- } +- return QWidget::eventFilter(w,e); +-} +- +-void ChangePwdIntelDialog::initPwdChecked(){ +-#ifdef ENABLEPQ +- int ret; +- void *auxerror; +- char buf[255]; +- +- settings = pwquality_default_settings(); +- if (settings == NULL) { +- enablePwdQuality = false; +- qDebug() << "init pwquality settings failed"; +- } else { +- enablePwdQuality = true; +- } +- +- ret = pwquality_read_config(settings, PWCONF, &auxerror); +- if (ret != 0){ +- enablePwdQuality = false; +- qDebug() << "Reading pwquality configuration file failed: " << pwquality_strerror(buf, sizeof(buf), ret, auxerror); +- } else { +- enablePwdQuality = true; +- } +- +- if (PasswdCheckUtil::getCurrentPamState()) +- enablePwdQuality = true; +- else +- enablePwdQuality = false; +- +-#else +- enablePwdQuality = false; +-#endif +-} +- +-void ChangePwdIntelDialog::setupComponent(){ +- +- ElipseMaskWidget * cpMaskWidget = new ElipseMaskWidget(ui->faceLabel); +- cpMaskWidget->setGeometry(0, 0, ui->faceLabel->width(), ui->faceLabel->height()); +- +- ui->pwdtypeComboBox->setText(tr("General Pwd")); +- +- ui->oldPwdLineEdit->setEchoMode(QLineEdit::Password); +- ui->pwdLineEdit->setEchoMode(QLineEdit::Password); +- ui->pwdsureLineEdit->setEchoMode(QLineEdit::Password); +- +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- ui->tipLabel->setPalette(pa); +- ui->tipLabel_2->setPalette(pa); +- ui->tipLabel_3->setPalette(pa); +- +- ui->oldPwdLineEdit->setPlaceholderText(tr("Old Password")); +- ui->pwdLineEdit->setPlaceholderText(tr("New Password")); +- ui->pwdsureLineEdit->setPlaceholderText(tr("New Password Identify")); +- +- ui->oldPwdLineEdit->setTextMargins(16,0,32,0); +- ui->pwdLineEdit->setTextMargins(16,0,32,0); +- ui->pwdsureLineEdit->setTextMargins(16,0,32,0); +- oldPwdLineEditHLayout = new QHBoxLayout(); +- pwdLineEditHLayout = new QHBoxLayout(); +- pwdsureLineEditHLayout = new QHBoxLayout(); +- +- showOldPwdBtn = new QPushButton(); +- showOldPwdBtn->setFixedSize(QSize(16, 16)); +- +- oldPwdLineEditHLayout->addStretch(); +- oldPwdLineEditHLayout->addWidget(showOldPwdBtn); +- oldPwdLineEditHLayout->setContentsMargins(0,0,16,0); +- ui->oldPwdLineEdit->setLayout(oldPwdLineEditHLayout); +- +- showPwdBtn = new QPushButton(); +- showPwdBtn->setFixedSize(QSize(16, 16)); +- +- pwdLineEditHLayout->addStretch(); +- pwdLineEditHLayout->addWidget(showPwdBtn); +- pwdLineEditHLayout->setContentsMargins(0,0,16,0); +- ui->pwdLineEdit->setLayout(pwdLineEditHLayout); +- +- showSurePwdBtn = new QPushButton(); +- showSurePwdBtn->setFixedSize(QSize(16, 16)); +- +- pwdsureLineEditHLayout->addStretch(); +- pwdsureLineEditHLayout->addWidget(showSurePwdBtn); +- pwdsureLineEditHLayout->setContentsMargins(0,0,16,0); +- ui->pwdsureLineEdit->setLayout(pwdsureLineEditHLayout); +- +- showOldPwdBtn->setCursor(QCursor(Qt::ArrowCursor)); +- showPwdBtn->setCursor(QCursor(Qt::ArrowCursor)); +- showSurePwdBtn->setCursor(QCursor(Qt::ArrowCursor)); +- +-// showOldPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}" +-// "QPushButton:pressed{border-image: url(:/img/plugins/userinfo_intel/pwdUnscramble.png);}"); +-// showPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}" +-// "QPushButton:pressed{border-image: url(:/img/plugins/userinfo_intel/pwdUnscramble.png);}"); +-// showSurePwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}" +-// "QPushButton:pressed{border-image: url(:/img/plugins/userinfo_intel/pwdUnscramble.png);}"); +- showOldPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- showPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- showSurePwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- connect(showOldPwdBtn, &QPushButton::clicked, this, [=]{ +- if(isOldPwdVisibel){ +- ui->oldPwdLineEdit->setEchoMode(QLineEdit::Password); +- isOldPwdVisibel = false; +- showOldPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- +- } else { +- ui->oldPwdLineEdit->setEchoMode(QLineEdit::Normal); +- isOldPwdVisibel = true; +- showOldPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdUnscramble.png);}"); +- } +- ui->oldPwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->oldPwdLineEdit->setFocus(); +- }); +-// connect(showOldPwdBtn, &QPushButton::released, this, [=]{ +-// ui->oldPwdLineEdit->setEchoMode(QLineEdit::Password); +-// ui->oldPwdLineEdit->setFocus(); +-// }); +- connect(showPwdBtn, &QPushButton::clicked, this, [=]{ +- if(isNewPwdVisibel){ +- ui->pwdLineEdit->setEchoMode(QLineEdit::Password); +- isNewPwdVisibel = false; +- showPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- +- } else { +- ui->pwdLineEdit->setEchoMode(QLineEdit::Normal); +- isNewPwdVisibel = true; +- showPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdUnscramble.png);}"); +- } +- ui->oldPwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setFocus(); +- }); +-// connect(showPwdBtn, &QPushButton::released, this, [=]{ +-// ui->pwdLineEdit->setEchoMode(QLineEdit::Password); +-// ui->pwdLineEdit->setFocus(); +-// }); +- connect(showSurePwdBtn, &QPushButton::clicked, this, [=]{ +- if(isSurePwdVisibel){ +- ui->pwdsureLineEdit->setEchoMode(QLineEdit::Password); +- isSurePwdVisibel = false; +- showSurePwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- +- } else { +- ui->pwdsureLineEdit->setEchoMode(QLineEdit::Normal); +- isSurePwdVisibel = true; +- showSurePwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdUnscramble.png);}"); +- } +- ui->oldPwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdsureLineEdit->setFocus(); +- }); +-// connect(showSurePwdBtn, &QPushButton::released, this, [=]{ +-// ui->pwdsureLineEdit->setEchoMode(QLineEdit::Password); +-// ui->pwdsureLineEdit->setFocus(); +-// }); +- refreshConfirmBtnStatus(); +-} +- +-void ChangePwdIntelDialog::setupConnect(){ +- connect(ui->closeBtn, &QPushButton::clicked, [=]{ +- if (cmd->state() == QProcess::Running) { +- cmd->kill(); +- cmd->waitForFinished(); +- } +- close(); +- }); +- +- connect(ui->oldPwdLineEdit, &QLineEdit::textChanged, [=](QString text){ +- if(!text.isEmpty() && text == ui->pwdLineEdit->text()){ +- ui->tipLabel_3->setText(tr("Please set different pwd!")); +- } else { +- ui->tipLabel_3->setText(""); +- } +- refreshConfirmBtnStatus(); +- }); +- connect(ui->pwdLineEdit, &QLineEdit::textChanged, [=](QString text){ +- pwdLegalityCheck(text); +- if(!text.isEmpty() && text == ui->oldPwdLineEdit->text()){ +- ui->tipLabel_3->setText(tr("Please set different pwd!")); +- } else { +- ui->tipLabel_3->setText(""); +- } +- refreshConfirmBtnStatus(); +- }); +- connect(ui->pwdsureLineEdit, &QLineEdit::textChanged, [=](QString text){ +- if (!text.isEmpty() && text != ui->pwdLineEdit->text()){ +- pwdSureTip = tr("Inconsistency with pwd"); +- } else { +- pwdSureTip = ""; +- } +- +- ui->tipLabel->setText(pwdSureTip); +- if (pwdSureTip.isEmpty()){ +- pwdTip.isEmpty() ? ui->tipLabel->setText(nameTip) : ui->tipLabel->setText(pwdTip); +- } +- +- refreshConfirmBtnStatus(); +- }); +- +- connect(ui->cancelPushBtn, &QPushButton::clicked, [=]{ +- if (cmd->state() == QProcess::Running) { +- cmd->kill(); +- cmd->waitForFinished(); +- } +- reject(); +- }); +- connect(ui->confirmPushBtn, &QPushButton::clicked, [=]{ +- if(ui->oldPwdLineEdit->isVisible()){ +- process = 0; +- cmd->start(); +- cmd->waitForStarted(); +- //验证当前密码 +-// if(ui->oldPwdLineEdit->text() == ""){ +-// ui->tipLabel_3->setText(tr("Old pwd can not be void!")); +-// } else { +-// ui->tipLabel_3->setText(tr("Old pwd is wrong!")); +-// } +- cmd->write(ui->oldPwdLineEdit->text().toLocal8Bit() + '\n'); +-// cmd->waitForStarted(); +- cmd->write(ui->pwdLineEdit->text().toLocal8Bit() + '\n'); +-// cmd->waitForStarted(); +- cmd->write(ui->pwdsureLineEdit->text().toLocal8Bit() + '\n'); +- //新旧密码相似度过高时,输入不匹配的密码来使cmd结束 +- cmd->write("a\n"); +- cmd->write("b\n"); +- ui->confirmPushBtn->setEnabled(false); +- } else { +- this->accept(); +- emit passwd_send(ui->pwdLineEdit->text(), ui->usernameLabel->text()); +- } +-// emit passwd_send(ui->pwdLineEdit->text(), ui->usernameLabel->text()); +- }); +- +- connect(cmd, &QProcess::started, this, &ChangePwdIntelDialog::on_started); +- connect(cmd, &QProcess::bytesWritten, this, &ChangePwdIntelDialog::on_byteWritten); +- //一次输入结束后,重新拉起cmd process +- connect(cmd, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), +- [=](int exitCode, QProcess::ExitStatus exitStatus){ +-// Q_UNUSED(exitCode); +-// Q_UNUSED(exitStatus); +- qDebug()<<"exitCode: "<<exitCode; +- qDebug()<<"cmd->Finished !"; +- ui->confirmPushBtn->setEnabled(true); +- if(exitStatus == QProcess::NormalExit){ +- if(exitCode == 0){ +- //密码修改成功 +- // int ret1 = QMessageBox::warning(this, tr("Warning"),tr("change pwd successfully!"), QMessageBox::Abort); +- this->close(); +- } else { +- //密码验证失败时,process为3,密码相似度过高时,process为4,密码修改成功时,process为5 +- if(process == 3) { +- ui->tipLabel_3->setText(tr("Old pwd is wrong!")); +- } else if (process == 4) { +- ui->tipLabel_2->setText(tr("New pwd is too similar with old pwd!")); +- } +- } +- } else { +- //exitstatus == crashed or others +- ui->tipLabel_3->setText(tr("Check old pwd failed because of unknown reason!")); +- } +- }); +- connect(cmd, &QProcess::readyReadStandardOutput, this, &ChangePwdIntelDialog::on_readyReadStandardOutput); +- connect(cmd, &QProcess::readyReadStandardError, this, &ChangePwdIntelDialog::on_readyReadStandardError); +-} +- +-void ChangePwdIntelDialog::on_readyReadStandardOutput(){ +- process ++; +-// qDebug()<<"Process: "<<process; +- QString outStr = QString::fromLocal8Bit(cmd->readAllStandardOutput()); +- qDebug()<<outStr; +-} +- +-void ChangePwdIntelDialog::on_readyReadStandardError(){ +- process ++; +-// qDebug()<<"Process: "<<process; +- QString outStr = QString::fromLocal8Bit(cmd->readAllStandardError()); +- qDebug()<<outStr; +-} +- +-void ChangePwdIntelDialog::on_started() +-{ +- qDebug()<<"cmd->Started !"; +-} +- +-void ChangePwdIntelDialog::on_byteWritten() +-{ +- qDebug()<<"cmd->Written !"; +-} +- +-void ChangePwdIntelDialog::setFace(QString iconfile){ +- ui->faceLabel->setPixmap(QPixmap(iconfile).scaled(QSize(80, 80))); +-} +- +-void ChangePwdIntelDialog::setUsername(QString username){ +- ui->usernameLabel->setText(username); +- //修改本用户密码时,显示验证当前密码输入框 +- if (username == QString(g_get_user_name())){ +- ui->oldPwdLineEdit->show(); +- ui->pwdFrame->hide(); +- } +-} +- +-//void ChangePwdIntelDialog::setPwdType(QString type){ +-// ui->pwdtypeComboBox->setCurrentText(type); +-//} +- +-void ChangePwdIntelDialog::setAccountType(QString aType){ +- ui->aTypeLabel->setText(aType); +-} +- +-void ChangePwdIntelDialog::paintEvent(QPaintEvent *event) { +- Q_UNUSED(event) +- +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 6, 6); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +- +-} +- +-void ChangePwdIntelDialog::pwdLegalityCheck(QString pwd){ +- if (enablePwdQuality){ +-#ifdef ENABLEPQ +- void * auxerror; +- int ret; +- const char * msg; +- char buf[256]; +- +- QByteArray ba = pwd.toLatin1(); +- +- ret = pwquality_check(settings, ba.data(), NULL, NULL, &auxerror); +- if (ret < 0 && pwd.length() > 0){ +- msg = pwquality_strerror(buf, sizeof(buf), ret, auxerror); +- pwdTip = QString(msg); +- } else { +- pwdTip = ""; +- } +-#endif +- +- } else { //系统未开启pwdquality模块 +- if (pwd.length() < PWD_LOW_LENGTH) { +- if (pwd.length() == 0) pwdTip_2 = ""; +- else pwdTip_2 = tr("Password length needs to more than %1 character!").arg(PWD_LOW_LENGTH - 1); +- } else if (pwd.length() > PWD_HIGH_LENGTH) { +- pwdTip_2 = tr("Password length needs to less than %1 character!").arg(PWD_HIGH_LENGTH + 1); +- } else { +- //密码不能只由数字组成 +- const char *s = pwd.toUtf8().data(); +- while (*s && *s >= '0' && *s <= '9') { +- s++; +- } +- if (!bool(*s)) { +- pwdTip_2 = tr("Password cannot be made up entirely by Numbers!"); +- } else { +- pwdTip_2 = ""; +- } +- } +- }; +- ui->tipLabel_2->setText(pwdTip_2); +- +- //防止先输入确认密码,再输入密码后pwdsuretipLabel无法刷新 +- if (!ui->pwdsureLineEdit->text().isEmpty()){ +- if (ui->pwdLineEdit->text() == ui->pwdsureLineEdit->text()) { +- pwdSureTip = ""; +- } else { +- pwdSureTip = tr("Inconsistency with pwd"); +- } +- } +- +- ui->tipLabel->setText(pwdTip); +- if (pwdTip.isEmpty()){ +- pwdSureTip.isEmpty() ? ui->tipLabel->setText(nameTip) : ui->tipLabel->setText(pwdSureTip); +- } +- +- refreshConfirmBtnStatus(); +-} +- +- +-void ChangePwdIntelDialog::refreshConfirmBtnStatus(){ +- if (!ui->tipLabel->text().isEmpty() || \ +- ui->pwdLineEdit->text().isEmpty() || ui->pwdLineEdit->text() == tr("New Password") || \ +- ui->pwdsureLineEdit->text().isEmpty() || ui->pwdsureLineEdit->text() == tr("New Password Identify") || +- !nameTip.isEmpty() || !pwdTip.isEmpty() || !pwdSureTip.isEmpty() || !pwdTip_2.isEmpty() || \ +- !ui->tipLabel_3->text().isEmpty()) +- ui->confirmPushBtn->setEnabled(false); +- else +- ui->confirmPushBtn->setEnabled(true); +-} +diff --git a/plugins/account/userinfo_intel/changepwdinteldialog.h b/plugins/account/userinfo_intel/changepwdinteldialog.h +deleted file mode 100644 +index 5d9eff8..0000000 +--- a/plugins/account/userinfo_intel/changepwdinteldialog.h ++++ /dev/null +@@ -1,110 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef CHANGEPWDINTELDIALOG_H +-#define CHANGEPWDINTELDIALOG_H +- +-#include <QDialog> +-#include <QPainter> +-#include <QPainterPath> +-#include <QHBoxLayout> +-#include <QPushButton> +-#include <QProcess> +- +-#ifdef ENABLEPQ +-extern "C" { +- +-#include <pwquality.h> +- +-} +- +-#define PWCONF "/etc/security/pwquality.conf" +-#define RFLAG 0x1 +-#define CFLAG 0x2 +- +-#endif +- +-namespace Ui { +-class ChangePwdIntelDialog; +-} +- +-class ChangePwdIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit ChangePwdIntelDialog(QWidget *parent = 0); +- ~ChangePwdIntelDialog(); +- +-public: +- void initPwdChecked(); +- void setupComponent(); +- void setupConnect(); +- +- void refreshConfirmBtnStatus(); +- +- void setFace(QString iconfile); +- void setUsername(QString username); +- void setPwdType(QString type); +- void setAccountType(QString text); +- +-protected: +- void paintEvent(QPaintEvent *); +- bool eventFilter(QObject *w,QEvent *e); +- +-private slots: +- void pwdLegalityCheck(QString pwd); +- //标准输出 +- void on_readyReadStandardOutput(); +- //标准错误输出 +- void on_readyReadStandardError(); +- //QProcess程序启动输出展示 +- void on_started(); +- //QProcess程序写入展示 +- void on_byteWritten(); +-private: +- Ui::ChangePwdIntelDialog *ui; +- QString nameTip; +- QString pwdTip; +- QString pwdTip_2; +- QString pwdSureTip; +- QHBoxLayout * oldPwdLineEditHLayout; +- QHBoxLayout * pwdLineEditHLayout; +- QHBoxLayout * pwdsureLineEditHLayout; +- QPushButton * showOldPwdBtn; +- QPushButton * showPwdBtn; +- QPushButton * showSurePwdBtn; +- +- bool enablePwdQuality; +- bool isOldPwdVisibel; +- bool isNewPwdVisibel; +- bool isSurePwdVisibel; +- +- QProcess *cmd; +- int process; +- +-#ifdef ENABLEPQ +- pwquality_settings_t *settings; +-#endif +- +-Q_SIGNALS: +- void passwd_send(QString pwd, QString username); +-}; +- +-#endif // CHANGEPWDINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/changepwdinteldialog.ui b/plugins/account/userinfo_intel/changepwdinteldialog.ui +deleted file mode 100644 +index 102f815..0000000 +--- a/plugins/account/userinfo_intel/changepwdinteldialog.ui ++++ /dev/null +@@ -1,661 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>ChangePwdIntelDialog</class> +- <widget class="QDialog" name="ChangePwdIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>378</width> +- <height>490</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>378</width> +- <height>490</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>378</width> +- <height>490</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Change Pwd</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>9</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>80</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>9</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="topFrame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_9"> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>12</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>12</number> +- </property> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="font"> +- <font> +- <family>Noto Sans CJK SC</family> +- <pointsize>13</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>Change Pwd</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>216</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="closeBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>24</width> +- <height>24</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>24</width> +- <height>24</height> +- </size> +- </property> +- <property name="layoutDirection"> +- <enum>Qt::LeftToRight</enum> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- <zorder>horizontalSpacer_4</zorder> +- <zorder>titleLabel</zorder> +- <zorder>closeBtn</zorder> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="frame_2"> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <property name="lineWidth"> +- <number>0</number> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>40</number> +- </property> +- <property name="rightMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>24</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="faceLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>56</width> +- <height>56</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>56</width> +- <height>56</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <property name="scaledContents"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_8"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="usernameLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="aTypeLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="horizontalSpacer_6"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>24</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QWidget" name="widget" native="true"> +- <layout class="QVBoxLayout" name="verticalLayout_11"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_10"> +- <property name="spacing"> +- <number>4</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <item> +- <widget class="QFrame" name="pwdFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="pwdtypeComboBox"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLineEdit" name="oldPwdLineEdit"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="tipLabel_3"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>16</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <pointsize>10</pointsize> +- </font> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <item> +- <widget class="QLineEdit" name="pwdLineEdit"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLabel" name="tipLabel_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>16</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <pointsize>10</pointsize> +- </font> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <item> +- <widget class="QLineEdit" name="pwdsureLineEdit"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLabel" name="tipLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>16</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <pointsize>10</pointsize> +- </font> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>24</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="sizeConstraint"> +- <enum>QLayout::SetDefaultConstraint</enum> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QPushButton" name="cancelPushBtn"> +- <property name="minimumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>Cancel</string> +- </property> +- <property name="flat"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>24</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="confirmPushBtn"> +- <property name="minimumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>Confirm</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/account/userinfo_intel/changetypeinteldialog.cpp b/plugins/account/userinfo_intel/changetypeinteldialog.cpp +deleted file mode 100644 +index cf1ad50..0000000 +--- a/plugins/account/userinfo_intel/changetypeinteldialog.cpp ++++ /dev/null +@@ -1,168 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "changetypeinteldialog.h" +-#include "ui_changetypeinteldialog.h" +- +-#include "elipsemaskwidget.h" +- +-#include <QDebug> +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-ChangeTypeIntelDialog::ChangeTypeIntelDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::ChangeTypeIntelDialog) +-{ +- ui->setupUi(this); +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- ui->titleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); +- ui->closeBtn->setProperty("useIconHighlightEffect", true); +- ui->closeBtn->setProperty("iconHighlightEffectMode", 1); +- ui->closeBtn->setFlat(true); +- ui->closeBtn->setStyleSheet("QPushButton:hover:!pressed#closeBtn{background: #FA6056; border-radius: 4px;}" +- "QPushButton:hover:pressed#closeBtn{background: #E54A50; border-radius: 4px;}"); +- +-// ui->frame->setStyleSheet("QFrame{background: #ffffff; border: none; border-radius: 6px;}"); +-// ui->closeBtn->setStyleSheet("QPushButton{background: #ffffff; border: none;}"); +- +- +- +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- +- setupComonpent(); +- +-} +- +-ChangeTypeIntelDialog::~ChangeTypeIntelDialog() +-{ +- delete ui; +-} +- +-void ChangeTypeIntelDialog::setupComonpent(){ +- +-// ElipseMaskWidget * ctMaskWidget = new ElipseMaskWidget(ui->faceLabel); +-// ctMaskWidget->setGeometry(0, 0, ui->faceLabel->width(), ui->faceLabel->height()); +- +- ui->buttonGroup->setId(ui->standardRadioButton, 0); +- ui->buttonGroup->setId(ui->adminRadioButton, 1); +- +- //给选项卡加背景色,此部分样式应由主题控制,此处只为预览样式改进效果 +- ui->widget->setStyleSheet(".QWidget{background: rgba(245,245,245,1); border-radius: 8px;}"); +- ui->widget_2->setStyleSheet(".QWidget{background: rgba(245,245,245,1); border-radius: 8px;}"); +- +- ui->confirmPushBtn->setEnabled(false); +- +- connect(ui->closeBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +- connect(ui->cancelPushBtn, &QPushButton::clicked, [=](bool checked){ +- Q_UNUSED(checked) +- reject(); +- }); +- connect(ui->confirmPushBtn, &QPushButton::clicked, [=](bool checked){ +- Q_UNUSED(checked) +- this->accept(); +- emit type_send(ui->buttonGroup->checkedId(), ui->usernameLabel->text()); +- }); +-} +- +-void ChangeTypeIntelDialog::setFace(QString faceFile){ +- ui->faceLabel->setPixmap(QPixmap(faceFile)); +-} +- +-void ChangeTypeIntelDialog::setUsername(QString username){ +- ui->usernameLabel->setText(username); +-} +- +-void ChangeTypeIntelDialog::setCurrentAccountTypeLabel(QString atype){ +- ui->typeLabel->setText(atype); +-} +- +-void ChangeTypeIntelDialog::setCurrentAccountTypeBtn(int id){ +- currenttype = id; +- if (id == 0) +- ui->standardRadioButton->setChecked(true); +- else +- ui->adminRadioButton->setChecked(true); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- connect(ui->buttonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [=](int id){ +-#else +- connect(ui->buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), [=](int id){ +-#endif +- if (id != currenttype) +- ui->confirmPushBtn->setEnabled(true); +- else +- ui->confirmPushBtn->setEnabled(false); +- }); +-} +- +-void ChangeTypeIntelDialog::forbidenChange(int total){ +- if (total <= 1 && currenttype == 1){ +- ui->standardRadioButton->setEnabled(false); +- } else { +- ui->standardRadioButton->setEnabled(true); +- } +-} +- +-void ChangeTypeIntelDialog::paintEvent(QPaintEvent *event) { +- Q_UNUSED(event); +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 6, 6); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +-} +- +diff --git a/plugins/account/userinfo_intel/changetypeinteldialog.h b/plugins/account/userinfo_intel/changetypeinteldialog.h +deleted file mode 100644 +index e05dc13..0000000 +--- a/plugins/account/userinfo_intel/changetypeinteldialog.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef CHANGETYPEINTELDIALOG_H +-#define CHANGETYPEINTELDIALOG_H +- +-#include <QDialog> +-#include <QPainter> +-#include <QPainterPath> +- +-namespace Ui { +-class ChangeTypeIntelDialog; +-} +- +-class ChangeTypeIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit ChangeTypeIntelDialog(QWidget *parent = 0); +- ~ChangeTypeIntelDialog(); +- +-public: +- void setupComonpent(); +- +- void setFace(QString faceFile); +- void setUsername(QString name); +- void setCurrentAccountTypeLabel(QString aType); +- void setCurrentAccountTypeBtn(int id); +- +- void forbidenChange(int total); +- +-protected: +- void paintEvent(QPaintEvent *); +- +-private: +- Ui::ChangeTypeIntelDialog *ui; +- +- int currenttype; +- bool currentloginstatus; +- +-Q_SIGNALS: +- void type_send(int type, QString username); +-}; +- +-#endif // CHANGETYPEINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/changetypeinteldialog.ui b/plugins/account/userinfo_intel/changetypeinteldialog.ui +deleted file mode 100644 +index 18d47f2..0000000 +--- a/plugins/account/userinfo_intel/changetypeinteldialog.ui ++++ /dev/null +@@ -1,672 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>ChangeTypeIntelDialog</class> +- <widget class="QDialog" name="ChangeTypeIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>387</width> +- <height>500</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>387</width> +- <height>500</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>387</width> +- <height>500</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Change AccountType</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>9</number> +- </property> +- <property name="topMargin"> +- <number>9</number> +- </property> +- <property name="rightMargin"> +- <number>9</number> +- </property> +- <property name="bottomMargin"> +- <number>9</number> +- </property> +- <item> +- <widget class="QFrame" name="frame_3"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>12</number> +- </property> +- <property name="rightMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>12</number> +- </property> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="font"> +- <font> +- <pointsize>13</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>Change Account Type</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="closeBtn"> +- <property name="minimumSize"> +- <size> +- <width>24</width> +- <height>24</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>24</width> +- <height>24</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="minimumSize"> +- <size> +- <width>369</width> +- <height>434</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>369</width> +- <height>434</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>24</number> +- </property> +- <item> +- <spacer name="verticalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="faceLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>56</width> +- <height>56</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>56</width> +- <height>56</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <property name="scaledContents"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_9"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="usernameLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="typeLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_5"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>24</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QWidget" name="widget" native="true"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>88</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>88</height> +- </size> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="standardRadioButton"> +- <property name="minimumSize"> +- <size> +- <width>16</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>4</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>8</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="label"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="font"> +- <font> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>standard user</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Standard users can use most software, but cannot install software and change system settings</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>8</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QWidget" name="widget_2" native="true"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>88</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>88</height> +- </size> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_10"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_9"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="adminRadioButton"> +- <property name="minimumSize"> +- <size> +- <width>16</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_10"> +- <property name="spacing"> +- <number>4</number> +- </property> +- <property name="topMargin"> +- <number>8</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="label_3"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="font"> +- <font> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>administrator</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_4"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Administrators can make any changes they need</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="tipLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Make sure that there is at least one administrator on the computer</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>24</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="QPushButton" name="cancelPushBtn"> +- <property name="minimumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>Cancel</string> +- </property> +- <property name="flat"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>24</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="confirmPushBtn"> +- <property name="minimumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>Confirm</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +- <buttongroups> +- <buttongroup name="buttonGroup"/> +- </buttongroups> +-</ui> +diff --git a/plugins/account/userinfo_intel/changevalidinteldialog.cpp b/plugins/account/userinfo_intel/changevalidinteldialog.cpp +deleted file mode 100644 +index acb6324..0000000 +--- a/plugins/account/userinfo_intel/changevalidinteldialog.cpp ++++ /dev/null +@@ -1,306 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "changevalidinteldialog.h" +-#include "ui_changevalidinteldialog.h" +- +-#include <QProcess> +-#include <QDBusInterface> +- +-#include <QDebug> +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-ChangeValidIntelDialog::ChangeValidIntelDialog(QString userName, QWidget *parent) : +- QDialog(parent), +- _name(userName), +- ui(new Ui::ChangeValidIntelDialog) +-{ +- ui->setupUi(this); +- +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- ui->titleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); +- ui->closeBtn->setProperty("useIconHighlightEffect", true); +- ui->closeBtn->setProperty("iconHighlightEffectMode", 1); +- ui->closeBtn->setFlat(true); +- +- ui->closeBtn->setStyleSheet("QPushButton:hover:!pressed#closeBtn{background: #FA6056; border-radius: 4px;}" +- "QPushButton:hover:pressed#closeBtn{background: #E54A50; border-radius: 4px;}"); +- +- ui->monthCombox->setMaxVisibleItems(3); +- ui->yearCombox->setMaxVisibleItems(3); +- ui->dayCombox->setMaxVisibleItems(3); +- +- ui->validFrame->setFrameShape(QFrame::Shape::Box); +- +- _getCurrentPwdStatus(); +- +- setupCurrentValid(); +- setupConnect(); +- setupComponent(); +- +-} +- +-ChangeValidIntelDialog::~ChangeValidIntelDialog() +-{ +- delete ui; +-} +- +-void ChangeValidIntelDialog::setupConnect(){ +- connect(ui->closeBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +- connect(ui->cancelBtn, &QPushButton::clicked, [=]{ +- reject(); +- }); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- connect(ui->yearCombox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index){ +-#else +- connect(ui->yearCombox, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){ +-#endif +- setupMonthCombo(); +- setupDayCombo(); +- +- }); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- connect(ui->monthCombox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index){ +-#else +- connect(ui->monthCombox, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){ +-#endif +- setupDayCombo(); +- +- }); +- +- connect(ui->certainBtn, &QPushButton::clicked, [=]{ +- int year = ui->yearCombox->currentData().toInt(); +- QString cmd; +- if (year == 0){ +- cmd = QString("chage -M %1 %2").arg(99999).arg(_name); +- } else { +- int month = ui->monthCombox->currentData().toInt(); +- int day = ui->dayCombox->currentData().toInt(); +- +- QDate selected = QDate(year, month, day); +- +- int setDays = lastChangeDate.daysTo(selected); +- +- cmd = QString("chage -M %1 %2").arg(setDays).arg(_name); +- +- } +- +- QDBusInterface * tmpSysinterface = new QDBusInterface("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- if (!tmpSysinterface->isValid()){ +- qCritical() << "Create Client Interface Failed When execute chage: " << QDBusConnection::systemBus().lastError(); +- return; +- } +- tmpSysinterface->call("systemRun", cmd); +- delete tmpSysinterface; +- +- close(); +- }); +-} +- +-void ChangeValidIntelDialog::setUserLogo(QString iconfile){ +- ui->faceLabel->setPixmap(QPixmap(iconfile)); +-} +- +-void ChangeValidIntelDialog::setUserName(){ +- ui->nameLabel->setText(_name); +-} +- +-void ChangeValidIntelDialog::setUserType(QString atype){ +- ui->typeLabel->setText(atype); +-} +- +-void ChangeValidIntelDialog::_getCurrentPwdStatus(){ +- // +- QString cmd = "passwd -S " + _name; +- +- QProcess * process = new QProcess; +- process->start(cmd); +- process->waitForFinished(); +- +- QByteArray ba = process->readAllStandardOutput(); +- QString valid = QString(ba.data()).simplified(); +- +- if (valid.startsWith(_name)){ +- QStringList validList = valid.split(" "); +- QString lastChangeStr = validList.at(2); +- QStringList lastChangeList = lastChangeStr.split("/"); +- lastChangeDate = QDate(QString(lastChangeList.at(2)).toInt(), QString(lastChangeList.at(0)).toInt(), QString(lastChangeList.at(1)).toInt()); +- delayDays = QString(validList.at(4)).toInt(); +- } else { +- delayDays = -1; +- } +-} +- +-void ChangeValidIntelDialog::setupCurrentValid(){ +- if (lastChangeDate.isValid() && delayDays >= 0){ +- if (delayDays >= 10000){ +- ui->validDateLabel->setText(QObject::tr("Never")); +- } else { +- QDate invalid = lastChangeDate.addDays(delayDays); +- ui->validDateLabel->setText(invalid.toString("yyyy-MM-dd")); +- } +- } else { +- ui->validDateLabel->setText(QObject::tr("Unknown")); +- } +-} +- +-void ChangeValidIntelDialog::setupComponent(){ +- //chage源码中超过10000天会显示从不,10000/365 = 27.3,为了方便显示,取整,界面显示26年 +- if (lastChangeDate.isValid()){ +- setupYearCombo(); +- +- +- setupMonthCombo(); +- ui->monthCombox->blockSignals(true); +- ui->monthCombox->setCurrentIndex(ui->monthCombox->findData(lastChangeDate.addDays(delayDays).month())); +- ui->monthCombox->blockSignals(false); +- +- setupDayCombo(); +- ui->dayCombox->blockSignals(true); +- ui->dayCombox->setCurrentIndex(ui->dayCombox->findData(lastChangeDate.addDays(delayDays).day())); +- ui->dayCombox->blockSignals(false); +- } else { +- +- } +-} +- +-void ChangeValidIntelDialog::setupYearCombo(){ +- ui->yearCombox->blockSignals(true); +- ui->yearCombox->clear(); +- +- QDate begin = QDate::currentDate().addDays(1); +- QDate canSelect = lastChangeDate.addYears(26); +- +- ui->yearCombox->addItem(QObject::tr("Never"), 0); +- for (int year = begin.year(); year <= canSelect.year(); year++){ +- ui->yearCombox->addItem(QString::number(year)+QObject::tr("Year"), year); +- } +- +- if (delayDays > 10000) +- ui->yearCombox->setCurrentIndex(0); +- else +- ui->yearCombox->setCurrentIndex(ui->yearCombox->findData(lastChangeDate.addDays(delayDays).year())); +- +- ui->yearCombox->blockSignals(false); +-} +- +-void ChangeValidIntelDialog::setupMonthCombo(){ +- ui->monthCombox->blockSignals(true); +- +- ui->monthCombox->clear(); +- +- int year = ui->yearCombox->currentData().toInt(); +- if (year > 0){ +- ui->monthCombox->addItem(QObject::tr("Jan"), 1); +- ui->monthCombox->addItem(QObject::tr("Feb"), 2); +- ui->monthCombox->addItem(QObject::tr("Mar"), 3); +- ui->monthCombox->addItem(QObject::tr("Apr"), 4); +- ui->monthCombox->addItem(QObject::tr("May"), 5); +- ui->monthCombox->addItem(QObject::tr("Jun"), 6); +- ui->monthCombox->addItem(QObject::tr("Jul"), 7); +- ui->monthCombox->addItem(QObject::tr("Aug"), 8); +- ui->monthCombox->addItem(QObject::tr("Sep"), 9); +- ui->monthCombox->addItem(QObject::tr("Oct"), 10); +- ui->monthCombox->addItem(QObject::tr("Nov"), 11); +- ui->monthCombox->addItem(QObject::tr("Dec"), 12); +- } +- +- +- +- ui->monthCombox->blockSignals(false); +-} +- +-void ChangeValidIntelDialog::setupDayCombo(){ +- ui->dayCombox->blockSignals(true); +- +- ui->dayCombox->clear(); +- +- int year = ui->yearCombox->currentData().toInt(); +- +- if (year > 0){ +- int month = ui->monthCombox->currentData().toInt(); +- if (month){ +- QDate selected = QDate(year, month, 1); +- int days = selected.daysInMonth(); +- for (int d = 1; d <= days; d++){ +- ui->dayCombox->addItem(QString::number(d)+QObject::tr("Day"), d); +- } +- } +- } else { +- +- } +- +- ui->dayCombox->blockSignals(false); +-} +- +- +-void ChangeValidIntelDialog::paintEvent(QPaintEvent * event){ +- Q_UNUSED(event) +- +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 6, 6); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +-} +diff --git a/plugins/account/userinfo_intel/changevalidinteldialog.h b/plugins/account/userinfo_intel/changevalidinteldialog.h +deleted file mode 100644 +index ade9511..0000000 +--- a/plugins/account/userinfo_intel/changevalidinteldialog.h ++++ /dev/null +@@ -1,72 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef CHANGEVALIDINTELDIALOG_H +-#define CHANGEVALIDINTELDIALOG_H +- +-#include <QDialog> +- +-#include <QDate> +- +-#include <QPainter> +-#include <QPainterPath> +- +- +-namespace Ui { +-class ChangeValidIntelDialog; +-} +- +-class ChangeValidIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit ChangeValidIntelDialog(QString userName, QWidget *parent = 0); +- ~ChangeValidIntelDialog(); +- +- void setupConnect(); +- +- void setUserName(); +- void setUserLogo(QString face); +- void setUserType(QString atype); +- +- void _getCurrentPwdStatus(); +- +- void setupCurrentValid(); +- void setupComponent(); +- +- void setupYearCombo(); +- void setupMonthCombo(); +- void setupDayCombo(); +- +-protected: +- void paintEvent(QPaintEvent *); +- +-private: +- Ui::ChangeValidIntelDialog *ui; +- +-private: +- QString _name; +- +- QDate lastChangeDate; +- +- int delayDays; +-}; +- +-#endif // CHANGEVALIDINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/changevalidinteldialog.ui b/plugins/account/userinfo_intel/changevalidinteldialog.ui +deleted file mode 100644 +index aabee4c..0000000 +--- a/plugins/account/userinfo_intel/changevalidinteldialog.ui ++++ /dev/null +@@ -1,520 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>ChangeValidIntelDialog</class> +- <widget class="QDialog" name="ChangeValidIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>370</width> +- <height>410</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>370</width> +- <height>410</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>370</width> +- <height>410</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>13</number> +- </property> +- <property name="rightMargin"> +- <number>13</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="closeFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>36</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="closeBtn"> +- <property name="minimumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>18</number> +- </property> +- <property name="leftMargin"> +- <number>32</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>32</number> +- </property> +- <property name="bottomMargin"> +- <number>48</number> +- </property> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Password Validity Setting</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="infoFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>60</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>60</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="faceLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>48</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>48</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <property name="scaledContents"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <item> +- <widget class="QLabel" name="nameLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="typeLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <item> +- <widget class="QLabel" name="label"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Current passwd validity:</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="validDateLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QFrame" name="adjustFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>80</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>80</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_8"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_7"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="label_5"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Adjust date to:</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="validFrame"> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_9"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QComboBox" name="yearCombox"/> +- </item> +- <item> +- <widget class="QComboBox" name="dayCombox"/> +- </item> +- <item> +- <widget class="QComboBox" name="monthCombox"/> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="btnFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>40</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>40</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="cancelBtn"> +- <property name="text"> +- <string>Cancel</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="certainBtn"> +- <property name="text"> +- <string>Certain</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/account/userinfo_intel/creategroupinteldialog.cpp b/plugins/account/userinfo_intel/creategroupinteldialog.cpp +deleted file mode 100644 +index 278f2c7..0000000 +--- a/plugins/account/userinfo_intel/creategroupinteldialog.cpp ++++ /dev/null +@@ -1,168 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2020 KYLINOS Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +- +-#include "creategroupinteldialog.h" +-#include "ui_creategroupinteldialog.h" +-#include "userinfo_intel.h" +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-CreateGroupIntelDialog::CreateGroupIntelDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::CreateGroupIntelDialog) +-{ +- ui->setupUi(this); +- setupInit(); +- getUsersList(); +- signalsBind(); +-} +- +-CreateGroupIntelDialog::~CreateGroupIntelDialog() +-{ +- delete ui; +-} +- +-void CreateGroupIntelDialog::limitInput() +-{ +- QIntValidator *intValidator = new QIntValidator; +- //QRegExp rx("^[a-zA-z]+$");// 首字符为字母 +- QRegExp rx("[a-zA-z]{40}"); +- QRegExpValidator *regValidator = new QRegExpValidator(rx); +- //intValidator->setRange(0, 65535); +- intValidator->setBottom(0); +- // 整形输入限制 +- ui->lineEdit_id->setValidator(intValidator); +- // 字母输入限制 +- ui->lineEdit_name->setValidator(regValidator); +- // 字符长度限制 +- //ui->lineEdit_name->setMaxLength(4); +-} +- +-void CreateGroupIntelDialog::refreshCertainBtnStatus(){ +- if (ui->lineEdit_name->text().isEmpty() || +- ui->lineEdit_id->text().isEmpty()) +- ui->certainBtn->setEnabled(false); +- else +- ui->certainBtn->setEnabled(true); +-} +- +-void CreateGroupIntelDialog::getUsersList() +-{ +- UserInfoIntel * userinfo = new UserInfoIntel; +- QStringList usersList = userinfo->getUsersList(); +- qDebug() << "CreateGroupIntelDialog::getUsersList" << usersList.at(0) << usersList.at(1); +- for(int i = 0; i < usersList.size(); i++){ +- QListWidgetItem * item = new QListWidgetItem(ui->listWidget); +- item->setSizeHint(QSize(ui->listWidget->width(), 36)); +- item->setData(Qt::UserRole, ""); +- QCheckBox * box = new QCheckBox(usersList.at(i)); +- ui->listWidget->addItem(item); +- ui->listWidget->setItemWidget(item, box); +- } +-} +- +-void CreateGroupIntelDialog::signalsBind() +-{ +- connect(ui->closeBtn, &QPushButton::clicked, [=](bool checked){ +- Q_UNUSED(checked) +- close(); +- }); +- connect(ui->cancelBtn,&QPushButton::clicked,[=](){ +- close(); +- }); +- connect(ui->lineEdit_name,&QLineEdit::textChanged,[=](QString txt){ +- refreshCertainBtnStatus(); +- }); +- connect(ui->lineEdit_id,&QLineEdit::textChanged,[=](QString txt){ +- refreshCertainBtnStatus(); +- }); +-} +- +-void CreateGroupIntelDialog::setupInit() +-{ +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- ui->titleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); +- ui->closeBtn->setProperty("useIconHighlightEffect", true); +- ui->closeBtn->setProperty("iconHighlightEffectMode", 1); +- ui->closeBtn->setFlat(true); +- +- ui->closeBtn->setStyleSheet("QPushButton:hover:!pressed#closeBtn{background: #FA6056; border-radius: 4px;}" +- "QPushButton:hover:pressed#closeBtn{background: #E54A50; border-radius: 4px;}"); +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- ui->listWidget->setFocusPolicy(Qt::NoFocus); +- ui->listWidget->setSelectionMode(QAbstractItemView::NoSelection); +- ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +- ui->listWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +-// ui->listWidget->setSpacing(5); +- ui->lineEdit_name->setStyleSheet("QLineEdit{background:#EEEEEE;}"); +- ui->lineEdit_id->setStyleSheet("QLineEdit{background:#EEEEEE;}"); +- ui->listWidget->setStyleSheet("QListWidget{background:#EEEEEE; border-radius: 4px;}" +- "QListWidget::Item:hover{background:#FFE1E1E1}" +- "QListWidget::Item{padding-left:20px;}"); +- +- // 设置确认按钮 +- refreshCertainBtnStatus(); +- // 限制组名输入规则 +- limitInput(); +- // +-} +- +-void CreateGroupIntelDialog::paintEvent(QPaintEvent *event) { +- Q_UNUSED(event); +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 6, 6); +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +- +-} +diff --git a/plugins/account/userinfo_intel/creategroupinteldialog.h b/plugins/account/userinfo_intel/creategroupinteldialog.h +deleted file mode 100644 +index 9952b8e..0000000 +--- a/plugins/account/userinfo_intel/creategroupinteldialog.h ++++ /dev/null +@@ -1,59 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2020 KYLINOS Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +- +-#ifndef CREATEGROUPINTELDIALOG_H +-#define CREATEGROUPINTELDIALOG_H +- +-#include <QDialog> +-#include <QPainter> +-#include <QPainterPath> +-#include <QCheckBox> +-#include <QIntValidator> +-#include <QRegExpValidator> +- +-class UserInfo; +-namespace Ui { +-class CreateGroupIntelDialog; +-} +- +-class CreateGroupIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit CreateGroupIntelDialog(QWidget *parent = nullptr); +- ~CreateGroupIntelDialog(); +- +-public: +- void limitInput(); +- void getUsersList(); +- void refreshCertainBtnStatus(); +- +-protected: +- void paintEvent(QPaintEvent *event); +- +-private: +- Ui::CreateGroupIntelDialog *ui; +- +- void setupInit(); +- void signalsBind(); +-}; +- +-#endif // CREATEGROUPINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/creategroupinteldialog.ui b/plugins/account/userinfo_intel/creategroupinteldialog.ui +deleted file mode 100644 +index 3ab29e9..0000000 +--- a/plugins/account/userinfo_intel/creategroupinteldialog.ui ++++ /dev/null +@@ -1,380 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>CreateGroupIntelDialog</class> +- <widget class="QDialog" name="CreateGroupIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>460</width> +- <height>530</height> +- </rect> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <widget class="QFrame" name="frame"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>455</width> +- <height>529</height> +- </rect> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <widget class="QWidget" name="layoutWidget"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>466</width> +- <height>562</height> +- </rect> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>23</number> +- </property> +- <property name="topMargin"> +- <number>8</number> +- </property> +- <property name="bottomMargin"> +- <number>58</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="topMargin"> +- <number>8</number> +- </property> +- <property name="rightMargin"> +- <number>8</number> +- </property> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="closeBtn"> +- <property name="minimumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>30</number> +- </property> +- <property name="leftMargin"> +- <number>35</number> +- </property> +- <property name="rightMargin"> +- <number>33</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Add New Group</string> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QLabel" name="label"> +- <property name="text"> +- <string>Group Name</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLineEdit" name="lineEdit_name"> +- <property name="minimumSize"> +- <size> +- <width>256</width> +- <height>0</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QLabel" name="label_3"> +- <property name="text"> +- <string>Group Id</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLineEdit" name="lineEdit_id"> +- <property name="minimumSize"> +- <size> +- <width>256</width> +- <height>0</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_9"> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <item> +- <spacer name="horizontalSpacer_5"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QLabel" name="label_2"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string>Group Members</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QListWidget" name="listWidget"> +- <property name="minimumSize"> +- <size> +- <width>256</width> +- <height>194</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>256</width> +- <height>194</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QFrame" name="btnFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>40</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>40</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="cancelBtn"> +- <property name="minimumSize"> +- <size> +- <width>100</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>100</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Cancel</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="certainBtn"> +- <property name="minimumSize"> +- <size> +- <width>100</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>100</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Certain</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </widget> +- </widget> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/account/userinfo_intel/createuserinteldialog.cpp b/plugins/account/userinfo_intel/createuserinteldialog.cpp +deleted file mode 100644 +index c91e765..0000000 +--- a/plugins/account/userinfo_intel/createuserinteldialog.cpp ++++ /dev/null +@@ -1,567 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "createuserinteldialog.h" +-#include "ui_createuserinteldialog.h" +- +-#include "passwdcheckutil.h" +- +-#include <QDebug> +-#include <QDir> +- +-#define MOBILE 0 +-#define PC 1 +-#define PWD_LOW_LENGTH 6 +-#define PWD_HIGH_LENGTH 20 +-#define PIN_LENGTH 6 +-#define USER_LENGTH 32 +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-CreateUserIntelDialog::CreateUserIntelDialog(QStringList userlist, QWidget *parent) : +- QDialog(parent), +- ui(new Ui::CreateUserIntelDialog), +- usersStringList(userlist) +-{ +-// installEventFilter(this); +- ui->setupUi(this); +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- ui->titleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); +- ui->closeBtn->setProperty("useIconHighlightEffect", true); +- ui->closeBtn->setProperty("iconHighlightEffectMode", 1); +- ui->closeBtn->setFlat(true); +- +- ui->closeBtn->setStyleSheet("QPushButton:hover:!pressed#closeBtn{background: #FA6056; border-radius: 4px;}" +- "QPushButton:hover:pressed#closeBtn{background: #E54A50; border-radius: 4px;}"); +-// ui->tipLabel->setAlignment(Qt::AlignCenter); +- +- ui->label_8->adjustSize(); +- ui->label_8->setWordWrap(true); +- +- ui->label_10->adjustSize(); +- ui->label_10->setWordWrap(true); +- +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- initPwdChecked(); +- setupComonpent(); +- setupConnect(); +-} +- +-CreateUserIntelDialog::~CreateUserIntelDialog() +-{ +- delete ui; +-// delete process; +-} +- +-void CreateUserIntelDialog::initPwdChecked(){ +- +-#ifdef ENABLEPQ +- int ret; +- void *auxerror; +- char buf[255]; +- +- settings = pwquality_default_settings(); +- if (settings == NULL) { +- enablePwdQuality = false; +- qDebug() << "init pwquality settings failed"; +- } else { +- enablePwdQuality = true; +- } +- +- ret = pwquality_read_config(settings, PWCONF, &auxerror); +- if (ret != 0){ +- enablePwdQuality = false; +- qDebug() << "Reading pwquality configuration file failed: " << pwquality_strerror(buf, sizeof(buf), ret, auxerror); +- } else { +- enablePwdQuality = true; +- } +- +- if (PasswdCheckUtil::getCurrentPamState()){ +- enablePwdQuality = true; +- } else { +- enablePwdQuality = false; +- } +- +-#else +- enablePwdQuality = false; +-#endif +- +-} +- +-void CreateUserIntelDialog::setupComonpent(){ +- nameTip = ""; +- pwdTip = ""; +- pwdSureTip = ""; +- +- //给选项卡加背景色,此部分样式应由主题控制,此处只为预览样式改进效果 +- ui->widget->setStyleSheet(".QWidget{background: rgba(245,245,245,1); border-radius: 8px;}"); +- ui->widget_2->setStyleSheet(".QWidget{background: rgba(245,245,245,1); border-radius: 8px;}"); +- +- ui->pwdLineEdit->setEchoMode(QLineEdit::Password); +- ui->pwdsureLineEdit->setEchoMode(QLineEdit::Password); +-// ui->pinLineEdit->setEchoMode(QLineEdit::Password); +-// ui->pinsureLineEdit->setEchoMode(QLineEdit::Password); +- +-// QString required = tr("(Required)"); +-// QString optional = tr("(Optional)"); +-// if (ostype == PC){ +-// ui->pwdLabel->setText(required); +-// ui->pwdsurelabel->setText(required); +-// ui->pinLabel->setText(optional); +-// ui->pinsurelabel->setText(optional); +-// } +-// else{ +-// ui->pwdLabel->setText(optional); +-// ui->pwdsurelabel->setText(optional); +-// ui->pinLabel->setText(required); +-// ui->pinsurelabel->setText(required); +-// } +- +- ui->usernameLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->usernameLineEdit->installEventFilter(this); +- ui->pwdLineEdit->installEventFilter(this); +- ui->pwdsureLineEdit->installEventFilter(this); +- +- ui->usernameLineEdit->setPlaceholderText(tr("UserName")); +- ui->pwdLineEdit->setPlaceholderText(tr("Password")); +- ui->pwdsureLineEdit->setPlaceholderText(tr("Password Identify")); +- +- ui->usernameLineEdit->setTextMargins(16,0,32,0); +- ui->pwdLineEdit->setTextMargins(16,0,32,0); +- ui->pwdsureLineEdit->setTextMargins(16,0,32,0); +- +- pwdLineEditHLayout = new QHBoxLayout(); +- pwdsureLineEditHLayout = new QHBoxLayout(); +- +- showPwdBtn = new QPushButton(); +- showPwdBtn->setFixedSize(QSize(16, 16)); +- +- pwdLineEditHLayout->addStretch(); +- pwdLineEditHLayout->addWidget(showPwdBtn); +- pwdLineEditHLayout->setContentsMargins(0,0,16,0); +- ui->pwdLineEdit->setLayout(pwdLineEditHLayout); +- +- showSurePwdBtn = new QPushButton(); +- showSurePwdBtn->setFixedSize(QSize(16, 16)); +- +- pwdsureLineEditHLayout->addStretch(); +- pwdsureLineEditHLayout->addWidget(showSurePwdBtn); +- pwdsureLineEditHLayout->setContentsMargins(0,0,16,0); +- ui->pwdsureLineEdit->setLayout(pwdsureLineEditHLayout); +- +- showPwdBtn->setCursor(QCursor(Qt::ArrowCursor)); +- showSurePwdBtn->setCursor(QCursor(Qt::ArrowCursor)); +- +- showPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- showSurePwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- +-// connect(showPwdBtn, &QPushButton::pressed, this, [=]{ +-// ui->pwdLineEdit->setEchoMode(QLineEdit::Normal); +-// }); +-// connect(showPwdBtn, &QPushButton::released, this, [=]{ +-// ui->pwdLineEdit->setEchoMode(QLineEdit::Password); +-// ui->pwdLineEdit->setFocus(); +-// }); +-// connect(showSurePwdBtn, &QPushButton::pressed, this, [=]{ +-// ui->pwdsureLineEdit->setEchoMode(QLineEdit::Normal); +-// }); +-// connect(showSurePwdBtn, &QPushButton::released, this, [=]{ +-// ui->pwdsureLineEdit->setEchoMode(QLineEdit::Password); +-// ui->pwdsureLineEdit->setFocus(); +-// }); +- connect(showPwdBtn, &QPushButton::clicked, this, [=]{ +- if(isPwdVisibel){ +- ui->pwdLineEdit->setEchoMode(QLineEdit::Password); +- isPwdVisibel = false; +- showPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- +- } else { +- ui->pwdLineEdit->setEchoMode(QLineEdit::Normal); +- isPwdVisibel = true; +- showPwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdUnscramble.png);}"); +- } +- ui->usernameLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setFocus(); +- }); +- connect(showSurePwdBtn, &QPushButton::clicked, this, [=]{ +- if(isSurePwdVisibel){ +- ui->pwdsureLineEdit->setEchoMode(QLineEdit::Password); +- isSurePwdVisibel = false; +- showSurePwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdEncrypted.png);}"); +- +- } else { +- ui->pwdsureLineEdit->setEchoMode(QLineEdit::Normal); +- isSurePwdVisibel = true; +- showSurePwdBtn->setStyleSheet("QPushButton{border-image: url(:/img/plugins/userinfo_intel/pwdUnscramble.png);}"); +- } +- ui->usernameLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdsureLineEdit->setFocus(); +- }); +-// ui->pinLineEdit->setPlaceholderText(tr("PIN Code")); +-// ui->pinsureLineEdit->setPlaceholderText(tr("PIN Code Identify")); +- +-// ui->pwdTypeComBox->addItem(tr("General Password")); +- +-// //给radiobtn设置id,id即accoutnType,方便直接返回id值 +- ui->buttonGroup->setId(ui->standardRadioBtn, 0); +- ui->buttonGroup->setId(ui->adminRadioBtn, 1); +- +-// //默认标准用户 +- ui->standardRadioBtn->setChecked(true); +- +- //设置确定按钮 +- refreshConfirmBtnStatus(); +- +-// confirm_btn_status_refresh(); +-} +- +-bool CreateUserIntelDialog::eventFilter(QObject *w, QEvent *e) { +- if(w == ui->usernameLineEdit) { +- if(e->type() == QEvent::MouseButtonPress) { +- ui->usernameLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- } +- } else if(w == ui->pwdLineEdit) { +- if(e->type() == QEvent::MouseButtonPress) { +- ui->usernameLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- } +- } else if(w == ui->pwdsureLineEdit) { +- if(e->type() == QEvent::MouseButtonPress) { +- ui->usernameLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);}"); +- ui->pwdsureLineEdit->setStyleSheet("QLineEdit{border-radius: 8px;" +- "background: palett(base);" +- "border: 2px solid #2FB3E8;}"); +- } +- } +- return QWidget::eventFilter(w,e); +-} +- +-void CreateUserIntelDialog::setupConnect(){ +- +- connect(ui->closeBtn, &QPushButton::clicked, [=](bool checked){ +- Q_UNUSED(checked) +- close(); +- }); +- +- connect(ui->usernameLineEdit, &QLineEdit::textChanged, [=](QString text){ +- nameLegalityCheck(text); +- }); +- +- connect(ui->pwdLineEdit, &QLineEdit::textChanged, [=](QString text){ +- pwdLegalityCheck(text); +- }); +- +- connect(ui->pwdsureLineEdit, &QLineEdit::textChanged, [=](QString text){ +- if (!text.isEmpty() && text != ui->pwdLineEdit->text()){ +- pwdSureTip = tr("Inconsistency with pwd"); +- } else { +- pwdSureTip = ""; +- } +- +- ui->tipLabel->setText(pwdSureTip); +-// if (pwdSureTip.isEmpty()){ +-// pwdTip.isEmpty() ? ui->tipLabel->setText(nameTip) : ui->tipLabel->setText(pwdTip); +-// } +- +- refreshConfirmBtnStatus(); +- }); +- +- // connect(ui->confirmPushBtn, SIGNAL(clicked(bool)), this, SLOT(confirm_btn_clicked_slot())); +- // connect(ui->usernameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(name_legality_check_slot(QString))); +- // connect(ui->pwdLineEdit, SIGNAL(textChanged(QString)), this, SLOT(pwd_legality_check_slot(QString))); +- // connect(ui->pwdsureLineEdit, SIGNAL(textChanged(QString)), this, SLOT(pwdsure_legality_check_slot(QString))); +- +- connect(ui->confirmBtn, &QPushButton::clicked, [=](bool checked){ +- Q_UNUSED(checked) +- this->accept(); +- QString uName, pwd, pin; +- +- uName = ui->usernameLineEdit->text(); +-// if (ui->pwdTypeComBox->currentIndex() == 0){ +-// pwd = ui->pwdLineEdit->text(); +-// pin = ""; +-// } else { +-// pwd = ""; +-// pin = ui->pwdLineEdit->text(); +-// } +- pwd = ui->pwdLineEdit->text(); +- pin = ""; +- +- emit newUserWillCreate(uName, pwd, pin, ui->buttonGroup->checkedId()); +- +- }); +- +- connect(ui->cancelBtn, &QPushButton::clicked, [=](bool checked){ +- Q_UNUSED(checked) +- reject(); +- }); +-} +- +-//void CreateUserIntelDialog::set_face_label(QString iconfile){ +-// ui->faceLabel->setPixmap(QPixmap(iconfile).scaled(QSize(80, 80))); +-//} +- +-//void CreateUserIntelDialog::tiplabel_status_refresh(){ +-// if (ui->usernametipLabel->text().isEmpty()) +-// ui->usernametipLabel->hide(); +-// else +-// ui->usernametipLabel->show(); +- +-// if (ui->pwdtipLabel->text().isEmpty()) +-// ui->pwdtipLabel->hide(); +-// else +-// ui->pwdtipLabel->show(); +- +-// if (ui->pwdsuretipLabel->text().isEmpty()) +-// ui->pwdsuretipLabel->hide(); +-// else +-// ui->pwdsuretipLabel->show(); +- +-// if (ui->pintipLabel->text().isEmpty()) +-// ui->pintipLabel->hide(); +-// else +-// ui->pintipLabel->show(); +- +-// if (ui->pinsuretipLabel->text().isEmpty()) +-// ui->pinsuretipLabel->hide(); +-// else +-// ui->pinsuretipLabel->show(); +-//} +- +-void CreateUserIntelDialog::setRequireLabel(QString msg){ +-// ui->requireLabel->setText(msg); +-} +- +-void CreateUserIntelDialog::refreshConfirmBtnStatus(){ +- if (ui->usernameLineEdit->text().isEmpty() || +- ui->pwdLineEdit->text().isEmpty() || +- ui->pwdsureLineEdit->text().isEmpty() || +- !nameTip.isEmpty() || !pwdTip.isEmpty() || !pwdSureTip.isEmpty()) +- ui->confirmBtn->setEnabled(false); +- else +- ui->confirmBtn->setEnabled(true); +-} +- +- +-void CreateUserIntelDialog::pwdLegalityCheck(QString pwd){ +- if (enablePwdQuality){ +-#ifdef ENABLEPQ +- void * auxerror; +- int ret; +- const char * msg; +- char buf[256]; +- +- QByteArray ba = pwd.toLatin1(); +- +- ret = pwquality_check(settings, ba.data(), NULL, NULL, &auxerror); +- if (ret < 0 && pwd.length() > 0){ +- msg = pwquality_strerror(buf, sizeof(buf), ret, auxerror); +- pwdTip = QString(msg); +- } else { +- pwdTip = ""; +- } +-#endif +- } else { +- if (pwd.length() < PWD_LOW_LENGTH) { +- pwdTip = tr("Password length needs to more than %1 character!").arg(PWD_LOW_LENGTH - 1); +- } else if (pwd.length() > PWD_HIGH_LENGTH) { +- pwdTip = tr("Password length needs to less than %1 character!").arg(PWD_HIGH_LENGTH + 1); +- } else { +- pwdTip = ""; +- } +- } +- +- //防止先输入确认密码,再输入密码后pwdsuretipLabel无法刷新 +- if (!ui->pwdsureLineEdit->text().isEmpty()){ +- if (ui->pwdLineEdit->text() == ui->pwdsureLineEdit->text()) { +- pwdSureTip = ""; +- } else { +- pwdSureTip = tr("Inconsistency with pwd"); +- } +- } +- +- ui->tipLabel_2->setText(pwdTip); +-// if (pwdTip.isEmpty()){ +-// pwdSureTip.isEmpty() ? ui->tipLabel->setText(nameTip) : ui->tipLabel->setText(pwdSureTip); +-// } +- +- refreshConfirmBtnStatus(); +-} +- +- +-void CreateUserIntelDialog::paintEvent(QPaintEvent *event) { +- Q_UNUSED(event); +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- QRect rect = this->rect(); +- rect.setWidth(rect.width()-0); +- rect.setHeight(rect.height()-0); +- rectPath.addRoundedRect(rect,12,12); +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +- +-} +- +-void CreateUserIntelDialog::keyPressEvent(QKeyEvent *event) +-{ +- if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return ) { +- if( ui->confirmBtn->isEnabled()) { +- ui->confirmBtn->click(); +- } +- return; +- } +- QDialog::keyPressEvent(event); +-} +- +-QStringList CreateUserIntelDialog::getHomeUser() +-{ +- QStringList homeList; +- QDir dir("/home"); +- if (dir.exists()) +- { +- homeList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); +- } +- +- return homeList; +-} +- +-bool CreateUserIntelDialog::nameTraverse(QString username){ +- QString::const_iterator cit = NULL; +- for (cit = username.cbegin(); cit < username.cend(); cit++){ +- QString str = *cit; +- if (str.contains(QRegExp("[a-z]"))){ +- } else if (str.contains(QRegExp("[0-9]"))){ +- } else if (str.contains("_")){ +- } else{ +- return false; +- } +- } +- return true; +-} +- +-void CreateUserIntelDialog::nameLegalityCheck(QString username){ +- +- if (username.isEmpty()) +- nameTip = tr("The user name cannot be empty"); +- else if (username.startsWith("_") || username.left(1).contains((QRegExp("[0-9]")))){ +- nameTip = tr("The first character must be lowercase letters!"); +- } +- else if (username.contains(QRegExp("[A-Z]"))){ +- nameTip = tr("User name can not contain capital letters!"); +- } +- else if (nameTraverse(username)) +- if (username.length() > 0 && username.length() < USER_LENGTH){ +- /* +- * 此处代码需要优化 +- */ +-// back = false; +-// QString cmd = QString("getent group %1").arg(username); +-// process = new QProcess(this); +-// connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(name_conflict_group_slot())); +-// process->start(cmd); +- +- if (usersStringList.contains(username)){ +- nameTip = tr("The user name is already in use, please use a different one."); +- } else { +- nameTip = ""; +- } +- } else { +- nameTip = tr("User name length need to less than %1 letters!").arg(USER_LENGTH); +- } else { +- nameTip = tr("The user name can only be composed of letters, numbers and underline!"); +- } +- +- QStringList homeDir = getHomeUser(); +- if (homeDir.contains(username) && nameTip.isEmpty()) { +- nameTip = tr("The username is configured, please change the username"); +- } +- +- ui->tipLabel_3->setText(nameTip); +- +-// if (nameTip.isEmpty()){ +-// pwdTip.isEmpty() ? ui->tipLabel->setText(pwdSureTip) : ui->tipLabel->setText(pwdTip); +-// } +- +- refreshConfirmBtnStatus(); +-} +diff --git a/plugins/account/userinfo_intel/createuserinteldialog.h b/plugins/account/userinfo_intel/createuserinteldialog.h +deleted file mode 100644 +index 2198370..0000000 +--- a/plugins/account/userinfo_intel/createuserinteldialog.h ++++ /dev/null +@@ -1,109 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef CREATEUSERINTELDIALOG_H +-#define CREATEUSERINTELDIALOG_H +- +-#include <QDialog> +-#include <QProcess> +-#include <QPainter> +-#include <QPainterPath> +-#include <QKeyEvent> +-#include <QFile> +-#include <QStyledItemDelegate> +-#include <QHBoxLayout> +-#include <QPushButton> +- +-#ifdef ENABLEPQ +-extern "C" { +- +-#include <pwquality.h> +- +-} +-#define PWCONF "/etc/security/pwquality.conf" +-#define RFLAG 0x1 +-#define CFLAG 0x2 +-#endif +- +-namespace Ui { +-class CreateUserIntelDialog; +-} +- +-class CreateUserIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit CreateUserIntelDialog(QStringList userlist, QWidget *parent = 0); +- ~CreateUserIntelDialog(); +- +-public: +- void setupComonpent(); +- void setupConnect(); +- void setRequireLabel(QString msg); +- +- void refreshConfirmBtnStatus(); +- +- void nameLegalityCheck(QString username); +- void pwdLegalityCheck(QString pwd); +- bool nameTraverse(QString username); +- +- void initPwdChecked(); +- +- QHBoxLayout * pwdLineEditHLayout; +- QHBoxLayout * pwdsureLineEditHLayout; +- QPushButton * showPwdBtn; +- QPushButton * showSurePwdBtn; +- +-protected: +- void paintEvent(QPaintEvent *); +- void keyPressEvent(QKeyEvent *); +- bool eventFilter(QObject *w,QEvent *e); +- +-private: +- QStringList getHomeUser(); +- +-private: +- Ui::CreateUserIntelDialog *ui; +- +- bool back; +- bool isCreateUser = false; +- bool enablePwdQuality; +- +- bool isPwdVisibel = false; +- bool isSurePwdVisibel = false; +- +- QProcess * process; +- +- QString nameTip; +- QString pwdTip; +- QString pwdSureTip; +- +- QStringList usersStringList; +- +-#ifdef ENABLEPQ +- pwquality_settings_t *settings; +-#endif +- +-Q_SIGNALS: +- void newUserWillCreate(QString username, QString pwd, QString pin, int atype); +- +-}; +- +-#endif // CREATEUSERINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/createuserinteldialog.ui b/plugins/account/userinfo_intel/createuserinteldialog.ui +deleted file mode 100644 +index b0b0632..0000000 +--- a/plugins/account/userinfo_intel/createuserinteldialog.ui ++++ /dev/null +@@ -1,778 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>CreateUserIntelDialog</class> +- <widget class="QDialog" name="CreateUserIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>360</width> +- <height>628</height> +- </rect> +- </property> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>628</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>628</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Create User</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="frame_4"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>48</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>12</number> +- </property> +- <property name="rightMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>12</number> +- </property> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="font"> +- <font> +- <pointsize>13</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>Add New Account</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="closeBtn"> +- <property name="minimumSize"> +- <size> +- <width>24</width> +- <height>24</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>24</width> +- <height>24</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>360</width> +- <height>580</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>360</width> +- <height>580</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_8"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>24</number> +- </property> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>24</number> +- </property> +- <item> +- <widget class="QWidget" name="widget_3" native="true"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_10"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLineEdit" name="usernameLineEdit"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLabel" name="tipLabel_3"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>24</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>24</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <family>Noto Sans CJK SC</family> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_12"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLineEdit" name="pwdLineEdit"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLabel" name="tipLabel_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>24</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>24</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <family>Noto Sans CJK SC</family> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_13"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLineEdit" name="pwdsureLineEdit"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>48</height> +- </size> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QLabel" name="tipLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>24</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>24</height> +- </size> +- </property> +- <property name="font"> +- <font> +- <pointsize>10</pointsize> +- </font> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_9"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="label_6"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Account Type</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="widget" native="true"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>90</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>90</height> +- </size> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="standardRadioBtn"> +- <property name="minimumSize"> +- <size> +- <width>20</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>20</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>4</number> +- </property> +- <property name="topMargin"> +- <number>8</number> +- </property> +- <property name="bottomMargin"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="label_7"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="font"> +- <font> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>standard user</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_8"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Standard users can use most software, but cannot install the software and +-change system settings</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="widget_2" native="true"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>90</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>90</height> +- </size> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_9"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="QRadioButton" name="adminRadioBtn"> +- <property name="minimumSize"> +- <size> +- <width>20</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>20</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>4</number> +- </property> +- <property name="topMargin"> +- <number>8</number> +- </property> +- <property name="bottomMargin"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="label_9"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="font"> +- <font> +- <pointsize>12</pointsize> +- </font> +- </property> +- <property name="text"> +- <string>administrator</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label_10"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Administrators can make any changes they need</string> +- </property> +- <property name="wordWrap"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_10"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <item> +- <widget class="QPushButton" name="cancelBtn"> +- <property name="minimumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>Cancel</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="confirmBtn"> +- <property name="minimumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>144</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>Confirm</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +- <buttongroups> +- <buttongroup name="buttonGroup"/> +- </buttongroups> +-</ui> +diff --git a/plugins/account/userinfo_intel/definegroupitemintel.cpp b/plugins/account/userinfo_intel/definegroupitemintel.cpp +deleted file mode 100644 +index b92c92c..0000000 +--- a/plugins/account/userinfo_intel/definegroupitemintel.cpp ++++ /dev/null +@@ -1,139 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2020 KYLINOS Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +- +-#include <QHBoxLayout> +-#include <QLabel> +-#include <QPushButton> +-#include <QSizePolicy> +- +-#include "definegroupitemintel.h" +- +-DefineGroupItemIntel::DefineGroupItemIntel(QString groupName) +-{ +-// setAttribute(Qt::WA_DeleteOnClose); +- +- _deleteable = false; +- _updateable = false; +- _editable = false; +- +- QHBoxLayout * baseHorLayout = new QHBoxLayout(this); +- baseHorLayout->setSpacing(16); +- baseHorLayout->setMargin(0); +- +- pWidget = new QWidget(this); +- +- QHBoxLayout * mainHorLayout = new QHBoxLayout(pWidget); +- mainHorLayout->setSpacing(0); +- //mainHorLayout->setContentsMargins(16, 0, 16, 0); +- +- pWidget->setLayout(mainHorLayout); +- +- pLabel = new QLabel(pWidget); +- pLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); +- pLabel->setText(groupName); +- +- pEditBtn = new QPushButton(this); +- pEditBtn->setText(tr("Edit")); +- pEditBtn->setFixedSize(60,36); +- pEditBtn->hide(); +- +- QSizePolicy btnSizePolicy = pEditBtn->sizePolicy(); +- btnSizePolicy.setVerticalPolicy(QSizePolicy::Expanding); +- pEditBtn->setSizePolicy(btnSizePolicy); +- +- pDelBtn = new QPushButton(this); +- pDelBtn->setText(tr("Delete")); +- pDelBtn->setFixedSize(60,36); +- pDelBtn->hide(); +- +- QSizePolicy btnSizePolicy2 = pDelBtn->sizePolicy(); +- btnSizePolicy2.setVerticalPolicy(QSizePolicy::Expanding); +- pDelBtn->setSizePolicy(btnSizePolicy2); +- +- QPalette palette = pEditBtn->palette(); +- QColor ColorPlaceholderText(255,255,255,0); +- QBrush brush; +- brush.setColor(ColorPlaceholderText); +- palette.setBrush(QPalette::Button, Qt::white); +- //palette.setBrush(QPalette::ButtonText, brush); +- pEditBtn->setPalette(palette); +- pDelBtn->setPalette(palette); +- +- mainHorLayout->addWidget(pLabel); +- +- baseHorLayout->addWidget(pWidget); +- baseHorLayout->addWidget(pEditBtn); +- baseHorLayout->addWidget(pDelBtn); +- baseHorLayout->addSpacing(16); +- +- setLayout(baseHorLayout); +-} +- +-DefineGroupItemIntel::~DefineGroupItemIntel() +-{ +-} +- +-QWidget * DefineGroupItemIntel::widgetComponent(){ +- return pWidget; +-} +- +-QLabel * DefineGroupItemIntel::labelComponent(){ +- return pLabel; +-} +- +-QPushButton * DefineGroupItemIntel::editBtnComponent(){ +- return pEditBtn; +-} +- +-QPushButton * DefineGroupItemIntel::delBtnComponent(){ +- return pDelBtn; +-} +- +-void DefineGroupItemIntel::setDeleteable(bool deleteable){ +- _deleteable = deleteable; +-} +- +-void DefineGroupItemIntel::setUpdateable(bool updateable){ +- _updateable = updateable; +-} +- +-void DefineGroupItemIntel::setEditable(bool editable){ +- _editable = editable; +-} +- +-void DefineGroupItemIntel::setShortcutName(QString newName){ +- pLabel->setText(newName); +-} +- +-void DefineGroupItemIntel::mousePressEvent(QMouseEvent *e){ +- if (e->button() == Qt::LeftButton && _deleteable && _editable){ +- pEditBtn->show(); +- pDelBtn->show(); +- } +- +- QWidget::mousePressEvent(e); +-} +- +-void DefineGroupItemIntel::mouseDoubleClickEvent(QMouseEvent *e){ +- if (e->button() == Qt::LeftButton && _updateable){ +- emit updateShortcutSignal(); +- } +- QWidget::mouseDoubleClickEvent(e); +-} +diff --git a/plugins/account/userinfo_intel/definegroupitemintel.h b/plugins/account/userinfo_intel/definegroupitemintel.h +deleted file mode 100644 +index 56e5e38..0000000 +--- a/plugins/account/userinfo_intel/definegroupitemintel.h ++++ /dev/null +@@ -1,74 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2020 KYLINOS Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +- +-#ifndef DEFINEGROUPITEMINTEL_H +-#define DEFINEGROUPITEMINTEL_H +- +-#include <QWidget> +-#include <QFrame> +-#include <QMouseEvent> +- +-class QLabel; +-class QPushButton; +- +-class DefineGroupItemIntel : public QFrame +-{ +- Q_OBJECT +- +-public: +- explicit DefineGroupItemIntel(QString groupName); +- ~DefineGroupItemIntel(); +- +-public: +- QWidget * widgetComponent(); +- QLabel * labelComponent(); +- QPushButton * editBtnComponent(); +- QPushButton * delBtnComponent(); +- +-public: +- void setDeleteable(bool deleteable); +- void setUpdateable(bool updateable); +- void setEditable(bool editable); +- +- void setShortcutName(QString newName); +- void setShortcutBinding(QString newBinding); +- +-protected: +- virtual void mousePressEvent(QMouseEvent * e); +- virtual void mouseDoubleClickEvent(QMouseEvent * e); +- +- +-private: +- QWidget * pWidget; +- QLabel * pLabel; +- QPushButton * pEditBtn; +- QPushButton * pDelBtn; +- +-private: +- bool _deleteable; +- bool _editable; +- bool _updateable; +- +-Q_SIGNALS: +- void updateShortcutSignal(); +- +-}; +- +-#endif // DEFINEGROUPITEMINTEL_H +diff --git a/plugins/account/userinfo_intel/delgroupinteldialog.cpp b/plugins/account/userinfo_intel/delgroupinteldialog.cpp +deleted file mode 100644 +index 99b5dd5..0000000 +--- a/plugins/account/userinfo_intel/delgroupinteldialog.cpp ++++ /dev/null +@@ -1,41 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2020 KYLINOS Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +- +-#include "delgroupinteldialog.h" +-#include "ui_delgroupinteldialog.h" +- +-DelGroupIntelDialog::DelGroupIntelDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::DelGroupIntelDialog) +-{ +- ui->setupUi(this); +- ui->labelPic->setPixmap(QPixmap("://img/plugins/desktop/notice.png")); +-} +- +-DelGroupIntelDialog::~DelGroupIntelDialog() +-{ +- delete ui; +-} +- +-void DelGroupIntelDialog::setNoticeText(QString txt) +-{ +- qDebug() << "setNoticeText" << txt; +-} +- +diff --git a/plugins/account/userinfo_intel/delgroupinteldialog.h b/plugins/account/userinfo_intel/delgroupinteldialog.h +deleted file mode 100644 +index 6fd3e6a..0000000 +--- a/plugins/account/userinfo_intel/delgroupinteldialog.h ++++ /dev/null +@@ -1,47 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2020 KYLINOS Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +- +-#ifndef DELGROUPINTELDIALOG_H +-#define DELGROUPINTELDIALOG_H +- +-#include <QDialog> +-#include <QPixmap> +-#include <QDebug> +- +-namespace Ui { +-class DelGroupIntelDialog; +-} +- +-class DelGroupIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit DelGroupIntelDialog(QWidget *parent = nullptr); +- ~DelGroupIntelDialog(); +- +-public: +- void setNoticeText(QString txt); +- +-private: +- Ui::DelGroupIntelDialog *ui; +-}; +- +-#endif // DELGROUPINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/delgroupinteldialog.ui b/plugins/account/userinfo_intel/delgroupinteldialog.ui +deleted file mode 100644 +index c7efa35..0000000 +--- a/plugins/account/userinfo_intel/delgroupinteldialog.ui ++++ /dev/null +@@ -1,154 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>DelGroupIntelDialog</class> +- <widget class="QDialog" name="DelGroupIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>363</width> +- <height>280</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>363</width> +- <height>280</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>363</width> +- <height>280</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <widget class="QLabel" name="label_2"> +- <property name="geometry"> +- <rect> +- <x>60</x> +- <y>70</y> +- <width>280</width> +- <height>39</height> +- </rect> +- </property> +- <property name="text"> +- <string>TextLabel</string> +- </property> +- </widget> +- <widget class="QWidget" name="layoutWidget"> +- <property name="geometry"> +- <rect> +- <x>20</x> +- <y>180</y> +- <width>311</width> +- <height>38</height> +- </rect> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>12</number> +- </property> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="cancelPushBtn"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Cancel</string> +- </property> +- <property name="flat"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="removePushBtn"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>RemoveFile</string> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- <widget class="QWidget" name="layoutWidget"> +- <property name="geometry"> +- <rect> +- <x>70</x> +- <y>30</y> +- <width>82</width> +- <height>32</height> +- </rect> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>10</number> +- </property> +- <item> +- <widget class="QLabel" name="labelPic"> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QLabel" name="label"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>30</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>18</height> +- </size> +- </property> +- <property name="text"> +- <string>Remind</string> +- </property> +- </widget> +- </item> +- </layout> +- </widget> +- </widget> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/account/userinfo_intel/deluserinteldialog.cpp b/plugins/account/userinfo_intel/deluserinteldialog.cpp +deleted file mode 100644 +index 8dc3694..0000000 +--- a/plugins/account/userinfo_intel/deluserinteldialog.cpp ++++ /dev/null +@@ -1,156 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "deluserinteldialog.h" +-#include "ui_deluserinteldialog.h" +- +-#include <QDebug> +-#include <QtGlobal> +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-DelUserIntelDialog::DelUserIntelDialog(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::DelUserIntelDialog) +-{ +- ui->setupUi(this); +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- +- setupComonpent(); +- setupConnect(); +-} +- +-DelUserIntelDialog::~DelUserIntelDialog() +-{ +- delete ui; +-} +- +-void DelUserIntelDialog::setupComonpent(){ +- closeBtn = new QPushButton(this); +- closeBtn->setFixedSize(36, 36); +- ui->horizontalLayout_4->addWidget(closeBtn); +- closeBtn->setFlat(true); +- closeBtn->setProperty("useIconHighlightEffect", true); +- closeBtn->setProperty("iconHighlightEffectMode", 1); +- closeBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/close.svg")); +-// ui->closeBtn->setStyleSheet("QPushButton:hover:!pressed#closeBtn{background: #FA6056; border-radius: 4px;}" +-// "QPushButton:hover:pressed#closeBtn{background: #E54A50; border-radius: 4px;}"); +- ui->textEdit->setText(tr("Delete the user, belonging to the user's desktop documents, favorites, music, pictures and video folder will be deleted!")); +- ui->textEdit->setReadOnly(true); +-// ui->textEdit->adjustSize(); +-// ui->label_2->setWordWrap(true); +-// faceLabel = new QLabel; +-} +- +-void DelUserIntelDialog::setupConnect(){ +- +- connect(closeBtn, &QPushButton::clicked, [=](){ +- close(); +- }); +- connect(ui->cancelPushBtn, SIGNAL(clicked()), this, SLOT(reject())); +- +- QSignalMapper * differSignalMapper = new QSignalMapper(); +- for (QAbstractButton * button : ui->buttonGroup->buttons()){ +- connect(button, SIGNAL(clicked()), differSignalMapper, SLOT(map())); +- differSignalMapper->setMapping(button, button->text()); +- } +- +-#if QT_VERSION <= QT_VERSION_CHECK(5,12,0) +- connect(differSignalMapper, static_cast<void(QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped), [=](const QString key){ +-#else +- connect(differSignalMapper, QOverload<const QString &>::of(&QSignalMapper::mapped), [=](const QString key){ +-#endif +- this->accept(); +- bool removefile; +- if (ui->removePushBtn->text() == key) +- removefile = true; +- else +- removefile = false; +- emit removefile_send(removefile, m_username); +- }); +-} +- +-void DelUserIntelDialog::setFace(QString iconfile){ +- +- ui->faceLabel->setPixmap(QPixmap(PixmapToRound(iconfile,28))); +-} +- +-void DelUserIntelDialog::setUsername(QString username,QString realname){ +- ui->usernameLabel->setText(realname); +- m_username = username; +-} +- +-QPixmap DelUserIntelDialog::PixmapToRound(const QString &src, int radius) +-{ +- if (src == "") { +- return QPixmap(); +- } +- QPixmap pixmapa(src); +- QPixmap pixmap(radius*2,radius*2); +- pixmap.fill(Qt::transparent); +- QPainter painter(&pixmap); +- painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- QPainterPath path; +- path.addEllipse(0, 0, radius*2, radius*2); +- painter.setClipPath(path); +- painter.drawPixmap(0, 0, radius*2, radius*2, pixmapa); +- return pixmap; +-} +- +-void DelUserIntelDialog::paintEvent(QPaintEvent *event) { +- Q_UNUSED(event); +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 16, 16); +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +- +-} +- +- +diff --git a/plugins/account/userinfo_intel/deluserinteldialog.h b/plugins/account/userinfo_intel/deluserinteldialog.h +deleted file mode 100644 +index 55d7cee..0000000 +--- a/plugins/account/userinfo_intel/deluserinteldialog.h ++++ /dev/null +@@ -1,66 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef DELUSERINTELDIALOG_H +-#define DELUSERINTELDIALOG_H +- +-#include <QDialog> +-#include <QSignalMapper> +-#include <QAbstractButton> +-#include <QPainter> +-#include <QPainterPath> +-#include <QHBoxLayout> +-#include <QLabel> +- +-namespace Ui { +-class DelUserIntelDialog; +-} +- +-class DelUserIntelDialog : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit DelUserIntelDialog(QWidget *parent = 0); +- ~DelUserIntelDialog(); +- +-public: +- void setupComonpent(); +- void setupConnect(); +- +- void setFace(QString file); +- void setUsername(QString name,QString realname); +- +-protected: +- void paintEvent(QPaintEvent *); +- +-private: +- Ui::DelUserIntelDialog *ui; +- QHBoxLayout *m_namelayout; +- QLabel *usernameLabel; +- QString m_username; +- QPushButton * closeBtn; +- QPixmap PixmapToRound(const QString &src, int radius); +- +- +-Q_SIGNALS: +- void removefile_send(bool removefile, QString username); +-}; +- +-#endif // DELUSERINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/deluserinteldialog.ui b/plugins/account/userinfo_intel/deluserinteldialog.ui +deleted file mode 100644 +index 5943ea9..0000000 +--- a/plugins/account/userinfo_intel/deluserinteldialog.ui ++++ /dev/null +@@ -1,259 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>DelUserIntelDialog</class> +- <widget class="QDialog" name="DelUserIntelDialog"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>380</width> +- <height>412</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>380</width> +- <height>412</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>502</width> +- <height>412</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Delete User</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>10</number> +- </property> +- <property name="leftMargin"> +- <number>10</number> +- </property> +- <property name="topMargin"> +- <number>10</number> +- </property> +- <property name="rightMargin"> +- <number>10</number> +- </property> +- <property name="bottomMargin"> +- <number>10</number> +- </property> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>8</number> +- </property> +- <item> +- <widget class="QLabel" name="label"> +- <property name="text"> +- <string> Delete</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>47</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>12</number> +- </property> +- <property name="leftMargin"> +- <number>24</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>24</number> +- </property> +- <property name="bottomMargin"> +- <number>24</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <item> +- <widget class="QLabel" name="faceLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>56</width> +- <height>56</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>56</width> +- <height>56</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- <property name="scaledContents"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLabel" name="usernameLabel"> +- <property name="text"> +- <string/> +- </property> +- <property name="alignment"> +- <set>Qt::AlignCenter</set> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_6" stretch="0"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QTextEdit" name="textEdit"/> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <item> +- <widget class="QPushButton" name="removePushBtn"> +- <property name="minimumSize"> +- <size> +- <width>147</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>147</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>Define</string> +- </property> +- <property name="autoDefault"> +- <bool>false</bool> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="cancelPushBtn"> +- <property name="minimumSize"> +- <size> +- <width>147</width> +- <height>48</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>147</width> +- <height>48</height> +- </size> +- </property> +- <property name="text"> +- <string>Cancel</string> +- </property> +- <property name="flat"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +- <buttongroups> +- <buttongroup name="buttonGroup"/> +- </buttongroups> +-</ui> +diff --git a/plugins/account/userinfo_intel/digitalauthinteldialog.cpp b/plugins/account/userinfo_intel/digitalauthinteldialog.cpp +deleted file mode 100644 +index 1b240ce..0000000 +--- a/plugins/account/userinfo_intel/digitalauthinteldialog.cpp ++++ /dev/null +@@ -1,421 +0,0 @@ +-/* +- * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +- * +- * Authors: ZHAI Kang-ning <zhaikangning@kylinos.cn> +-**/ +-#include "digitalauthinteldialog.h" +-#include <QDebug> +-#include <cmath> +-#include <QPushButton> +-#include <QHBoxLayout> +-#include <QVBoxLayout> +-#include <QLabel> +-#include <QEvent> +-#include <QMessageBox> +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-DigitalAuthIntelDialog::DigitalAuthIntelDialog(QString username ,QWidget *parent) : QWidget(parent), +- m_bgColor("#FFFFFF") +-{ +- this->resize(360, 529); +- m_username = username; +- +- initUI(); +- setQSS(); +- initConnect(); +-} +- +-DigitalAuthIntelDialog::~DigitalAuthIntelDialog() +-{ +- +-} +- +-void DigitalAuthIntelDialog::initUI(){ +- +- mainLayout = new QVBoxLayout(this); +- setLayout(mainLayout); +- +- m_pTitle = new QLabel(tr("Enter Old Password")); +- m_pTitle->setProperty("class", "titleLB"); +- mainLayout->addWidget(m_pTitle, 0, Qt::AlignHCenter); +- mainLayout->addSpacing(10); +- +- m_pPasswordBar = new PasswordBar(this); +- m_pPasswordBar->setBallRadius(8); +- mainLayout->addWidget(m_pPasswordBar, 0, Qt::AlignHCenter); +- +- m_pPromptMessage = new QLabel(this); +- m_pPromptMessageClone = new QLabel(this); +- m_pPromptMessage->setProperty("class", "promptMessageLabel"); +- hidePromptMsg(); +- mainLayout->addWidget(m_pPromptMessage, 0, Qt::AlignHCenter); +- mainLayout->addWidget(m_pPromptMessageClone, 0, Qt::AlignHCenter); +- +- m_pNumbersBtn = new NumbersButtonIntel(this); +- +- //mainLayout->addSpacing(20); +- mainLayout->addWidget(m_pNumbersBtn, 0, Qt::AlignHCenter); +- +- m_curInputMode = InputMode::InputOldPwd; +- +- label2 = new QLabel(this); +- label2 -> setText(tr("Forget Password?")); +-// label2->move(140, 528); +- label2->show(); +- label2->installEventFilter(this);//安装事件过滤 +- mainLayout->addSpacing(20); +- mainLayout->addStretch(); +- mainLayout->addWidget(label2, 0, Qt::AlignHCenter); +- mainLayout->addStretch(); +- m_interface1 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- if (m_interface1->isValid()) { +- QDBusMessage result = m_interface1->call("GetAccountPincode",m_username); +- QList<QVariant> outArgs = result.arguments(); +- delete m_interface1; +- pinstatus = outArgs.at(1).value<int>(); +- if (pinstatus == 0) { +- QString oldpwd = outArgs.at(0).value<QString>(); +- if (oldpwd == "") { +- m_curInputMode = InputMode::InputPwd; +- m_pTitle->setText(tr("Input New Password")); +- hidePromptMsg(); +- m_pPasswordBar->setFillBall(0); +- m_oldPwd = ""; +- m_curPwd = ""; +- label2->hide(); +- pinstatus = 1; +- } +- } +- } else { +- qCritical() << "Create DBus Interface Failed: " << QDBusConnection::systemBus().lastError(); +- } +-} +- +-void DigitalAuthIntelDialog::initConnect() +-{ +- connect(m_pNumbersBtn, &NumbersButtonIntel::numbersButtonPress, this, &DigitalAuthIntelDialog::onNumerPress); +-} +- +-void DigitalAuthIntelDialog::setQSS() +-{ +- setStyleSheet(".promptMessageLabel{" +- "border: 2px solid #FD625E;" +- "border-radius: 8px;" +- "font-size:14px;" +- "font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;" +- "background: #FD625E" +- "}"); +-} +- +-void DigitalAuthIntelDialog::showPromptMsg() +-{ +- m_pPromptMessage->show(); +- m_pPromptMessageClone->hide(); +-} +- +-void DigitalAuthIntelDialog::hidePromptMsg() +-{ +- m_pPromptMessage->hide(); +- m_pPromptMessageClone->show(); +- m_pPromptMessageClone->setFixedHeight(m_pPromptMessage->height()); +-} +- +-void DigitalAuthIntelDialog::onReset() +-{ +- m_pTitle->setText(tr("Input Password")); +- m_pPasswordBar->setFillBall(0); +- m_curPwd = ""; +- m_reInputPwd = ""; +- m_curInputMode = InputMode::InputPwd; +-} +- +-void DigitalAuthIntelDialog::gotonext() +-{ +- m_curInputMode = InputMode::InputPwd; +- m_pTitle->setText(tr("Input New Password")); +- hidePromptMsg(); +- label2->hide(); +- m_pPasswordBar->setFillBall(0); +- m_curPwd = ""; +- m_interface1 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- if (!m_interface1->isValid()) { +- qCritical() << "Create DBus Interface Failed: " << QDBusConnection::systemBus().lastError(); +- return; +- } +- QDBusMessage result = m_interface1->call("GetAccountPincode",m_username); +- +- QList<QVariant> outArgs = result.arguments(); +- delete m_interface1; +- m_oldPwd = outArgs.at(0).value<QString>(); +- +-} +- +-void DigitalAuthIntelDialog::onNumerPress(int btn_id) +-{ +- if (btn_id == 10) +- { +- if(InputMode::InputOldPwd == m_curInputMode && m_oldPwd.size()) +- m_oldPwd = m_oldPwd.left(m_oldPwd.size() - 1); +- else if(InputMode::InputPwd == m_curInputMode && m_curPwd.size()) +- m_curPwd = m_curPwd.left(m_curPwd.size() - 1); +- else if(InputMode::ReInputPwd == m_curInputMode && m_reInputPwd.size()) +- m_reInputPwd = m_reInputPwd.left(m_reInputPwd.size() - 1); +- m_pPasswordBar->delFillBall(); +- } else if (btn_id == 11){ +- if(InputMode::InputOldPwd == m_curInputMode && m_oldPwd.size()) +- m_oldPwd = ""; +- else if(InputMode::InputPwd == m_curInputMode && m_curPwd.size()) +- m_curPwd = ""; +- else if(InputMode::ReInputPwd == m_curInputMode && m_reInputPwd.size()) +- m_reInputPwd = ""; +- m_pPasswordBar->setFillBall(0); +- } else { +- if(InputMode::InputOldPwd == m_curInputMode && m_oldPwd.size() < 6) +- m_oldPwd += QChar(btn_id + '0'); +- else if(InputMode::InputPwd == m_curInputMode && m_curPwd.size() < 6) +- m_curPwd += QChar(btn_id + '0'); +- else if(InputMode::ReInputPwd == m_curInputMode && m_reInputPwd.size() < 6) +- m_reInputPwd += QChar(btn_id + '0'); +- +- m_pPasswordBar->addFillBall(); +- hidePromptMsg(); +- +- if (m_oldPwd.size() == 6 && InputMode::InputOldPwd == m_curInputMode) { +- m_interface1 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- if (!m_interface1->isValid()) { +- qCritical() << "Create DBus Interface Failed: " << QDBusConnection::systemBus().lastError(); +- return; +- } +- QDBusMessage result = m_interface1->call("GetAccountPincode",m_username); +- +- QList<QVariant> outArgs = result.arguments(); +- delete m_interface1; +- int status = outArgs.at(1).value<int>(); +- +- if (status == 0) { +- QString oldpwd = outArgs.at(0).value<QString>(); +- if (oldpwd == m_oldPwd) { +- qDebug() << "旧密码为:" << m_oldPwd; +- m_curInputMode = InputMode::InputPwd; +- m_pTitle->setText(tr("Input New Password")); +- hidePromptMsg(); +- label2->hide(); +- m_pPasswordBar->setFillBall(0); +- m_curPwd = ""; +- +- } else { +- m_pPromptMessage->setText(tr("The password input is error")); +- showPromptMsg(); +- m_pPasswordBar->setFillBall(0); +- m_curPwd = ""; +- m_reInputPwd = ""; +- m_oldPwd =""; +- +- } +- +- } +- +- } else if (m_curPwd.size() == 6 && InputMode::InputPwd == m_curInputMode) { +- qDebug() << "设置新密码为:" << m_curPwd; +- m_curInputMode = InputMode::ReInputPwd; +- m_pTitle->setText(tr("Confirm New Password")); +- hidePromptMsg(); +- m_pPasswordBar->setFillBall(0); +- m_reInputPwd = ""; +- } else if(m_reInputPwd.size() == 6 && InputMode::ReInputPwd == m_curInputMode) { +- if (m_curPwd != m_reInputPwd) { +- m_pPromptMessage->setText(tr("The password input is inconsistent")); +- showPromptMsg(); +- m_curInputMode = InputMode::InputPwd; +- m_pTitle->setText(tr("Input New Password")); +- m_pPasswordBar->setFillBall(0); +- m_curPwd = ""; +- m_reInputPwd = ""; +- } else { +- // TODO 更改密码 +- if (m_oldPwd == m_curPwd) { +- m_pPromptMessage->setText(tr("New password can not be consistent of old password")); +- showPromptMsg(); +- m_curInputMode = InputMode::InputPwd; +- m_pTitle->setText(tr("Input New Password")); +- m_pPasswordBar->setFillBall(0); +- m_curPwd = ""; +- m_reInputPwd = ""; +- } else { +- if(pinstatus == 1) { +- m_interface2 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- QDBusMessage result = m_interface2->call("SetAccountPincode",m_username,m_curPwd); +- +- QList<QVariant> outArgs = result.arguments(); +- delete m_interface2; +- qDebug()<<"outArgs=="<<outArgs; +- int status = outArgs.at(0).toInt(); +- qDebug()<<"status=="<<status; +- if (status == 0) { +- hidePromptMsg(); +- emit ended(); +- } else { +- m_pPromptMessage->setText(tr("Password Change Failed")); +- showPromptMsg(); +- m_curInputMode = InputMode::InputOldPwd; +- m_pTitle->setText(tr("Enter Old Password")); +- m_pPasswordBar->setFillBall(0); +- m_curPwd =""; +- m_reInputPwd = ""; +- m_oldPwd =""; +- } +- } else { +- m_interface2 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- QDBusMessage result = m_interface2->call("ChangeAccountPincode",m_username,m_oldPwd,m_curPwd); +- +- QList<QVariant> outArgs = result.arguments(); +- delete m_interface2; +- qDebug()<<"outArgs=="<<outArgs; +- int status = outArgs.at(0).toInt(); +- qDebug()<<"status=="<<status; +- if (status == 0) { +- hidePromptMsg(); +- emit ended(); +- } else { +- m_pPromptMessage->setText(tr("Password Change Failed")); +- showPromptMsg(); +- m_curInputMode = InputMode::InputOldPwd; +- m_pTitle->setText(tr("Enter Old Password")); +- m_pPasswordBar->setFillBall(0); +- m_curPwd =""; +- m_reInputPwd = ""; +- m_oldPwd =""; +- } +- } +- +- } +- +- } +- +- } +- } +-} +- +- +-bool DigitalAuthIntelDialog::eventFilter(QObject *obj, QEvent *event){ +- if(obj == label2)//需要操作label +- { +- if(event->type() == QEvent::MouseButtonPress)//判断事件类型 +- { +- QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); +- if(mouseEvent->button() == Qt::LeftButton) +- { +- emit forgetpassword(); +-// QMessageBox::information(NULL,QString::fromLocal8Bit("点击"),QString::fromLocal8Bit("牛逼吗?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); +- return true; +- } +- return false; +- } +- return false; +- } +- return DigitalAuthIntelDialog::eventFilter(obj, event); +-} +- +-void DigitalAuthIntelDialog::showEvent(QShowEvent *event) +-{ +- Q_UNUSED(event); +- setFocus(); +-} +- +-void DigitalAuthIntelDialog::paintEvent(QPaintEvent *event) +-{ +- Q_UNUSED(event) +-} +- +-void DigitalAuthIntelDialog::drawBg(QPainter *painter) +-{ +- painter->save(); +- +- int width = this->width(); +- int height = this->height(); +- +- painter->setPen(Qt::NoPen); +- m_bgColor.setAlpha(255); +- painter->setBrush(m_bgColor); +- painter->drawRoundRect(0, 0, width, height, 5*height/width, 5); +- +- painter->restore(); +-} +-void DigitalAuthIntelDialog::keyPressEvent(QKeyEvent *ev) +-{ +- if (ev->key() == Qt::Key_0) { +- onNumerPress(0); +- return; +- } +- if (ev->key() == Qt::Key_1) { +- onNumerPress(1); +- return; +- } +- if (ev->key() == Qt::Key_2) { +- onNumerPress(2); +- return; +- } +- if (ev->key() == Qt::Key_3) { +- onNumerPress(3); +- return; +- } +- if (ev->key() == Qt::Key_4) { +- onNumerPress(4); +- return; +- } +- if (ev->key() == Qt::Key_5) { +- onNumerPress(5); +- return; +- } +- if (ev->key() == Qt::Key_6) { +- onNumerPress(6); +- return; +- } +- if (ev->key() == Qt::Key_7) { +- onNumerPress(7); +- return; +- } +- if (ev->key() == Qt::Key_8) { +- onNumerPress(8); +- return; +- } +- if (ev->key() == Qt::Key_9) { +- onNumerPress(9); +- return; +- } +- if (ev->key()== Qt::Key_Backspace){ +- onNumerPress(10); +- return; +- } +- +- QWidget::keyPressEvent(ev); +-} +diff --git a/plugins/account/userinfo_intel/digitalauthinteldialog.h b/plugins/account/userinfo_intel/digitalauthinteldialog.h +deleted file mode 100644 +index 15eb91f..0000000 +--- a/plugins/account/userinfo_intel/digitalauthinteldialog.h ++++ /dev/null +@@ -1,98 +0,0 @@ +-/* +- * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +- * +- * Authors: ZHAI Kang-ning <zhaikangning@kylinos.cn> +-**/ +-#ifndef DIGITALAUTHINTELDIALOG_H +-#define DIGITALAUTHINTELDIALOG_H +- +-#include "passwordbar.h" +-#include "numbersbuttonintel.h" +-#include "qtdbus/systemdbusdispatcher.h" +-#include "qtdbus/userdispatcher.h" +-#include <QWidget> +-#include <QPaintEvent> +-#include <QPainter> +-#include <QMouseEvent> +-#include <QPushButton> +-#include <QLabel> +-#include <QList> +-#include <QRect> +-#include <QDBusInterface> +-#include <QDBusReply> +- +-class Auth; +-class QEvent; +-class QVBoxLayout; +-class QHBoxLayout; +- +-class DigitalAuthIntelDialog : public QWidget +-{ +- Q_OBJECT +-public: +- explicit DigitalAuthIntelDialog(QString username,QWidget *parent = nullptr); +- ~DigitalAuthIntelDialog(); +- +- void initUI(); +- void initConnect(); +- void setQSS(); +- void hidePromptMsg(); +- void showPromptMsg(); +- void gotonext(); +-protected: +- void showEvent(QShowEvent *event); +- bool eventFilter(QObject *obj, QEvent *event); +- void drawBg(QPainter *painter); +- +-protected: +- void paintEvent(QPaintEvent *event); +- virtual void keyPressEvent(QKeyEvent *ev); +-Q_SIGNALS: +- void numberBtnPress(int btn_id); +- void forgetpassword(); +- void ended(); +-public slots: +- void onReset(); +-private slots: +- void onNumerPress(int btn_id); +-private: +- QLabel * label2; +- QColor m_bgColor; //背景色 +- +- QVBoxLayout *mainLayout; +- enum InputMode{ +- InputOldPwd, +- InputPwd, +- ReInputPwd, +- }; +- QLabel *m_pTitle; // 标题 +- NumbersButtonIntel *m_pNumbersBtn; +- PasswordBar *m_pPasswordBar; +- QLabel *m_pPromptMessage; +- QLabel *m_pPromptMessageClone; // 控制格式 +- +- InputMode m_curInputMode; +- QString m_oldPwd; // 记录旧密码 +- QString m_curPwd; // 记录当前密码 +- QString m_reInputPwd; // 记录再次输入的密码 +- QString m_username;//用户名 +- +- QDBusInterface *m_interface1; +- QDBusInterface *m_interface2; +- int pinstatus; +-}; +- +-#endif // DIGITALAUTHINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/digitalphoneinteldialog.cpp b/plugins/account/userinfo_intel/digitalphoneinteldialog.cpp +deleted file mode 100644 +index e6313cb..0000000 +--- a/plugins/account/userinfo_intel/digitalphoneinteldialog.cpp ++++ /dev/null +@@ -1,268 +0,0 @@ +-/* +- * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +- * +- * Authors: ZHAI Kang-ning <zhaikangning@kylinos.cn> +-**/ +-#include "digitalphoneinteldialog.h" +-#include <QDebug> +-#include <cmath> +-#include <QPushButton> +-#include <QHBoxLayout> +-#include <QVBoxLayout> +-#include <QLabel> +-#include <QEvent> +-#include <QMessageBox> +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-DigitalPhoneIntelDialog::DigitalPhoneIntelDialog(QString username ,QWidget *parent) : QWidget(parent), +- m_bgColor("#FFFFFF") +-{ +- this->resize(360, 529); +- m_username = username; +- +- initUI(); +- setQSS(); +- initConnect(); +-} +- +-DigitalPhoneIntelDialog::~DigitalPhoneIntelDialog() +-{ +- +-} +- +-void DigitalPhoneIntelDialog::initUI(){ +- +- mainLayout = new QVBoxLayout(this); +- setLayout(mainLayout); +- +- m_pTitle = new QLabel(tr("Please Enter Edu OS Password")); +- m_pTitle->setProperty("class", "titleLB"); +- mainLayout->addWidget(m_pTitle, 0, Qt::AlignHCenter); +- +- m_pPasswordBar = new PasswordBar(this); +- m_pPasswordBar->setBallRadius(8); +- mainLayout->addWidget(m_pPasswordBar, 0, Qt::AlignHCenter); +- +- m_pPromptMessage = new QLabel(this); +- m_pPromptMessageClone = new QLabel(this); +- m_pPromptMessage->setProperty("class", "promptMessageLabel"); +- hidePromptMsg(); +- mainLayout->addWidget(m_pPromptMessage, 0, Qt::AlignHCenter); +- mainLayout->addWidget(m_pPromptMessageClone, 0, Qt::AlignHCenter); +- +- m_pNumbersBtn = new NumbersButtonIntel(this); +- +- //mainLayout->addSpacing(20); +- mainLayout->addWidget(m_pNumbersBtn, 0, Qt::AlignHCenter); +- +- m_curInputMode = InputMode::InputOldPwd; +- +- +- label2 = new QLabel(this); +-// label2 -> setText(tr("<u>Forget Password?</u>")); +-// label2->move(140, 528); +- label2->show(); +- label2->installEventFilter(this);//安装事件过滤 +- mainLayout->addWidget(label2, 0, Qt::AlignHCenter); +- //label2->hide(); +-} +- +-void DigitalPhoneIntelDialog::initConnect() +-{ +- connect(m_pNumbersBtn, &NumbersButtonIntel::numbersButtonPress, this, &DigitalPhoneIntelDialog::onNumerPress); +-} +- +-void DigitalPhoneIntelDialog::setQSS() +-{ +- setStyleSheet(".promptMessageLabel{" +- "border: 2px solid #FD625E;" +- "border-radius: 8px;" +- "font-size:14px;" +- "font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;" +- "background: #FD625E" +- "}"); +-} +- +-void DigitalPhoneIntelDialog::showPromptMsg() +-{ +- m_pPromptMessage->show(); +- m_pPromptMessageClone->hide(); +-} +- +-void DigitalPhoneIntelDialog::hidePromptMsg() +-{ +- m_pPromptMessage->hide(); +- m_pPromptMessageClone->show(); +- m_pPromptMessageClone->setFixedHeight(m_pPromptMessage->height()); +-} +- +-void DigitalPhoneIntelDialog::onReset() +-{ +- m_pTitle->setText("请输入密码"); +- m_pPasswordBar->setFillBall(0); +- m_curPwd = ""; +- m_reInputPwd = ""; +- m_curInputMode = InputMode::InputPwd; +-} +- +-void DigitalPhoneIntelDialog::onNumerPress(int btn_id) +-{ +- if(btn_id == 10) +- { +- if(InputMode::InputOldPwd == m_curInputMode && m_oldPwd.size()) +- m_oldPwd = m_oldPwd.left(m_oldPwd.size() - 1); +- else if(InputMode::InputPwd == m_curInputMode && m_curPwd.size()) +- m_curPwd = m_curPwd.left(m_curPwd.size() - 1); +- else if(InputMode::ReInputPwd == m_curInputMode && m_reInputPwd.size()) +- m_reInputPwd = m_reInputPwd.left(m_reInputPwd.size() - 1); +- +- m_pPasswordBar->delFillBall(); +- } +- else +- { +- if(InputMode::InputOldPwd == m_curInputMode && m_oldPwd.size() < 6) +- m_oldPwd += QChar(btn_id + '0'); +- +- m_pPasswordBar->addFillBall(); +- +- if (m_oldPwd.size() == 6 && InputMode::InputOldPwd == m_curInputMode) { +- m_interface1 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- QDBusMessage result = m_interface1->call("GetAccountPincode",m_username); +- delete m_interface1; +- +- QList<QVariant> outArgs = result.arguments(); +- +- int status = outArgs.at(1).value<int>(); +- +- if (status == 0) { +- QString oldpwd = outArgs.at(0).value<QString>(); +- if (oldpwd == m_oldPwd) { +- qDebug() << "旧密码为:" << m_oldPwd; +- hidePromptMsg(); +- m_pPasswordBar->setFillBall(0); +- m_oldPwd = ""; +- emit phone(); +- } else { +- m_pPromptMessage->setText(tr("The password input is error")); +- showPromptMsg(); +- m_pPasswordBar->setFillBall(0); +- m_oldPwd = ""; +- } +- +- } +- +- } +- } +-} +- +- +-bool DigitalPhoneIntelDialog::eventFilter(QObject *obj, QEvent *event){ +- if(obj == label2)//需要操作label +- { +- if(event->type() == QEvent::MouseButtonPress)//判断事件类型 +- { +- QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); +- if(mouseEvent->button() == Qt::LeftButton) +- { +- emit forgetpassword(); +-// QMessageBox::information(NULL,QString::fromLocal8Bit("点击"),QString::fromLocal8Bit("牛逼吗?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); +- return true; +- } +- return false; +- } +- return false; +- } +- return DigitalPhoneIntelDialog::eventFilter(obj, event); +-} +- +-void DigitalPhoneIntelDialog::showEvent(QShowEvent *event) +-{ +- Q_UNUSED(event); +- setFocus(); +-} +- +-void DigitalPhoneIntelDialog::paintEvent(QPaintEvent *event) +-{ +- Q_UNUSED(event) +-} +- +-void DigitalPhoneIntelDialog::drawBg(QPainter *painter) +-{ +- painter->save(); +- +- int width = this->width(); +- int height = this->height(); +- +- painter->setPen(Qt::NoPen); +- m_bgColor.setAlpha(255); +- painter->setBrush(m_bgColor); +- painter->drawRoundRect(0, 0, width, height, 5*height/width, 5); +- +- painter->restore(); +-} +-void DigitalPhoneIntelDialog::keyPressEvent(QKeyEvent *ev) +-{ +- if (ev->key() == Qt::Key_0) { +- onNumerPress(0); +- return; +- } +- if (ev->key() == Qt::Key_1) { +- onNumerPress(1); +- return; +- } +- if (ev->key() == Qt::Key_2) { +- onNumerPress(2); +- return; +- } +- if (ev->key() == Qt::Key_3) { +- onNumerPress(3); +- return; +- } +- if (ev->key() == Qt::Key_4) { +- onNumerPress(4); +- return; +- } +- if (ev->key() == Qt::Key_5) { +- onNumerPress(5); +- return; +- } +- if (ev->key() == Qt::Key_6) { +- onNumerPress(6); +- return; +- } +- if (ev->key() == Qt::Key_7) { +- onNumerPress(7); +- return; +- } +- if (ev->key() == Qt::Key_8) { +- onNumerPress(8); +- return; +- } +- if (ev->key() == Qt::Key_9) { +- onNumerPress(9); +- return; +- } +- if (ev->key()== Qt::Key_Backspace){ +- onNumerPress(10); +- return; +- } +- +- QWidget::keyPressEvent(ev); +-} +diff --git a/plugins/account/userinfo_intel/digitalphoneinteldialog.h b/plugins/account/userinfo_intel/digitalphoneinteldialog.h +deleted file mode 100644 +index 6fd2e5d..0000000 +--- a/plugins/account/userinfo_intel/digitalphoneinteldialog.h ++++ /dev/null +@@ -1,95 +0,0 @@ +-/* +- * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +- * +- * Authors: ZHAI Kang-ning <zhaikangning@kylinos.cn> +-**/ +-#ifndef DIGITALPHONEINTELDIALOG_H +-#define DIGITALPHONEINTELDIALOG_H +- +-#include "passwordbar.h" +-#include "numbersbuttonintel.h" +-#include "qtdbus/systemdbusdispatcher.h" +-#include "qtdbus/userdispatcher.h" +-#include <QWidget> +-#include <QPaintEvent> +-#include <QPainter> +-#include <QMouseEvent> +-#include <QPushButton> +-#include <QLabel> +-#include <QList> +-#include <QRect> +-#include <QDBusInterface> +-#include <QDBusReply> +- +-class Auth; +-class QEvent; +-class QVBoxLayout; +-class QHBoxLayout; +- +-class DigitalPhoneIntelDialog : public QWidget +-{ +- Q_OBJECT +-public: +- explicit DigitalPhoneIntelDialog(QString username,QWidget *parent = nullptr); +- ~DigitalPhoneIntelDialog(); +- +- void initUI(); +- void initConnect(); +- void setQSS(); +- void hidePromptMsg(); +- void showPromptMsg(); +-protected: +- void showEvent(QShowEvent *event); +- bool eventFilter(QObject *obj, QEvent *event); +- void drawBg(QPainter *painter); +- +-protected: +- void paintEvent(QPaintEvent *event); +- virtual void keyPressEvent(QKeyEvent *ev); +-Q_SIGNALS: +- void numberBtnPress(int btn_id); +- void forgetpassword(); +- void phone(); +-public slots: +- void onReset(); +-private slots: +- void onNumerPress(int btn_id); +-private: +- QLabel * label2; +- QColor m_bgColor; //背景色 +- +- QVBoxLayout *mainLayout; +- enum InputMode{ +- InputOldPwd, +- InputPwd, +- ReInputPwd, +- }; +- QLabel *m_pTitle; // 标题 +- NumbersButtonIntel *m_pNumbersBtn; +- PasswordBar *m_pPasswordBar; +- QLabel *m_pPromptMessage; +- QLabel *m_pPromptMessageClone; // 控制格式 +- +- InputMode m_curInputMode; +- QString m_oldPwd; // 记录旧密码 +- QString m_curPwd; // 记录当前密码 +- QString m_reInputPwd; // 记录再次输入的密码 +- QString m_username;//用户名 +- +- QDBusInterface *m_interface1; +-}; +- +-#endif // DIGITALPHONEINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/elipsemaskwidget.cpp b/plugins/account/userinfo_intel/elipsemaskwidget.cpp +deleted file mode 100644 +index f3ca22f..0000000 +--- a/plugins/account/userinfo_intel/elipsemaskwidget.cpp ++++ /dev/null +@@ -1,60 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "elipsemaskwidget.h" +- +-#include <QPainter> +-#include <QPainterPath> +- +-ElipseMaskWidget::ElipseMaskWidget(QWidget *parent) : +- QWidget(parent) +-{ +- setAttribute(Qt::WA_DeleteOnClose); +- pWidth = parent->width(); +- pHeigh = parent->height(); +- pRadius = 6; +- pColor = QString("#ffffff"); +- pBorder = 1; +-} +- +-ElipseMaskWidget::~ElipseMaskWidget() +-{ +-} +- +-void ElipseMaskWidget::setBgColor(QString color){ +- pColor = color; +-} +- +-void ElipseMaskWidget::paintEvent(QPaintEvent *e){ +- Q_UNUSED(e) +- +- QPainterPath cPath; +- cPath.addRect(0, 0, pWidth, pHeigh); +- cPath.addEllipse(0, 0, pWidth, pHeigh); +- +- QPainter painter(this); +- painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿 +- painter.setPen(Qt::NoPen); +- painter.setBrush(palette().color(QPalette::Base)); +- painter.setOpacity(1); +- painter.drawPath(cPath); +- painter.setBrush(palette().color(QPalette::Base)); +-// painter.setOpacity(0.45); +- painter.drawPath(cPath); +-} +diff --git a/plugins/account/userinfo_intel/elipsemaskwidget.h b/plugins/account/userinfo_intel/elipsemaskwidget.h +deleted file mode 100644 +index 0b9a87a..0000000 +--- a/plugins/account/userinfo_intel/elipsemaskwidget.h ++++ /dev/null +@@ -1,48 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef ELIPSEMASKWIDGET_H +-#define ELIPSEMASKWIDGET_H +- +-#include <QWidget> +- +-class ElipseMaskWidget : public QWidget +-{ +- Q_OBJECT +- +-public: +- explicit ElipseMaskWidget(QWidget *parent = nullptr); +- ~ElipseMaskWidget(); +- +-public: +- void setBgColor(QString color); +- +-protected: +- void paintEvent(QPaintEvent *event); +- +-private: +- int pWidth; +- int pHeigh; +- int pRadius; +- int pBorder; +- QString pColor; +- +-}; +- +-#endif // ELIPSEMASKWIDGET_H +diff --git a/plugins/account/userinfo_intel/messageboxpowerintel.cpp b/plugins/account/userinfo_intel/messageboxpowerintel.cpp +deleted file mode 100644 +index b7b7d60..0000000 +--- a/plugins/account/userinfo_intel/messageboxpowerintel.cpp ++++ /dev/null +@@ -1,208 +0,0 @@ +-#include "messageboxpowerintel.h" +-#include <QtDBus/QtDBus> +- +- +-MessageBoxPowerIntel::MessageBoxPowerIntel(QWidget *parent) +- : QDialog(parent) +-{ +- //设置任务栏无显示 +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); +- QDesktopWidget *deskdop=QApplication::desktop(); +- //this->move((deskdop->width()-this->width())/2, (deskdop->height()-this->height())/2); +- //this->move(this->geometry().center() - this->rect().center()); +- this->setFixedSize(360,272); +- initUI(); +- //QDBusConnection::systemBus().connect(QString(),QString("/"),"com.kylin.update.notification","DownloadFinish",this,SLOT(otaevent())); +-} +- +-MessageBoxPowerIntel::~MessageBoxPowerIntel() +-{ +- +-} +-void MessageBoxPowerIntel::initUI() +-{ +- m_pmainlayout = new QVBoxLayout(); +- m_pfirstlayout = new QHBoxLayout(); +- m_ptestlayout = new QVBoxLayout(); +- buttonlayout = new QHBoxLayout(); +- m_pcenterlayout = new QHBoxLayout(); +- +- topWidget = new QWidget(); +- closeButton = new QPushButton(); +- closeButton = new QPushButton(this); +- closeButton->setProperty("useIconHighlightEffect", true); +- closeButton->setProperty("iconHighlightEffectMode", 1); +- closeButton->setFlat(true); +- closeButton->setAutoDefault(false); +- closeButton->setIcon(QIcon(":/img/plugins/backup/window-close-symbolic.svg"));; +- connect(closeButton, &QPushButton::clicked, [=]{ +- close(); +- }); +- contentWidget = new QWidget(); +- +- firstlabel = new QLabel(); +- +- //firstlabel->setText("系统更新已准备就绪,请重启安装最新版本"); +- firstlabel->setText(tr("Nothing has been entered, re-enter")); +- firstlabel->setStyleSheet("width: 208px;" +- "height: 24px;" +- "font-size: 16px;" +- "font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;" +- "font-weight: bold;" +- "line-height: 24px;" +- ); +- +- remindButton = new QPushButton(); +- //remindButton->setText("30分钟后提醒我"); +- remindButton->setText(tr("Remind in 30 minutes")); +- remindButton->setFixedSize(148,48); +- remindButton->setStyleSheet("background-color: rgb(255,255,255);color:black;border:1px solid grey;border-radius:10px;"); +- //connect(remindButton,&QPushButton::clicked,this,&MessageBoxPowerIntel::remindslots); +- +-// connect(remindButton, &QPushButton::clicked, this, [=]() { +-// hide(); +-// }); +- +- +- confirmButton = new QPushButton(); +- //restartButton->setText("立即重启"); +- confirmButton->setText(tr("Got it")); +- confirmButton->setFixedSize(148,48); +- confirmButton->setStyleSheet("background-color: rgb(85,173,222);color:white;border-radius: 8px;"); +- connect(confirmButton,&QPushButton::clicked,this,&MessageBoxPowerIntel::restartslots); +- buttonWidget = new QWidget(); +- +- iconBigLabel = new QLabel(); +- QImage *img2=new QImage; //新建一个image对象 +- img2->load(":/img/plugins/userinfo_intel/warning.svg"); //将图像资源载入对象img,注意路径,可点进图片右键复制路径 +- iconBigLabel->setPixmap(QPixmap::fromImage(*img2)); //将图片放入label,使用setPixmap,注意指针*img +- iconBigLabel->setFixedSize(64,64); +- leftIconWidget = new QWidget(); +- centerWidget = new QWidget(); +- +- +- //标题布局 +- m_pfirstlayout->addStretch(1); +- m_pfirstlayout->addWidget(closeButton); +- topWidget->setLayout(m_pfirstlayout); +- +- +- +- //按钮布局 +- //buttonlayout->addWidget(remindButton); +- remindButton->hide(); +- buttonlayout->addStretch(); +- buttonlayout->addWidget(confirmButton); +- buttonlayout->addStretch(); +- buttonWidget->setLayout(buttonlayout); +- +- +- //主体内容布局 +- m_ptestlayout->addWidget(iconBigLabel,0,Qt::AlignHCenter); +- //m_ptestlayout->addItem(new QSpacerItem(360,16)); +- m_ptestlayout->addWidget(firstlabel,0,Qt::AlignHCenter); +- m_ptestlayout->addStretch(2); +- m_ptestlayout->addWidget(buttonWidget); +- m_ptestlayout->addStretch(1); +- contentWidget->setLayout(m_ptestlayout); +- +- //增加图标主体内容布局 +- m_pcenterlayout->addWidget(contentWidget); +- centerWidget->setLayout(m_pcenterlayout); +- +- //整体布局 +- +- m_pmainlayout->addWidget(topWidget); +- m_pmainlayout->addWidget(centerWidget); +- //centerWidget->setStyleSheet("background-color: rgb(85,173,222)"); +- +- +- this->setLayout(m_pmainlayout); +-} +- +-void MessageBoxPowerIntel::paintEvent(QPaintEvent *e) +-{ +-// QStyleOption opt; +-// opt.init(this); +-// QPainter p(this); +-// /* 获取当前剪贴板中字体的颜色,作为背景色; +-// * 白字体 --> 黑背景 +-// * 黑字体 --> 白字体 +-// */ +-// p.setBrush(opt.palette.color(QPalette::Base)); +-// p.setOpacity(1); +-// p.setPen(QPen(QColor(255,255,255))); +-// QPainterPath path; +-// opt.rect.adjust(0,0,0,0); +-// path.addRoundedRect(opt.rect,16,16); +-// p.setRenderHint(QPainter::Antialiasing); //反锯齿 +-// p.drawRoundedRect(opt.rect,16,16); +-// setProperty("blurRegion",QRegion(path.toFillPolygon().toPolygon())); +-// style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +-// QWidget::paintEvent(e); +- +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 16, 16); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- p.restore(); +-} +- +-void MessageBoxPowerIntel::remindslots() +-{ +- +- //timer->start(1800*1000); +- +-} +-void MessageBoxPowerIntel::restartslots() +-{ +- /*QDBusMessage msg = QDBusMessage::createMethodCall("org.gnome.SessionManager", +- "/org/gnome/SessionManager", +- "org.gnome.SessionManager", +- "reboot"); +- */ +-// QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.login1", +-// "/org/freedesktop/login1", +-// "org.freedesktop.login1.Manager", +-// "Reboot"); +-// bool arg=1; +-// msg<<arg; +- +-// QDBusMessage response = QDBusConnection::systemBus().call(msg); +- this->close(); +- +-} +- +-void MessageBoxPowerIntel::otaevent() +-{ +- +-} +- +-void MessageBoxPowerIntel::timetask() +-{ +-// timer->stop(); +-// otaevent(); +- //QDBusMessage msg =QDBusMessage::createSignal("/", "com.kylin.update.notification", "DownloadFinish"); +- //QDBusConnection::systemBus().send(msg); +-} +diff --git a/plugins/account/userinfo_intel/messageboxpowerintel.h b/plugins/account/userinfo_intel/messageboxpowerintel.h +deleted file mode 100644 +index b70c844..0000000 +--- a/plugins/account/userinfo_intel/messageboxpowerintel.h ++++ /dev/null +@@ -1,61 +0,0 @@ +-#ifndef WIDGET_H +-#define WIDGET_H +- +-#include <QWidget> +-#include <QApplication> +-#include <QTranslator> +-#include <QDesktopWidget> +-#include <QPainter> +-#include <QPainterPath> +-#include <QStyleOption> +-#include <QLabel> +-#include <QVBoxLayout> +-#include <QPushButton> +-#include <QDebug> +-#include <QDialog> +- +-class MessageBoxPowerIntel : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit MessageBoxPowerIntel(QWidget *parent = nullptr); +- ~MessageBoxPowerIntel(); +- QHBoxLayout *m_pfirstlayout = nullptr; +- QVBoxLayout *m_pmainlayout = nullptr; +- QVBoxLayout *m_ptestlayout = nullptr; +- QHBoxLayout *buttonlayout = nullptr; +- QHBoxLayout *m_pcenterlayout = nullptr; +- +- QWidget *topWidget; +- QWidget *contentWidget; +- QWidget *buttonWidget; +- QWidget *leftIconWidget; +- QWidget *centerWidget; +- +- +- QPushButton *closeButton; +- +- +- +- QLabel *firstlabel; +- +- QPushButton *remindButton; +- QPushButton *confirmButton; +- +- QLabel *iconBigLabel; +- +- QTimer *timer; +- +- void initUI(); +- void paintEvent(QPaintEvent *e); +- +-public Q_SLOTS: +- void otaevent(); +- void timetask(); +- +-protected slots: +- void remindslots(); +- void restartslots(); +-}; +-#endif // WIDGET_H +diff --git a/plugins/account/userinfo_intel/numbersbuttonintel.cpp b/plugins/account/userinfo_intel/numbersbuttonintel.cpp +deleted file mode 100644 +index be0226c..0000000 +--- a/plugins/account/userinfo_intel/numbersbuttonintel.cpp ++++ /dev/null +@@ -1,131 +0,0 @@ +-#include "numbersbuttonintel.h" +- +-#include <QGridLayout> +-#include <QVariant> +- +-NumbersButtonIntel::NumbersButtonIntel(QWidget *parent): +- QWidget(parent) +-{ +- initUI(); +- initConnect(); +- const QByteArray id_1(UKUI_QT_STYLE); +- if (QGSettings::isSchemaInstalled(id_1)) { +- m_style = new QGSettings(id_1); +- } +- setQSS(); +-} +- +-NumbersButtonIntel::~NumbersButtonIntel() +-{ +- if (m_style != nullptr) { +- delete m_style; +- } +-} +- +-void NumbersButtonIntel::initUI() +-{ +- QGridLayout* mainLayout = new QGridLayout(this); +- setLayout(mainLayout); +- +- for(int i = 1;i <= 9;i++) +- { +- m_pNumerPressBT[i] = new QPushButton(this); +- m_pNumerPressBT[i]->setText(QString(QChar(i + '0'))); +- m_pNumerPressBT[i]->setProperty("class", "numberPressBT"); +- mainLayout->addWidget(m_pNumerPressBT[i], (i - 1) / 3, (i - 1) % 3); +- } +- m_pNumerPressBT[0] = new QPushButton(this); +- m_pNumerPressBT[0]->setText(QString(QChar('0'))); +- m_pNumerPressBT[0]->setProperty("class", "numberPressBT"); +- mainLayout->addWidget(m_pNumerPressBT[0], 3, 1); +- +- m_pNumerPressBT[10] = new QPushButton(this); +- m_pPictureToWhite = new PictureToWhite(); +- m_pNumerPressBT[10]->setIcon(QIcon(m_pPictureToWhite->drawSymbolicColoredPixmap(QPixmap(":/img/plugins/userinfo_intel/num-delete.svg").scaled(30,30)))); +- m_pNumerPressBT[10]->setProperty("class", "numberPressBT"); +- m_pNumerPressBT[11] = new QPushButton(this); +- m_pNumerPressBT[11]->setText(tr("clean")); +- m_pNumerPressBT[11]->setProperty("class", "numberPressCL"); +- mainLayout->addWidget(m_pNumerPressBT[11], 3, 0); +- mainLayout->setSpacing(12); +- mainLayout->setVerticalSpacing(10); +- mainLayout->addWidget(m_pNumerPressBT[10], 3, 2); +-} +- +-void NumbersButtonIntel::initConnect() +-{ +- connect(m_pNumerPressBT[0], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(0); }); +- connect(m_pNumerPressBT[1], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(1); }); +- connect(m_pNumerPressBT[2], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(2); }); +- connect(m_pNumerPressBT[3], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(3); }); +- connect(m_pNumerPressBT[4], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(4); }); +- connect(m_pNumerPressBT[5], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(5); }); +- connect(m_pNumerPressBT[6], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(6); }); +- connect(m_pNumerPressBT[7], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(7); }); +- connect(m_pNumerPressBT[8], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(8); }); +- connect(m_pNumerPressBT[9], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(9); }); +- connect(m_pNumerPressBT[10], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(10); }); +- connect(m_pNumerPressBT[11], &QPushButton::clicked, this, [=](){ emit numbersButtonPress(11); }); +-} +- +-void NumbersButtonIntel::setQSS() +-{ +- QString themeName = m_style->get(UKUI_STYLE_KEY).toString(); +- if( themeName == "ukui-light" || themeName == "ukui-default" | themeName == "ukui" ) { +- setStyleSheet(".numberPressBT{" +- "font-size:24px;" +- "min-width:96px;" +- "min-height:64px;" +- "max-width:96px;" +- "max-height:64px;" +- "background:rgba(0, 0, 0, 0.05);" +- "border-radius:16px;" +- "}" +- ".numberPressBT:hover{" +- "background:rgba(0, 0, 0, 0.15)" +- "}" +- ".numberPressCL{" +- "font-size:16px;" +- "min-width:96px;" +- "min-height:64px;" +- "max-width:96px;" +- "max-height:64px;" +- "background:rgba(0, 0, 0, 0.05);" +- "border-radius:16px;" +- "}" +- ".numberPressCL:hover{" +- "background:rgba(0, 0, 0, 0.15)" +- "}" +- +- ); // isNightMode=false +- } else { +- setStyleSheet(".numberPressBT{" +- "font-size:24px;" +- "min-width:96px;" +- "min-height:64px;" +- "max-width:96px;" +- "max-height:64px;" +- "background:rgba(58, 58, 61, 255);" +- "border-radius:16px;" +- "}" +- ".numberPressBT:hover{" +- "background:rgba(98, 98, 103, 255)" +- "}" +- ".numberPressCL{" +- "font-size:16px;" +- "min-width:96px;" +- "min-height:64px;" +- "max-width:96px;" +- "max-height:64px;" +- "background:rgba(58, 58, 61, 255);" +- "border-radius:16px;" +- "}" +- ".numberPressCL:hover{" +- "background:rgba(98, 98, 98, 255)" +- "}" +- +- ); // isNightMode=true +- } +- +-} +- +diff --git a/plugins/account/userinfo_intel/numbersbuttonintel.h b/plugins/account/userinfo_intel/numbersbuttonintel.h +deleted file mode 100644 +index 3bed004..0000000 +--- a/plugins/account/userinfo_intel/numbersbuttonintel.h ++++ /dev/null +@@ -1,34 +0,0 @@ +-#ifndef NUMBERSBUTTONINTEL_H +-#define NUMBERSBUTTONINTEL_H +- +-#include <QWidget> +-#include <QPushButton> +-#include <QGSettings/QGSettings> +-#include "picturetowhite.h" +- +-#define UKUI_QT_STYLE "org.ukui.style" +-#define UKUI_STYLE_KEY "style-name" +- +-class NumbersButtonIntel : public QWidget +-{ +- Q_OBJECT +- +-public: +- NumbersButtonIntel(QWidget *parent = nullptr); +- ~NumbersButtonIntel(); +- +-Q_SIGNALS: +- void numbersButtonPress(int btn_id); +- +-private: +- void initUI(); +- void initConnect(); +- void setQSS(); +- +-private: +- QPushButton *m_pNumerPressBT[12]; // 0~9 是数字按键 10是删除键 11是清空 +- PictureToWhite *m_pPictureToWhite; +- QGSettings *m_style = nullptr; +-}; +- +-#endif // NUMBERSBUTTONINTEL_H +diff --git a/plugins/account/userinfo_intel/passwdcheckutil.cpp b/plugins/account/userinfo_intel/passwdcheckutil.cpp +deleted file mode 100644 +index 0efc2fd..0000000 +--- a/plugins/account/userinfo_intel/passwdcheckutil.cpp ++++ /dev/null +@@ -1,47 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "passwdcheckutil.h" +- +-#include <QFile> +-#include <QDebug> +- +-#define PAM_CONF_FILE "/etc/pam.d/common-password" +- +-PasswdCheckUtil::PasswdCheckUtil(QObject *parent) : QObject(parent) +-{ +- +-} +- +-bool PasswdCheckUtil::getCurrentPamState(){ +- QFile * readFile = new QFile(PAM_CONF_FILE); +- if (!readFile->open(QIODevice::ReadOnly | QIODevice::Text)){ +- readFile->close(); +- qDebug() << QString("Open conf file %1 failed!").arg(PAM_CONF_FILE); +- return false; +- } else { +- QTextStream stream(readFile); +- while(!stream.atEnd()){ +- QString line = stream.readLine(); +- if (line.contains("pam_pwquality.so")) +- return true; +- } +- return false; +- } +-} +diff --git a/plugins/account/userinfo_intel/passwdcheckutil.h b/plugins/account/userinfo_intel/passwdcheckutil.h +deleted file mode 100644 +index 0375fa2..0000000 +--- a/plugins/account/userinfo_intel/passwdcheckutil.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef PASSWDCHECKUTIL_H +-#define PASSWDCHECKUTIL_H +- +-#include <QObject> +- +-class PasswdCheckUtil : public QObject +-{ +- Q_OBJECT +-public: +- explicit PasswdCheckUtil(QObject *parent = nullptr); +- +- static bool getCurrentPamState(); +- +-}; +- +-#endif // PASSWDCHECKUTIL_H +diff --git a/plugins/account/userinfo_intel/passwordbar.cpp b/plugins/account/userinfo_intel/passwordbar.cpp +deleted file mode 100644 +index 47fe260..0000000 +--- a/plugins/account/userinfo_intel/passwordbar.cpp ++++ /dev/null +@@ -1,118 +0,0 @@ +-#include "passwordbar.h" +- +-#include <QPainter> +- +-PasswordBar::PasswordBar(QWidget *parent): +- QWidget(parent) +-{ +- initUI(); +-} +- +-PasswordBar::~PasswordBar() +-{ +- if (m_style != nullptr) { +- delete m_style; +- } +-} +- +-void PasswordBar::initUI() +-{ +- m_bitLen = 6; // 密码位数 +- m_ballRadius = 8; +- m_fillBallCnt = 0; +- m_ballSpan = m_ballRadius << 1; // 密码间的跨度 +- +- adjSize(); +- +- const QByteArray id_1(UKUI_QT_STYLE); +- if (QGSettings::isSchemaInstalled(id_1)) { +- m_style = new QGSettings(id_1); +- } +-} +- +-void PasswordBar::setLength(int l) +-{ +- m_bitLen = l; +- adjSize(); +-} +- +-void PasswordBar::setBallRadius(int l) +-{ +- m_ballRadius = l; +- adjSize(); +-} +- +-void PasswordBar::setBallSpan(int l) +-{ +- m_ballSpan = l; +- adjSize(); +-} +- +-void PasswordBar::setFillBall(int l) +-{ +- m_fillBallCnt = l; +- repaint(); +-} +- +-int PasswordBar::getFillBall() +-{ +- return m_fillBallCnt; +-} +- +-void PasswordBar::adjSize() +-{ +- int ballD = m_ballRadius << 1; +- setFixedHeight(ballD + 2); +- setFixedWidth(ballD * m_bitLen + 2 + m_ballSpan * (m_bitLen - 1)); +- adjustSize(); +- repaint(); +-} +- +-void PasswordBar::addFillBall() +-{ +- if(m_fillBallCnt == m_bitLen) return; +- ++m_fillBallCnt; +- repaint(); +-} +- +-void PasswordBar::delFillBall() +-{ +- if(!m_fillBallCnt) return; +- --m_fillBallCnt; +- repaint(); +-} +- +-QSize PasswordBar::sizeHint() const{ +- return QSize(width(), height()); +-} +- +-void PasswordBar::paintEvent(QPaintEvent *event) +-{ +- Q_UNUSED(event); +- QPainter painter(this); +- painter.setPen(QColor(200, 200, 200, 255)); +- painter.setRenderHint(QPainter::Antialiasing); +- +- QColor ballColor; +- QString themeName = m_style->get(UKUI_STYLE_KEY).toString(); +- if( themeName == "ukui-light" || themeName == "ukui-default" | themeName == "ukui" ) { +- ballColor = QColor(0,0,0,255); // isNightMode=false +- } else { +- ballColor = QColor(255,255,255,255); // isNightMode=true +- } +- +- int beginx = 1; +- for(int i = 0;i < m_bitLen;i++) +- { +- if(i){ +- beginx += m_ballSpan + m_ballRadius * 2; +- } +- if(i < m_fillBallCnt) +- painter.setBrush(ballColor); +- else +- painter.setBrush(QColor(255,255,255,0)); +- +- painter.drawEllipse(QPoint(beginx + m_ballRadius, m_ballRadius + 1), m_ballRadius, m_ballRadius); +- //painter.drawRoundedRect(rect(), m_ballRadius, m_ballRadius); +- } +-} +diff --git a/plugins/account/userinfo_intel/passwordbar.h b/plugins/account/userinfo_intel/passwordbar.h +deleted file mode 100644 +index a52e571..0000000 +--- a/plugins/account/userinfo_intel/passwordbar.h ++++ /dev/null +@@ -1,42 +0,0 @@ +-#ifndef PASSWORDBAR_H +-#define PASSWORDBAR_H +- +-#include <QWidget> +-#include <QLabel> +-#include <QPushButton> +-#include <QGSettings/QGSettings> +-#include <QVariant> +- +-#define UKUI_QT_STYLE "org.ukui.style" +-#define UKUI_STYLE_KEY "style-name" +- +-class PasswordBar : public QWidget +-{ +-public: +- PasswordBar(QWidget *parent = nullptr); +- ~PasswordBar(); +- +- void setLength(int l); +- void setBallRadius(int l); +- void setBallSpan(int l); +- void addFillBall(); +- void delFillBall(); +- void setFillBall(int l); +- int getFillBall(); +- +-private: +- void initUI(); +- void adjSize(); +- +-protected: +- void paintEvent(QPaintEvent *event); +- QSize sizeHint() const; +- +-private: +- int m_bitLen; +- int m_ballRadius; +- int m_fillBallCnt; +- int m_ballSpan; +- QGSettings *m_style = nullptr; +-}; +-#endif // PASSWORDBAR_H +diff --git a/plugins/account/userinfo_intel/phoneauthinteldialog.cpp b/plugins/account/userinfo_intel/phoneauthinteldialog.cpp +deleted file mode 100644 +index 242419d..0000000 +--- a/plugins/account/userinfo_intel/phoneauthinteldialog.cpp ++++ /dev/null +@@ -1,702 +0,0 @@ +-#include "phoneauthinteldialog.h" +-#include <QPushButton> +-#include <QLineEdit> +-#include <QFrame> +-#include <QHBoxLayout> +-#include <QVBoxLayout> +-#include <QLabel> +-#include <QFile> +-#include <QLatin1String> +-#include <QString> +-#include <QEventLoop> +-#include <QAction> +-#include <QStackedWidget> +- +-#include <QNetworkAccessManager> +-#include <QNetworkReply> +-#include <QNetworkRequest> +- +-#define KYLIN_WIFI_GSETTING_VALUE "org.kylinnm.settings" +- +-PhoneAuthIntelDialog::PhoneAuthIntelDialog(QString username,QWidget *parent) : QWidget(parent) +-{ +- this->resize(360, 529); +- m_username = username; +- initUI(); +- setQSS(); +-} +- +-PhoneAuthIntelDialog::~PhoneAuthIntelDialog() +-{ +- if(m_interface3){ +- delete m_interface3; +- m_interface3 = NULL; +- } +- if(m_interface4){ +- delete m_interface4; +- m_interface4 = NULL; +- } +-} +- +-void PhoneAuthIntelDialog::initUI(){ +- wechatAuthBtn = new QPushButton(tr("Wechat Auth")); +- wechatAuthBtn->setFixedSize(156, 48); +- phoneAuthBtn = new QPushButton(tr("Phone Auth")); +- phoneAuthBtn->setFixedSize(156, 48); +- is_phoneVerifyChecked = true; +- stackWidget = new QStackedWidget(this); +- +- const QByteArray id(KYLIN_WIFI_GSETTING_VALUE); +- if (QGSettings::isSchemaInstalled(id)){ +- m_wifi = new QGSettings(id); +- } +- +- wechatAuthBtn->setObjectName("wechatAuthBtn"); +- phoneAuthBtn->setObjectName("phoneAuthBtn"); +- QHBoxLayout * p_hLayout1 = new QHBoxLayout(); +- p_hLayout1->setSpacing(0); +- p_hLayout1->addStretch(); +- p_hLayout1->addWidget(wechatAuthBtn); +- p_hLayout1->addWidget(phoneAuthBtn); +- p_hLayout1->addStretch(); +- is_phoneVerifyChecked = true; +- phoneAuthBtn->setStyleSheet("QPushButton, QPushButton:hover:!pressed, QPushButton:pressed{background: #2FB3E8; " +- "border-top-right-radius: 8px; " +- "border-bottom-right-radius: 8px; " +- "font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- +- m_qr = new QLabel(); +- phoneNumLine = new QLineEdit(this); +- phoneNumLine->setFixedSize(312, 64); +- phoneNumLine->setPlaceholderText(tr("Phone number")); +- phoneNumLine->setProperty("class", "PhoneLineEdit"); +- verifyCodeLine = new QLineEdit(this); +- verifyCodeLine->setFixedSize(184, 64); +- verifyCodeLine->setPlaceholderText(tr("SMS verification code")); +- verifyCodeLine->setProperty("class", "PhoneLineEdit"); +- QRegExp regx_DeviceID1("^[0-9]{1,11}$"); +- QRegExp regx_DeviceID2("^[0-9]{1,6}$"); +- QValidator *validator_DeviceID1 = new QRegExpValidator(regx_DeviceID1,phoneNumLine); +- QValidator *validator_DeviceID2 = new QRegExpValidator(regx_DeviceID2,verifyCodeLine); +- phoneNumLine->setValidator(validator_DeviceID1); +- verifyCodeLine->setValidator(validator_DeviceID2); +- +- phonePicture = new QAction(this); +- smsPicture = new QAction(this); +- phonePicture->setIcon(QIcon(":/img/plugins/userinfo_intel/phonenum.svg")); +- smsPicture->setIcon(QIcon(":/img/plugins/userinfo_intel/smscode.svg")); +- phoneNumLine->addAction(phonePicture, QLineEdit::LeadingPosition); +- verifyCodeLine->addAction(smsPicture, QLineEdit::LeadingPosition); +- phoneNumLine->setTextMargins(10, 0, 0, 0); +- verifyCodeLine->setTextMargins(10, 0, 0, 0); +- +- +- QWidget *phoneWidget = new QWidget(stackWidget); +- phoneWidget->setFixedSize(312, 64); +- QHBoxLayout * p_hPhoneLayout = new QHBoxLayout(phoneWidget); +- p_hPhoneLayout->setContentsMargins(0, 0, 0, 0); +- p_hPhoneLayout->setSpacing(0); +- p_hPhoneLayout->addWidget(phoneNumLine); +- phoneWidget->setObjectName("phoneWidget"); +- +- +- QWidget *codeWidget = new QWidget(stackWidget); +- codeWidget->setFixedSize(312, 64); +- getVerifyCodeBtn = new QPushButton(tr("GetCode")); +- getVerifyCodeBtn->setObjectName("getVerifyCodeBtn"); +- getVerifyCodeBtn->setFixedSize(128, 64); +- QHBoxLayout * p_hCodeLayout = new QHBoxLayout(codeWidget); +- p_hCodeLayout->setContentsMargins(0, 0, 0, 0); +- p_hCodeLayout->setSpacing(0); +- p_hCodeLayout->addWidget(verifyCodeLine); +- p_hCodeLayout->addWidget(getVerifyCodeBtn); +- codeWidget->setObjectName("codeWidget"); +- +- returnButton = new QPushButton(tr("Return")); +- confirmButton = new QPushButton(tr("Commit")); +- returnButton->setProperty("class", "phoneBT"); +- confirmButton->setProperty("class", "phoneBT"); +- confirmButton->setDefault(false); +- confirmButton->setFlat(true); +- returnButton->setFlat(true); +- QHBoxLayout * p_hLayout = new QHBoxLayout(); +- p_hLayout->setSpacing(20); +- p_hLayout->addStretch(); +- p_hLayout->addWidget(returnButton); +- p_hLayout->addWidget(confirmButton); +- p_hLayout->addStretch(); +- +- QVBoxLayout *p_mainLayout = new QVBoxLayout(); +- +- p_mainLayout->setContentsMargins(5, 15, 5, 24); +- p_mainLayout->addLayout(p_hLayout1); +- p_mainLayout->setSpacing(0); +- +- /* +- * 微信stackwidget +- */ +- QWidget *phonestackWidget = new QWidget(); +- QWidget *wechatstackWidget = new QWidget(); +- stackWidget->addWidget(phonestackWidget); +- stackWidget->addWidget(wechatstackWidget); +- m_pQRPromptMessage = new QLabel(); +- m_pQRPromptMessage->setProperty("class", "promptMessageLabel"); +- QVBoxLayout * v_wechatLayout = new QVBoxLayout(wechatstackWidget); +- v_wechatLayout->addStretch(); +- v_wechatLayout->addWidget(m_pQRPromptMessage, 0, Qt::AlignHCenter); +- v_wechatLayout->addWidget(m_qr, 0, Qt::AlignHCenter); +- v_wechatLayout->addStretch(); +- +- /* +- * 手机stackwidget +- */ +- m_pPromptMessage = new QLabel(); +- m_pPromptMessage->setProperty("class", "promptMessageLabel"); +- QWidget * widget_1 = new QWidget(phonestackWidget); +- widget_1->setFixedSize(312, 40); +- QVBoxLayout *v_boxLayout1 = new QVBoxLayout(widget_1); +- v_boxLayout1->addWidget(m_pPromptMessage, 0, Qt::AlignHCenter); +- v_boxLayout1->addStretch(); +- QVBoxLayout * v_phoneLayout = new QVBoxLayout(phonestackWidget); +- v_phoneLayout->setSpacing(0); +- v_phoneLayout->addWidget(widget_1, 0, Qt::AlignHCenter); +- v_phoneLayout->addWidget(phoneWidget, 0, Qt::AlignHCenter); +- v_phoneLayout->addWidget(codeWidget, 0, Qt::AlignHCenter); +- v_phoneLayout->addStretch(); +- hidePromptMsg(); +- +- p_mainLayout->addWidget(stackWidget); +- p_mainLayout->addLayout(p_hLayout); +- m_interface3 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.eduplatform", +- QDBusConnection::systemBus()); +- m_interface4 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- if(!m_interface3->isValid()) +- qDebug() << "connect to cn.kylinos.SSOBackend 3failed"; +- if(!m_interface4->isValid()) +- qDebug() << "connect to cn.kylinos.SSOBackend 4failed"; +- connect(m_interface3, SIGNAL(QRStatusChange(QString, QString,int)), this, SLOT(QRStatusChangedSlots(QString, QString,int))); +- m_qrTimeout = new QTimer(); +- connect(m_qrTimeout,&QTimer::timeout,this,[=](){ +- if (qrstatus) { +- m_qrTimeout->stop(); +- qDebug()<<"停止获取"; +- } else { +- QPixmap qrcode; +- getQRCodeFromURL(qrcode); +- qrcode = beautifyQRCode(qrcode); +- m_qr->setPixmap(qrcode); +- m_qr->show(); +- } +- }); +- +- +- this->setLayout(p_mainLayout); +- connect(wechatAuthBtn, &QPushButton::clicked, this, [=](){ +- confirmButton->setText(tr("confirm")); +- stackWidget->setCurrentIndex(1); +- is_phoneVerifyChecked = false; +- hideQRPromptMsg(); +- QPixmap qrcode; +- getQRCodeFromURL(qrcode); +- qrcode = beautifyQRCode(qrcode); +- m_qr->setPixmap(qrcode); +- m_qr->show(); +- +- wechatAuthBtn->setStyleSheet("QPushButton, QPushButton:hover:!pressed, QPushButton:pressed{background: #2FB3E8; " +- "border-top-left-radius: 8px; " +- "border-bottom-left-radius: 8px; " +- "font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- if(!is_nightTheme){ +- phoneAuthBtn->setStyleSheet("QPushButton{background: #F6F6F6; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;}" +- "QPushButton:hover:!pressed{background: #F6F6F6; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;font-weight: bold;color: #2FB3E8;}" +- "QPushButton:pressed{background: #2FB3E8; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- } +- else{ +- phoneAuthBtn->setStyleSheet("QPushButton{background: #31373F; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;}" +- "QPushButton:hover:!pressed{background: #31373F; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;font-weight: bold;color: #2FB3E8;}" +- "QPushButton:pressed{background: #2FB3E8; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- } +- }); +- connect(phoneAuthBtn, &QPushButton::clicked, this, [=](){ +- confirmButton->setText(tr("commit")); +- stackWidget->setCurrentIndex(0); +- is_phoneVerifyChecked = true; +- hidePromptMsg(); +- phoneAuthBtn->setStyleSheet("QPushButton, QPushButton:hover:!pressed, QPushButton:pressed{background: #2FB3E8; " +- "border-top-right-radius: 8px; " +- "border-bottom-right-radius: 8px; " +- "font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- if(!is_nightTheme){ +- wechatAuthBtn->setStyleSheet("QPushButton{background: #F6F6F6; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;}" +- "QPushButton:hover:!pressed{background: #F6F6F6; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;font-weight: bold;color: #2FB3E8;}" +- "QPushButton:pressed{background: #2FB3E8; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- } +- else{ +- wechatAuthBtn->setStyleSheet("QPushButton{background: #31373F; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;}" +- "QPushButton:hover:!pressed{background: #31373F; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;font-weight: bold;color: #2FB3E8;}" +- "QPushButton:pressed{background: #2FB3E8; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- } +- }); +- connect(this, &PhoneAuthIntelDialog::getCodeChange, this, &PhoneAuthIntelDialog::getCodeChanged); +- QString m_clonephone; +- QDBusMessage result = m_interface4->call("GetAccountBasicInfo", m_username); +- if (QDBusMessage::ErrorMessage == result.type()) { +- qDebug() << "result.type() = " << result.type(); +- qDebug() << "QDBusMessage::ErrorMessage = " << QDBusMessage::ErrorMessage; +- qDebug()<<"error"; +- m_clonephone = "error"; +- } else { +- QList<QVariant> outArgs2 = result.arguments(); +- m_phone = outArgs2.at(5).value<QString>(); +- m_clonephone = m_phone.mid(0,3)+"****"+m_phone.mid(7,4); +- } +- if (m_clonephone == "error") { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pPromptMessage->setPalette(pa); +- m_pPromptMessage->setText(tr("Mobile number acquisition failed")); +- showPromptMsg(); +- phonestatus = false; +- getVerifyCodeBtn->setEnabled(false); +- emit getCodeChange(); +- } else { +- phoneNumLine->setText(m_clonephone); +- phoneNumLine->setReadOnly(true); +- phonestatus = true; +- } +- connect(phoneNumLine, &QLineEdit::textChanged, this, [=](){ +- hidePromptMsg(); +- if (phoneNumLine->text().count() == 11) { +- getVerifyCodeBtn->setEnabled(true); +- emit getCodeChange(); +- phonestatus = true; +- } else { +- getVerifyCodeBtn->setEnabled(false); +- emit getCodeChange(); +- phonestatus = false; +- } +- if (phonestatus && codestatus) { +- confirmButton->setEnabled(true); +- } else { +- confirmButton->setEnabled(false); +- } +- }); +- +- connect(getVerifyCodeBtn, &QPushButton::clicked, this, [=](bool checked){ +- Q_UNUSED(checked); +- QTimer *start_timer = new QTimer(); +- daojishi = 60; +- QString s = tr("Recapture"); +- QString s1 = QString::number(daojishi); +- QString s2 = "("+s1+")"; +- QString s3 = s+s2; +- m_interface1 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.eduplatform", +- QDBusConnection::systemBus()); +- QDBusMessage result; +- if (m_clonephone == "error") { +- result = m_interface1->call("GetVerifyCode",phoneNumLine->text()); +- } else { +- result = m_interface1->call("GetVerifyCode",m_phone); +- } +- hidePromptMsg(); +- +- QList<QVariant> outArgs = result.arguments(); +- delete m_interface1; +- int codestatus = outArgs.at(0).value<int>(); +- if (codestatus == 6 || codestatus == 28) { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pPromptMessage->setPalette(pa); +- m_pPromptMessage->setText(tr("Network connection failure, please check")); +- showPromptMsg(); +- } +- getVerifyCodeBtn->setEnabled(false); +- emit getCodeChange(); +- getVerifyCodeBtn->setText(s3); +- start_timer->start(1000); +- connect(start_timer,&QTimer::timeout,this,[=](){ +- QString s = tr("Recapture"); +- if (daojishi > 0){ +- daojishi--; +- QString s1 = QString::number(daojishi); +- QString s2 = "("+s1+")"; +- QString s3 = s+s2; +- getVerifyCodeBtn->setText(s3); +- } else { +- getVerifyCodeBtn->setText(tr("GetCode")); +- getVerifyCodeBtn->setEnabled(true); +- emit getCodeChange(); +- start_timer->stop(); +- } +- +- }); +- +- }); +- +- confirmButton->setEnabled(false); +- codestatus =false; +- connect(verifyCodeLine, &QLineEdit::textChanged, this, [=](){ +- hidePromptMsg(); +- if (verifyCodeLine->text().count() == 6) { +- codestatus =true; +- } else { +- confirmButton->setEnabled(false); +- codestatus =false; +- } +- if (phonestatus && codestatus) { +- confirmButton->setEnabled(true); +- } else { +- confirmButton->setEnabled(false); +- } +- }); +- +- connect(confirmButton, &QPushButton::clicked, this, [=](bool checked){ +- Q_UNUSED(checked) +- m_interface2 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.eduplatform", +- QDBusConnection::systemBus()); +- QDBusMessage result; +- if (m_clonephone == "error") { +- result = m_interface2->call("CheckUserByPhone",m_username,phoneNumLine->text(),verifyCodeLine->text()); +- } else { +- result = m_interface2->call("CheckUserByPhone",m_username,m_phone,verifyCodeLine->text()); +- } +- QList<QVariant> outArgs = result.arguments(); +- delete m_interface2; +- int status = outArgs.at(0).value<int>(); +- if (status == 0) { +- hidePromptMsg(); +- emit confirmSignal(); +- } else if (status == 9014) { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pPromptMessage->setPalette(pa); +- m_pPromptMessage->setText(tr("Phone is lock,try again in an hour")); +- showPromptMsg(); +- } else if (status == 9000) { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pPromptMessage->setPalette(pa); +- m_pPromptMessage->setText(tr("Phone code is wrong")); +- verifyCodeLine->clear(); +- showPromptMsg(); +- } else if (status == 6 || status == 28) { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pPromptMessage->setPalette(pa); +- m_pPromptMessage->setText(tr("Network connection failure, please check")); +- showPromptMsg(); +- } else if (status == 2300) { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pPromptMessage->setPalette(pa); +- m_pPromptMessage->setText(tr("Current login expired,using wechat code!")); +- showPromptMsg(); +- } else { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pPromptMessage->setPalette(pa); +- m_pPromptMessage->setText(tr("Unknown error, please try again later")); +- verifyCodeLine->clear(); +- showPromptMsg(); +- } +- +- }); +- connect(returnButton, &QPushButton::clicked, [=](){ +- hidePromptMsg(); +- emit returnSignal(); +- }); +- wechatAuthBtn->setAutoDefault(false); +-} +- +-void PhoneAuthIntelDialog::getCodeChanged() +-{ +- if (is_nightTheme) { +- if (getVerifyCodeBtn->isEnabled()) { +- qDebug()<<__FUNCTION__<<__LINE__; +- getVerifyCodeBtn->setStyleSheet("QPushButton{background-color:#030303;" +- "selection-background-color:#030303;" +- "border-bottom-right-radius:8px;" +- "color:#2FB3E8" +- "}"); +- } else { +- getVerifyCodeBtn->setStyleSheet("QPushButton{background-color:#030303;" +- "selection-background-color:#030303;" +- "border-bottom-right-radius:8px;" +- "color:#DDDDDD" +- "}"); +- } +- } else { +- if (getVerifyCodeBtn->isEnabled()) { +- getVerifyCodeBtn->setStyleSheet("QPushButton{background-color:#F6F6F6;" +- "selection-background-color:#F6F6F6;" +- "border-bottom-right-radius:8px;" +- "color:#2FB3E8" +- "}"); +- } else { +- getVerifyCodeBtn->setStyleSheet("QPushButton{background-color:#F6F6F6;" +- "selection-background-color:#F6F6F6;" +- "border-bottom-right-radius:8px;" +- "color:#DDDDDD" +- "}"); +- } +- } +-} +- +-void PhoneAuthIntelDialog::themeChanged(const quint32 currentTheme){ +- if(currentTheme == 0){ +- is_nightTheme = false; +- confirmButton->setStyleSheet("QPushButton{background-color:#F6F6F6;}" +- "QPushButton:hover:!pressed{background: #F6F6F6;}" +- "QPushButton:pressed{background: #2FB3E8;}"); +- returnButton->setStyleSheet("QPushButton{background-color:#F6F6F6;}" +- "QPushButton:hover:!pressed{background: #F6F6F6;}" +- "QPushButton:pressed{background: #2FB3E8;}"); +- phoneNumLine->setStyleSheet("QLineEdit{background-color: #F6F6F6; border: 0px;" +- "border-top-left-radius:8px;" +- "border-top-right-radius:8px;" +- "}"); +- verifyCodeLine->setStyleSheet("QLineEdit{background-color: #F6F6F6; border: 0px;" +- "border-bottom-left-radius:8px" +- "}"); +- if (getVerifyCodeBtn->isEnabled()) { +- getVerifyCodeBtn->setStyleSheet("QPushButton{background-color:#F6F6F6;" +- "selection-background-color:#F6F6F6;" +- "border-bottom-right-radius:8px;" +- "color:#2FB3E8" +- "}"); +- } else { +- getVerifyCodeBtn->setStyleSheet("QPushButton{background-color:#F6F6F6;" +- "selection-background-color:#F6F6F6;" +- "border-bottom-right-radius:8px;" +- "color:#DDDDDD" +- "}"); +- } +- if(is_phoneVerifyChecked){ +- wechatAuthBtn->setStyleSheet("QPushButton{background: #F6F6F6; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;}" +- "QPushButton:hover:!pressed{background: #F6F6F6; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;font-weight: bold;color: #2FB3E8;}" +- "QPushButton:pressed{background: #2FB3E8; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- } +- else{ +- phoneAuthBtn->setStyleSheet("QPushButton{background: #F6F6F6; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;}" +- "QPushButton:hover:!pressed{background: #F6F6F6; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;font-weight: bold;color: #2FB3E8;}" +- "QPushButton:pressed{background: #2FB3E8; border-top-right-radius: 8px; border-bottom-right-radius: 8px;font-weight: bold;color: white;}"); +- } +- } +- else{ +- is_nightTheme = true; +- confirmButton->setStyleSheet("QPushButton{background-color:#31373F;}" +- "QPushButton:hover:!pressed{background: #31373F;}" +- "QPushButton:pressed{background: #2FB3E8;}" +- ); +- returnButton->setStyleSheet("QPushButton{background-color:#31373F;}" +- "QPushButton:hover:!pressed{background: #31373F;}" +- "QPushButton:pressed{background: #2FB3E8;}" +- ); +- phoneNumLine->setStyleSheet("QLineEdit{background-color: #030303; border: 0px;" +- "border-top-left-radius:8px;" +- "border-top-right-radius:8px;" +- "}"); +- verifyCodeLine->setStyleSheet("QLineEdit{background-color: #030303; border: 0px;" +- "border-bottom-left-radius:8px" +- "}"); +- if (getVerifyCodeBtn->isEnabled()) { +- getVerifyCodeBtn->setStyleSheet("QPushButton{background-color:#030303;" +- "selection-background-color:#030303;" +- "border-bottom-right-radius:8px;" +- "color:#2FB3E8" +- "}"); +- } else { +- getVerifyCodeBtn->setStyleSheet("QPushButton{background-color:#030303;" +- "selection-background-color:#030303;" +- "border-bottom-right-radius:8px;" +- "color:#DDDDDD" +- "}"); +- } +- if(is_phoneVerifyChecked){ +- wechatAuthBtn->setStyleSheet("QPushButton, {background: #31373F; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;}" +- "QPushButton:hover:!pressed{background: #31373F; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;font-weight: bold;color: #2FB3E8;}" +- "QPushButton:pressed{background: #2FB3E8; border-top-left-radius: 8px; border-bottom-left-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc; font-weight: bold;color: white;}"); +- } +- else{ +- phoneAuthBtn->setStyleSheet("QPushButton{background: #31373F; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Regular, NotoSansCJKsc;}" +- "QPushButton:hover:!pressed{background: #31373F; border-top-right-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px;font-family: NotoSansCJKsc-Bold, NotoSansCJKsc;font-weight: bold;color: #2FB3E8;}" +- "QPushButton:pressed{background: #2FB3E8; border-top-right-radius: 8px; border-bottom-right-radius: 8px;font-weight: bold;color: white;}"); +- } +- } +-} +- +-void PhoneAuthIntelDialog::showPromptMsg() +-{ +- m_pPromptMessage->show(); +-} +- +-void PhoneAuthIntelDialog::hidePromptMsg() +-{ +- m_pPromptMessage->hide(); +-} +-void PhoneAuthIntelDialog::showQRPromptMsg() +-{ +- m_pQRPromptMessage->setVisible(true); +-} +- +-void PhoneAuthIntelDialog::hideQRPromptMsg() +-{ +- m_pQRPromptMessage->setVisible(false); +-} +-void PhoneAuthIntelDialog::getQRCodeFromURL(QPixmap &qrcode) +-{ +- // 从网络上下载二维码 并加载到qrcode +- QDBusMessage result = m_interface3->call("CheckUserByQR"); +- QList<QVariant> outArgs = result.arguments(); +- int status = outArgs.at(1).value<int>(); +- if (status == 6 || status == 28) { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pQRPromptMessage->setPalette(pa); +- m_pQRPromptMessage->setText(tr("Network connection failure, please check")); +- showQRPromptMsg(); +- qrstatus = false; +- qrcode = QPixmap(":/img/plugins/userinfo_intel/qring.png"); +- if (!m_qrTimeout->isActive()) { +- m_qrTimeout->start(5000); +- } +- return; +- } +- if (QDBusMessage::ErrorMessage == result.type()) { +- qDebug()<<"error pix"; +- qrstatus = false; +- +- qrcode = QPixmap(":/img/plugins/userinfo_intel/qring.png"); +- if (!m_qrTimeout->isActive()) { +- m_qrTimeout->start(5000); +- } +- return; +- } else { +- qrstatus = true; +- } +- +- +- const QString url = outArgs.at(0).value<QString>(); +- QNetworkRequest request; +- QNetworkAccessManager networkManager; +- request.setUrl(url); +- QNetworkReply *reply = networkManager.get(request); +- +- // 超时 \ 同步处理 +- QEventLoop loop; +- QTimer timer; +- connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit); +- connect(&timer, &QTimer::timeout, &timer, &QTimer::stop); +- connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); +- timer.start(3000); +- loop.exec(); +- +- if(!timer.isActive()) +- { +- reply->abort(); +- return; +- } +- timer.stop(); +- +- // 生成二维码 +- if(reply->error() != QNetworkReply::NoError) +- { +- qDebug() << "info: [EduPlatformInterface][GetLoginQR]: Network error!"; +- qrstatus = false; +- qrcode = QPixmap(":/img/plugins/userinfo_intel/qring.png"); +- if (!m_qrTimeout->isActive()) { +- m_qrTimeout->start(5000); +- } +- return; +- } else { +- qrstatus = true; +- QByteArray bytes = reply->readAll(); +- hideQRPromptMsg(); +- qrcode.loadFromData(bytes); +- reply->deleteLater(); +- } +-} +-QPixmap PhoneAuthIntelDialog::beautifyQRCode(QPixmap &pixImg) +-{ +- // 去除白边 +- QImage img = pixImg.toImage(); +- int rect_x, rect_y, rect_width, rect_height; +- for(int i = 0;i < img.size().width();i++) +- { +- bool isEnd = false; +- for(int j = 0;j < img.size().height();j++) +- { +- if(img.pixel(i, j) != qRgb(255, 255, 255)) +- { +- rect_x = i - 1; +- rect_y = j - 1; +- rect_width = img.size().width() - 2 * rect_x; +- rect_height = img.size().height() - 2 * rect_y; +- isEnd = true; +- break; +- } +- } +- if(isEnd) break; +- } +- QPixmap dealImg = QPixmap::fromImage(img.copy(rect_x, rect_y, rect_width, rect_height)).scaledToWidth(150); +- img = dealImg.toImage(); +- +- dealImg = QPixmap::fromImage(img); +- return dealImg; +-} +-void PhoneAuthIntelDialog::QRStatusChangedSlots(QString name, QString passwd, int status){ +- if (status == 4) { +- if (name == m_username) { +- emit confirmSignal(); +- } else { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pQRPromptMessage->setPalette(pa); +- m_pQRPromptMessage->setText(tr("Please use the correct wechat scan code")); +- showQRPromptMsg(); +- QPixmap qrcode; +- getQRCodeFromURL(qrcode); +- qrcode = beautifyQRCode(qrcode); +- m_qr->setPixmap(qrcode); +- } +- } +- if (status == 5) { +- +- QPixmap qrcode; +- getQRCodeFromURL(qrcode); +- qrcode = beautifyQRCode(qrcode); +- m_qr->setPixmap(qrcode); +- } +- if (status == 6) { +- QPalette pa; +- pa.setColor(QPalette::WindowText,Qt::red); +- m_pQRPromptMessage->setPalette(pa); +- m_pQRPromptMessage->setText(tr("Network connection failure, please check")); +- showQRPromptMsg(); +- QPixmap qrcode; +- getQRCodeFromURL(qrcode); +- qrcode = beautifyQRCode(qrcode); +- m_qr->setPixmap(qrcode); +- } +-} +-void PhoneAuthIntelDialog::setQSS(){ +- QFile qss(":/phoneauthinteldialog.qss"); +- if(qss.open(QFile::ReadOnly)) +- { +- qDebug("open success"); +- QString style = QLatin1String(qss.readAll()); +- this->setStyleSheet(style); +- qss.close(); +- } +- else +- qDebug("Open failed"); +-} +diff --git a/plugins/account/userinfo_intel/phoneauthinteldialog.h b/plugins/account/userinfo_intel/phoneauthinteldialog.h +deleted file mode 100644 +index 558235d..0000000 +--- a/plugins/account/userinfo_intel/phoneauthinteldialog.h ++++ /dev/null +@@ -1,80 +0,0 @@ +-#ifndef PHONEAUTHINTELDIALOG_H +-#define PHONEAUTHINTELDIALOG_H +- +-#include <QWidget> +-#include <QTimerEvent> +-#include <QTimer> +-#include <QDBusInterface> +-#include <QDBusReply> +-#include <QLabel> +-#include <QRegExpValidator> +-#include <QEventLoop> +-#include <QGSettings/QGSettings> +-#include <QTimer> +- +-class QAction; +-class QLineEdit; +-class QPushButton; +-class QStackedWidget; +- +-class PhoneAuthIntelDialog : public QWidget +-{ +- Q_OBJECT +-public: +- explicit PhoneAuthIntelDialog(QString username,QWidget *parent = nullptr); +- ~PhoneAuthIntelDialog(); +- void initUI(); +- void setQSS(); +- void hidePromptMsg(); +- void showPromptMsg(); +- void hideQRPromptMsg(); +- void showQRPromptMsg(); +-public slots: +- void QRStatusChangedSlots(QString name,QString passwd,int status); +- void themeChanged(const quint32 currentTheme); +- void getCodeChanged(); +- +-Q_SIGNALS: +- void returnSignal(); +- void confirmSignal(); +- void getCodeChange(); +-private: +- int daojishi; +- QTimer *m_qrTimeout; +- QString m_username; +- QLabel *m_pPromptMessage; +- QLabel *m_pQRPromptMessage; +- QLabel *m_qr; +- QStackedWidget *stackWidget; +- +- QAction *phonePicture; +- QAction *smsPicture; +- +- QPushButton * wechatAuthBtn; +- QPushButton * phoneAuthBtn; +- QLineEdit *phoneNumLine; +- QLineEdit *verifyCodeLine; +- QPushButton * getVerifyCodeBtn; +- +- QDBusInterface *m_interface1; +- QDBusInterface *m_interface2; +- QDBusInterface *m_interface3; +- QDBusInterface *m_interface4; +- +- QString m_phone; +- +- QGSettings *m_wifi; +- QPushButton *returnButton; +- QPushButton *confirmButton; +- +- void getQRCodeFromURL(QPixmap &qrcode); +- QPixmap beautifyQRCode(QPixmap &); +- +- bool phonestatus; +- bool codestatus; +- bool qrstatus = false; +- bool is_phoneVerifyChecked; +- bool is_nightTheme; +-}; +- +-#endif // PHONEAUTHINTELDIALOG_H +diff --git a/plugins/account/userinfo_intel/phoneauthinteldialog.qss b/plugins/account/userinfo_intel/phoneauthinteldialog.qss +deleted file mode 100644 +index 81f331f..0000000 +--- a/plugins/account/userinfo_intel/phoneauthinteldialog.qss ++++ /dev/null +@@ -1,33 +0,0 @@ +-QWidget#codeWidget,QWidget#phoneWidget{ +- width: 304px; +- height: 56px; +- background: rgba(0, 0, 0, 0.05); +- border-radius: 16px; +-} +- +-QPushButton#getVerifyCodeBtn{ +- background: rgba(0, 0, 0, 0); +- font-size: 16px; +- font-family: NotoSansCJKsc-Regular, NotoSansCJKsc; +- font-weight: 400; +- line-height: 24px; +-} +- +-.PhoneLineEdit{ +- background: rgba(0, 0, 0, 0); +- border: 0px; +-} +- +-.phoneBT{ +- width: 144px; +- height: 48px; +- border-radius: 8px; +- border: 0px solid #DDDDDD; +-} +-.phoneBT:hover{ +- width: 144px; +- height: 48px; +- background: #2FB3E8; +- border-radius: 8px; +-} +- +diff --git a/plugins/account/userinfo_intel/picturetowhite.cpp b/plugins/account/userinfo_intel/picturetowhite.cpp +deleted file mode 100644 +index 1e304ce..0000000 +--- a/plugins/account/userinfo_intel/picturetowhite.cpp ++++ /dev/null +@@ -1,74 +0,0 @@ +-/* +-* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +-* +-*/ +-#include "picturetowhite.h" +- +-PictureToWhite::PictureToWhite(QObject *parent) : QObject(parent) +-{ +- initGsettingValue(); +-} +- +-void PictureToWhite::initGsettingValue() +-{ +- const QByteArray id(ORG_UKUI_STYLE); +- QStringList stylelist; +- stylelist << STYLE_NAME_KEY_DARK << STYLE_NAME_KEY_LIGHT << STYLE_NAME_KEY_DEFAULT; +- if (QGSettings::isSchemaInstalled(id)) { +- m_pgsettings = new QGSettings(id); +- if (stylelist.contains(m_pgsettings->get(STYLE_NAME).toString()) && m_pgsettings->get(STYLE_NAME).toString() == STYLE_NAME_KEY_LIGHT) +- tray_icon_color = TRAY_ICON_COLOR_LOGHT; +- else +- tray_icon_color = TRAY_ICON_COLOR_DRAK; +- } +- connect(m_pgsettings, &QGSettings::changed, this, [=] (const QString &key) { +- if (key==STYLE_NAME) { +- if (stylelist.contains(m_pgsettings->get(STYLE_NAME).toString()) && m_pgsettings->get(STYLE_NAME).toString() == STYLE_NAME_KEY_LIGHT) +- tray_icon_color = TRAY_ICON_COLOR_LOGHT; +- else +- tray_icon_color = TRAY_ICON_COLOR_DRAK; +- +- } +- }); +-} +- +-QPixmap PictureToWhite::drawSymbolicColoredPixmap(const QPixmap &source) +-{ +- QColor gray(128,128,128); +- QColor standard (31,32,34); +- QImage img = source.toImage(); +- qDebug() << "tray_icon_color-->" << tray_icon_color; +- for (int x = 0; x < img.width(); x++) { +- for (int y = 0; y < img.height(); y++) { +- auto color = img.pixelColor(x, y); +- if (color.alpha() > 0) { +- if (qAbs(color.red()-gray.red()) < 255 && qAbs(color.green()-gray.green()) < 255 && qAbs(color.blue()-gray.blue()) < 255) { +- color.setRed(tray_icon_color); +- color.setGreen(tray_icon_color); +- color.setBlue(tray_icon_color); +- img.setPixelColor(x, y, color); +- } else if (qAbs(color.red()-standard.red()) < 255 && qAbs(color.green()-standard.green()) < 255 && qAbs(color.blue()-standard.blue()) < 255) { +- color.setRed(tray_icon_color); +- color.setGreen(tray_icon_color); +- color.setBlue(tray_icon_color); +- img.setPixelColor(x, y, color); +- } else +- img.setPixelColor(x, y, color); +- } +- } +- } +- return QPixmap::fromImage(img); +-} +diff --git a/plugins/account/userinfo_intel/picturetowhite.h b/plugins/account/userinfo_intel/picturetowhite.h +deleted file mode 100644 +index 24c1e14..0000000 +--- a/plugins/account/userinfo_intel/picturetowhite.h ++++ /dev/null +@@ -1,52 +0,0 @@ +-/* +-* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., 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; either version 3, 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 <http://www.gnu.org/licenses/>. +-* +-*/ +-#ifndef PICTURETOWHITE_H +-#define PICTURETOWHITE_H +- +-#include <QObject> +-#include <QGSettings/QGSettings> +-#include <QString> +-#include <QVariant> +-#include <QPixmap> +-#include <QDebug> +- +-#define ORG_UKUI_STYLE "org.ukui.style" +-#define STYLE_NAME "styleName" +-#define STYLE_NAME_KEY_DARK "ukui-dark" +-#define STYLE_NAME_KEY_DEFAULT "ukui-default" +-//#define STYLE_NAME_KEY_BLACK "ukui-black" +-#define STYLE_NAME_KEY_LIGHT "ukui-light" +-#define STYLE_NAME_KEY_WHITE "ukui-white" +-#define TRAY_ICON_COLOR_LOGHT 0 +-#define TRAY_ICON_COLOR_DRAK 255 +- +-class PictureToWhite : public QObject +-{ +- Q_OBJECT +-public: +- explicit PictureToWhite(QObject *parent = nullptr); +- void initGsettingValue(); +- QPixmap drawSymbolicColoredPixmap(const QPixmap &source); +- +-public: +- QGSettings *m_pgsettings; +- int tray_icon_color; +- +-}; +- +-#endif // PICTURETOWHITE_H +diff --git a/plugins/account/userinfo_intel/qtdbus/systemdbusdispatcher.cpp b/plugins/account/userinfo_intel/qtdbus/systemdbusdispatcher.cpp +deleted file mode 100644 +index 725dfe6..0000000 +--- a/plugins/account/userinfo_intel/qtdbus/systemdbusdispatcher.cpp ++++ /dev/null +@@ -1,68 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "systemdbusdispatcher.h" +- +-#include <QDebug> +- +-SystemDbusDispatcher::SystemDbusDispatcher(QObject *parent) : +- QObject(parent) +-{ +- systemiface = new QDBusInterface("org.freedesktop.Accounts", +- "/org/freedesktop/Accounts", +- "org.freedesktop.Accounts", +- QDBusConnection::systemBus()); +- connect(systemiface, SIGNAL(UserAdded(QDBusObjectPath)), this, SLOT(create_user_success(QDBusObjectPath))); +- connect(systemiface, SIGNAL(UserDeleted(QDBusObjectPath)), this, SLOT(delete_user_success(QDBusObjectPath))); +-} +- +-SystemDbusDispatcher::~SystemDbusDispatcher() +-{ +- delete systemiface; +- systemiface = NULL; +-} +- +-QStringList SystemDbusDispatcher::list_cached_users(){ +- QStringList users; +- QDBusReply<QList<QDBusObjectPath> > reply = systemiface->call("ListCachedUsers"); +- if (reply.isValid()){ +- for (QDBusObjectPath op : reply.value()) +- users << op.path(); +- } +- return users; +-} +- +-void SystemDbusDispatcher::create_user(QString name, QString fullname, int accounttype){ +- QDBusReply<QDBusObjectPath> repley = systemiface->call("CreateUser", name, fullname, accounttype); +- if (!repley.isValid()) +- qDebug() << "Create User Error" << repley.error().message(); +-// QMessageBox::information(0, "Create User Error", repley.error().message()); +-} +- +-void SystemDbusDispatcher::delete_user(qint64 uid, bool removefile){ +- systemiface->call("DeleteUser", uid, removefile); +-} +- +-void SystemDbusDispatcher::create_user_success(QDBusObjectPath objpath){ +- emit createuserdone(objpath.path()); +-} +- +-void SystemDbusDispatcher::delete_user_success(QDBusObjectPath objpath){ +- emit deleteuserdone(objpath.path()); +-} +diff --git a/plugins/account/userinfo_intel/qtdbus/systemdbusdispatcher.h b/plugins/account/userinfo_intel/qtdbus/systemdbusdispatcher.h +deleted file mode 100644 +index c6ffd90..0000000 +--- a/plugins/account/userinfo_intel/qtdbus/systemdbusdispatcher.h ++++ /dev/null +@@ -1,56 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef SYSTEMDBUSDISPATCHER_H +-#define SYSTEMDBUSDISPATCHER_H +- +-#include <QObject> +-#include <QDBusInterface> +-#include <QDBusConnection> +-#include <QDBusReply> +- +-#include<QMessageBox> +- +-class SystemDbusDispatcher : public QObject +-{ +- Q_OBJECT +- +-public: +- explicit SystemDbusDispatcher(QObject * parent = 0); +- ~SystemDbusDispatcher(); +- +- QStringList list_cached_users(); +- +- void create_user(QString name, QString fullname, int accounttype); +- void delete_user(qint64 uid, bool removefile); +- +-private: +- QDBusInterface * systemiface; +- +-private slots: +- void create_user_success(QDBusObjectPath objpath); +- void delete_user_success(QDBusObjectPath objpath); +- +-signals: +- void createuserdone(QString path); +- void deleteuserdone(QString path); +- +-}; +- +-#endif // SYSTEMDBUSDISPATCHER_H +diff --git a/plugins/account/userinfo_intel/qtdbus/userdispatcher.cpp b/plugins/account/userinfo_intel/qtdbus/userdispatcher.cpp +deleted file mode 100644 +index 201db29..0000000 +--- a/plugins/account/userinfo_intel/qtdbus/userdispatcher.cpp ++++ /dev/null +@@ -1,116 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "userdispatcher.h" +- +-#include <QDebug> +- +-UserDispatcher::UserDispatcher(QString objpath, QObject *parent) : +- QObject(parent) +-{ +- this->setParent(parent); +- useriface = new QDBusInterface("org.freedesktop.Accounts", +- objpath, +- "org.freedesktop.Accounts.User", +- QDBusConnection::systemBus()); +- pUserInfo = (UserInfo *)QObject::parent(); +- +- +- userPropert = new QDBusInterface("org.freedesktop.Accounts", +- objpath, +- "org.freedesktop.DBus.Properties", +- QDBusConnection::systemBus()); +-} +- +-UserDispatcher::~UserDispatcher() +-{ +- delete useriface; +- useriface = NULL; +-} +- +-/*来自gtk控制面板的加密代码*/ +-QString UserDispatcher::make_crypted (const gchar *plain){ +- GString *salt; +- gchar *result; +- GRand *rand; +- gint i; +- +- rand = g_rand_new (); +- salt = g_string_sized_new (21); +- +- gchar salt_char[] = "ABCDEFGHIJKLMNOPQRSTUVXYZ" +- "abcdefghijklmnopqrstuvxyz" +- "./0123456789"; +- +-// /* SHA 256 */ +- g_string_append (salt, "$6$"); +- for (i = 0; i < 16; i++) { +- g_string_append_c (salt, salt_char[g_rand_int_range(rand, 0, G_N_ELEMENTS (salt_char) )]); +- } +- g_string_append_c (salt, '$'); +- +- result = g_strdup ((const gchar *)crypt(plain, salt->str)); //运行后找不到crypt undefined symbol: crypt +- +- g_string_free (salt, TRUE); +- g_rand_free (rand); +- +- return QString(result); +- +-} +- +-QString UserDispatcher::change_user_pwd(QString pwd, QString hint){ +- QByteArray ba = pwd.toLatin1(); +- QString pwdencryption = make_crypted(ba.data()); +- +- QDBusReply<QString> reply = useriface->call("SetPassword", pwdencryption, hint); +-// if (reply.isValid()) +-// qDebug() << reply.value(); +-// else +-// qDebug() << reply.error().message(); +- return ""; +-} +- +-void UserDispatcher::change_user_type(int atype){ +- useriface->call("SetAccountType", QVariant(atype)); +-} +- +-void UserDispatcher::change_user_face(QString facefile){ +- useriface->call("SetIconFile", QVariant(facefile)); +-} +- +-void UserDispatcher::change_user_autologin(QString username){ +- QDBusInterface * tmpSysinterface = new QDBusInterface("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- if (!tmpSysinterface->isValid()){ +- qCritical() << "Create Client Interface Failed When : " << QDBusConnection::systemBus().lastError(); +- return; +- } +- tmpSysinterface->call("setAutoLoginStatus", username); +- +- delete tmpSysinterface; +-} +- +-bool UserDispatcher::get_autoLogin_status() { +- QDBusReply<QVariant> reply = userPropert->call("Get", "org.freedesktop.Accounts.User", "AutomaticLogin"); +-// qDebug()<<"the status is------>"<<reply.value().toBool()<<endl; +- return reply.value().toBool(); +-} +diff --git a/plugins/account/userinfo_intel/qtdbus/userdispatcher.h b/plugins/account/userinfo_intel/qtdbus/userdispatcher.h +deleted file mode 100644 +index 4c4cb8e..0000000 +--- a/plugins/account/userinfo_intel/qtdbus/userdispatcher.h ++++ /dev/null +@@ -1,70 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef USERDISPATCHER_H +-#define USERDISPATCHER_H +- +-#include <QObject> +-#include <QDBusInterface> +-#include <QDBusConnection> +-#include <QDBusReply> +- +-#include <unistd.h> +- +-/* qt会将glib里的signals成员识别为宏,所以取消该宏 +- * 后面如果用到signals时,使用Q_SIGNALS代替即可 +- **/ +-#ifdef signals +-#undef signals +-#endif +- +-extern "C" { +-#include <glib.h> +-#include <glib/gstdio.h> +-#include <gio/gio.h> +-} +- +-class UserInfo; +- +-class UserDispatcher : public QObject +-{ +- Q_OBJECT +- +-public: +- explicit UserDispatcher(QString objpath, QObject *parent = 0); +- ~UserDispatcher(); +- +- QString change_user_pwd(QString pwd, QString hint); +- void change_user_type(int atype); +- void change_user_face(QString facefile); +- void change_user_autologin(QString username); +- bool get_autoLogin_status(); +- +-private: +- QDBusInterface * useriface; +- QDBusInterface * userPropert; +- +- UserInfo * pUserInfo; +- +- /***加密,来自gtk控制面板***/ +- QString make_crypted(const gchar * plain); +- /*****/ +-}; +- +-#endif // USERDISPATCHER_H +diff --git a/plugins/account/userinfo_intel/res/img.qrc b/plugins/account/userinfo_intel/res/img.qrc +deleted file mode 100644 +index 4d8ed66..0000000 +--- a/plugins/account/userinfo_intel/res/img.qrc ++++ /dev/null +@@ -1,3 +0,0 @@ +-<RCC> +- <qresource prefix="/"/> +-</RCC> +diff --git a/plugins/account/userinfo_intel/userinfo_intel.cpp b/plugins/account/userinfo_intel/userinfo_intel.cpp +deleted file mode 100644 +index 08cf360..0000000 +--- a/plugins/account/userinfo_intel/userinfo_intel.cpp ++++ /dev/null +@@ -1,1358 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "userinfo_intel.h" +-#include "ui_userinfo_intel.h" +-#include "changepininteldialog.h" +-#include "changepwdinteldialog.h" +- +-#include <QDBusInterface> +-#include <QDBusConnection> +-#include <QDBusError> +-#include <QDBusReply> +- +-#include <QDebug> +-#include <QDir> +-#include <QFrame> +-#include <QTextCodec> +-#include <QByteArray> +- +-#include "switchbutton.h" +-#include "imageutil.h" +-#include "elipsemaskwidget.h" +-#include "passwdcheckutil.h" +- +- +-/* qt会将glib里的signals成员识别为宏,所以取消该宏 +- * 后面如果用到signals时,使用Q_SIGNALS代替即可 +- **/ +-#ifdef signals +-#undef signals +-#endif +- +-extern "C" { +-#include <glib.h> +-#include <gio/gio.h> +-} +- +- +-#define DEFAULTFACE "/usr/share/ukui/faces/default.png" +-#define ITEMHEIGH 72 +- +-UserInfoIntel::UserInfoIntel() : mFirstLoad(true) +-{ +- pluginName = tr("User Info Intel"); +- pluginType = ACCOUNT; +-} +- +-UserInfoIntel::~UserInfoIntel() +-{ +- if (!mFirstLoad) { +- delete ui; +- delete autoSettings; +- } +-} +- +-QString UserInfoIntel::plugini18nName(){ +- return pluginName; +-} +- +-int UserInfoIntel::pluginTypes(){ +- return pluginType; +-} +- +-QWidget *UserInfoIntel::pluginUi(){ +- if (mFirstLoad) { +- mFirstLoad = false; +- ui = new Ui::UserInfoIntel; +- pluginWidget = new QWidget; +- pluginWidget->setAttribute(Qt::WA_StyledBackground,true); +- pluginWidget->setAttribute(Qt::WA_DeleteOnClose); +- ui->setupUi(pluginWidget); +- ui->titleLabel->setStyleSheet("QLabel{font-size: 14px; color: palette(windowText);}"); +- //构建System dbus调度对象 +- sysdispatcher = new SystemDbusDispatcher; +- +- ui->changeGroupBtn->hide(); +- // ui->changeValidBtn->hide(); +- +- //获取系统全部用户信息,用户Uid大于等于1000的 +- _acquireAllUsersInfo(); +- +- initSearchText(); +- readCurrentPwdConf(); +- initComponent(); +- initAllUserStatus(); +- //设置界面用户信息 +- _refreshUserInfoUI(); +- +- // pwdSignalMapper = new QSignalMapper(this); +- // faceSignalMapper = new QSignalMapper(this); +- // typeSignalMapper = new QSignalMapper(this); +- // delSignalMapper = new QSignalMapper(this); +- +- // faceSize = QSize(64, 64); +- // itemSize = QSize(230, 106); //?需要比btnsize大多少?否则显示不全 +- // btnSize = QSize(222, 92); +- // showCreateUserDialog(); +- +- // get_all_users(); +- // ui_component_init(); +- // ui_status_init(); +- } +- return pluginWidget; +-} +- +-const QString UserInfoIntel::name() const { +- +- return QStringLiteral("UserinfoIntel"); +-} +- +-bool UserInfoIntel::isShowOnHomePage() const +-{ +- return UkccCommon::isTablet(); +-} +- +-QIcon UserInfoIntel::icon() const +-{ +- return QIcon::fromTheme("user-available-symbolic"); +-} +- +-bool UserInfoIntel::isEnable() const +-{ +- return UkccCommon::isTablet(); +-} +- +-void UserInfoIntel::initSearchText() { +- ui->changePhoneBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/phone.svg")); +- //~ contents_path /UserinfoIntel/Current User +- ui->titleLabel->setText(tr("Current User")); +- +- //~ contents_path /UserinfoIntel/Other Users +- ui->title2Label->setText(tr("Other Users")); +- +- //~ contents_path /UserinfoIntel/Change Tel +- ui->changePhoneBtn->setText(tr("Change Tel")); +- +- ui->changePwdBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/password.svg")); +- +- //~ contents_path /UserinfoIntel/Change pwd +- ui->changePwdBtn->setText(tr("Change pwd")); +- +- +- ui->delUserBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/delete.svg")); +- m_pPictureToWhite = new PictureToWhite(); +- ui->editBtn->setIcon(QIcon(m_pPictureToWhite->drawSymbolicColoredPixmap(QPixmap(":/img/plugins/userinfo_intel/settingedit.svg")))); +- ui->userNameLabel->setStyleSheet("background-color: transparent"); +- const QByteArray id(ORG_UKUI_STYLE); +- if (QGSettings::isSchemaInstalled(id)) { +- m_pgsettings = new QGSettings(id); +- connect(m_pgsettings, &QGSettings::changed, this, [=] (const QString &key) { +- if (key==STYLE_NAME) { +- ui->editBtn->setIcon(QIcon(m_pPictureToWhite->drawSymbolicColoredPixmap(QPixmap(":/img/plugins/userinfo_intel/settingedit.svg")))); +- } +- }); +- } +- +- +- //~ contents_path /UserinfoIntel/Delete user +- ui->delUserBtn->setText(tr("Delete user")); +- +- //~ contents_path /UserinfoIntel/Change user name +- tr("Change user name"); // 用于添加搜索索引 +- +- ui->frame->hide(); +- ui->frame_2->hide(); +- ui->line_2->hide(); +- ui->line_4->hide(); +- ui->line->hide(); +-} +- +-QString UserInfoIntel::_accountTypeIntToString(int type){ +-// qDebug()<<"allUserInfoMap.count()-------------"<<allUserInfoMap.count(); +- QString atype; +- if (type == STANDARDUSER) { +- atype = tr("standard user"); +- } else if (type == ADMINISTRATOR) { +- atype = tr("administrator"); +- if (allUserInfoMap.count() != 1) { +- ui->line_3->hide(); +- ui->delUserBtn->hide(); +- } else { +- ui->title2Label->hide(); +- } +- } +- else if (type == ROOT) { +- atype = tr("root"); +- } +- +- return atype; +-} +- +-void UserInfoIntel::_acquireAllUsersInfo(){ +- QStringList objectpaths = sysdispatcher->list_cached_users(); +- +- //初始化用户信息QMap +- allUserInfoMap.clear(); +- //初始化管理员数目为0 +- adminnum = 0; +- +- for (QString objectpath : objectpaths){ +- UserInfomation user; +- user = _acquireUserInfo(objectpath); +- allUserInfoMap.insert(user.username, user); +- } +- +- if (allUserInfoMap.isEmpty()) { +- ui->currentUserFrame->setVisible(false); +- } else { +- ui->currentUserFrame->setVisible(true); +- } +-} +- +-UserInfomation UserInfoIntel::_acquireUserInfo(QString objpath){ +- UserInfomation user; +- +- //默认值 +- user.current = false; +- user.logined = false; +- user.autologin = false; +- +- QDBusInterface * iproperty = new QDBusInterface("org.freedesktop.Accounts", +- objpath, +- "org.freedesktop.DBus.Properties", +- QDBusConnection::systemBus()); +- QDBusReply<QMap<QString, QVariant> > reply = iproperty->call("GetAll", "org.freedesktop.Accounts.User"); +- if (reply.isValid()){ +- QMap<QString, QVariant> propertyMap; +- propertyMap = reply.value(); +- user.username = propertyMap.find("UserName").value().toString(); +- user.realname = propertyMap.find("RealName").value().toString(); +- if (user.username == QString(g_get_user_name())){ +- user.current = true; +- user.logined = true; +- +- //获取当前用户免密登录属性 +- QDBusInterface *tmpSysinterface = new QDBusInterface("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- //获取免密登录状态 +- QDBusReply<QString> noPwdres; +- noPwdres = tmpSysinterface ->call("getNoPwdLoginStatus"); +- //const QString &tmp=noPwdres; +- if(!noPwdres.isValid()){ +- qDebug()<<"获取tmpSysinterface状态不合法---->"<< noPwdres.error(); +- } +- delete tmpSysinterface; +- +- user.noPwdLogin = noPwdres.value().contains(user.username) ? true : false; +- } +- user.accounttype = propertyMap.find("AccountType").value().toInt(); +- if (user.accounttype == ADMINISTRATOR) +- adminnum++; +- user.iconfile = propertyMap.find("IconFile").value().toString(); +- user.passwdtype = propertyMap.find("PasswordMode").value().toInt(); +- user.uid = propertyMap.find("Uid").value().toInt(); +-// user.autologin = propertyMap.find("AutomaticLogin").value().toBool(); +- user.autologin = this->getAutomaticLogin(user.username); +- user.objpath = objpath; +- } +- else +- qDebug() << "reply failed"; +- +- delete iproperty; +- +- return user; +-} +- +-void UserInfoIntel::readCurrentPwdConf(){ +-#ifdef ENABLEPQ +- int ret, status; +- void *auxerror; +- char buf[255]; +- +- pwdMsg = ""; +- +- pwdconf = pwquality_default_settings(); +- if (pwdconf == NULL) { +- enablePwdQuality = false; +- qDebug() << "init pwquality settings failed"; +- } else { +- enablePwdQuality = true; +- } +- +- ret = pwquality_read_config(pwdconf, PWCONF, &auxerror); +- if (ret != 0){ +- enablePwdQuality = false; +- qDebug() << "Reading pwquality configuration file failed: " << pwquality_strerror(buf, sizeof(buf), ret, auxerror); +- } else { +- enablePwdQuality = true; +- } +- +- if (PasswdCheckUtil::getCurrentPamState()){ +- enablePwdQuality = true; +- } else { +- enablePwdQuality = false; +- } +- +- if (enablePwdQuality){ +- int minLen; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_MIN_LENGTH, &minLen); +- if (!status && minLen > 0){ +- pwdOption.min_length = minLen; +- pwdMsg += QObject::tr("min length %1\n").arg(minLen); +- +- } else { +- pwdMsg += ""; +- } +- +- int digCredit; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_DIG_CREDIT, &digCredit); +- if (!status && digCredit > 0){ +- pwdOption.dig_credit = digCredit; +- pwdMsg += QObject::tr("min digit num %1\n").arg(digCredit); +- } else { +- pwdMsg += ""; +- } +- +- int upCredit; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_UP_CREDIT, &upCredit); +- if (!status && upCredit > 0){ +- pwdOption.up_credit = upCredit; +- pwdMsg += QObject::tr("min upper num %1\n").arg(upCredit); +- } else { +- pwdMsg += ""; +- } +- +- int lowCredit; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_LOW_CREDIT, &lowCredit); +- if (!status && lowCredit > 0){ +- pwdOption.low_credit = lowCredit; +- pwdMsg += QObject::tr("min lower num %1\n").arg(lowCredit); +- } else { +- pwdMsg += ""; +- } +- +- int othCredit; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_OTH_CREDIT, &othCredit); +- if (!status && othCredit > 0){ +- pwdOption.oth_credit = othCredit; +- pwdMsg += QObject::tr("min other num %1\n").arg(othCredit); +- } else { +- pwdMsg += ""; +- } +- +- +- int minClass; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_MIN_CLASS, &minClass); +- if (!status && minClass > 0){ +- pwdOption.min_class = minClass; +- pwdMsg += QObject::tr("min char class %1\n").arg(minClass); +- } else { +- pwdMsg += ""; +- } +- +- int maxRepeat; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_MAX_REPEAT, &maxRepeat); +- if (!status && maxRepeat > 0){ +- pwdOption.max_repeat = maxRepeat; +- pwdMsg += QObject::tr("max repeat %1\n").arg(maxRepeat); +- } else { +- pwdMsg += ""; +- } +- +- int maxClassRepeat; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_MAX_CLASS_REPEAT, &maxClassRepeat); +- if (!status && maxClassRepeat > 0){ +- pwdOption.max_class_repeat = maxClassRepeat; +- pwdMsg += QObject::tr("max class repeat %1\n").arg(maxClassRepeat); +- } else { +- pwdMsg += ""; +- } +- +- int maxSequence; +- status = pwquality_get_int_value(pwdconf, PWQ_SETTING_MAX_SEQUENCE, &maxSequence); +- if (!status && maxSequence > 0){ +- pwdOption.max_class_repeat = maxSequence; +- pwdMsg += QObject::tr("max sequence %1\n").arg(maxSequence); +- } else { +- pwdMsg += ""; +- } +- } +- +- qDebug() << "pwquality:" << pwdOption.min_length << pwdOption.min_class << pwdOption.dig_credit << pwdOption.low_credit << pwdOption.up_credit; +- qDebug() << "pwquality msg:" << pwdMsg; +-#endif +-} +- +-void UserInfoIntel::initComponent(){ +- //样式表 +-// pluginWidget->setStyleSheet("background: #ffffff;"); +- +-// ui->currentUserWidget->setStyleSheet("QWidget{background: #F4F4F4; border-top-left-radius: 6px; border-top-right-radius: 6px;}"); +-// ui->autoLoginWidget->setStyleSheet("QWidget{background: #F4F4F4; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px;}"); +- +-// QString btnQss = QString("QPushButton{background: #FFFFFF; border-radius: 4px;}"); +-// ui->changePwdBtn->setStyleSheet(btnQss); +-// ui->changeTypeBtn->setStyleSheet(btnQss); +- +-// ui->addUserWidget->setStyleSheet("QWidget{background: #F4F4F4; border-radius: 6px;}"); +- +-// QString filename = "/etc/lightdm/lightdm.conf"; +-// autoSettings = new QSettings(filename, QSettings::IniFormat); +- +- ui->listWidget->setStyleSheet("QListWidget::Item{background:palette(base);}"); +- +- addWgt = new HoverWidget(""); +- addWgt->setObjectName("addwgt"); +- addWgt->setMinimumSize(QSize(0, 64)); +- addWgt->setMaximumSize(QSize(16777215, 64)); +- addWgt->setStyleSheet("HoverWidget#addwgt{background: palette(base); border-radius: 4px;}HoverWidget:hover:!pressed#addwgt{background: #2FB3E8; border-radius: 4px;}"); +- +- QHBoxLayout *addLyt = new QHBoxLayout; +- +- QLabel * iconLabel = new QLabel(); +- QLabel * textLabel = new QLabel(tr("Add new user")); +- QPixmap pixgray = ImageUtil::loadSvg(":/img/titlebar/add.svg", "black", 12); +- iconLabel->setPixmap(pixgray); +- addLyt->addWidget(iconLabel); +- addLyt->addWidget(textLabel); +- addLyt->addStretch(); +- addWgt->setLayout(addLyt); +- +- // 悬浮改变Widget状态 +- connect(addWgt, &HoverWidget::enterWidget, this, [=](QString mname){ +- QPixmap pixgray = ImageUtil::loadSvg(":/img/titlebar/add.svg", "white", 12); +- iconLabel->setPixmap(pixgray); +- textLabel->setStyleSheet("color: palette(base);"); +- +- }); +- // 还原状态 +- connect(addWgt, &HoverWidget::leaveWidget, this, [=](QString mname){ +- QPixmap pixgray = ImageUtil::loadSvg(":/img/titlebar/add.svg", "black", 12); +- iconLabel->setPixmap(pixgray); +- textLabel->setStyleSheet("color: palette(windowText);"); +- }); +- +- ui->listWidget->setSpacing(0); +- +- ElipseMaskWidget * mainElipseMaskWidget = new ElipseMaskWidget(ui->currentUserFaceLabel); +- mainElipseMaskWidget->setGeometry(0, 0, ui->currentUserFaceLabel->width(), ui->currentUserFaceLabel->height()); +- +- //设置添加用户的图标 +-// ui->addBtn->setIcon(QIcon("://img/plugins/userinfo_intel/add.png")); +-// ui->addBtn->setIconSize(ui->addBtn->size()); +-// ui->addBtn->setStyleSheet("QPushButton{background-color:transparent;}"); +- +- ui->currentUserFaceLabel->installEventFilter(this); +-// ui->addUserFrame->installEventFilter(this); +- +- //修改当前用户绑定手机号的回调 +- connect(ui->changePhoneBtn, &QPushButton::clicked, this, [=](bool checked){ +- Q_UNUSED(checked) +- UserInfomation user = allUserInfoMap.value(g_get_user_name()); +- +- showChangePhoDialog(user.username); +- }); +- +- //修改当前用户密码的回调 +- connect(ui->changePwdBtn, &QPushButton::clicked, this, [=](bool checked){ +- Q_UNUSED(checked) +- UserInfomation user = allUserInfoMap.value(g_get_user_name()); +- showChangePwdDialog(user.username); +- }); +- //删除当前用户 +- connect(ui->delUserBtn, &QPushButton::clicked, this, [=](bool checked){ +- +- UserInfomation user = allUserInfoMap.value(g_get_user_name()); +- DelUserIntelDialog * dialog = new DelUserIntelDialog; +- dialog->setAttribute(Qt::WA_DeleteOnClose); +- dialog->setFace(user.iconfile); +- dialog->setUsername(user.username,user.realname); +- +- connect(dialog, &DelUserIntelDialog::removefile_send, this, [=](bool removeFile, QString userName){ +- qDebug()<<userName; +- QDBusInterface * m_interface = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- QDBusReply<int> result = m_interface->call("DeleteAccount",user.username); +- isDelCurrentUser = true; +- if (result == 0) { +- delete m_interface; +- QDBusInterface *m_session = new QDBusInterface("org.freedesktop.login1", +- "/org/freedesktop/login1/session/auto", +- "org.freedesktop.login1.Session", +- QDBusConnection::systemBus(),this); +- m_session->call("Terminate"); +- } else { +- qDebug() << "--------error:" << result.error(); +- } +- }); +- dialog->exec(); +- return; +- }); +- +-// //修改当前用户类型的回调 +-// connect(ui->changeTypeBtn, &QPushButton::clicked, this, [=](bool checked){ +-// Q_UNUSED(checked) +-// UserInfomation user = allUserInfoMap.value(g_get_user_name()); +- +-// showChangeTypeDialog(user.username); +-// }); +- +-// connect(ui->changeValidBtn, &QPushButton::clicked, this, [=](bool checked){ +-// Q_UNUSED(checked) +-// UserInfomation user = allUserInfoMap.value(g_get_user_name()); +- +-// showChangeValidDialog(user.username); +- +-// }); +- +- connect(ui->changeGroupBtn, &QPushButton::clicked, this, [=](bool checked){ +- Q_UNUSED(checked) +- showChangeGroupDialog(); +- }); +- +- +- //修改当前用户自动登录 +-// connect(autoLoginSwitchBtn, &SwitchButton::checkedChanged, [=](bool checked){ +-// UserInfomation user = allUserInfoMap.value(g_get_user_name()); +- +- +-// UserDispatcher * userdispatcher = new UserDispatcher(user.objpath); +- +- +-// bool status = userdispatcher->get_autoLogin_status(); +- +-// bool status = this->getAutomaticLogin(user.username); +- +- +-// if ((checked != status)) { +-// if (checked) { +-// userdispatcher->change_user_autologin(user.username); +-// } else { +-// userdispatcher->change_user_autologin(""); +-// } +-// } +- +-// bool lstStatus = userdispatcher->get_autoLogin_status(); +- +-// bool lstStatus = this->getAutomaticLogin(user.username); +-// autoLoginSwitchBtn->setChecked(lstStatus); +-// }); +- +- //成功删除用户的回调 +- connect(sysdispatcher, &SystemDbusDispatcher::deleteuserdone, this, [=](QString objPath){ +- deleteUserDone(objPath); +- }); +- +- //新建用户的回调 +-// connect(ui->addBtn, &QPushButton::clicked, this, [=](bool checked){ +-// Q_UNUSED(checked) +-// showCreateUserDialog(); +-// }); +- +- //成功新建用户的回调 +- connect(sysdispatcher, &SystemDbusDispatcher::createuserdone, this, [=](QString objPath){ +- createUserDone(objPath); +- }); +-} +- +-void UserInfoIntel::_resetListWidgetHeigh(){ +- //设置其他用户控件的总高度 +- if (!isDelCurrentUser) { +- ui->listWidget->setFixedHeight((allUserInfoMap.count() - 1) * (ITEMHEIGH + 2)); +- } +- // ui->listWidget->setFixedHeight((20) * (ITEMHEIGH + 2)); +-} +- +-void UserInfoIntel::initAllUserStatus(){ +- _resetListWidgetHeigh(); +- +- //每次初始化用户状态清空其他用户QMap +- otherUserItemMap.clear(); +- +- QMap<QString, UserInfomation>::iterator it = allUserInfoMap.begin(); +- for (; it != allUserInfoMap.end(); it++){ +- UserInfomation user = it.value(); +- +- //当前用户 +- if (user.username == QString(g_get_user_name())){ +- +- } else { //其他用户 +- _buildWidgetForItem(user); +- +- } +- } +-} +- +-QPixmap UserInfoIntel::PixmapToRound(const QString &src, int radius) +-{ +- if (src == "") { +- return QPixmap(); +- } +- QPixmap pixmapa(src); +- QPixmap pixmap(radius*2,radius*2); +- pixmap.fill(Qt::transparent); +- QPainter painter(&pixmap); +- painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- QPainterPath path; +- path.addEllipse(0, 0, radius*2, radius*2); +- painter.setClipPath(path); +- painter.drawPixmap(0, 0, radius*2, radius*2, pixmapa); +- return pixmap; +-} +- +-void UserInfoIntel::_refreshUserInfoUI(){ +- QMap<QString, UserInfomation>::iterator it = allUserInfoMap.begin(); +- for (; it != allUserInfoMap.end(); it++){ +- UserInfomation user = it.value(); +- +- //用户头像为.face且.face文件不存在 +- char * iconpath = user.iconfile.toLatin1().data(); +- if (!g_file_test(iconpath, G_FILE_TEST_EXISTS)){ +- user.iconfile = DEFAULTFACE; +- //更新用户数据 +- allUserInfoMap.find(it.key()).value().iconfile = DEFAULTFACE; +- } +- +- //当前用户 +- if (user.username == QString(g_get_user_name())){ +- //设置用户头像 +- QPixmap iconcop = QPixmap(user.iconfile); +- if (iconcop.width() > iconcop.height()) { +- QPixmap iconPixmap = iconcop.copy((iconcop.width() - iconcop.height())/2, 0, iconcop.height(), iconcop.height()); +- // 根据label高度等比例缩放图片 +- ui->currentUserFaceLabel->setPixmap(iconPixmap.scaledToHeight(ui->currentUserFaceLabel->height())); +- +- setChangeFaceShadow(); +- } else { +- QPixmap iconPixmap = iconcop.copy(0, (iconcop.height() - iconcop.width())/2, iconcop.width(), iconcop.width()); +- // 根据label宽度等比例缩放图片 +- ui->currentUserFaceLabel->setPixmap(iconPixmap.scaledToWidth(ui->currentUserFaceLabel->width())); +- +- setChangeFaceShadow(); +- } +- +- current_user = user; +- +- QDir historyDir; +- historyDir.setPath(QString("/home/%1").arg(user.username)); +- if(!historyDir.exists(QString("/home/%1/.historyfaces").arg(user.username))) { +- historyDir.mkpath(QString("/home/%1/.historyfaces").arg(user.username)); +- } else { +-// qDebug()<<QString("/home/%1/.historyfaces/").arg(user.username)<<" Exist!"; +- } +- +- //设置用户名 +- +- ui->userNameLabel->setStyleSheet("QLineEdit{color: palette(windowText);}"); +- QFontMetrics fontMetrics(ui->userNameLabel->font()); +- int fontSize = fontMetrics.width(user.realname); +- m_userName = user.realname; +- if (fontSize > 180) { +- QString str = fontMetrics.elidedText(user.realname, Qt::ElideRight, 180); +- ui->userNameLabel->setFixedWidth(180); +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(str); +- ui->userNameLabel->blockSignals(false); +- ui->userNameLabel->setToolTip(user.realname); +- } else { +- ui->userNameLabel->setFixedWidth(fontSize+5); +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(user.realname); +- ui->userNameLabel->blockSignals(false); +- } +- ui->userNameLabel->setCursorPosition(0); +- ui->userNameLabel->setReadOnly(true); +- ui->userNameLabel->installEventFilter(this); +- +- oldName = ui->userNameLabel->text(); +- ui->userNameLabel->setMaxLength(32); +- connect(ui->userNameLabel,&QLineEdit::textChanged, [=](QString text){ +- QFontMetrics fontMetrics(ui->userNameLabel->font()); +- int fontSize = fontMetrics.width(text); +- if (fontSize > 180) { +- ui->userNameLabel->setFixedWidth(180); +- } else { +- ui->userNameLabel->setFixedWidth(fontSize+5); +- } +- m_userName = text; +- qDebug()<<"*********************SET NAME = "<<text; +- }); +- connect(ui->editBtn,&QPushButton::clicked,[=](){ +- UserInfomation curruser = allUserInfoMap.value(g_get_user_name()); +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(curruser.realname); +- ui->userNameLabel->blockSignals(false); +- ui->userNameLabel->setReadOnly(false); +- ui->userNameLabel->selectAll(); +- ui->userNameLabel->setFocus(); +- ui->editBtn->hide(); +- }); +- my_name = user.username; +- //设置用户类型 +- ui->userTypeLabel->setText(_accountTypeIntToString(user.accounttype)); +- //设置登录状态 +- // autoLoginSwitchBtn->setChecked(user.autologin); +- //设置免密登录状态 +- // nopwdSwitchBtn->setChecked(user.noPwdLogin); +- +- } else { //其他用户 +- QListWidgetItem * item = otherUserItemMap.value(user.objpath); //是否需要判断?? +- +- QWidget * widget = ui->listWidget->itemWidget(item); +- +- QLabel * faceLabel = widget->findChild<QLabel *>("faceLabel"); +-// faceLabel->setIcon(QIcon(user.iconfile)); +-// _buildWidgetForItem(user); +- if (faceLabel->layout() != NULL) { +- QLayoutItem* item; +- while ((item = faceLabel->layout()->takeAt( 0 )) != NULL ) +- { +- delete item->widget(); +- delete item; +- } +-// delete faceLabel->layout(); +- } +- faceLabel->setScaledContents(true); +- faceLabel->setPixmap(PixmapToRound(user.iconfile, faceLabel->width()/2)); +- } +- } +- QDBusInterface *m_interface1 = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.eduplatform", +- QDBusConnection::systemBus()); +- if (m_interface1->isValid()) { +- QDBusMessage result = m_interface1->call("CheckPincodeSet",QString(g_get_user_name())); +- QList<QVariant> outArgs = result.arguments(); +- delete m_interface1; +- int pinstatus = 0; +- pinstatus = outArgs.at(0).value<int>(); +- if (pinstatus == 0) { +- ui->changePwdBtn->setText(tr("set pwd")); +- } +- } +- +-} +- +-void UserInfoIntel::setChangeFaceShadow() +-{ +- //在头像上添加更换字样及阴影 +- QLabel *changeLabel = new QLabel(ui->currentUserFaceLabel); +- int changeLabelHeight = 26; +- changeLabel->setGeometry(0, ui->currentUserFaceLabel->height() - changeLabelHeight, ui->currentUserFaceLabel->width(), changeLabelHeight); +- +- changeLabel->setStyleSheet("QLabel{color:white;font-size:12px;background-color:rgb(0,0,0,70);}"); +- changeLabel->setText(tr("Change")); +- changeLabel->setAlignment(Qt::AlignCenter); +- +- QLabel *eraseOutLabel = new QLabel(ui->currentUserFaceLabel); +- eraseOutLabel->setAttribute(Qt::WA_TranslucentBackground, true); +- eraseOutLabel->setGeometry(0, 0, ui->currentUserFaceLabel->width(), ui->currentUserFaceLabel->height()); +- +- ElipseMaskWidget *eraseOutElipseMaskWidget = new ElipseMaskWidget(eraseOutLabel); +- eraseOutElipseMaskWidget->setGeometry(0, 0, eraseOutLabel->width(), eraseOutLabel->height()); +-} +- +-void UserInfoIntel::_buildWidgetForItem(UserInfomation user){ +- HoverWidget * baseWidget = new HoverWidget(user.username); +- baseWidget->setMinimumSize(0,64); +- baseWidget->setMaximumSize(16777215,64); +- baseWidget->setAttribute(Qt::WA_DeleteOnClose); +- +- QHBoxLayout * baseVerLayout = new QHBoxLayout(baseWidget); +- baseVerLayout->setSpacing(0); +- baseVerLayout->setMargin(0); +- +- QHBoxLayout * baseHorLayout = new QHBoxLayout(); +- baseHorLayout->setSpacing(16); +- baseHorLayout->setMargin(0); +- +- QFrame * widget = new QFrame(baseWidget); +- widget->setFrameShape(QFrame::Shape::Box); +- widget->setFixedHeight(64); +- +- QHBoxLayout * mainHorLayout = new QHBoxLayout(widget); +- mainHorLayout->setSpacing(16); +- mainHorLayout->setContentsMargins(16, 0, 16, 0); +- +- QLabel * faceLabel = new QLabel(widget); +- faceLabel->setObjectName("faceLabel"); +- faceLabel->setFixedSize(40, 40); +- +- QHBoxLayout * faceLabelHorLayout = new QHBoxLayout(faceLabel); +- faceLabelHorLayout->setSpacing(0); +- faceLabelHorLayout->setMargin(0); +- faceLabel->setLayout(faceLabelHorLayout); +- +- ElipseMaskWidget * faceElipseMaskWidget = new ElipseMaskWidget(faceLabel); +- faceElipseMaskWidget->setGeometry(0, 0, faceLabel->width(), faceLabel->height()); +- +- QLabel * nameLabel = new QLabel(widget); +- QSizePolicy nameSizePolicy = nameLabel->sizePolicy(); +- nameSizePolicy.setHorizontalPolicy(QSizePolicy::Fixed); +- nameSizePolicy.setVerticalPolicy(QSizePolicy::Fixed); +- nameLabel->setSizePolicy(nameSizePolicy); +- nameLabel->setText(user.realname); +- +- QString btnQss = QString("QPushButton{background: #ffffff; border-radius: 4px;}"); +- +- QPushButton * typeBtn = new QPushButton(widget); +- typeBtn->setFixedSize(64, 64); +-// typeBtn->setText(tr("Change type")); +- typeBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/type.svg")); +-// typeBtn->setStyleSheet(btnQss); +- connect(typeBtn, &QPushButton::clicked, this, [=](bool checked){ +- Q_UNUSED(checked) +- showChangeTypeDialog(user.username); +- }); +- typeBtn->hide(); +- +- QPushButton * pwdBtn = new QPushButton(widget); +- pwdBtn->setFixedSize(64, 64); +-// pwdBtn->setText(tr("Change pwd")); +- pwdBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/password.svg")); +-// pwdBtn->setStyleSheet(btnQss); +- connect(pwdBtn, &QPushButton::clicked, this, [=](bool checked){ +- Q_UNUSED(checked) +- showChangePwdDialog(user.username); +- +- }); +- pwdBtn->hide(); +- +- QFrame * line = new QFrame; +- line->setFrameShape(QFrame::VLine); +- line->setFixedSize(4, 12); +- +- mainHorLayout->addWidget(faceLabel); +- mainHorLayout->addWidget(nameLabel); +- mainHorLayout->addStretch(); +-// mainHorLayout->addWidget(pwdBtn); +-// mainHorLayout->addWidget(typeBtn); +- mainHorLayout->addWidget(line); +- widget->setLayout(mainHorLayout); +- +- QPushButton * delBtn = new QPushButton(baseWidget); +- delBtn->setFixedSize(64, 64); +-// delBtn->setText(tr("Delete")); +- delBtn->setIcon(QIcon(":/img/plugins/userinfo_intel/deluser.svg")); +-// delBtn->setStyleSheet("QPushButton{background: #FA6056; border-radius: 4px}"); +- delBtn->hide(); +- connect(delBtn, &QPushButton::clicked, this, [=](bool checked){ +- Q_UNUSED(checked) +- showDeleteUserDialog(user.username); +- }); +- +- connect(baseWidget, &HoverWidget::enterWidget, this, [=](QString name){ +- Q_UNUSED(name) +- //对普通用户,隐藏对其他用户进行操作的按钮 +- if (current_user.accounttype != STANDARDUSER){ +- line->hide(); +- //typeBtn->show(); +- //pwdBtn->show(); +- delBtn->show(); +- } +-// delBtn->show(); +- }); +- connect(baseWidget, &HoverWidget::leaveWidget, this, [=](QString name){ +- Q_UNUSED(name) +- line->show(); +- typeBtn->hide(); +- pwdBtn->hide(); +- delBtn->hide(); +- }); +- +- baseHorLayout->addWidget(widget); +- baseHorLayout->addWidget(pwdBtn, Qt::AlignVCenter); +- baseHorLayout->addWidget(typeBtn, Qt::AlignVCenter); +- baseHorLayout->addWidget(delBtn, Qt::AlignVCenter); +-// baseHorLayout->addSpacing(4); +- baseHorLayout->setSpacing(8); +- +- +- baseVerLayout->addLayout(baseHorLayout); +-// baseVerLayout->addStretch(); +- +- baseWidget->setLayout(baseVerLayout); +- +- QListWidgetItem * item = new QListWidgetItem(ui->listWidget); +-// item->setSizeHint(QSize(ui->listWidget->width() - 4, ITEMHEIGH)); +- item->setSizeHint(QSize(QSizePolicy::Expanding, ITEMHEIGH)); +- item->setData(Qt::UserRole, QVariant(user.objpath)); +- ui->listWidget->setItemWidget(item, baseWidget); +- +- otherUserItemMap.insert(user.objpath, item); +- +-} +- +-void UserInfoIntel::showCreateUserDialog(){ +- //获取系统所有用户名列表,创建时判断重名 +- QStringList usersStringList; +- for (QVariant tmp : allUserInfoMap.keys()){ +- usersStringList << tmp.toString(); +- } +- +- CreateUserIntelDialog * dialog = new CreateUserIntelDialog(usersStringList); +- dialog->setRequireLabel(pwdMsg); +- connect(dialog, &CreateUserIntelDialog::newUserWillCreate, this, [=](QString uName, QString pwd, QString pin, int aType){ +- createUser(uName, pwd, pin, aType); +- }); +- dialog->exec(); +-} +- +-QStringList UserInfoIntel::getUsersList() +-{ +- QStringList usersStringList; +- for (QVariant tmp : allUserInfoMap.keys()){ +- usersStringList << tmp.toString(); +- } +- return usersStringList; +-} +- +-void UserInfoIntel::createUser(QString username, QString pwd, QString pin, int atype){ +- Q_UNUSED(pin); +- sysdispatcher->create_user(username, "", atype); +- +- //使用全局变量传递新建用户密码 +- _newUserPwd = pwd; +-} +- +-void UserInfoIntel::createUserDone(QString objpath){ +- UserDispatcher * userdispatcher = new UserDispatcher(objpath); +- //设置默认头像 +- userdispatcher->change_user_face(DEFAULTFACE); +- //设置默认密码 +- userdispatcher->change_user_pwd(_newUserPwd, ""); +- +- //刷新全部用户信息 +- _acquireAllUsersInfo(); +- //重建其他用户ListWidget高度 +- _resetListWidgetHeigh(); +- +- //获取新建用户信息 +- UserInfomation user; +- user = _acquireUserInfo(objpath); +- +- //构建Item +- _buildWidgetForItem(user); +- _refreshUserInfoUI(); +-} +- +-void UserInfoIntel::showDeleteUserDialog(QString username){ +- UserInfomation user = (UserInfomation)(allUserInfoMap.find(username).value()); +-// QDBusInterface * m_interface = new QDBusInterface("cn.kylinos.SSOBackend", +-// "/cn/kylinos/SSOBackend", +-// "cn.kylinos.SSOBackend.accounts", +-// QDBusConnection::systemBus()); +-// m_interface->call("DeleteAccount",user.username); +-// delete m_interface; +- DelUserIntelDialog * dialog = new DelUserIntelDialog; +- dialog->setAttribute(Qt::WA_DeleteOnClose); +- dialog->setFace(user.iconfile); +- dialog->setUsername(user.username,user.realname); +- connect(dialog, &DelUserIntelDialog::removefile_send, this, [=](bool removeFile, QString userName){ +- qDebug()<<userName; +- deleteUser(removeFile, userName); +- }); +- qDebug()<<"delete"; +- dialog->exec(); +-} +- +-void UserInfoIntel::deleteUser(bool removefile, QString username){ +- qDebug() << allUserInfoMap.keys() << username; +- +- UserInfomation user = (UserInfomation)(allUserInfoMap.find(username).value()); +- +- //sysdispatcher->delete_user(user.uid, removefile); +- QDBusInterface * m_interface = new QDBusInterface("cn.kylinos.SSOBackend", +- "/cn/kylinos/SSOBackend", +- "cn.kylinos.SSOBackend.accounts", +- QDBusConnection::systemBus()); +- +- QDBusReply<int> reply = m_interface->call("DeleteAccount",user.username); +- if (reply == 0) { +- // hidden the item when click delete user button +- QListWidgetItem *item = otherUserItemMap.find(user.objpath).value(); +- ui->listWidget->setItemHidden(item, true); +- } else { +- qDebug() << "***********error:" << reply.error(); +- return; +- } +- +- delete m_interface; +-} +- +-void UserInfoIntel::delete_user_slot(bool removefile, QString username){ +- UserInfomation user = (UserInfomation)(allUserInfoMap.find(username).value()); +- +- sysdispatcher->delete_user(user.uid, removefile); +-} +- +-void UserInfoIntel::deleteUserDone(QString objpath){ +- QListWidgetItem * item = otherUserItemMap.value(objpath); +- +- //删除Item +- ui->listWidget->takeItem(ui->listWidget->row(item)); +- +- //更新其他用户QMap +- otherUserItemMap.remove(objpath); +- +- //更新所有用户信息 +- _acquireAllUsersInfo(); +- +- //重置其他用户ListWidget高度 +- _resetListWidgetHeigh(); +- if (allUserInfoMap.count() == 1 && !isDelCurrentUser) { +- ui->line_3->show(); +- ui->delUserBtn->show(); +- ui->title2Label->hide(); +- } +-} +- +-void UserInfoIntel::showChangeGroupDialog(){ +- ChangeGroupIntelDialog * dialog = new ChangeGroupIntelDialog(); +- dialog->exec(); +-} +- +-void UserInfoIntel::showChangeValidDialog(QString username){ +- if (allUserInfoMap.keys().contains(username)){ +- UserInfomation user = allUserInfoMap.value(username); +- +- ChangeValidIntelDialog * dialog = new ChangeValidIntelDialog(user.username); +- dialog->setUserName(); +- dialog->setUserLogo(user.iconfile); +- dialog->setUserType(_accountTypeIntToString(user.accounttype)); +- dialog->exec(); +- +- } else { +- qDebug() << "User Data Error When Change User type"; +- } +-} +- +- +-void UserInfoIntel::showChangeTypeDialog(QString username){ +- if (allUserInfoMap.keys().contains(username)){ +- UserInfomation user = allUserInfoMap.value(username); +- +- ChangeTypeIntelDialog * dialog = new ChangeTypeIntelDialog; +- dialog->setFace(user.iconfile); +- dialog->setUsername(user.username); +- dialog->setCurrentAccountTypeLabel(_accountTypeIntToString(user.accounttype)); +- dialog->setCurrentAccountTypeBtn(user.accounttype); +- dialog->forbidenChange(adminnum); +-// connect(dialog, SIGNAL(type_send(int,QString,bool)), this, SLOT(change_accounttype_slot(int,QString,bool))); +- connect(dialog, &ChangeTypeIntelDialog::type_send, this, [=](int atype, QString userName){ +- changeUserType(atype, userName); +- }); +- dialog->exec(); +- +- } else { +- qDebug() << "User Data Error When Change User type"; +- } +-} +- +-void UserInfoIntel::changeUserType(int atype, QString username){ +- UserInfomation user = allUserInfoMap.value(username); +- +- //构建dbus调度对象 +- UserDispatcher * userdispatcher = new UserDispatcher(user.objpath); //继承QObject不再删除 +- +- //更改用户类型 +- userdispatcher->change_user_type(atype); +- +- //重新获取全部用户QMap +- _acquireAllUsersInfo(); +- +- //更新界面显示 +- _refreshUserInfoUI(); +-} +- +- +-void UserInfoIntel::showChangeFaceDialog(QString username){ +- UserInfomation user = (UserInfomation)(allUserInfoMap.find(username).value()); +- +- ChangeFaceIntelDialog * dialog = new ChangeFaceIntelDialog; +- dialog->setHistoryFacesPath(QString("/home/%1/.historyfaces").arg(user.username)); +- dialog->setFace(user.iconfile); +- dialog->setUsername(user.username); +- dialog->setRealname(user.realname); +- dialog->setAccountType(_accountTypeIntToString(user.accounttype)); +-// dialog->set_face_list_status(user.iconfile); +- connect(dialog, &ChangeFaceIntelDialog::face_file_send, [=](QString faceFile, QString userName){ +- changeUserFace(faceFile, userName); +- +- }); +- dialog->exec(); +- //ui->autoLoginFrame->hide(); +-} +- +-void UserInfoIntel::changeUserFace(QString facefile, QString username){ +- UserInfomation user = (UserInfomation)(allUserInfoMap.find(username).value()); +- +- UserDispatcher * userdispatcher = new UserDispatcher(user.objpath); +- userdispatcher->change_user_face(facefile); +-// userdispatcher->change_user_face(QString("/home/%1/.face").arg(user.username)); +- +- //拷贝设置的头像文件到~/.face +- sysinterface = new QDBusInterface("com.control.center.qt.systemdbus", +- "/", +- "com.control.center.interface", +- QDBusConnection::systemBus()); +- +- if (!sysinterface->isValid()) { +- qCritical() << "Create Client Interface Failed When Copy Face File: " << QDBusConnection::systemBus().lastError(); +- return; +- } +- +- QString cmd = QString("cp %1 /home/%2/.face").arg(facefile).arg(user.username); +- +- QDBusReply<QString> reply = sysinterface->call("systemRun", QVariant(cmd)); +- +- //重新获取全部用户QMap +- _acquireAllUsersInfo(); +- +- //更新界面显示 +- _refreshUserInfoUI(); +- +- Q_UNUSED(reply) +-} +- +-void UserInfoIntel::showChangePwdDialog(QString username){ +- if (allUserInfoMap.keys().contains(username)){ +- UserInfomation user = allUserInfoMap.value(username); +- +- ChangePinIntelDialog * dialog = new ChangePinIntelDialog(user.username); +- connect(dialog, &ChangePinIntelDialog::changepwd, [=](){ +- ui->changePwdBtn->setText(tr("Change pwd")); +- }); +-// dialog->setFace(user.iconfile); +-// dialog->setUsername(user.username); +-// dialog->setAccountType(_accountTypeIntToString(user.accounttype)); +-// connect(dialog, &ChangePwdIntelDialog::passwd_send, this, [=](QString pwd, QString userName){ +-// changeUserPwd(pwd, userName); +-// }); +- //修改PIN码弹窗(已实现PIN码验证,等待设置PIN码接口) +- //ChangePinIntelDialog * dialog = new ChangePinIntelDialog; +- //ChangePwdIntelDialog * dialog = new ChangePwdIntelDialog(); +- dialog->exec(); +- +- } else { +- qDebug() << "User Info Data Error When Change User type"; +- } +-} +-void UserInfoIntel::showChangePhoDialog(QString username){ +- if (allUserInfoMap.keys().contains(username)){ +- UserInfomation user = allUserInfoMap.value(username); +- +- ChangePhoneIntelDialog * dialog = new ChangePhoneIntelDialog(user.username); +-// dialog->setFace(user.iconfile); +-// dialog->setUsername(user.username); +-// dialog->setAccountType(_accountTypeIntToString(user.accounttype)); +-// connect(dialog, &ChangePwdIntelDialog::passwd_send, this, [=](QString pwd, QString userName){ +-// changeUserPwd(pwd, userName); +-// }); +- //修改PIN码弹窗(已实现PIN码验证,等待设置PIN码接口) +-// ChangePinIntelDialog * dialog = new ChangePinIntelDialog; +- dialog->exec(); +- +- } else { +- qDebug() << "User Info Data Error When Change User type"; +- } +-} +- +- +-void UserInfoIntel::changeUserPwd(QString pwd, QString username){ +- //上层已做判断,这里不去判断而直接获取 +- UserInfomation user = allUserInfoMap.value(username); +- +- UserDispatcher * userdispatcher = new UserDispatcher(user.objpath); //继承QObject不再删除 +- QString result = userdispatcher->change_user_pwd(pwd, ""); +- +- Q_UNUSED(result) +-} +- +- +-bool UserInfoIntel::eventFilter(QObject *watched, QEvent *event){ +- if (watched == ui->currentUserFaceLabel){ +- if (event->type() == QEvent::MouseButtonPress){ +- QMouseEvent * mouseEvent = static_cast<QMouseEvent *>(event); +- if (mouseEvent->button() == Qt::LeftButton ){ +- if(watched == ui->currentUserFaceLabel){ +- showChangeFaceDialog(my_name); +- } +- return true; +- } else { +- return false; +- } +- } +- } +- if (watched == ui->userNameLabel) +- { +- if (event->type() == QEvent::KeyPress) +- { +- QKeyEvent* keyevt = static_cast<QKeyEvent*>(event); +- if ((keyevt->key() == Qt::Key_Return) || +- (keyevt->key() == Qt::Key_Escape) || +- (keyevt->key() == Qt::Key_Enter)) // Qt::Key_Return是大键盘的回车键 Qt::Key_Enter是小键盘的回车键 +- { +- QString str_name =ui->userNameLabel->text().remove(QRegExp("\\s")); +- qlonglong uid = getuid(); +- QDBusInterface user("org.freedesktop.Accounts", +- "/org/freedesktop/Accounts", +- "org.freedesktop.Accounts", +- QDBusConnection::systemBus()); +- QDBusMessage result = user.call("FindUserById", uid); +- QString userpath = result.arguments().value(0).value<QDBusObjectPath>().path(); +- +- QDBusInterface userreal("org.freedesktop.Accounts", +- userpath, +- "org.freedesktop.Accounts.User", +- QDBusConnection::systemBus()); +- +- ui->userNameLabel->setCursorPosition(0); +- if (str_name != NULL) { +- userreal.call("SetRealName",m_userName); +- allUserInfoMap.find(my_name).value().realname = m_userName; +- QFontMetrics fontMetrics(ui->userNameLabel->font()); +- int fontSize = fontMetrics.width(ui->userNameLabel->text()); +- if (fontSize > 180) { +- QString str = fontMetrics.elidedText(ui->userNameLabel->text(), Qt::ElideRight, 180); +- ui->userNameLabel->setToolTip(m_userName); +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(str); +- ui->userNameLabel->blockSignals(false); +- } else { +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(ui->userNameLabel->text()); +- ui->userNameLabel->blockSignals(false); +- ui->userNameLabel->setToolTip(""); +- } +- ui->editBtn->show(); +- ui->userNameLabel->setReadOnly(true); +- ui->userNameLabel->deselect(); +- } else { +- qDebug()<<"回车"; +- enter = true; +- MessageBoxPowerIntel *messageBoxpower = new MessageBoxPowerIntel(); +- messageBoxpower->exec(); +- QFontMetrics fontMetrics(ui->userNameLabel->font()); +- int fontSize = fontMetrics.width(userreal.property("RealName").toString()); +- if (fontSize > 180) { +- QString str = fontMetrics.elidedText(userreal.property("RealName").toString(), Qt::ElideRight, 180); +- ui->userNameLabel->setToolTip(userreal.property("RealName").toString()); +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(str); +- ui->userNameLabel->blockSignals(false); +- } else { +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(userreal.property("RealName").toString()); +- ui->userNameLabel->blockSignals(false); +- ui->userNameLabel->setToolTip(""); +- } +- ui->editBtn->show(); +- ui->userNameLabel->setReadOnly(true); +- ui->userNameLabel->deselect(); +- } +- } +- } +- else if (event->type() == QEvent::FocusOut) +- { +- +- QString str_name =ui->userNameLabel->text().remove(QRegExp("\\s")); +- qlonglong uid = getuid(); +- QDBusInterface user("org.freedesktop.Accounts", +- "/org/freedesktop/Accounts", +- "org.freedesktop.Accounts", +- QDBusConnection::systemBus()); +- QDBusMessage result = user.call("FindUserById", uid); +- QString userpath = result.arguments().value(0).value<QDBusObjectPath>().path(); +- +- QDBusInterface userreal("org.freedesktop.Accounts", +- userpath, +- "org.freedesktop.Accounts.User", +- QDBusConnection::systemBus()); +- if (str_name != NULL) { +- ui->userNameLabel->setCursorPosition(0); +- userreal.call("SetRealName",m_userName); +- allUserInfoMap.find(my_name).value().realname = m_userName; +- QFontMetrics fontMetrics(ui->userNameLabel->font()); +- int fontSize = fontMetrics.width(ui->userNameLabel->text()); +- if (fontSize > 180) { +- QString str = fontMetrics.elidedText(ui->userNameLabel->text(), Qt::ElideRight, 180); +- ui->userNameLabel->setToolTip(m_userName); +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(str); +- ui->userNameLabel->blockSignals(false); +- } else { +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(ui->userNameLabel->text()); +- ui->userNameLabel->blockSignals(false); +- ui->userNameLabel->setToolTip(""); +- } +- ui->editBtn->show(); +- ui->userNameLabel->setReadOnly(true); +- ui->userNameLabel->deselect(); +- } else { +- qDebug()<<"失去焦点"; +- ui->userNameLabel->setCursorPosition(0); +- if (enter) { +- enter = false; +- } else { +- MessageBoxPowerIntel *messageBoxpower = new MessageBoxPowerIntel; +- messageBoxpower->exec(); +- QFontMetrics fontMetrics(ui->userNameLabel->font()); +- int fontSize = fontMetrics.width(userreal.property("RealName").toString()); +- if (fontSize > 180) { +- QString str = fontMetrics.elidedText(userreal.property("RealName").toString(), Qt::ElideRight, 180); +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(str); +- ui->userNameLabel->blockSignals(false); +- ui->userNameLabel->setToolTip(userreal.property("RealName").toString()); +- } else { +- ui->userNameLabel->blockSignals(true); +- ui->userNameLabel->setText(userreal.property("RealName").toString()); +- ui->userNameLabel->blockSignals(false); +- ui->userNameLabel->setToolTip(""); +- } +- ui->editBtn->show(); +- ui->userNameLabel->setReadOnly(true); +- ui->userNameLabel->deselect(); +- } +- } +- +- } +- } +- return QObject::eventFilter(watched, event); +-} +- +-bool UserInfoIntel::getAutomaticLogin(QString username) { +- +- QString filename = "/etc/lightdm/lightdm.conf"; +- autoSettings = new QSettings(filename, QSettings::IniFormat); +- autoSettings->beginGroup("SeatDefaults"); +- +- QString autoUser = autoSettings->value("autologin-user", "").toString(); +- +- autoSettings->endGroup(); +- +- return autoUser == username ? true : false; +-} +diff --git a/plugins/account/userinfo_intel/userinfo_intel.h b/plugins/account/userinfo_intel/userinfo_intel.h +deleted file mode 100644 +index 497398d..0000000 +--- a/plugins/account/userinfo_intel/userinfo_intel.h ++++ /dev/null +@@ -1,276 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef USERINFO_INTEL_H +-#define USERINFO_INTEL_H +- +-#include <QObject> +-#include <QtPlugin> +- +-//#include <QToolButton> +-//#include <QMenu> +-//#include <QAction> +-#include <QSignalMapper> +-#include <QMouseEvent> +-#include <QSettings> +-#include <QProcess> +-#include <QPainterPath> +- +-#include "shell/interface.h" +- +-#include "qtdbus/systemdbusdispatcher.h" +-#include "qtdbus/userdispatcher.h" +- +-#include "changegroupinteldialog.h" +-#include "changepwdinteldialog.h" +-#include "changephoneinteldialog.h" +- +-#include "changepininteldialog.h" +- +-#include "changefaceinteldialog.h" +-#include "changetypeinteldialog.h" +-#include "changevalidinteldialog.h" +-#include "deluserinteldialog.h" +-#include "createuserinteldialog.h" +-#include "hoverwidget.h" +-#include "picturetowhite.h" +-#include "messageboxpowerintel.h" +- +-#include "ukcccommon.h" +-using namespace ukcc; +- +-#ifdef ENABLEPQ +-extern "C" { +-#include <pwquality.h> +-} +-#endif +- +-enum { +- STANDARDUSER, +- ADMINISTRATOR, +- ROOT +-}; +- +-typedef struct _UserInfomation { +- QString objpath; +- QString username; +- QString realname; +- QString iconfile; +- QString passwd; +- int accounttype; +- int passwdtype; +- bool current; +- bool logined; +- bool autologin; +- bool noPwdLogin; +- qint64 uid; +-}UserInfomation; +- +-typedef struct _PwdQualityOption { +- +- int diff_ok; +- int min_length; +- int dig_credit; +- int up_credit; +- int low_credit; +- int oth_credit; +- int min_class; +- int max_repeat; +- int max_class_repeat; +- int max_sequence; +- int gecos_check; +- int dict_check; +- int user_check; +- int enforcing; +- int retry_times; +- int enforce_for_root; +- int local_users_only; +- int palindrome; +- int no_similar_check; +- char *bad_words; +- char *dict_path; +- +-}PwdQualityOption; +- +-namespace Ui { +-class UserInfoIntel; +-} +- +-class QDBusInterface; +-class SwitchButton; +- +-class UserInfoIntel : public QObject, CommonInterface +-{ +- Q_OBJECT +- Q_PLUGIN_METADATA(IID "org.ukcc.CommonInterface") +- Q_INTERFACES(CommonInterface) +- +-public: +- UserInfoIntel(); +- ~UserInfoIntel(); +- +- QString plugini18nName() Q_DECL_OVERRIDE; +- int pluginTypes() Q_DECL_OVERRIDE; +- QWidget *pluginUi() Q_DECL_OVERRIDE; +- const QString name() const Q_DECL_OVERRIDE; +- bool isShowOnHomePage() const Q_DECL_OVERRIDE; +- QIcon icon() const Q_DECL_OVERRIDE; +- bool isEnable() const Q_DECL_OVERRIDE; +- +-public: +- void initSearchText(); +- void initComponent(); +- void initAllUserStatus(); +- +- void _acquireAllUsersInfo(); +- UserInfomation _acquireUserInfo(QString objpath); +- QString _accountTypeIntToString(int type); +- void _buildWidgetForItem(UserInfomation user); +- void _resetListWidgetHeigh(); +- +- void _refreshUserInfoUI(); +- +- void showCreateUserDialog(); +- void createUser(QString username, QString pwd, QString pin, int atype); +- void createUserDone(QString objpath); +- +- void showDeleteUserDialog(QString username); +- void deleteUser(bool removefile, QString username); +- void deleteUserDone(QString objpath); +- +- void showChangePwdDialog(QString username); +- void showChangePhoDialog(QString username); +- void changeUserPwd(QString pwd, QString username); +- +- void showChangeTypeDialog(QString username); +- void changeUserType(int atype, QString username); +- +- void showChangeFaceDialog(QString username); +- void changeUserFace(QString facefile, QString username); +- +- void showChangeValidDialog(QString username); +- +- void showChangeGroupDialog(); +- +- void get_all_users(); +- UserInfomation init_user_info(QString objpath); +- void setup_otherusers_ui(); +- void build_item_with_widget(UserInfomation user); +- void ui_component_init(); +- +- QString accounttype_enum_to_string(int id); +- QString login_status_bool_to_string(bool status); +- +- +- void readCurrentPwdConf(); +- QStringList getUsersList(); +- +- QPixmap PixmapToRound(const QString &src, int radius); +- +- void setChangeFaceShadow(); +- +-protected: +- bool eventFilter(QObject *watched, QEvent *event); +- +-private: +- Ui::UserInfoIntel *ui; +- bool mFirstLoad; +- QString pluginName; +- QString oldName; +- int pluginType; +- QWidget * pluginWidget; +- HoverWidget *addWgt; +- +- UserInfomation current_user; +- bool isDelCurrentUser = false; +- +-private: +- SwitchButton * nopwdSwitchBtn; +- SwitchButton * autoLoginSwitchBtn; +- +- SystemDbusDispatcher * sysdispatcher; +- QSettings * autoSettings = nullptr; +- QGSettings *m_pgsettings; +- bool enter = false; +- +- PictureToWhite *m_pPictureToWhite; +- QString m_userName = ""; +- +-private: +- bool getAutomaticLogin(QString username); +- +-private: +- QMap<QString, UserInfomation> allUserInfoMap; +- QMap<QString, QListWidgetItem *> otherUserItemMap; +- +- int adminnum; +- +- QString _newUserPwd; +- +-// QMap<QString, QToolButton *> otherbtnMap; +- QMap<QString, QListWidgetItem *> otherItemMap; +- +- QSignalMapper * pwdSignalMapper; +- QSignalMapper * faceSignalMapper; +- QSignalMapper * typeSignalMapper; +- QSignalMapper * delSignalMapper; +- +- QSize faceSize; +- QSize itemSize; +- QSize btnSize; +- +- +- QString pwdcreate; +- QString my_name; +- +- QDBusInterface * sysinterface; +- +- bool enablePwdQuality; +- +-#ifdef ENABLEPQ +- pwquality_settings_t * pwdconf; +-#endif +- +- PwdQualityOption pwdOption; +- +- QString pwdMsg; +- +-private slots: +-// void show_change_pwd_dialog_slot(QString username); +-// void change_pwd_slot(QString pwd, QString username); +-// void change_pwd_done_slot(); +- +-// void show_change_face_dialog_slot(QString username); +-// void change_face_slot(QString facefile, QString username); +-// void change_face_done_slot(); +- +-// void show_change_accounttype_dialog_slot(QString username); +-// void change_accounttype_slot(int atype, QString username, bool status); +-// void change_accounttype_done_slot(); +- +-// void show_del_user_dialog_slot(QString username); +- void delete_user_slot(bool removefile, QString username); +-// void delete_user_done_slot(QString objpath); +- +-// void show_create_user_dialog_slot(); +-// void create_user_slot(QString username, QString pwd, QString pin, int atype, bool autologin); +-// void create_user_done_slot(QString objpath); +-}; +- +-#endif // USERINFO_INTEL_H +diff --git a/plugins/account/userinfo_intel/userinfo_intel.pro b/plugins/account/userinfo_intel/userinfo_intel.pro +deleted file mode 100644 +index 19e8556..0000000 +--- a/plugins/account/userinfo_intel/userinfo_intel.pro ++++ /dev/null +@@ -1,110 +0,0 @@ +-#------------------------------------------------- +-# +-# Project created by QtCreator 2019-06-29T14:35:43 +-# +-#------------------------------------------------- +-include(../../../env.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/FlowLayout/flowlayout.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/ImageUtil/imageutil.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/HoverWidget/hoverwidget.pri) +-include($$PROJECT_ROOTDIR/libukcc/widgets/SwitchButton/switchbutton.pri) +-include($$PROJECT_ROOTDIR/libukcc/interface.pri) +- +-QT += widgets dbus gui network +- +-TEMPLATE = lib +-CONFIG += plugin +- +-TARGET = $$qtLibraryTarget(userinfo_intel) +-DESTDIR = ../.. +-target.path = $${PLUGIN_INSTALL_DIRS} +- +-INCLUDEPATH += \ +- $$PROJECT_ROOTDIR \ +- +-LIBS += -L$$[QT_INSTALL_LIBS] -lcrypt -lpam +- +-##加载gio库和gio-unix库 +-CONFIG += link_pkgconfig \ +- C++11 +-PKGCONFIG += gio-2.0 \ +- gio-unix-2.0 +- +- +-#DEFINES += QT_DEPRECATED_WARNINGS +- +-SOURCES += \ +- changefaceinteldialog.cpp \ +- changegroupinteldialog.cpp \ +- changephoneinteldialog.cpp \ +- changepininteldialog.cpp \ +- changepwdinteldialog.cpp \ +- changetypeinteldialog.cpp \ +- changevalidinteldialog.cpp \ +- creategroupinteldialog.cpp \ +- createuserinteldialog.cpp \ +- definegroupitemintel.cpp \ +- delgroupinteldialog.cpp \ +- deluserinteldialog.cpp \ +- digitalauthinteldialog.cpp \ +- digitalphoneinteldialog.cpp \ +- elipsemaskwidget.cpp \ +- messageboxpowerintel.cpp \ +- numbersbuttonintel.cpp \ +- phoneauthinteldialog.cpp \ +- picturetowhite.cpp \ +- userinfo_intel.cpp \ +- qtdbus/systemdbusdispatcher.cpp \ +- qtdbus/userdispatcher.cpp \ +- passwdcheckutil.cpp \ +- auth-pam.cpp \ +- passwordbar.cpp +-# changepasswd.cpp \ +- +-HEADERS += \ +- changefaceinteldialog.h \ +- changegroupinteldialog.h \ +- changephoneinteldialog.h \ +- changepininteldialog.h \ +- changepwdinteldialog.h \ +- changetypeinteldialog.h \ +- changevalidinteldialog.h \ +- creategroupinteldialog.h \ +- createuserinteldialog.h \ +- definegroupitemintel.h \ +- delgroupinteldialog.h \ +- deluserinteldialog.h \ +- digitalauthinteldialog.h \ +- digitalphoneinteldialog.h \ +- elipsemaskwidget.h \ +- messageboxpowerintel.h \ +- numbersbuttonintel.h \ +- phoneauthinteldialog.h \ +- picturetowhite.h \ +- userinfo_intel.h \ +- qtdbus/systemdbusdispatcher.h \ +- qtdbus/userdispatcher.h \ +- passwdcheckutil.h \ +- auth.h \ +- auth-pam.h \ +- passwordbar.h +-# changepasswd.h \ +- +-FORMS += \ +- changefaceinteldialog.ui \ +- changegroupinteldialog.ui \ +- changephoneinteldialog.ui \ +- changepininteldialog.ui \ +- changepwdinteldialog.ui \ +- changetypeinteldialog.ui \ +- changevalidinteldialog.ui \ +- creategroupinteldialog.ui \ +- createuserinteldialog.ui \ +- delgroupinteldialog.ui \ +- deluserinteldialog.ui \ +- userinfo_intel.ui +- +-INSTALLS += target +- +-RESOURCES += \ +- changepwd.qrc +diff --git a/plugins/account/userinfo_intel/userinfo_intel.ui b/plugins/account/userinfo_intel/userinfo_intel.ui +deleted file mode 100644 +index 67e84d9..0000000 +--- a/plugins/account/userinfo_intel/userinfo_intel.ui ++++ /dev/null +@@ -1,728 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>UserInfoIntel</class> +- <widget class="QWidget" name="UserInfoIntel"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>881</width> +- <height>1080</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">UserInfo</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_10"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <item> +- <widget class="QWidget" name="widget" native="true"> +- <layout class="QVBoxLayout" name="verticalLayout_11"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_16"> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>2</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_14"> +- <item> +- <widget class="QLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>100</width> +- <height>20</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>80</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string>Current User</string> +- </property> +- <property name="scaledContents"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="horizontalSpacer_15"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QFrame" name="currentUserFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>210</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>210</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::Box</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <item> +- <widget class="QLabel" name="currentUserFaceLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>112</width> +- <height>112</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>112</width> +- <height>112</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Preferred</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>16</width> +- <height>10</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>4</number> +- </property> +- <item> +- <spacer name="verticalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_9"> +- <item> +- <widget class="QLineEdit" name="userNameLabel"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>50</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frame"> +- <bool>false</bool> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="editBtn"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="maximumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>0</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QLabel" name="userTypeLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_8"> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QPushButton" name="changePhoneBtn"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Change phone</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="Line" name="line_5"> +- <property name="minimumSize"> +- <size> +- <width>1</width> +- <height>16</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>1</width> +- <height>16</height> +- </size> +- </property> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_5"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <widget class="QPushButton" name="changePwdBtn"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Change pwd</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <widget class="Line" name="line_3"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>1</width> +- <height>16</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>1</width> +- <height>16</height> +- </size> +- </property> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_7"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <widget class="QPushButton" name="changeGroupBtn"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>User group</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <widget class="QPushButton" name="delUserBtn"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Del user</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- <item> +- <widget class="Line" name="line_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>1</height> +- </size> +- </property> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_9"> +- <item> +- <widget class="Line" name="line"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>1</height> +- </size> +- </property> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- <zorder></zorder> +- <zorder>line_2</zorder> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>46</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_19"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_18"> +- <item> +- <widget class="QLabel" name="label_4"> +- <property name="text"> +- <string>system reboot</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_6"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="Line" name="line_4"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>1</height> +- </size> +- </property> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="frame_2"> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_13"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_11"> +- <item> +- <widget class="QLabel" name="label_2"> +- <property name="text"> +- <string>Unclosed apps start after a restart</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_4"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QComboBox" name="comboBox"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_9"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>46</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_17"> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <property name="bottomMargin"> +- <number>2</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_15"> +- <item> +- <widget class="QLabel" name="title2Label"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Other Users</string> +- </property> +- <property name="scaledContents"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="horizontalSpacer_16"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Expanding</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_10"> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_4"> +- <item> +- <widget class="QListWidget" name="listWidget"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>64</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="resizeMode"> +- <enum>QListView::Adjust</enum> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_7"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>7</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- <layoutdefault spacing="6" margin="11"/> +- <resources/> +- <connections/> +-</ui> +diff --git a/plugins/devices/keyboard/kbdlayoutmanager.cpp b/plugins/devices/keyboard/kbdlayoutmanager.cpp +deleted file mode 100644 +index 1a81c8e..0000000 +--- a/plugins/devices/keyboard/kbdlayoutmanager.cpp ++++ /dev/null +@@ -1,367 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "kbdlayoutmanager.h" +-#include "ui_layoutmanager.h" +-#include "closebutton.h" +- +-#include <QPainter> +-#include <QPainterPath> +- +-#include <QDebug> +- +-extern "C" { +-#include <libxklavier/xklavier.h> +-#include <libmatekbd/matekbd-keyboard-config.h> +-} +- +-#define MAXNUM 4 +-#define KBD_LAYOUTS_SCHEMA "org.mate.peripherals-keyboard-xkb.kbd" +-#define KBD_LAYOUTS_KEY "layouts" +- +-XklEngine * engine; +-XklConfigRegistry * config_registry; +- +-static void kbd_set_countries(XklConfigRegistry *config_registry, XklConfigItem *config_item, QList<Layout> *list); +- +-static void kbd_set_languages(XklConfigRegistry *config_registry, XklConfigItem *config_item, QList<Layout> *list); +- +-static void kbd_set_available_countries(XklConfigRegistry *config_registry, XklConfigItem * parent_config_item, XklConfigItem *config_item, QList<Layout> *list); +- +-static void kbd_set_available_languages(XklConfigRegistry *config_registry, XklConfigItem * parent_config_item, XklConfigItem *config_item, QList<Layout> *list); +- +-QList<Layout> languages; +-QList<Layout> countries; +-QStringList availablelayoutsList; +- +-extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); +- +-KbdLayoutManager::KbdLayoutManager(QWidget *parent) : +- QDialog(parent), +- ui(new Ui::LayoutManager) +-{ +- ui->setupUi(this); +- this->setWindowTitle(tr("Add Layout")); +- setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); +- setAttribute(Qt::WA_TranslucentBackground); +- setAttribute(Qt::WA_DeleteOnClose); +- +- ui->titleLabel->setStyleSheet("QLabel{color: palette(windowText);}"); +- +- ui->closeBtn->setIcon(QIcon("://img/titlebar/close.svg")); +- +- ui->variantFrame->setFrameShape(QFrame::Shape::Box); +- +- configRegistry(); +- +- const QByteArray id(KBD_LAYOUTS_SCHEMA); +- if (QGSettings::isSchemaInstalled(id)){ +- kbdsettings = new QGSettings(id); +- setupComponent(); +- setupConnect(); +- } +-} +- +-KbdLayoutManager::~KbdLayoutManager() +-{ +- delete ui; +- ui = nullptr; +- if (QGSettings::isSchemaInstalled(KBD_LAYOUTS_SCHEMA)){ +- delete kbdsettings; +- kbdsettings = nullptr; +- } +-} +- +-void KbdLayoutManager::configRegistry(){ +- engine = xkl_engine_get_instance (QX11Info::display()); +- config_registry = xkl_config_registry_get_instance (engine); +- +- xkl_config_registry_load (config_registry, false); +- +- xkl_config_registry_foreach_country(config_registry,(ConfigItemProcessFunc)kbd_set_countries, NULL); +- +- xkl_config_registry_foreach_language(config_registry,(ConfigItemProcessFunc)kbd_set_languages, NULL); +- +-} +- +-void KbdLayoutManager::setupComponent(){ +- +- ui->countryRadioButton->setChecked(true); +- +- //设置listwidget无点击 +- ui->listWidget->setFocusPolicy(Qt::NoFocus); +- ui->listWidget->setSelectionMode(QAbstractItemView::NoSelection); +- +- rebuildSelectListWidget(); +- rebuildVariantCombo(); +- +- rebuild_listwidget(); +- +-} +- +-void KbdLayoutManager::setupConnect(){ +- connect(ui->closeBtn, &CloseButton::clicked, [=]{ +- close(); +- }); +- connect(ui->cancelBtn, &QPushButton::clicked, [=]{ +- close(); +- }); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- connect(ui->buttonGroup, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [=]{ +-#else +- connect(ui->buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), [=]{ +-#endif +- rebuildSelectListWidget(); +- +- rebuildVariantCombo(); +- }); +- +- connect(ui->selectListWidget, &QListWidget::currentItemChanged, [=]{ +- rebuildVariantCombo(); +- }); +- +-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) +- connect(ui->variantComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index){ +-#else +- connect(ui->variantComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index) { +-#endif +- Q_UNUSED(index) +- if (index != -1) +- installedNoSame(); +- }); +- +- connect(ui->installBtn, &QPushButton::clicked, this, [=]{ +- QString layout = ui->variantComboBox->currentData().toString(); +- +- QStringList layouts = kbdsettings->get(KBD_LAYOUTS_KEY).toStringList(); +- layouts.append(layout); +- +- kbdsettings->set(KBD_LAYOUTS_KEY, layouts); +- rebuild_listwidget(); +- }); +- +- connect(ui->PreBtn, &QPushButton::clicked, this, &KbdLayoutManager::preview); +-} +- +-void KbdLayoutManager::installedNoSame(){ +- +- //最多4个布局,来自GTK控制面板,原因未知 +- QStringList layouts = kbdsettings->get(KBD_LAYOUTS_KEY).toStringList(); +- if (layouts.length() < MAXNUM && !layouts.contains(ui->variantComboBox->currentData(Qt::UserRole).toString())) +- ui->installBtn->setEnabled(true); +- else +- ui->installBtn->setEnabled(false); +-} +- +-void KbdLayoutManager::rebuildSelectListWidget(){ +- +- ui->selectListWidget->blockSignals(true); +- ui->selectListWidget->clear(); +- if (ui->countryRadioButton->isChecked()){ +- for (Layout keylayout : countries){ +- if (keylayout.name == "TW") +- continue; +- QListWidgetItem * item = new QListWidgetItem(ui->selectListWidget); +- item->setText(keylayout.desc); +- item->setData(Qt::UserRole, keylayout.name); +- ui->selectListWidget->addItem(item); +- } +- } else if (ui->languageRadioButton->isChecked()){ +- for (Layout keylayout : languages){ +- QListWidgetItem * item = new QListWidgetItem(ui->selectListWidget); +- item->setText(keylayout.desc); +- item->setData(Qt::UserRole, keylayout.name); +- ui->selectListWidget->addItem(item); +- } +- } +- +- +- ui->selectListWidget->setCurrentRow(0); +- ui->selectListWidget->blockSignals(false); +-} +- +-void KbdLayoutManager::rebuildVariantCombo(){ +- QString id = ui->selectListWidget->currentItem()->data(Qt::UserRole).toString(); +- +- availablelayoutsList.clear(); +- char * iid = id.toLatin1().data(); +- if (ui->countryRadioButton->isChecked()) +- kbd_trigger_available_countries(iid); +- else if (ui->languageRadioButton->isChecked()) +- kbd_trigger_available_languages(iid); +- +- ui->variantComboBox->clear(); +- for (QString name : availablelayoutsList){ +- QString desc = kbd_get_description_by_id(const_cast<const char *>(name.toLatin1().data())); +- ui->variantComboBox->blockSignals(true); +- ui->variantComboBox->addItem(desc, name); +- ui->variantComboBox->blockSignals(false); +- } +- +- installedNoSame(); +-} +- +-void KbdLayoutManager::rebuild_listwidget(){ +- installedNoSame(); +- +- ui->listWidget->clear(); +- +- QStringList layouts = kbdsettings->get(KBD_LAYOUTS_KEY).toStringList(); +- for (QString layout : layouts){ +- QString desc = kbd_get_description_by_id(const_cast<const char *>(layout.toLatin1().data())); +- +- //自定义widget +- QWidget * layoutWidget = new QWidget(); +- layoutWidget->setAttribute(Qt::WA_DeleteOnClose); +- QHBoxLayout * mainHLayout = new QHBoxLayout(layoutWidget); +- QLabel * layoutLabel = new QLabel(layoutWidget); +- QPushButton * layoutdelBtn = new QPushButton(layoutWidget); +- layoutdelBtn->setText(tr("Del")); +- +- connect(layoutdelBtn, &QPushButton::clicked, this, [=]{ +- QStringList layouts = kbdsettings->get(KBD_LAYOUTS_KEY).toStringList(); +- layouts.removeOne(layout); +- kbdsettings->set(KBD_LAYOUTS_KEY, layouts); +- rebuild_listwidget(); +- }); +- +- mainHLayout->addWidget(layoutLabel); +- mainHLayout->addStretch(); +- mainHLayout->addWidget(layoutdelBtn); +- layoutWidget->setLayout(mainHLayout); +- +- QListWidgetItem * item = new QListWidgetItem(ui->listWidget); +- item->setData(Qt::UserRole, layout); +- item->setSizeHint(QSize(ui->listWidget->width(), 50)); +- +- layoutLabel->setText(desc); +- QFontMetrics fontWidth(layoutLabel->font()); +- QString elideNote = fontWidth.elidedText(desc, Qt::ElideRight, 100); +- layoutLabel->setText(elideNote); +- layoutLabel->setToolTip(desc); +- ui->listWidget->addItem(item); +- ui->listWidget->setItemWidget(item, layoutWidget); +- } +- +- if (!ui->listWidget->count()) { +- ui->installedFrame->setVisible(false); +- } else { +- ui->installedFrame->setVisible(true); +- } +-} +- +-void KbdLayoutManager::preview() +-{ +- QString variantID; +- QString layoutID = ui->variantComboBox->currentData(Qt::UserRole).toString(); +- QStringList layList = layoutID.split('\t'); +- +- for (int i = 0; i < layList.length(); i++) { +- if (0 == i) { +- layoutID = layList.at(0); +- } +- if (1 == i) { +- variantID = layList.at(1); +- } +- } +-} +- +-void KbdLayoutManager::kbd_trigger_available_countries(char *countryid){ +- xkl_config_registry_foreach_country_variant (config_registry, countryid, (TwoConfigItemsProcessFunc)kbd_set_available_countries, NULL); +-} +- +-void KbdLayoutManager::kbd_trigger_available_languages(char *languageid){ +- xkl_config_registry_foreach_language_variant (config_registry, languageid, (TwoConfigItemsProcessFunc)kbd_set_available_languages, NULL); +-} +- +-QString KbdLayoutManager::kbd_get_description_by_id(const char *visible){ +- char *l, *sl, *v, *sv; +- if (matekbd_keyboard_config_get_descriptions(config_registry, visible, &sl, &l, &sv, &v)) +- visible = matekbd_keyboard_config_format_full_layout (l, v); +- return QString(const_cast<char *>(visible)); +-} +- +-static void kbd_set_countries(XklConfigRegistry *config_registry, XklConfigItem *config_item, QList<Layout> *list){ +- Q_UNUSED(config_registry); Q_UNUSED(list); +- Layout item; +- item.desc = config_item->description; +- item.name = config_item->name; +- +- countries.append(item); +-} +- +-static void kbd_set_languages(XklConfigRegistry *config_registry, XklConfigItem *config_item, QList<Layout> *list){ +- Q_UNUSED(config_registry); Q_UNUSED(list); +- Layout item; +- item.desc = config_item->description; +- item.name = config_item->name; +- languages.append(item); +-} +- +-static void kbd_set_available_countries(XklConfigRegistry *config_registry, XklConfigItem * parent_config_item, XklConfigItem *config_item, QList<Layout> *list){ +- Q_UNUSED(config_registry); Q_UNUSED(list); +- const gchar *xkb_id = config_item ? matekbd_keyboard_config_merge_items (parent_config_item->name, config_item->name) : parent_config_item->name; +- availablelayoutsList.append(QString(const_cast<char *>(xkb_id))); +-} +- +-static void kbd_set_available_languages(XklConfigRegistry *config_registry, XklConfigItem *parent_config_item, XklConfigItem *config_item, QList<Layout> *list){ +- Q_UNUSED(list); +- kbd_set_available_countries(config_registry, parent_config_item, config_item, NULL); +-} +- +- +-void KbdLayoutManager::paintEvent(QPaintEvent *event){ +- Q_UNUSED(event); +- QPainter p(this); +- p.setRenderHint(QPainter::Antialiasing); +- QPainterPath rectPath; +- rectPath.addRoundedRect(this->rect().adjusted(10, 10, -10, -10), 6, 6); +- +- // 画一个黑底 +- QPixmap pixmap(this->rect().size()); +- pixmap.fill(Qt::transparent); +- QPainter pixmapPainter(&pixmap); +- pixmapPainter.setRenderHint(QPainter::Antialiasing); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(Qt::black); +- pixmapPainter.setOpacity(0.65); +- pixmapPainter.drawPath(rectPath); +- pixmapPainter.end(); +- +- // 模糊这个黑底 +- QImage img = pixmap.toImage(); +- qt_blurImage(img, 10, false, false); +- // 挖掉中心 +- pixmap = QPixmap::fromImage(img); +- QPainter pixmapPainter2(&pixmap); +- pixmapPainter2.setRenderHint(QPainter::Antialiasing); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawPath(rectPath); +- +- // 绘制阴影 +- p.drawPixmap(this->rect(), pixmap, pixmap.rect()); +- // 绘制一个背景 +- p.save(); +- p.fillPath(rectPath,palette().color(QPalette::Base)); +- +- p.restore(); +-} +diff --git a/plugins/devices/keyboard/kbdlayoutmanager.h b/plugins/devices/keyboard/kbdlayoutmanager.h +deleted file mode 100644 +index dbcbb2f..0000000 +--- a/plugins/devices/keyboard/kbdlayoutmanager.h ++++ /dev/null +@@ -1,82 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef KBDLAYOUTMANAGER_H +-#define KBDLAYOUTMANAGER_H +- +-#include <QWidget> +-#include <QDialog> +-#include <QX11Info> +-#include <QGSettings> +- +-/* qt会将glib里的signals成员识别为宏,所以取消该宏 +- * 后面如果用到signals时,使用Q_SIGNALS代替即可 +- **/ +-#ifdef signals +-#undef signals +-#endif +- +- +-typedef struct _Layout Layout; +- +-struct _Layout{ +- QString desc; +- QString name; +-}; +- +-namespace Ui { +-class LayoutManager; +-} +- +-class KbdLayoutManager : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit KbdLayoutManager(QWidget *parent = 0); +- ~KbdLayoutManager(); +- +- QString kbd_get_description_by_id(const char *visible); +- +- void kbd_trigger_available_countries(char * countryid); +- void kbd_trigger_available_languages(char * languageid); +- +- void configRegistry(); +- void setupComponent(); +- void setupConnect(); +- void rebuildSelectListWidget(); +- void rebuildVariantCombo(); +- +- void rebuild_listwidget(); +- void preview(); +- +- void installedNoSame(); +- +-protected: +- void paintEvent(QPaintEvent * event); +- +-private: +- Ui::LayoutManager *ui; +- +- QStringList layoutsList; +- +- QGSettings * kbdsettings; +-}; +- +-#endif // KBDLAYOUTMANAGER_H +diff --git a/plugins/devices/keyboard/kbdlayoutmanager.ui b/plugins/devices/keyboard/kbdlayoutmanager.ui +deleted file mode 100644 +index 421cf3e..0000000 +--- a/plugins/devices/keyboard/kbdlayoutmanager.ui ++++ /dev/null +@@ -1,298 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>KbdLayoutManager</class> +- <widget class="QWidget" name="KbdLayoutManager"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>742</width> +- <height>432</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>742</width> +- <height>432</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>742</width> +- <height>432</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string notr="true">Form</string> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>30</number> +- </property> +- <property name="leftMargin"> +- <number>25</number> +- </property> +- <property name="topMargin"> +- <number>35</number> +- </property> +- <property name="rightMargin"> +- <number>25</number> +- </property> +- <property name="bottomMargin"> +- <number>10</number> +- </property> +- <item> +- <widget class="QListWidget" name="listWidget"> +- <property name="minimumSize"> +- <size> +- <width>330</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>330</width> +- <height>16777215</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout"> +- <property name="spacing"> +- <number>10</number> +- </property> +- <item> +- <widget class="QRadioButton" name="countryRadioButton"> +- <property name="text"> +- <string>C</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="countryWidget" native="true"> +- <layout class="QHBoxLayout" name="horizontalLayout_5"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QComboBox" name="countryComboBox"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>32</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QRadioButton" name="languageRadioButton"> +- <property name="text"> +- <string>L</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <widget class="QWidget" name="languageWidget" native="true"> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QComboBox" name="languageComboBox"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>32</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <property name="spacing"> +- <number>10</number> +- </property> +- <item> +- <widget class="QLabel" name="label"> +- <property name="text"> +- <string>Variant</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="variantComboBox"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>32</height> +- </size> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="addBtn"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string>Add</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>40</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- <resources/> +- <connections/> +- <buttongroups> +- <buttongroup name="buttonGroup"/> +- </buttongroups> +-</ui> +diff --git a/plugins/devices/keyboard/keyboardcontrol.cpp b/plugins/devices/keyboard/keyboardcontrol.cpp +deleted file mode 100644 +index ee3faf2..0000000 +--- a/plugins/devices/keyboard/keyboardcontrol.cpp ++++ /dev/null +@@ -1,70 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "keyboardcontrol.h" +- +-KeyboardControl::KeyboardControl() : mFirstLoad(true) +-{ +- pluginName = tr("Keyboard"); +- pluginType = DEVICES; +-} +- +-KeyboardControl::~KeyboardControl() +-{ +-} +- +-QString KeyboardControl::plugini18nName() +-{ +- return pluginName; +-} +- +-int KeyboardControl::pluginTypes() { +- return pluginType; +-} +- +-QWidget *KeyboardControl::pluginUi() +-{ +- if (mFirstLoad) { +- mFirstLoad = false; +- pluginWidget = new KeyboardMain; +- pluginWidget->setAttribute(Qt::WA_DeleteOnClose); +- } +- return pluginWidget; +-} +- +-const QString KeyboardControl::name() const +-{ +- return QStringLiteral("Keyboard"); +-} +- +-bool KeyboardControl::isShowOnHomePage() const +-{ +- return true; +-} +- +-QIcon KeyboardControl::icon() const +-{ +- return QIcon::fromTheme("input-keyboard-symbolic"); +-} +- +-bool KeyboardControl::isEnable() const +-{ +- return false; +-} +- +diff --git a/plugins/devices/keyboard/keyboardcontrol.h b/plugins/devices/keyboard/keyboardcontrol.h +deleted file mode 100644 +index 388aeb8..0000000 +--- a/plugins/devices/keyboard/keyboardcontrol.h ++++ /dev/null +@@ -1,55 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef KEYBOARDCONTROL_H +-#define KEYBOARDCONTROL_H +- +-#include <QObject> +- +-#include "shell/interface.h" +-#include "keyboardmain.h" +- +- +-class KeyboardControl : public QObject, CommonInterface +-{ +- Q_OBJECT +- Q_PLUGIN_METADATA(IID "org.ukcc.CommonInterface") +- Q_INTERFACES(CommonInterface) +- +-public: +- KeyboardControl(); +- ~KeyboardControl() Q_DECL_OVERRIDE; +- +- QString plugini18nName() Q_DECL_OVERRIDE; +- int pluginTypes() Q_DECL_OVERRIDE; +- QWidget *pluginUi() Q_DECL_OVERRIDE; +- const QString name() const Q_DECL_OVERRIDE; +- bool isShowOnHomePage() const Q_DECL_OVERRIDE; +- QIcon icon() const Q_DECL_OVERRIDE; +- bool isEnable() const Q_DECL_OVERRIDE; +- +-private: +- QString pluginName; +- int pluginType; +- KeyboardMain *pluginWidget; +- +- bool mFirstLoad; +-}; +- +-#endif // KEYBOARDCONTROL_H +diff --git a/plugins/devices/keyboard/keyboardlayout.cpp b/plugins/devices/keyboard/keyboardlayout.cpp +deleted file mode 100644 +index 0ecb3f2..0000000 +--- a/plugins/devices/keyboard/keyboardlayout.cpp ++++ /dev/null +@@ -1,111 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#include "keyboardlayout.h" +- +-#include <QDebug> +- +-extern "C" { +-#include <libxklavier/xklavier.h> +-#include <libmatekbd/matekbd-keyboard-config.h> +-} +- +-XklEngine * engine; +-XklConfigRegistry * config_registry; +- +-static void KeyboardXkb_get_countries(XklConfigRegistry *config_registry, XklConfigItem *config_item, QList<Layout> *list); +- +-static void KeyboardXkb_get_languages(XklConfigRegistry *config_registry, XklConfigItem *config_item, QList<Layout> *list); +- +-static void KeyboardXkb_get_available_countries(XklConfigRegistry *config_registry, XklConfigItem * parent_config_item, XklConfigItem *config_item, QList<Layout> *list); +- +-static void KeyboardXkb_get_available_languages(XklConfigRegistry *config_registry, XklConfigItem * parent_config_item, XklConfigItem *config_item, QList<Layout> *list); +- +- +-QList<Layout> languages; +-QList<Layout> countries; +- +-KeyboardLayout::KeyboardLayout() +-{ +- +- data_init(); +- +- char * id = QString("ee").toLatin1().data(); +- QString desc = kbd_get_description_by_id(id); +- +-} +- +-KeyboardLayout::~KeyboardLayout() +-{ +- +-} +- +-void KeyboardLayout::data_init(){ +- engine = xkl_engine_get_instance (QX11Info::display()); +- config_registry = xkl_config_registry_get_instance (engine); +- +- xkl_config_registry_load (config_registry, false); +- +- xkl_config_registry_foreach_country(config_registry,(ConfigItemProcessFunc)KeyboardXkb_get_countries, NULL); +- +- xkl_config_registry_foreach_language(config_registry,(ConfigItemProcessFunc)KeyboardXkb_get_languages, NULL); +- +-// char * country_id = QString("EE").toLatin1().data(); +-// xkl_config_registry_foreach_country_variant (config_registry, country_id, (TwoConfigItemsProcessFunc)KeyboardXkb_get_available_countries, NULL); +- +-// char * language_id = QString("est").toLatin1().data(); +-// xkl_config_registry_foreach_language_variant (config_registry, language_id, (TwoConfigItemsProcessFunc)KeyboardXkb_get_available_languages, NULL); +-} +- +-QString KeyboardLayout::kbd_get_description_by_id(const char *visible){ +- char *l, *sl, *v, *sv; +- if (matekbd_keyboard_config_get_descriptions(config_registry, visible, &sl, &l, &sv, &v)) +- visible = matekbd_keyboard_config_format_full_layout (l, v); +- return QString(const_cast<char *>(visible)); +-} +- +-static void KeyboardXkb_get_countries(XklConfigRegistry *config_registry, XklConfigItem *config_item, QList<Layout> *list){ +- Layout item; +- item.desc = config_item->description; +- item.name = config_item->name; +- +- qDebug()<<"countries" << "desc = "<<item.desc<<"name = "<<item.name ; +- +- +-// list->append(item); +- countries.append(item); +-} +- +-static void KeyboardXkb_get_languages(XklConfigRegistry *config_registry, XklConfigItem *config_item, QList<Layout> *list){ +- Layout item; +- item.desc = config_item->description; +- item.name = config_item->name; +- qDebug()<<"languages" << "desc = "<<item.desc<<"name = "<<item.name; +-// list->append(item); +- languages.append(item); +-} +- +-static void KeyboardXkb_get_available_countries(XklConfigRegistry *config_registry, XklConfigItem * parent_config_item, XklConfigItem *config_item, QList<Layout> *list){ +- const gchar *xkb_id = config_item ? matekbd_keyboard_config_merge_items (parent_config_item->name, config_item->name) : parent_config_item->name; +- g_warning("------------->%s", xkb_id); +-} +- +-static void KeyboardXkb_get_available_languages(XklConfigRegistry *config_registry, XklConfigItem *parent_config_item, XklConfigItem *config_item, QList<Layout> *list){ +- KeyboardXkb_get_available_countries(config_registry, parent_config_item, config_item, NULL); +-} +diff --git a/plugins/devices/keyboard/keyboardlayout.h b/plugins/devices/keyboard/keyboardlayout.h +deleted file mode 100644 +index 1f80cc0..0000000 +--- a/plugins/devices/keyboard/keyboardlayout.h ++++ /dev/null +@@ -1,55 +0,0 @@ +-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +- * +- * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., 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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +- * +- */ +-#ifndef KEYBOARDLAYOUT_H +-#define KEYBOARDLAYOUT_H +- +-#include <QWidget> +-#include <QX11Info> +- +-/* qt会将glib里的signals成员识别为宏,所以取消该宏 +- * 后面如果用到signals时,使用Q_SIGNALS代替即可 +- **/ +-#ifdef signals +-#undef signals +-#endif +- +- +-typedef struct _Layout Layout; +- +-struct _Layout{ +- QString desc; +- QString name; +-}; +- +-class KeyboardLayout : public QWidget +-{ +- Q_OBJECT +- +-public: +- explicit KeyboardLayout(); +- ~KeyboardLayout(); +- +- void data_init(); +- +- QString kbd_get_description_by_id(const char *visible); +- +-}; +- +-#endif // KEYBOARDLAYOUT_H +diff --git a/plugins/devices/keyboard/layoutmanager.ui b/plugins/devices/keyboard/layoutmanager.ui +deleted file mode 100644 +index f1a4b54..0000000 +--- a/plugins/devices/keyboard/layoutmanager.ui ++++ /dev/null +@@ -1,480 +0,0 @@ +-<?xml version="1.0" encoding="UTF-8"?> +-<ui version="4.0"> +- <class>LayoutManager</class> +- <widget class="QDialog" name="LayoutManager"> +- <property name="geometry"> +- <rect> +- <x>0</x> +- <y>0</y> +- <width>572</width> +- <height>594</height> +- </rect> +- </property> +- <property name="minimumSize"> +- <size> +- <width>572</width> +- <height>594</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>572</width> +- <height>594</height> +- </size> +- </property> +- <property name="windowTitle"> +- <string>Dialog</string> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>15</number> +- </property> +- <property name="rightMargin"> +- <number>15</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="frame"> +- <property name="frameShape"> +- <enum>QFrame::NoFrame</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_3"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QFrame" name="closeFrame"> +- <property name="minimumSize"> +- <size> +- <width>0</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>16777215</width> +- <height>36</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_2"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout"> +- <property name="spacing"> +- <number>0</number> +- </property> +- <property name="leftMargin"> +- <number>16</number> +- </property> +- <item> +- <widget class="TitleLabel" name="titleLabel"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Manager Keyboard Layout</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="CloseButton" name="closeBtn"> +- <property name="minimumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>32</width> +- <height>32</height> +- </size> +- </property> +- <property name="text"> +- <string/> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <layout class="QVBoxLayout" name="verticalLayout_4"> +- <property name="spacing"> +- <number>24</number> +- </property> +- <property name="leftMargin"> +- <number>32</number> +- </property> +- <property name="topMargin"> +- <number>16</number> +- </property> +- <property name="rightMargin"> +- <number>32</number> +- </property> +- <property name="bottomMargin"> +- <number>48</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_6"> +- <property name="spacing"> +- <number>24</number> +- </property> +- <item> +- <widget class="QFrame" name="selectedFrame"> +- <property name="minimumSize"> +- <size> +- <width>240</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>240</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_6"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_8"> +- <property name="spacing"> +- <number>32</number> +- </property> +- <item> +- <widget class="QRadioButton" name="languageRadioButton"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Language</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <widget class="QRadioButton" name="countryRadioButton"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Country</string> +- </property> +- <attribute name="buttonGroup"> +- <string notr="true">buttonGroup</string> +- </attribute> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_3"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- </layout> +- </item> +- <item> +- <widget class="QListWidget" name="selectListWidget"/> +- </item> +- <item> +- <widget class="QFrame" name="variantFrame"> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QHBoxLayout" name="horizontalLayout_3"> +- <item> +- <widget class="QLabel" name="label_2"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Variant</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QComboBox" name="variantComboBox"/> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- </item> +- <item> +- <widget class="QFrame" name="installedFrame"> +- <property name="minimumSize"> +- <size> +- <width>240</width> +- <height>0</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>240</width> +- <height>16777215</height> +- </size> +- </property> +- <property name="frameShape"> +- <enum>QFrame::StyledPanel</enum> +- </property> +- <property name="frameShadow"> +- <enum>QFrame::Raised</enum> +- </property> +- <layout class="QVBoxLayout" name="verticalLayout_7"> +- <property name="spacing"> +- <number>16</number> +- </property> +- <property name="leftMargin"> +- <number>0</number> +- </property> +- <property name="topMargin"> +- <number>0</number> +- </property> +- <property name="rightMargin"> +- <number>0</number> +- </property> +- <property name="bottomMargin"> +- <number>0</number> +- </property> +- <item> +- <widget class="QLabel" name="label"> +- <property name="sizePolicy"> +- <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> +- </property> +- <property name="text"> +- <string>Layout installed</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QListWidget" name="listWidget"/> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </item> +- <item> +- <spacer name="verticalSpacer"> +- <property name="orientation"> +- <enum>Qt::Vertical</enum> +- </property> +- <property name="sizeType"> +- <enum>QSizePolicy::Fixed</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>20</width> +- <height>24</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <layout class="QHBoxLayout" name="horizontalLayout_7"> +- <property name="spacing"> +- <number>8</number> +- </property> +- <item> +- <widget class="QPushButton" name="PreBtn"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Preview</string> +- </property> +- </widget> +- </item> +- <item> +- <spacer name="horizontalSpacer_2"> +- <property name="orientation"> +- <enum>Qt::Horizontal</enum> +- </property> +- <property name="sizeHint" stdset="0"> +- <size> +- <width>40</width> +- <height>20</height> +- </size> +- </property> +- </spacer> +- </item> +- <item> +- <widget class="QPushButton" name="cancelBtn"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Cancel</string> +- </property> +- </widget> +- </item> +- <item> +- <widget class="QPushButton" name="installBtn"> +- <property name="minimumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="maximumSize"> +- <size> +- <width>120</width> +- <height>36</height> +- </size> +- </property> +- <property name="text"> +- <string>Install</string> +- </property> +- </widget> +- </item> +- </layout> +- </item> +- </layout> +- </item> +- </layout> +- </widget> +- </item> +- </layout> +- </widget> +- <customwidgets> +- <customwidget> +- <class>TitleLabel</class> +- <extends>QLabel</extends> +- <header location="global">titlelabel.h</header> +- </customwidget> +- <customwidget> +- <class>CloseButton</class> +- <extends>QPushButton</extends> +- <header location="global">closebutton.h</header> +- </customwidget> +- </customwidgets> +- <resources/> +- <connections/> +- <buttongroups> +- <buttongroup name="buttonGroup"/> +- </buttongroups> +-</ui> +diff --git a/plugins/devices/keyboard/org.ukui.control-center.keybinding.gschema.xml b/plugins/devices/keyboard/org.ukui.control-center.keybinding.gschema.xml +deleted file mode 100644 +index df8859e..0000000 +--- a/plugins/devices/keyboard/org.ukui.control-center.keybinding.gschema.xml ++++ /dev/null +@@ -1,19 +0,0 @@ +-<schemalist gettext-domain="ukui-control-center"> +- <schema id="org.ukui.control-center.keybinding"> +- <key name="binding" type="s"> +- <default>''</default> +- <summary>Keybinding</summary> +- <description>Keybinding associated with a custom shortcut.</description> +- </key> +- <key name="action" type="s"> +- <default>''</default> +- <summary>Command</summary> +- <description>Command associated with a custom keybinding.</description> +- </key> +- <key name="name" type="s"> +- <default>''</default> +- <summary>Name</summary> +- <description>Description associated with a custom keybinding.</description> +- </key> +- </schema> +-</schemalist> +diff --git a/plugins/devices/keyboard/preview/config-keyboard.h b/plugins/devices/keyboard/preview/config-keyboard.h +deleted file mode 100644 +index 3c0331c..0000000 +--- a/plugins/devices/keyboard/preview/config-keyboard.h ++++ /dev/null +@@ -1,9 +0,0 @@ +-#ifndef CONFIG_KEYBOARD_H +-#define CONFIG_KEYBOARD_H +- +-#define HAVE_XINPUT +-/* #undef HAVE_UDEV */ +- +-#define NEW_GEOMETRY +- +-#endif // CONFIG_KEYBOARD_H +diff --git a/plugins/devices/keyboard/preview/config-workspace.h b/plugins/devices/keyboard/preview/config-workspace.h +deleted file mode 100644 +index 12fc40a..0000000 +--- a/plugins/devices/keyboard/preview/config-workspace.h ++++ /dev/null +@@ -1,166 +0,0 @@ +-/* config-workspace.h. Generated by cmake from config-workspace.h.cmake */ +- +-/* #undef HAVE_QIMAGEBLITZ */ +- +-/* Define if you have DPMS support */ +-#define HAVE_DPMS 1 +- +-/* Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h> */ +-/* #undef HAVE_DPMSCAPABLE_PROTO */ +- +-/* Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h> */ +-/* #undef HAVE_DPMSINFO_PROTO */ +- +-/* Defines if your system has the libfontconfig library */ +-#define HAVE_FONTCONFIG 1 +- +-/* Defines if your system has the freetype library */ +-#define HAVE_FREETYPE 1 +- +-/* Define if you have gethostname */ +-/* #undef HAVE_GETHOSTNAME */ +- +-/* Define if you have the gethostname prototype */ +-/* #undef HAVE_GETHOSTNAME_PROTO */ +- +-/* Define to 1 if you have the `getpeereid' function. */ +-/* #undef HAVE_GETPEEREID */ +- +-/* Defines if you have Solaris' libkstat */ +-/* #undef HAVE_KSTAT */ +- +-/* Define if you have long long as datatype */ +-/* #undef HAVE_LONG_LONG */ +- +-/* Define to 1 if you have the `nice' function. */ +-/* #undef HAVE_NICE */ +- +-/* Define to 1 if you have the <sasl.h> header file. */ +-/* #undef HAVE_SASL_H */ +- +-/* Define to 1 if you have the <sasl/sasl.h> header file. */ +-/* #undef HAVE_SASL_SASL_H */ +- +-/* Define to 1 if you have the `setpriority' function. */ +-#define HAVE_SETPRIORITY 1 +- +-/* Define to 1 if you have the `sigaction' function. */ +-/* #undef HAVE_SIGACTION */ +- +-/* Define to 1 if you have the `sigset' function. */ +-/* #undef HAVE_SIGSET */ +- +-/* Define to 1 if you have statvfs */ +-#define HAVE_STATVFS 1 +- +-/* Define to 1 if you have the <string.h> header file. */ +-/* #undef HAVE_STRING_H */ +- +-/* Define if you have the struct ucred */ +-/* #undef HAVE_STRUCT_UCRED */ +- +-/* Define to 1 if you have the <sys/loadavg.h> header file. */ +-/* #undef HAVE_SYS_LOADAVG_H */ +- +-/* Define to 1 if you have the <sys/mount.h> header file. */ +-#define HAVE_SYS_MOUNT_H 1 +- +-/* Define to 1 if you have the <sys/param.h> header file. */ +-#define HAVE_SYS_PARAM_H 1 +- +-/* Define to 1 if you have the <sys/statfs.h> header file. */ +-#define HAVE_SYS_STATFS_H 1 +- +-/* Define to 1 if you have the <sys/statvfs.h> header file. */ +-#define HAVE_SYS_STATVFS_H 1 +- +-/* Define to 1 if you have statfs(). */ +-#define HAVE_STATFS 1 +- +-/* Define to 1 if you have the <sys/select.h> header file. */ +-/* #undef HAVE_SYS_SELECT_H */ +- +-/* Define to 1 if you have the <sys/socket.h> header file. */ +-/* #undef HAVE_SYS_SOCKET_H */ +- +-/* Define to 1 if you have the <sys/time.h> header file. */ +-#define HAVE_SYS_TIME_H 1 +- +-/* Define to 1 if you have the <sys/types.h> header file. */ +-/* #undef HAVE_SYS_TYPES_H */ +- +-/* Define to 1 if you have the <sys/vfs.h> header file. */ +-#define HAVE_SYS_VFS_H 1 +- +-/* Define to 1 if you have the <sys/wait.h> header file. */ +-/* #undef HAVE_SYS_WAIT_H */ +- +-/* Define to 1 if you have the <unistd.h> header file. */ +-#define HAVE_UNISTD_H 1 +- +-/* Define to 1 if you have the <stdint.h> header file. */ +-#define HAVE_STDINT_H 1 +- +-/* Define to 1 if you have the <malloc.h> header file. */ +-#define HAVE_MALLOC_H 1 +- +-/* Define if you have unsetenv */ +-/* #undef HAVE_UNSETENV */ +- +-/* Define if you have the unsetenv prototype */ +-/* #undef HAVE_UNSETENV_PROTO */ +- +-/* Define if you have usleep */ +-/* #undef HAVE_USLEEP */ +- +-/* Define if you have the usleep prototype */ +-/* #undef HAVE_USLEEP_PROTO */ +- +-/* Define to 1 if you have the `vsnprintf' function. */ +-/* #undef HAVE_VSNPRINTF */ +- +-/* Define to 1 if you have the Wayland libraries. */ +-/* #undef WAYLAND_FOUND */ +- +-/* KDE's default home directory */ +-/* #undef KDE_DEFAULT_HOME */ +- +-/* KDE's binaries directory */ +-#define KDE_BINDIR "bin" +- +-/* KDE's configuration directory */ +-#define KDE_CONFDIR "/etc/xdg" +- +-/* KDE's static data directory */ +-#define KDE_DATADIR "share" +- +-/* Define where your java executable is */ +-#undef PATH_JAVA +- +-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +-/* #undef TIME_WITH_SYS_TIME */ +- +-/* xkb resources directory */ +-#define XKBDIR "/usr/share/X11/xkb" +- +-/* KWin binary name */ +-#define KWIN_BIN "kwin_x11" +- +-/* Number of bits in a file offset, on hosts where this is settable. */ +-#define _FILE_OFFSET_BITS 64 +- +-/* Define 1 if the Breeze window decoration was found */ +-#define HAVE_BREEZE_DECO 1 +- +-#ifdef HAVE_BREEZE_DECO +-#define BREEZE_KDECORATION_PLUGIN_ID "org.kde.breeze" +-#endif +- +-/* +- * On HP-UX, the declaration of vsnprintf() is needed every time ! +- */ +- +-/* type to use in place of socklen_t if not defined */ +-#define kde_socklen_t socklen_t +- +-#define WORKSPACE_VERSION_STRING "5.16.5" +diff --git a/plugins/devices/keyboard/preview/debug.cpp b/plugins/devices/keyboard/preview/debug.cpp +deleted file mode 100644 +index 63ba1ca..0000000 +--- a/plugins/devices/keyboard/preview/debug.cpp ++++ /dev/null +@@ -1,11 +0,0 @@ +-// This file was generated by ecm_qt_declare_logging_category(): DO NOT EDIT! +- +-#include "debug.h" +- +- +-#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) +-Q_LOGGING_CATEGORY(KCM_KEYBOARD, "org.kde.kcm_keyboard", QtWarningMsg) +-#else +-Q_LOGGING_CATEGORY(KCM_KEYBOARD, "org.kde.kcm_keyboard") +-#endif +- +diff --git a/plugins/devices/keyboard/preview/debug.h b/plugins/devices/keyboard/preview/debug.h +deleted file mode 100644 +index acefe93..0000000 +--- a/plugins/devices/keyboard/preview/debug.h ++++ /dev/null +@@ -1,11 +0,0 @@ +-// This file was generated by ecm_qt_declare_logging_category(): DO NOT EDIT! +- +-#ifndef ECM_QLOGGINGCATEGORY_KCM_KEYBOARD_DEBUG_H +-#define ECM_QLOGGINGCATEGORY_KCM_KEYBOARD_DEBUG_H +- +-#include <QLoggingCategory> +- +-Q_DECLARE_LOGGING_CATEGORY(KCM_KEYBOARD) +- +- +-#endif +diff --git a/plugins/devices/keyboard/preview/geometry_components.cpp b/plugins/devices/keyboard/preview/geometry_components.cpp +deleted file mode 100644 +index 4716ee4..0000000 +--- a/plugins/devices/keyboard/preview/geometry_components.cpp ++++ /dev/null +@@ -1,245 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +- +-#include "geometry_components.h" +- +-#include <QString> +-#include <QDebug> +-#include <QPoint> +- +- +-Q_LOGGING_CATEGORY(KEYBOARD_PREVIEW, "keyboard_preview") +- +- +-GShape::GShape() +-{ +- cordi_count = 0; +-} +- +-void GShape::setCordinate(double a, double b) +-{ +- cordii << QPoint(a, b); +- cordi_count++; +-} +- +-void GShape::setApprox(double a, double b) +-{ +- a -= approx.x(); +- b -= approx.y(); +- approx = QPoint(a, b); +-} +- +-QPoint GShape :: getCordii(int i) const +-{ +- if (i < cordi_count) { +- return cordii[i]; +- } +- +- return QPoint(); +-} +- +-void GShape::display() +-{ +- qCDebug(KEYBOARD_PREVIEW) << "shape: " << sname << "\n"; +- qCDebug(KEYBOARD_PREVIEW) << "(" << approx.x() << "," << approx.y() << ");"; +- +- for (int i = 0; i < cordi_count; i++) { +- qCDebug(KEYBOARD_PREVIEW) << cordii[i]; +- } +-} +- +-double GShape::size(int vertical) const +-{ +- if (!cordii.isEmpty()) { +- if (vertical == 0) { +- if (approx.x() == 0 && approx.y() == 0) { +- int max = 0; +- for (int i = 0; i < cordi_count; i++) { +- if (max < cordii[i].x()) { +- max = cordii[i].x(); +- } +- } +- return max; +- } else { +- return approx.x(); +- } +- } else { +- if (approx.x() == 0 && approx.y() == 0) { +- int max = 0; +- for (int i = 0; i < cordi_count; i++) { +- if (max < cordii[i].y()) { +- max = cordii[i].y(); +- } +- } +- return max; +- } +- +- return approx.y(); +- } +- } +- +- return 0; +-} +- +- +-Key::Key() +-{ +- offset = 0; +-} +- +-void Key::setKeyPosition(double x, double y) +-{ +- position = QPoint(x, y); +-} +- +-void Key::showKey() +-{ +- qCDebug(KEYBOARD_PREVIEW) << "\n\tKey: " << name << "\tshape: " << shapeName << "\toffset: " << offset; +- qCDebug(KEYBOARD_PREVIEW) << "\tposition" << position; +-} +- +- +-Row::Row() +-{ +- top = 0; +- left = 0; +- keyCount = 0; +- vertical = 0; +- keyList << Key(); +-} +- +-void Row::addKey() +-{ +- //qCDebug(KEYBOARD_PREVIEW) << "keyCount: " << keyCount; +- keyCount++; +- keyList << Key(); +-} +- +-void Row::displayRow() +-{ +- qCDebug(KEYBOARD_PREVIEW) << "\nRow: (" << left << "," << top << ")\n"; +- qCDebug(KEYBOARD_PREVIEW) << "vertical: " << vertical; +- for (int i = 0; i < keyCount; i++) { +- keyList[i].showKey(); +- } +-} +- +- +-Section::Section() +-{ +- top = 0; +- left = 0; +- angle = 0; +- rowCount = 0; +- vertical = 0; +- rowList << Row(); +-} +- +-void Section::addRow() +-{ +- //qCDebug(KEYBOARD_PREVIEW) << "\nrowCount: " << rowCount; +- rowCount++; +- rowList << Row(); +-} +- +-void Section::displaySection() +-{ +- //qCDebug(KEYBOARD_PREVIEW) << "\nSection: " << name << "\n\tposition: (" << left << "," << top << ");" << angle << "\n"; +- //qCDebug(KEYBOARD_PREVIEW) << "vertical: " << vertical; +- for (int i = 0; i < rowCount; i++) { +- qCDebug(KEYBOARD_PREVIEW) << "\n\t"; +- rowList[i].displayRow(); +- } +-} +- +- +-Geometry::Geometry() +-{ +- sectionTop = 0; +- sectionLeft = 0; +- rowTop = 0; +- rowLeft = 0; +- keyGap = 0; +- shape_count = 0; +- width = 0; +- height = 0; +- sectionCount = 0; +- vertical = 0; +- sectionList << Section(); +- shapes << GShape(); +- keyShape = QStringLiteral("NORM"); +- parsedGeometry = true; +-} +- +-void Geometry::setShapeName(const QString &n) +-{ +- shapes[shape_count].setShapeName(n); +-} +- +-void Geometry::setShapeCord(double a, double b) +-{ +- shapes[shape_count].setCordinate(a, b); +-} +- +-void Geometry::setShapeApprox(double a, double b) +-{ +- shapes[shape_count].setApprox(a, b); +-} +- +-void Geometry::addShape() +-{ +- shape_count++; +- shapes << GShape(); +-} +- +-void Geometry::display() +-{ +- qCDebug(KEYBOARD_PREVIEW) << name << "\n" << description << "\nwidth:" << width +- << "\nheight:" << height << "\n" << "sectionTop:" << sectionTop; +- qCDebug(KEYBOARD_PREVIEW) << "\nsectionLeft:" << sectionLeft << "\nrowTop:" << rowTop << "\nrowLeft:" +- << rowLeft << "\nkeyGap: " << keyGap << "\nkeyShape:" << keyShape << "\n"; +- qCDebug(KEYBOARD_PREVIEW) << "vertical:" << vertical; +- +- for (int i = 0; i < shape_count; i++) { +- shapes[i].display(); +- } +- +- for (int j = 0; j < sectionCount; j++) { +- sectionList[j].displaySection(); +- } +-} +- +-void Geometry::addSection() +-{ +- //qCDebug(KEYBOARD_PREVIEW) << "\nsectionCount: " << sectionCount; +- sectionCount++; +- sectionList << Section(); +-} +- +-GShape Geometry::findShape(const QString &name) +-{ +- GShape l; +- +- for (int i = 0; i < shape_count; i++) { +- if (shapes[i].getShapeName() == name) { +- return shapes[i]; +- } +- } +- return l; +-} +diff --git a/plugins/devices/keyboard/preview/geometry_components.h b/plugins/devices/keyboard/preview/geometry_components.h +deleted file mode 100644 +index e66fd44..0000000 +--- a/plugins/devices/keyboard/preview/geometry_components.h ++++ /dev/null +@@ -1,362 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#ifndef GEOMETRY_COMPONENTS_H +-#define GEOMETRY_COMPONENTS_H +- +-#include <QString> +-#include <QPoint> +-#include <QList> +-#include <QLoggingCategory> +- +- +-Q_DECLARE_LOGGING_CATEGORY(KEYBOARD_PREVIEW) +- +- +-class GShape +-{ +-private: +- QString sname; +- QPoint approx; +- QList <QPoint> cordii; +- int cordi_count; +- +-public: +- GShape(); +- void setCordinate(double a, double b); +- void setApprox(double a, double b); +- QPoint getCordii(int i) const; +- void display(); +- double size(int vertical) const; +- +- void setShapeName(const QString &n) +- { +- sname = n; +- } +- +- QPoint getApprox() const +- { +- return approx; +- } +- +- QString getShapeName() +- { +- return sname; +- } +- +- int getCordi_count() const +- { +- return cordi_count; +- } +-}; +- +-class Key +-{ +-private: +- QString name, shapeName; +- double offset; +- QPoint position; +- +-public: +- Key(); +- void setKeyPosition(double x, double y); +- +- void setOffset(double o) +- { +- offset = o; +- } +- +- void setKeyName(const QString &n) +- { +- name = n; +- } +- +- void setShapeName(const QString &n) +- { +- shapeName = n; +- } +- +- QString getName() +- { +- return name; +- } +- +- QString getShapeName() +- { +- return shapeName; +- } +- +- double getOffset() +- { +- return offset; +- } +- +- QPoint getPosition() +- { +- return position; +- } +- +- void showKey(); +-}; +- +-class Row +-{ +-private: +- double top, left; +- int keyCount, vertical; +- QString shapeName; +- +-public : +- QList <Key> keyList; +- +- Row(); +- void addKey(); +- +- void setTop(double t) +- { +- top = t; +- } +- +- void setLeft(double l) +- { +- left = l; +- } +- +- void setVertical(int v) +- { +- vertical = v; +- } +- +- void setShapeName(const QString &n) +- { +- shapeName = n; +- } +- +- double getTop() +- { +- return top; +- } +- +- double getLeft() +- { +- return left; +- } +- +- int getKeyCount() +- { +- return keyCount; +- } +- +- int getVertical() +- { +- return vertical; +- } +- +- QString getShapeName() +- { +- return shapeName; +- } +- +- void displayRow(); +-}; +- +-class Section +-{ +-private: +- QString name, shapeName; +- double top, left, angle; +- int rowCount, vertical; +- +-public: +- QList <Row> rowList; +- +- Section(); +- void addRow(); +- +- void setName(const QString &n) +- { +- name = n; +- } +- +- void setShapeName(const QString &n) +- { +- shapeName = n; +- } +- +- void setTop(double t) +- { +- top = t; +- } +- +- void setLeft(double l) +- { +- left = l; +- } +- +- void setAngle(double a) +- { +- angle = a; +- } +- +- void setVertical(int v) +- { +- vertical = v; +- } +- +- QString getName() +- { +- return name; +- } +- +- QString getShapeName() +- { +- return shapeName; +- } +- +- double getTop() +- { +- return top; +- } +- +- double getLeft() +- { +- return left; +- } +- +- double getAngle() +- { +- return angle; +- } +- +- int getVertical() +- { +- return vertical; +- } +- +- int getRowCount() +- { +- return rowCount; +- } +- +- void displaySection(); +-}; +- +-class Geometry +-{ +-private: +- QString name, description, keyShape; +- int shape_count, vertical; +- int sectionCount; +- +-public: +- QList <GShape> shapes; +- QList <Section> sectionList; +- double width, height, sectionTop, sectionLeft, rowTop, rowLeft, keyGap; +- bool parsedGeometry; +- Geometry(); +- +- void setWidth(double a) +- { +- width = a; +- } +- +- void setParsing(bool state) +- { +- parsedGeometry = state; +- } +- +- void setHeight(double a) +- { +- height = a; +- } +- +- void setName(const QString &n) +- { +- name = n; +- } +- +- void setDescription(const QString &d) +- { +- description = d; +- } +- +- void setKeyShape(const QString &s) +- { +- keyShape = s; +- } +- +- void setVertical(int v) +- { +- vertical = v; +- } +- +- double getWidth() +- { +- return width; +- } +- +- double getHeight() +- { +- return height; +- } +- +- QString getName() +- { +- return name; +- } +- +- QString getDescription() +- { +- return description; +- } +- +- QString getKeyShape() +- { +- return keyShape; +- } +- +- int getVertical() +- { +- return vertical; +- } +- +- int getShapeCount() +- { +- return shape_count; +- } +- +- int getSectionCount() +- { +- return sectionCount; +- } +- +- bool getParsing() +- { +- return parsedGeometry; +- } +- +- void setShapeName(const QString &n); +- void setShapeCord(double a, double b); +- void setShapeApprox(double a, double b); +- void addShape(); +- void display(); +- void addSection(); +- GShape findShape(const QString &name); +-}; +- +-#endif //geometry_componets.h +diff --git a/plugins/devices/keyboard/preview/geometry_parser.cpp b/plugins/devices/keyboard/preview/geometry_parser.cpp +deleted file mode 100644 +index d054336..0000000 +--- a/plugins/devices/keyboard/preview/geometry_parser.cpp ++++ /dev/null +@@ -1,593 +0,0 @@ +-/* +-* Copyright (C) 2013 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +-*/ +- +-#include "geometry_parser.h" +-#include "geometry_components.h" +-#include "xkb_rules.h" +- +-#include <QString> +-#include <QDebug> +-#include <QFileDialog> +-#include <QFile> +-#include <QPair> +- +- +-#include <fixx11h.h> +-#include "config-workspace.h" +- +-namespace grammar +-{ +-keywords::keywords() +-{ +- add +- ("shape", 1) +- ("height", 2) +- ("width", 3) +- ("description", 4) +- ("keys", 5) +- ("row", 6) +- ("section", 7) +- ("key", 8) +- ("//", 9) +- ("/*", 10) +- ; +-} +- +- +-template<typename Iterator> +-GeometryParser<Iterator>::GeometryParser(): GeometryParser::base_type(start) +-{ +- +- using qi::lexeme; +- using qi::char_; +- using qi::lit; +- using qi::_1; +- using qi::_val; +- using qi::int_; +- using qi::double_; +- using qi::eol; +- +- +- name = '"' >> +(char_ - '"') >> '"'; +- +- ignore = (lit("outline") || lit("overlay") || lit("text")) >> *(char_ - lit("};")) >> lit("};") +- || lit("solid") >> *(char_ - lit("};")) >> lit("};") +- || lit("indicator") >> *(char_ - ';' - '{') >> ';' || '{' >> *(char_ - lit("};")) >> lit("};") +- || lit("indicator") >> '.' >> lit("shape") >> '=' >> name >> ';'; +- +- comments = lexeme[ lit("//") >> *(char_ - eol || keyword - eol) >> eol || lit("/*") >> *(char_ - lit("*/") || keyword - lit("*/")) >> lit("*/") ]; +- +- cordinates = ('[' +- >> double_[phx::ref(shapeLenX) = _1] +- >> ',' +- >> double_[phx::ref(shapeLenY) = _1] +- >> ']') +- || '[' >> double_ >> "," >> double_ >> ']' +- ; +- +- cordinatea = '[' >> double_[phx::ref(approxLenX) = _1] >> "," >> double_[phx::ref(approxLenY) = _1] >> ']'; +- +- set = '{' >> cordinates >> *(',' >> cordinates) >> '}'; +- +- setap = '{' >> cordinatea >> *(',' >> cordinatea) >> '}'; +- +- seta = '{' +- >> cordinates[phx::bind(&GeometryParser::setCord, this)] +- >> *(',' >> cordinates[phx::bind(&GeometryParser::setCord, this)]) +- >> '}' +- ; +- +- description = lit("description") >> '=' >> name[phx::bind(&GeometryParser::getDescription, this, _1)] >> ';'; +- +- cornerRadius = (lit("cornerRadius") || lit("corner")) >> '=' >> double_; +- +- shapeDef = lit("shape") +- >> name[phx::bind(&GeometryParser::getShapeName, this, _1)] +- >> '{' +- >> *(lit("approx") >> '=' >> setap[phx::bind(&GeometryParser::setApprox, this)] >> ',' || cornerRadius >> ',' || comments) +- >> seta +- >> *((',' >> (set || lit("approx") >> '=' >> setap[phx::bind(&GeometryParser::setApprox, this)] || cornerRadius) || comments)) +- >> lit("};") +- ; +- +- keyName = '<' >> +(char_ - '>') >> '>'; +- +- keyShape = *(lit("key.")) >> lit("shape") >> '=' >> name[phx::bind(&GeometryParser::setKeyShape, this, _1)] +- || name[phx::bind(&GeometryParser::setKeyShape, this, _1)]; +- +- keyColor = lit("color") >> '=' >> name; +- +- keygap = lit("gap") >> '=' >> double_[phx::ref(KeyOffset) = _1] || double_[phx::ref(KeyOffset) = _1]; +- +- keyDesc = keyName[phx::bind(&GeometryParser::setKeyNameandShape, this, _1)] +- || '{' >> (keyName[phx::bind(&GeometryParser::setKeyNameandShape, this, _1)] || keyShape +- || keygap[phx::bind(&GeometryParser::setKeyOffset, this)] +- || keyColor) +- >> *((',' +- >> (keyName +- || keyShape +- || keygap[phx::bind(&GeometryParser::setKeyOffset, this)] +- || keyColor)) +- || comments) +- >> '}'; +- +- keys = lit("keys") +- >> '{' +- >> keyDesc[phx::bind(&GeometryParser::setKeyCordi, this)] +- >> *((*lit(',') >> keyDesc[phx::bind(&GeometryParser::setKeyCordi, this)] >> *lit(',')) || comments) +- >> lit("};"); +- +- geomShape = ((lit("key.shape") >> '=' >> name[phx::bind(&GeometryParser::setGeomShape, this, _1)]) || (lit("key.color") >> '=' >> name)) >> ';'; +- geomLeft = lit("section.left") >> '=' >> double_[phx::ref(geom.sectionLeft) = _1] >> ';'; +- geomTop = lit("section.top") >> '=' >> double_[phx::ref(geom.sectionTop) = _1] >> ';'; +- geomRowTop = lit("row.top") >> '=' >> double_[phx::ref(geom.rowTop) = _1] >> ';'; +- geomRowLeft = lit("row.left") >> '=' >> double_[phx::ref(geom.rowLeft) = _1] >> ';'; +- geomGap = lit("key.gap") >> '=' >> double_[phx::ref(geom.keyGap) = _1] >> ';'; +- geomVertical = *lit("row.") >> lit("vertical") >> '=' >> (lit("True") || lit("true")) >> ';'; +- geomAtt = geomLeft || geomTop || geomRowTop || geomRowLeft || geomGap; +- +- top = lit("top") >> '=' >> double_ >> ';'; +- left = lit("left") >> '=' >> double_ >> ';'; +- +- row = lit("row")[phx::bind(&GeometryParser::rowinit, this)] +- >> '{' +- >> *(top[phx::bind(&GeometryParser::setRowTop, this, _1)] +- || left[phx::bind(&GeometryParser::setRowLeft, this, _1)] +- || localShape[phx::bind(&GeometryParser::setRowShape, this, _1)] +- || localColor +- || comments +- || geomVertical[phx::bind(&GeometryParser::setVerticalRow, this)] +- || keys +- ) +- >> lit("};") || ignore || geomVertical[phx::bind(&GeometryParser::setVerticalSection, this)]; +- +- angle = lit("angle") >> '=' >> double_ >> ';'; +- +- localShape = lit("key.shape") >> '=' >> name[_val = _1] >> ';'; +- localColor = lit("key.color") >> '=' >> name >> ';'; +- localDimension = (lit("height") || lit("width")) >> '=' >> double_ >> ';'; +- priority = lit("priority") >> '=' >> double_ >> ';'; +- +- section = lit("section")[phx::bind(&GeometryParser::sectioninit, this)] +- >> name[phx::bind(&GeometryParser::sectionName, this, _1)] +- >> '{' +- >> *(top[phx::bind(&GeometryParser::setSectionTop, this, _1)] +- || left[phx::bind(&GeometryParser::setSectionLeft, this, _1)] +- || angle[phx::bind(&GeometryParser::setSectionAngle, this, _1)] +- || row[phx::bind(&GeometryParser::addRow, this)] +- || localShape[phx::bind(&GeometryParser::setSectionShape, this, _1)] +- || geomAtt +- || localColor +- || localDimension +- || priority +- || comments) +- >> lit("};") || geomVertical[phx::bind(&GeometryParser::setVerticalGeometry, this)]; +- +- shapeC = lit("shape") >> '.' >> cornerRadius >> ';'; +- +- shape = shapeDef || shapeC; +- +- +- input = '{' +- >> +(width +- || height +- || comments +- || ignore +- || description +- || (char_ - keyword - '}' +- || shape[phx::bind(&Geometry::addShape, &geom)] +- || section[phx::bind(&Geometry::addSection, &geom)] +- || geomAtt +- || geomShape +- )) +- >> '}'; +- +- width = lit("width") >> '=' >> double_[phx::bind(&Geometry::setWidth, &geom, _1)] >> ";"; +- height = lit("height") >> '=' >> double_[phx::bind(&Geometry::setHeight, &geom, _1)] >> ";"; +- +- start %= *(lit("default")) +- >> lit("xkb_geometry") +- >> name[phx::bind(&GeometryParser::getName, this, _1)] +- >> input +- >> ';' >> *(comments || char_ - lit("xkb_geometry")); +-} +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setCord() +-{ +- geom.setShapeCord(shapeLenX, shapeLenY); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setSectionShape(std::string n) +-{ +- geom.sectionList[geom.getSectionCount()].setShapeName(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::getName(std::string n) +-{ +- geom.setName(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::getDescription(std::string n) +-{ +- geom.setDescription(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::getShapeName(std::string n) +-{ +- geom.setShapeName(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setGeomShape(std::string n) +-{ +- geom.setKeyShape(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setRowShape(std::string n) +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- geom.sectionList[secn].rowList[rown].setShapeName(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setApprox() +-{ +- geom.setShapeApprox(approxLenX, approxLenY); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::addRow() +-{ +- geom.sectionList[geom.getSectionCount()].addRow(); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::sectionName(std::string n) +-{ +- geom.sectionList[geom.getSectionCount()].setName(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::rowinit() +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- double tempTop = geom.sectionList[secn].getTop(); +- QString tempShape = geom.sectionList[secn].getShapeName(); +- geom.sectionList[secn].rowList[rown].setTop(tempTop); +- geom.sectionList[secn].rowList[rown].setLeft(geom.sectionList[secn].getLeft()); +- geom.sectionList[secn].rowList[rown].setShapeName(tempShape); +- keyCordiX = geom.sectionList[secn].rowList[rown].getLeft(); +- keyCordiY = geom.sectionList[secn].rowList[rown].getTop(); +- tempTop = geom.sectionList[secn].getVertical(); +- geom.sectionList[secn].rowList[rown].setVertical(tempTop); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::sectioninit() +-{ +- int secn = geom.getSectionCount(); +- geom.sectionList[secn].setTop(geom.sectionTop); +- geom.sectionList[secn].setLeft(geom.sectionLeft); +- keyCordiX = geom.sectionList[secn].getLeft(); +- keyCordiY = geom.sectionList[secn].getTop(); +- geom.sectionList[secn].setShapeName(geom.getKeyShape()); +- geom.sectionList[secn].setVertical(geom.getVertical()); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setRowTop(double a) +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- double tempTop = geom.sectionList[secn].getTop(); +- geom.sectionList[secn].rowList[rown].setTop(a + tempTop); +- keyCordiY = geom.sectionList[secn].rowList[rown].getTop(); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setRowLeft(double a) +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- double tempLeft = geom.sectionList[secn].getLeft(); +- geom.sectionList[secn].rowList[rown].setLeft(a + tempLeft); +- keyCordiX = geom.sectionList[secn].rowList[rown].getLeft(); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setSectionTop(double a) +-{ +- //qCDebug(KEYBOARD_PREVIEW) << "\nsectionCount" << geom.sectionCount; +- int secn = geom.getSectionCount(); +- geom.sectionList[secn].setTop(a + geom.sectionTop); +- keyCordiY = geom.sectionList[secn].getTop(); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setSectionLeft(double a) +-{ +- //qCDebug(KEYBOARD_PREVIEW) << "\nsectionCount" << geom.sectionCount; +- int secn = geom.getSectionCount(); +- geom.sectionList[secn].setLeft(a + geom.sectionLeft); +- keyCordiX = geom.sectionList[secn].getLeft(); +- +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setSectionAngle(double a) +-{ +- //qCDebug(KEYBOARD_PREVIEW) << "\nsectionCount" << geom.sectionCount; +- int secn = geom.getSectionCount(); +- geom.sectionList[secn].setAngle(a); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setVerticalRow() +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- geom.sectionList[secn].rowList[rown].setVertical(1); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setVerticalSection() +-{ +- int secn = geom.getSectionCount(); +- geom.sectionList[secn].setVertical(1); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setVerticalGeometry() +-{ +- geom.setVertical(1); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setKeyName(std::string n) +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- int keyn = geom.sectionList[secn].rowList[rown].getKeyCount(); +- //qCDebug(KEYBOARD_PREVIEW) << "\nsC: " << secn << "\trC: " << rown << "\tkn: " << keyn; +- geom.sectionList[secn].rowList[rown].keyList[keyn].setKeyName(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setKeyShape(std::string n) +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- int keyn = geom.sectionList[secn].rowList[rown].getKeyCount(); +- //qCDebug(KEYBOARD_PREVIEW) << "\nsC: " << secn << "\trC: " << rown << "\tkn: " << keyn; +- geom.sectionList[secn].rowList[rown].keyList[keyn].setShapeName(QString::fromUtf8(n.data(), n.size())); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setKeyNameandShape(std::string n) +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- setKeyName(n); +- setKeyShape(geom.sectionList[secn].rowList[rown].getShapeName().toUtf8().constData()); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setKeyOffset() +-{ +- //qCDebug(KEYBOARD_PREVIEW) << "\nhere\n"; +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- int keyn = geom.sectionList[secn].rowList[rown].getKeyCount(); +- //qCDebug(KEYBOARD_PREVIEW) << "\nsC: " << secn << "\trC: " << rown << "\tkn: " << keyn; +- geom.sectionList[secn].rowList[rown].keyList[keyn].setOffset(KeyOffset); +-} +- +- +-template<typename Iterator> +-void GeometryParser<Iterator>::setKeyCordi() +-{ +- int secn = geom.getSectionCount(); +- int rown = geom.sectionList[secn].getRowCount(); +- int keyn = geom.sectionList[secn].rowList[rown].getKeyCount(); +- int vertical = geom.sectionList[secn].rowList[rown].getVertical(); +- +- Key key = geom.sectionList[secn].rowList[rown].keyList[keyn]; +- +- if (vertical == 0) { +- keyCordiX += key.getOffset(); +- } else { +- keyCordiY += key.getOffset(); +- } +- +- geom.sectionList[secn].rowList[rown].keyList[keyn].setKeyPosition(keyCordiX, keyCordiY); +- +- QString shapeStr = key.getShapeName(); +- if (shapeStr.isEmpty()) { +- shapeStr = geom.getKeyShape(); +- } +- +- GShape shapeObj = geom.findShape(shapeStr); +- int a = shapeObj.size(vertical); +- +- if (vertical == 0) { +- keyCordiX += a + geom.keyGap; +- } else { +- keyCordiY += a + geom.keyGap; +- } +- +- geom.sectionList[secn].rowList[rown].addKey(); +-} +- +- +-Geometry parseGeometry(const QString &model) +-{ +- using boost::spirit::iso8859_1::space; +- typedef std::string::const_iterator iterator_type; +- typedef grammar::GeometryParser<iterator_type> GeometryParser; +- GeometryParser geometryParser; +- +- Rules::GeometryId geoId = Rules::getGeometryId(model); +- QString geometryFile = geoId.fileName; +- QString geometryName = geoId.geoName; +- +- qCDebug(KEYBOARD_PREVIEW) << "looking for model" << model << "geometryName" << geometryName << "in" << geometryFile; +- +- QString input = getGeometry(geometryFile, geometryName); +- if (! input.isEmpty()) { +- geometryParser.geom = Geometry(); +- input = includeGeometry(input); +- std::string parserInput = input.toUtf8().constData(); +- +- std::string::const_iterator iter = parserInput.begin(); +- std::string::const_iterator end = parserInput.end(); +- +- bool success = phrase_parse(iter, end, geometryParser, space); +- +- if (success && iter == end) { +-// qCDebug(KEYBOARD_PREVIEW) << "Geometry parsing succeeded for" << input.left(20); +- geometryParser.geom.setParsing(true); +- return geometryParser.geom; +- } else { +- qCritical() << "Geometry parsing failed for\n\t" << input.left(30); +- geometryParser.geom.setParsing(false); +- } +- } +- +- if (geometryParser.geom.getParsing()) { +- return geometryParser.geom; +- } +- +- qCritical() << "Failed to get geometry" << geometryParser.geom.getName() << "falling back to pc104"; +- return parseGeometry(QStringLiteral("pc104")); +-} +- +-QString includeGeometry(QString geometry) +-{ +- QStringList lines = geometry.split(QStringLiteral("\n")); +- int includeLine = -1; +- QString includeLineStr; +- QString startLine = lines[0]; +- for (int i = 0; i < lines.size(); i++) { +- includeLineStr = lines[i]; +- lines[i] = lines[i].remove(QStringLiteral(" ")); +- lines[i] = lines[i].remove(QStringLiteral("\r")); +- if (lines[i].startsWith(QLatin1String("include"))) { +- includeLine = i; +- break; +- } +- } +- if (includeLine == -1) { +- return geometry; +- } +- geometry = geometry.remove(includeLineStr); +- lines[includeLine] = lines[includeLine].remove(QStringLiteral("include")); +- lines[includeLine] = lines[includeLine].remove(QStringLiteral("\"")); +- lines[includeLine] = lines[includeLine].remove(QStringLiteral(")")); +- if (lines[includeLine].contains(QStringLiteral("("))) { +- QString includeFile = lines[includeLine].split(QStringLiteral("("))[0]; +- QString includeGeom = lines[includeLine].split(QStringLiteral("("))[1]; +- qCDebug(KEYBOARD_PREVIEW) << "looking to include " << "geometryName" << includeGeom << "in" << includeFile; +- QString includeStr = getGeometry(includeFile, includeGeom); +- includeStr = getGeometryStrContent(includeStr); +- geometry = geometry.remove(startLine); +- geometry = geometry.prepend(includeStr); +- geometry = geometry.prepend(startLine); +- includeGeometry(geometry); +- +- } +- return geometry; +-} +- +-QString getGeometryStrContent(QString geometryStr) +-{ +- int k = geometryStr.indexOf(QStringLiteral("{")); +- int k2 = geometryStr.lastIndexOf(QLatin1String("};")); +- geometryStr = geometryStr.mid(k + 1, k2 - k - 2); +- return geometryStr; +-} +- +-QString getGeometry(QString geometryFile, QString geometryName) +-{ +- +- QString xkbParentDir = findGeometryBaseDir(); +- geometryFile.prepend(xkbParentDir); +- QFile gfile(geometryFile); +- +- if (!gfile.open(QIODevice::ReadOnly | QIODevice::Text)) { +- qCritical() << "Unable to open the file" << geometryFile; +- return QString(); +- } +- +- QString gcontent = gfile.readAll(); +- gfile.close(); +- +- QStringList gcontentList = gcontent.split(QStringLiteral("xkb_geometry ")); +- +- int current = 0; +- for (int i = 1; i < gcontentList.size(); i++) { +- if (gcontentList[i].startsWith("\"" + geometryName + "\"")) { +- current = i; +- break; +- } +- } +- if (current != 0) { +- return gcontentList[current].prepend("xkb_geometry "); +- } else { +- return QString(); +- } +-} +- +- +-QString findGeometryBaseDir() +-{ +- QString xkbDir = Rules::findXkbDir(); +- return QStringLiteral("%1/geometry/").arg(xkbDir); +-} +- +-} +diff --git a/plugins/devices/keyboard/preview/geometry_parser.h b/plugins/devices/keyboard/preview/geometry_parser.h +deleted file mode 100644 +index 6f4a32c..0000000 +--- a/plugins/devices/keyboard/preview/geometry_parser.h ++++ /dev/null +@@ -1,161 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +- +-#ifndef GEOMETRY_PARSER_H +-#define GEOMETRY_PARSER_H +- +-#include <boost/config/warning_disable.hpp> +-#include <boost/spirit/include/qi.hpp> +-#include <boost/spirit/include/phoenix_core.hpp> +-#include <boost/spirit/include/phoenix_operator.hpp> +-#include <boost/spirit/include/phoenix_object.hpp> +-#include <boost/fusion/include/adapt_struct.hpp> +-#include <boost/fusion/include/io.hpp> +-#include <boost/spirit/include/phoenix_function.hpp> +-#include <boost/spirit/include/phoenix_statement.hpp> +-#include <boost/spirit/include/phoenix_bind.hpp> +-#include <boost/spirit/home/support/char_encoding/iso8859_1.hpp> +- +- +-#include <iostream> +-#include <QDebug> +-#include <QStringList> +- +-#include "geometry_components.h" +- +-namespace qi = boost::spirit::qi; +-namespace ascii = boost::spirit::ascii; +-namespace phx = boost::phoenix; +-namespace iso = boost::spirit::iso8859_1; +- +- +-namespace grammar +-{ +- +-struct keywords : qi::symbols<char, int> { +- keywords(); +-}; +- +-template<typename Iterator> +-struct GeometryParser : qi::grammar<Iterator, iso::space_type> { +- +- //comments +- qi::rule<Iterator, std::string(), iso::space_type>comments, ignore; +- qi::rule<Iterator, double(), iso::space_type>localDimension, priority; +- +- //general non-terminals +- qi::rule<Iterator, std::string(), iso::space_type>name; +- qi::rule<Iterator, std::string(), iso::space_type>description; +- qi::rule<Iterator, std::string(), iso::space_type>input; +- +- //non-terminals for shape +- qi::rule<Iterator, int(), iso::space_type>shape; +- qi::rule<Iterator, int(), iso::space_type>shapeDef; +- qi::rule<Iterator, int(), iso::space_type>shapeC; +- qi::rule<Iterator, int(), iso::space_type>set; +- qi::rule<Iterator, int(), iso::space_type>setap; +- qi::rule<Iterator, int(), iso::space_type>seta; +- qi::rule<Iterator, int(), iso::space_type>cornerRadius; +- qi::rule<Iterator, int(), iso::space_type>cordinatea; +- qi::rule<Iterator, int(), iso::space_type>cordinates; +- +- //non-terminals for key +- qi::rule<Iterator, double(), iso::space_type>keygap; +- qi::rule<Iterator, std::string(), iso::space_type>keyName; +- qi::rule<Iterator, std::string(), iso::space_type>keyShape; +- qi::rule<Iterator, std::string(), iso::space_type>keyColor; +- qi::rule<Iterator, std::string(), iso::space_type>keyDesc; +- qi::rule<Iterator, std::string(), iso::space_type>keys; +- +- qi::rule<Iterator, std::string(), iso::space_type>row; +- +- qi::rule<Iterator, std::string(), iso::space_type>section; +- +- //non-terminals related to local data +- qi::rule<Iterator, std::string(), iso::space_type>localShape; +- qi::rule<Iterator, std::string(), iso::space_type>localColor; +- +- //Geometry non-terminals +- qi::rule<Iterator, std::string(), iso::space_type>geomShape; +- qi::rule<Iterator, int(), iso::space_type>geomTop, geomVertical; +- qi::rule<Iterator, int(), iso::space_type>geomLeft; +- qi::rule<Iterator, int(), iso::space_type>geomRowTop; +- qi::rule<Iterator, int(), iso::space_type>geomRowLeft; +- qi::rule<Iterator, int(), iso::space_type>geomGap; +- qi::rule<Iterator, int(), iso::space_type>geomAtt; +- qi::rule<Iterator, int(), iso::space_type>angle; +- qi::rule<Iterator, int(), iso::space_type>top; +- qi::rule<Iterator, int(), iso::space_type>left; +- qi::rule<Iterator, int(), iso::space_type>width; +- qi::rule<Iterator, int(), iso::space_type>height; +- +- qi::rule<Iterator, iso::space_type>start; +- Geometry geom; +- keywords keyword; +- double shapeLenX, shapeLenY, approxLenX, approxLenY, keyCordiX, keyCordiY, KeyOffset; +- GeometryParser(); +- +- //functions for shape +- void getShapeName(std::string n); +- void setCord(); +- void setApprox(); +- +- //functions for section +- void sectionName(std::string n); +- void setSectionShape(std::string n); +- void setSectionTop(double a); +- void setSectionLeft(double a); +- void setSectionAngle(double a); +- void sectioninit(); +- +- //functions for row +- void setRowShape(std::string n); +- void setRowTop(double a); +- void setRowLeft(double a); +- void rowinit(); +- void addRow(); +- +- //functions for key +- void setKeyName(std::string n); +- void setKeyShape(std::string n); +- void setKeyNameandShape(std::string n); +- void setKeyOffset(); +- void setKeyCordi(); +- +- //functions for geometry +- void setGeomShape(std::string n); +- void getName(std::string n); +- void getDescription(std::string n); +- +- //functions for alignment +- void setVerticalRow(); +- void setVerticalSection(); +- void setVerticalGeometry(); +-}; +- +- +- +-Geometry parseGeometry(const QString &model); +-QString getGeometry(QString geometryFile, QString geometryName); +-QString includeGeometry(QString geometry); +-QString getGeometryStrContent(QString geometryStr); +-QString findGeometryBaseDir(); +-} +- +-#endif //geometry_parser +diff --git a/plugins/devices/keyboard/preview/kbpreviewframe.cpp b/plugins/devices/keyboard/preview/kbpreviewframe.cpp +deleted file mode 100644 +index aea0694..0000000 +--- a/plugins/devices/keyboard/preview/kbpreviewframe.cpp ++++ /dev/null +@@ -1,374 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +- +-#include "kbpreviewframe.h" +- +-#include "geometry_parser.h" +-#include "geometry_components.h" +-#include "keyboardlayout.h" +-#include "symbol_parser.h" +- +-#include <QFile> +-#include <QFont> +-#include <QFileDialog> +-#include <QHelpEvent> +-#include <QMessageBox> +-#include <QRect> +-#include <QDesktopWidget> +-#include <QApplication> +- +-#include <math.h> +- +- +-static const QColor keyBorderColor("#d4d4d4"); +-static const QColor lev12color(Qt::black); +-static const QColor lev34color("#0033FF"); +-static const QColor unknownSymbolColor("#FF3300"); +-static const int xOffset[] = {10, 10, -15, -15 }; +-static const int yOffset[] = {5, -20, 5, -20 }; +-static const QColor color[] = { lev12color, lev12color, lev34color, lev34color }; +-static const int keyLevel[3][4] = { { 1, 0, 3, 2}, { 1, 0, 5, 4}, { 1, 0, 7, 6} }; +-static const QRegExp fkKey(QStringLiteral("^FK\\d+$")); +- +- +-KbPreviewFrame::KbPreviewFrame(QWidget *parent) : +- QFrame(parent), +- geometry(*new Geometry()) +-{ +- setFrameStyle(QFrame::Box); +- setFrameShadow(QFrame::Sunken); +- setMouseTracking(true); +- scaleFactor = 1; +- l_id = 0; +-} +- +-KbPreviewFrame::~KbPreviewFrame() +-{ +- delete &geometry; +-} +- +- +-int KbPreviewFrame::getWidth() const +-{ +- return geometry.width; +-} +-int KbPreviewFrame::getHeight() const +-{ +- return geometry.height; +-} +- +- +-//writes text on the keys call only by paintevent +-void KbPreviewFrame::drawKeySymbols(QPainter &painter, QPoint temp[], const GShape &s, const QString &name) +-{ +- int keyindex = keyboardLayout.findKey(name); +- int szx = scaleFactor * s.size(0) / 2 < 20 ? scaleFactor * s.size(0) / 3 : 20; +- int szy = scaleFactor * s.size(1) / 2 < 20 ? scaleFactor * s.size(1) / 3 : 20; +- QFont kbfont; +- if (szx > szy) { +- kbfont.setPointSize(szy / 2 < 9 ? szy : 9); +- } else { +- kbfont.setPointSize(szx / 2 < 9 ? szx / 2 : 9); +- } +- +- painter.setFont(kbfont); +- +- int cordinate[] = {0, 3, 1, 2}; +- float tooltipX = 0, toolTipY = 0; +- QString tip; +- if (keyindex != -1) { +- KbKey key = keyboardLayout.keyList.at(keyindex); +- +- for (int level = 0; level < (key.getSymbolCount() < 4 ? key.getSymbolCount() : 4); level++) { +- +- if (keyLevel[l_id][level] < key.getSymbolCount()) { +- +- QString txt = symbol.getKeySymbol(key.getSymbol(keyLevel[l_id][level])); +- +- QColor txtColor = txt[0] == -1 ? unknownSymbolColor : color[level]; +- +- painter.setPen(txtColor); +- +- painter.drawText(temp[cordinate[level]].x() + xOffset[level]*scaleFactor / 2.5, temp[cordinate[level]].y() + yOffset[level]*scaleFactor / 2.5, szx, szy, Qt::AlignTop, txt); +- +- QString currentSymbol = key.getSymbol(keyLevel[l_id][level]); +- currentSymbol = currentSymbol.size() < 3 ? currentSymbol.append("\t") : currentSymbol; +- +- if (level == 0) { +- tip.append(currentSymbol); +- } else { +- tip.append("\n" + currentSymbol); +- } +- } +- } +- +- for (int i = 0 ; i < 4; i++) { +- tooltipX += temp[i].x(); +- toolTipY += temp[i].y(); +- } +- +- tooltipX = tooltipX / 4; +- toolTipY = toolTipY / 4; +- QPoint tooltipPoint = QPoint(tooltipX, toolTipY); +- +- tooltip.append(tip); +- tipPoint.append(tooltipPoint); +- } else { +- painter.setPen(Qt::black); +- +- if (name.contains(fkKey)) { +- QString tempName = name; +- tempName.remove(QStringLiteral("K")); +- painter.drawText(temp[0].x() + s.size(0) - 10, temp[0].y() + 3 * scaleFactor * s.size(1) / 5, tempName); +- } else { +- painter.setFont(kbfont); +- painter.drawText(temp[0].x() + s.size(0) - 10, temp[0].y() + 3 * scaleFactor * s.size(1) / 5, name); +- } +- tip = name; +- +- for (int i = 0 ; i < 4; i++) { +- tooltipX += temp[i].x(); +- toolTipY += temp[i].y(); +- } +- +- tooltipX = tooltipX / 4; +- toolTipY = toolTipY / 4; +- QPoint tooltipPoint = QPoint(tooltipX, toolTipY); +- +- tooltip.append(tip); +- tipPoint.append(tooltipPoint); +- } +-} +- +- +-//draws key shape on QFrame called only by paint event +-void KbPreviewFrame::drawShape(QPainter &painter, const GShape &s, int x, int y, int i, const QString &name) +-{ +- painter.setPen(Qt::black); +- int cordi_count = s.getCordi_count(); +- +- if (geometry.sectionList[i].getAngle() == 0) { +- if (cordi_count == 1) { +- int width = s.getCordii(0).x(); +- int height = s.getCordii(0).y(); +- +- painter.drawRoundedRect(scaleFactor * x + 2, scaleFactor * y, scaleFactor * width, scaleFactor * height, 4, 4); +- +- QPoint temp[4]; +- +- temp[0] = QPoint(scaleFactor * x, scaleFactor * y); +- temp[1] = QPoint(scaleFactor * (s.getCordii(0).x() + x), scaleFactor * y); +- temp[2] = QPoint(scaleFactor * (s.getCordii(0).x() + x), scaleFactor * (s.getCordii(0).y() + y)); +- temp[3] = QPoint(scaleFactor * (x), scaleFactor * (s.getCordii(0).y() + y)); +- +- drawKeySymbols(painter, temp, s, name); +- } else { +- QVarLengthArray<QPoint> temp(cordi_count); +- for (int i = 0; i < cordi_count; i++) { +- temp[i].setX(scaleFactor * (s.getCordii(i).x() + x + 1)); +- temp[i].setY(scaleFactor * (s.getCordii(i).y() + y + 1)); +- } +- +- painter.drawPolygon(temp.data(), cordi_count); +- drawKeySymbols(painter, temp.data(), s, name); // no length passed here, is this safe? +- } +- } else { +- QVarLengthArray<QPoint> temp(cordi_count == 1 ? 4 : cordi_count); +- int size; +- +- if (cordi_count == 1) { +- temp[0] = QPoint(x, y); +- temp[1] = QPoint(s.getCordii(0).x() + x, y); +- temp[2] = QPoint(s.getCordii(0).x() + x, s.getCordii(0).y() + y); +- temp[3] = QPoint(x, s.getCordii(0).y() + y); +- size = 4; +- } else { +- size = cordi_count; +- +- for (int i = 0; i < cordi_count; i++) { +- temp[i].setX((s.getCordii(i).x() + x + 1)); +- temp[i].setY((s.getCordii(i).y() + y + 1)); +- } +- } +- +- double refX, refY; +- +- refX = geometry.sectionList[i].getLeft(); +- refY = geometry.sectionList[i].getTop(); +- +- //qCDebug(KEYBOARD_PREVIEW) <<"\ntransform"; +- for (int j = 0; j < size; j++) { +- double x = temp[j].x() - refX; +- double y = temp[j].y() - refY; +- +- //qCDebug(KEYBOARD_PREVIEW) <<"(" <<x <<"," <<y <<")->"; +- +- float theta = (3.1459 * geometry.sectionList[i].getAngle()) / 180; +- double x_ = x * cos(theta) - y * sin(theta); +- +- //qCDebug(KEYBOARD_PREVIEW) <<"x_= " <<x <<"*" <<cos(theta) <<"-" <<y <<"*" <<sin(theta); +- +- double y_ = x * sin(theta) + y * cos(theta); +- +- //qCDebug(KEYBOARD_PREVIEW) <<"\ny_= " <<x <<"*" <<sin(theta) <<"+" <<y <<"*" <<cos(theta); +- //qCDebug(KEYBOARD_PREVIEW) <<"(" <<x_ <<"," <<y_ <<")\n"; +- +- temp[j] = QPoint(scaleFactor * (x_ + refX), scaleFactor * (y_ + refY)); +- } +- +- /*for(int i=0;i<size;i++){ +- qCDebug(KEYBOARD_PREVIEW) <<temp[i]; +- }*/ +- +- painter.drawPolygon(temp.data(), size); +- drawKeySymbols(painter, temp.data(), s, name); // no length passed here, is this safe? +- } +- +-} +- +- +-//event handling for tooltip +-bool KbPreviewFrame::event(QEvent *event) +-{ +- +- if (event->type() == QEvent::ToolTip) { +- QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); +- int index = itemAt(helpEvent->pos()); +- +- if (index != -1) { +- QToolTip::showText(helpEvent->globalPos(), tooltip.at(index)); +- } else { +- QToolTip::hideText(); +- event->ignore(); +- } +- +- return true; +- } +- return QWidget::event(event); +-} +- +- +-void KbPreviewFrame::paintEvent(QPaintEvent *) +-{ +- if (geometry.getParsing() && keyboardLayout.getParsedSymbol()) { +- QPainter painter(this); +- +- QFont kbfont; +- kbfont.setPointSize(9); +- +- painter.setFont(kbfont); +- painter.setBrush(QBrush("#C3C8CB")); +- painter.setRenderHint(QPainter::Antialiasing); +- +- const int strtx = 0, strty = 0, endx = geometry.getWidth(), endy = geometry.getHeight(); +- +- +- painter.setPen("#EDEEF2"); +- +- painter.drawRect(strtx, strty, scaleFactor * endx + 60, scaleFactor * endy + 60); +- +- painter.setPen(Qt::black); +- painter.setBrush(QBrush("#EDEEF2")); +- +- for (int i = 0; i < geometry.getSectionCount(); i++) { +- +- painter.setPen(Qt::black); +- +- for (int j = 0; j < geometry.sectionList[i].getRowCount(); j++) { +- +- int keyn = geometry.sectionList[i].rowList[j].getKeyCount(); +- +- for (int k = 0; k < keyn; k++) { +- +- Key temp = geometry.sectionList[i].rowList[j].keyList[k]; +- +- int x = temp.getPosition().x(); +- int y = temp.getPosition().y(); +- +- GShape s; +- +- s = geometry.findShape(temp.getShapeName()); +- QString name = temp.getName(); +- +- drawShape(painter, s, x, y, i, name); +- +- } +- } +- } +- +- if (symbol.isFailed()) { +- painter.setPen(keyBorderColor); +- painter.drawRect(strtx, strty, endx, endy); +- +- const int midx = 470, midy = 240; +- painter.setPen(lev12color); +- painter.drawText(midx, midy, tr("No preview found")); +- } +- } else { +- QMessageBox errorBox; +- errorBox.setText(tr("Unable to open Preview !")); +- errorBox.exec(); +- } +- +-} +- +-// this function draws the keyboard preview on a QFrame +-void KbPreviewFrame::generateKeyboardLayout(const QString &layout, const QString &layoutVariant, const QString &model) +-{ +- qDebug() << " generateKeyboardLayout " << endl; +- geometry = grammar::parseGeometry(model); +- int endx = geometry.getWidth(), endy = geometry.getHeight(); +- +- QDesktopWidget *desktopWidget = qApp->desktop(); +- QRect screenGeometry = desktopWidget->screenGeometry(); +- int screenWidth = screenGeometry.width(); +- +- scaleFactor = 2.5; +- while (scaleFactor * endx + screenWidth / 20 > screenWidth) { +- scaleFactor -= 0.2; +- } +- qCDebug(KEYBOARD_PREVIEW) << "scale factor: 2.5 ->" << scaleFactor; +- +- setFixedSize(scaleFactor * endx + 60, scaleFactor * endy + 60); +- qCDebug(KEYBOARD_PREVIEW) << screenWidth << ":" << scaleFactor << scaleFactor *endx + 60 << scaleFactor *endy + 60; +- keyboardLayout = grammar::parseSymbols(layout, layoutVariant); +-} +- +- +-//this functions give the index of the tooltip over which mouse hovers +-int KbPreviewFrame::itemAt(const QPoint &pos) +-{ +- int distance = 10000; +- int closest = 0; +- for (int i = 0; i < tipPoint.size(); i++) { +- +- int temp = sqrt((pos.x() - tipPoint.at(i).x()) * (pos.x() - tipPoint.at(i).x()) + (pos.y() - tipPoint.at(i).y()) * (pos.y() - tipPoint.at(i).y())); +- +- if (distance > temp) { +- distance = temp; +- closest = i; +- } +- } +- +- if (distance < 25) { +- return closest; +- } +- +- return -1; +-} +diff --git a/plugins/devices/keyboard/preview/kbpreviewframe.h b/plugins/devices/keyboard/preview/kbpreviewframe.h +deleted file mode 100644 +index 336af31..0000000 +--- a/plugins/devices/keyboard/preview/kbpreviewframe.h ++++ /dev/null +@@ -1,95 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +-#ifndef KBPREVIEWFRAME_H +-#define KBPREVIEWFRAME_H +- +-#include "keyboardlayout.h" +- +-#include "keysymhelper.h" +-#include "keyaliases.h" +- +-#include <QPainter> +-#include <QFrame> +-#include <QHash> +-#include <QToolTip> +-#include <QLoggingCategory> +- +- +-Q_DECLARE_LOGGING_CATEGORY(KEYBOARD_PREVIEW) +- +- +-class Geometry; +-class GShape; +- +- +-class KbPreviewFrame : public QFrame +-{ +- Q_OBJECT +- +-private: +- static const int width = 1100, height = 490; +- +- KeySymHelper symbol; +- Aliases alias; +- QStringList tooltip; +- QList <QPoint> tipPoint; +- int l_id; +- Geometry &geometry; +- float scaleFactor; +- KbLayout keyboardLayout; +- +- void drawKeySymbols(QPainter &painter, QPoint temp[], const GShape &s, const QString &name); +- void drawShape(QPainter &painter, const GShape &s, int x, int y, int i, const QString &name); +- +- int itemAt(const QPoint &pos); +- +- +-protected: +- bool event(QEvent *event) override; +- +-public: +- explicit KbPreviewFrame(QWidget *parent = nullptr); +- ~KbPreviewFrame() override; +- void paintEvent(QPaintEvent *event) override; +- void generateKeyboardLayout(const QString &layout, const QString &layoutVariant, const QString &model); +- int getWidth() const; +- int getHeight() const; +- +- int getLevel() +- { +- return keyboardLayout.getLevel(); +- } +- +- void setL_id(int lId) +- { +- l_id = lId; +- repaint(); +- } +- +- QString getLayoutName() const +- { +- return keyboardLayout.getLayoutName(); +- } +- +- float getScaleFactor() +- { +- return scaleFactor; +- } +-}; +- +-#endif // KBPREVIEWFRAME_H +diff --git a/plugins/devices/keyboard/preview/keyaliases.cpp b/plugins/devices/keyboard/preview/keyaliases.cpp +deleted file mode 100644 +index 746120d..0000000 +--- a/plugins/devices/keyboard/preview/keyaliases.cpp ++++ /dev/null +@@ -1,128 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#include "keyaliases.h" +-#include "xkb_rules.h" +- +-#include <QString> +-#include <QMessageBox> +-#include <QFile> +-#include <QDir> +- +-#include <X11/Xlib.h> +-#include <X11/Xatom.h> +-#include <X11/XKBlib.h> +-#include <X11/extensions/XKBrules.h> +- +-#include <fixx11h.h> +-#include "config-workspace.h" +- +- +-Aliases::Aliases() +-{ +- QString filename = findaliasdir(); +- QFile file(filename); +- file.open(QIODevice::ReadOnly | QIODevice::Text); +- QString content = file.readAll(); +- file.close(); +- +- QList<QString>als; +- als = content.split(QStringLiteral("xkb_keycodes")); +- +- for (int i = 1; i < als.size(); i++) { +- +- QString temp = als.at(i); +- +- temp = temp.remove(QStringLiteral(" ")); +- temp = temp.remove(QStringLiteral("\n")); +- temp = temp.remove(QStringLiteral("\"")); +- temp = temp.remove(QStringLiteral(">")); +- temp = temp.remove(QStringLiteral("<")); +- temp = temp.remove(QStringLiteral(";")); +- temp = temp.remove(QStringLiteral("}")); +- temp = temp.remove(QStringLiteral("{")); +- +- QList<QString>alskeys; +- +- alskeys = temp.split(QStringLiteral("alias")); +- +- if (temp.startsWith(QLatin1String("qwerty"))) { +- +- for (int k = 1; k < alskeys.size(); k++) { +- +- QString tmp = alskeys.at(k); +- int inofeq = tmp.indexOf(QStringLiteral("=")); +- +- QString lat = tmp.left(inofeq); +- QString key = tmp.mid(inofeq + 1); +- +- qwerty[lat] = key; +- } +- } +- +- if (temp.startsWith(QLatin1String("azerty"))) { +- +- for (int k = 1; k < alskeys.size(); k++) { +- QString tmp = alskeys.at(k); +- +- int inofeq = tmp.indexOf(QStringLiteral("=")); +- +- QString lat = tmp.left(inofeq); +- QString key = tmp.mid(inofeq + 1); +- +- azerty[lat] = key; +- } +- } +- +- if (temp.startsWith(QLatin1String("qwertz"))) { +- for (int k = 1; k < alskeys.size(); k++) { +- +- QString tmp = alskeys.at(k); +- +- int inofeq = tmp.indexOf(QStringLiteral("=")); +- +- QString lat = tmp.left(inofeq); +- QString key = tmp.mid(inofeq + 1); +- +- qwertz[lat] = key; +- } +- } +- } +- +-} +- +- +-QString Aliases::getAlias(const QString &cname, const QString &name) +-{ +- QMessageBox q; +- QString a = name; +- +- if (cname == QLatin1String("ma") || cname == QLatin1String("be") || cname == QLatin1String("fr")) { +- a = azerty.value(name); +- } else { +- a = qwerty.value(name); +- } +- +- return a; +-} +- +-QString Aliases::findaliasdir() +-{ +- QString xkbDir = Rules::findXkbDir(); +- return QStringLiteral("%1/keycodes/aliases").arg(xkbDir); +-} +diff --git a/plugins/devices/keyboard/preview/keyaliases.h b/plugins/devices/keyboard/preview/keyaliases.h +deleted file mode 100644 +index fe40342..0000000 +--- a/plugins/devices/keyboard/preview/keyaliases.h ++++ /dev/null +@@ -1,36 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +-#ifndef ALIASES_H +-#define ALIASES_H +- +-#include <QMap> +- +-class Aliases +-{ +-private: +- QMap<QString, QString>qwerty; +- QMap<QString, QString>azerty; +- QMap<QString, QString>qwertz; +- QString findaliasdir(); +- +-public: +- Aliases(); +- QString getAlias(const QString &type, const QString &name); +-}; +- +-#endif // ALIASES_H +diff --git a/plugins/devices/keyboard/preview/keyboard_config.cpp b/plugins/devices/keyboard/preview/keyboard_config.cpp +deleted file mode 100644 +index f8169a8..0000000 +--- a/plugins/devices/keyboard/preview/keyboard_config.cpp ++++ /dev/null +@@ -1,208 +0,0 @@ +-/* +- * Copyright (C) 2010 Andriy Rysin (rysin@kde.org) +- * +- * 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 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#include "keyboard_config.h" +-#include "debug.h" +- +-#include <ksharedconfig.h> +-#include <kconfiggroup.h> +- +- +-static const char* const SWITCHING_POLICIES[] = {"Global", "Desktop", "WinClass", "Window", nullptr }; +-static const char LIST_SEPARATOR[] = ","; +-//static const char* DEFAULT_LAYOUT = "us"; +-static const char DEFAULT_MODEL[] = "pc104"; +- +-static const QString CONFIG_FILENAME(QStringLiteral("kxkbrc")); +-static const QString CONFIG_GROUPNAME(QStringLiteral("Layout")); +- +-const int KeyboardConfig::NO_LOOPING = -1; +- +-KeyboardConfig::KeyboardConfig() +-{ +- setDefaults(); +-} +- +-QString KeyboardConfig::getSwitchingPolicyString(SwitchingPolicy switchingPolicy) { +- return SWITCHING_POLICIES[switchingPolicy]; +-} +- +-static int findStringIndex(const char* const strings[], const QString& toFind, int defaultIndex) +-{ +- for(int i=0; strings[i] != nullptr; i++) { +- if( toFind == strings[i] ) { +- return i; +- } +- } +- return defaultIndex; +-} +- +-void KeyboardConfig::setDefaults() +-{ +- keyboardModel = DEFAULT_MODEL; +- resetOldXkbOptions = false; +- xkbOptions.clear(); +- +- // init layouts options +- configureLayouts = false; +- layouts.clear(); +-// layouts.append(LayoutUnit(DEFAULT_LAYOUT)); +- layoutLoopCount = NO_LOOPING; +- +- // switch control options +- switchingPolicy = SWITCH_POLICY_GLOBAL; +-// stickySwitching = false; +-// stickySwitchingDepth = 2; +- +- // display options +- showIndicator = true; +- indicatorType = SHOW_LABEL; +- showSingle = false; +-} +- +-static +-KeyboardConfig::IndicatorType getIndicatorType(bool showFlag, bool showLabel) +-{ +- if( showFlag ) { +- if( showLabel ) +- return KeyboardConfig::SHOW_LABEL_ON_FLAG; +- else +- return KeyboardConfig::SHOW_FLAG; +- } +- else { +- return KeyboardConfig::SHOW_LABEL; +- } +-} +- +- +-void KeyboardConfig::load() +-{ +- KConfigGroup config(KSharedConfig::openConfig( CONFIG_FILENAME, KConfig::NoGlobals ), CONFIG_GROUPNAME); +- +- keyboardModel = config.readEntry("Model", ""); +- +- resetOldXkbOptions = config.readEntry("ResetOldOptions", false); +- QString options = config.readEntry("Options", ""); +- xkbOptions = options.split(LIST_SEPARATOR, QString::SkipEmptyParts); +- +- configureLayouts = config.readEntry("Use", false); +- QString layoutsString = config.readEntry("LayoutList", ""); +- QStringList layoutStrings = layoutsString.split(LIST_SEPARATOR, QString::SkipEmptyParts); +-// if( layoutStrings.isEmpty() ) { +-// layoutStrings.append(DEFAULT_LAYOUT); +-// } +- layouts.clear(); +- foreach(const QString& layoutString, layoutStrings) { +- layouts.append(LayoutUnit(layoutString)); +- } +- if( layouts.isEmpty() ) { +- configureLayouts = false; +- } +- +- layoutLoopCount = config.readEntry("LayoutLoopCount", NO_LOOPING); +- +- QString layoutMode = config.readEntry("SwitchMode", "Global"); +- switchingPolicy = static_cast<SwitchingPolicy>(findStringIndex(SWITCHING_POLICIES, layoutMode, SWITCH_POLICY_GLOBAL)); +- +- showIndicator = config.readEntry("ShowLayoutIndicator", true); +- +- bool showFlag = config.readEntry("ShowFlag", false); +- bool showLabel = config.readEntry("ShowLabel", true); +- indicatorType = getIndicatorType(showFlag, showLabel); +- +- showSingle = config.readEntry("ShowSingle", false); +- +- QString labelsStr = config.readEntry("DisplayNames", ""); +- QStringList labels = labelsStr.split(LIST_SEPARATOR, QString::KeepEmptyParts); +- for(int i=0; i<labels.count() && i<layouts.count(); i++) { +- if( !labels[i].isEmpty() && labels[i] != layouts[i].layout ) { +- layouts[i].setDisplayName(labels[i]); +- } +- } +- +-// QString shortcutsStr = config.readEntry("LayoutShortcuts", ""); +-// QStringList shortcutsList = shortcutsStr.split(LIST_SEPARATOR, QString::KeepEmptyParts); +-// for(int i=0; i<shortcutsList.count() && i<layouts.count(); i++) { +-// if( !shortcutsList[i].isEmpty() ) { +-// layouts[i].setShortcut(QKeySequence(shortcutsList[i])); +-// } +-// } +- +- qCDebug(KCM_KEYBOARD) << "configuring layouts" << configureLayouts << "configuring options" << resetOldXkbOptions; +-} +- +-void KeyboardConfig::save() +-{ +- KConfigGroup config(KSharedConfig::openConfig( CONFIG_FILENAME, KConfig::NoGlobals ), CONFIG_GROUPNAME); +- +- config.writeEntry("Model", keyboardModel); +- +- config.writeEntry("ResetOldOptions", resetOldXkbOptions); +- if( resetOldXkbOptions ) { +- config.writeEntry("Options", xkbOptions.join(LIST_SEPARATOR)); +- } +- else { +- config.deleteEntry("Options"); +- } +- +- config.writeEntry("Use", configureLayouts); +- +- QStringList layoutStrings; +- QStringList displayNames; +-// QStringList shortcuts; +- foreach(const LayoutUnit& layoutUnit, layouts) { +- layoutStrings.append(layoutUnit.toString()); +- displayNames.append(layoutUnit.getRawDisplayName()); +-// shortcuts.append(layoutUnit.getShortcut().toString()); +- } +- config.writeEntry("LayoutList", layoutStrings.join(LIST_SEPARATOR)); +- config.writeEntry("DisplayNames", displayNames.join(LIST_SEPARATOR)); +-// config.writeEntry("LayoutShortcuts", shortcuts.join(LIST_SEPARATOR)); +- +- config.writeEntry("LayoutLoopCount", layoutLoopCount); +- +- config.writeEntry("SwitchMode", SWITCHING_POLICIES[switchingPolicy]); +- +- config.writeEntry("ShowLayoutIndicator", showIndicator); +- config.writeEntry("ShowFlag", indicatorType == SHOW_FLAG || indicatorType == SHOW_LABEL_ON_FLAG); +- config.writeEntry("ShowLabel", indicatorType == SHOW_LABEL || indicatorType == SHOW_LABEL_ON_FLAG); +- config.writeEntry("ShowSingle", showSingle); +- +- config.sync(); +-} +- +-QList<LayoutUnit> KeyboardConfig::getDefaultLayouts() const +-{ +- QList<LayoutUnit> defaultLayoutList; +- int i = 0; +- foreach(const LayoutUnit& layoutUnit, layouts) { +- defaultLayoutList.append(layoutUnit); +- if( layoutLoopCount != KeyboardConfig::NO_LOOPING && i >= layoutLoopCount-1 ) +- break; +- i++; +- } +- return defaultLayoutList; +-} +- +-QList<LayoutUnit> KeyboardConfig::getExtraLayouts() const +-{ +- if( layoutLoopCount == KeyboardConfig::NO_LOOPING ) +- return QList<LayoutUnit>(); +- +- return layouts.mid(layoutLoopCount, layouts.size()); +-} +diff --git a/plugins/devices/keyboard/preview/keyboard_config.h b/plugins/devices/keyboard/preview/keyboard_config.h +deleted file mode 100644 +index 21e5b60..0000000 +--- a/plugins/devices/keyboard/preview/keyboard_config.h ++++ /dev/null +@@ -1,91 +0,0 @@ +-/* +- * Copyright (C) 2010 Andriy Rysin (rysin@kde.org) +- * +- * 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 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +- +-#ifndef KEYBOARD_CONFIG_H_ +-#define KEYBOARD_CONFIG_H_ +- +-#include "x11_helper.h" +- +-#include <QString> +-#include <QStringList> +-#include <QList> +-#include <QMap> +-#include <QPair> +- +-/** +- * This class provides configuration options for keyboard module +- */ +-class KeyboardConfig +-{ +-public: +- static const int MAX_LABEL_LEN = 3; +- static const int NO_LOOPING; // = -1; +- +- enum SwitchingPolicy { +- SWITCH_POLICY_GLOBAL = 0, +- SWITCH_POLICY_DESKTOP = 1, +- SWITCH_POLICY_APPLICATION = 2, +- SWITCH_POLICY_WINDOW = 3 +- }; +- +- enum IndicatorType { +- SHOW_LABEL = 0, +- SHOW_FLAG = 1, +- SHOW_LABEL_ON_FLAG = 2 +- }; +- +- QString keyboardModel; +- // resetOldXkbOptions is now also "set xkb options" +- bool resetOldXkbOptions; +- QStringList xkbOptions; +- +- // init layouts options +- bool configureLayouts; +- QList<LayoutUnit> layouts; +- int layoutLoopCount; +- +- // switch control options +- SwitchingPolicy switchingPolicy; +-// bool stickySwitching; +-// int stickySwitchingDepth; +- +- // display options +- bool showIndicator; +- IndicatorType indicatorType; +- bool showSingle; +- +- KeyboardConfig(); +- +- QList<LayoutUnit> getDefaultLayouts() const; +- QList<LayoutUnit> getExtraLayouts() const; +- bool isFlagShown() const { +- return indicatorType == SHOW_FLAG || indicatorType == SHOW_LABEL_ON_FLAG; +- } +- bool isLabelShown() const { +- return indicatorType == SHOW_LABEL || indicatorType == SHOW_LABEL_ON_FLAG; +- } +- +- void setDefaults(); +- void load(); +- void save(); +- +- static QString getSwitchingPolicyString(SwitchingPolicy switchingPolicy); +-}; +- +-#endif /* KEYBOARD_CONFIG_H_ */ +diff --git a/plugins/devices/keyboard/preview/keyboardlayout.cpp b/plugins/devices/keyboard/preview/keyboardlayout.cpp +deleted file mode 100644 +index 2f70a89..0000000 +--- a/plugins/devices/keyboard/preview/keyboardlayout.cpp ++++ /dev/null +@@ -1,133 +0,0 @@ +-/* +- * Copyright (C) 2013 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +- +-#include "keyboardlayout.h" +- +-#include <QDebug> +-#include <QString> +-#include <QList> +- +- +-KbKey::KbKey() +-{ +- symbolCount = 0; +- symbols << QString(); +-} +- +- +-void KbKey::setKeyName(QString n) +-{ +- keyName = n; +-} +- +- +-void KbKey::addSymbol(QString n, int i) +-{ +- if (!symbols.contains(n)) { +- symbols[i] = n; +- symbolCount++; +- symbols << QString(); +- } +-} +- +- +-QString KbKey::getSymbol(int i) +-{ +- if (i < symbolCount) { +- return symbols[i]; +- } else { +- return QString(); +- } +-} +- +- +-void KbKey::display() +-{ +- qCDebug(KEYBOARD_PREVIEW) << keyName << " : "; +- for (int i = 0; i < symbolCount; i++) { +- qCDebug(KEYBOARD_PREVIEW) << "\t" << symbols[i]; +- } +-} +- +- +-KbLayout::KbLayout() +-{ +- keyCount = 0; +- includeCount = 0; +- level = 4; +- keyList << KbKey(); +- include << QString(); +- parsedSymbol = true; +-} +- +- +-void KbLayout::setName(QString n) +-{ +- name = n; +-} +- +- +-void KbLayout::addInclude(QString n) +-{ +- if (!include.contains(n)) { +- include[includeCount] = n; +- includeCount++; +- include << QString(); +- } +-} +- +- +-void KbLayout :: addKey() +-{ +- keyCount++; +- keyList << KbKey(); +-} +- +- +-QString KbLayout :: getInclude(int i) +-{ +- if (i < includeCount) { +- return include[i]; +- } else { +- return QString(); +- } +-} +- +- +-int KbLayout :: findKey(QString n) +-{ +- for (int i = 0 ; i < keyCount ; i++) { +- if (keyList[i].keyName == n) { +- return i; +- } +- } +- return -1; +-} +- +- +-void KbLayout::display() +-{ +-// qCDebug(KEYBOARD_PREVIEW) << name << "\n"; +-// for(int i = 0; i<includeCount; i++){ +-// qCDebug(KEYBOARD_PREVIEW) << include[i]; +-// } +- for (int i = 0 ; i < keyCount; i++) { +- keyList[i].display(); +- } +-} +diff --git a/plugins/devices/keyboard/preview/keyboardlayout.h b/plugins/devices/keyboard/preview/keyboardlayout.h +deleted file mode 100644 +index bd31e59..0000000 +--- a/plugins/devices/keyboard/preview/keyboardlayout.h ++++ /dev/null +@@ -1,115 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#ifndef KEYBOARDLAYOUT_NEW_H +-#define KEYBOARDLAYOUT_NEW_H +- +-#include "keyaliases.h" +- +-#include <QString> +-#include <QStringList> +-#include <QList> +-#include <QLoggingCategory> +- +- +-Q_DECLARE_LOGGING_CATEGORY(KEYBOARD_PREVIEW) +- +- +-class KbKey +-{ +-private: +- QList<QString> symbols; +- int symbolCount; +- +-public: +- QString keyName; +- +- KbKey(); +- +- void setKeyName(QString n); +- void addSymbol(QString n, int i); +- QString getSymbol(int i); +- +- int getSymbolCount() +- { +- return symbolCount; +- } +- +- void display(); +-}; +- +- +-class KbLayout +-{ +-private: +- QList<QString> include; +- QString name; +- int keyCount, includeCount, level; +- bool parsedSymbol; +- +-public: +- QList <KbKey> keyList; +- QString country; +- +- KbLayout(); +- +- void setName(QString n); +- void addInclude(QString n); +- void addKey(); +- QString getInclude(int i); +- int findKey(QString n); +- +- void setLevel(int lvl) +- { +- level = lvl; +- } +- +- int getLevel() +- { +- return level; +- } +- +- int getKeyCount() +- { +- return keyCount; +- } +- +- int getIncludeCount() +- { +- return includeCount; +- } +- +- QString getLayoutName() const +- { +- return name; +- } +- +- void setParsedSymbol(bool state) +- { +- parsedSymbol = state; +- } +- +- bool getParsedSymbol() +- { +- return parsedSymbol; +- } +- +- void display(); +-}; +- +-#endif //KEYBOARDLAYOUT_NEW_H +diff --git a/plugins/devices/keyboard/preview/keyboardpainter.cpp b/plugins/devices/keyboard/preview/keyboardpainter.cpp +deleted file mode 100644 +index 108b2ef..0000000 +--- a/plugins/devices/keyboard/preview/keyboardpainter.cpp ++++ /dev/null +@@ -1,103 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#include "keyboardpainter.h" +-#include "geometry_components.h" +- +-#include <QVBoxLayout> +-#include <QPushButton> +-#include <QComboBox> +-#include <QDebug> +- +- +-KeyboardPainter::KeyboardPainter(): +- kbDialog(new QDialog(this)), +- kbframe(new KbPreviewFrame(this)), +- exitButton(new QPushButton(tr("Close"), this)), +- levelBox(new QComboBox(this)) +-{ +- this->setFixedSize(1250, 600); +- kbframe->setFixedSize(1100, 490); +- exitButton->setFixedSize(120, 30); +- levelBox->setFixedSize(360, 30); +- +- QVBoxLayout *vLayout = new QVBoxLayout(this); +- QHBoxLayout *hLayout = new QHBoxLayout(); +- +- hLayout->addWidget(exitButton, 0, Qt::AlignLeft); +- hLayout->addWidget(levelBox, 0, Qt::AlignRight); +- hLayout->addSpacing(30); +- +- vLayout->addWidget(kbframe); +- vLayout->addLayout(hLayout); +- +- connect(exitButton, &QPushButton::clicked, this, &KeyboardPainter::close); +- connect(levelBox, SIGNAL(activated(int)), this, SLOT(levelChanged(int))); +- +- setWindowTitle(kbframe->getLayoutName()); +- levelBox->setVisible(false); +-} +- +- +-void KeyboardPainter::generateKeyboardLayout(const QString &layout, const QString &variant, const QString &model, const QString &title) +-{ +- kbframe->generateKeyboardLayout(layout, variant, model); +- kbframe->setFixedSize(getWidth(), getHeight()); +- kbDialog->setFixedSize(getWidth(), getWidth()); +- setWindowTitle(title); +- +- int level = kbframe->getLevel(); +- +- if (level > 4) { +- levelBox->addItem(tr("Keyboard layout levels"), (tr("Level %1, %2").arg(3, 4))); +- for (int i = 5; i <= level; i += 2) { +- levelBox->addItem(tr("Keyboard layout levels"), (tr("Level %1, %2").arg(i, i + 1))); +- } +- } else { +- levelBox->setVisible(false); +- } +-} +- +-void KeyboardPainter::levelChanged(int l_id) +-{ +- kbframe->setL_id(l_id); +-} +- +-int KeyboardPainter::getHeight() +-{ +- int height = kbframe->getHeight(); +- height = kbframe->getScaleFactor() * height + 50; +- return height; +-} +- +-int KeyboardPainter::getWidth() +-{ +- int width = kbframe->getWidth(); +- width = kbframe->getScaleFactor() * width + 20; +- return width; +-} +- +-KeyboardPainter::~KeyboardPainter() +-{ +- delete kbframe; +- kbframe = nullptr; +- delete exitButton; +- exitButton = nullptr; +- delete levelBox; +- levelBox = nullptr; +-} +diff --git a/plugins/devices/keyboard/preview/keyboardpainter.h b/plugins/devices/keyboard/preview/keyboardpainter.h +deleted file mode 100644 +index 4e100d2..0000000 +--- a/plugins/devices/keyboard/preview/keyboardpainter.h ++++ /dev/null +@@ -1,51 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +- +-#ifndef KEYBOARDPAINTER_H +-#define KEYBOARDPAINTER_H +- +-#include "kbpreviewframe.h" +- +-#include <QDialog> +- +-class QPushButton; +-class QComboBox; +- +-class KeyboardPainter : public QDialog +-{ +- Q_OBJECT +- +-public: +- explicit KeyboardPainter(); +- ~KeyboardPainter() override; +- void generateKeyboardLayout(const QString &layout, const QString &variant, const QString &model, const QString &title); +- int getHeight(); +- int getWidth(); +- +-public Q_SLOTS: +- void levelChanged(int l_id); +- +-private: +- QDialog *kbDialog; +- KbPreviewFrame *kbframe; +- QPushButton *exitButton; +- QComboBox *levelBox; +-}; +- +-#endif // KEYBOARDPAINTER_H +diff --git a/plugins/devices/keyboard/preview/keysym2ucs.cpp b/plugins/devices/keyboard/preview/keysym2ucs.cpp +deleted file mode 100644 +index 5d0125d..0000000 +--- a/plugins/devices/keyboard/preview/keysym2ucs.cpp ++++ /dev/null +@@ -1,901 +0,0 @@ +-/* +- * Copyright (C) 2010 Andriy Rysin (rysin@kde.org) +- * +- * 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 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-/* $XFree86$ +- * This module converts keysym values into the corresponding ISO 10646-1 +- * (UCS, Unicode) values. +- * +- * The array keysymtab[] contains pairs of X11 keysym values for graphical +- * characters and the corresponding Unicode value. The function +- * keysym2ucs() maps a keysym onto a Unicode value using a binary search, +- * therefore keysymtab[] must remain SORTED by keysym value. +- * +- * The keysym -> UTF-8 conversion will hopefully one day be provided +- * by Xlib via XmbLookupString() and should ideally not have to be +- * done in X applications. But we are not there yet. +- * +- * We allow to represent any UCS character in the range U+00000000 to +- * U+00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff. +- * This admittedly does not cover the entire 31-bit space of UCS, but +- * it does cover all of the characters up to U+10FFFF, which can be +- * represented by UTF-16, and more, and it is very unlikely that higher +- * UCS codes will ever be assigned by ISO. So to get Unicode character +- * U+ABCD you can directly use keysym 0x1000abcd. +- * +- * NOTE: The comments in the table below contain the actual character +- * encoded in UTF-8, so for viewing and editing best use an editor in +- * UTF-8 mode. +- * +- * Author: Markus G. Kuhn <mkuhn@acm.org>, University of Cambridge, June 1999 +- * +- * Special thanks to Richard Verhoeven <river@win.tue.nl> for preparing +- * an initial draft of the mapping table. +- */ +- +-#include "keysym2ucs.h" +- +-struct codepair { +- unsigned short keysym; +- unsigned short ucs; +-} keysymtab[] = { +- { 0x01a1, 0x0104 }, /* Aogonek Ą LATIN CAPITAL LETTER A WITH OGONEK */ +- { 0x01a2, 0x02d8 }, /* breve ˘ BREVE */ +- { 0x01a3, 0x0141 }, /* Lstroke Ł LATIN CAPITAL LETTER L WITH STROKE */ +- { 0x01a5, 0x013d }, /* Lcaron Ľ LATIN CAPITAL LETTER L WITH CARON */ +- { 0x01a6, 0x015a }, /* Sacute Ś LATIN CAPITAL LETTER S WITH ACUTE */ +- { 0x01a9, 0x0160 }, /* Scaron Š LATIN CAPITAL LETTER S WITH CARON */ +- { 0x01aa, 0x015e }, /* Scedilla Ş LATIN CAPITAL LETTER S WITH CEDILLA */ +- { 0x01ab, 0x0164 }, /* Tcaron Ť LATIN CAPITAL LETTER T WITH CARON */ +- { 0x01ac, 0x0179 }, /* Zacute Ź LATIN CAPITAL LETTER Z WITH ACUTE */ +- { 0x01ae, 0x017d }, /* Zcaron Ž LATIN CAPITAL LETTER Z WITH CARON */ +- { 0x01af, 0x017b }, /* Zabovedot Ż LATIN CAPITAL LETTER Z WITH DOT ABOVE */ +- { 0x01b1, 0x0105 }, /* aogonek ą LATIN SMALL LETTER A WITH OGONEK */ +- { 0x01b2, 0x02db }, /* ogonek ˛ OGONEK */ +- { 0x01b3, 0x0142 }, /* lstroke ł LATIN SMALL LETTER L WITH STROKE */ +- { 0x01b5, 0x013e }, /* lcaron ľ LATIN SMALL LETTER L WITH CARON */ +- { 0x01b6, 0x015b }, /* sacute ś LATIN SMALL LETTER S WITH ACUTE */ +- { 0x01b7, 0x02c7 }, /* caron ˇ CARON */ +- { 0x01b9, 0x0161 }, /* scaron š LATIN SMALL LETTER S WITH CARON */ +- { 0x01ba, 0x015f }, /* scedilla ş LATIN SMALL LETTER S WITH CEDILLA */ +- { 0x01bb, 0x0165 }, /* tcaron ť LATIN SMALL LETTER T WITH CARON */ +- { 0x01bc, 0x017a }, /* zacute ź LATIN SMALL LETTER Z WITH ACUTE */ +- { 0x01bd, 0x02dd }, /* doubleacute ˝ DOUBLE ACUTE ACCENT */ +- { 0x01be, 0x017e }, /* zcaron ž LATIN SMALL LETTER Z WITH CARON */ +- { 0x01bf, 0x017c }, /* zabovedot ż LATIN SMALL LETTER Z WITH DOT ABOVE */ +- { 0x01c0, 0x0154 }, /* Racute Ŕ LATIN CAPITAL LETTER R WITH ACUTE */ +- { 0x01c3, 0x0102 }, /* Abreve Ă LATIN CAPITAL LETTER A WITH BREVE */ +- { 0x01c5, 0x0139 }, /* Lacute Ĺ LATIN CAPITAL LETTER L WITH ACUTE */ +- { 0x01c6, 0x0106 }, /* Cacute Ć LATIN CAPITAL LETTER C WITH ACUTE */ +- { 0x01c8, 0x010c }, /* Ccaron Č LATIN CAPITAL LETTER C WITH CARON */ +- { 0x01ca, 0x0118 }, /* Eogonek Ę LATIN CAPITAL LETTER E WITH OGONEK */ +- { 0x01cc, 0x011a }, /* Ecaron Ě LATIN CAPITAL LETTER E WITH CARON */ +- { 0x01cf, 0x010e }, /* Dcaron Ď LATIN CAPITAL LETTER D WITH CARON */ +- { 0x01d0, 0x0110 }, /* Dstroke Đ LATIN CAPITAL LETTER D WITH STROKE */ +- { 0x01d1, 0x0143 }, /* Nacute Ń LATIN CAPITAL LETTER N WITH ACUTE */ +- { 0x01d2, 0x0147 }, /* Ncaron Ň LATIN CAPITAL LETTER N WITH CARON */ +- { 0x01d5, 0x0150 }, /* Odoubleacute Ő LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ +- { 0x01d8, 0x0158 }, /* Rcaron Ř LATIN CAPITAL LETTER R WITH CARON */ +- { 0x01d9, 0x016e }, /* Uring Ů LATIN CAPITAL LETTER U WITH RING ABOVE */ +- { 0x01db, 0x0170 }, /* Udoubleacute Ű LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ +- { 0x01de, 0x0162 }, /* Tcedilla Ţ LATIN CAPITAL LETTER T WITH CEDILLA */ +- { 0x01e0, 0x0155 }, /* racute ŕ LATIN SMALL LETTER R WITH ACUTE */ +- { 0x01e3, 0x0103 }, /* abreve ă LATIN SMALL LETTER A WITH BREVE */ +- { 0x01e5, 0x013a }, /* lacute ĺ LATIN SMALL LETTER L WITH ACUTE */ +- { 0x01e6, 0x0107 }, /* cacute ć LATIN SMALL LETTER C WITH ACUTE */ +- { 0x01e8, 0x010d }, /* ccaron č LATIN SMALL LETTER C WITH CARON */ +- { 0x01ea, 0x0119 }, /* eogonek ę LATIN SMALL LETTER E WITH OGONEK */ +- { 0x01ec, 0x011b }, /* ecaron ě LATIN SMALL LETTER E WITH CARON */ +- { 0x01ef, 0x010f }, /* dcaron ď LATIN SMALL LETTER D WITH CARON */ +- { 0x01f0, 0x0111 }, /* dstroke đ LATIN SMALL LETTER D WITH STROKE */ +- { 0x01f1, 0x0144 }, /* nacute ń LATIN SMALL LETTER N WITH ACUTE */ +- { 0x01f2, 0x0148 }, /* ncaron ň LATIN SMALL LETTER N WITH CARON */ +- { 0x01f5, 0x0151 }, /* odoubleacute ő LATIN SMALL LETTER O WITH DOUBLE ACUTE */ +- { 0x01f8, 0x0159 }, /* rcaron ř LATIN SMALL LETTER R WITH CARON */ +- { 0x01f9, 0x016f }, /* uring ů LATIN SMALL LETTER U WITH RING ABOVE */ +- { 0x01fb, 0x0171 }, /* udoubleacute ű LATIN SMALL LETTER U WITH DOUBLE ACUTE */ +- { 0x01fe, 0x0163 }, /* tcedilla ţ LATIN SMALL LETTER T WITH CEDILLA */ +- { 0x01ff, 0x02d9 }, /* abovedot ˙ DOT ABOVE */ +- { 0x02a1, 0x0126 }, /* Hstroke Ħ LATIN CAPITAL LETTER H WITH STROKE */ +- { 0x02a6, 0x0124 }, /* Hcircumflex Ĥ LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ +- { 0x02a9, 0x0130 }, /* Iabovedot İ LATIN CAPITAL LETTER I WITH DOT ABOVE */ +- { 0x02ab, 0x011e }, /* Gbreve Ğ LATIN CAPITAL LETTER G WITH BREVE */ +- { 0x02ac, 0x0134 }, /* Jcircumflex Ĵ LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ +- { 0x02b1, 0x0127 }, /* hstroke ħ LATIN SMALL LETTER H WITH STROKE */ +- { 0x02b6, 0x0125 }, /* hcircumflex ĥ LATIN SMALL LETTER H WITH CIRCUMFLEX */ +- { 0x02b9, 0x0131 }, /* idotless ı LATIN SMALL LETTER DOTLESS I */ +- { 0x02bb, 0x011f }, /* gbreve ğ LATIN SMALL LETTER G WITH BREVE */ +- { 0x02bc, 0x0135 }, /* jcircumflex ĵ LATIN SMALL LETTER J WITH CIRCUMFLEX */ +- { 0x02c5, 0x010a }, /* Cabovedot Ċ LATIN CAPITAL LETTER C WITH DOT ABOVE */ +- { 0x02c6, 0x0108 }, /* Ccircumflex Ĉ LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ +- { 0x02d5, 0x0120 }, /* Gabovedot Ġ LATIN CAPITAL LETTER G WITH DOT ABOVE */ +- { 0x02d8, 0x011c }, /* Gcircumflex Ĝ LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ +- { 0x02dd, 0x016c }, /* Ubreve Ŭ LATIN CAPITAL LETTER U WITH BREVE */ +- { 0x02de, 0x015c }, /* Scircumflex Ŝ LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ +- { 0x02e5, 0x010b }, /* cabovedot ċ LATIN SMALL LETTER C WITH DOT ABOVE */ +- { 0x02e6, 0x0109 }, /* ccircumflex ĉ LATIN SMALL LETTER C WITH CIRCUMFLEX */ +- { 0x02f5, 0x0121 }, /* gabovedot ġ LATIN SMALL LETTER G WITH DOT ABOVE */ +- { 0x02f8, 0x011d }, /* gcircumflex ĝ LATIN SMALL LETTER G WITH CIRCUMFLEX */ +- { 0x02fd, 0x016d }, /* ubreve ŭ LATIN SMALL LETTER U WITH BREVE */ +- { 0x02fe, 0x015d }, /* scircumflex ŝ LATIN SMALL LETTER S WITH CIRCUMFLEX */ +- { 0x03a2, 0x0138 }, /* kra ĸ LATIN SMALL LETTER KRA */ +- { 0x03a3, 0x0156 }, /* Rcedilla Ŗ LATIN CAPITAL LETTER R WITH CEDILLA */ +- { 0x03a5, 0x0128 }, /* Itilde Ĩ LATIN CAPITAL LETTER I WITH TILDE */ +- { 0x03a6, 0x013b }, /* Lcedilla Ļ LATIN CAPITAL LETTER L WITH CEDILLA */ +- { 0x03aa, 0x0112 }, /* Emacron Ē LATIN CAPITAL LETTER E WITH MACRON */ +- { 0x03ab, 0x0122 }, /* Gcedilla Ģ LATIN CAPITAL LETTER G WITH CEDILLA */ +- { 0x03ac, 0x0166 }, /* Tslash Ŧ LATIN CAPITAL LETTER T WITH STROKE */ +- { 0x03b3, 0x0157 }, /* rcedilla ŗ LATIN SMALL LETTER R WITH CEDILLA */ +- { 0x03b5, 0x0129 }, /* itilde ĩ LATIN SMALL LETTER I WITH TILDE */ +- { 0x03b6, 0x013c }, /* lcedilla ļ LATIN SMALL LETTER L WITH CEDILLA */ +- { 0x03ba, 0x0113 }, /* emacron ē LATIN SMALL LETTER E WITH MACRON */ +- { 0x03bb, 0x0123 }, /* gcedilla ģ LATIN SMALL LETTER G WITH CEDILLA */ +- { 0x03bc, 0x0167 }, /* tslash ŧ LATIN SMALL LETTER T WITH STROKE */ +- { 0x03bd, 0x014a }, /* ENG Ŋ LATIN CAPITAL LETTER ENG */ +- { 0x03bf, 0x014b }, /* eng ŋ LATIN SMALL LETTER ENG */ +- { 0x03c0, 0x0100 }, /* Amacron Ā LATIN CAPITAL LETTER A WITH MACRON */ +- { 0x03c7, 0x012e }, /* Iogonek Į LATIN CAPITAL LETTER I WITH OGONEK */ +- { 0x03cc, 0x0116 }, /* Eabovedot Ė LATIN CAPITAL LETTER E WITH DOT ABOVE */ +- { 0x03cf, 0x012a }, /* Imacron Ī LATIN CAPITAL LETTER I WITH MACRON */ +- { 0x03d1, 0x0145 }, /* Ncedilla Ņ LATIN CAPITAL LETTER N WITH CEDILLA */ +- { 0x03d2, 0x014c }, /* Omacron Ō LATIN CAPITAL LETTER O WITH MACRON */ +- { 0x03d3, 0x0136 }, /* Kcedilla Ķ LATIN CAPITAL LETTER K WITH CEDILLA */ +- { 0x03d9, 0x0172 }, /* Uogonek Ų LATIN CAPITAL LETTER U WITH OGONEK */ +- { 0x03dd, 0x0168 }, /* Utilde Ũ LATIN CAPITAL LETTER U WITH TILDE */ +- { 0x03de, 0x016a }, /* Umacron Ū LATIN CAPITAL LETTER U WITH MACRON */ +- { 0x03e0, 0x0101 }, /* amacron ā LATIN SMALL LETTER A WITH MACRON */ +- { 0x03e7, 0x012f }, /* iogonek į LATIN SMALL LETTER I WITH OGONEK */ +- { 0x03ec, 0x0117 }, /* eabovedot ė LATIN SMALL LETTER E WITH DOT ABOVE */ +- { 0x03ef, 0x012b }, /* imacron ī LATIN SMALL LETTER I WITH MACRON */ +- { 0x03f1, 0x0146 }, /* ncedilla ņ LATIN SMALL LETTER N WITH CEDILLA */ +- { 0x03f2, 0x014d }, /* omacron ō LATIN SMALL LETTER O WITH MACRON */ +- { 0x03f3, 0x0137 }, /* kcedilla ķ LATIN SMALL LETTER K WITH CEDILLA */ +- { 0x03f9, 0x0173 }, /* uogonek ų LATIN SMALL LETTER U WITH OGONEK */ +- { 0x03fd, 0x0169 }, /* utilde ũ LATIN SMALL LETTER U WITH TILDE */ +- { 0x03fe, 0x016b }, /* umacron ū LATIN SMALL LETTER U WITH MACRON */ +- { 0x047e, 0x203e }, /* overline ‾ OVERLINE */ +- { 0x04a1, 0x3002 }, /* kana_fullstop 。 IDEOGRAPHIC FULL STOP */ +- { 0x04a2, 0x300c }, /* kana_openingbracket 「 LEFT CORNER BRACKET */ +- { 0x04a3, 0x300d }, /* kana_closingbracket 」 RIGHT CORNER BRACKET */ +- { 0x04a4, 0x3001 }, /* kana_comma 、 IDEOGRAPHIC COMMA */ +- { 0x04a5, 0x30fb }, /* kana_conjunctive ・ KATAKANA MIDDLE DOT */ +- { 0x04a6, 0x30f2 }, /* kana_WO ヲ KATAKANA LETTER WO */ +- { 0x04a7, 0x30a1 }, /* kana_a ァ KATAKANA LETTER SMALL A */ +- { 0x04a8, 0x30a3 }, /* kana_i ィ KATAKANA LETTER SMALL I */ +- { 0x04a9, 0x30a5 }, /* kana_u ゥ KATAKANA LETTER SMALL U */ +- { 0x04aa, 0x30a7 }, /* kana_e ェ KATAKANA LETTER SMALL E */ +- { 0x04ab, 0x30a9 }, /* kana_o ォ KATAKANA LETTER SMALL O */ +- { 0x04ac, 0x30e3 }, /* kana_ya ャ KATAKANA LETTER SMALL YA */ +- { 0x04ad, 0x30e5 }, /* kana_yu ュ KATAKANA LETTER SMALL YU */ +- { 0x04ae, 0x30e7 }, /* kana_yo ョ KATAKANA LETTER SMALL YO */ +- { 0x04af, 0x30c3 }, /* kana_tsu ッ KATAKANA LETTER SMALL TU */ +- { 0x04b0, 0x30fc }, /* prolongedsound ー KATAKANA-HIRAGANA PROLONGED SOUND MARK */ +- { 0x04b1, 0x30a2 }, /* kana_A ア KATAKANA LETTER A */ +- { 0x04b2, 0x30a4 }, /* kana_I イ KATAKANA LETTER I */ +- { 0x04b3, 0x30a6 }, /* kana_U ウ KATAKANA LETTER U */ +- { 0x04b4, 0x30a8 }, /* kana_E エ KATAKANA LETTER E */ +- { 0x04b5, 0x30aa }, /* kana_O オ KATAKANA LETTER O */ +- { 0x04b6, 0x30ab }, /* kana_KA カ KATAKANA LETTER KA */ +- { 0x04b7, 0x30ad }, /* kana_KI キ KATAKANA LETTER KI */ +- { 0x04b8, 0x30af }, /* kana_KU ク KATAKANA LETTER KU */ +- { 0x04b9, 0x30b1 }, /* kana_KE ケ KATAKANA LETTER KE */ +- { 0x04ba, 0x30b3 }, /* kana_KO コ KATAKANA LETTER KO */ +- { 0x04bb, 0x30b5 }, /* kana_SA サ KATAKANA LETTER SA */ +- { 0x04bc, 0x30b7 }, /* kana_SHI シ KATAKANA LETTER SI */ +- { 0x04bd, 0x30b9 }, /* kana_SU ス KATAKANA LETTER SU */ +- { 0x04be, 0x30bb }, /* kana_SE セ KATAKANA LETTER SE */ +- { 0x04bf, 0x30bd }, /* kana_SO ソ KATAKANA LETTER SO */ +- { 0x04c0, 0x30bf }, /* kana_TA タ KATAKANA LETTER TA */ +- { 0x04c1, 0x30c1 }, /* kana_CHI チ KATAKANA LETTER TI */ +- { 0x04c2, 0x30c4 }, /* kana_TSU ツ KATAKANA LETTER TU */ +- { 0x04c3, 0x30c6 }, /* kana_TE テ KATAKANA LETTER TE */ +- { 0x04c4, 0x30c8 }, /* kana_TO ト KATAKANA LETTER TO */ +- { 0x04c5, 0x30ca }, /* kana_NA ナ KATAKANA LETTER NA */ +- { 0x04c6, 0x30cb }, /* kana_NI ニ KATAKANA LETTER NI */ +- { 0x04c7, 0x30cc }, /* kana_NU ヌ KATAKANA LETTER NU */ +- { 0x04c8, 0x30cd }, /* kana_NE ネ KATAKANA LETTER NE */ +- { 0x04c9, 0x30ce }, /* kana_NO ノ KATAKANA LETTER NO */ +- { 0x04ca, 0x30cf }, /* kana_HA ハ KATAKANA LETTER HA */ +- { 0x04cb, 0x30d2 }, /* kana_HI ヒ KATAKANA LETTER HI */ +- { 0x04cc, 0x30d5 }, /* kana_FU フ KATAKANA LETTER HU */ +- { 0x04cd, 0x30d8 }, /* kana_HE ヘ KATAKANA LETTER HE */ +- { 0x04ce, 0x30db }, /* kana_HO ホ KATAKANA LETTER HO */ +- { 0x04cf, 0x30de }, /* kana_MA マ KATAKANA LETTER MA */ +- { 0x04d0, 0x30df }, /* kana_MI ミ KATAKANA LETTER MI */ +- { 0x04d1, 0x30e0 }, /* kana_MU ム KATAKANA LETTER MU */ +- { 0x04d2, 0x30e1 }, /* kana_ME メ KATAKANA LETTER ME */ +- { 0x04d3, 0x30e2 }, /* kana_MO モ KATAKANA LETTER MO */ +- { 0x04d4, 0x30e4 }, /* kana_YA ヤ KATAKANA LETTER YA */ +- { 0x04d5, 0x30e6 }, /* kana_YU ユ KATAKANA LETTER YU */ +- { 0x04d6, 0x30e8 }, /* kana_YO ヨ KATAKANA LETTER YO */ +- { 0x04d7, 0x30e9 }, /* kana_RA ラ KATAKANA LETTER RA */ +- { 0x04d8, 0x30ea }, /* kana_RI リ KATAKANA LETTER RI */ +- { 0x04d9, 0x30eb }, /* kana_RU ル KATAKANA LETTER RU */ +- { 0x04da, 0x30ec }, /* kana_RE レ KATAKANA LETTER RE */ +- { 0x04db, 0x30ed }, /* kana_RO ロ KATAKANA LETTER RO */ +- { 0x04dc, 0x30ef }, /* kana_WA ワ KATAKANA LETTER WA */ +- { 0x04dd, 0x30f3 }, /* kana_N ン KATAKANA LETTER N */ +- { 0x04de, 0x309b }, /* voicedsound ゛ KATAKANA-HIRAGANA VOICED SOUND MARK */ +- { 0x04df, 0x309c }, /* semivoicedsound ゜ KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ +- { 0x05ac, 0x060c }, /* Arabic_comma ، ARABIC COMMA */ +- { 0x05bb, 0x061b }, /* Arabic_semicolon ؛ ARABIC SEMICOLON */ +- { 0x05bf, 0x061f }, /* Arabic_question_mark ؟ ARABIC QUESTION MARK */ +- { 0x05c1, 0x0621 }, /* Arabic_hamza ء ARABIC LETTER HAMZA */ +- { 0x05c2, 0x0622 }, /* Arabic_maddaonalef آ ARABIC LETTER ALEF WITH MADDA ABOVE */ +- { 0x05c3, 0x0623 }, /* Arabic_hamzaonalef أ ARABIC LETTER ALEF WITH HAMZA ABOVE */ +- { 0x05c4, 0x0624 }, /* Arabic_hamzaonwaw ؤ ARABIC LETTER WAW WITH HAMZA ABOVE */ +- { 0x05c5, 0x0625 }, /* Arabic_hamzaunderalef إ ARABIC LETTER ALEF WITH HAMZA BELOW */ +- { 0x05c6, 0x0626 }, /* Arabic_hamzaonyeh ئ ARABIC LETTER YEH WITH HAMZA ABOVE */ +- { 0x05c7, 0x0627 }, /* Arabic_alef ا ARABIC LETTER ALEF */ +- { 0x05c8, 0x0628 }, /* Arabic_beh ب ARABIC LETTER BEH */ +- { 0x05c9, 0x0629 }, /* Arabic_tehmarbuta ة ARABIC LETTER TEH MARBUTA */ +- { 0x05ca, 0x062a }, /* Arabic_teh ت ARABIC LETTER TEH */ +- { 0x05cb, 0x062b }, /* Arabic_theh ث ARABIC LETTER THEH */ +- { 0x05cc, 0x062c }, /* Arabic_jeem ج ARABIC LETTER JEEM */ +- { 0x05cd, 0x062d }, /* Arabic_hah ح ARABIC LETTER HAH */ +- { 0x05ce, 0x062e }, /* Arabic_khah خ ARABIC LETTER KHAH */ +- { 0x05cf, 0x062f }, /* Arabic_dal د ARABIC LETTER DAL */ +- { 0x05d0, 0x0630 }, /* Arabic_thal ذ ARABIC LETTER THAL */ +- { 0x05d1, 0x0631 }, /* Arabic_ra ر ARABIC LETTER REH */ +- { 0x05d2, 0x0632 }, /* Arabic_zain ز ARABIC LETTER ZAIN */ +- { 0x05d3, 0x0633 }, /* Arabic_seen س ARABIC LETTER SEEN */ +- { 0x05d4, 0x0634 }, /* Arabic_sheen ش ARABIC LETTER SHEEN */ +- { 0x05d5, 0x0635 }, /* Arabic_sad ص ARABIC LETTER SAD */ +- { 0x05d6, 0x0636 }, /* Arabic_dad ض ARABIC LETTER DAD */ +- { 0x05d7, 0x0637 }, /* Arabic_tah ط ARABIC LETTER TAH */ +- { 0x05d8, 0x0638 }, /* Arabic_zah ظ ARABIC LETTER ZAH */ +- { 0x05d9, 0x0639 }, /* Arabic_ain ع ARABIC LETTER AIN */ +- { 0x05da, 0x063a }, /* Arabic_ghain غ ARABIC LETTER GHAIN */ +- { 0x05e0, 0x0640 }, /* Arabic_tatweel ـ ARABIC TATWEEL */ +- { 0x05e1, 0x0641 }, /* Arabic_feh ف ARABIC LETTER FEH */ +- { 0x05e2, 0x0642 }, /* Arabic_qaf ق ARABIC LETTER QAF */ +- { 0x05e3, 0x0643 }, /* Arabic_kaf ك ARABIC LETTER KAF */ +- { 0x05e4, 0x0644 }, /* Arabic_lam ل ARABIC LETTER LAM */ +- { 0x05e5, 0x0645 }, /* Arabic_meem م ARABIC LETTER MEEM */ +- { 0x05e6, 0x0646 }, /* Arabic_noon ن ARABIC LETTER NOON */ +- { 0x05e7, 0x0647 }, /* Arabic_ha ه ARABIC LETTER HEH */ +- { 0x05e8, 0x0648 }, /* Arabic_waw و ARABIC LETTER WAW */ +- { 0x05e9, 0x0649 }, /* Arabic_alefmaksura ى ARABIC LETTER ALEF MAKSURA */ +- { 0x05ea, 0x064a }, /* Arabic_yeh ي ARABIC LETTER YEH */ +- { 0x05eb, 0x064b }, /* Arabic_fathatan ً ARABIC FATHATAN */ +- { 0x05ec, 0x064c }, /* Arabic_dammatan ٌ ARABIC DAMMATAN */ +- { 0x05ed, 0x064d }, /* Arabic_kasratan ٍ ARABIC KASRATAN */ +- { 0x05ee, 0x064e }, /* Arabic_fatha َ ARABIC FATHA */ +- { 0x05ef, 0x064f }, /* Arabic_damma ُ ARABIC DAMMA */ +- { 0x05f0, 0x0650 }, /* Arabic_kasra ِ ARABIC KASRA */ +- { 0x05f1, 0x0651 }, /* Arabic_shadda ّ ARABIC SHADDA */ +- { 0x05f2, 0x0652 }, /* Arabic_sukun ْ ARABIC SUKUN */ +- { 0x06a1, 0x0452 }, /* Serbian_dje ђ CYRILLIC SMALL LETTER DJE */ +- { 0x06a2, 0x0453 }, /* Macedonia_gje ѓ CYRILLIC SMALL LETTER GJE */ +- { 0x06a3, 0x0451 }, /* Cyrillic_io ё CYRILLIC SMALL LETTER IO */ +- { 0x06a4, 0x0454 }, /* Ukrainian_ie є CYRILLIC SMALL LETTER UKRAINIAN IE */ +- { 0x06a5, 0x0455 }, /* Macedonia_dse ѕ CYRILLIC SMALL LETTER DZE */ +- { 0x06a6, 0x0456 }, /* Ukrainian_i і CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ +- { 0x06a7, 0x0457 }, /* Ukrainian_yi ї CYRILLIC SMALL LETTER YI */ +- { 0x06a8, 0x0458 }, /* Cyrillic_je ј CYRILLIC SMALL LETTER JE */ +- { 0x06a9, 0x0459 }, /* Cyrillic_lje љ CYRILLIC SMALL LETTER LJE */ +- { 0x06aa, 0x045a }, /* Cyrillic_nje њ CYRILLIC SMALL LETTER NJE */ +- { 0x06ab, 0x045b }, /* Serbian_tshe ћ CYRILLIC SMALL LETTER TSHE */ +- { 0x06ac, 0x045c }, /* Macedonia_kje ќ CYRILLIC SMALL LETTER KJE */ +- { 0x06ad, 0x0491 }, /* Ukrainian_ghe_with_upturn ґ CYRILLIC SMALL LETTER GHE WITH UPTURN */ +- { 0x06ae, 0x045e }, /* Byelorussian_shortu ў CYRILLIC SMALL LETTER SHORT U */ +- { 0x06af, 0x045f }, /* Cyrillic_dzhe џ CYRILLIC SMALL LETTER DZHE */ +- { 0x06b0, 0x2116 }, /* numerosign № NUMERO SIGN */ +- { 0x06b1, 0x0402 }, /* Serbian_DJE Ђ CYRILLIC CAPITAL LETTER DJE */ +- { 0x06b2, 0x0403 }, /* Macedonia_GJE Ѓ CYRILLIC CAPITAL LETTER GJE */ +- { 0x06b3, 0x0401 }, /* Cyrillic_IO Ё CYRILLIC CAPITAL LETTER IO */ +- { 0x06b4, 0x0404 }, /* Ukrainian_IE Є CYRILLIC CAPITAL LETTER UKRAINIAN IE */ +- { 0x06b5, 0x0405 }, /* Macedonia_DSE Ѕ CYRILLIC CAPITAL LETTER DZE */ +- { 0x06b6, 0x0406 }, /* Ukrainian_I І CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ +- { 0x06b7, 0x0407 }, /* Ukrainian_YI Ї CYRILLIC CAPITAL LETTER YI */ +- { 0x06b8, 0x0408 }, /* Cyrillic_JE Ј CYRILLIC CAPITAL LETTER JE */ +- { 0x06b9, 0x0409 }, /* Cyrillic_LJE Љ CYRILLIC CAPITAL LETTER LJE */ +- { 0x06ba, 0x040a }, /* Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE */ +- { 0x06bb, 0x040b }, /* Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE */ +- { 0x06bc, 0x040c }, /* Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE */ +- { 0x06bd, 0x0490 }, /* Ukrainian_GHE_WITH_UPTURN Ґ CYRILLIC CAPITAL LETTER GHE WITH UPTURN */ +- { 0x06be, 0x040e }, /* Byelorussian_SHORTU Ў CYRILLIC CAPITAL LETTER SHORT U */ +- { 0x06bf, 0x040f }, /* Cyrillic_DZHE Џ CYRILLIC CAPITAL LETTER DZHE */ +- { 0x06c0, 0x044e }, /* Cyrillic_yu ю CYRILLIC SMALL LETTER YU */ +- { 0x06c1, 0x0430 }, /* Cyrillic_a а CYRILLIC SMALL LETTER A */ +- { 0x06c2, 0x0431 }, /* Cyrillic_be б CYRILLIC SMALL LETTER BE */ +- { 0x06c3, 0x0446 }, /* Cyrillic_tse ц CYRILLIC SMALL LETTER TSE */ +- { 0x06c4, 0x0434 }, /* Cyrillic_de д CYRILLIC SMALL LETTER DE */ +- { 0x06c5, 0x0435 }, /* Cyrillic_ie е CYRILLIC SMALL LETTER IE */ +- { 0x06c6, 0x0444 }, /* Cyrillic_ef ф CYRILLIC SMALL LETTER EF */ +- { 0x06c7, 0x0433 }, /* Cyrillic_ghe г CYRILLIC SMALL LETTER GHE */ +- { 0x06c8, 0x0445 }, /* Cyrillic_ha х CYRILLIC SMALL LETTER HA */ +- { 0x06c9, 0x0438 }, /* Cyrillic_i и CYRILLIC SMALL LETTER I */ +- { 0x06ca, 0x0439 }, /* Cyrillic_shorti й CYRILLIC SMALL LETTER SHORT I */ +- { 0x06cb, 0x043a }, /* Cyrillic_ka к CYRILLIC SMALL LETTER KA */ +- { 0x06cc, 0x043b }, /* Cyrillic_el л CYRILLIC SMALL LETTER EL */ +- { 0x06cd, 0x043c }, /* Cyrillic_em м CYRILLIC SMALL LETTER EM */ +- { 0x06ce, 0x043d }, /* Cyrillic_en н CYRILLIC SMALL LETTER EN */ +- { 0x06cf, 0x043e }, /* Cyrillic_o о CYRILLIC SMALL LETTER O */ +- { 0x06d0, 0x043f }, /* Cyrillic_pe п CYRILLIC SMALL LETTER PE */ +- { 0x06d1, 0x044f }, /* Cyrillic_ya я CYRILLIC SMALL LETTER YA */ +- { 0x06d2, 0x0440 }, /* Cyrillic_er р CYRILLIC SMALL LETTER ER */ +- { 0x06d3, 0x0441 }, /* Cyrillic_es с CYRILLIC SMALL LETTER ES */ +- { 0x06d4, 0x0442 }, /* Cyrillic_te т CYRILLIC SMALL LETTER TE */ +- { 0x06d5, 0x0443 }, /* Cyrillic_u у CYRILLIC SMALL LETTER U */ +- { 0x06d6, 0x0436 }, /* Cyrillic_zhe ж CYRILLIC SMALL LETTER ZHE */ +- { 0x06d7, 0x0432 }, /* Cyrillic_ve в CYRILLIC SMALL LETTER VE */ +- { 0x06d8, 0x044c }, /* Cyrillic_softsign ь CYRILLIC SMALL LETTER SOFT SIGN */ +- { 0x06d9, 0x044b }, /* Cyrillic_yeru ы CYRILLIC SMALL LETTER YERU */ +- { 0x06da, 0x0437 }, /* Cyrillic_ze з CYRILLIC SMALL LETTER ZE */ +- { 0x06db, 0x0448 }, /* Cyrillic_sha ш CYRILLIC SMALL LETTER SHA */ +- { 0x06dc, 0x044d }, /* Cyrillic_e э CYRILLIC SMALL LETTER E */ +- { 0x06dd, 0x0449 }, /* Cyrillic_shcha щ CYRILLIC SMALL LETTER SHCHA */ +- { 0x06de, 0x0447 }, /* Cyrillic_che ч CYRILLIC SMALL LETTER CHE */ +- { 0x06df, 0x044a }, /* Cyrillic_hardsign ъ CYRILLIC SMALL LETTER HARD SIGN */ +- { 0x06e0, 0x042e }, /* Cyrillic_YU Ю CYRILLIC CAPITAL LETTER YU */ +- { 0x06e1, 0x0410 }, /* Cyrillic_A А CYRILLIC CAPITAL LETTER A */ +- { 0x06e2, 0x0411 }, /* Cyrillic_BE Б CYRILLIC CAPITAL LETTER BE */ +- { 0x06e3, 0x0426 }, /* Cyrillic_TSE Ц CYRILLIC CAPITAL LETTER TSE */ +- { 0x06e4, 0x0414 }, /* Cyrillic_DE Д CYRILLIC CAPITAL LETTER DE */ +- { 0x06e5, 0x0415 }, /* Cyrillic_IE Е CYRILLIC CAPITAL LETTER IE */ +- { 0x06e6, 0x0424 }, /* Cyrillic_EF Ф CYRILLIC CAPITAL LETTER EF */ +- { 0x06e7, 0x0413 }, /* Cyrillic_GHE Г CYRILLIC CAPITAL LETTER GHE */ +- { 0x06e8, 0x0425 }, /* Cyrillic_HA Х CYRILLIC CAPITAL LETTER HA */ +- { 0x06e9, 0x0418 }, /* Cyrillic_I И CYRILLIC CAPITAL LETTER I */ +- { 0x06ea, 0x0419 }, /* Cyrillic_SHORTI Й CYRILLIC CAPITAL LETTER SHORT I */ +- { 0x06eb, 0x041a }, /* Cyrillic_KA К CYRILLIC CAPITAL LETTER KA */ +- { 0x06ec, 0x041b }, /* Cyrillic_EL Л CYRILLIC CAPITAL LETTER EL */ +- { 0x06ed, 0x041c }, /* Cyrillic_EM М CYRILLIC CAPITAL LETTER EM */ +- { 0x06ee, 0x041d }, /* Cyrillic_EN Н CYRILLIC CAPITAL LETTER EN */ +- { 0x06ef, 0x041e }, /* Cyrillic_O О CYRILLIC CAPITAL LETTER O */ +- { 0x06f0, 0x041f }, /* Cyrillic_PE П CYRILLIC CAPITAL LETTER PE */ +- { 0x06f1, 0x042f }, /* Cyrillic_YA Я CYRILLIC CAPITAL LETTER YA */ +- { 0x06f2, 0x0420 }, /* Cyrillic_ER Р CYRILLIC CAPITAL LETTER ER */ +- { 0x06f3, 0x0421 }, /* Cyrillic_ES С CYRILLIC CAPITAL LETTER ES */ +- { 0x06f4, 0x0422 }, /* Cyrillic_TE Т CYRILLIC CAPITAL LETTER TE */ +- { 0x06f5, 0x0423 }, /* Cyrillic_U У CYRILLIC CAPITAL LETTER U */ +- { 0x06f6, 0x0416 }, /* Cyrillic_ZHE Ж CYRILLIC CAPITAL LETTER ZHE */ +- { 0x06f7, 0x0412 }, /* Cyrillic_VE В CYRILLIC CAPITAL LETTER VE */ +- { 0x06f8, 0x042c }, /* Cyrillic_SOFTSIGN Ь CYRILLIC CAPITAL LETTER SOFT SIGN */ +- { 0x06f9, 0x042b }, /* Cyrillic_YERU Ы CYRILLIC CAPITAL LETTER YERU */ +- { 0x06fa, 0x0417 }, /* Cyrillic_ZE З CYRILLIC CAPITAL LETTER ZE */ +- { 0x06fb, 0x0428 }, /* Cyrillic_SHA Ш CYRILLIC CAPITAL LETTER SHA */ +- { 0x06fc, 0x042d }, /* Cyrillic_E Э CYRILLIC CAPITAL LETTER E */ +- { 0x06fd, 0x0429 }, /* Cyrillic_SHCHA Щ CYRILLIC CAPITAL LETTER SHCHA */ +- { 0x06fe, 0x0427 }, /* Cyrillic_CHE Ч CYRILLIC CAPITAL LETTER CHE */ +- { 0x06ff, 0x042a }, /* Cyrillic_HARDSIGN Ъ CYRILLIC CAPITAL LETTER HARD SIGN */ +- { 0x07a1, 0x0386 }, /* Greek_ALPHAaccent Ά GREEK CAPITAL LETTER ALPHA WITH TONOS */ +- { 0x07a2, 0x0388 }, /* Greek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS */ +- { 0x07a3, 0x0389 }, /* Greek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS */ +- { 0x07a4, 0x038a }, /* Greek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS */ +- { 0x07a5, 0x03aa }, /* Greek_IOTAdiaeresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ +- { 0x07a7, 0x038c }, /* Greek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS */ +- { 0x07a8, 0x038e }, /* Greek_UPSILONaccent Ύ GREEK CAPITAL LETTER UPSILON WITH TONOS */ +- { 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ +- { 0x07ab, 0x038f }, /* Greek_OMEGAaccent Ώ GREEK CAPITAL LETTER OMEGA WITH TONOS */ +- { 0x07ae, 0x0385 }, /* Greek_accentdieresis ΅ GREEK DIALYTIKA TONOS */ +- { 0x07af, 0x2015 }, /* Greek_horizbar ― HORIZONTAL BAR */ +- { 0x07b1, 0x03ac }, /* Greek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS */ +- { 0x07b2, 0x03ad }, /* Greek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS */ +- { 0x07b3, 0x03ae }, /* Greek_etaaccent ή GREEK SMALL LETTER ETA WITH TONOS */ +- { 0x07b4, 0x03af }, /* Greek_iotaaccent ί GREEK SMALL LETTER IOTA WITH TONOS */ +- { 0x07b5, 0x03ca }, /* Greek_iotadieresis ϊ GREEK SMALL LETTER IOTA WITH DIALYTIKA */ +- { 0x07b6, 0x0390 }, /* Greek_iotaaccentdieresis ΐ GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ +- { 0x07b7, 0x03cc }, /* Greek_omicronaccent ό GREEK SMALL LETTER OMICRON WITH TONOS */ +- { 0x07b8, 0x03cd }, /* Greek_upsilonaccent ύ GREEK SMALL LETTER UPSILON WITH TONOS */ +- { 0x07b9, 0x03cb }, /* Greek_upsilondieresis ϋ GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ +- { 0x07ba, 0x03b0 }, /* Greek_upsilonaccentdieresis ΰ GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ +- { 0x07bb, 0x03ce }, /* Greek_omegaaccent ώ GREEK SMALL LETTER OMEGA WITH TONOS */ +- { 0x07c1, 0x0391 }, /* Greek_ALPHA Α GREEK CAPITAL LETTER ALPHA */ +- { 0x07c2, 0x0392 }, /* Greek_BETA Β GREEK CAPITAL LETTER BETA */ +- { 0x07c3, 0x0393 }, /* Greek_GAMMA Γ GREEK CAPITAL LETTER GAMMA */ +- { 0x07c4, 0x0394 }, /* Greek_DELTA Δ GREEK CAPITAL LETTER DELTA */ +- { 0x07c5, 0x0395 }, /* Greek_EPSILON Ε GREEK CAPITAL LETTER EPSILON */ +- { 0x07c6, 0x0396 }, /* Greek_ZETA Ζ GREEK CAPITAL LETTER ZETA */ +- { 0x07c7, 0x0397 }, /* Greek_ETA Η GREEK CAPITAL LETTER ETA */ +- { 0x07c8, 0x0398 }, /* Greek_THETA Θ GREEK CAPITAL LETTER THETA */ +- { 0x07c9, 0x0399 }, /* Greek_IOTA Ι GREEK CAPITAL LETTER IOTA */ +- { 0x07ca, 0x039a }, /* Greek_KAPPA Κ GREEK CAPITAL LETTER KAPPA */ +- { 0x07cb, 0x039b }, /* Greek_LAMBDA Λ GREEK CAPITAL LETTER LAMDA */ +- { 0x07cc, 0x039c }, /* Greek_MU Μ GREEK CAPITAL LETTER MU */ +- { 0x07cd, 0x039d }, /* Greek_NU Ν GREEK CAPITAL LETTER NU */ +- { 0x07ce, 0x039e }, /* Greek_XI Ξ GREEK CAPITAL LETTER XI */ +- { 0x07cf, 0x039f }, /* Greek_OMICRON Ο GREEK CAPITAL LETTER OMICRON */ +- { 0x07d0, 0x03a0 }, /* Greek_PI Π GREEK CAPITAL LETTER PI */ +- { 0x07d1, 0x03a1 }, /* Greek_RHO Ρ GREEK CAPITAL LETTER RHO */ +- { 0x07d2, 0x03a3 }, /* Greek_SIGMA Σ GREEK CAPITAL LETTER SIGMA */ +- { 0x07d4, 0x03a4 }, /* Greek_TAU Τ GREEK CAPITAL LETTER TAU */ +- { 0x07d5, 0x03a5 }, /* Greek_UPSILON Υ GREEK CAPITAL LETTER UPSILON */ +- { 0x07d6, 0x03a6 }, /* Greek_PHI Φ GREEK CAPITAL LETTER PHI */ +- { 0x07d7, 0x03a7 }, /* Greek_CHI Χ GREEK CAPITAL LETTER CHI */ +- { 0x07d8, 0x03a8 }, /* Greek_PSI Ψ GREEK CAPITAL LETTER PSI */ +- { 0x07d9, 0x03a9 }, /* Greek_OMEGA Ω GREEK CAPITAL LETTER OMEGA */ +- { 0x07e1, 0x03b1 }, /* Greek_alpha α GREEK SMALL LETTER ALPHA */ +- { 0x07e2, 0x03b2 }, /* Greek_beta β GREEK SMALL LETTER BETA */ +- { 0x07e3, 0x03b3 }, /* Greek_gamma γ GREEK SMALL LETTER GAMMA */ +- { 0x07e4, 0x03b4 }, /* Greek_delta δ GREEK SMALL LETTER DELTA */ +- { 0x07e5, 0x03b5 }, /* Greek_epsilon ε GREEK SMALL LETTER EPSILON */ +- { 0x07e6, 0x03b6 }, /* Greek_zeta ζ GREEK SMALL LETTER ZETA */ +- { 0x07e7, 0x03b7 }, /* Greek_eta η GREEK SMALL LETTER ETA */ +- { 0x07e8, 0x03b8 }, /* Greek_theta θ GREEK SMALL LETTER THETA */ +- { 0x07e9, 0x03b9 }, /* Greek_iota ι GREEK SMALL LETTER IOTA */ +- { 0x07ea, 0x03ba }, /* Greek_kappa κ GREEK SMALL LETTER KAPPA */ +- { 0x07eb, 0x03bb }, /* Greek_lambda λ GREEK SMALL LETTER LAMDA */ +- { 0x07ec, 0x03bc }, /* Greek_mu μ GREEK SMALL LETTER MU */ +- { 0x07ed, 0x03bd }, /* Greek_nu ν GREEK SMALL LETTER NU */ +- { 0x07ee, 0x03be }, /* Greek_xi ξ GREEK SMALL LETTER XI */ +- { 0x07ef, 0x03bf }, /* Greek_omicron ο GREEK SMALL LETTER OMICRON */ +- { 0x07f0, 0x03c0 }, /* Greek_pi π GREEK SMALL LETTER PI */ +- { 0x07f1, 0x03c1 }, /* Greek_rho ρ GREEK SMALL LETTER RHO */ +- { 0x07f2, 0x03c3 }, /* Greek_sigma σ GREEK SMALL LETTER SIGMA */ +- { 0x07f3, 0x03c2 }, /* Greek_finalsmallsigma ς GREEK SMALL LETTER FINAL SIGMA */ +- { 0x07f4, 0x03c4 }, /* Greek_tau τ GREEK SMALL LETTER TAU */ +- { 0x07f5, 0x03c5 }, /* Greek_upsilon υ GREEK SMALL LETTER UPSILON */ +- { 0x07f6, 0x03c6 }, /* Greek_phi φ GREEK SMALL LETTER PHI */ +- { 0x07f7, 0x03c7 }, /* Greek_chi χ GREEK SMALL LETTER CHI */ +- { 0x07f8, 0x03c8 }, /* Greek_psi ψ GREEK SMALL LETTER PSI */ +- { 0x07f9, 0x03c9 }, /* Greek_omega ω GREEK SMALL LETTER OMEGA */ +- { 0x08a1, 0x23b7 }, /* leftradical ⎷ RADICAL SYMBOL BOTTOM */ +- { 0x08a2, 0x250c }, /* topleftradical ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */ +- { 0x08a3, 0x2500 }, /* horizconnector ─ BOX DRAWINGS LIGHT HORIZONTAL */ +- { 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */ +- { 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */ +- { 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */ +- { 0x08a7, 0x23a1 }, /* topleftsqbracket ⎡ LEFT SQUARE BRACKET UPPER CORNER */ +- { 0x08a8, 0x23a3 }, /* botleftsqbracket ⎣ LEFT SQUARE BRACKET LOWER CORNER */ +- { 0x08a9, 0x23a4 }, /* toprightsqbracket ⎤ RIGHT SQUARE BRACKET UPPER CORNER */ +- { 0x08aa, 0x23a6 }, /* botrightsqbracket ⎦ RIGHT SQUARE BRACKET LOWER CORNER */ +- { 0x08ab, 0x239b }, /* topleftparens ⎛ LEFT PARENTHESIS UPPER HOOK */ +- { 0x08ac, 0x239d }, /* botleftparens ⎝ LEFT PARENTHESIS LOWER HOOK */ +- { 0x08ad, 0x239e }, /* toprightparens ⎞ RIGHT PARENTHESIS UPPER HOOK */ +- { 0x08ae, 0x23a0 }, /* botrightparens ⎠ RIGHT PARENTHESIS LOWER HOOK */ +- { 0x08af, 0x23a8 }, /* leftmiddlecurlybrace ⎨ LEFT CURLY BRACKET MIDDLE PIECE */ +- { 0x08b0, 0x23ac }, /* rightmiddlecurlybrace ⎬ RIGHT CURLY BRACKET MIDDLE PIECE */ +- /* 0x08b1 topleftsummation ? ??? */ +- /* 0x08b2 botleftsummation ? ??? */ +- /* 0x08b3 topvertsummationconnector ? ??? */ +- /* 0x08b4 botvertsummationconnector ? ??? */ +- /* 0x08b5 toprightsummation ? ??? */ +- /* 0x08b6 botrightsummation ? ??? */ +- /* 0x08b7 rightmiddlesummation ? ??? */ +- { 0x08bc, 0x2264 }, /* lessthanequal ≤ LESS-THAN OR EQUAL TO */ +- { 0x08bd, 0x2260 }, /* notequal ≠ NOT EQUAL TO */ +- { 0x08be, 0x2265 }, /* greaterthanequal ≥ GREATER-THAN OR EQUAL TO */ +- { 0x08bf, 0x222b }, /* integral ∫ INTEGRAL */ +- { 0x08c0, 0x2234 }, /* therefore ∴ THEREFORE */ +- { 0x08c1, 0x221d }, /* variation ∝ PROPORTIONAL TO */ +- { 0x08c2, 0x221e }, /* infinity ∞ INFINITY */ +- { 0x08c5, 0x2207 }, /* nabla ∇ NABLA */ +- { 0x08c8, 0x223c }, /* approximate ∼ TILDE OPERATOR */ +- { 0x08c9, 0x2243 }, /* similarequal ≃ ASYMPTOTICALLY EQUAL TO */ +- { 0x08cd, 0x21d4 }, /* ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW */ +- { 0x08ce, 0x21d2 }, /* implies ⇒ RIGHTWARDS DOUBLE ARROW */ +- { 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */ +- { 0x08d6, 0x221a }, /* radical √ SQUARE ROOT */ +- { 0x08da, 0x2282 }, /* includedin ⊂ SUBSET OF */ +- { 0x08db, 0x2283 }, /* includes ⊃ SUPERSET OF */ +- { 0x08dc, 0x2229 }, /* intersection ∩ INTERSECTION */ +- { 0x08dd, 0x222a }, /* union ∪ UNION */ +- { 0x08de, 0x2227 }, /* logicaland ∧ LOGICAL AND */ +- { 0x08df, 0x2228 }, /* logicalor ∨ LOGICAL OR */ +- { 0x08ef, 0x2202 }, /* partialderivative ∂ PARTIAL DIFFERENTIAL */ +- { 0x08f6, 0x0192 }, /* function ƒ LATIN SMALL LETTER F WITH HOOK */ +- { 0x08fb, 0x2190 }, /* leftarrow ← LEFTWARDS ARROW */ +- { 0x08fc, 0x2191 }, /* uparrow ↑ UPWARDS ARROW */ +- { 0x08fd, 0x2192 }, /* rightarrow → RIGHTWARDS ARROW */ +- { 0x08fe, 0x2193 }, /* downarrow ↓ DOWNWARDS ARROW */ +- { 0x09df, 0x2422 }, /* blank ␢ BLANK SYMBOL */ +- { 0x09e0, 0x25c6 }, /* soliddiamond ◆ BLACK DIAMOND */ +- { 0x09e1, 0x2592 }, /* checkerboard ▒ MEDIUM SHADE */ +- { 0x09e2, 0x2409 }, /* ht ␉ SYMBOL FOR HORIZONTAL TABULATION */ +- { 0x09e3, 0x240c }, /* ff ␌ SYMBOL FOR FORM FEED */ +- { 0x09e4, 0x240d }, /* cr ␍ SYMBOL FOR CARRIAGE RETURN */ +- { 0x09e5, 0x240a }, /* lf ␊ SYMBOL FOR LINE FEED */ +- { 0x09e8, 0x2424 }, /* nl  SYMBOL FOR NEWLINE */ +- { 0x09e9, 0x240b }, /* vt ␋ SYMBOL FOR VERTICAL TABULATION */ +- { 0x09ea, 0x2518 }, /* lowrightcorner ┘ BOX DRAWINGS LIGHT UP AND LEFT */ +- { 0x09eb, 0x2510 }, /* uprightcorner ┐ BOX DRAWINGS LIGHT DOWN AND LEFT */ +- { 0x09ec, 0x250c }, /* upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */ +- { 0x09ed, 0x2514 }, /* lowleftcorner └ BOX DRAWINGS LIGHT UP AND RIGHT */ +- { 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ +- { 0x09ef, 0x23ba }, /* horizlinescan1 ⎺ HORIZONTAL SCAN LINE-1 */ +- { 0x09f0, 0x23bb }, /* horizlinescan3 ⎻ HORIZONTAL SCAN LINE-3 */ +- { 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */ +- { 0x09f2, 0x23bc }, /* horizlinescan7 ⎼ HORIZONTAL SCAN LINE-7 */ +- { 0x09f3, 0x23bd }, /* horizlinescan9 ⎽ HORIZONTAL SCAN LINE-9 */ +- { 0x09f4, 0x251c }, /* leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ +- { 0x09f5, 0x2524 }, /* rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT */ +- { 0x09f6, 0x2534 }, /* bott ┴ BOX DRAWINGS LIGHT UP AND HORIZONTAL */ +- { 0x09f7, 0x252c }, /* topt ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ +- { 0x09f8, 0x2502 }, /* vertbar │ BOX DRAWINGS LIGHT VERTICAL */ +- { 0x0aa1, 0x2003 }, /* emspace EM SPACE */ +- { 0x0aa2, 0x2002 }, /* enspace EN SPACE */ +- { 0x0aa3, 0x2004 }, /* em3space THREE-PER-EM SPACE */ +- { 0x0aa4, 0x2005 }, /* em4space FOUR-PER-EM SPACE */ +- { 0x0aa5, 0x2007 }, /* digitspace FIGURE SPACE */ +- { 0x0aa6, 0x2008 }, /* punctspace PUNCTUATION SPACE */ +- { 0x0aa7, 0x2009 }, /* thinspace THIN SPACE */ +- { 0x0aa8, 0x200a }, /* hairspace HAIR SPACE */ +- { 0x0aa9, 0x2014 }, /* emdash — EM DASH */ +- { 0x0aaa, 0x2013 }, /* endash – EN DASH */ +- { 0x0aac, 0x2423 }, /* signifblank ␣ OPEN BOX */ +- { 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */ +- { 0x0aaf, 0x2025 }, /* doubbaselinedot ‥ TWO DOT LEADER */ +- { 0x0ab0, 0x2153 }, /* onethird ⅓ VULGAR FRACTION ONE THIRD */ +- { 0x0ab1, 0x2154 }, /* twothirds ⅔ VULGAR FRACTION TWO THIRDS */ +- { 0x0ab2, 0x2155 }, /* onefifth ⅕ VULGAR FRACTION ONE FIFTH */ +- { 0x0ab3, 0x2156 }, /* twofifths ⅖ VULGAR FRACTION TWO FIFTHS */ +- { 0x0ab4, 0x2157 }, /* threefifths ⅗ VULGAR FRACTION THREE FIFTHS */ +- { 0x0ab5, 0x2158 }, /* fourfifths ⅘ VULGAR FRACTION FOUR FIFTHS */ +- { 0x0ab6, 0x2159 }, /* onesixth ⅙ VULGAR FRACTION ONE SIXTH */ +- { 0x0ab7, 0x215a }, /* fivesixths ⅚ VULGAR FRACTION FIVE SIXTHS */ +- { 0x0ab8, 0x2105 }, /* careof ℅ CARE OF */ +- { 0x0abb, 0x2012 }, /* figdash ‒ FIGURE DASH */ +- { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */ +- { 0x0abd, 0x002e }, /* decimalpoint . FULL STOP */ +- { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */ +- /* 0x0abf marker ? ??? */ +- { 0x0ac3, 0x215b }, /* oneeighth ⅛ VULGAR FRACTION ONE EIGHTH */ +- { 0x0ac4, 0x215c }, /* threeeighths ⅜ VULGAR FRACTION THREE EIGHTHS */ +- { 0x0ac5, 0x215d }, /* fiveeighths ⅝ VULGAR FRACTION FIVE EIGHTHS */ +- { 0x0ac6, 0x215e }, /* seveneighths ⅞ VULGAR FRACTION SEVEN EIGHTHS */ +- { 0x0ac9, 0x2122 }, /* trademark ™ TRADE MARK SIGN */ +- { 0x0aca, 0x2613 }, /* signaturemark ☓ SALTIRE */ +- /* 0x0acb trademarkincircle ? ??? */ +- { 0x0acc, 0x25c1 }, /* leftopentriangle ◁ WHITE LEFT-POINTING TRIANGLE */ +- { 0x0acd, 0x25b7 }, /* rightopentriangle ▷ WHITE RIGHT-POINTING TRIANGLE */ +- { 0x0ace, 0x25cb }, /* emopencircle ○ WHITE CIRCLE */ +- { 0x0acf, 0x25af }, /* emopenrectangle ▯ WHITE VERTICAL RECTANGLE */ +- { 0x0ad0, 0x2018 }, /* leftsinglequotemark ‘ LEFT SINGLE QUOTATION MARK */ +- { 0x0ad1, 0x2019 }, /* rightsinglequotemark ’ RIGHT SINGLE QUOTATION MARK */ +- { 0x0ad2, 0x201c }, /* leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK */ +- { 0x0ad3, 0x201d }, /* rightdoublequotemark ” RIGHT DOUBLE QUOTATION MARK */ +- { 0x0ad4, 0x211e }, /* prescription ℞ PRESCRIPTION TAKE */ +- /* 0x0ad5 permille ? ??? */ +- { 0x0ad6, 0x2032 }, /* minutes ′ PRIME */ +- { 0x0ad7, 0x2033 }, /* seconds ″ DOUBLE PRIME */ +- { 0x0ad9, 0x271d }, /* latincross ✝ LATIN CROSS */ +- /* 0x0ada hexagram ? ??? */ +- { 0x0adb, 0x25ac }, /* filledrectbullet ▬ BLACK RECTANGLE */ +- { 0x0adc, 0x25c0 }, /* filledlefttribullet ◀ BLACK LEFT-POINTING TRIANGLE */ +- { 0x0add, 0x25b6 }, /* filledrighttribullet ▶ BLACK RIGHT-POINTING TRIANGLE */ +- { 0x0ade, 0x25cf }, /* emfilledcircle ● BLACK CIRCLE */ +- { 0x0adf, 0x25ae }, /* emfilledrect ▮ BLACK VERTICAL RECTANGLE */ +- { 0x0ae0, 0x25e6 }, /* enopencircbullet ◦ WHITE BULLET */ +- { 0x0ae1, 0x25ab }, /* enopensquarebullet ▫ WHITE SMALL SQUARE */ +- { 0x0ae2, 0x25ad }, /* openrectbullet ▭ WHITE RECTANGLE */ +- { 0x0ae3, 0x25b3 }, /* opentribulletup △ WHITE UP-POINTING TRIANGLE */ +- { 0x0ae4, 0x25bd }, /* opentribulletdown ▽ WHITE DOWN-POINTING TRIANGLE */ +- { 0x0ae5, 0x2606 }, /* openstar ☆ WHITE STAR */ +- { 0x0ae6, 0x2022 }, /* enfilledcircbullet • BULLET */ +- { 0x0ae7, 0x25aa }, /* enfilledsqbullet ▪ BLACK SMALL SQUARE */ +- { 0x0ae8, 0x25b2 }, /* filledtribulletup ▲ BLACK UP-POINTING TRIANGLE */ +- { 0x0ae9, 0x25bc }, /* filledtribulletdown ▼ BLACK DOWN-POINTING TRIANGLE */ +- { 0x0aea, 0x261c }, /* leftpointer ☜ WHITE LEFT POINTING INDEX */ +- { 0x0aeb, 0x261e }, /* rightpointer ☞ WHITE RIGHT POINTING INDEX */ +- { 0x0aec, 0x2663 }, /* club ♣ BLACK CLUB SUIT */ +- { 0x0aed, 0x2666 }, /* diamond ♦ BLACK DIAMOND SUIT */ +- { 0x0aee, 0x2665 }, /* heart ♥ BLACK HEART SUIT */ +- { 0x0af0, 0x2720 }, /* maltesecross ✠ MALTESE CROSS */ +- { 0x0af1, 0x2020 }, /* dagger † DAGGER */ +- { 0x0af2, 0x2021 }, /* doubledagger ‡ DOUBLE DAGGER */ +- { 0x0af3, 0x2713 }, /* checkmark ✓ CHECK MARK */ +- { 0x0af4, 0x2717 }, /* ballotcross ✗ BALLOT X */ +- { 0x0af5, 0x266f }, /* musicalsharp ♯ MUSIC SHARP SIGN */ +- { 0x0af6, 0x266d }, /* musicalflat ♭ MUSIC FLAT SIGN */ +- { 0x0af7, 0x2642 }, /* malesymbol ♂ MALE SIGN */ +- { 0x0af8, 0x2640 }, /* femalesymbol ♀ FEMALE SIGN */ +- { 0x0af9, 0x260e }, /* telephone ☎ BLACK TELEPHONE */ +- { 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */ +- { 0x0afb, 0x2117 }, /* phonographcopyright ℗ SOUND RECORDING COPYRIGHT */ +- { 0x0afc, 0x2038 }, /* caret ‸ CARET */ +- { 0x0afd, 0x201a }, /* singlelowquotemark ‚ SINGLE LOW-9 QUOTATION MARK */ +- { 0x0afe, 0x201e }, /* doublelowquotemark „ DOUBLE LOW-9 QUOTATION MARK */ +- /* 0x0aff cursor ? ??? */ +- { 0x0ba3, 0x003c }, /* leftcaret < LESS-THAN SIGN */ +- { 0x0ba6, 0x003e }, /* rightcaret > GREATER-THAN SIGN */ +- { 0x0ba8, 0x2228 }, /* downcaret ∨ LOGICAL OR */ +- { 0x0ba9, 0x2227 }, /* upcaret ∧ LOGICAL AND */ +- { 0x0bc0, 0x00af }, /* overbar ¯ MACRON */ +- { 0x0bc2, 0x22a5 }, /* downtack ⊥ UP TACK */ +- { 0x0bc3, 0x2229 }, /* upshoe ∩ INTERSECTION */ +- { 0x0bc4, 0x230a }, /* downstile ⌊ LEFT FLOOR */ +- { 0x0bc6, 0x005f }, /* underbar _ LOW LINE */ +- { 0x0bca, 0x2218 }, /* jot ∘ RING OPERATOR */ +- { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD */ +- { 0x0bce, 0x22a4 }, /* uptack ⊤ DOWN TACK */ +- { 0x0bcf, 0x25cb }, /* circle ○ WHITE CIRCLE */ +- { 0x0bd3, 0x2308 }, /* upstile ⌈ LEFT CEILING */ +- { 0x0bd6, 0x222a }, /* downshoe ∪ UNION */ +- { 0x0bd8, 0x2283 }, /* rightshoe ⊃ SUPERSET OF */ +- { 0x0bda, 0x2282 }, /* leftshoe ⊂ SUBSET OF */ +- { 0x0bdc, 0x22a2 }, /* lefttack ⊢ RIGHT TACK */ +- { 0x0bfc, 0x22a3 }, /* righttack ⊣ LEFT TACK */ +- { 0x0cdf, 0x2017 }, /* hebrew_doublelowline ‗ DOUBLE LOW LINE */ +- { 0x0ce0, 0x05d0 }, /* hebrew_aleph א HEBREW LETTER ALEF */ +- { 0x0ce1, 0x05d1 }, /* hebrew_bet ב HEBREW LETTER BET */ +- { 0x0ce2, 0x05d2 }, /* hebrew_gimel ג HEBREW LETTER GIMEL */ +- { 0x0ce3, 0x05d3 }, /* hebrew_dalet ד HEBREW LETTER DALET */ +- { 0x0ce4, 0x05d4 }, /* hebrew_he ה HEBREW LETTER HE */ +- { 0x0ce5, 0x05d5 }, /* hebrew_waw ו HEBREW LETTER VAV */ +- { 0x0ce6, 0x05d6 }, /* hebrew_zain ז HEBREW LETTER ZAYIN */ +- { 0x0ce7, 0x05d7 }, /* hebrew_chet ח HEBREW LETTER HET */ +- { 0x0ce8, 0x05d8 }, /* hebrew_tet ט HEBREW LETTER TET */ +- { 0x0ce9, 0x05d9 }, /* hebrew_yod י HEBREW LETTER YOD */ +- { 0x0cea, 0x05da }, /* hebrew_finalkaph ך HEBREW LETTER FINAL KAF */ +- { 0x0ceb, 0x05db }, /* hebrew_kaph כ HEBREW LETTER KAF */ +- { 0x0cec, 0x05dc }, /* hebrew_lamed ל HEBREW LETTER LAMED */ +- { 0x0ced, 0x05dd }, /* hebrew_finalmem ם HEBREW LETTER FINAL MEM */ +- { 0x0cee, 0x05de }, /* hebrew_mem מ HEBREW LETTER MEM */ +- { 0x0cef, 0x05df }, /* hebrew_finalnun ן HEBREW LETTER FINAL NUN */ +- { 0x0cf0, 0x05e0 }, /* hebrew_nun נ HEBREW LETTER NUN */ +- { 0x0cf1, 0x05e1 }, /* hebrew_samech ס HEBREW LETTER SAMEKH */ +- { 0x0cf2, 0x05e2 }, /* hebrew_ayin ע HEBREW LETTER AYIN */ +- { 0x0cf3, 0x05e3 }, /* hebrew_finalpe ף HEBREW LETTER FINAL PE */ +- { 0x0cf4, 0x05e4 }, /* hebrew_pe פ HEBREW LETTER PE */ +- { 0x0cf5, 0x05e5 }, /* hebrew_finalzade ץ HEBREW LETTER FINAL TSADI */ +- { 0x0cf6, 0x05e6 }, /* hebrew_zade צ HEBREW LETTER TSADI */ +- { 0x0cf7, 0x05e7 }, /* hebrew_qoph ק HEBREW LETTER QOF */ +- { 0x0cf8, 0x05e8 }, /* hebrew_resh ר HEBREW LETTER RESH */ +- { 0x0cf9, 0x05e9 }, /* hebrew_shin ש HEBREW LETTER SHIN */ +- { 0x0cfa, 0x05ea }, /* hebrew_taw ת HEBREW LETTER TAV */ +- { 0x0da1, 0x0e01 }, /* Thai_kokai ก THAI CHARACTER KO KAI */ +- { 0x0da2, 0x0e02 }, /* Thai_khokhai ข THAI CHARACTER KHO KHAI */ +- { 0x0da3, 0x0e03 }, /* Thai_khokhuat ฃ THAI CHARACTER KHO KHUAT */ +- { 0x0da4, 0x0e04 }, /* Thai_khokhwai ค THAI CHARACTER KHO KHWAI */ +- { 0x0da5, 0x0e05 }, /* Thai_khokhon ฅ THAI CHARACTER KHO KHON */ +- { 0x0da6, 0x0e06 }, /* Thai_khorakhang ฆ THAI CHARACTER KHO RAKHANG */ +- { 0x0da7, 0x0e07 }, /* Thai_ngongu ง THAI CHARACTER NGO NGU */ +- { 0x0da8, 0x0e08 }, /* Thai_chochan จ THAI CHARACTER CHO CHAN */ +- { 0x0da9, 0x0e09 }, /* Thai_choching ฉ THAI CHARACTER CHO CHING */ +- { 0x0daa, 0x0e0a }, /* Thai_chochang ช THAI CHARACTER CHO CHANG */ +- { 0x0dab, 0x0e0b }, /* Thai_soso ซ THAI CHARACTER SO SO */ +- { 0x0dac, 0x0e0c }, /* Thai_chochoe ฌ THAI CHARACTER CHO CHOE */ +- { 0x0dad, 0x0e0d }, /* Thai_yoying ญ THAI CHARACTER YO YING */ +- { 0x0dae, 0x0e0e }, /* Thai_dochada ฎ THAI CHARACTER DO CHADA */ +- { 0x0daf, 0x0e0f }, /* Thai_topatak ฏ THAI CHARACTER TO PATAK */ +- { 0x0db0, 0x0e10 }, /* Thai_thothan ฐ THAI CHARACTER THO THAN */ +- { 0x0db1, 0x0e11 }, /* Thai_thonangmontho ฑ THAI CHARACTER THO NANGMONTHO */ +- { 0x0db2, 0x0e12 }, /* Thai_thophuthao ฒ THAI CHARACTER THO PHUTHAO */ +- { 0x0db3, 0x0e13 }, /* Thai_nonen ณ THAI CHARACTER NO NEN */ +- { 0x0db4, 0x0e14 }, /* Thai_dodek ด THAI CHARACTER DO DEK */ +- { 0x0db5, 0x0e15 }, /* Thai_totao ต THAI CHARACTER TO TAO */ +- { 0x0db6, 0x0e16 }, /* Thai_thothung ถ THAI CHARACTER THO THUNG */ +- { 0x0db7, 0x0e17 }, /* Thai_thothahan ท THAI CHARACTER THO THAHAN */ +- { 0x0db8, 0x0e18 }, /* Thai_thothong ธ THAI CHARACTER THO THONG */ +- { 0x0db9, 0x0e19 }, /* Thai_nonu น THAI CHARACTER NO NU */ +- { 0x0dba, 0x0e1a }, /* Thai_bobaimai บ THAI CHARACTER BO BAIMAI */ +- { 0x0dbb, 0x0e1b }, /* Thai_popla ป THAI CHARACTER PO PLA */ +- { 0x0dbc, 0x0e1c }, /* Thai_phophung ผ THAI CHARACTER PHO PHUNG */ +- { 0x0dbd, 0x0e1d }, /* Thai_fofa ฝ THAI CHARACTER FO FA */ +- { 0x0dbe, 0x0e1e }, /* Thai_phophan พ THAI CHARACTER PHO PHAN */ +- { 0x0dbf, 0x0e1f }, /* Thai_fofan ฟ THAI CHARACTER FO FAN */ +- { 0x0dc0, 0x0e20 }, /* Thai_phosamphao ภ THAI CHARACTER PHO SAMPHAO */ +- { 0x0dc1, 0x0e21 }, /* Thai_moma ม THAI CHARACTER MO MA */ +- { 0x0dc2, 0x0e22 }, /* Thai_yoyak ย THAI CHARACTER YO YAK */ +- { 0x0dc3, 0x0e23 }, /* Thai_rorua ร THAI CHARACTER RO RUA */ +- { 0x0dc4, 0x0e24 }, /* Thai_ru ฤ THAI CHARACTER RU */ +- { 0x0dc5, 0x0e25 }, /* Thai_loling ล THAI CHARACTER LO LING */ +- { 0x0dc6, 0x0e26 }, /* Thai_lu ฦ THAI CHARACTER LU */ +- { 0x0dc7, 0x0e27 }, /* Thai_wowaen ว THAI CHARACTER WO WAEN */ +- { 0x0dc8, 0x0e28 }, /* Thai_sosala ศ THAI CHARACTER SO SALA */ +- { 0x0dc9, 0x0e29 }, /* Thai_sorusi ษ THAI CHARACTER SO RUSI */ +- { 0x0dca, 0x0e2a }, /* Thai_sosua ส THAI CHARACTER SO SUA */ +- { 0x0dcb, 0x0e2b }, /* Thai_hohip ห THAI CHARACTER HO HIP */ +- { 0x0dcc, 0x0e2c }, /* Thai_lochula ฬ THAI CHARACTER LO CHULA */ +- { 0x0dcd, 0x0e2d }, /* Thai_oang อ THAI CHARACTER O ANG */ +- { 0x0dce, 0x0e2e }, /* Thai_honokhuk ฮ THAI CHARACTER HO NOKHUK */ +- { 0x0dcf, 0x0e2f }, /* Thai_paiyannoi ฯ THAI CHARACTER PAIYANNOI */ +- { 0x0dd0, 0x0e30 }, /* Thai_saraa ะ THAI CHARACTER SARA A */ +- { 0x0dd1, 0x0e31 }, /* Thai_maihanakat ั THAI CHARACTER MAI HAN-AKAT */ +- { 0x0dd2, 0x0e32 }, /* Thai_saraaa า THAI CHARACTER SARA AA */ +- { 0x0dd3, 0x0e33 }, /* Thai_saraam ำ THAI CHARACTER SARA AM */ +- { 0x0dd4, 0x0e34 }, /* Thai_sarai ิ THAI CHARACTER SARA I */ +- { 0x0dd5, 0x0e35 }, /* Thai_saraii ี THAI CHARACTER SARA II */ +- { 0x0dd6, 0x0e36 }, /* Thai_saraue ึ THAI CHARACTER SARA UE */ +- { 0x0dd7, 0x0e37 }, /* Thai_sarauee ื THAI CHARACTER SARA UEE */ +- { 0x0dd8, 0x0e38 }, /* Thai_sarau ุ THAI CHARACTER SARA U */ +- { 0x0dd9, 0x0e39 }, /* Thai_sarauu ู THAI CHARACTER SARA UU */ +- { 0x0dda, 0x0e3a }, /* Thai_phinthu ฺ THAI CHARACTER PHINTHU */ +- { 0x0dde, 0x0e3e }, /* Thai_maihanakat_maitho ??? */ +- { 0x0ddf, 0x0e3f }, /* Thai_baht ฿ THAI CURRENCY SYMBOL BAHT */ +- { 0x0de0, 0x0e40 }, /* Thai_sarae เ THAI CHARACTER SARA E */ +- { 0x0de1, 0x0e41 }, /* Thai_saraae แ THAI CHARACTER SARA AE */ +- { 0x0de2, 0x0e42 }, /* Thai_sarao โ THAI CHARACTER SARA O */ +- { 0x0de3, 0x0e43 }, /* Thai_saraaimaimuan ใ THAI CHARACTER SARA AI MAIMUAN */ +- { 0x0de4, 0x0e44 }, /* Thai_saraaimaimalai ไ THAI CHARACTER SARA AI MAIMALAI */ +- { 0x0de5, 0x0e45 }, /* Thai_lakkhangyao ๅ THAI CHARACTER LAKKHANGYAO */ +- { 0x0de6, 0x0e46 }, /* Thai_maiyamok ๆ THAI CHARACTER MAIYAMOK */ +- { 0x0de7, 0x0e47 }, /* Thai_maitaikhu ็ THAI CHARACTER MAITAIKHU */ +- { 0x0de8, 0x0e48 }, /* Thai_maiek ่ THAI CHARACTER MAI EK */ +- { 0x0de9, 0x0e49 }, /* Thai_maitho ้ THAI CHARACTER MAI THO */ +- { 0x0dea, 0x0e4a }, /* Thai_maitri ๊ THAI CHARACTER MAI TRI */ +- { 0x0deb, 0x0e4b }, /* Thai_maichattawa ๋ THAI CHARACTER MAI CHATTAWA */ +- { 0x0dec, 0x0e4c }, /* Thai_thanthakhat ์ THAI CHARACTER THANTHAKHAT */ +- { 0x0ded, 0x0e4d }, /* Thai_nikhahit ํ THAI CHARACTER NIKHAHIT */ +- { 0x0df0, 0x0e50 }, /* Thai_leksun ๐ THAI DIGIT ZERO */ +- { 0x0df1, 0x0e51 }, /* Thai_leknung ๑ THAI DIGIT ONE */ +- { 0x0df2, 0x0e52 }, /* Thai_leksong ๒ THAI DIGIT TWO */ +- { 0x0df3, 0x0e53 }, /* Thai_leksam ๓ THAI DIGIT THREE */ +- { 0x0df4, 0x0e54 }, /* Thai_leksi ๔ THAI DIGIT FOUR */ +- { 0x0df5, 0x0e55 }, /* Thai_lekha ๕ THAI DIGIT FIVE */ +- { 0x0df6, 0x0e56 }, /* Thai_lekhok ๖ THAI DIGIT SIX */ +- { 0x0df7, 0x0e57 }, /* Thai_lekchet ๗ THAI DIGIT SEVEN */ +- { 0x0df8, 0x0e58 }, /* Thai_lekpaet ๘ THAI DIGIT EIGHT */ +- { 0x0df9, 0x0e59 }, /* Thai_lekkao ๙ THAI DIGIT NINE */ +- { 0x0ea1, 0x3131 }, /* Hangul_Kiyeog ㄱ HANGUL LETTER KIYEOK */ +- { 0x0ea2, 0x3132 }, /* Hangul_SsangKiyeog ㄲ HANGUL LETTER SSANGKIYEOK */ +- { 0x0ea3, 0x3133 }, /* Hangul_KiyeogSios ㄳ HANGUL LETTER KIYEOK-SIOS */ +- { 0x0ea4, 0x3134 }, /* Hangul_Nieun ㄴ HANGUL LETTER NIEUN */ +- { 0x0ea5, 0x3135 }, /* Hangul_NieunJieuj ㄵ HANGUL LETTER NIEUN-CIEUC */ +- { 0x0ea6, 0x3136 }, /* Hangul_NieunHieuh ㄶ HANGUL LETTER NIEUN-HIEUH */ +- { 0x0ea7, 0x3137 }, /* Hangul_Dikeud ㄷ HANGUL LETTER TIKEUT */ +- { 0x0ea8, 0x3138 }, /* Hangul_SsangDikeud ㄸ HANGUL LETTER SSANGTIKEUT */ +- { 0x0ea9, 0x3139 }, /* Hangul_Rieul ㄹ HANGUL LETTER RIEUL */ +- { 0x0eaa, 0x313a }, /* Hangul_RieulKiyeog ㄺ HANGUL LETTER RIEUL-KIYEOK */ +- { 0x0eab, 0x313b }, /* Hangul_RieulMieum ㄻ HANGUL LETTER RIEUL-MIEUM */ +- { 0x0eac, 0x313c }, /* Hangul_RieulPieub ㄼ HANGUL LETTER RIEUL-PIEUP */ +- { 0x0ead, 0x313d }, /* Hangul_RieulSios ㄽ HANGUL LETTER RIEUL-SIOS */ +- { 0x0eae, 0x313e }, /* Hangul_RieulTieut ㄾ HANGUL LETTER RIEUL-THIEUTH */ +- { 0x0eaf, 0x313f }, /* Hangul_RieulPhieuf ㄿ HANGUL LETTER RIEUL-PHIEUPH */ +- { 0x0eb0, 0x3140 }, /* Hangul_RieulHieuh ㅀ HANGUL LETTER RIEUL-HIEUH */ +- { 0x0eb1, 0x3141 }, /* Hangul_Mieum ㅁ HANGUL LETTER MIEUM */ +- { 0x0eb2, 0x3142 }, /* Hangul_Pieub ㅂ HANGUL LETTER PIEUP */ +- { 0x0eb3, 0x3143 }, /* Hangul_SsangPieub ㅃ HANGUL LETTER SSANGPIEUP */ +- { 0x0eb4, 0x3144 }, /* Hangul_PieubSios ㅄ HANGUL LETTER PIEUP-SIOS */ +- { 0x0eb5, 0x3145 }, /* Hangul_Sios ㅅ HANGUL LETTER SIOS */ +- { 0x0eb6, 0x3146 }, /* Hangul_SsangSios ㅆ HANGUL LETTER SSANGSIOS */ +- { 0x0eb7, 0x3147 }, /* Hangul_Ieung ㅇ HANGUL LETTER IEUNG */ +- { 0x0eb8, 0x3148 }, /* Hangul_Jieuj ㅈ HANGUL LETTER CIEUC */ +- { 0x0eb9, 0x3149 }, /* Hangul_SsangJieuj ㅉ HANGUL LETTER SSANGCIEUC */ +- { 0x0eba, 0x314a }, /* Hangul_Cieuc ㅊ HANGUL LETTER CHIEUCH */ +- { 0x0ebb, 0x314b }, /* Hangul_Khieuq ㅋ HANGUL LETTER KHIEUKH */ +- { 0x0ebc, 0x314c }, /* Hangul_Tieut ㅌ HANGUL LETTER THIEUTH */ +- { 0x0ebd, 0x314d }, /* Hangul_Phieuf ㅍ HANGUL LETTER PHIEUPH */ +- { 0x0ebe, 0x314e }, /* Hangul_Hieuh ㅎ HANGUL LETTER HIEUH */ +- { 0x0ebf, 0x314f }, /* Hangul_A ㅏ HANGUL LETTER A */ +- { 0x0ec0, 0x3150 }, /* Hangul_AE ㅐ HANGUL LETTER AE */ +- { 0x0ec1, 0x3151 }, /* Hangul_YA ㅑ HANGUL LETTER YA */ +- { 0x0ec2, 0x3152 }, /* Hangul_YAE ㅒ HANGUL LETTER YAE */ +- { 0x0ec3, 0x3153 }, /* Hangul_EO ㅓ HANGUL LETTER EO */ +- { 0x0ec4, 0x3154 }, /* Hangul_E ㅔ HANGUL LETTER E */ +- { 0x0ec5, 0x3155 }, /* Hangul_YEO ㅕ HANGUL LETTER YEO */ +- { 0x0ec6, 0x3156 }, /* Hangul_YE ㅖ HANGUL LETTER YE */ +- { 0x0ec7, 0x3157 }, /* Hangul_O ㅗ HANGUL LETTER O */ +- { 0x0ec8, 0x3158 }, /* Hangul_WA ㅘ HANGUL LETTER WA */ +- { 0x0ec9, 0x3159 }, /* Hangul_WAE ㅙ HANGUL LETTER WAE */ +- { 0x0eca, 0x315a }, /* Hangul_OE ㅚ HANGUL LETTER OE */ +- { 0x0ecb, 0x315b }, /* Hangul_YO ㅛ HANGUL LETTER YO */ +- { 0x0ecc, 0x315c }, /* Hangul_U ㅜ HANGUL LETTER U */ +- { 0x0ecd, 0x315d }, /* Hangul_WEO ㅝ HANGUL LETTER WEO */ +- { 0x0ece, 0x315e }, /* Hangul_WE ㅞ HANGUL LETTER WE */ +- { 0x0ecf, 0x315f }, /* Hangul_WI ㅟ HANGUL LETTER WI */ +- { 0x0ed0, 0x3160 }, /* Hangul_YU ㅠ HANGUL LETTER YU */ +- { 0x0ed1, 0x3161 }, /* Hangul_EU ㅡ HANGUL LETTER EU */ +- { 0x0ed2, 0x3162 }, /* Hangul_YI ㅢ HANGUL LETTER YI */ +- { 0x0ed3, 0x3163 }, /* Hangul_I ㅣ HANGUL LETTER I */ +- { 0x0ed4, 0x11a8 }, /* Hangul_J_Kiyeog ᆨ HANGUL JONGSEONG KIYEOK */ +- { 0x0ed5, 0x11a9 }, /* Hangul_J_SsangKiyeog ᆩ HANGUL JONGSEONG SSANGKIYEOK */ +- { 0x0ed6, 0x11aa }, /* Hangul_J_KiyeogSios ᆪ HANGUL JONGSEONG KIYEOK-SIOS */ +- { 0x0ed7, 0x11ab }, /* Hangul_J_Nieun ᆫ HANGUL JONGSEONG NIEUN */ +- { 0x0ed8, 0x11ac }, /* Hangul_J_NieunJieuj ᆬ HANGUL JONGSEONG NIEUN-CIEUC */ +- { 0x0ed9, 0x11ad }, /* Hangul_J_NieunHieuh ᆭ HANGUL JONGSEONG NIEUN-HIEUH */ +- { 0x0eda, 0x11ae }, /* Hangul_J_Dikeud ᆮ HANGUL JONGSEONG TIKEUT */ +- { 0x0edb, 0x11af }, /* Hangul_J_Rieul ᆯ HANGUL JONGSEONG RIEUL */ +- { 0x0edc, 0x11b0 }, /* Hangul_J_RieulKiyeog ᆰ HANGUL JONGSEONG RIEUL-KIYEOK */ +- { 0x0edd, 0x11b1 }, /* Hangul_J_RieulMieum ᆱ HANGUL JONGSEONG RIEUL-MIEUM */ +- { 0x0ede, 0x11b2 }, /* Hangul_J_RieulPieub ᆲ HANGUL JONGSEONG RIEUL-PIEUP */ +- { 0x0edf, 0x11b3 }, /* Hangul_J_RieulSios ᆳ HANGUL JONGSEONG RIEUL-SIOS */ +- { 0x0ee0, 0x11b4 }, /* Hangul_J_RieulTieut ᆴ HANGUL JONGSEONG RIEUL-THIEUTH */ +- { 0x0ee1, 0x11b5 }, /* Hangul_J_RieulPhieuf ᆵ HANGUL JONGSEONG RIEUL-PHIEUPH */ +- { 0x0ee2, 0x11b6 }, /* Hangul_J_RieulHieuh ᆶ HANGUL JONGSEONG RIEUL-HIEUH */ +- { 0x0ee3, 0x11b7 }, /* Hangul_J_Mieum ᆷ HANGUL JONGSEONG MIEUM */ +- { 0x0ee4, 0x11b8 }, /* Hangul_J_Pieub ᆸ HANGUL JONGSEONG PIEUP */ +- { 0x0ee5, 0x11b9 }, /* Hangul_J_PieubSios ᆹ HANGUL JONGSEONG PIEUP-SIOS */ +- { 0x0ee6, 0x11ba }, /* Hangul_J_Sios ᆺ HANGUL JONGSEONG SIOS */ +- { 0x0ee7, 0x11bb }, /* Hangul_J_SsangSios ᆻ HANGUL JONGSEONG SSANGSIOS */ +- { 0x0ee8, 0x11bc }, /* Hangul_J_Ieung ᆼ HANGUL JONGSEONG IEUNG */ +- { 0x0ee9, 0x11bd }, /* Hangul_J_Jieuj ᆽ HANGUL JONGSEONG CIEUC */ +- { 0x0eea, 0x11be }, /* Hangul_J_Cieuc ᆾ HANGUL JONGSEONG CHIEUCH */ +- { 0x0eeb, 0x11bf }, /* Hangul_J_Khieuq ᆿ HANGUL JONGSEONG KHIEUKH */ +- { 0x0eec, 0x11c0 }, /* Hangul_J_Tieut ᇀ HANGUL JONGSEONG THIEUTH */ +- { 0x0eed, 0x11c1 }, /* Hangul_J_Phieuf ᇁ HANGUL JONGSEONG PHIEUPH */ +- { 0x0eee, 0x11c2 }, /* Hangul_J_Hieuh ᇂ HANGUL JONGSEONG HIEUH */ +- { 0x0eef, 0x316d }, /* Hangul_RieulYeorinHieuh ㅭ HANGUL LETTER RIEUL-YEORINHIEUH */ +- { 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ㅱ HANGUL LETTER KAPYEOUNMIEUM */ +- { 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ㅸ HANGUL LETTER KAPYEOUNPIEUP */ +- { 0x0ef2, 0x317f }, /* Hangul_PanSios ㅿ HANGUL LETTER PANSIOS */ +- { 0x0ef3, 0x3181 }, /* Hangul_KkogjiDalrinIeung ㆁ HANGUL LETTER YESIEUNG */ +- { 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */ +- { 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */ +- { 0x0ef6, 0x318d }, /* Hangul_AraeA ㆍ HANGUL LETTER ARAEA */ +- { 0x0ef7, 0x318e }, /* Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE */ +- { 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */ +- { 0x0ef9, 0x11f0 }, /* Hangul_J_KkogjiDalrinIeung ᇰ HANGUL JONGSEONG YESIEUNG */ +- { 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */ +- { 0x0eff, 0x20a9 }, /* Korean_Won ₩ WON SIGN */ +- { 0x13a4, 0x20ac }, /* Euro € EURO SIGN */ +- { 0x13bc, 0x0152 }, /* OE Œ LATIN CAPITAL LIGATURE OE */ +- { 0x13bd, 0x0153 }, /* oe œ LATIN SMALL LIGATURE OE */ +- { 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */ +- { 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */ +- +- /* Combining symbols */ +- { 0xfe50, 0x0300 }, /* dead_grave */ +- { 0xfe51, 0x0301 }, /* dead_acute" */ +- { 0xfe52, 0x0302 }, /* dead_circumflex" */ +- { 0xfe53, 0x0303 }, /* dead_tilde" */ +- { 0xfe54, 0x0304 }, /* dead_macron" */ +- { 0xfe55, 0x0306 }, /* dead_breve" */ +- { 0xfe56, 0x0307 }, /* dead_abovedot" */ +- { 0xfe57, 0x0308 }, /* dead_diaeresis" */ +- { 0xfe58, 0x030A }, /* dead_abovering" */ +- { 0xfe59, 0x030B }, /* dead_doubleacute" */ +- { 0xfe5a, 0x030C }, /* dead_caron" */ +- { 0xfe5b, 0x0327 }, /* dead_cedilla" */ +- { 0xfe5c, 0x0328 }, /* dead_ogonek" */ +- { 0xfe60, 0x0323 }, /* dead_belowdot */ +- +- /* Special function keys. */ +- +- { 0xff08, 0x0008 }, /* XK_BackSpace */ +- { 0xff09, 0x0009 }, /* XK_Tab */ +- { 0xff0a, 0x000a }, /* XK_Linefeed */ +- { 0xff0d, 0x000d }, /* XK_Return */ +- { 0xff13, 0x0013 }, /* XK_Pause */ +- { 0xff1b, 0x001b }, /* XK_Escape */ +- { 0xff50, 0x0001 }, /* XK_Home */ +- { 0xff51, 0x001c }, /* XK_Left */ +- { 0xff52, 0x001e }, /* XK_Up */ +- { 0xff53, 0x001d }, /* XK_Right */ +- { 0xff54, 0x001f }, /* XK_Down */ +- { 0xff55, 0x000b }, /* XK_Prior */ +- { 0xff56, 0x000c }, /* XK_Next */ +- { 0xff57, 0x0004 }, /* XK_End */ +- { 0xff6a, 0x0005 }, /* XK_Help */ +- { 0xffff, 0x007f }, /* XK_Delete */ +-}; +- +-long keysym2ucs(KeySym keysym) +-{ +- int min = 0; +- int max = sizeof(keysymtab) / sizeof(struct codepair) - 1; +- int mid; +- +- /* first check for Latin-1 characters (1:1 mapping) */ +- if ((keysym >= 0x0020 && keysym <= 0x007e) || +- (keysym >= 0x00a0 && keysym <= 0x00ff)) { +- return keysym; +- } +- +- /* also check for directly encoded 24-bit UCS characters */ +- if ((keysym & 0xff000000) == 0x01000000) { +- return keysym & 0x00ffffff; +- } +- +- /* binary search in table */ +- while (max >= min) { +- mid = (min + max) / 2; +- if (keysymtab[mid].keysym < keysym) { +- min = mid + 1; +- } else if (keysymtab[mid].keysym > keysym) { +- max = mid - 1; +- } else { +- /* found it */ +- return keysymtab[mid].ucs; +- } +- } +- +- /* no matching Unicode value found */ +- return -1; +-} +diff --git a/plugins/devices/keyboard/preview/keysym2ucs.h b/plugins/devices/keyboard/preview/keysym2ucs.h +deleted file mode 100644 +index 6e50c76..0000000 +--- a/plugins/devices/keyboard/preview/keysym2ucs.h ++++ /dev/null +@@ -1,27 +0,0 @@ +-/* +- * Copyright (C) 2012 Andriy Rysin (arysin@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#ifndef KEYSYM2UCS_H +-#define KEYSYM2UCS_H +- +-#include <X11/XKBlib.h> +-#include <fixx11h.h> +- +-extern long keysym2ucs(KeySym keysym); +- +-#endif +diff --git a/plugins/devices/keyboard/preview/keysymhelper.cpp b/plugins/devices/keyboard/preview/keysymhelper.cpp +deleted file mode 100644 +index ee57f13..0000000 +--- a/plugins/devices/keyboard/preview/keysymhelper.cpp ++++ /dev/null +@@ -1,84 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#include "keysymhelper.h" +-#include "keysym2ucs.h" +- +-#include <QString> +-#include <QChar> +-#include <QDebug> +- +-#include <X11/XKBlib.h> +- +- +-KeySymHelper::KeySymHelper() +-{ +- nill = 0; +-} +- +-QString KeySymHelper::getKeySymbol(const QString &opton) +-{ +- if (keySymbolMap.contains(opton)) { +- return keySymbolMap[opton]; +- } +- +- const char *str = opton.toLatin1().data(); +- +-#if 0 +- //TODO: figure out how to use this so we don't need our own symkey2ucs mapping +- int res = Xutf8LookupString(XIC ic, XKeyPressedEvent * event, char *buffer_return, int bytes_buffer, KeySym * keysym_return, Status * status_return); +- +-#else +- +- KeySym keysym = XStringToKeysym(str); +- +- //TODO: make it more generic +-// if( keysym == 0xfe03 ) +-// return "L3"; +- +- long ucs = keysym2ucs(keysym); +- +-// if( ucs == -1 && (keysym >= 0xFE50 && keysym <= 0xFE5F) ) { +-// ucs = 0x0300 + (keysym & 0x000F); +-// qWarning() << "Got dead symbol" << QString("0x%1").arg(keysym, 0, 16) << "named" << opton << "will use" << QString("0x%1").arg(ucs, 0, 16) << "as UCS"; +-// } +- +- if (ucs == -1) { +- nill++; +- qWarning() << "No mapping from keysym:" << QStringLiteral("0x%1").arg(keysym, 0, 16) << "named:" << opton << "to UCS"; +- return ""; +- } +- +- QString ucsStr = QString(QChar((int)ucs)); +- +- // Combining Diacritical Marks +- if (ucs >= 0x0300 && ucs <= 0x036F) { +- ucsStr = " " + ucsStr + " "; +- } +- +-// qWarning() << "--" << opton << "keysym: " << keysym << QString("0x%1").arg(keysym, 0, 16) << "keysym2string" << XKeysymToString(keysym) +-// << "---" << QString("0x%1").arg(ucs, 0, 16) << ucsStr; +- +- keySymbolMap[opton] = ucsStr; +- +- return ucsStr; +- +-#endif +- +-} +- +diff --git a/plugins/devices/keyboard/preview/keysymhelper.h b/plugins/devices/keyboard/preview/keysymhelper.h +deleted file mode 100644 +index be8799f..0000000 +--- a/plugins/devices/keyboard/preview/keysymhelper.h ++++ /dev/null +@@ -1,41 +0,0 @@ +-/* +- * Copyright (C) 2012 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#ifndef KEYSYMHELPER_H +-#define KEYSYMHELPER_H +- +-#include <QString> +-#include <QMap> +- +-class KeySymHelper +-{ +-public: +- KeySymHelper(); +- +- QString getKeySymbol(const QString &opton); +- bool isFailed() const +- { +- return nill >= 120; +- } +- +-private: +- QMap<QString, QString> keySymbolMap; +- int nill; +-}; +- +-#endif // KEYSYMHELPER_H +diff --git a/plugins/devices/keyboard/preview/symbol_parser.cpp b/plugins/devices/keyboard/preview/symbol_parser.cpp +deleted file mode 100644 +index 71aa552..0000000 +--- a/plugins/devices/keyboard/preview/symbol_parser.cpp ++++ /dev/null +@@ -1,288 +0,0 @@ +-/* +- * Copyright (C) 2013 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#include "symbol_parser.h" +-#include "xkb_rules.h" +- +-#include <QString> +-#include <QStringList> +-#include <QDebug> +-#include <QFileDialog> +-#include <QFile> +- +- +-namespace grammar +-{ +- +-symbol_keywords::symbol_keywords() +-{ +- add("key", 2)("include", 1)("//", 3)("*/", 4); +-} +- +-levels::levels() +-{ +- add("ONE", 1)("TWO", 2)("THREE", 3)("FOUR", 4)("SIX", 6)("EIGHT", 8); +-} +- +-template<typename Iterator> +-SymbolParser<Iterator>::SymbolParser() : +- SymbolParser::base_type(start) +-{ +- using qi::lexeme; +- using qi::char_; +- using qi::lit; +- using qi::_1; +- using qi::_val; +- using qi::int_; +- using qi::double_; +- using qi::eol; +- +- newKey = 0; +- +- name %= '"' >> +(char_ - '"') >> '"'; +- +- group = lit("Group") >> int_; +- +- comments = lexeme[lit("//") >> *(char_ - eol || symbolKeyword - eol) >> eol +- || lit("/*") >> *(char_ - lit("*/") || symbolKeyword - lit("*/")) +- >> lit("*/")]; +- +- include = lit("include") +- >> name[phx::bind(&SymbolParser::getInclude, this, _1)]; +- +- type = lit("type") >> '[' >> group >> lit(']') >> lit('=') >> lit("\"") +- >> *(char_ - lvl) +- >> *lvl[phx::bind(&SymbolParser::setLevel, this, _1)] +- >> *(char_ - lvl - '"') >> lit("\""); +- +- symbol = +(char_ - ',' - ']'); +- +- symbols = *(lit("symbols") >> '[' >> group >> lit(']') >> lit('=')) >> '[' +- >> symbol[phx::bind(&SymbolParser::getSymbol, this, _1)] +- >> *(',' >> symbol[phx::bind(&SymbolParser::getSymbol, this, _1)]) +- >> ']'; +- +- keyName = '<' >> *(char_ - '>') >> '>'; +- +- key = (lit("key") +- >> keyName[phx::bind(&SymbolParser::addKeyName, this, _1)] >> '{' +- >> *(type >> ',') >> symbols >> *(',' >> type) >> lit("};")) +- || lit("key") >> lit(".") >> type >> lit(";"); +- +- ee = *(char_ - symbolKeyword - '{') >> '{' >> *(char_ - '}' - ';') +- >> lit("};"); +- +- start = *(char_ - lit("xkb_symbols") || comments) >> lit("xkb_symbols") +- >> name[phx::bind(&SymbolParser::setName, this, _1)] >> '{' +- >> *(key[phx::bind(&SymbolParser::addKey, this)] || include || ee +- || char_ - '}' - symbolKeyword || comments) >> lit("};") +- >> *(comments || char_); +-} +- +-template<typename Iterator> +-void SymbolParser<Iterator>::getSymbol(std::string n) +-{ +- int index = layout.keyList[keyIndex].getSymbolCount(); +- layout.keyList[keyIndex].addSymbol(QString::fromUtf8(n.data(), n.size()), +- index); +- //qCDebug(KEYBOARD_PREVIEW) << "adding symbol: " << QString::fromUtf8(n.data(), n.size()); +- //qCDebug(KEYBOARD_PREVIEW) << "added symbol: " << layout.keyList[keyIndex].getSymbol(index) << " in " << keyIndex << " at " << index; +-} +- +-template<typename Iterator> +-void SymbolParser<Iterator>::addKeyName(std::string n) +-{ +- QString kname = QString::fromUtf8(n.data(), n.size()); +- if (kname.startsWith(QLatin1String("Lat"))) { +- kname = alias.getAlias(layout.country, kname); +- } +- keyIndex = layout.findKey(kname); +- //qCDebug(KEYBOARD_PREVIEW) << layout.getKeyCount(); +- if (keyIndex == -1) { +- layout.keyList[layout.getKeyCount()].keyName = kname; +- keyIndex = layout.getKeyCount(); +- newKey = 1; +- } +- // qCDebug(KEYBOARD_PREVIEW) << "key at" << keyIndex; +-} +- +-template<typename Iterator> +-void SymbolParser<Iterator>::addKey() +-{ +- if (newKey == 1) { +- layout.addKey(); +- newKey = 0; +- //qCDebug(KEYBOARD_PREVIEW) << "new key"; +- } +-} +- +-template<typename Iterator> +-void SymbolParser<Iterator>::getInclude(std::string n) +-{ +- layout.addInclude(QString::fromUtf8(n.data(), n.size())); +-} +- +-template<typename Iterator> +-void SymbolParser<Iterator>::setName(std::string n) +-{ +- layout.setName(QString::fromUtf8(n.data(), n.size())); +- //qCDebug(KEYBOARD_PREVIEW) << layout.getLayoutName(); +-} +- +-template<typename Iterator> +-void SymbolParser<Iterator>::setLevel(int lvl) +-{ +- if (lvl > layout.getLevel()) { +- layout.setLevel(lvl); +- qCDebug(KEYBOARD_PREVIEW) << lvl; +- } +-} +- +-QString findSymbolBaseDir() +-{ +- QString xkbDir = Rules::findXkbDir(); +- return QStringLiteral("%1/symbols/").arg(xkbDir); +-} +- +-QString findLayout(const QString &layout, const QString &layoutVariant) +-{ +- +- QString symbolBaseDir = findSymbolBaseDir(); +- QString symbolFile = symbolBaseDir.append(layout); +- +- QFile sfile(symbolFile); +- if (!sfile.open(QIODevice::ReadOnly | QIODevice::Text)) { +- //qCDebug(KEYBOARD_PREVIEW) << "unable to open the file"; +- return QStringLiteral("I/O ERROR"); +- } +- +- QString scontent = sfile.readAll(); +- sfile.close(); +- QStringList scontentList = scontent.split(QStringLiteral("xkb_symbols")); +- +- QString variant; +- QString input; +- +- if (layoutVariant.isEmpty()) { +- input = scontentList.at(1); +- input.prepend("xkb_symbols"); +- } +- +- else { +- int current = 1; +- +- while (layoutVariant != variant && current < scontentList.size()) { +- input = scontentList.at(current); +- +- QString symbolCont = scontentList.at(current); +- +- int index = symbolCont.indexOf(QStringLiteral("\"")); +- symbolCont = symbolCont.mid(index); +- index = symbolCont.indexOf(QStringLiteral("{")); +- symbolCont = symbolCont.left(index); +- symbolCont = symbolCont.remove(QStringLiteral(" ")); +- variant = symbolCont.remove(QStringLiteral("\"")); +- +- input.prepend("xkb_symbols"); +- current++; +- } +- } +- +- return input; +-} +- +-KbLayout parseSymbols(const QString &layout, const QString &layoutVariant) +-{ +- +- using boost::spirit::iso8859_1::space; +- typedef std::string::const_iterator iterator_type; +- typedef grammar::SymbolParser<iterator_type> SymbolParser; +- +- SymbolParser symbolParser; +- +- symbolParser.layout.country = layout; +- QString input = findLayout(layout, layoutVariant); +- +- if (input == QLatin1String("I/O ERROR")) { +- symbolParser.layout.setParsedSymbol(false); +- return symbolParser.layout; +- } +- +- std::string parserInput = input.toUtf8().constData(); +- +- std::string::const_iterator iter = parserInput.begin(); +- std::string::const_iterator end = parserInput.end(); +- +- bool success = phrase_parse(iter, end, symbolParser, space); +- +- if (success && iter == end) { +- qCDebug(KEYBOARD_PREVIEW) << "Symbols Parsing succeeded"; +- symbolParser.layout.setParsedSymbol(true); +- +- } else { +- qWarning() << "Symbols Parsing failed\n" << input; +- symbolParser.layout.setParsedSymbol(false); +- } +- +- for (int currentInclude = 0; +- currentInclude < symbolParser.layout.getIncludeCount(); +- currentInclude++) { +- QString include = symbolParser.layout.getInclude(currentInclude); +- QStringList includeFile = include.split(QStringLiteral("(")); +- if (includeFile.size() == 2) { +- QString file = includeFile.at(0); +- QString layout = includeFile.at(1); +- layout.remove(QStringLiteral(")")); +- input = findLayout(file, layout); +- +- } +- +- else { +- QString a; +- a.clear(); +- input = findLayout(includeFile.at(0), a); +- } +- +- parserInput = input.toUtf8().constData(); +- +- std::string::const_iterator iter = parserInput.begin(); +- std::string::const_iterator end = parserInput.end(); +- +- success = phrase_parse(iter, end, symbolParser, space); +- +- if (success && iter == end) { +- qCDebug(KEYBOARD_PREVIEW) << "Symbols Parsing succeeded"; +- symbolParser.layout.setParsedSymbol(true); +- +- } else { +- qCDebug(KEYBOARD_PREVIEW) << "Symbols Parsing failed\n"; +- qCDebug(KEYBOARD_PREVIEW) << input; +- symbolParser.layout.setParsedSymbol(false); +- } +- +- } +- +- //s.layout.display(); +- if (symbolParser.layout.getParsedSymbol()) { +- return symbolParser.layout; +- } else { +- return parseSymbols(QStringLiteral("us"), QStringLiteral("basic")); +- } +-} +- +-} +diff --git a/plugins/devices/keyboard/preview/symbol_parser.h b/plugins/devices/keyboard/preview/symbol_parser.h +deleted file mode 100644 +index 77bf875..0000000 +--- a/plugins/devices/keyboard/preview/symbol_parser.h ++++ /dev/null +@@ -1,93 +0,0 @@ +-/* +- * Copyright (C) 2013 Shivam Makkar (amourphious1992@gmail.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; either version 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#ifndef SYMBOL_PARSER_H +-#define SYMBOL_PARSER_H +- +-#include <boost/config/warning_disable.hpp> +-#include <boost/spirit/include/qi.hpp> +-#include <boost/spirit/include/phoenix_core.hpp> +-#include <boost/spirit/include/phoenix_operator.hpp> +-#include <boost/spirit/include/phoenix_object.hpp> +-#include <boost/fusion/include/adapt_struct.hpp> +-#include <boost/fusion/include/io.hpp> +-#include <boost/spirit/include/phoenix_function.hpp> +-#include <boost/spirit/include/phoenix_statement.hpp> +-#include <boost/spirit/include/phoenix_bind.hpp> +-#include <boost/spirit/home/support/char_encoding/iso8859_1.hpp> +- +-#include <iostream> +-#include <QDebug> +- +-#include "keyboardlayout.h" +-#include "keyaliases.h" +- +- +-namespace qi = boost::spirit::qi; +-namespace ascii = boost::spirit::ascii; +-namespace phx = boost::phoenix; +-namespace iso = boost::spirit::iso8859_1; +- +- +-namespace grammar +-{ +- +-struct symbol_keywords : qi::symbols<char, int> { +- symbol_keywords(); +-}; +- +-struct levels : qi::symbols<char, int> { +- levels(); +-}; +- +-template<typename Iterator> +-struct SymbolParser : qi::grammar<Iterator, iso::space_type> { +- +- SymbolParser(); +- +- qi::rule<Iterator, iso::space_type>start; +- qi::rule<Iterator, std::string(), iso::space_type>name; +- qi::rule<Iterator, std::string(), iso::space_type>keyName; +- qi::rule<Iterator, std::string(), iso::space_type>symbols; +- qi::rule<Iterator, std::string(), iso::space_type>key; +- qi::rule<Iterator, std::string(), iso::space_type>type; +- qi::rule<Iterator, std::string(), iso::space_type>group; +- qi::rule<Iterator, std::string(), iso::space_type>symbol; +- qi::rule<Iterator, std::string(), iso::space_type>comments; +- qi::rule<Iterator, std::string(), iso::space_type>ee; +- qi::rule<Iterator, std::string(), iso::space_type>include; +- +- KbLayout layout; +- int keyIndex, newKey; +- symbol_keywords symbolKeyword; +- levels lvl; +- Aliases alias; +- +- void getSymbol(std::string n); +- void addKeyName(std::string n); +- void getInclude(std::string n); +- void addKey(); +- void setName(std::string n); +- void setLevel(int lvl); +-}; +- +-KbLayout parseSymbols(const QString &layout, const QString &layoutVariant); +-QString findSymbolBaseDir(); +-} +- +-#endif //SYMBOL_PARSER_H +diff --git a/plugins/devices/keyboard/preview/x11_helper.cpp b/plugins/devices/keyboard/preview/x11_helper.cpp +deleted file mode 100644 +index eb36733..0000000 +--- a/plugins/devices/keyboard/preview/x11_helper.cpp ++++ /dev/null +@@ -1,453 +0,0 @@ +-/* +- * Copyright (C) 2010 Andriy Rysin (rysin@kde.org) +- * +- * 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 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#include "x11_helper.h" +-#include "debug.h" +- +-#define explicit explicit_is_keyword_in_cpp +-#include <xcb/xkb.h> +-#undef explicit +- +- +-#include <QX11Info> +-#include <QCoreApplication> +-#include <QDebug> +- +-#include <X11/X.h> +-#include <X11/Xlib.h> +-#include <X11/Xatom.h> +-#include <X11/XKBlib.h> +-#include <X11/extensions/XKBrules.h> +-#include <xcb/xcb.h> +-#include <fixx11h.h> +- +-// more information about the limit https://bugs.freedesktop.org/show_bug.cgi?id=19501 +-const int X11Helper::MAX_GROUP_COUNT = 4; +-const int X11Helper::ARTIFICIAL_GROUP_LIMIT_COUNT = 8; +- +-const char X11Helper::LEFT_VARIANT_STR[] = "("; +-const char X11Helper::RIGHT_VARIANT_STR[] = ")"; +- +-bool X11Helper::xkbSupported(int* xkbOpcode) +-{ +- if (!QX11Info::isPlatformX11()) { +- return false; +- } +- // Verify the Xlib has matching XKB extension. +- +- int major = XkbMajorVersion; +- int minor = XkbMinorVersion; +- +- if (!XkbLibraryVersion(&major, &minor)) +- { +- qCWarning(KCM_KEYBOARD) << "Xlib XKB extension " << major << '.' << minor << +- " != " << XkbMajorVersion << '.' << XkbMinorVersion; +- return false; +- } +- +- // Verify the X server has matching XKB extension. +- +- int opcode_rtrn; +- int error_rtrn; +- int xkb_opcode; +- if( ! XkbQueryExtension(QX11Info::display(), &opcode_rtrn, &xkb_opcode, &error_rtrn, &major, &minor)) { +- qCWarning(KCM_KEYBOARD) << "X server XKB extension " << major << '.' << minor << +- " != " << XkbMajorVersion << '.' << XkbMinorVersion; +- return false; +- } +- +- if( xkbOpcode != nullptr ) { +- *xkbOpcode = xkb_opcode; +- } +- +- return true; +-} +- +-void X11Helper::switchToNextLayout() +-{ +- int size = getLayoutsList().size(); //TODO: could optimize a bit as we don't need the layouts - just count +- int group = (X11Helper::getGroup() + 1) % size; +- X11Helper::setGroup(group); +-} +- +-void X11Helper::scrollLayouts(int delta) +-{ +- int size = getLayoutsList().size(); //TODO: could optimize a bit as we don't need the layouts - just count +- int group = X11Helper::getGroup() + delta; +- group = group < 0 ? size - ((-group) % size) : group % size; +- +- X11Helper::setGroup(group); +-} +- +-QStringList X11Helper::getLayoutsListAsString(const QList<LayoutUnit>& layoutsList) +-{ +- QStringList stringList; +- foreach(const LayoutUnit& layoutUnit, layoutsList) { +- stringList << layoutUnit.toString(); +- } +- return stringList; +-} +- +-bool X11Helper::setLayout(const LayoutUnit& layout) +-{ +- QList<LayoutUnit> currentLayouts = getLayoutsList(); +- int idx = currentLayouts.indexOf(layout); +- if( idx == -1 || idx >= X11Helper::MAX_GROUP_COUNT ) { +- qCWarning(KCM_KEYBOARD) << "Layout" << layout.toString() << "is not found in current layout list" +- << getLayoutsListAsString(currentLayouts); +- return false; +- } +- +- return X11Helper::setGroup((unsigned int)idx); +-} +- +-bool X11Helper::setDefaultLayout() { +- return X11Helper::setGroup(0); +-} +- +-bool X11Helper::isDefaultLayout() { +- return X11Helper::getGroup() == 0; +-} +- +-LayoutUnit X11Helper::getCurrentLayout() +-{ +- if (!QX11Info::isPlatformX11()) { +- return LayoutUnit(); +- } +- QList<LayoutUnit> currentLayouts = getLayoutsList(); +- unsigned int group = X11Helper::getGroup(); +- if( group < (unsigned int)currentLayouts.size() ) +- return currentLayouts[group]; +- +- qCWarning(KCM_KEYBOARD) << "Current group number" << group << "is outside of current layout list" << +- getLayoutsListAsString(currentLayouts); +- return LayoutUnit(); +-} +- +-LayoutSet X11Helper::getCurrentLayouts() +-{ +- LayoutSet layoutSet; +- +- QList<LayoutUnit> currentLayouts = getLayoutsList(); +- layoutSet.layouts = currentLayouts; +- +- unsigned int group = X11Helper::getGroup(); +- if( group < (unsigned int)currentLayouts.size() ) { +- layoutSet.currentLayout = currentLayouts[group]; +- } +- else { +- qCWarning(KCM_KEYBOARD) << "Current group number" << group << "is outside of current layout list" << getLayoutsListAsString(currentLayouts); +- layoutSet.currentLayout = LayoutUnit(); +- } +- +- return layoutSet; +-} +- +- +-//static QString addNum(const QString& str, int n) +-//{ +-// QString format("%1%2"); +-// if( str.length() >= 3 ) return format.arg(str.left(2)).arg(n); +-// return format.arg(str).arg(n); +-//} +- +-QList<LayoutUnit> X11Helper::getLayoutsList() +-{ +- if (!QX11Info::isPlatformX11()) { +- return QList<LayoutUnit>(); +- } +- XkbConfig xkbConfig; +- QList<LayoutUnit> layouts; +- if( X11Helper::getGroupNames(QX11Info::display(), &xkbConfig, X11Helper::LAYOUTS_ONLY) ) { +- for(int i=0; i<xkbConfig.layouts.size(); i++) { +- QString layout(xkbConfig.layouts[i]); +- QString variant; +- if( i<xkbConfig.variants.size() && ! xkbConfig.variants[i].isEmpty() ) { +- variant = xkbConfig.variants[i]; +- } +- layouts << LayoutUnit(layout, variant); +- } +- // if there are layouts with same map name add numbers to display name +-// for(int i=0; i<layouts.length(); i++) { +-// int n=1; +-// for(int j=i+1; j<layouts.length(); j++) { +-// if( layouts[i].layout == layouts[j].layout && layouts[i].getRawDisplayName().isEmpty() ) { +-// layouts[i].setDisplayName( addNum(layouts[i].layout, 1) ); +-// layouts[j].setDisplayName( addNum(layouts[j].layout, ++n) ); +-// qCDebug(KCM_KEYBOARD) << "Adding" << 1 << "to" << layouts[i].toString(); +-// qCDebug(KCM_KEYBOARD) << "Adding" << n << "to" << layouts[j].toString(); +-// } +-// } +-// } +- } +- else { +- qCWarning(KCM_KEYBOARD) << "Failed to get layout groups from X server"; +- } +- return layouts; +-} +- +-bool X11Helper::setGroup(unsigned int group) +-{ +-// qDebug() << "setGroup--------------->" << endl; +-// qCDebug(KCM_KEYBOARD) << group; +-// xcb_void_cookie_t cookie; +-// cookie = xcb_xkb_latch_lock_state(QX11Info::connection(), +-// XCB_XKB_ID_USE_CORE_KBD, +-// 0, 0, +-// 1, +-// group, +-// 0, 0, 0 +-// ); +-// xcb_generic_error_t *error = nullptr; +-// error = xcb_request_check(QX11Info::connection(), cookie); +-// if (error) { +-// qCDebug(KCM_KEYBOARD) << "Couldn't change the group" << error->error_code; +-// return false; +-// } +- +- return true; +-} +- +-unsigned int X11Helper::getGroup() +-{ +- XkbStateRec xkbState; +- XkbGetState( QX11Info::display(), XkbUseCoreKbd, &xkbState ); +- return xkbState.group; +-} +- +-bool X11Helper::getGroupNames(Display* display, XkbConfig* xkbConfig, FetchType fetchType) +-{ +- static const char OPTIONS_SEPARATOR[] = ","; +- +- Atom real_prop_type; +- int fmt; +- unsigned long nitems, extra_bytes; +- char *prop_data = nullptr; +- Status ret; +- +- Atom rules_atom = XInternAtom(display, _XKB_RF_NAMES_PROP_ATOM, False); +- +- /* no such atom! */ +- if (rules_atom == None) { /* property cannot exist */ +- qCWarning(KCM_KEYBOARD) << "Failed to fetch layouts from server:" << "could not find the atom" << _XKB_RF_NAMES_PROP_ATOM; +- return false; +- } +- +- ret = XGetWindowProperty(display, +- DefaultRootWindow(display), +- rules_atom, 0L, _XKB_RF_NAMES_PROP_MAXLEN, +- False, XA_STRING, &real_prop_type, &fmt, +- &nitems, &extra_bytes, +- (unsigned char **) (void *) &prop_data); +- +- /* property not found! */ +- if (ret != Success) { +- qCWarning(KCM_KEYBOARD) << "Failed to fetch layouts from server:" << "Could not get the property"; +- return false; +- } +- +- /* has to be array of strings */ +- if ((extra_bytes > 0) || (real_prop_type != XA_STRING) || (fmt != 8)) { +- if (prop_data) +- XFree(prop_data); +- qCWarning(KCM_KEYBOARD) << "Failed to fetch layouts from server:" << "Wrong property format"; +- return false; +- } +- +-// qCDebug(KCM_KEYBOARD) << "prop_data:" << nitems << prop_data; +- QStringList names; +- for(char* p=prop_data; p-prop_data < (long)nitems && p != nullptr; p += strlen(p)+1) { +- names.append( p ); +-// qDebug() << " " << p; +- } +- +- if( names.count() < 4 ) { //{ rules, model, layouts, variants, options } +- XFree(prop_data); +- return false; +- } +- +- if( fetchType == ALL || fetchType == LAYOUTS_ONLY ) { +- QStringList layouts = names[2].split(OPTIONS_SEPARATOR); +- QStringList variants = names[3].split(OPTIONS_SEPARATOR); +- +- for(int ii=0; ii<layouts.count(); ii++) { +- xkbConfig->layouts << (layouts[ii] != nullptr ? layouts[ii] : QLatin1String("")); +- xkbConfig->variants << (ii < variants.count() && variants[ii] != nullptr ? variants[ii] : QLatin1String("")); +- } +- qCDebug(KCM_KEYBOARD) << "Fetched layout groups from X server:" +- << "\tlayouts:" << xkbConfig->layouts +- << "\tvariants:" << xkbConfig->variants; +- } +- +- if( fetchType == ALL || fetchType == MODEL_ONLY ) { +- xkbConfig->keyboardModel = (names[1] != nullptr ? names[1] : QLatin1String("")); +- qCDebug(KCM_KEYBOARD) << "Fetched keyboard model from X server:" << xkbConfig->keyboardModel; +- } +- +- if( fetchType == ALL ) { +- if( names.count() >= 5 ) { +- QString options = (names[4] != nullptr ? names[4] : QLatin1String("")); +- xkbConfig->options = options.split(OPTIONS_SEPARATOR); +- qCDebug(KCM_KEYBOARD) << "Fetched xkbOptions from X server:" << options; +- } +- } +- +- XFree(prop_data); +- return true; +-} +- +-XEventNotifier::XEventNotifier(): +- xkbOpcode(-1) +-{ +- if( QCoreApplication::instance() == nullptr ) { +- qCWarning(KCM_KEYBOARD) << "Layout Widget won't work properly without QCoreApplication instance"; +- } +-} +- +-void XEventNotifier::start() +-{ +- qCDebug(KCM_KEYBOARD) << "qCoreApp" << QCoreApplication::instance(); +- if( QCoreApplication::instance() != nullptr && X11Helper::xkbSupported(&xkbOpcode) ) { +- registerForXkbEvents(QX11Info::display()); +- +- // start the event loop +- QCoreApplication::instance()->installNativeEventFilter(this); +- } +-} +- +-void XEventNotifier::stop() +-{ +- if( QCoreApplication::instance() != nullptr ) { +- //TODO: unregister +- // XEventNotifier::unregisterForXkbEvents(QX11Info::display()); +- +- // stop the event loop +- QCoreApplication::instance()->removeNativeEventFilter(this); +- } +-} +- +- +-bool XEventNotifier::isXkbEvent(xcb_generic_event_t* event) +-{ +-// qDebug() << "event response type:" << (event->response_type & ~0x80) << xkbOpcode << ((event->response_type & ~0x80) == xkbOpcode + XkbEventCode); +- return (event->response_type & ~0x80) == xkbOpcode + XkbEventCode; +-} +- +-bool XEventNotifier::processOtherEvents(xcb_generic_event_t* /*event*/) +-{ +- return true; +-} +- +-bool XEventNotifier::processXkbEvents(xcb_generic_event_t* event) +-{ +- _xkb_event *xkbevt = reinterpret_cast<_xkb_event *>(event); +- if( XEventNotifier::isGroupSwitchEvent(xkbevt) ) { +-// qDebug() << "group switch event"; +- emit(layoutChanged()); +- } +- else if( XEventNotifier::isLayoutSwitchEvent(xkbevt) ) { +-// qDebug() << "layout switch event"; +- emit(layoutMapChanged()); +- } +- return true; +-} +- +-bool XEventNotifier::nativeEventFilter(const QByteArray &eventType, void *message, long *) +-{ +-// qDebug() << "event type:" << eventType; +- if (eventType == "xcb_generic_event_t") { +- xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message); +- if( isXkbEvent(ev) ) { +- processXkbEvents(ev); +- } +- else { +- processOtherEvents(ev); +- } +- } +- return false; +-} +- +-//bool XEventNotifier::x11Event(XEvent * event) +-//{ +-// // qApp->x11ProcessEvent ( event ); +-// if( isXkbEvent(event) ) { +-// processXkbEvents(event); +-// } +-// else { +-// processOtherEvents(event); +-// } +-// return QWidget::x11Event(event); +-//} +- +-bool XEventNotifier::isGroupSwitchEvent(_xkb_event* xkbEvent) +-{ +-// XkbEvent *xkbEvent = (XkbEvent*) event; +-#define GROUP_CHANGE_MASK \ +- ( XkbGroupStateMask | XkbGroupBaseMask | XkbGroupLatchMask | XkbGroupLockMask ) +- +- return xkbEvent->any.xkbType == XkbStateNotify && (xkbEvent->state_notify.changed & GROUP_CHANGE_MASK); +-} +- +-bool XEventNotifier::isLayoutSwitchEvent(_xkb_event* xkbEvent) +-{ +-// XkbEvent *xkbEvent = (XkbEvent*) event; +- +- return //( (xkbEvent->any.xkb_type == XkbMapNotify) && (xkbEvent->map.changed & XkbKeySymsMask) ) || +-/* || ( (xkbEvent->any.xkb_type == XkbNamesNotify) && (xkbEvent->names.changed & XkbGroupNamesMask) || )*/ +- (xkbEvent->any.xkbType == XkbNewKeyboardNotify); +-} +- +-int XEventNotifier::registerForXkbEvents(Display* display) +-{ +- int eventMask = XkbNewKeyboardNotifyMask | XkbStateNotifyMask; +- if( ! XkbSelectEvents(display, XkbUseCoreKbd, eventMask, eventMask) ) { +- qCWarning(KCM_KEYBOARD) << "Couldn't select desired XKB events"; +- return false; +- } +- return true; +-} +- +- +-static const char LAYOUT_VARIANT_SEPARATOR_PREFIX[] = "("; +-static const char LAYOUT_VARIANT_SEPARATOR_SUFFIX[] = ")"; +- +-static QString& stripVariantName(QString& variant) +-{ +- if( variant.endsWith(LAYOUT_VARIANT_SEPARATOR_SUFFIX) ) { +- int suffixLen = strlen(LAYOUT_VARIANT_SEPARATOR_SUFFIX); +- return variant.remove(variant.length()-suffixLen, suffixLen); +- } +- return variant; +-} +- +-LayoutUnit::LayoutUnit(const QString& fullLayoutName) +-{ +- QStringList lv = fullLayoutName.split(LAYOUT_VARIANT_SEPARATOR_PREFIX); +- layout = lv[0]; +- variant = lv.size() > 1 ? stripVariantName(lv[1]) : QLatin1String(""); +-} +- +-QString LayoutUnit::toString() const +-{ +- if( variant.isEmpty() ) +- return layout; +- +- return layout + LAYOUT_VARIANT_SEPARATOR_PREFIX+variant+LAYOUT_VARIANT_SEPARATOR_SUFFIX; +-} +- +-const int LayoutUnit::MAX_LABEL_LENGTH = 3; +diff --git a/plugins/devices/keyboard/preview/x11_helper.h b/plugins/devices/keyboard/preview/x11_helper.h +deleted file mode 100644 +index 29a092b..0000000 +--- a/plugins/devices/keyboard/preview/x11_helper.h ++++ /dev/null +@@ -1,260 +0,0 @@ +-/* +- * Copyright (C) 2010 Andriy Rysin (rysin@kde.org) +- * +- * 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 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +- +-#ifndef X11_HELPER_H_ +-#define X11_HELPER_H_ +- +-#include <QKeySequence> +-#include <QString> +-#include <QStringList> +-#include <QWidget> +-#include <QX11Info> +-#include <QAbstractNativeEventFilter> +- +-#include <xcb/xcb.h> +-//#include <xcb/xkb.h> +- +-//union _xkb_event; +-//class xcb_generic_event_t; +- +-// TODO: remove this when we can include xcb/xkb.h +-namespace +-{ +-typedef struct _xcb_xkb_map_notify_event_t { +- uint8_t response_type; +- uint8_t xkbType; +- uint16_t sequence; +- xcb_timestamp_t time; +- uint8_t deviceID; +- uint8_t ptrBtnActions; +- uint16_t changed; +- xcb_keycode_t minKeyCode; +- xcb_keycode_t maxKeyCode; +- uint8_t firstType; +- uint8_t nTypes; +- xcb_keycode_t firstKeySym; +- uint8_t nKeySyms; +- xcb_keycode_t firstKeyAct; +- uint8_t nKeyActs; +- xcb_keycode_t firstKeyBehavior; +- uint8_t nKeyBehavior; +- xcb_keycode_t firstKeyExplicit; +- uint8_t nKeyExplicit; +- xcb_keycode_t firstModMapKey; +- uint8_t nModMapKeys; +- xcb_keycode_t firstVModMapKey; +- uint8_t nVModMapKeys; +- uint16_t virtualMods; +- uint8_t pad0[2]; +-} _xcb_xkb_map_notify_event_t; +-typedef struct _xcb_xkb_state_notify_event_t { +- uint8_t response_type; +- uint8_t xkbType; +- uint16_t sequence; +- xcb_timestamp_t time; +- uint8_t deviceID; +- uint8_t mods; +- uint8_t baseMods; +- uint8_t latchedMods; +- uint8_t lockedMods; +- uint8_t group; +- int16_t baseGroup; +- int16_t latchedGroup; +- uint8_t lockedGroup; +- uint8_t compatState; +- uint8_t grabMods; +- uint8_t compatGrabMods; +- uint8_t lookupMods; +- uint8_t compatLoockupMods; +- uint16_t ptrBtnState; +- uint16_t changed; +- xcb_keycode_t keycode; +- uint8_t eventType; +- uint8_t requestMajor; +- uint8_t requestMinor; +-} _xcb_xkb_state_notify_event_t; +-typedef union { +- /* All XKB events share these fields. */ +- struct { +- uint8_t response_type; +- uint8_t xkbType; +- uint16_t sequence; +- xcb_timestamp_t time; +- uint8_t deviceID; +- } any; +- _xcb_xkb_map_notify_event_t map_notify; +- _xcb_xkb_state_notify_event_t state_notify; +-} _xkb_event; +-} +- +-class XEventNotifier : public QObject, public QAbstractNativeEventFilter { +- Q_OBJECT +- +-Q_SIGNALS: +- void layoutChanged(); +- void layoutMapChanged(); +- +-public: +- XEventNotifier(); +- ~XEventNotifier() override {} +- +- virtual void start(); +- virtual void stop(); +- +-protected: +-// bool x11Event(XEvent * e); +- virtual bool processOtherEvents(xcb_generic_event_t* e); +- virtual bool processXkbEvents(xcb_generic_event_t* e); +- bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override; +- +-private: +- int registerForXkbEvents(Display* display); +- bool isXkbEvent(xcb_generic_event_t* event); +- bool isGroupSwitchEvent(_xkb_event* event); +- bool isLayoutSwitchEvent(_xkb_event* event); +- +- int xkbOpcode; +-}; +- +-struct XkbConfig { +- QString keyboardModel; +- QStringList layouts; +- QStringList variants; +- QStringList options; +- +- bool isValid() { return ! layouts.empty(); } +-}; +- +- +-struct LayoutUnit { +- static const int MAX_LABEL_LENGTH; +- +- //TODO: move these to private? +- QString layout; +- QString variant; +- +- LayoutUnit() {} +- explicit LayoutUnit(const QString& fullLayoutName); +- LayoutUnit(const QString& layout_, const QString& variant_) { +- layout = layout_; +- variant = variant_; +- } +- /*explicit*/ LayoutUnit(const LayoutUnit& layoutUnit) { +- layout = layoutUnit.layout; +- variant = layoutUnit.variant; +- displayName = layoutUnit.displayName; +- shortcut = layoutUnit.shortcut; +- } +- +- QString getRawDisplayName() const { return displayName; } +- QString getDisplayName() const { return !displayName.isEmpty() ? displayName : layout; } +- void setDisplayName(const QString& name) { displayName = name; } +- +- void setShortcut(const QKeySequence& shortcut) { this->shortcut = shortcut; } +- QKeySequence getShortcut() const { return shortcut; } +- +- bool isEmpty() const { return layout.isEmpty(); } +- bool isValid() const { return ! isEmpty(); } +- bool operator==(const LayoutUnit& layoutItem) const { +- return layout==layoutItem.layout && variant==layoutItem.variant; +- } +- bool operator!=(const LayoutUnit& layoutItem) const { +- return ! (*this == layoutItem); +- } +- QString toString() const; +- +-private: +- QString displayName; +- QKeySequence shortcut; +-}; +- +-struct LayoutSet { +- QList<LayoutUnit> layouts; +- LayoutUnit currentLayout; +- +- LayoutSet() {} +- +- LayoutSet(const LayoutSet& currentLayouts) { +- this->layouts = currentLayouts.layouts; +- this->currentLayout = currentLayouts.currentLayout; +- } +- +- bool isValid() const { +- return currentLayout.isValid() && layouts.contains(currentLayout); +- } +- +- bool operator == (const LayoutSet& currentLayouts) const { +- return this->layouts == currentLayouts.layouts +- && this->currentLayout == currentLayouts.currentLayout; +- } +- +- LayoutSet& operator = (const LayoutSet& currentLayouts) { +- this->layouts = currentLayouts.layouts; +- this->currentLayout = currentLayouts.currentLayout; +- return *this; +- } +- +- QString toString() const { +- QString str(currentLayout.toString()); +- str += QLatin1String(": "); +- foreach(const LayoutUnit& layoutUnit, layouts) { +- str += layoutUnit.toString() + " "; +- } +- return str; +- } +- +- static QString toString(const QList<LayoutUnit>& layoutUnits) { +- QString str; +- foreach(const LayoutUnit& layoutUnit, layoutUnits) { +- str += layoutUnit.toString() + ","; +- } +- return str; +- } +-}; +- +-class X11Helper +-{ +-public: +- static const int MAX_GROUP_COUNT; +- static const int ARTIFICIAL_GROUP_LIMIT_COUNT; +- +- static const char LEFT_VARIANT_STR[]; +- static const char RIGHT_VARIANT_STR[]; +- +- static bool xkbSupported(int* xkbOpcode); +- +- static void switchToNextLayout(); +- static void scrollLayouts(int delta); +- static bool isDefaultLayout(); +- static bool setDefaultLayout(); +- static bool setLayout(const LayoutUnit& layout); +- static LayoutUnit getCurrentLayout(); +- static LayoutSet getCurrentLayouts(); +- static QList<LayoutUnit> getLayoutsList(); +- static QStringList getLayoutsListAsString(const QList<LayoutUnit>& layoutsList); +- +- enum FetchType { ALL, LAYOUTS_ONLY, MODEL_ONLY }; +- static bool getGroupNames(Display* dpy, XkbConfig* xkbConfig, FetchType fetchType); +- +-private: +- static unsigned int getGroup(); +- static bool setGroup(unsigned int group); +-}; +- +-#endif /* X11_HELPER_H_ */ +diff --git a/plugins/devices/keyboard/preview/xkb_rules.cpp b/plugins/devices/keyboard/preview/xkb_rules.cpp +deleted file mode 100644 +index 619fc92..0000000 +--- a/plugins/devices/keyboard/preview/xkb_rules.cpp ++++ /dev/null +@@ -1,497 +0,0 @@ +-/* +- * Copyright (C) 2010 Andriy Rysin (rysin@kde.org) +- * +- * 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 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +-#include "xkb_rules.h" +-#include "config-workspace.h" +-#include "debug.h" +- +-#include <KLocalizedString> +- +-#include <QDir> +-#include <QRegExp> +-#include <QTextDocument> // for Qt::escape +-#include <QXmlAttributes> +- +-#include <QtConcurrent> +-//#include <libintl.h> +-//#include <locale.h> +- +-#include "x11_helper.h" +- +-// for findXkbRuleFile +-#include <QX11Info> +-#include <X11/Xlib.h> +-#include <X11/Xatom.h> +-#include <X11/XKBlib.h> +-#include <X11/extensions/XKBrules.h> +-#include <fixx11h.h> +-#include "config-workspace.h" +- +- +- +-class RulesHandler : public QXmlDefaultHandler +-{ +-public: +- RulesHandler(Rules* rules_, bool fromExtras_): +- rules(rules_), +- fromExtras(fromExtras_){} +- +- bool startElement(const QString &namespaceURI, const QString &localName, +- const QString &qName, const QXmlAttributes &attributes) override; +- bool endElement(const QString &namespaceURI, const QString &localName, +- const QString &qName) override; +- bool characters(const QString &str) override; +-// bool fatalError(const QXmlParseException &exception); +-// QString errorString() const; +- +-private: +-// QString getString(const QString& text); +- +- QStringList path; +- Rules* rules; +- const bool fromExtras; +-}; +- +-static QString translate_xml_item(const QString& itemText) +-{ +- if (itemText.isEmpty()) { // i18n warns on empty input strings +- return itemText; +- } +- //messages are already extracted from the source XML files by xkb +- //the characters '<' and '>' (but not '"') are HTML-escaped in the xkeyboard-config translation files, so we need to convert them before/after looking up the translation +- //note that we cannot use QString::toHtmlEscaped() here because that would convert '"' as well +- QString msgid(itemText); +- return i18nd("xkeyboard-config", msgid.replace(QLatin1Literal("<"), QLatin1Literal("<")).replace(QLatin1Literal(">"), QLatin1Literal(">")).toUtf8()).replace(QLatin1Literal("<"), QLatin1Literal("<")).replace(QLatin1Literal(">"), QLatin1Literal(">")); +-} +- +-static QString translate_description(ConfigItem* item) +-{ +- return item->description.isEmpty() +- ? item->name : translate_xml_item(item->description); +-} +- +-static bool notEmpty(const ConfigItem* item) +-{ +- return ! item->name.isEmpty(); +-} +- +-template<class T> +-void removeEmptyItems(QList<T*>& list) +-{ +-#ifdef __GNUC__ +-#if __GNUC__ == 4 && (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 3) || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ < 4) +-#warning Compiling with a workaround for GCC < 4.8.3 || GCC < 4.7.4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800 +- Q_FOREACH(T* x, list) { +- ConfigItem *y = static_cast<ConfigItem*>(x); +- if (y->name.isEmpty()) { +- list.removeAll(x); +- } +- } +-#else +- QtConcurrent::blockingFilter(list, notEmpty); +-#endif +-#endif +-} +- +-static +-void postProcess(Rules* rules) +-{ +- //TODO remove elements with empty names to safeguard us +- removeEmptyItems(rules->layoutInfos); +- removeEmptyItems(rules->modelInfos); +- removeEmptyItems(rules->optionGroupInfos); +- +-// setlocale(LC_ALL, ""); +-// bindtextdomain("xkeyboard-config", LOCALE_DIR); +- foreach(ModelInfo* modelInfo, rules->modelInfos) { +- modelInfo->vendor = translate_xml_item(modelInfo->vendor); +- modelInfo->description = translate_description(modelInfo); +- } +- +- foreach(LayoutInfo* layoutInfo, rules->layoutInfos) { +- layoutInfo->description = translate_description(layoutInfo); +- +- removeEmptyItems(layoutInfo->variantInfos); +- foreach(VariantInfo* variantInfo, layoutInfo->variantInfos) { +- variantInfo->description = translate_description(variantInfo); +- } +- } +- foreach(OptionGroupInfo* optionGroupInfo, rules->optionGroupInfos) { +- optionGroupInfo->description = translate_description(optionGroupInfo); +- +- removeEmptyItems(optionGroupInfo->optionInfos); +- foreach(OptionInfo* optionInfo, optionGroupInfo->optionInfos) { +- optionInfo->description = translate_description(optionInfo); +- } +- } +-} +- +- +-Rules::Rules(): +- version(QStringLiteral("1.0")) +-{ +-} +- +-QString Rules::getRulesName() +-{ +- if (!QX11Info::isPlatformX11()) { +- return QString(); +- } +- XkbRF_VarDefsRec vd; +- char *tmp = nullptr; +- +- if (XkbRF_GetNamesProp(QX11Info::display(), &tmp, &vd) && tmp != nullptr ) { +- // qCDebug(KCM_KEYBOARD) << "namesprop" << tmp ; +- const QString name(tmp); +- XFree(tmp); +- return name; +- } +- +- return {}; +-} +- +-QString Rules::findXkbDir() +-{ +- return QStringLiteral(XKBDIR); +-} +- +-static QString findXkbRulesFile() +-{ +- QString rulesFile; +- QString rulesName = Rules::getRulesName(); +- +- const QString xkbDir = Rules::findXkbDir(); +- if ( ! rulesName.isNull() ) { +- rulesFile = QStringLiteral("%1/rules/%2.xml").arg(xkbDir, rulesName); +- } else { +- // default to evdev +- rulesFile = QStringLiteral("%1/rules/evdev.xml").arg(xkbDir); +- } +- +- return rulesFile; +-} +- +-static +-void mergeRules(Rules* rules, Rules* extraRules) +-{ +- rules->modelInfos.append( extraRules->modelInfos ); +- rules->optionGroupInfos.append( extraRules->optionGroupInfos ); // need to iterate and merge? +- +- QList<LayoutInfo*> layoutsToAdd; +- foreach(LayoutInfo* extraLayoutInfo, extraRules->layoutInfos) { +- LayoutInfo* layoutInfo = findByName(rules->layoutInfos, extraLayoutInfo->name); +- if( layoutInfo != nullptr ) { +- layoutInfo->variantInfos.append( extraLayoutInfo->variantInfos ); +- layoutInfo->languages.append( extraLayoutInfo->languages ); +- } +- else { +- layoutsToAdd.append(extraLayoutInfo); +- } +- } +- rules->layoutInfos.append(layoutsToAdd); +- qCDebug(KCM_KEYBOARD) << "Merged from extra rules:" << extraRules->layoutInfos.size() << "layouts," << extraRules->modelInfos.size() << "models," << extraRules->optionGroupInfos.size() << "option groups"; +- +- // base rules now own the objects - remove them from extra rules so that it does not try to delete them +- extraRules->layoutInfos.clear(); +- extraRules->modelInfos.clear(); +- extraRules->optionGroupInfos.clear(); +-} +- +- +-const char Rules::XKB_OPTION_GROUP_SEPARATOR = ':'; +- +-Rules* Rules::readRules(ExtrasFlag extrasFlag) +-{ +- Rules* rules = new Rules(); +- QString rulesFile = findXkbRulesFile(); +- if( ! readRules(rules, rulesFile, false) ) { +- delete rules; +- rules = nullptr; +- return nullptr; +- } +- if( extrasFlag == Rules::READ_EXTRAS ) { +- QRegExp regex(QStringLiteral("\\.xml$")); +- Rules* rulesExtra = new Rules(); +- QString extraRulesFile = rulesFile.replace(regex, QStringLiteral(".extras.xml")); +- if( readRules(rulesExtra, extraRulesFile, true) ) { // not fatal if it fails +- mergeRules(rules, rulesExtra); +- } +- delete rulesExtra; +- rulesExtra = nullptr; +- } +- return rules; +-} +- +- +-Rules* Rules::readRules(Rules* rules, const QString& filename, bool fromExtras) +-{ +- QFile file(filename); +- if( !file.open(QFile::ReadOnly | QFile::Text) ) { +- qCCritical(KCM_KEYBOARD) << "Cannot open the rules file" << file.fileName(); +- return nullptr; +- } +- +- RulesHandler rulesHandler(rules, fromExtras); +- +- QXmlSimpleReader reader; +- reader.setContentHandler(&rulesHandler); +- reader.setErrorHandler(&rulesHandler); +- +- QXmlInputSource xmlInputSource(&file); +- +- qCDebug(KCM_KEYBOARD) << "Parsing xkb rules from" << file.fileName(); +- +- if( ! reader.parse(xmlInputSource) ) { +- qCCritical(KCM_KEYBOARD) << "Failed to parse the rules file" << file.fileName(); +- return nullptr; +- } +- +- postProcess(rules); +- +- return rules; +-} +- +-bool RulesHandler::startElement(const QString &/*namespaceURI*/, const QString &/*localName*/, +- const QString &qName, const QXmlAttributes &attributes) +-{ +- path << QString(qName); +- +- QString strPath = path.join(QStringLiteral("/")); +- if( strPath.endsWith(QLatin1String("layoutList/layout/configItem")) ) { +- rules->layoutInfos << new LayoutInfo(fromExtras); +- } +- else if( strPath.endsWith(QLatin1String("layoutList/layout/variantList/variant")) ) { +- rules->layoutInfos.last()->variantInfos << new VariantInfo(fromExtras); +- } +- else if( strPath.endsWith(QLatin1String("modelList/model")) ) { +- rules->modelInfos << new ModelInfo(); +- } +- else if( strPath.endsWith(QLatin1String("optionList/group")) ) { +- rules->optionGroupInfos << new OptionGroupInfo(); +- rules->optionGroupInfos.last()->exclusive = (attributes.value(QStringLiteral("allowMultipleSelection")) != QLatin1String("true")); +- } +- else if( strPath.endsWith(QLatin1String("optionList/group/option")) ) { +- rules->optionGroupInfos.last()->optionInfos << new OptionInfo(); +- } +- else if( strPath == ("xkbConfigRegistry") && ! attributes.value(QStringLiteral("version")).isEmpty() ) { +- rules->version = attributes.value(QStringLiteral("version")); +- qCDebug(KCM_KEYBOARD) << "xkbConfigRegistry version" << rules->version; +- } +- return true; +-} +- +-bool RulesHandler::endElement(const QString &/*namespaceURI*/, const QString &/*localName*/, const QString &/*qName*/) +-{ +- path.removeLast(); +- return true; +-} +- +-bool RulesHandler::characters(const QString &str) +-{ +- if( !str.trimmed().isEmpty() ) { +- QString strPath = path.join(QStringLiteral("/")); +- if( strPath.endsWith(QLatin1String("layoutList/layout/configItem/name")) ) { +- if( rules->layoutInfos.last() != nullptr ) { +- rules->layoutInfos.last()->name = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "name:" << str; +- } +- // skipping invalid entry +- } +- else if( strPath.endsWith(QLatin1String("layoutList/layout/configItem/description")) ) { +- rules->layoutInfos.last()->description = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "descr:" << str; +- } +- else if( strPath.endsWith(QLatin1String("layoutList/layout/configItem/languageList/iso639Id")) ) { +- rules->layoutInfos.last()->languages << str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "\tlang:" << str; +- } +- else if( strPath.endsWith(QLatin1String("layoutList/layout/variantList/variant/configItem/name")) ) { +- rules->layoutInfos.last()->variantInfos.last()->name = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "\tvariant name:" << str; +- } +- else if( strPath.endsWith(QLatin1String("layoutList/layout/variantList/variant/configItem/description")) ) { +- rules->layoutInfos.last()->variantInfos.last()->description = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "\tvariant descr:" << str; +- } +- else if( strPath.endsWith(QLatin1String("layoutList/layout/variantList/variant/configItem/languageList/iso639Id")) ) { +- rules->layoutInfos.last()->variantInfos.last()->languages << str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "\tvlang:" << str; +- } +- else if( strPath.endsWith(QLatin1String("modelList/model/configItem/name")) ) { +- rules->modelInfos.last()->name = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "name:" << str; +- } +- else if( strPath.endsWith(QLatin1String("modelList/model/configItem/description")) ) { +- rules->modelInfos.last()->description = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "\tdescr:" << str; +- } +- else if( strPath.endsWith(QLatin1String("modelList/model/configItem/vendor")) ) { +- rules->modelInfos.last()->vendor = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "\tvendor:" << str; +- } +- else if( strPath.endsWith(QLatin1String("optionList/group/configItem/name")) ) { +- rules->optionGroupInfos.last()->name = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "name:" << str; +- } +- else if( strPath.endsWith(QLatin1String("optionList/group/configItem/description")) ) { +- rules->optionGroupInfos.last()->description = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "\tdescr:" << str; +- } +- else if( strPath.endsWith(QLatin1String("optionList/group/option/configItem/name")) ) { +- rules->optionGroupInfos.last()->optionInfos.last()->name = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "name:" << str; +- } +- else if( strPath.endsWith(QLatin1String("optionList/group/option/configItem/description")) ) { +- rules->optionGroupInfos.last()->optionInfos.last()->description = str.trimmed(); +-// qCDebug(KCM_KEYBOARD) << "\tdescr:" << str; +- } +- } +- return true; +-} +- +-bool LayoutInfo::isLanguageSupportedByLayout(const QString& lang) const +-{ +- if( languages.contains(lang) || isLanguageSupportedByVariants(lang) ) +- return true; +- +-// // return yes if no languages found in layout or its variants +-// if( languages.empty() ) { +-// foreach(const VariantInfo* info, variantInfos) { +-// if( ! info->languages.empty() ) +-// return false; +-// } +-// return true; +-// } +- +- return false; +-} +- +-bool LayoutInfo::isLanguageSupportedByVariants(const QString& lang) const +-{ +- foreach(const VariantInfo* info, variantInfos) { +- if( info->languages.contains(lang) ) +- return true; +- } +- return false; +-} +- +-bool LayoutInfo::isLanguageSupportedByDefaultVariant(const QString& lang) const +-{ +- if( languages.contains(lang) ) +- return true; +- +- if( languages.empty() && isLanguageSupportedByVariants(lang) ) +- return true; +- +- return false; +-} +- +-bool LayoutInfo::isLanguageSupportedByVariant(const VariantInfo* variantInfo, const QString& lang) const +-{ +- if( variantInfo->languages.contains(lang) ) +- return true; +- +- // if variant has no languages try to "inherit" them from layout +- if( variantInfo->languages.empty() && languages.contains(lang) ) +- return true; +- +- return false; +-} +- +-#ifdef NEW_GEOMETRY +- +-Rules::GeometryId Rules::getGeometryId(const QString& model) { +- QString xkbDir = Rules::findXkbDir(); +- QString rulesName = Rules::getRulesName(); +- QString ruleFileName = QStringLiteral("%1/rules/%2").arg(xkbDir, rulesName); +- QFile ruleFile(ruleFileName); +- +- GeometryId defaultGeoId(QStringLiteral("pc"), QStringLiteral("pc104")); +- +- if ( ! ruleFile.open(QIODevice::ReadOnly | QIODevice::Text) ){ +- qCCritical(KCM_KEYBOARD) << "Unable to open file" << ruleFileName; +- return defaultGeoId; +- } +- +- QString modelGeoId = model; +- bool inTable = false; +- QTextStream in(&ruleFile); +- +- while (!in.atEnd()) { +- QString line = in.readLine().trimmed(); +- +- if( line.isEmpty() || QRegExp(QStringLiteral("^\\s*//")).indexIn(line) != -1 ) +- continue; +- +- QRegExp modelGroupRegex(QStringLiteral("!\\s*(\\$[a-zA-Z0-9_]+)\\s*=(.*)")); +- +- if( modelGroupRegex.indexIn(line) != -1 ) { +- QStringList parts = modelGroupRegex.capturedTexts(); +- QString groupName = parts[1]; +- QStringList models = parts[2].split(QRegExp(QStringLiteral("\\s+")), QString::SkipEmptyParts); +- +-// qCDebug(KCM_KEYBOARD) << "modelGroup definition" << groupName << ":" << models; +- if( models.contains(model) ) { +- modelGeoId = groupName; +- } +- continue; +- } +- +- +- if( inTable ) { +- QRegExp modelTableEntry (QStringLiteral("\\s*(\\$?[a-zA-Z0-9_]+|\\*)\\s*=\\s*([a-zA-Z0-9_]+)\\(([a-zA-Z0-9_%]+)\\)")); +- if( modelTableEntry.indexIn(line) == -1 ) { +- if( QRegExp(QStringLiteral("^!\\s*")).indexIn(line) != -1 ) +- break; +- +- qCWarning(KCM_KEYBOARD) << "could not parse geometry line" << line; +- continue; +- } +- +- QStringList parts = modelTableEntry.capturedTexts(); +- QString modelName = parts[1]; +- QString fileName = parts[2]; +- QString geoName = parts[3]; +- if( geoName == QLatin1String("%m") ) { +- geoName = model; +- } +- if( modelName == QLatin1String("*") ) { +- defaultGeoId = GeometryId(fileName, geoName); +- } +- +-// qCDebug(KCM_KEYBOARD) << "geo entry" << modelName << fileName << geoName; +- +- if( modelName == model ) { +- return GeometryId(fileName, geoName); +- } +- +- continue; +- } +- +- QRegExp modelTableHeader (QStringLiteral("!\\s+model\\s*=\\s*geometry")); +- if( modelTableHeader.indexIn(line) != -1 ) { +- inTable = true; +- continue; +- } +- +- } +- +- return defaultGeoId; +-} +- +-#endif +diff --git a/plugins/devices/keyboard/preview/xkb_rules.h b/plugins/devices/keyboard/preview/xkb_rules.h +deleted file mode 100644 +index 2351611..0000000 +--- a/plugins/devices/keyboard/preview/xkb_rules.h ++++ /dev/null +@@ -1,142 +0,0 @@ +-/* +- * Copyright (C) 2010 Andriy Rysin (rysin@kde.org) +- * +- * 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 2 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, write to the Free Software +- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +- */ +- +- +-#ifndef XKB_RULES_H_ +-#define XKB_RULES_H_ +- +-#include <QXmlDefaultHandler> +-#include <QList> +-#include <QStringList> +- +-#include "config-keyboard.h" +- +-struct ConfigItem { +- QString name; +- QString description; +-}; +- +-template <class T> +-inline T* findByName(QList<T*> list, QString name) { +- foreach(T* info, list) { +- if( info->name == name ) +- return info; +- } +- return nullptr; +-} +- +-struct VariantInfo: public ConfigItem { +- QList<QString> languages; +- const bool fromExtras; +- +- VariantInfo(bool fromExtras_): +- fromExtras(fromExtras_) {} +-}; +- +-struct LayoutInfo: public ConfigItem { +- QList<VariantInfo*> variantInfos; +- QList<QString> languages; +- const bool fromExtras; +- +-// LayoutInfo() {} +- LayoutInfo(bool fromExtras_): +- fromExtras(fromExtras_) {} +- ~LayoutInfo() { foreach(VariantInfo* variantInfo, variantInfos) delete variantInfo; } +- +- VariantInfo* getVariantInfo(const QString& variantName) const { +- return findByName(variantInfos, variantName); +- } +- +- bool isLanguageSupportedByLayout(const QString& lang) const; +- bool isLanguageSupportedByDefaultVariant(const QString& lang) const; +- bool isLanguageSupportedByVariants(const QString& lang) const; +- bool isLanguageSupportedByVariant(const VariantInfo* variantInfo, const QString& lang) const; +-}; +- +-struct ModelInfo: public ConfigItem { +- QString vendor; +-}; +- +-struct OptionInfo: public ConfigItem { +-}; +- +-struct OptionGroupInfo: public ConfigItem { +- QList<OptionInfo*> optionInfos; +- bool exclusive; +- +- ~OptionGroupInfo() { foreach(OptionInfo* opt, optionInfos) delete opt; } +- +- const OptionInfo* getOptionInfo(const QString& optionName) const { +- return findByName(optionInfos, optionName); +- } +-}; +- +-struct Rules { +- enum ExtrasFlag { NO_EXTRAS, READ_EXTRAS }; +- +- static const char XKB_OPTION_GROUP_SEPARATOR; +- +- QList<LayoutInfo*> layoutInfos; +- QList<ModelInfo*> modelInfos; +- QList<OptionGroupInfo*> optionGroupInfos; +- QString version; +- +- Rules(); +- +- ~Rules() { +- foreach(LayoutInfo* layoutInfo, layoutInfos) delete layoutInfo; +- foreach(ModelInfo* modelInfo, modelInfos) delete modelInfo; +- foreach(OptionGroupInfo* optionGroupInfo, optionGroupInfos) delete optionGroupInfo; +- } +- +- const LayoutInfo* getLayoutInfo(const QString& layoutName) const { +- return findByName(layoutInfos, layoutName); +- } +- +- const OptionGroupInfo* getOptionGroupInfo(const QString& optionGroupName) const { +- return findByName(optionGroupInfos, optionGroupName); +- } +- +- static Rules* readRules(ExtrasFlag extrasFlag); +- static Rules* readRules(Rules* rules, const QString& filename, bool fromExtras); +- static QString getRulesName(); +- static QString findXkbDir(); +- +-#ifdef NEW_GEOMETRY +- class GeometryId { +- public: +- QString fileName; +- QString geoName; +- +- GeometryId(const QString& fileName_, const QString& geoName_): +- fileName(fileName_), +- geoName(geoName_) {} +- +- GeometryId& operator=(const GeometryId& geoId) { +- fileName = geoId.fileName; +- geoName = geoId.geoName; +- return *this; +- } +- }; +- +- static GeometryId getGeometryId(const QString& model); +-#endif +- +-}; +- +-#endif /* XKB_RULES_H_ */ +diff --git a/plugins/devices/keyboard/tastenbrett.cpp b/plugins/devices/keyboard/tastenbrett.cpp +deleted file mode 100644 +index ab95303..0000000 +--- a/plugins/devices/keyboard/tastenbrett.cpp ++++ /dev/null +@@ -1,63 +0,0 @@ +-/* +- Copyright 2019 Harald Sitter <sitter@kde.org> +- 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 2 of +- the License or (at your option) version 3 or any later version +- accepted by the membership of KDE e.V. (or its successor approved +- by the membership of KDE e.V.), which shall act as a proxy +- defined in Section 14 of version 3 of the license. +- This program is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. +- You should have received a copy of the GNU General Public License +- along with this program. If not, see <http://www.gnu.org/licenses/>. +-*/ +- +-#include "tastenbrett.h" +- +-#include <QCoreApplication> +-#include <QProcess> +-#include <QStandardPaths> +-#include <QDebug> +- +-QString Tastenbrett::path() +-{ +- static QString path; +- if (!path.isNull()) { +- return path; +- } +- +- // Find relative to KCM (when run from build dir) +- path = QStandardPaths::findExecutable("tastenbrett", { qEnvironmentVariable("QT_PLUGIN_PATH"), +- qApp->applicationDirPath() }); +- if (!path.isNull()) { +- return path; +- } +- +- return QStandardPaths::findExecutable("tastenbrett"); +-} +- +-bool Tastenbrett::exists() +-{ +- return !path().isNull(); +-} +- +-void Tastenbrett::launch(const QString &model, const QString &layout, const QString &variant, const QString &options, const QString &title) +-{ +- if (!exists()) { +- return; +- } +- +- QProcess p; +- p.setProgram(path()); +- QStringList args { "--model", model, "--layout", layout, "--variant", variant, "--options", options }; +- if (!title.isEmpty()) { +- args << "-title" << title; +- } +- qDebug() << args; +- p.setArguments(args); +- p.setProcessChannelMode(QProcess::ForwardedChannels); +- p.startDetached(); +-} +diff --git a/plugins/devices/keyboard/tastenbrett.h b/plugins/devices/keyboard/tastenbrett.h +deleted file mode 100644 +index 68ff590..0000000 +--- a/plugins/devices/keyboard/tastenbrett.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-/* +- Copyright 2019 Harald Sitter <sitter@kde.org> +- 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 2 of +- the License or (at your option) version 3 or any later version +- accepted by the membership of KDE e.V. (or its successor approved +- by the membership of KDE e.V.), which shall act as a proxy +- defined in Section 14 of version 3 of the license. +- This program is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. +- You should have received a copy of the GNU General Public License +- along with this program. If not, see <http://www.gnu.org/licenses/>. +-*/ +- +-#ifndef TASTENBRETT_H +-#define TASTENBRETT_H +- +-#include <QString> +- +-class Tastenbrett +-{ +-public: +- static QString path(); +- static bool exists(); +- static void launch(const QString &model, const QString &layout, const QString &variant, const QString &options, +- const QString &title = QString()); +-}; +- +-#endif // TASTENBRETT_H diff -Nru ukui-control-center-4.10.0.0/debian/patches/series ukui-control-center-4.10.0.0/debian/patches/series --- ukui-control-center-4.10.0.0/debian/patches/series 2025-01-01 16:22:05.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/patches/series 2025-02-07 16:32:50.000000000 +0800 @@ -108,3 +108,22 @@ 0108-124-bug.patch 0109-125-277741.patch 0110-chore-changelog.patch +0111-128-316417.patch +0112-fix-theme.patch +0113-fix-theme.patch +0114-127-bug.patch +0115-131-290807.patch +0116-chore-md.patch +0117-133-v11-2501.patch +0118-135-291185.patch +0119-139-bug.patch +0120-140-fix-panel-bug-278913.patch +0121-141-380937-2024-OEM-v11-2501.patch +0122-142-vino.patch +0123-143-380927-v11-2501.patch +0124-146-326999-core.patch +0125-145-update-display-log.patch +0126-152-sdk.patch +0127-154-fix-ukui-control-center-update-agreement.patch +0128-155-fix-font.patch +0129-fix-sonar-security.patch diff -Nru ukui-control-center-4.10.0.0/debian/source/include-binaries ukui-control-center-4.10.0.0/debian/source/include-binaries --- ukui-control-center-4.10.0.0/debian/source/include-binaries 2025-01-01 16:22:05.000000000 +0800 +++ ukui-control-center-4.10.0.0/debian/source/include-binaries 2025-02-07 16:32:50.000000000 +0800 @@ -22,3 +22,5 @@ debian/patches/0095-102-bug.patch debian/patches/0103-118-291281.patch debian/patches/0106-122-md.patch +debian/patches/0116-chore-md.patch +debian/patches/0120-140-fix-panel-bug-278913.patch