├── CommonControl ├── CommonControl.pri ├── kabuttonproxystyle.cpp ├── kabuttonproxystyle.h ├── kagroupbutton.cpp ├── kagroupbutton.h ├── kainfotitle.cpp ├── kainfotitle.h ├── kalabel.cpp ├── kalabel.h ├── kaslider.cpp ├── kaslider.h ├── katabbar.cpp ├── katabbar.h ├── katabbutton.cpp ├── katabbutton.h ├── kdriveinfoitem.cpp ├── kdriveinfoitem.h ├── kinfolistitem.cpp ├── kinfolistitem.h ├── loadingwidget.cpp └── loadingwidget.h ├── README.md ├── commonfunc ├── commonfunc.pri ├── utils.cpp └── utils.h ├── data └── toolkit │ ├── en_US │ ├── image │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ └── 8.png │ └── index.md │ ├── toolkit.png │ └── zh_CN │ ├── image │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ └── 8.png │ └── index.md ├── dataworker ├── dataworker.cpp ├── dataworker.h └── dataworker.pri ├── debian ├── changelog ├── control ├── copyright ├── install ├── kylin-assistant.manpages ├── links ├── rules ├── source │ └── format └── watch ├── env.pri ├── kyasDbus ├── kyasDbus.pro └── systemdaemon │ ├── audioadaptorthread.py │ ├── conf │ ├── com.kylin.assistant.systemdaemon.conf │ ├── com.kylin.assistant.systemdaemon.policy │ └── com.kylin.assistant.systemdaemon.service │ ├── kabatteryinfo.py │ ├── kabluetoothinfo.py │ ├── kacamerainfo.py │ ├── kacdrominfo.py │ ├── kacmdtool.py │ ├── kacpufm.py │ ├── kadevmonitor.py │ ├── kafaninfo.py │ ├── kagraphicscardinfo.py │ ├── kaharddiskinfo.py │ ├── kahwinfo.py │ ├── kajsondef.py │ ├── kakeyboardinfo.py │ ├── kamachineinfo.py │ ├── kamonitorthread.py │ ├── kamouseinfo.py │ ├── kapolicykit.py │ ├── karealization.py │ ├── kasystemdbusmain.py │ ├── kathread.py │ ├── memoryinfothread.py │ ├── networkadaptorthread.py │ ├── systemboardthread.py │ └── utils.py ├── kylin-assistant.desktop ├── kylin-assistant.pro ├── man ├── kylin-assistant-systemdaemon.py.1 ├── kylin-assistant-systemdbus.py.1 └── kylin-assistant.1 ├── plugins ├── drivemanage │ ├── driveinfopage.cpp │ ├── driveinfopage.h │ ├── drivemanage.cpp │ ├── drivemanage.h │ └── drivemanage.pro ├── hwmonitor │ ├── cpufmpage.cpp │ ├── cpufmpage.h │ ├── cpufmsetwidget.cpp │ ├── cpufmsetwidget.h │ ├── devicemonitorpage.cpp │ ├── devicemonitorpage.h │ ├── hwmonitor.cpp │ ├── hwmonitor.h │ ├── hwmonitor.pro │ ├── hwmonitorwidget.cpp │ ├── hwmonitorwidget.h │ ├── kaprogressbar.cpp │ ├── kaprogressbar.h │ ├── katempitem.cpp │ ├── katempitem.h │ ├── kausageitem.cpp │ └── kausageitem.h ├── hwparam │ ├── batteryinfo.cpp │ ├── batteryinfo.h │ ├── bluetoothinfo.cpp │ ├── bluetoothinfo.h │ ├── camerainfo.cpp │ ├── camerainfo.h │ ├── cdrominfo.cpp │ ├── cdrominfo.h │ ├── faninfo.cpp │ ├── faninfo.h │ ├── graphicscardinfo.cpp │ ├── graphicscardinfo.h │ ├── harddiskinfo.cpp │ ├── harddiskinfo.h │ ├── hwparam.cpp │ ├── hwparam.h │ ├── hwparam.pro │ ├── kabaseinfopage.cpp │ ├── kabaseinfopage.h │ ├── keyboardinfo.cpp │ ├── keyboardinfo.h │ ├── maininfopage.cpp │ ├── maininfopage.h │ ├── memoryinfo.cpp │ ├── memoryinfo.h │ ├── monitorinfo.cpp │ ├── monitorinfo.h │ ├── motherboardinfo.cpp │ ├── motherboardinfo.h │ ├── mouseinfo.cpp │ ├── mouseinfo.h │ ├── netcardinfo.cpp │ ├── netcardinfo.h │ ├── processorinfo.cpp │ ├── processorinfo.h │ ├── udevhotplugin.cpp │ ├── udevhotplugin.h │ ├── voicecardinfo.cpp │ └── voicecardinfo.h ├── machineinfo │ ├── infopage.cpp │ ├── infopage.h │ ├── machineinfo.cpp │ ├── machineinfo.h │ └── machineinfo.pro └── plugins.pro └── src ├── aboutwidget.cpp ├── aboutwidget.h ├── commondef.h ├── imageutil.cpp ├── imageutil.h ├── img_res ├── Bluetooth.svg ├── Machine-model.svg ├── SN.svg ├── drivemanager.svg ├── graphics-card.svg ├── hard-disk.svg ├── hardwaremonitor.svg ├── hardwareparam.svg ├── host.svg ├── icon-cpu.svg ├── iso.svg ├── kernel-architecture.svg ├── kernel-version.svg ├── machineinfo.svg ├── manufacturer.svg ├── memory.svg ├── monitor.svg ├── mother-board.svg ├── network-card.svg ├── osversion.svg ├── processor.svg ├── soundcard.svg ├── system-bits.svg ├── ukui-occupation-map.svg ├── ukui-occupation-map@2x.png ├── wired.svg └── wireless.svg ├── interface.h ├── kaaboutdialog.cpp ├── kaaboutdialog.h ├── kajsondef.h ├── kleftsideitem.cpp ├── kleftsideitem.h ├── kleftwidget.cpp ├── kleftwidget.h ├── krightwidget.cpp ├── krightwidget.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── qtsingleapplication ├── QtLockedFile ├── QtSingleApplication ├── qtlocalpeer.cpp ├── qtlocalpeer.h ├── qtlockedfile.cpp ├── qtlockedfile.h ├── qtlockedfile_unix.cpp ├── qtlockedfile_win.cpp ├── qtsingleapplication.cpp ├── qtsingleapplication.h ├── qtsingleapplication.pri ├── qtsinglecoreapplication.cpp ├── qtsinglecoreapplication.h └── qtsinglecoreapplication.pri ├── res.qrc ├── src.pro ├── translation ├── kylin-assistant_bo.qm ├── kylin-assistant_bo.ts ├── kylin-assistant_de.qm ├── kylin-assistant_de.ts ├── kylin-assistant_es.qm ├── kylin-assistant_es.ts ├── kylin-assistant_fr.qm ├── kylin-assistant_fr.ts ├── kylin-assistant_ru.qm ├── kylin-assistant_ru.ts ├── kylin-assistant_zh_CN.qm └── kylin-assistant_zh_CN.ts ├── xatom-helper.cpp └── xatom-helper.h /CommonControl/CommonControl.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | DEPENDPATH += $$PWD 3 | include($$PWD/../commonfunc/commonfunc.pri) 4 | HEADERS += \ 5 | $$PWD/kabuttonproxystyle.h \ 6 | $$PWD/kagroupbutton.h \ 7 | $$PWD/kainfotitle.h \ 8 | $$PWD/kalabel.h \ 9 | $$PWD/kaslider.h \ 10 | $$PWD/katabbar.h \ 11 | $$PWD/katabbutton.h \ 12 | $$PWD/kdriveinfoitem.h \ 13 | $$PWD/kinfolistitem.h \ 14 | $$PWD/loadingwidget.h 15 | SOURCES += \ 16 | $$PWD/kabuttonproxystyle.cpp \ 17 | $$PWD/kagroupbutton.cpp \ 18 | $$PWD/kainfotitle.cpp \ 19 | $$PWD/kalabel.cpp \ 20 | $$PWD/kaslider.cpp \ 21 | $$PWD/katabbar.cpp \ 22 | $$PWD/katabbutton.cpp \ 23 | $$PWD/kdriveinfoitem.cpp \ 24 | $$PWD/kinfolistitem.cpp \ 25 | $$PWD/loadingwidget.cpp 26 | -------------------------------------------------------------------------------- /CommonControl/kagroupbutton.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "kagroupbutton.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | KAGroupButton::KAGroupButton(QWidget *parent) 29 | : QPushButton(parent) 30 | { 31 | mPosition = KAButtonStyleOption::OnlyOne; 32 | this->setAttribute(Qt::WA_TranslucentBackground); 33 | } 34 | 35 | KAGroupButton::~KAGroupButton() 36 | { 37 | 38 | } 39 | 40 | void KAGroupButton::paintEvent(QPaintEvent *event) 41 | { 42 | Q_UNUSED(event); 43 | QStylePainter p(this); 44 | KAButtonStyleOption option; 45 | initStyleOption(&option); 46 | option.position = mPosition; 47 | option.katype = KAButtonStyleOption::BT_GROUP; 48 | p.drawControl(QStyle::CE_PushButton, option); 49 | } 50 | -------------------------------------------------------------------------------- /CommonControl/kagroupbutton.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KAGROUPBUTTON_H 22 | #define KAGROUPBUTTON_H 23 | 24 | #include 25 | 26 | #include "kabuttonproxystyle.h" 27 | 28 | class KAGroupButton : public QPushButton 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit KAGroupButton(QWidget *parent = nullptr); 33 | virtual ~KAGroupButton(); 34 | 35 | inline KAButtonStyleOption::ButtonPosition position() 36 | { return mPosition; } 37 | inline void setPosition(KAButtonStyleOption::ButtonPosition pos) 38 | { mPosition = pos; } 39 | 40 | protected: 41 | void paintEvent(QPaintEvent *event); 42 | 43 | private: 44 | KAButtonStyleOption::ButtonPosition mPosition; 45 | }; 46 | 47 | #endif // KAGROUPBUTTON_H 48 | -------------------------------------------------------------------------------- /CommonControl/kainfotitle.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "kainfotitle.h" 22 | 23 | #include 24 | #include 25 | 26 | #define KATITLE_LABEL_WIDTH 4 27 | #define KATITLE_LABEL_HEIGHT 14 28 | 29 | KAInfoTitle::KAInfoTitle(QString strTitle, QWidget *parent) 30 | : QWidget(parent) 31 | , m_strTitle(strTitle) 32 | { 33 | this->setAttribute(Qt::WA_TranslucentBackground); 34 | 35 | m_mainLayout = new QHBoxLayout(); 36 | m_mainLayout->setContentsMargins(0,0,0,0); 37 | 38 | m_labelTitle = new QLabel(); 39 | m_labelTitle->setText(m_strTitle); 40 | m_mainLayout->addSpacing(KATITLE_LABEL_WIDTH+8); 41 | m_mainLayout->addWidget(m_labelTitle, 0, Qt::AlignLeft); 42 | 43 | this->setLayout(m_mainLayout); 44 | } 45 | 46 | void KAInfoTitle::setText(QString strTitle) 47 | { 48 | m_strTitle = strTitle; 49 | m_labelTitle->setText(m_strTitle); 50 | } 51 | 52 | void KAInfoTitle::paintEvent(QPaintEvent *event) 53 | { 54 | Q_UNUSED(event); 55 | QPainterPath path; 56 | 57 | QPainter painter(this); 58 | painter.setOpacity(1); 59 | painter.setRenderHint(QPainter::Antialiasing); // 反锯齿; 60 | painter.setClipping(true); 61 | painter.setPen(Qt::transparent); 62 | 63 | /*path.addRect(this->rect()); 64 | path.setFillRule(Qt::WindingFill); 65 | painter.setBrush(this->palette().base()); 66 | painter.setPen(Qt::transparent); 67 | 68 | painter.drawPath(path);*/ 69 | // 画小块 70 | QRect rectBlue = this->rect(); 71 | int nX = 0; 72 | int nY = 0; 73 | int nWidth = 0; 74 | int nHeight = 0; 75 | if (KATITLE_LABEL_WIDTH > rectBlue.width()) { 76 | nX = rectBlue.x(); 77 | nWidth = rectBlue.width(); 78 | } else { 79 | nX = rectBlue.x(); 80 | nWidth = KATITLE_LABEL_WIDTH; 81 | } 82 | if (KATITLE_LABEL_HEIGHT > rectBlue.height()) { 83 | nY = rectBlue.y(); 84 | nHeight = rectBlue.height(); 85 | } else { 86 | nY = rectBlue.y()+(rectBlue.height()-KATITLE_LABEL_HEIGHT)/2; 87 | nHeight = KATITLE_LABEL_HEIGHT; 88 | } 89 | rectBlue.setX(nX); 90 | rectBlue.setY(nY); 91 | rectBlue.setWidth(nWidth); 92 | rectBlue.setHeight(nHeight); 93 | QPainterPath path1; 94 | path1.addRect(rectBlue); 95 | path1.setFillRule(Qt::WindingFill); 96 | painter.setBrush(QColor("#3790FA")); 97 | painter.setPen(Qt::transparent); 98 | 99 | painter.drawPath(path1); 100 | } 101 | -------------------------------------------------------------------------------- /CommonControl/kainfotitle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KAINFOTITLE_H 22 | #define KAINFOTITLE_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class KAInfoTitle : public QWidget 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit KAInfoTitle(QString strTitle = "", QWidget *parent = nullptr); 33 | void setText(QString strTitle); 34 | 35 | protected: 36 | void paintEvent(QPaintEvent *event) override; 37 | 38 | private: 39 | QHBoxLayout *m_mainLayout = nullptr; 40 | QLabel *m_labelTitle = nullptr; 41 | QString m_strTitle; 42 | }; 43 | 44 | #endif // KAINFOTITLE_H 45 | -------------------------------------------------------------------------------- /CommonControl/kalabel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "kalabel.h" 22 | 23 | #include "utils.h" 24 | 25 | KALabel::KALabel(QWidget *parent) 26 | : QLabel(parent) 27 | { 28 | m_strText = ""; 29 | } 30 | 31 | KALabel::KALabel(QString strText, QWidget *parent) 32 | : QLabel(strText, parent) 33 | { 34 | m_strText = strText; 35 | } 36 | 37 | void KALabel::setText(const QString &strText) 38 | { 39 | m_strText = strText; 40 | QLabel::setText(strText); 41 | } 42 | 43 | void KALabel::paintEvent(QPaintEvent *event) 44 | { 45 | QString strEText = getElidedText(font(), m_strText, width()); 46 | if (strEText != m_strText) { 47 | QLabel::setText(strEText); 48 | setToolTip(m_strText); 49 | } else { 50 | QLabel::setText(m_strText); 51 | setToolTip(""); 52 | } 53 | QLabel::paintEvent(event); 54 | } 55 | -------------------------------------------------------------------------------- /CommonControl/kalabel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KALABEL_H 22 | #define KALABEL_H 23 | 24 | #include 25 | 26 | class KALabel : public QLabel 27 | { 28 | Q_OBJECT 29 | public: 30 | KALabel(QWidget *parent = nullptr); 31 | KALabel(QString strText, QWidget *parent = nullptr); 32 | 33 | public slots: 34 | void setText(const QString &); 35 | 36 | protected: 37 | void paintEvent(QPaintEvent *event); 38 | 39 | private: 40 | QString m_strText; 41 | }; 42 | 43 | #endif // KALABEL_H 44 | -------------------------------------------------------------------------------- /CommonControl/kaslider.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "kaslider.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | KASlider::KASlider(QStringList listValues, QWidget *parent) 31 | : QSlider(Qt::Horizontal, parent) 32 | , m_listValues(listValues) 33 | { 34 | this->setFixedHeight(64); 35 | this->setContentsMargins(0,24,0,0); 36 | } 37 | 38 | void KASlider::paintEvent(QPaintEvent *ev) 39 | { 40 | QSlider::paintEvent(ev); 41 | 42 | auto painter = new QPainter(this); 43 | painter->setBrush(QBrush(QColor(QPalette::Base))); 44 | 45 | int nCurPos = (value() - minimum())/tickInterval(); 46 | if (nCurPos < m_listValues.size()) { 47 | auto rect = this->geometry(); 48 | int numTicks = (maximum() - minimum()) / tickInterval(); 49 | if (this->orientation() == Qt::Horizontal) { 50 | QFontMetrics fontMetrics = QFontMetrics(this->font()); 51 | QRect fontRect = fontMetrics.boundingRect(m_listValues.at(nCurPos)); 52 | const int interval = (rect.width() - fontRect.width()) / numTicks; 53 | int tickX = 1+(interval*nCurPos); 54 | int tickY = rect.height() / 2 - 16; 55 | painter->drawText(QPoint(tickX, tickY), 56 | this->m_listValues.at(nCurPos)); 57 | } 58 | } 59 | painter->end(); 60 | } 61 | 62 | QStringList KASlider::valueList() 63 | { 64 | return m_listValues; 65 | } 66 | 67 | void KASlider::setValueList(QStringList listValues) 68 | { 69 | m_listValues = listValues; 70 | repaint(); 71 | } 72 | -------------------------------------------------------------------------------- /CommonControl/kaslider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KASLIDER_H 22 | #define KASLIDER_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class KASlider : public QSlider 29 | { 30 | Q_OBJECT 31 | public: 32 | KASlider(QStringList listValues, QWidget *parent = nullptr); 33 | QStringList valueList(); 34 | void setValueList(QStringList listValues); 35 | 36 | protected: 37 | void paintEvent(QPaintEvent *ev); 38 | 39 | private: 40 | QStringList m_listValues; 41 | QLabel *m_labelValue = nullptr; 42 | }; 43 | 44 | #endif // KASLIDER_H 45 | -------------------------------------------------------------------------------- /CommonControl/katabbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KATABBAR_H 22 | #define KATABBAR_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "katabbutton.h" 33 | 34 | class KATabBar : public QWidget 35 | { 36 | Q_OBJECT 37 | public: 38 | explicit KATabBar(QWidget *parent = nullptr); 39 | virtual ~KATabBar(); 40 | 41 | void initUI(); 42 | void initConnections(); 43 | 44 | int addTabButton(KATabButton *tabBtn); 45 | int getCurIndex(); 46 | 47 | public slots: 48 | void onChangeTabPage(); 49 | void checkArrowNeedShow(); 50 | void onChangeTabIndex(int nIndex); 51 | void onTabItemClicked(); 52 | 53 | signals: 54 | void changeTabIndex(int nIndex); 55 | 56 | protected: 57 | void paintEvent(QPaintEvent *); 58 | void resizeEvent(QResizeEvent *e) override; 59 | 60 | private: 61 | void initStyleTheme(); 62 | 63 | private: 64 | QVBoxLayout *m_mainLayout = nullptr; 65 | QHBoxLayout *m_topLayout = nullptr; 66 | QHBoxLayout *m_topMidLayout = nullptr; 67 | QPushButton *m_leftArrowBtn = nullptr; 68 | QPushButton *m_rightArrowBtn = nullptr; 69 | 70 | QButtonGroup *m_btnGroup = nullptr; 71 | QScrollArea *m_scrollWidget = nullptr; 72 | QGSettings *m_styleSettings = nullptr; 73 | 74 | QString m_strStyleName; 75 | int m_nCurIndex; 76 | }; 77 | 78 | #endif // KATABBAR_H 79 | -------------------------------------------------------------------------------- /CommonControl/katabbutton.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "katabbutton.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "kabuttonproxystyle.h" 29 | 30 | KATabButton::KATabButton(QWidget *parent) 31 | : QPushButton(parent) 32 | { 33 | this->setAttribute(Qt::WA_TranslucentBackground); 34 | } 35 | 36 | void KATabButton::paintEvent(QPaintEvent *event) 37 | { 38 | Q_UNUSED(event); 39 | QPainterPath path; 40 | 41 | QPainter painter(this); 42 | painter.setOpacity(1); 43 | painter.setRenderHint(QPainter::Antialiasing); // 反锯齿; 44 | painter.setClipping(true); 45 | painter.setPen(Qt::transparent); 46 | 47 | path.addRect(this->rect()); 48 | path.setFillRule(Qt::WindingFill); 49 | painter.setBrush(this->palette().base()); 50 | painter.setPen(Qt::transparent); 51 | 52 | painter.drawPath(path); 53 | 54 | QStylePainter p(this); 55 | KAButtonStyleOption option; 56 | initStyleOption(&option); 57 | option.katype = KAButtonStyleOption::BT_TAB; 58 | p.drawControl(QStyle::CE_PushButton, option); 59 | } 60 | -------------------------------------------------------------------------------- /CommonControl/katabbutton.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KATABBUTTON_H 22 | #define KATABBUTTON_H 23 | 24 | #include 25 | #include 26 | 27 | class KATabButton : public QPushButton 28 | { 29 | Q_OBJECT 30 | public: 31 | KATabButton(QWidget *parent = nullptr); 32 | 33 | protected: 34 | void paintEvent(QPaintEvent *event); 35 | 36 | }; 37 | 38 | #endif // KATABBUTTON_H 39 | -------------------------------------------------------------------------------- /CommonControl/kdriveinfoitem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KDRIVEINFOITEM_H 22 | #define KDRIVEINFOITEM_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | class QLabel; 30 | class QVBoxLayout; 31 | class QHBoxLayout; 32 | 33 | class KDriveInfoItem : public QFrame 34 | { 35 | Q_OBJECT 36 | public: 37 | explicit KDriveInfoItem(QString strTitle, QString strIcon, QString strDriveName, QString strDriveVer, bool isOdd, QWidget *parent = nullptr); 38 | virtual ~KDriveInfoItem(); 39 | 40 | void initUI(); 41 | void updateDriveInfo(QString strDriveName, QString strDriveVer); 42 | 43 | public slots: 44 | void onCopyContent(); 45 | 46 | protected: 47 | void paintEvent(QPaintEvent *event); 48 | void mousePressEvent(QMouseEvent *event); 49 | 50 | private: 51 | void initStyleTheme(); 52 | 53 | private: 54 | QHBoxLayout *m_mainLayout = nullptr; 55 | QVBoxLayout *m_driveInfoLayout = nullptr; 56 | 57 | QLabel *m_labelIcon = nullptr; 58 | QLabel *m_labelTitle = nullptr; 59 | QLabel *m_labelDriveName = nullptr; 60 | QLabel *m_labelDriveVersion = nullptr; 61 | 62 | QString m_strTitle; 63 | QString m_strIcon; 64 | QString m_strDriveName; 65 | QString m_strDriveVersion; 66 | 67 | bool m_isOdd = false; 68 | QGSettings *m_styleSettings = nullptr; 69 | QColor m_alternateBase; 70 | QMenu *m_rkeyMenu = nullptr; 71 | }; 72 | 73 | #endif // KDRIVEINFOITEM_H 74 | -------------------------------------------------------------------------------- /CommonControl/kinfolistitem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KINFOLISTITEM_H 22 | #define KINFOLISTITEM_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "kalabel.h" 30 | class QLabel; 31 | class QVBoxLayout; 32 | class QHBoxLayout; 33 | 34 | class KInfoListItem : public QFrame 35 | { 36 | Q_OBJECT 37 | public: 38 | explicit KInfoListItem(QString strTitle, QString strIcon, QString strDetail, bool isOdd, QWidget *parent = nullptr); 39 | virtual ~KInfoListItem(); 40 | 41 | void initUI(); 42 | void updateDetailInfo(QString strDetail); 43 | 44 | public slots: 45 | void onCopyContent(); 46 | 47 | protected: 48 | void paintEvent(QPaintEvent *event); 49 | void mousePressEvent(QMouseEvent *event); 50 | 51 | private: 52 | void initStyleTheme(); 53 | 54 | private: 55 | QHBoxLayout *m_mainLayout = nullptr; 56 | 57 | QLabel *m_labelIcon = nullptr; 58 | KALabel *m_labelTitle = nullptr; 59 | KALabel *m_labelDetail = nullptr; 60 | 61 | QString m_strTitle; 62 | QString m_strIcon; 63 | QString m_strDetail; 64 | 65 | bool m_isOdd = false; 66 | QGSettings *m_styleSettings = nullptr; 67 | QColor m_alternateBase; 68 | QMenu *m_rkeyMenu = nullptr; 69 | }; 70 | 71 | #endif // KINFOLISTITEM_H 72 | -------------------------------------------------------------------------------- /CommonControl/loadingwidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "loadingwidget.h" 22 | 23 | LoadingWidget::LoadingWidget(QWidget *parent) 24 | : QWidget(parent) 25 | { 26 | initUI(); 27 | } 28 | 29 | void LoadingWidget::initUI() 30 | { 31 | m_hLayout = new QHBoxLayout(); 32 | m_hLayout->setContentsMargins(0,0,0,0); 33 | m_hLayout->setSpacing(0); 34 | m_vLayout = new QVBoxLayout(); 35 | m_vLayout->setContentsMargins(0,0,0,0); 36 | m_vLayout->setSpacing(0); 37 | 38 | m_labelLoadIcon = new QLabel(); 39 | QPixmap pixmap; 40 | pixmap.load(":/imgres/img_res/ukui-occupation-map.svg"); 41 | pixmap.scaled(290,262); 42 | m_labelLoadIcon->setPixmap(pixmap); 43 | 44 | m_labelLoadText = new QLabel(); 45 | m_labelLoadText->setText(tr("Scanning, please wait")); 46 | 47 | m_vLayout->addStretch(40); 48 | m_vLayout->addWidget(m_labelLoadIcon, 0, Qt::AlignHCenter); 49 | m_vLayout->addSpacing(10); 50 | m_vLayout->addWidget(m_labelLoadText, 0, Qt::AlignHCenter); 51 | m_vLayout->addStretch(55); 52 | 53 | m_hLayout->addLayout(m_vLayout); 54 | this->setLayout(m_hLayout); 55 | } 56 | -------------------------------------------------------------------------------- /CommonControl/loadingwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef LOADINGWIDGET_H 22 | #define LOADINGWIDGET_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | class LoadingWidget : public QWidget 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit LoadingWidget(QWidget *parent = nullptr); 34 | 35 | void initUI(); 36 | 37 | private: 38 | QVBoxLayout *m_vLayout = nullptr; 39 | QHBoxLayout *m_hLayout = nullptr; 40 | QLabel *m_labelLoadIcon = nullptr; 41 | QLabel *m_labelLoadText = nullptr; 42 | }; 43 | 44 | #endif // LOADINGWIDGET_H 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | V10SP1 新UI分支 2 | -------------------------------------------------------------------------------- /commonfunc/commonfunc.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | DEPENDPATH += $$PWD 3 | HEADERS += \ 4 | $$PWD/utils.h 5 | SOURCES += \ 6 | $$PWD/utils.cpp 7 | -------------------------------------------------------------------------------- /commonfunc/utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "utils.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | QString getElidedText(QFont font, QString str, int MaxWidth) 29 | { 30 | if(str.isEmpty()) { 31 | return ""; 32 | } 33 | 34 | QFontMetrics fontWidth(font); 35 | 36 | //计算字符串宽度 37 | int width = fontWidth.width(str); 38 | 39 | //当字符串宽度大于最大宽度时进行转换 40 | if(width >= MaxWidth) { 41 | //右部显示省略号 42 | str = fontWidth.elidedText(str, Qt::ElideRight, MaxWidth); 43 | } 44 | //返回处理后的字符串 45 | return str; 46 | } 47 | 48 | void centerToScreen(QWidget* widget) 49 | { 50 | if (!widget) 51 | return; 52 | QDesktopWidget* m = QApplication::desktop(); 53 | QRect desk_rect = m->screenGeometry(widget); 54 | int desk_x = desk_rect.width(); 55 | int desk_y = desk_rect.height(); 56 | int x = widget->width(); 57 | int y = widget->height(); 58 | widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top()); 59 | } 60 | 61 | // 获取应用程序版本 62 | QString getKAVersion() 63 | { 64 | QString versionText; 65 | QProcess proc; 66 | QStringList options; 67 | options << "-l" << "|" << "grep" << "youker-assistant"; 68 | proc.start("dpkg", options); 69 | proc.waitForFinished(); 70 | QString dpkgInfo = proc.readAll(); 71 | QStringList infoList = dpkgInfo.split("\n"); 72 | for (int n = 0; n < infoList.size(); n++) { 73 | QString strInfoLine = infoList[n]; 74 | if (strInfoLine.contains("youker-assistant")) { 75 | QStringList lineInfoList = strInfoLine.split(QRegExp("[\\s]+")); 76 | if (lineInfoList.size() >= 3) { 77 | versionText = lineInfoList[2]; 78 | } 79 | break; 80 | } 81 | } 82 | return versionText; 83 | } 84 | -------------------------------------------------------------------------------- /commonfunc/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef UTILS_H 22 | #define UTILS_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | QString getElidedText(QFont font, QString str, int MaxWidth); 29 | 30 | void centerToScreen(QWidget* widget); 31 | 32 | // 获取应用程序版本 33 | QString getKAVersion(); 34 | 35 | #endif // UTILS_H 36 | -------------------------------------------------------------------------------- /data/toolkit/en_US/image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/en_US/image/1.png -------------------------------------------------------------------------------- /data/toolkit/en_US/image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/en_US/image/2.png -------------------------------------------------------------------------------- /data/toolkit/en_US/image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/en_US/image/3.png -------------------------------------------------------------------------------- /data/toolkit/en_US/image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/en_US/image/4.png -------------------------------------------------------------------------------- /data/toolkit/en_US/image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/en_US/image/5.png -------------------------------------------------------------------------------- /data/toolkit/en_US/image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/en_US/image/6.png -------------------------------------------------------------------------------- /data/toolkit/en_US/image/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/en_US/image/8.png -------------------------------------------------------------------------------- /data/toolkit/en_US/index.md: -------------------------------------------------------------------------------- 1 | # ToolKit 2 | ## Overview 3 | ToolKit provides some extended functions and users can query the hardware details of the current computer. The main interface as shown in Fig 1. 4 | 5 | ![Fig 1 ToolKit-big](image/1.png) 6 |
7 | 8 | ## MachineInformation 9 | 10 | As shown in Figure 2, the general information of the whole machine is displayed. 11 | 12 | ![Fig 2 Machine Information-big](image/1.png) 13 |
14 | 15 | ## HardwareParameters 16 | 17 | 1) Processor: displays details of the computer's processor. 18 | 19 | ![Fig 3 Processor-big](image/2.png) 20 | 21 | 2)Memory: displays details of the computer's memory. 22 | 23 | ![Fig 4 Memory-big](image/3.png) 24 | 25 | 3)Click other items to switch to the hardware details tab. 26 | 27 | ![Fig 5 MotherBoard-big](image/4.png) 28 | 29 |
30 | 31 | ## HardwareMonitoring 32 | 33 | 1)Equipment monitoring, users can view the temperature and utilization of hardware equipment. 34 | 35 | ![Fig 6 Device Monitor-big](image/5.png) 36 | 37 | 2)CPU frequency modulation, user can set CPU management policy. 38 | 39 | ![Fig 7 CPU FM-big](image/6.png) 40 |
41 | 42 | ## DriveManager 43 | 44 | The interface is shown in Figure 9, which displays each driver information in the computer. 45 | 46 | ![Fig 9 Drive Manager-big](image/8.png) 47 |
48 | 49 | -------------------------------------------------------------------------------- /data/toolkit/toolkit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/toolkit.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/zh_CN/image/1.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/zh_CN/image/2.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/zh_CN/image/3.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/zh_CN/image/4.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/zh_CN/image/5.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/zh_CN/image/6.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/image/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/zh_CN/image/7.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/image/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/data/toolkit/zh_CN/image/8.png -------------------------------------------------------------------------------- /data/toolkit/zh_CN/index.md: -------------------------------------------------------------------------------- 1 | # 工具箱 2 | ## 概 述 3 | 工具箱提供了整机信息,硬件参数,硬件监测等功能。主界面如图1所示。 4 | 5 | ![图 1 工具箱-big](image/1.png) 6 |
7 | 8 | ## 整机信息 9 | 10 | 如图2所示,展示整机的概要信息。 11 | 12 | ![图 2 整机信息-big](image/1.png) 13 |
14 | 15 | ## 硬件参数 16 | 17 | 1)处理器:显示计算机处理器的详细信息。 18 | 19 | ![图 3 处理器-big](image/2.png) 20 | 21 | 2)内存:显示计算机内存的详细信息。 22 | 23 | ![图 4 内存-big](image/3.png) 24 | 25 | 3)点击其他项目,切换到该硬件的详细信息标签页。 26 | 27 | ![图 5 主板-big](image/4.png) 28 | 29 |
30 | 31 | ## 硬件监测 32 | 1)设备监测,用户可查看硬件设备温度和使用率。 33 | 34 | ![图 6 设备监测-big](image/5.png) 35 | 36 | 2)CPU调频,用户可设置CPU管理策略。 37 | 38 | ![图 7 CPU调频-big](image/6.png) 39 | 40 | 自定义模式如图8所示。 41 | 42 | ![图 8 自定义模式](image/7.png) 43 |
44 | 45 | ## 驱动管理 46 | 界面如图9所示,显示了计算机中的各个驱动信息。 47 | 48 | ![图 9 驱动管理-big](image/8.png) 49 |
50 | 51 | -------------------------------------------------------------------------------- /dataworker/dataworker.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | DEPENDPATH += $$PWD 3 | HEADERS += \ 4 | $$PWD/dataworker.h 5 | SOURCES += \ 6 | $$PWD/dataworker.cpp 7 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: youker-assistant 2 | Section: misc 3 | Priority: optional 4 | Maintainer: Ubuntu Developers 5 | Uploaders: handsome_feng , 6 | lixiang 7 | Build-Depends: debhelper-compat (= 12), 8 | dh-python, 9 | python3-all (>= 3.1), 10 | python3-dev, 11 | python3-lxml, 12 | python3-dbus, 13 | python3-xdg, 14 | libqt5charts5-dev, 15 | qtbase5-dev (>= 5.1), 16 | libqt5svg5-dev, 17 | libqt5charts5-dev, 18 | qt5-qmake, 19 | qtscript5-dev, 20 | qttools5-dev-tools, 21 | libgsettings-qt-dev, 22 | pkg-config, 23 | libglib2.0-dev (>= 2.46.0), 24 | libgtop2-dev, 25 | libkf5windowsystem-dev, 26 | libqt5x11extras5-dev, 27 | libxrandr-dev, 28 | libudev-dev, 29 | libukui-log4qt-dev 30 | Standards-Version: 4.5.0 31 | Rules-Requires-Root: no 32 | Homepage: https://github.com/ubuntukylin/youker-assistant 33 | Vcs-git: https://github.com/ubuntukylin/youker-assistant.git 34 | Vcs-browser: https://github.com/ubuntukylin/youker-assistant 35 | 36 | Package: youker-assistant 37 | Architecture: any 38 | Depends: python3-dbus, 39 | python3-psutil, 40 | python3-lxml, 41 | python3-pil, 42 | python3-smbus, 43 | python3-xdg, 44 | inotify-hookable, 45 | bsdutils (>= 1:2.27.1), 46 | hdparm, 47 | lm-sensors, 48 | lshw, 49 | edid-decode, 50 | dmidecode [amd64 arm64 armhf i386], 51 | cpufrequtils, 52 | dpkg-dev, 53 | pciutils, 54 | libukui-log4qt-dev, 55 | hwinfo, 56 | smartmontools, 57 | net-tools, 58 | ${misc:Depends}, 59 | ${python3:Depends}, 60 | ${shlibs:Depends}, 61 | Description: Integrated tool to aid in routine system maintenance tasks 62 | Kylin Assistant is a tool designed to help Ubuntu and Ubuntu Kylin 63 | desktop users manage and maintain many aspects of their working 64 | environment conveniently in a single application, providing a consistent 65 | user experience. 66 | . 67 | Features currently included: 68 | * Detecting and displaying general system information 69 | * Unity and Mate user interface customization 70 | * System garbage cleaning 71 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: kylin-assistant 3 | Upstream-Contact: Ubuntu Kylin Team 4 | Source: https://github.com/KylinAppCenter/kylin-assistant 5 | 6 | Files: * 7 | Copyright: Copyright (C) 2021 KylinSoft Co., Ltd. 8 | Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd. 9 | License: GPL-3 10 | 11 | License: GPL-2+ 12 | This program is free software; you can redistribute it and/or 13 | modify it under the terms of the GNU General Public License as 14 | published by the Free Software Foundation; either version 2 of 15 | the License, or (at your option) any later version. 16 | . 17 | On Debian and Ubuntu systems, a copy of the GNU General Public License version 18 | 2 may be found in the file /usr/share/common-licenses/GPL-2. 19 | 20 | License: GPL-3 21 | This program is free software: you can redistribute it and/or modify 22 | it under the terms of the GNU General Public License version 3 as 23 | published by the Free Software Foundation. 24 | . 25 | This program is distributed in the hope that it will be useful, 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | GNU General Public License for more details. 29 | . 30 | On Debian/Ubuntu systems, the full text of the GPL v3 can be found in 31 | `/usr/share/common-licenses/GPL-3' 32 | -------------------------------------------------------------------------------- /debian/install: -------------------------------------------------------------------------------- 1 | man/*.1 /usr/share/man/man1/ 2 | src/translation/*.qm /usr/share/youker-assistant/translations/ 3 | data/toolkit/ /usr/share/kylin-user-guide/data/guide/ 4 | -------------------------------------------------------------------------------- /debian/kylin-assistant.manpages: -------------------------------------------------------------------------------- 1 | man/kylin-assistant.1 2 | man/kylin-assistant-systemdaemon.py.1 3 | 4 | -------------------------------------------------------------------------------- /debian/links: -------------------------------------------------------------------------------- 1 | /usr/lib/python3/dist-packages/kylin-assistant-daemon/systemdaemon/kasystemdbusmain.py /usr/bin/kylin-assistant-systemdaemon.py 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | #export DH_VERBOSE = 1 4 | 5 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 6 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 7 | export QT_SELECT=5 8 | export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow 9 | 10 | QMAKE_OPTS = DEFINES+=NO_DEBUG_ON_CONSOLE 11 | MAKE_OPTS = PREFIX=/usr QMAKE=qmake LRELEASE=lrelease QMAKE_OPTS="$(QMAKE_OPTS)" 12 | 13 | override_dh_auto_configure: 14 | QT_SELECT=qt5 dh_auto_configure \ 15 | -- "QMAKE_CXXFLAGS=$(CFLAGS)" \ 16 | kylin-assistant.pro 17 | 18 | %: 19 | dh $@ --with python3 20 | 21 | # fix private dynamic library not found when debuild 22 | #override_dh_shlibdeps: 23 | # dh_shlibdeps -l "${CURDIR}/cclibs" 24 | 25 | # fix private dynamic library lintian warning 26 | #override_dh_makeshlibs: 27 | # dh_makeshlibs --no-scripts 28 | 29 | override_dh_missing: 30 | dh_missing --fail-missing 31 | 32 | override_dh_auto_build: 33 | dh_auto_build -- $(MAKE_OPTS) 34 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | version=4 2 | opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/youker-assistant-$1\.tar\.gz/ \ 3 | https://github.com/ubuntukylin/youker-assistant/releases .*/v?(\d\S+)\.tar\.gz 4 | -------------------------------------------------------------------------------- /env.pri: -------------------------------------------------------------------------------- 1 | PROJECT_ROOTDIR = $$PWD 2 | PROJECT_COMPONENTLIBS = $$PWD/cclibs 3 | PROJECT_COMPONENTSOURCE = $$PWD/commonComponent 4 | PLUGIN_INSTALL_DIRS = $$[QT_INSTALL_LIBS]/kylin-assistant 5 | -------------------------------------------------------------------------------- /kyasDbus/kyasDbus.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = aux 2 | 3 | inst1.files += systemdaemon/ 4 | inst1.path = /usr/lib/python3/dist-packages/kylin-assistant-daemon/ 5 | 6 | inst2.files += systemdaemon/conf/com.kylin.assistant.systemdaemon.conf 7 | inst2.path = /etc/dbus-1/system.d/ 8 | inst3.files += systemdaemon/conf/com.kylin.assistant.systemdaemon.service 9 | inst3.path = /usr/share/dbus-1/system-services/ 10 | inst4.files += systemdaemon/conf/com.kylin.assistant.systemdaemon.policy 11 | inst4.path = /usr/share/polkit-1/actions/ 12 | 13 | 14 | INSTALLS += inst1 \ 15 | inst2 \ 16 | inst3 \ 17 | inst4 \ 18 | -------------------------------------------------------------------------------- /kyasDbus/systemdaemon/conf/com.kylin.assistant.systemdaemon.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /kyasDbus/systemdaemon/conf/com.kylin.assistant.systemdaemon.policy: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Kylin Assistant 8 | https://www.kylinos.cn/ 9 | kylin-assistant 10 | 11 | 12 | <_description> 13 | system level settings 14 | 15 | <_message> 16 | To Change the settings, you need to authenticate. 17 | 18 | 19 | auth_admin 20 | auth_admin 21 | auth_admin 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /kyasDbus/systemdaemon/conf/com.kylin.assistant.systemdaemon.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=com.kylin.assistant.systemdaemon 3 | Exec=/usr/bin/kylin-assistant-systemdaemon.py 4 | User=root 5 | -------------------------------------------------------------------------------- /kyasDbus/systemdaemon/kapolicykit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | ### BEGIN LICENSE 5 | # Copyright (C) 2021 KylinSoft Co., Ltd. 6 | # 7 | # Authors: 8 | # Yang Min yangmin@kylinos.cn 9 | # 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program. If not, see . 22 | ### END LICENSE 23 | 24 | import dbus.service 25 | 26 | KA_POLICYKIT_ACTION = "com.kylin.assistant.systemdaemon.action" 27 | 28 | class AccessDeniedException(dbus.DBusException): 29 | '''This exception is raised when some operation is not permitted.''' 30 | 31 | _dbus_error_name = 'com.kylin.assistant.systemdaemon.AccessDeniedException' 32 | 33 | 34 | class PolicyKitService(dbus.service.Object): 35 | '''A D-BUS service that uses PolicyKit for authorization.''' 36 | 37 | def _check_permission(self, sender, action): 38 | if not sender: raise ValueError('sender == None') 39 | kit = dbus.SystemBus().get_object('org.freedesktop.PolicyKit1', '/org/freedesktop/PolicyKit1/Authority') 40 | kit = dbus.Interface(kit, 'org.freedesktop.PolicyKit1.Authority') 41 | (granted, _, details) = kit.CheckAuthorization( 42 | ('system-bus-name', {'name': sender}), 43 | action, {}, dbus.UInt32(1), '', timeout=600) 44 | return granted 45 | -------------------------------------------------------------------------------- /kyasDbus/systemdaemon/kathread.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | ### BEGIN LICENSE 5 | # Copyright (C) 2021 KylinSoft Co., Ltd. 6 | # 7 | # Authors: 8 | # Yang Min yangmin@kylinos.cn 9 | # 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program. If not, see . 22 | ### END LICENSE 23 | 24 | 25 | from threading import Thread 26 | 27 | 28 | class KAThread(Thread): 29 | 30 | def __init__(self, func, cbfunc, args): 31 | ''' 32 | :param func: 可调用的对象 33 | :param args: 可调用对象的参数 34 | ''' 35 | Thread.__init__(self) 36 | self.func = func 37 | self.args = args 38 | self.cbfunc = cbfunc 39 | self.result = "" 40 | 41 | def run(self): 42 | self.result = self.func(*self.args) 43 | if self.cbfunc : 44 | self.cbfunc(1, self.result) 45 | 46 | def getResult(self): 47 | return self.result 48 | 49 | if __name__ == "__main__": 50 | pass 51 | 52 | -------------------------------------------------------------------------------- /kylin-assistant.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=ToolKit 3 | Name[zh_CN]=工具箱 4 | Name[bo_CN]=ལག་རོགས། 5 | GenericName[bo_CN]=ལག་རོགས། 6 | Comment=System Auxiliar Tools 7 | Comment[zh_CN]=系统辅助工具 8 | Comment[bo_CN]=རྒྱུད་ཁོངས་ལས་རོགས་ལག་ཆ། 9 | Keywords=Settings;Cleaning;Customization 10 | Exec=/usr/bin/kylin-assistant %u 11 | Icon=kylin-assistant 12 | StartupNotify=true 13 | Terminal=false 14 | Type=Application 15 | Categories=GNOME;GTK;System;Viewer; 16 | -------------------------------------------------------------------------------- /kylin-assistant.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = \ 3 | src \ 4 | plugins \ 5 | kyasDbus 6 | 7 | TRANSLATIONS += \ 8 | src/translation/kylin-assistant_zh_CN.ts \ 9 | src/translation/kylin-assistant_es.ts \ 10 | src/translation/kylin-assistant_de.ts \ 11 | src/translation/kylin-assistant_fr.ts \ 12 | src/translation/kylin-assistant_ru.ts \ 13 | src/translation/kylin-assistant_bo.ts 14 | 15 | CONFIG += qt 16 | 17 | QT += widgets 18 | -------------------------------------------------------------------------------- /man/kylin-assistant-systemdaemon.py.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .TH KYLIN-ASSISTANT-SYSTEMDAEMON 1 "03 AUG 2021" 3 | .\" Please adjust this date whenever revising the manpage. 4 | .SH NAME 5 | kylin-assistant-systemdaemon \- launch systemdaemon 6 | .SH SYNOPSIS 7 | .B kylin-assistant-systemdaemon 8 | .SH DESCRIPTION 9 | .B kylin-assistant-systemdaemon 10 | It is used to launch systemdaemon. 11 | .PP 12 | .SH SEE ALSO 13 | .BR kylin-assistant-systemdaemon (1), 14 | .br 15 | .SH AUTHOR 16 | kylin-assistant-systemdaemon was written by Yang Min . 17 | .PP 18 | This manual page was written by Yang Min . 19 | -------------------------------------------------------------------------------- /man/kylin-assistant-systemdbus.py.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .TH KYLIN-ASSISTANT-SYSTEMDAEMON 1 "03 AUG 2021" 3 | .\" Please adjust this date whenever revising the manpage. 4 | .SH NAME 5 | kylin-assistant-systemdaemon \- launch systemdaemon 6 | .SH SYNOPSIS 7 | .B kylin-assistant-systemdaemon 8 | .SH DESCRIPTION 9 | .B kylin-assistant-systemdaemon 10 | It is used to launch systemdaemon. 11 | .PP 12 | .SH SEE ALSO 13 | .BR kylin-assistant-systemdaemon (1), 14 | .br 15 | .SH AUTHOR 16 | kylin-assistant-systemdaemon was written by Yang Min . 17 | .PP 18 | This manual page was written by Yang Min . 19 | 20 | -------------------------------------------------------------------------------- /man/kylin-assistant.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .TH KYLIN-ASSISTANT 1 "22 DEC 2017" 3 | .\" Please adjust this date whenever revising the manpage. 4 | .SH NAME 5 | kylin-assistant \- launch kylin-assistant frontends 6 | .SH SYNOPSIS 7 | .B kylin-assistant 8 | .SH DESCRIPTION 9 | .B kylin-assistant 10 | It is used to launch frontends. 11 | .PP 12 | .SH SEE ALSO 13 | .BR kylin-assistant (1), 14 | .br 15 | .SH AUTHOR 16 | kylin-assistant was written by lixiang . 17 | .PP 18 | This manual page was written by lixiang . 19 | 20 | -------------------------------------------------------------------------------- /plugins/drivemanage/driveinfopage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef DRIVEINFOPAGE_H 22 | #define DRIVEINFOPAGE_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "kdriveinfoitem.h" 33 | #include "../../src/commondef.h" 34 | #include "../../src/kajsondef.h" 35 | 36 | enum DI_TYPE{ 37 | DRIVEINFOTYPE_MOTHERBOCARD, // 主板 38 | DRIVEINFOTYPE_GRPHICS, // 显卡 39 | DRIVEINFOTYPE_NETWORK, // 有线网卡 40 | DRIVEINFOTYPE_AUDIO, // 声卡 41 | DRIVEINFOTYPE_WIFI, // 无线网卡 42 | DRIVEINFOTYPE_OTHER, // 其他 43 | }; 44 | 45 | typedef struct _DriveInfo_s 46 | { 47 | QString strName; 48 | QString strType; 49 | QString strVersion; 50 | }DriveInfo; 51 | 52 | class DriveInfoPage : public QWidget 53 | { 54 | Q_OBJECT 55 | public: 56 | explicit DriveInfoPage(QWidget *parent = nullptr); 57 | 58 | void initUI(); 59 | 60 | void initConnections(); 61 | void updateInfoItems(QString strInfoJson); 62 | 63 | public slots: 64 | void onUpdateInfo(QString strInfoJson); 65 | 66 | private: 67 | void clearInfoItems(); 68 | void refreshInfoItems(); 69 | DI_TYPE getDriveType(QString strType); 70 | 71 | private: 72 | QString m_strInfoJson; 73 | 74 | QHBoxLayout *m_mainLayout = nullptr; 75 | QFrame *m_listFrame = nullptr; 76 | QVBoxLayout *m_listLayout = nullptr; 77 | QScrollArea *m_scrollFrame = nullptr; 78 | 79 | QMap> m_mapItems; 80 | QMap> m_mapDriveInfo; 81 | }; 82 | 83 | #endif // DRIVEINFOPAGE_H 84 | -------------------------------------------------------------------------------- /plugins/drivemanage/drivemanage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef DRIVEMANAGE_H 22 | #define DRIVEMANAGE_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "../../src/interface.h" 32 | #include "loadingwidget.h" 33 | #include "driveinfopage.h" 34 | 35 | class DriveManage : public QObject, PluginInterface 36 | { 37 | Q_OBJECT 38 | Q_PLUGIN_METADATA(IID PluginInterfaceIID) 39 | Q_INTERFACES(PluginInterface) 40 | 41 | public: 42 | DriveManage(); 43 | virtual ~DriveManage(); 44 | 45 | QString getPluginName() Q_DECL_OVERRIDE; 46 | int getPluginType() Q_DECL_OVERRIDE; 47 | QWidget* getPluginMainWnd() Q_DECL_OVERRIDE; 48 | void pluginDelayControl() Q_DECL_OVERRIDE; 49 | const QString name() const Q_DECL_OVERRIDE; 50 | void updatePluginContent() Q_DECL_OVERRIDE; 51 | 52 | void initUI(); 53 | void initConnections(); 54 | void getDriveInfo(bool bReScan = false); 55 | 56 | bool isHW990(); 57 | QStringList getDeviceDriveInfo(); 58 | QString getDriveInfoJson(); 59 | 60 | public slots: 61 | void onUpdateInfo(unsigned uStatus, QString strInfoJson); 62 | 63 | private: 64 | QString m_pluginName; 65 | int m_pluginType; 66 | QWidget *m_pluginWidget = nullptr; 67 | bool mFirstLoad; 68 | 69 | QHBoxLayout *m_mainLayout = nullptr; 70 | LoadingWidget *m_loadingWidget = nullptr; 71 | DriveInfoPage *m_driveInfoPage = nullptr; 72 | QStackedWidget *m_stackedWidget = nullptr; 73 | }; 74 | 75 | #endif // DRIVEMANAGE_H 76 | -------------------------------------------------------------------------------- /plugins/drivemanage/drivemanage.pro: -------------------------------------------------------------------------------- 1 | 2 | QT += widgets dbus x11extras charts 3 | 4 | TEMPLATE = lib 5 | CONFIG += plugin \ 6 | link_pkgconfig \ 7 | C++11 8 | 9 | DEFINES += QT_MESSAGELOGCONTEXT 10 | 11 | include(../../env.pri) 12 | include(../../CommonControl/CommonControl.pri) 13 | 14 | TARGET = $$qtLibraryTarget(drivemanage) 15 | DESTDIR = .. 16 | target.path = $${PLUGIN_INSTALL_DIRS} 17 | INSTALLS += target 18 | 19 | LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt 20 | 21 | PKGCONFIG += gsettings-qt 22 | 23 | SOURCES += \ 24 | driveinfopage.cpp \ 25 | drivemanage.cpp 26 | 27 | HEADERS += \ 28 | driveinfopage.h \ 29 | drivemanage.h 30 | -------------------------------------------------------------------------------- /plugins/hwmonitor/cpufmpage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef CPUFMPAGE_H 22 | #define CPUFMPAGE_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "cpufmsetwidget.h" 31 | 32 | class CpuFMPage : public QWidget 33 | { 34 | Q_OBJECT 35 | public: 36 | explicit CpuFMPage(QWidget *parent = nullptr); 37 | virtual ~CpuFMPage(); 38 | 39 | void initUI(); 40 | void initConnections(); 41 | void refreshInfo(); 42 | 43 | public slots: 44 | void onCpuFMChange(QString strModel, QString strCurFreq); 45 | void onUpdateInfo(unsigned uStatus, QString strInfoJson); 46 | void onUpdateCoreFreq(QString strFreq); 47 | 48 | private: 49 | void initStyleTheme(); 50 | 51 | private: 52 | QVBoxLayout *m_layoutMain = nullptr; 53 | QHBoxLayout *m_layoutFreq = nullptr; 54 | QHBoxLayout *m_layoutSetting = nullptr; 55 | QHBoxLayout *m_layoutTips = nullptr; 56 | QVBoxLayout *m_layoutFreqRight = nullptr; 57 | 58 | CpuFMSetWidget *m_cpuFMSetWidget = nullptr; 59 | QLabel *m_iconFreq = nullptr; 60 | QLabel *m_labelFreqValue = nullptr; 61 | QLabel *m_labelFreq = nullptr; 62 | QLabel *m_labelTips = nullptr; 63 | 64 | QGSettings *m_styleSettings = nullptr; 65 | }; 66 | 67 | #endif // CPUFMPAGE_H 68 | -------------------------------------------------------------------------------- /plugins/hwmonitor/cpufmsetwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef CPUFMSETWIDGET_H 22 | #define CPUFMSETWIDGET_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "kainfotitle.h" 34 | #include "kaslider.h" 35 | 36 | class CpuFMSetWidget : public QWidget 37 | { 38 | Q_OBJECT 39 | public: 40 | explicit CpuFMSetWidget(QWidget *parent = nullptr); 41 | virtual ~CpuFMSetWidget(); 42 | 43 | void initUI(); 44 | void initConnections(); 45 | 46 | public slots: 47 | void onUpdateInfo(QString strInfoJson); 48 | void onButtonClicked(QAbstractButton* button); 49 | 50 | signals: 51 | void updateCpuFreq(QString strFreq); 52 | 53 | protected: 54 | void paintEvent(QPaintEvent *event); 55 | 56 | private: 57 | void initStyleTheme(); 58 | void updateUIStatus(); 59 | 60 | signals: 61 | void modelChanged(QString strModel, QString strFreq); 62 | 63 | private: 64 | QVBoxLayout *m_layoutMain = nullptr; 65 | QHBoxLayout *m_layoutTitle = nullptr; 66 | QHBoxLayout *m_layoutSingleChk = nullptr; 67 | QHBoxLayout *m_layoutSlider = nullptr; 68 | 69 | KAInfoTitle *m_labelTitle = nullptr; 70 | QButtonGroup *m_bgRadio = nullptr; 71 | QRadioButton *m_radioPerformance = nullptr; 72 | QRadioButton *m_radioPowerSave = nullptr; 73 | QRadioButton *m_radioUserSpace = nullptr; 74 | QRadioButton *m_radioBalance = nullptr; 75 | QRadioButton *m_radioOndemand = nullptr; 76 | QRadioButton *m_radioConservative = nullptr; 77 | 78 | KASlider *m_sliderUserSpace = nullptr; 79 | 80 | QString m_strCurModel; 81 | QString m_strCurFreq; 82 | 83 | QGSettings *m_styleSettings = nullptr; 84 | QColor m_alternateBase; 85 | QStringList m_validFreqList; 86 | QStringList m_validModelList; 87 | }; 88 | 89 | #endif // CPUFMSETWIDGET_H 90 | -------------------------------------------------------------------------------- /plugins/hwmonitor/devicemonitorpage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef DEVICEMONITORPAGE_H 22 | #define DEVICEMONITORPAGE_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "kausageitem.h" 34 | #include "katempitem.h" 35 | 36 | class DeviceMonitorPage : public QWidget 37 | { 38 | Q_OBJECT 39 | public: 40 | explicit DeviceMonitorPage(QWidget *parent = nullptr); 41 | virtual ~DeviceMonitorPage(); 42 | 43 | void initUI(); 44 | void initConnections(); 45 | void refreshInfo(); 46 | 47 | public slots: 48 | void onUpdateInfo(unsigned uStatus, QString strInfoJson); 49 | 50 | signals: 51 | void updateInfo(unsigned uStatus, QString strInfoJson); 52 | 53 | private: 54 | void initStyleTheme(); 55 | void clearInfoItems(); 56 | void addInfoItems(int nType, QString strTitle, qreal rHigh, qreal rVHigh, qreal newValue); 57 | void checkTempStatus(); 58 | 59 | private: 60 | QVBoxLayout *m_mainLayout = nullptr; 61 | QVBoxLayout *m_tempLayout = nullptr; 62 | QVBoxLayout *m_usageLayout = nullptr; 63 | QHBoxLayout *m_tempTitleLayout = nullptr; 64 | QHBoxLayout *m_tempContentLayout = nullptr; 65 | QVBoxLayout *m_scrollLayout = nullptr; 66 | QScrollArea *m_scrollFrame = nullptr; 67 | QFrame *m_scrollWidget = nullptr; 68 | //usage items 69 | KAUsageItem *m_usageItemCPU = nullptr; 70 | KAUsageItem *m_usageItemMem = nullptr; 71 | // temperature items 72 | QLabel *m_tempTitle = nullptr; 73 | KATempItem *m_tempCpu = nullptr; 74 | KATempItem *m_tempDev = nullptr; 75 | KATempItem *m_tempBaseBoard = nullptr; 76 | 77 | QGSettings *m_styleSettings = nullptr; 78 | QList m_listStatus; 79 | QMap m_mapSubWidgets; 80 | }; 81 | 82 | #endif // DEVICEMONITORPAGE_H 83 | -------------------------------------------------------------------------------- /plugins/hwmonitor/hwmonitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef HWMONITOR_H 22 | #define HWMONITOR_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/interface.h" 31 | #include "loadingwidget.h" 32 | #include "hwmonitorwidget.h" 33 | 34 | class HWMonitorInfo : public QObject, PluginInterface 35 | { 36 | Q_OBJECT 37 | Q_PLUGIN_METADATA(IID PluginInterfaceIID) 38 | Q_INTERFACES(PluginInterface) 39 | 40 | public: 41 | HWMonitorInfo(); 42 | virtual ~HWMonitorInfo(); 43 | 44 | QString getPluginName() Q_DECL_OVERRIDE; 45 | int getPluginType() Q_DECL_OVERRIDE; 46 | QWidget* getPluginMainWnd() Q_DECL_OVERRIDE; 47 | void pluginDelayControl() Q_DECL_OVERRIDE; 48 | const QString name() const Q_DECL_OVERRIDE; 49 | void updatePluginContent() Q_DECL_OVERRIDE; 50 | 51 | void initUI(); 52 | void initConnections(); 53 | 54 | public slots: 55 | void onUpdateInfo(unsigned uStatus, QString strInfoJson); 56 | 57 | private: 58 | QString m_pluginName; 59 | int m_pluginType; 60 | QWidget *m_pluginWidget = nullptr; 61 | bool mFirstLoad; 62 | 63 | QHBoxLayout *m_mainLayout = nullptr; 64 | LoadingWidget *m_loadingWidget = nullptr; 65 | HWMonitorWidget *m_hwMonitorWidget = nullptr; 66 | QStackedWidget *m_stackedWidget = nullptr; 67 | }; 68 | 69 | #endif // HWMONITOR_H 70 | -------------------------------------------------------------------------------- /plugins/hwmonitor/hwmonitor.pro: -------------------------------------------------------------------------------- 1 | 2 | QT += widgets dbus x11extras charts 3 | 4 | TEMPLATE = lib 5 | CONFIG += plugin \ 6 | link_pkgconfig \ 7 | C++11 8 | 9 | DEFINES += QT_MESSAGELOGCONTEXT 10 | 11 | include(../../env.pri) 12 | include(../../CommonControl/CommonControl.pri) 13 | include(../../dataworker/dataworker.pri) 14 | 15 | TARGET = $$qtLibraryTarget(hwmonitor) 16 | DESTDIR = .. 17 | target.path = $${PLUGIN_INSTALL_DIRS} 18 | INSTALLS += target 19 | 20 | LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt 21 | 22 | PKGCONFIG += gsettings-qt 23 | 24 | SOURCES += \ 25 | cpufmpage.cpp \ 26 | cpufmsetwidget.cpp \ 27 | devicemonitorpage.cpp \ 28 | hwmonitor.cpp \ 29 | hwmonitorwidget.cpp \ 30 | kaprogressbar.cpp \ 31 | katempitem.cpp \ 32 | kausageitem.cpp 33 | 34 | HEADERS += \ 35 | cpufmpage.h \ 36 | cpufmsetwidget.h \ 37 | devicemonitorpage.h \ 38 | hwmonitor.h \ 39 | hwmonitorwidget.h \ 40 | kaprogressbar.h \ 41 | katempitem.h \ 42 | kausageitem.h 43 | -------------------------------------------------------------------------------- /plugins/hwmonitor/hwmonitorwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef HWMONITORWIDGET_H 22 | #define HWMONITORWIDGET_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "kagroupbutton.h" 33 | #include "devicemonitorpage.h" 34 | #include "cpufmpage.h" 35 | 36 | class HWMonitorWidget : public QWidget 37 | { 38 | Q_OBJECT 39 | public: 40 | explicit HWMonitorWidget(QWidget *parent = nullptr); 41 | virtual ~HWMonitorWidget(); 42 | 43 | void initUI(); 44 | 45 | void initConnections(); 46 | 47 | public slots: 48 | void onUpdateInfo(unsigned uStatus, QString strInfoJson); 49 | void onSwitchWidget(); 50 | void onTimerRefreshInfo(); 51 | void onRefreshInfo(); 52 | 53 | signals: 54 | void refreshInfo(); 55 | 56 | private: 57 | void initStyleTheme(); 58 | 59 | private: 60 | QVBoxLayout *m_mainLayout = nullptr; 61 | QHBoxLayout *m_topLayout = nullptr; 62 | KAGroupButton *m_btnDevMonitor = nullptr; 63 | KAGroupButton *m_btnFreqAdjust = nullptr; 64 | QButtonGroup *m_btnGroup = nullptr; 65 | QStackedWidget *m_stackedWidget = nullptr; 66 | QGSettings *m_styleSettings = nullptr; 67 | 68 | DeviceMonitorPage *m_deviceMonitor = nullptr; 69 | CpuFMPage *m_cpuFM = nullptr; 70 | 71 | QString m_strStyleName; 72 | QTimer *m_refreshInfoTimer = nullptr; 73 | }; 74 | 75 | #endif // HWMONITORWIDGET_H 76 | -------------------------------------------------------------------------------- /plugins/hwmonitor/kaprogressbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KAPROGRESSBAR_H 22 | #define KAPROGRESSBAR_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class KAProgressBar : public QWidget 29 | { 30 | Q_OBJECT 31 | public: 32 | enum Corner { 33 | TopLeftCorner = 0x00001, 34 | TopRightCorner = 0x00002, 35 | BottomLeftCorner = 0x00004, 36 | BottomRightCorner = 0x00008 37 | }; 38 | Q_DECLARE_FLAGS(Corners, Corner) 39 | typedef enum PROG_STATUS_e{ 40 | STATUS_NORMAL = 0, 41 | STATUS_HIGH, 42 | STATUS_VHIGH 43 | }PROG_STATUS; 44 | explicit KAProgressBar(QWidget *parent = nullptr); 45 | 46 | void setMaxValue(qreal rMaxValue); 47 | void setCurValue(qreal rCurValue); 48 | void setThresholdValue(qreal rHigh, qreal rVHigh); 49 | qreal getCurValue(); 50 | qreal getMaxValue(); 51 | PROG_STATUS getCurStatus() { 52 | return m_curStatus; 53 | } 54 | 55 | protected: 56 | void paintEvent(QPaintEvent *event); 57 | void drawRoundedRect(QPainter *pa, const QRect &rect, 58 | qreal xRadius, qreal yRadius, Corners corners, Qt::SizeMode mode = Qt::AbsoluteSize) const; 59 | 60 | private: 61 | qreal m_rMaxValue; 62 | qreal m_rCurValue; 63 | qreal m_rThresholdHigh; 64 | qreal m_rThresholdVHigh; 65 | QColor m_colorNormal; 66 | QColor m_colorHigh; 67 | QColor m_colorVHigh; 68 | QColor m_colorLeft; 69 | PROG_STATUS m_curStatus; 70 | }; 71 | 72 | #endif // KAPROGRESSBAR_H 73 | -------------------------------------------------------------------------------- /plugins/hwmonitor/katempitem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KATEMPITEM_H 22 | #define KATEMPITEM_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | QT_CHARTS_USE_NAMESPACE 33 | 34 | #define TEMP_CHARTSDATA_MAX 30 35 | 36 | class KATempItem : public QWidget 37 | { 38 | Q_OBJECT 39 | public: 40 | typedef enum TEMP_STATUS_e { 41 | STATUS_NORMAL, 42 | STATUS_HIGH, 43 | STATUS_VHIGH 44 | }TEMP_STATUS; 45 | explicit KATempItem(QString strTitle, QWidget *parent = nullptr); 46 | virtual ~KATempItem(); 47 | 48 | void initUI(); 49 | void setTitle(QString strTitle); 50 | qreal getCurTemperature(); 51 | void setThresholdValue(qreal rHigh, qreal rVHigh); 52 | TEMP_STATUS getCurStatus() { 53 | return m_curStatus; 54 | } 55 | 56 | public slots: 57 | void onUpdateTemperature(qreal fTemp); 58 | 59 | protected: 60 | void paintEvent(QPaintEvent *event); 61 | 62 | private: 63 | void initStyleTheme(); 64 | 65 | private: 66 | QChart *m_chart = nullptr; 67 | QChartView *m_chartView = nullptr; 68 | QLineSeries *m_upLineSeriesTemp = nullptr; 69 | QLineSeries *m_lowLineSeriesTemp = nullptr; 70 | QAreaSeries *m_areaSeriesTemp = nullptr; 71 | QValueAxis *m_valueAxisX = nullptr; 72 | QValueAxis *m_valueAxisY = nullptr; 73 | QSplineSeries *m_valueLine = nullptr; 74 | 75 | QColor m_colorBg; 76 | QColor m_colorBgDark; 77 | QColor m_colorBgCur; 78 | QColor m_colorNormal; 79 | QColor m_colorHigh; 80 | QColor m_colorVHigh; 81 | 82 | qreal m_tempThresholdHigh; 83 | qreal m_tempThresholdVHigh; 84 | qreal m_tempMax; 85 | 86 | QList m_historyTemp; 87 | QString m_strTitle; 88 | QLabel *m_labelTitle = nullptr; 89 | QLabel *m_labelTemp = nullptr; 90 | 91 | QVBoxLayout *m_mainLayout = nullptr; 92 | QHBoxLayout *m_topLayout = nullptr; 93 | QHBoxLayout *m_chartLayout = nullptr; 94 | 95 | QGSettings *m_styleSettings = nullptr; 96 | TEMP_STATUS m_curStatus; 97 | }; 98 | 99 | #endif // KATEMPITEM_H 100 | -------------------------------------------------------------------------------- /plugins/hwmonitor/kausageitem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KAUSAGEITEM_H 22 | #define KAUSAGEITEM_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "kaprogressbar.h" 31 | 32 | class KAUsageItem : public QWidget 33 | { 34 | Q_OBJECT 35 | public: 36 | explicit KAUsageItem(QString strTitle, QWidget *parent = nullptr); 37 | virtual ~KAUsageItem(); 38 | 39 | void initUI(); 40 | void setTitle(QString strTitle); 41 | void setMaxValue(qreal rMaxValue); 42 | void setThresholdValue(qreal rHigh, qreal rVHigh); 43 | qreal getMaxValue(); 44 | qreal getCurValue(); 45 | KAProgressBar::PROG_STATUS getCurStatus() { 46 | return m_progressBar->getCurStatus(); 47 | } 48 | 49 | public slots: 50 | void onUpdateValue(qreal rCurValue); 51 | 52 | private: 53 | void initStyleTheme(); 54 | 55 | private: 56 | QString m_strTitle; 57 | QLabel *m_labelTitle = nullptr; 58 | QLabel *m_labelUsed = nullptr; 59 | QLabel *m_labelLeft = nullptr; 60 | KAProgressBar *m_progressBar = nullptr; 61 | QVBoxLayout *m_mainLayout = nullptr; 62 | QHBoxLayout *m_topLayout = nullptr; 63 | QHBoxLayout *m_midLayout = nullptr; 64 | QHBoxLayout *m_buttomLayout = nullptr; 65 | 66 | QGSettings *m_styleSettings = nullptr; 67 | }; 68 | 69 | #endif // KAUSAGEITEM_H 70 | -------------------------------------------------------------------------------- /plugins/hwparam/batteryinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef BATTERYINFO_H 22 | #define BATTERYINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum BTI_INDEX{ 35 | BATTERYINFO_TITLE, 36 | BATTERYINFO_MANUFACTURER, 37 | BATTERYINFO_MODEL, 38 | BATTERYINFO_SERAILNUM, 39 | BATTERYINFO_TTE, 40 | BATTERYINFO_USEDTIMES, 41 | BATTERYINFO_ENERGYFULL, 42 | BATTERYINFO_ENERGY, 43 | BATTERYINFO_STATE, 44 | BATTERYINFO_PERCENTAGE, 45 | }; 46 | 47 | class BatteryInfo : public KABaseInfoPage 48 | { 49 | Q_OBJECT 50 | public: 51 | explicit BatteryInfo(QWidget *parent = nullptr); 52 | 53 | void initUI(); 54 | 55 | void initConnections(); 56 | void updateInfoItems(QString strInfoJson); 57 | 58 | public slots: 59 | void onUpdateInfo(QString strInfoJson) override; 60 | void onRefreshInfo() override; 61 | 62 | private: 63 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 64 | void clearInfoItems(); 65 | 66 | private: 67 | QString m_strInfoJson; 68 | 69 | QVBoxLayout *m_mainLayout = nullptr; 70 | QFrame *m_listFrame = nullptr; 71 | QVBoxLayout *m_listLayout = nullptr; 72 | QScrollArea *m_scrollFrame = nullptr; 73 | 74 | QMap> m_mapInfoItems; 75 | }; 76 | 77 | #endif // BATTERYINFO_H 78 | -------------------------------------------------------------------------------- /plugins/hwparam/bluetoothinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef BLUETOOTHINFO_H 22 | #define BLUETOOTHINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum BLI_INDEX{ 35 | BLUETOOTHINFO_TITLE, 36 | BLUETOOTHINFO_INVALID, 37 | BLUETOOTHINFO_BUSADDR, 38 | BLUETOOTHINFO_FUNCTION, 39 | BLUETOOTHINFO_FREQ, 40 | BLUETOOTHINFO_CONF, 41 | BLUETOOTHINFO_DEVTYPE, 42 | BLUETOOTHINFO_ID, 43 | BLUETOOTHINFO_DEVMODEL, 44 | BLUETOOTHINFO_RESOURCE, 45 | BLUETOOTHINFO_MANUFACTURER, 46 | BLUETOOTHINFO_DEVVERSION, 47 | BLUETOOTHINFO_DATAWIDTH, 48 | BLUETOOTHINFO_NAME, 49 | BLUETOOTHINFO_DRIVER, 50 | BLUETOOTHINFO_SPEED, 51 | BLUETOOTHINFO_SERIALNUM, 52 | BLUETOOTHINFO_ADDRESS, 53 | BLUETOOTHINFO_LINKMODE, 54 | BLUETOOTHINFO_LINKPOLICY, 55 | BLUETOOTHINFO_CAPABILITIES, 56 | BLUETOOTHINFO_BUS, 57 | BLUETOOTHINFO_SCOMTU, 58 | BLUETOOTHINFO_ALCMTU, 59 | BLUETOOTHINFO_PACKETTYPE, 60 | BLUETOOTHINFO_FEATURES, 61 | }; 62 | 63 | class BluetoothInfo : public KABaseInfoPage 64 | { 65 | Q_OBJECT 66 | public: 67 | explicit BluetoothInfo(QWidget *parent = nullptr); 68 | 69 | void initUI(); 70 | 71 | void initConnections(); 72 | void updateInfoItems(QString strInfoJson); 73 | 74 | public slots: 75 | void onUpdateInfo(QString strInfoJson) override; 76 | void onRefreshInfo() override; 77 | 78 | private: 79 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 80 | void clearInfoItems(); 81 | void chkNoDevice(); 82 | 83 | private: 84 | QString m_strInfoJson; 85 | 86 | QVBoxLayout *m_mainLayout = nullptr; 87 | QFrame *m_listFrame = nullptr; 88 | QVBoxLayout *m_listLayout = nullptr; 89 | QScrollArea *m_scrollFrame = nullptr; 90 | 91 | QMap> m_mapInfoItems; 92 | }; 93 | 94 | #endif // BLUETOOTHINFO_H 95 | -------------------------------------------------------------------------------- /plugins/hwparam/camerainfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef CAMERAINFO_H 22 | #define CAMERAINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum CAI_INDEX{ 35 | CAMERAINFO_TITLE, 36 | CAMERAINFO_NAME, 37 | CAMERAINFO_RESOLUTION, 38 | CAMERAINFO_MANUFACTURER, 39 | CAMERAINFO_MODEL, 40 | CAMERAINFO_INTERFACE, 41 | CAMERAINFO_DRIVER, 42 | CAMERAINFO_TYPE, 43 | CAMERAINFO_VERSION, 44 | CAMERAINFO_BUSINFO, 45 | CAMERAINFO_SPEED 46 | }; 47 | 48 | class CameraInfo : public KABaseInfoPage 49 | { 50 | Q_OBJECT 51 | public: 52 | explicit CameraInfo(QWidget *parent = nullptr); 53 | 54 | void initUI(); 55 | 56 | void initConnections(); 57 | void updateInfoItems(QString strInfoJson); 58 | 59 | public slots: 60 | void onUpdateInfo(QString strInfoJson) override; 61 | void onRefreshInfo() override; 62 | 63 | private: 64 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 65 | void clearInfoItems(); 66 | 67 | private: 68 | QString m_strInfoJson; 69 | 70 | QVBoxLayout *m_mainLayout = nullptr; 71 | QFrame *m_listFrame = nullptr; 72 | QVBoxLayout *m_listLayout = nullptr; 73 | QScrollArea *m_scrollFrame = nullptr; 74 | 75 | QMap> m_mapInfoItems; 76 | }; 77 | 78 | #endif // CAMERAINFO_H 79 | -------------------------------------------------------------------------------- /plugins/hwparam/cdrominfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef CDROMINFO_H 22 | #define CDROMINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum CDI_INDEX{ 35 | CDROMINFO_TITLE, 36 | CDROMINFO_INVALID, 37 | CDROMINFO_NAME, 38 | CDROMINFO_MANUFACTURER, 39 | CDROMINFO_VERSION, 40 | CDROMINFO_MODEL, 41 | CDROMINFO_SERAILNUM, 42 | CDROMINFO_BUSINFO, 43 | CDROMINFO_DRIVER, 44 | CDROMINFO_SPEED, 45 | CDROMINFO_DEVICENUM, 46 | }; 47 | 48 | class CDRomInfo : public KABaseInfoPage 49 | { 50 | Q_OBJECT 51 | public: 52 | explicit CDRomInfo(QWidget *parent = nullptr); 53 | 54 | void initUI(); 55 | 56 | void initConnections(); 57 | void updateInfoItems(QString strInfoJson); 58 | 59 | public slots: 60 | void onUpdateInfo(QString strInfoJson) override; 61 | void onRefreshInfo() override; 62 | 63 | private: 64 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 65 | void clearInfoItems(); 66 | void chkNoDevice(); 67 | 68 | private: 69 | QString m_strInfoJson; 70 | 71 | QVBoxLayout *m_mainLayout = nullptr; 72 | QFrame *m_listFrame = nullptr; 73 | QVBoxLayout *m_listLayout = nullptr; 74 | QScrollArea *m_scrollFrame = nullptr; 75 | 76 | QMap> m_mapInfoItems; 77 | }; 78 | 79 | #endif // CDROMINFO_H 80 | -------------------------------------------------------------------------------- /plugins/hwparam/faninfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef FANINFO_H 22 | #define FANINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "../../src/kajsondef.h" 32 | #include "kainfotitle.h" 33 | #include "kabaseinfopage.h" 34 | 35 | enum FAI_INDEX{ 36 | FANINFO_TITLE, 37 | FANINFO_INVALID, 38 | FANINFO_SPEED 39 | }; 40 | 41 | class FanInfo : public KABaseInfoPage 42 | { 43 | Q_OBJECT 44 | public: 45 | explicit FanInfo(QWidget *parent = nullptr); 46 | 47 | void initUI(); 48 | 49 | void initConnections(); 50 | void updateInfoItems(QString strInfoJson); 51 | 52 | public slots: 53 | void onUpdateInfo(QString strInfoJson) override; 54 | void onRefreshInfo() override; 55 | 56 | private: 57 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 58 | void clearInfoItems(); 59 | void chkNoDevice(); 60 | 61 | private: 62 | QString m_strInfoJson; 63 | 64 | QVBoxLayout *m_mainLayout = nullptr; 65 | QFrame *m_listFrame = nullptr; 66 | QVBoxLayout *m_listLayout = nullptr; 67 | QScrollArea *m_scrollFrame = nullptr; 68 | 69 | QMap> m_mapInfoItems; 70 | QTimer *m_refreshInfoTimer = nullptr; 71 | }; 72 | 73 | #endif // FANINFO_H 74 | -------------------------------------------------------------------------------- /plugins/hwparam/graphicscardinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef GRAPHICSCARDINFO_H 22 | #define GRAPHICSCARDINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum GCI_INDEX{ 35 | GRAPHICSCARDINFO_TITLE, 36 | GRAPHICSCARDINFO_INVALID, 37 | GRAPHICSCARDINFO_MANUFACTURER, 38 | GRAPHICSCARDINFO_SUBSYSTEM, 39 | GRAPHICSCARDINFO_NAME, 40 | GRAPHICSCARDINFO_ISDISCRETE, 41 | GRAPHICSCARDINFO_MEMORY, 42 | GRAPHICSCARDINFO_MEMTYPE, 43 | GRAPHICSCARDINFO_CAPCITY, 44 | GRAPHICSCARDINFO_MODEL, 45 | GRAPHICSCARDINFO_VERSION, 46 | GRAPHICSCARDINFO_BITWIDTH, 47 | GRAPHICSCARDINFO_FUNCTION, 48 | GRAPHICSCARDINFO_CLOCK, 49 | GRAPHICSCARDINFO_DRIVER, 50 | GRAPHICSCARDINFO_DBUSINFO, 51 | GRAPHICSCARDINFO_PHYSICSID, 52 | GRAPHICSCARDINFO_DEVICE, 53 | GRAPHICSCARDINFO_GDDRCAPACITY, 54 | GRAPHICSCARDINFO_EGLVERSION, 55 | GRAPHICSCARDINFO_EGLAPIS, 56 | GRAPHICSCARDINFO_GLVERSION, 57 | GRAPHICSCARDINFO_GLSLVERSION, 58 | }; 59 | 60 | class GraphicsCardInfo : public KABaseInfoPage 61 | { 62 | Q_OBJECT 63 | public: 64 | explicit GraphicsCardInfo(QWidget *parent = nullptr); 65 | 66 | void initUI(); 67 | 68 | void initConnections(); 69 | void updateInfoItems(QString strInfoJson); 70 | 71 | public slots: 72 | void onUpdateInfo(QString strInfoJson) override; 73 | void onRefreshInfo() override; 74 | 75 | private: 76 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 77 | void clearInfoItems(); 78 | void chkNoDevice(); 79 | 80 | private: 81 | QString m_strInfoJson; 82 | 83 | QVBoxLayout *m_mainLayout = nullptr; 84 | QFrame *m_listFrame = nullptr; 85 | QVBoxLayout *m_listLayout = nullptr; 86 | QScrollArea *m_scrollFrame = nullptr; 87 | 88 | QMap> m_mapInfoItems; 89 | }; 90 | 91 | #endif // GRAPHICSCARDINFO_H 92 | -------------------------------------------------------------------------------- /plugins/hwparam/harddiskinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef HARDDISKINFO_H 22 | #define HARDDISKINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum HDI_INDEX{ 35 | HARDDISKINFO_TITLE, 36 | HARDDISKINFO_INVALID, 37 | HARDDISKINFO_MANUFACTURER, 38 | HARDDISKINFO_NAME, 39 | HARDDISKINFO_CAPACITY, 40 | HARDDISKINFO_USEDTIMES, 41 | HARDDISKINFO_INTERFACE, 42 | HARDDISKINFO_ISMAINDISK, 43 | HARDDISKINFO_ISSSD, 44 | HARDDISKINFO_SERIALNUM, 45 | HARDDISKINFO_MODEL, 46 | HARDDISKINFO_TRANSRATE, 47 | HARDDISKINFO_READSPEED, 48 | HARDDISKINFO_WRITESPEED, 49 | HARDDISKINFO_FIRMWAREVER, 50 | }; 51 | 52 | class HardDiskInfo : public KABaseInfoPage 53 | { 54 | Q_OBJECT 55 | public: 56 | explicit HardDiskInfo(QWidget *parent = nullptr); 57 | 58 | void initUI(); 59 | 60 | void initConnections(); 61 | void updateInfoItems(QString strInfoJson); 62 | 63 | public slots: 64 | void onUpdateInfo(QString strInfoJson) override; 65 | void onRefreshInfo() override; 66 | 67 | private: 68 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 69 | void clearInfoItems(); 70 | void chkNoDevice(); 71 | 72 | private: 73 | QString m_strInfoJson; 74 | 75 | QVBoxLayout *m_mainLayout = nullptr; 76 | QFrame *m_listFrame = nullptr; 77 | QVBoxLayout *m_listLayout = nullptr; 78 | QScrollArea *m_scrollFrame = nullptr; 79 | 80 | QMap> m_mapInfoItems; 81 | }; 82 | 83 | #endif // HARDDISKINFO_H 84 | -------------------------------------------------------------------------------- /plugins/hwparam/hwparam.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "hwparam.h" 22 | 23 | #include "../../src/commondef.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | HWParam::HWParam() 33 | { 34 | m_pluginName = tr("HardwareParam"); 35 | m_pluginType = HARDWARE_PARAMETERS; 36 | mFirstLoad = true; 37 | } 38 | 39 | QString HWParam::getPluginName() 40 | { 41 | return m_pluginName; 42 | } 43 | 44 | int HWParam::getPluginType() 45 | { 46 | return m_pluginType; 47 | } 48 | 49 | QWidget* HWParam::getPluginMainWnd() 50 | { 51 | if (mFirstLoad) { 52 | mFirstLoad = false; 53 | initUI(); 54 | initConnections(); 55 | } 56 | return m_pluginWidget; 57 | } 58 | 59 | void HWParam::pluginDelayControl() 60 | { 61 | if (m_mainInfoPage) 62 | m_mainInfoPage->refreshInfo(); 63 | } 64 | 65 | const QString HWParam::name() const 66 | { 67 | return QStringLiteral("hardwareparam"); 68 | } 69 | 70 | void HWParam::updatePluginContent() 71 | { 72 | // if (m_mainInfoPage) 73 | // m_mainInfoPage->refreshInfo(); 74 | } 75 | 76 | void HWParam::initUI() 77 | { 78 | m_pluginWidget = new QWidget(); 79 | m_pluginWidget->setFixedSize(RIGHT_PANEL_WIDTH, RIGHT_PANEL_HEIGHT); 80 | m_pluginWidget->setAttribute(Qt::WA_DeleteOnClose); 81 | 82 | m_mainLayout = new QHBoxLayout(); 83 | m_mainLayout->setContentsMargins(0,0,0,0); 84 | m_mainLayout->setSpacing(0); 85 | 86 | m_stackedWidget = new QStackedWidget(); 87 | 88 | m_loadingWidget = new LoadingWidget(); 89 | m_stackedWidget->addWidget(m_loadingWidget); 90 | m_mainInfoPage = new MainInfoPage(); 91 | m_stackedWidget->addWidget(m_mainInfoPage); 92 | m_mainLayout->addWidget(m_stackedWidget); 93 | 94 | m_pluginWidget->setLayout(m_mainLayout); 95 | } 96 | 97 | void HWParam::initConnections() 98 | { 99 | // 连接dbus信号 100 | if (m_mainInfoPage) 101 | connect(m_mainInfoPage, &MainInfoPage::updateInfo, this, &HWParam::onUpdateInfo); 102 | } 103 | 104 | 105 | void HWParam::onUpdateInfo(unsigned uStatus) 106 | { 107 | qInfo()<<"updateInfo:"<setCurrentIndex(0); 110 | } else { 111 | m_stackedWidget->setCurrentIndex(1); 112 | } 113 | } 114 | 115 | -------------------------------------------------------------------------------- /plugins/hwparam/hwparam.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef HWPARAM_H 22 | #define HWPARAM_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/interface.h" 31 | #include "loadingwidget.h" 32 | #include "maininfopage.h" 33 | 34 | class HWParam : public QObject, PluginInterface 35 | { 36 | Q_OBJECT 37 | Q_PLUGIN_METADATA(IID PluginInterfaceIID) 38 | Q_INTERFACES(PluginInterface) 39 | 40 | public: 41 | explicit HWParam(); 42 | 43 | QString getPluginName() Q_DECL_OVERRIDE; 44 | int getPluginType() Q_DECL_OVERRIDE; 45 | QWidget* getPluginMainWnd() Q_DECL_OVERRIDE; 46 | void pluginDelayControl() Q_DECL_OVERRIDE; 47 | const QString name() const Q_DECL_OVERRIDE; 48 | void updatePluginContent() Q_DECL_OVERRIDE; 49 | 50 | void initUI(); 51 | void initConnections(); 52 | void getHardwareParam(bool bReScan = false); 53 | 54 | public slots: 55 | void onUpdateInfo(unsigned uStatus); 56 | 57 | private: 58 | QString m_pluginName; 59 | int m_pluginType; 60 | QWidget *m_pluginWidget = nullptr; 61 | bool mFirstLoad; 62 | 63 | LoadingWidget *m_loadingWidget = nullptr; 64 | MainInfoPage *m_mainInfoPage = nullptr; 65 | QHBoxLayout *m_mainLayout = nullptr; 66 | QStackedWidget *m_stackedWidget = nullptr; 67 | }; 68 | 69 | #endif // HWPARAM_H 70 | -------------------------------------------------------------------------------- /plugins/hwparam/hwparam.pro: -------------------------------------------------------------------------------- 1 | 2 | QT += widgets dbus x11extras 3 | 4 | TEMPLATE = lib 5 | CONFIG += plugin \ 6 | link_pkgconfig \ 7 | C++11 8 | 9 | DEFINES += QT_MESSAGELOGCONTEXT 10 | 11 | include(../../env.pri) 12 | include(../../CommonControl/CommonControl.pri) 13 | include(../../dataworker/dataworker.pri) 14 | 15 | TARGET = $$qtLibraryTarget(hwparam) 16 | DESTDIR = .. 17 | target.path = $${PLUGIN_INSTALL_DIRS} 18 | INSTALLS += target 19 | 20 | LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt 21 | LIBS +=-lX11 22 | LIBS +=-lXrandr 23 | LIBS +=-ludev 24 | 25 | PKGCONFIG += gsettings-qt 26 | 27 | SOURCES += \ 28 | batteryinfo.cpp \ 29 | bluetoothinfo.cpp \ 30 | camerainfo.cpp \ 31 | cdrominfo.cpp \ 32 | faninfo.cpp \ 33 | graphicscardinfo.cpp \ 34 | harddiskinfo.cpp \ 35 | hwparam.cpp \ 36 | kabaseinfopage.cpp \ 37 | keyboardinfo.cpp \ 38 | maininfopage.cpp \ 39 | memoryinfo.cpp \ 40 | monitorinfo.cpp \ 41 | motherboardinfo.cpp \ 42 | mouseinfo.cpp \ 43 | netcardinfo.cpp \ 44 | processorinfo.cpp \ 45 | udevhotplugin.cpp \ 46 | voicecardinfo.cpp 47 | 48 | HEADERS += \ 49 | batteryinfo.h \ 50 | bluetoothinfo.h \ 51 | camerainfo.h \ 52 | cdrominfo.h \ 53 | faninfo.h \ 54 | graphicscardinfo.h \ 55 | harddiskinfo.h \ 56 | hwparam.h \ 57 | kabaseinfopage.h \ 58 | keyboardinfo.h \ 59 | maininfopage.h \ 60 | memoryinfo.h \ 61 | monitorinfo.h \ 62 | motherboardinfo.h \ 63 | mouseinfo.h \ 64 | netcardinfo.h \ 65 | processorinfo.h \ 66 | udevhotplugin.h \ 67 | voicecardinfo.h 68 | -------------------------------------------------------------------------------- /plugins/hwparam/kabaseinfopage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "kabaseinfopage.h" 22 | 23 | KABaseInfoPage::KABaseInfoPage(QWidget *parent) 24 | : QWidget(parent) 25 | { 26 | 27 | } 28 | 29 | void KABaseInfoPage::onRefreshInfo() 30 | { 31 | 32 | } 33 | 34 | void KABaseInfoPage::onUpdateInfo(QString strInfoJson) 35 | { 36 | 37 | } 38 | 39 | void KABaseInfoPage::onUpdateInfo(unsigned uStatus, QString strInfoJson) 40 | { 41 | Q_UNUSED(uStatus); 42 | onUpdateInfo(strInfoJson); 43 | } 44 | -------------------------------------------------------------------------------- /plugins/hwparam/kabaseinfopage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KABASEINFOPAGE_H 22 | #define KABASEINFOPAGE_H 23 | 24 | #include 25 | 26 | class KABaseInfoPage : public QWidget 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit KABaseInfoPage(QWidget *parent = nullptr); 31 | 32 | public slots: 33 | virtual void onRefreshInfo(); 34 | virtual void onUpdateInfo(QString strInfoJson); 35 | virtual void onUpdateInfo(unsigned uStatus, QString strInfoJson); 36 | }; 37 | 38 | #endif // KABASEINFOPAGE_H 39 | -------------------------------------------------------------------------------- /plugins/hwparam/keyboardinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KEYBOARDINFO_H 22 | #define KEYBOARDINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum KBI_INDEX{ 35 | KEYBOARDINFO_TITLE, 36 | KEYBOARDINFO_INVALID, 37 | KEYBOARDINFO_DEVTYPE, 38 | KEYBOARDINFO_NAME, 39 | KEYBOARDINFO_DEVMODEL, 40 | KEYBOARDINFO_MANUFACTURER, 41 | KEYBOARDINFO_DEVADDR, 42 | KEYBOARDINFO_INTERFACE, 43 | KEYBOARDINFO_DRIVER, 44 | }; 45 | 46 | class KeyboardInfo : public KABaseInfoPage 47 | { 48 | Q_OBJECT 49 | public: 50 | explicit KeyboardInfo(QWidget *parent = nullptr); 51 | 52 | void initUI(); 53 | 54 | void initConnections(); 55 | void updateInfoItems(QString strInfoJson); 56 | 57 | public slots: 58 | void onUpdateInfo(QString strInfoJson) override; 59 | void onRefreshInfo() override; 60 | 61 | private: 62 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 63 | void clearInfoItems(); 64 | void chkNoDevice(); 65 | 66 | private: 67 | QString m_strInfoJson; 68 | 69 | QVBoxLayout *m_mainLayout = nullptr; 70 | QFrame *m_listFrame = nullptr; 71 | QVBoxLayout *m_listLayout = nullptr; 72 | QScrollArea *m_scrollFrame = nullptr; 73 | 74 | QMap> m_mapInfoItems; 75 | }; 76 | 77 | #endif // KEYBOARDINFO_H 78 | -------------------------------------------------------------------------------- /plugins/hwparam/memoryinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef MEMORYINFO_H 22 | #define MEMORYINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum MMI_INDEX{ 35 | MEMORYINFO_TITLE, 36 | MEMORYINFO_INVALID, 37 | MEMORYINFO_SLOT, 38 | MEMORYINFO_NAME, 39 | MEMORYINFO_FREQ, 40 | MEMORYINFO_BUSWIDTH, 41 | MEMORYINFO_TOTALCAPACITY, 42 | MEMORYINFO_USEDCAPACITY, 43 | MEMORYINFO_SERIALNUM, 44 | MEMORYINFO_MANUFACTURER, 45 | MEMORYINFO_DATAWIDTH, 46 | MEMORYINFO_TYPE, 47 | MEMORYINFO_SPEED, 48 | MEMORYINFO_CONFIGSPEED, 49 | MEMORYINFO_PIPE, 50 | MEMORYINFO_ARRAYHANDLE, 51 | MEMORYINFO_PARTNUMBER, 52 | MEMORYINFO_PHYSICALID 53 | }; 54 | 55 | class MemoryInfo : public KABaseInfoPage 56 | { 57 | Q_OBJECT 58 | public: 59 | explicit MemoryInfo(QWidget *parent = nullptr); 60 | 61 | void initUI(); 62 | 63 | void initConnections(); 64 | void updateInfoItems(QString strInfoJson); 65 | 66 | public slots: 67 | void onUpdateInfo(QString strInfoJson) override; 68 | void onRefreshInfo() override; 69 | 70 | private: 71 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 72 | void clearInfoItems(); 73 | void chkNoDevice(); 74 | 75 | private: 76 | QString m_strInfoJson; 77 | 78 | QVBoxLayout *m_mainLayout = nullptr; 79 | QFrame *m_listFrame = nullptr; 80 | QVBoxLayout *m_listLayout = nullptr; 81 | QScrollArea *m_scrollFrame = nullptr; 82 | 83 | QMap> m_mapInfoItems; 84 | }; 85 | 86 | #endif // MEMORYINFO_H 87 | -------------------------------------------------------------------------------- /plugins/hwparam/monitorinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef MONITORINFO_H 22 | #define MONITORINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "../../src/kajsondef.h" 32 | #include "kainfotitle.h" 33 | #include "kabaseinfopage.h" 34 | 35 | enum MNI_INDEX{ 36 | MONITORINFO_TITLE, 37 | MONITORINFO_INVALID, 38 | MONITORINFO_MANUFACTURER, 39 | MONITORINFO_NAME, 40 | MONITORINFO_SIZE, 41 | MONITORINFO_RATIO, 42 | MONITORINFO_RESOLUTION, 43 | MONITORINFO_MAXAVARES, 44 | MONITORINFO_ISMAIN, 45 | MONITORINFO_GAMMA, 46 | MONITORINFO_INTERFACE, 47 | MONITORINFO_MODEL, 48 | MONITORINFO_VISIBLEAREA, 49 | MONITORINFO_YEAR, 50 | MONITORINFO_WEEK, 51 | }; 52 | 53 | class MonitorInfo : public KABaseInfoPage, public QAbstractNativeEventFilter 54 | { 55 | Q_OBJECT 56 | public: 57 | explicit MonitorInfo(QWidget *parent = nullptr); 58 | 59 | void initUI(); 60 | 61 | void initConnections(); 62 | void updateInfoItems(QString strInfoJson); 63 | 64 | public slots: 65 | void onUpdateInfo(QString strInfoJson) override; 66 | void onRefreshInfo() override; 67 | 68 | protected: 69 | virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; 70 | 71 | private: 72 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 73 | void clearInfoItems(); 74 | void chkNoDevice(); 75 | void RRScreenChangeEvent(); 76 | 77 | private: 78 | QString m_strInfoJson; 79 | 80 | QVBoxLayout *m_mainLayout = nullptr; 81 | QFrame *m_listFrame = nullptr; 82 | QVBoxLayout *m_listLayout = nullptr; 83 | QScrollArea *m_scrollFrame = nullptr; 84 | 85 | QMap> m_mapInfoItems; 86 | int m_xrrEventBase = 0; 87 | int m_xrrErrorBase = 0; 88 | }; 89 | 90 | #endif // MONITORINFO_H 91 | -------------------------------------------------------------------------------- /plugins/hwparam/motherboardinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef MOTHERBOARDINFO_H 22 | #define MOTHERBOARDINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kabaseinfopage.h" 32 | 33 | enum MBI_INDEX{ 34 | MOTHERBOARDINFO_NAME, 35 | MOTHERBOARDINFO_INVALID, 36 | MOTHERBOARDINFO_MANUFACTURER, 37 | MOTHERBOARDINFO_CHIPSET, 38 | MOTHERBOARDINFO_SERIALNUM, 39 | MOTHERBOARDINFO_PUBDATE, 40 | MOTHERBOARDINFO_VERSION, 41 | MOTHERBOARDINFO_BIOSMANUFACTURER, 42 | MOTHERBOARDINFO_BIOSVERSION, 43 | }; 44 | 45 | class MotherBoardInfo : public KABaseInfoPage 46 | { 47 | Q_OBJECT 48 | public: 49 | explicit MotherBoardInfo(QWidget *parent = nullptr); 50 | 51 | void initUI(); 52 | 53 | void initConnections(); 54 | void updateInfoItems(QString strInfoJson); 55 | 56 | public slots: 57 | void onUpdateInfo(QString strInfoJson) override; 58 | void onRefreshInfo() override; 59 | 60 | private: 61 | void addInfoItems(unsigned uId, QString strTitle, QString strContent); 62 | void clearInfoItems(); 63 | void chkNoDevice(); 64 | 65 | private: 66 | QString m_strInfoJson; 67 | 68 | QVBoxLayout *m_mainLayout = nullptr; 69 | QFrame *m_listFrame = nullptr; 70 | QVBoxLayout *m_listLayout = nullptr; 71 | QScrollArea *m_scrollFrame = nullptr; 72 | 73 | QMap m_mapItem; 74 | }; 75 | 76 | #endif // MOTHERBOARDINFO_H 77 | -------------------------------------------------------------------------------- /plugins/hwparam/mouseinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef MOUSEINFO_H 22 | #define MOUSEINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum MSI_INDEX{ 35 | MOUSEINFO_TITLE, 36 | MOUSEINFO_INVALID, 37 | MOUSEINFO_DEVTYPE, 38 | MOUSEINFO_NAME, 39 | MOUSEINFO_DEVMODEL, 40 | MOUSEINFO_MANUFACTURER, 41 | MOUSEINFO_DEVADDR, 42 | MOUSEINFO_INTERFACE, 43 | MOUSEINFO_DRIVER, 44 | }; 45 | 46 | class MouseInfo : public KABaseInfoPage 47 | { 48 | Q_OBJECT 49 | public: 50 | explicit MouseInfo(QWidget *parent = nullptr); 51 | 52 | void initUI(); 53 | 54 | void initConnections(); 55 | void updateInfoItems(QString strInfoJson); 56 | 57 | public slots: 58 | void onUpdateInfo(QString strInfoJson) override; 59 | void onRefreshInfo() override; 60 | 61 | private: 62 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 63 | void clearInfoItems(); 64 | void chkNoDevice(); 65 | 66 | private: 67 | QString m_strInfoJson; 68 | 69 | QVBoxLayout *m_mainLayout = nullptr; 70 | QFrame *m_listFrame = nullptr; 71 | QVBoxLayout *m_listLayout = nullptr; 72 | QScrollArea *m_scrollFrame = nullptr; 73 | 74 | QMap> m_mapInfoItems; 75 | }; 76 | 77 | #endif // MOUSEINFO_H 78 | -------------------------------------------------------------------------------- /plugins/hwparam/netcardinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef NETCARDINFO_H 22 | #define NETCARDINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum NWI_INDEX{ 35 | NETCARDINFO_TITLE, 36 | NETCARDINFO_INVALID, 37 | NETCARDINFO_NAME, 38 | NETCARDINFO_ISWIFI, 39 | NETCARDINFO_MACADDR, 40 | NETCARDINFO_CONNSPEED, 41 | NETCARDINFO_MTU, 42 | NETCARDINFO_IPADDR, 43 | NETCARDINFO_SUBNETMASK, 44 | NETCARDINFO_GATEWAY, 45 | NETCARDINFO_DNSSERVER, 46 | NETCARDINFO_RECVBYTES, 47 | NETCARDINFO_SENDBYTES, 48 | NETCARDINFO_MANUFACTURER, 49 | NETCARDINFO_BUSADDR, 50 | NETCARDINFO_DRIVER, 51 | NETCARDINFO_MODEL, 52 | }; 53 | 54 | class NetCardInfo : public KABaseInfoPage 55 | { 56 | Q_OBJECT 57 | public: 58 | explicit NetCardInfo(QWidget *parent = nullptr); 59 | 60 | void initUI(); 61 | 62 | void initConnections(); 63 | void updateInfoItems(QString strInfoJson); 64 | 65 | public slots: 66 | void onUpdateInfo(QString strInfoJson) override; 67 | void onRefreshInfo() override; 68 | 69 | private: 70 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 71 | void clearInfoItems(); 72 | void chkNoDevice(); 73 | 74 | private: 75 | QString m_strInfoJson; 76 | 77 | QVBoxLayout *m_mainLayout = nullptr; 78 | QFrame *m_listFrame = nullptr; 79 | QVBoxLayout *m_listLayout = nullptr; 80 | QScrollArea *m_scrollFrame = nullptr; 81 | 82 | QMap> m_mapInfoItems; 83 | }; 84 | 85 | #endif // NETCARDINFO_H 86 | -------------------------------------------------------------------------------- /plugins/hwparam/processorinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef PROCESSORINFO_H 22 | #define PROCESSORINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kabaseinfopage.h" 32 | 33 | enum PSI_INDEX{ 34 | PROCESSORINFO_PROCESSOR, 35 | PROCESSORINFO_CORESNUM, 36 | PROCESSORINFO_THREADSNUM, 37 | PROCESSORINFO_SLOT, 38 | PROCESSORINFO_FREQ, 39 | PROCESSORINFO_L1CACHE, 40 | PROCESSORINFO_L1DCACHE, 41 | PROCESSORINFO_L1ICACHE, 42 | PROCESSORINFO_L2CACHE, 43 | PROCESSORINFO_L3CACHE, 44 | PROCESSORINFO_INSTSET, 45 | PROCESSORINFO_EXTINSTSET, 46 | PROCESSORINFO_USED, 47 | PROCESSORINFO_MANUFACTURER, 48 | PROCESSORINFO_ARCH, 49 | PROCESSORINFO_CORESONLINE, 50 | PROCESSORINFO_FREQMAX, 51 | }; 52 | 53 | class ProcessorInfo : public KABaseInfoPage 54 | { 55 | Q_OBJECT 56 | public: 57 | explicit ProcessorInfo(QWidget *parent = nullptr); 58 | 59 | void initUI(); 60 | 61 | void initConnections(); 62 | void updateInfoItems(QString strInfoJson); 63 | 64 | public slots: 65 | void onUpdateInfo(QString strInfoJson) override; 66 | void onRefreshInfo() override; 67 | 68 | private: 69 | void addInfoItems(unsigned uId, QString strTitle, QString strContent); 70 | void clearInfoItems(); 71 | 72 | private: 73 | QString m_strInfoJson; 74 | 75 | QVBoxLayout *m_mainLayout = nullptr; 76 | QFrame *m_listFrame = nullptr; 77 | QVBoxLayout *m_listLayout = nullptr; 78 | QScrollArea *m_scrollFrame = nullptr; 79 | 80 | QMap m_mapItem; 81 | }; 82 | 83 | #endif // PROCESSORINFO_H 84 | -------------------------------------------------------------------------------- /plugins/hwparam/udevhotplugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 ~ 2021 National University of Defense Technology(NUDT) & Kylin Ltd. 3 | * 4 | * Authors: 5 | * Min Yang yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; version 3. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | class UDevHotPlugin : public QThread 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit UDevHotPlugin(QObject * parent = nullptr); 33 | ~UDevHotPlugin(); 34 | void stopDevHotPlugin(); 35 | 36 | signals: 37 | void sendUdevAddNotify(QString strUdevSubName, QString strUdevType); 38 | void sendUdevRemoveNotify(QString strUdevSubName, QString strUdevType); 39 | 40 | protected: 41 | virtual void run() override; 42 | 43 | private: 44 | struct udev* mpUdev; 45 | struct udev_monitor* mpUdevMonitor; 46 | bool mIsStop; 47 | }; -------------------------------------------------------------------------------- /plugins/hwparam/voicecardinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef VOICECARDINFO_H 22 | #define VOICECARDINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/kajsondef.h" 31 | #include "kainfotitle.h" 32 | #include "kabaseinfopage.h" 33 | 34 | enum VCI_INDEX{ 35 | VOICECARDINFO_TITLE, 36 | VOICECARDINFO_INVALID, 37 | VOICECARDINFO_BUSADDR, 38 | VOICECARDINFO_DRIVE, 39 | VOICECARDINFO_MODEL, 40 | VOICECARDINFO_MANUFACTURER, 41 | VOICECARDINFO_NAME, 42 | VOICECARDINFO_CLOCK, 43 | VOICECARDINFO_BITWIDTH, 44 | }; 45 | 46 | class VoiceCardInfo : public KABaseInfoPage 47 | { 48 | Q_OBJECT 49 | public: 50 | explicit VoiceCardInfo(QWidget *parent = nullptr); 51 | 52 | void initUI(); 53 | 54 | void initConnections(); 55 | void updateInfoItems(QString strInfoJson); 56 | 57 | public slots: 58 | void onUpdateInfo(QString strInfoJson) override; 59 | void onRefreshInfo() override; 60 | 61 | private: 62 | void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); 63 | void clearInfoItems(); 64 | void chkNoDevice(); 65 | 66 | private: 67 | QString m_strInfoJson; 68 | 69 | QVBoxLayout *m_mainLayout = nullptr; 70 | QFrame *m_listFrame = nullptr; 71 | QVBoxLayout *m_listLayout = nullptr; 72 | QScrollArea *m_scrollFrame = nullptr; 73 | 74 | QMap> m_mapInfoItems; 75 | }; 76 | 77 | #endif // VOICECARDINFO_H 78 | -------------------------------------------------------------------------------- /plugins/machineinfo/infopage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef INFOPAGE_H 22 | #define INFOPAGE_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "kinfolistitem.h" 32 | #include "../../src/commondef.h" 33 | #include "../../src/kajsondef.h" 34 | 35 | enum MI_INDEX{ 36 | MACHINEINFO_MANUFACTURER, 37 | MACHINEINFO_MACHINEMODEL, 38 | MACHINEINFO_SERIALNUM, 39 | MACHINEINFO_SYSTEMBITS, 40 | MACHINEINFO_KERNELARCH, 41 | MACHINEINFO_HOSTNAME, 42 | MACHINEINFO_OSVERSION, 43 | MACHINEINFO_KERNELVERSION, 44 | MACHINEINFO_PROCESSOR, 45 | MACHINEINFO_MEMORY, 46 | MACHINEINFO_MAINBOARD, 47 | MACHINEINFO_HARDDISK, 48 | MACHINEINFO_GRAPHICSCARD, 49 | MACHINEINFO_MONITOR, 50 | MACHINEINFO_NETWORKCARD, 51 | MACHINEINFO_SOUNDCARD, 52 | }; 53 | 54 | class InfoPage : public QWidget 55 | { 56 | Q_OBJECT 57 | public: 58 | explicit InfoPage(QWidget *parent = nullptr); 59 | 60 | void initUI(); 61 | 62 | void initConnections(); 63 | void updateInfoItems(QString strInfoJson); 64 | 65 | public slots: 66 | void onUpdateInfo(QString strInfoJson); 67 | void onUpdateInfo(unsigned uStatus, QString strInfoJson); 68 | void onRefreshInfo(); 69 | 70 | signals: 71 | void updateInfo(unsigned, QString); 72 | 73 | private: 74 | void addInfoItems(unsigned uId, QString strTitle, QString strIcon, QString strContent); 75 | void clearInfoItems(); 76 | 77 | private: 78 | QString m_strInfoJson; 79 | 80 | QHBoxLayout *m_mainLayout = nullptr; 81 | QFrame *m_listFrame = nullptr; 82 | QVBoxLayout *m_listLayout = nullptr; 83 | QScrollArea *m_scrollFrame = nullptr; 84 | 85 | QMap m_mapItem; 86 | }; 87 | 88 | #endif // INFOPAGE_H 89 | -------------------------------------------------------------------------------- /plugins/machineinfo/machineinfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #include "stdio.h" 22 | #include "machineinfo.h" 23 | #include "../../src/commondef.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | MachineInfo::MachineInfo() 35 | { 36 | m_pluginName = tr("MachineInfo"); 37 | m_pluginType = MACHINE_INFO; 38 | mFirstLoad = true; 39 | } 40 | 41 | MachineInfo::~MachineInfo() 42 | { 43 | 44 | } 45 | 46 | QString MachineInfo::getPluginName() 47 | { 48 | return m_pluginName; 49 | } 50 | 51 | int MachineInfo::getPluginType() 52 | { 53 | return m_pluginType; 54 | } 55 | 56 | QWidget* MachineInfo::getPluginMainWnd() 57 | { 58 | if (mFirstLoad) { 59 | mFirstLoad = false; 60 | initUI(); 61 | initConnections(); 62 | } 63 | return m_pluginWidget; 64 | } 65 | 66 | void MachineInfo::pluginDelayControl() 67 | { 68 | // 首次获取整机信息 69 | if (m_infoPage) 70 | m_infoPage->onRefreshInfo(); 71 | } 72 | 73 | const QString MachineInfo::name() const 74 | { 75 | return QStringLiteral("machineinfo"); 76 | } 77 | 78 | void MachineInfo::updatePluginContent() 79 | { 80 | qInfo()<<""; 81 | } 82 | 83 | void MachineInfo::initUI() 84 | { 85 | m_pluginWidget = new QWidget(); 86 | m_pluginWidget->setFixedSize(RIGHT_PANEL_WIDTH, RIGHT_PANEL_HEIGHT); 87 | m_pluginWidget->setAttribute(Qt::WA_DeleteOnClose); 88 | 89 | m_mainLayout = new QHBoxLayout(); 90 | m_mainLayout->setContentsMargins(0,0,0,0); 91 | m_mainLayout->setSpacing(0); 92 | 93 | m_stackedWidget = new QStackedWidget(); 94 | 95 | m_loadingWidget = new LoadingWidget(); 96 | m_infoPage = new InfoPage(); 97 | m_stackedWidget->addWidget(m_loadingWidget); 98 | m_stackedWidget->addWidget(m_infoPage); 99 | m_mainLayout->addWidget(m_stackedWidget); 100 | 101 | m_pluginWidget->setLayout(m_mainLayout); 102 | } 103 | 104 | void MachineInfo::initConnections() 105 | { 106 | connect(m_infoPage, &InfoPage::updateInfo, this, &MachineInfo::onUpdateInfo); 107 | } 108 | 109 | void MachineInfo::onUpdateInfo(unsigned uStatus, QString strInfoJson) 110 | { 111 | Q_UNUSED(strInfoJson); 112 | qDebug()<<"updateInfo:"<setCurrentIndex(0); 115 | } else { 116 | m_stackedWidget->setCurrentIndex(1); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /plugins/machineinfo/machineinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef MACHINEINFO_H 22 | #define MACHINEINFO_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../../src/interface.h" 31 | #include "loadingwidget.h" 32 | #include "infopage.h" 33 | 34 | class MachineInfo : public QObject, PluginInterface 35 | { 36 | Q_OBJECT 37 | Q_PLUGIN_METADATA(IID PluginInterfaceIID) 38 | Q_INTERFACES(PluginInterface) 39 | 40 | public: 41 | MachineInfo(); 42 | virtual ~MachineInfo(); 43 | 44 | QString getPluginName() Q_DECL_OVERRIDE; 45 | int getPluginType() Q_DECL_OVERRIDE; 46 | QWidget* getPluginMainWnd() Q_DECL_OVERRIDE; 47 | void pluginDelayControl() Q_DECL_OVERRIDE; 48 | const QString name() const Q_DECL_OVERRIDE; 49 | void updatePluginContent() Q_DECL_OVERRIDE; 50 | 51 | void initUI(); 52 | void initConnections(); 53 | 54 | public slots: 55 | void onUpdateInfo(unsigned uStatus, QString strInfoJson); 56 | 57 | private: 58 | QString m_pluginName; 59 | int m_pluginType; 60 | QWidget *m_pluginWidget = nullptr; 61 | bool mFirstLoad; 62 | 63 | LoadingWidget *m_loadingWidget = nullptr; 64 | InfoPage *m_infoPage = nullptr; 65 | QHBoxLayout *m_mainLayout = nullptr; 66 | QStackedWidget *m_stackedWidget = nullptr; 67 | }; 68 | 69 | #endif // MACHINEINFO_H 70 | -------------------------------------------------------------------------------- /plugins/machineinfo/machineinfo.pro: -------------------------------------------------------------------------------- 1 | 2 | QT += widgets dbus x11extras 3 | 4 | TEMPLATE = lib 5 | CONFIG += plugin \ 6 | link_pkgconfig \ 7 | C++11 8 | 9 | include(../../env.pri) 10 | include(../../CommonControl/CommonControl.pri) 11 | include(../../dataworker/dataworker.pri) 12 | 13 | TARGET = $$qtLibraryTarget(machineinfo) 14 | DESTDIR = .. 15 | target.path = $${PLUGIN_INSTALL_DIRS} 16 | INSTALLS += target 17 | 18 | LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt 19 | 20 | PKGCONFIG += gsettings-qt 21 | 22 | SOURCES += \ 23 | infopage.cpp \ 24 | machineinfo.cpp 25 | 26 | HEADERS += \ 27 | infopage.h \ 28 | machineinfo.h 29 | -------------------------------------------------------------------------------- /plugins/plugins.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = \ 3 | drivemanage \ 4 | hwmonitor \ 5 | hwparam \ 6 | machineinfo 7 | -------------------------------------------------------------------------------- /src/aboutwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef ABOUTWIDGET_H 22 | #define ABOUTWIDGET_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | class AboutWidget : public QDialog 39 | { 40 | Q_OBJECT 41 | public: 42 | explicit AboutWidget(QWidget *parent = nullptr); 43 | ~AboutWidget(); 44 | 45 | void initUI(); 46 | void setAppIcon(const QString &text); 47 | void setAppName(const QString &text); 48 | void setAppVersion(const QString &text); 49 | void setAppDescription(const QString &text); 50 | protected: 51 | // void closeEvent(QCloseEvent *event); 52 | void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; 53 | 54 | private: 55 | void initThemeMode(); 56 | 57 | private: 58 | QVBoxLayout *main_layout = nullptr; 59 | 60 | QLabel *title_icon = nullptr; 61 | QLabel *title_name = nullptr; 62 | QPushButton *close_btn = nullptr; 63 | 64 | QLabel *app_icon = nullptr; 65 | QLabel *app_name = nullptr; 66 | QLabel *app_version = nullptr; 67 | QTextBrowser *app_description = nullptr; 68 | 69 | QGSettings *qtSettings = nullptr; 70 | }; 71 | 72 | #endif // ABOUTWIDGET_H 73 | -------------------------------------------------------------------------------- /src/commondef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | #ifndef COMMONDEF_H 21 | #define COMMONDEF_H 22 | 23 | #define MAIN_WINDOW_WIDTH 930 24 | #define MAIN_WINDOW_HEIGHT 550 25 | 26 | #define LEFT_WIDGET_WIDTH 200 27 | #define LEFT_WIDGET_HEIGHT 550 28 | #define LEFT_BUTTON_WIDTH 180 29 | #define LEFT_BUTTON_HEITHT 36 30 | 31 | #define RIGHT_WIDGET_WIDTH 730 32 | #define RIGHT_WIDGET_HEIGHT 550 33 | 34 | #define RIGHT_PANEL_WIDTH 730 35 | #define RIGHT_PANEL_HEIGHT 510 36 | 37 | /* 38 | * QT主题 39 | */ 40 | #define THEME_QT_SCHEMA "org.ukui.style" 41 | #define MODE_QT_KEY "style-name" 42 | #define FONT_SIZE "system-font-size" 43 | #define THEME_QT_TRANS "org.ukui.control-center.personalise" 44 | 45 | /* QT图标主题 */ 46 | #define ICON_QT_KEY "icon-theme-name" 47 | 48 | // 颜色 49 | #define COLOR_ALTERNATEBASE_LIGHT "#F4F5F5" 50 | #define COLOR_ALTERNATEBASE_DARK "#2E2E30" 51 | 52 | #define KYLIN_USER_GUIDE_PATH "/" 53 | #define KYLIN_USER_GUIDE_SERVICE "com.kylinUserGuide.hotel" 54 | #define KYLIN_USER_GUIDE_INTERFACE "com.guide.hotel" 55 | 56 | #endif // COMMONDEF_H 57 | -------------------------------------------------------------------------------- /src/imageutil.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 2 | * 3 | * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 18 | * 19 | */ 20 | 21 | #include "imageutil.h" 22 | 23 | #include 24 | 25 | const QPixmap ImageUtil::loadSvg(const QString &path, const QString color, int size) 26 | { 27 | int origSize = size; 28 | const auto ratio = qApp->devicePixelRatio(); 29 | if ( 2 == ratio) { 30 | size += origSize; 31 | } else if (3 == ratio) { 32 | size += origSize; 33 | } 34 | QPixmap pixmap(size, size); 35 | QSvgRenderer renderer(path); 36 | pixmap.fill(Qt::transparent); 37 | 38 | QPainter painter; 39 | painter.begin(&pixmap); 40 | renderer.render(&painter); 41 | painter.end(); 42 | 43 | pixmap.setDevicePixelRatio(ratio); 44 | return drawSymbolicColoredPixmap(pixmap, color); 45 | } 46 | 47 | QPixmap ImageUtil::drawSymbolicColoredPixmap(const QPixmap &source, QString cgColor) 48 | { 49 | QImage img = source.toImage(); 50 | for (int x = 0; x < img.width(); x++) { 51 | for (int y = 0; y < img.height(); y++) { 52 | auto color = img.pixelColor(x, y); 53 | if (color.alpha() > 0) { 54 | if ( "white" == cgColor) { 55 | color.setRed(255); 56 | color.setGreen(255); 57 | color.setBlue(255); 58 | img.setPixelColor(x, y, color); 59 | } else if( "black" == cgColor) { 60 | color.setRed(0); 61 | color.setGreen(0); 62 | color.setBlue(0); 63 | img.setPixelColor(x, y, color); 64 | } else if ("gray"== cgColor) { 65 | color.setRed(152); 66 | color.setGreen(163); 67 | color.setBlue(164); 68 | img.setPixelColor(x, y, color); 69 | } else if ("blue" == cgColor){ 70 | color.setRed(61); 71 | color.setGreen(107); 72 | color.setBlue(229); 73 | img.setPixelColor(x, y, color); 74 | } else { 75 | return source; 76 | } 77 | } 78 | } 79 | } 80 | return QPixmap::fromImage(img); 81 | } 82 | -------------------------------------------------------------------------------- /src/imageutil.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 2 | * 3 | * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 18 | * 19 | */ 20 | 21 | #ifndef IMAGEUTIL_H 22 | #define IMAGEUTIL_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class ImageUtil 29 | { 30 | public: 31 | static const QPixmap loadSvg(const QString &path, const QString color, int size = 16); 32 | static QPixmap drawSymbolicColoredPixmap(const QPixmap &source, QString cgColor); 33 | }; 34 | 35 | #endif // IMAGEUTIL_H 36 | -------------------------------------------------------------------------------- /src/img_res/Bluetooth.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/蓝牙-蓝 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/img_res/Machine-model.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/整机型号 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/img_res/SN.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/SN 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/img_res/drivemanager.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/sidebar-qdgl-b 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/img_res/graphics-card.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/显卡-蓝 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/img_res/hard-disk.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/硬盘 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/img_res/hardwaremonitor.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/sidebar-yjjc-b 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/img_res/hardwareparam.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/sidebar-yjcs-b 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/img_res/host.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/主机 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/img_res/icon-cpu.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon-CPU 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/img_res/iso.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/iso 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/img_res/kernel-architecture.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/内核架构 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/img_res/kernel-version.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/内核版本 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/img_res/machineinfo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/sidebar-localinformation-b 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/img_res/manufacturer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/制造商 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/img_res/memory.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/内存 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/img_res/monitor.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/其他-蓝 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/img_res/mother-board.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/主板-蓝 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/img_res/network-card.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/网卡 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/img_res/osversion.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/neicun 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/img_res/processor.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/处理器 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/img_res/soundcard.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/声卡-蓝 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/img_res/system-bits.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/系统位数 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/img_res/ukui-occupation-map@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/src/img_res/ukui-occupation-map@2x.png -------------------------------------------------------------------------------- /src/img_res/wired.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/有线-蓝 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/img_res/wireless.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon/无线-蓝 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef INTERFACE_H 22 | #define INTERFACE_H 23 | 24 | class QString; 25 | class QWidget; 26 | class QStringLiteral; 27 | 28 | enum FunType{ 29 | MACHINE_INFO, 30 | HARDWARE_PARAMETERS, 31 | HARDWARE_MONITOR, 32 | DRIVER_MANAGER, 33 | FUNCTYPE_MAX 34 | }; 35 | 36 | class PluginInterface{ 37 | public: 38 | virtual ~PluginInterface(){} 39 | 40 | /** 41 | * \brief getPluginName 42 | * get plugin's name 43 | */ 44 | virtual QString getPluginName() = 0; 45 | 46 | /** 47 | * \brief getPluginType 48 | * get plugin's type 49 | */ 50 | virtual int getPluginType() = 0; 51 | 52 | /** 53 | * \brief getPluginMainWnd 54 | * get plugin's main window 55 | */ 56 | virtual QWidget* getPluginMainWnd() = 0; 57 | 58 | /** 59 | * \brief pluginDelayControl 60 | * do plugin's delay things 61 | */ 62 | virtual void pluginDelayControl() = 0; 63 | 64 | /** 65 | * \brief name 66 | * module name (用于搜索?) 67 | */ 68 | virtual const QString name() const = 0; 69 | 70 | /** 71 | * \brief updatePluginContent 72 | * update plugin's content 73 | */ 74 | virtual void updatePluginContent() {}; 75 | }; 76 | 77 | #define PluginInterfaceIID "org.kyya.PluginInterface" 78 | 79 | Q_DECLARE_INTERFACE(PluginInterface, PluginInterfaceIID) 80 | 81 | #endif // INTERFACE_H 82 | -------------------------------------------------------------------------------- /src/kaaboutdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KAABOUTDIALOG_H 22 | #define KAABOUTDIALOG_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class KAAboutDialog : public QDialog 32 | { 33 | Q_OBJECT 34 | public: 35 | explicit KAAboutDialog(QWidget *parent = nullptr); 36 | virtual ~KAAboutDialog(); 37 | 38 | protected: 39 | void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; 40 | 41 | private: 42 | bool initWidgets(); 43 | bool initTitleWidget(); 44 | bool initContentWidget(); 45 | bool initSupportWidget(); 46 | bool initConnections(); 47 | 48 | void initThemeStyle(); 49 | void setFontSize(QLabel *label,int fontSize); 50 | void setFontSize(QTextEdit *txtEdit,int fontSize); 51 | void setFontSize(QPushButton *btn,int fontSize); 52 | void onThemeFontChange(float fFontSize); 53 | 54 | private: 55 | QLabel *m_labelTitleIcon = nullptr; 56 | QLabel *m_labelTitleText = nullptr; 57 | QPushButton *m_btnClose = nullptr; 58 | QLabel *m_labelLogoIcon = nullptr; 59 | QLabel *m_labelAppName = nullptr; 60 | QLabel *m_labelVersion = nullptr; 61 | QLabel *m_labelIntroduce = nullptr; 62 | QLabel *m_labelSupport = nullptr; 63 | QPushButton *m_btnSupportUrl = nullptr; 64 | 65 | QHBoxLayout *m_logoIconLayout = nullptr; 66 | QHBoxLayout *m_appNameLayout = nullptr; 67 | QHBoxLayout *m_versionLayout = nullptr; 68 | QHBoxLayout *m_introduceLayout = nullptr; 69 | QHBoxLayout *m_supportLayout = nullptr; 70 | QHBoxLayout *m_titleLayout = nullptr; 71 | QVBoxLayout *m_mainVLayout = nullptr; 72 | 73 | QGSettings *m_styleSettings = nullptr; 74 | float m_fFontSize; 75 | }; 76 | 77 | #endif // KAABOUTDIALOG_H 78 | -------------------------------------------------------------------------------- /src/kleftsideitem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef KLEFTSIDEITEM_H 22 | #define KLEFTSIDEITEM_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | class KLeftSideItem : public QPushButton 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit KLeftSideItem(QWidget *parent = nullptr); 34 | KLeftSideItem(QString strText, QString strIcon, QWidget *parent = nullptr); 35 | virtual ~KLeftSideItem(); 36 | 37 | void initUI(); 38 | void setText(const QString &strText); 39 | void setIcon(QString &strIcon); 40 | 41 | private: 42 | void initStyleTheme(); 43 | 44 | private: 45 | QHBoxLayout *m_layoutMain = nullptr; 46 | QLabel *m_labelIcon = nullptr; 47 | QLabel *m_labelText = nullptr; 48 | 49 | QString m_strIcon; 50 | QString m_strText; 51 | QGSettings *m_styleSettings = nullptr; 52 | }; 53 | 54 | #endif // KLEFTSIDEITEM_H 55 | -------------------------------------------------------------------------------- /src/kleftwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | #ifndef KLEFTWIDGET_H 21 | #define KLEFTWIDGET_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "kleftsideitem.h" 34 | 35 | class KLeftWidget : public QWidget 36 | { 37 | Q_OBJECT 38 | public: 39 | explicit KLeftWidget(QWidget *parent = nullptr); 40 | virtual ~KLeftWidget(); 41 | 42 | void initUI(); 43 | void initConnections(); 44 | int addItems(QString strText, QString strTip, QString strIcon); 45 | int currentIndex(); 46 | 47 | public slots: 48 | void onSwichPanel(int nIndex); 49 | 50 | signals: 51 | void switchPage(int nIndex); 52 | 53 | private: 54 | void initThemeMode(); 55 | 56 | private: 57 | QButtonGroup *m_buttonGroup = nullptr; 58 | QLabel *m_labelTitle = nullptr; 59 | QLabel *m_labelTitleIcon = nullptr; 60 | 61 | QVBoxLayout *m_mainLayout = nullptr; 62 | QHBoxLayout *m_titleLayout = nullptr; 63 | QVBoxLayout *m_itemsLayout = nullptr; 64 | QSpacerItem *m_verticalSpacer = nullptr; 65 | 66 | QGSettings *qtSettings = nullptr; 67 | }; 68 | 69 | #endif // KLEFTWIDGET_H 70 | -------------------------------------------------------------------------------- /src/krightwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | #ifndef KRIGHTWIDGET_H 21 | #define KRIGHTWIDGET_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "kaaboutdialog.h" 31 | 32 | class KRightWidget : public QWidget 33 | { 34 | Q_OBJECT 35 | public: 36 | explicit KRightWidget(QWidget *parent = nullptr); 37 | 38 | void initUI(); 39 | void initConnections(); 40 | void createAboutDialog(); 41 | 42 | void addPanel(QWidget* pWidget, QString strName, QString strIcon); 43 | int currentIndex(); 44 | 45 | public slots: 46 | void onMinBtnClicked(); 47 | void onMaxBtnClicked(); 48 | void onCloseBtnClicked(); 49 | void onSwichPanel(int nIndex); 50 | 51 | signals: 52 | void maximizeWindow(); 53 | void minimizeWindow(); 54 | 55 | protected: 56 | void paintEvent(QPaintEvent *) override; 57 | 58 | private: 59 | QToolButton *m_btnOption = nullptr; 60 | QToolButton *m_btnMin = nullptr; 61 | QToolButton *m_btnClose = nullptr; 62 | QMenu *m_mainMenu = nullptr; 63 | QStackedWidget *m_stackedWidget = nullptr; 64 | 65 | KAAboutDialog *m_aboutDlg = nullptr; 66 | 67 | QVBoxLayout *m_mainLayout = nullptr; 68 | QHBoxLayout *m_titleLayout = nullptr; 69 | }; 70 | 71 | #endif // KRIGHTWIDGET_H 72 | -------------------------------------------------------------------------------- /src/mainwindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 KylinSoft Co., Ltd. 3 | * 4 | * Authors: 5 | * Yang Min yangmin@kylinos.cn 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef MAINWINDOW_H 22 | #define MAINWINDOW_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "kleftwidget.h" 35 | #include "krightwidget.h" 36 | 37 | class MainWindow : public QFrame 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | MainWindow(QWidget *parent = nullptr); 43 | ~MainWindow(); 44 | 45 | void initUI(); 46 | void initOpacityGSettings(); 47 | void initConnections(); 48 | 49 | void initLeftSideBar(); 50 | void initRightPanel(); 51 | 52 | public slots: 53 | void handleMessage(const QString &); 54 | void onSwitchPage(int nIndex); 55 | void onMinimizeWindow(); 56 | void onMaximizeWindow(); 57 | void switchPage(int nIndex); 58 | 59 | protected: 60 | void loadPlugins(); 61 | void paintEvent(QPaintEvent *) override; 62 | void keyPressEvent(QKeyEvent *event); 63 | void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; 64 | void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; 65 | void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; 66 | 67 | private: 68 | int panelIndex2ListIndex(int nPanelIndex); 69 | 70 | private: 71 | KLeftWidget *m_leftWidget = nullptr; 72 | KRightWidget *m_rightWidget = nullptr; 73 | QPoint dragPosition; 74 | bool mousePressed = false; 75 | 76 | // layout 77 | QHBoxLayout *m_mainLayout = nullptr; 78 | 79 | // QGSettings 80 | QGSettings *m_gsTransOpacity = nullptr; 81 | qreal m_curTransOpacity = 1; 82 | 83 | // plugins 84 | QDir m_pluginsDir; 85 | QList m_pluginsList; 86 | }; 87 | #endif // MAINWINDOW_H 88 | -------------------------------------------------------------------------------- /src/qtsingleapplication/QtLockedFile: -------------------------------------------------------------------------------- 1 | #include "qtlockedfile.h" 2 | -------------------------------------------------------------------------------- /src/qtsingleapplication/QtSingleApplication: -------------------------------------------------------------------------------- 1 | #include "qtsingleapplication.h" 2 | -------------------------------------------------------------------------------- /src/qtsingleapplication/qtlocalpeer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the Qt Solutions component. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef QTLOCALPEER_H 42 | #define QTLOCALPEER_H 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | #include "qtlockedfile.h" 49 | 50 | class QtLocalPeer : public QObject 51 | { 52 | Q_OBJECT 53 | 54 | public: 55 | QtLocalPeer(QObject *parent = 0, const QString &appId = QString()); 56 | bool isClient(); 57 | bool sendMessage(const QString &message, int timeout); 58 | QString applicationId() const 59 | { return id; } 60 | 61 | Q_SIGNALS: 62 | void messageReceived(const QString &message); 63 | 64 | protected Q_SLOTS: 65 | void receiveConnection(); 66 | 67 | protected: 68 | QString id; 69 | QString socketName; 70 | QLocalServer* server; 71 | QtLP_Private::QtLockedFile lockFile; 72 | 73 | private: 74 | static const char* ack; 75 | }; 76 | 77 | #endif // QTLOCALPEER_H 78 | -------------------------------------------------------------------------------- /src/qtsingleapplication/qtsingleapplication.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | DEPENDPATH += $$PWD 3 | QT *= network 4 | greaterThan(QT_MAJOR_VERSION, 4): QT *= widgets 5 | 6 | qtsingleapplication-uselib:!qtsingleapplication-buildlib { 7 | LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME 8 | } else { 9 | SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp 10 | HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h 11 | } 12 | 13 | win32 { 14 | contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT 15 | else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT 16 | } 17 | -------------------------------------------------------------------------------- /src/qtsingleapplication/qtsinglecoreapplication.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the Qt Solutions component. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef QTSINGLECOREAPPLICATION_H 42 | #define QTSINGLECOREAPPLICATION_H 43 | 44 | #include 45 | 46 | class QtLocalPeer; 47 | 48 | class QtSingleCoreApplication : public QCoreApplication 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | QtSingleCoreApplication(int &argc, char **argv); 54 | QtSingleCoreApplication(const QString &id, int &argc, char **argv); 55 | 56 | bool isRunning(); 57 | QString id() const; 58 | 59 | public Q_SLOTS: 60 | bool sendMessage(const QString &message, int timeout = 5000); 61 | 62 | 63 | Q_SIGNALS: 64 | void messageReceived(const QString &message); 65 | 66 | 67 | private: 68 | QtLocalPeer* peer; 69 | }; 70 | 71 | #endif // QTSINGLECOREAPPLICATION_H 72 | -------------------------------------------------------------------------------- /src/qtsingleapplication/qtsinglecoreapplication.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | DEPENDPATH += $$PWD 3 | HEADERS += $$PWD/qtsinglecoreapplication.h $$PWD/qtlocalpeer.h 4 | SOURCES += $$PWD/qtsinglecoreapplication.cpp $$PWD/qtlocalpeer.cpp 5 | 6 | QT *= network 7 | 8 | win32:contains(TEMPLATE, lib):contains(CONFIG, shared) { 9 | DEFINES += QT_QTSINGLECOREAPPLICATION_EXPORT=__declspec(dllexport) 10 | } 11 | -------------------------------------------------------------------------------- /src/res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | translation/kylin-assistant_de.qm 4 | translation/kylin-assistant_es.qm 5 | translation/kylin-assistant_fr.qm 6 | translation/kylin-assistant_ru.qm 7 | translation/kylin-assistant_zh_CN.qm 8 | 9 | 10 | img_res/Bluetooth.svg 11 | img_res/graphics-card.svg 12 | img_res/hard-disk.svg 13 | img_res/host.svg 14 | img_res/icon-cpu.svg 15 | img_res/iso.svg 16 | img_res/kernel-architecture.svg 17 | img_res/kernel-version.svg 18 | img_res/Machine-model.svg 19 | img_res/manufacturer.svg 20 | img_res/memory.svg 21 | img_res/mother-board.svg 22 | img_res/osversion.svg 23 | img_res/network-card.svg 24 | img_res/monitor.svg 25 | img_res/processor.svg 26 | img_res/SN.svg 27 | img_res/soundcard.svg 28 | img_res/system-bits.svg 29 | img_res/ukui-occupation-map.svg 30 | img_res/drivemanager.svg 31 | img_res/hardwareparam.svg 32 | img_res/hardwaremonitor.svg 33 | img_res/wired.svg 34 | img_res/wireless.svg 35 | img_res/machineinfo.svg 36 | img_res/ukui-occupation-map@2x.png 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/src.pro: -------------------------------------------------------------------------------- 1 | TARGET = kylin-assistant 2 | DESTDIR = ../ 3 | TEMPLATE = app 4 | CONFIG += c++11 5 | #CONFIG += qt warn_on 6 | #CONFIG += release 7 | CONFIG += link_pkgconfig 8 | PKGCONFIG += glib-2.0 gio-unix-2.0 gsettings-qt 9 | QT += core dbus network charts svg KWindowSystem x11extras 10 | 11 | LIBS += -lukui-log4qt 12 | LIBS +=-lX11 13 | LIBS +=-lXrandr 14 | LIBS +=-ludev 15 | 16 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 17 | 18 | isEqual(QT_MAJOR_VERSION, 5) { 19 | QT += widgets gui 20 | } 21 | 22 | # The following define makes your compiler emit warnings if you use 23 | # any Qt feature that has been marked deprecated (the exact warnings 24 | # depend on your compiler). Please consult the documentation of the 25 | # deprecated API in order to know how to port your code away from it. 26 | DEFINES += QT_DEPRECATED_WARNINGS 27 | 28 | # You can also make your code fail to compile if it uses deprecated APIs. 29 | # In order to do so, uncomment the following line. 30 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 31 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 32 | 33 | unix { 34 | UI_DIR = .ui 35 | MOC_DIR = .moc 36 | OBJECTS_DIR = .obj 37 | } 38 | 39 | include(./qtsingleapplication/qtsingleapplication.pri) 40 | include(../env.pri) 41 | include(../dataworker/dataworker.pri) 42 | include(../commonfunc/commonfunc.pri) 43 | 44 | DEFINES += PLUGIN_INSTALL_DIRS='\\"$${PLUGIN_INSTALL_DIRS}\\"' 45 | 46 | SOURCES += \ 47 | kleftsideitem.cpp \ 48 | krightwidget.cpp \ 49 | kleftwidget.cpp \ 50 | main.cpp \ 51 | imageutil.cpp \ 52 | mainwindow.cpp \ 53 | xatom-helper.cpp \ 54 | kaaboutdialog.cpp 55 | 56 | HEADERS += \ 57 | commondef.h \ 58 | imageutil.h \ 59 | interface.h \ 60 | kajsondef.h \ 61 | kleftsideitem.h \ 62 | krightwidget.h \ 63 | kleftwidget.h \ 64 | mainwindow.h \ 65 | xatom-helper.h \ 66 | kaaboutdialog.h 67 | 68 | RESOURCES += \ 69 | res.qrc 70 | 71 | desktop.files += ../kylin-assistant.desktop 72 | desktop.path = /usr/share/applications 73 | 74 | target.source += $$TARGET 75 | target.path = /usr/bin 76 | 77 | INSTALLS += \ 78 | target \ 79 | desktop 80 | -------------------------------------------------------------------------------- /src/translation/kylin-assistant_bo.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/src/translation/kylin-assistant_bo.qm -------------------------------------------------------------------------------- /src/translation/kylin-assistant_de.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/src/translation/kylin-assistant_de.qm -------------------------------------------------------------------------------- /src/translation/kylin-assistant_es.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/src/translation/kylin-assistant_es.qm -------------------------------------------------------------------------------- /src/translation/kylin-assistant_fr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/src/translation/kylin-assistant_fr.qm -------------------------------------------------------------------------------- /src/translation/kylin-assistant_ru.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/src/translation/kylin-assistant_ru.qm -------------------------------------------------------------------------------- /src/translation/kylin-assistant_zh_CN.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UbuntuKylin/youker-assistant/812cc8949f466090526f0407d232f4ebb19054db/src/translation/kylin-assistant_zh_CN.qm --------------------------------------------------------------------------------