diff --git a/CommonControl/CommonControl.pri b/CommonControl/CommonControl.pri index 45c6b51..83864d7 100644 --- a/CommonControl/CommonControl.pri +++ b/CommonControl/CommonControl.pri @@ -11,7 +11,11 @@ HEADERS += \ $$PWD/katabbutton.h \ $$PWD/kdriveinfoitem.h \ $$PWD/kinfolistitem.h \ - $$PWD/loadingwidget.h + $$PWD/loadingwidget.h \ + $$PWD/../src/imageutil.h \ + $$PWD/../src/util.h \ + $$PWD/../src/loadwidget.h \ + SOURCES += \ $$PWD/kabuttonproxystyle.cpp \ $$PWD/kagroupbutton.cpp \ @@ -22,4 +26,7 @@ SOURCES += \ $$PWD/katabbutton.cpp \ $$PWD/kdriveinfoitem.cpp \ $$PWD/kinfolistitem.cpp \ - $$PWD/loadingwidget.cpp + $$PWD/loadingwidget.cpp \ + $$PWD/../src/imageutil.cpp \ + $$PWD/../src/util.cpp \ + $$PWD/../src/loadwidget.cpp diff --git a/CommonControl/kainfotitle.cpp b/CommonControl/kainfotitle.cpp index 4d07b14..2f3ad3d 100644 --- a/CommonControl/kainfotitle.cpp +++ b/CommonControl/kainfotitle.cpp @@ -49,6 +49,7 @@ void KAInfoTitle::setText(QString strTitle) { m_strTitle = strTitle; m_labelTitle->setText(m_strTitle); + m_labelTitle->setWordWrap(true); } void KAInfoTitle::paintEvent(QPaintEvent *event) @@ -95,7 +96,9 @@ void KAInfoTitle::paintEvent(QPaintEvent *event) QPainterPath path1; path1.addRect(rectBlue); path1.setFillRule(Qt::WindingFill); - painter.setBrush(QColor("#3790FA")); + QPalette pal = this->palette(); + QColor highlight = pal.color(QPalette::Active, QPalette::Highlight); + painter.setBrush(highlight); painter.setPen(Qt::transparent); painter.drawPath(path1); diff --git a/CommonControl/kdriveinfoitem.cpp b/CommonControl/kdriveinfoitem.cpp index e87760b..25569ba 100644 --- a/CommonControl/kdriveinfoitem.cpp +++ b/CommonControl/kdriveinfoitem.cpp @@ -39,6 +39,7 @@ #include #include "../../src/commondef.h" +#include "../src/imageutil.h" KDriveInfoItem::KDriveInfoItem(QString strTitle, QString strIcon, QString strDriveName, QString strDriveVer, bool isOdd, QWidget *parent) : QFrame(parent) @@ -97,23 +98,17 @@ void KDriveInfoItem::initUI() m_mainLayout->addSpacing(22); - if (!m_strIcon.isEmpty()) { - m_labelIcon = new QLabel(); - QIcon icon; - if (m_strIcon.contains("/")) { - QFileInfo fileInfo(m_strIcon); - if (fileInfo.exists()) { - icon = QIcon(m_strIcon); - } - } else { - icon = QIcon::fromTheme(m_strIcon); - } - m_labelIcon->setPixmap(icon.pixmap(16,16)); - m_mainLayout->addWidget(m_labelIcon, 0, Qt::AlignHCenter); - m_mainLayout->addSpacing(12); - } + m_labelIcon = new QLabel(); + m_mainLayout->addWidget(m_labelIcon, 0, Qt::AlignHCenter); + m_mainLayout->addSpacing(12); + + m_labelTitle = new QLabel(); - m_labelTitle->setText(m_strTitle); + QFontMetrics fontWidth(m_labelTitle->font()); + QString ShowValue = fontWidth.elidedText(m_strTitle, Qt::ElideRight, 150); + m_labelTitle->setText(ShowValue); + m_labelTitle->setToolTip(m_strTitle); + m_labelTitle->setFixedWidth(150); m_mainLayout->addWidget(m_labelTitle, 2, Qt::AlignLeft); m_labelDriveName = new QLabel(); m_labelDriveName->setText(m_strDriveName); @@ -130,12 +125,42 @@ void KDriveInfoItem::initUI() m_mainLayout->addStretch(); m_rkeyMenu = new QMenu(this); - QAction *copyAction = new QAction(QIcon::fromTheme("edit-copy-symbolic"), tr("Copy"), this); - connect(copyAction, &QAction::triggered, this, &KDriveInfoItem::onCopyContent); - m_rkeyMenu->addAction(copyAction); + // QAction *copyAction = new QAction(QIcon::fromTheme("edit-copy-symbolic"), tr("Copy"), this); +// connect(copyAction, &QAction::triggered, this, &KDriveInfoItem::onCopyContent); + // m_rkeyMenu->addAction(copyAction); this->setLayout(m_mainLayout); initStyleTheme(); + setIcon(m_strIcon); +} + +void KDriveInfoItem::setIcon(QString &m_strIcon) +{ + QPixmap pixmap; + if (!m_strIcon.isEmpty()) { + + QIcon icon; + if (m_strIcon.contains("/")) { + QFileInfo fileInfo(m_strIcon); + if (fileInfo.exists()) { + icon = QIcon(m_strIcon); + } + } else { + icon = QIcon::fromTheme(m_strIcon); + if (m_strThemeName == "ukui-dark" || m_strThemeName == "ukui-black") { + pixmap = ImageUtil::drawSymbolicColoredPixmap(icon.pixmap(16,16),"white"); + } else { // "ukui-default" "ukui-white" "ukui-light" "ukui" + pixmap = ImageUtil::drawSymbolicColoredPixmap(icon.pixmap(16,16),"black"); + } + } + + } + if (!pixmap.isNull()) { + m_labelIcon->setPixmap(pixmap); + m_labelIcon->show(); + } else { + m_labelIcon->hide(); + } } void KDriveInfoItem::initStyleTheme() @@ -155,6 +180,8 @@ void KDriveInfoItem::initStyleTheme() } else { m_alternateBase = QColor(COLOR_ALTERNATEBASE_LIGHT); } + m_strThemeName = styleName; + setIcon(m_strIcon); repaint(); } } @@ -167,6 +194,7 @@ void KDriveInfoItem::initStyleTheme() } else { m_alternateBase = QColor(COLOR_ALTERNATEBASE_LIGHT); } + m_strThemeName = styleName; } } } diff --git a/CommonControl/kdriveinfoitem.h b/CommonControl/kdriveinfoitem.h index 66b0119..d081401 100644 --- a/CommonControl/kdriveinfoitem.h +++ b/CommonControl/kdriveinfoitem.h @@ -49,6 +49,7 @@ protected: private: void initStyleTheme(); + void setIcon(QString &m_strIcon); private: QHBoxLayout *m_mainLayout = nullptr; @@ -63,6 +64,7 @@ private: QString m_strIcon; QString m_strDriveName; QString m_strDriveVersion; + QString m_strThemeName = ""; bool m_isOdd = false; QGSettings *m_styleSettings = nullptr; diff --git a/CommonControl/kinfolistitem.cpp b/CommonControl/kinfolistitem.cpp index b47447a..8bbd69e 100644 --- a/CommonControl/kinfolistitem.cpp +++ b/CommonControl/kinfolistitem.cpp @@ -38,6 +38,7 @@ #include #include +#include "../src/imageutil.h" #include "../../src/commondef.h" KInfoListItem::KInfoListItem(QString strTitle, QString strIcon, QString strDetail, bool isOdd, QWidget *parent) @@ -91,20 +92,13 @@ void KInfoListItem::initUI() m_mainLayout->addSpacing(22); + initStyleTheme(); + if (!m_strIcon.isEmpty()) { m_labelIcon = new QLabel(); - QIcon icon; - if (m_strIcon.contains("/")) { - QFileInfo fileInfo(m_strIcon); - if (fileInfo.exists()) { - icon = QIcon(m_strIcon); - } - } else { - icon = QIcon::fromTheme(m_strIcon); - } - m_labelIcon->setPixmap(icon.pixmap(16,16)); m_mainLayout->addWidget(m_labelIcon, 0, Qt::AlignHCenter); m_mainLayout->addSpacing(12); + setIcon(m_strIcon); } m_labelTitle = new KALabel(); m_labelTitle->setText(m_strTitle); @@ -114,16 +108,26 @@ void KInfoListItem::initUI() m_labelDetail->setText(m_strDetail); m_labelDetail->setFixedWidth(460); //m_labelDetail->setWordWrap(true); + m_mainLayout->addWidget(m_labelDetail, 0, Qt::AlignLeft); + if (m_strTitle == "") { + m_labelTitle->setFixedWidth(0); + m_labelDetail->setAlignment(Qt::AlignCenter); + m_mainLayout->insertStretch(0); + m_mainLayout->setAlignment(m_labelDetail, Qt::AlignCenter); + m_mainLayout->addSpacing(22); + m_mainLayout->setSpacing(0); + + } m_mainLayout->addStretch(); - m_rkeyMenu = new QMenu(this); - QAction *copyAction = new QAction(QIcon::fromTheme("edit-copy-symbolic"), tr("Copy"), this); - connect(copyAction, &QAction::triggered, this, &KInfoListItem::onCopyContent); - m_rkeyMenu->addAction(copyAction); + m_rkeyMenu = new QMenu(this); +// QAction *copyAction = new QAction(QIcon::fromTheme("edit-copy-symbolic"), tr("Copy"), this); +// connect(copyAction, &QAction::triggered, this, &KInfoListItem::onCopyContent); +// m_rkeyMenu->addAction(copyAction); this->setLayout(m_mainLayout); - initStyleTheme(); + // initStyleTheme(); } void KInfoListItem::initStyleTheme() @@ -143,6 +147,10 @@ void KInfoListItem::initStyleTheme() } else { m_alternateBase = QColor(COLOR_ALTERNATEBASE_LIGHT); } + m_strThemeName = styleName; + if (!m_strIcon.isEmpty()) { + setIcon(m_strIcon); + } repaint(); } } @@ -155,6 +163,7 @@ void KInfoListItem::initStyleTheme() } else { m_alternateBase = QColor(COLOR_ALTERNATEBASE_LIGHT); } + m_strThemeName = styleName; } } } @@ -173,8 +182,44 @@ void KInfoListItem::mousePressEvent(QMouseEvent *event) QFrame::mousePressEvent(event); } +// 复制单行 +// void KInfoListItem::onCopyContent() +// { +// QClipboard *clipboard = QApplication::clipboard(); +// clipboard->setText(m_strTitle+":"+m_strDetail); +// } + void KInfoListItem::onCopyContent() { QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(m_strTitle+":"+m_strDetail); } + +void KInfoListItem::setIcon(QString &m_strIcon) +{ + QPixmap pixmap; + if (!m_strIcon.isEmpty()) { + + QIcon icon; + if (m_strIcon.contains("/")) { + QFileInfo fileInfo(m_strIcon); + if (fileInfo.exists()) { + icon = QIcon(m_strIcon); + } + } else { + icon = QIcon::fromTheme(m_strIcon); + if (m_strThemeName == "ukui-dark" || m_strThemeName == "ukui-black") { + pixmap = ImageUtil::drawSymbolicColoredPixmap(icon.pixmap(16,16),"white"); + } else { // "ukui-default" "ukui-white" "ukui-light" "ukui" + pixmap = ImageUtil::drawSymbolicColoredPixmap(icon.pixmap(16,16),"black"); + } + } + + } + if (!pixmap.isNull()) { + m_labelIcon->setPixmap(pixmap); + m_labelIcon->show(); + } else { + m_labelIcon->hide(); + } +} diff --git a/CommonControl/kinfolistitem.h b/CommonControl/kinfolistitem.h index 24fea84..f45dc66 100644 --- a/CommonControl/kinfolistitem.h +++ b/CommonControl/kinfolistitem.h @@ -50,6 +50,7 @@ protected: private: void initStyleTheme(); + void setIcon(QString &m_strIcon); private: QHBoxLayout *m_mainLayout = nullptr; @@ -61,6 +62,7 @@ private: QString m_strTitle; QString m_strIcon; QString m_strDetail; + QString m_strThemeName = ""; bool m_isOdd = false; QGSettings *m_styleSettings = nullptr; diff --git a/CommonControl/loadingwidget.cpp b/CommonControl/loadingwidget.cpp index 3ee1ab1..92d5a36 100644 --- a/CommonControl/loadingwidget.cpp +++ b/CommonControl/loadingwidget.cpp @@ -35,10 +35,23 @@ void LoadingWidget::initUI() m_vLayout->setContentsMargins(0,0,0,0); m_vLayout->setSpacing(0); + + if(QGSettings::isSchemaInstalled("org.ukui.style")){ + settings = new QGSettings("org.ukui.style"); + connect(settings,&QGSettings::changed,this,&LoadingWidget::slot_SettingsChange); + } + m_labelLoadIcon = new QLabel(); QPixmap pixmap; - pixmap.load(":/imgres/img_res/ukui-occupation-map.svg"); - pixmap.scaled(290,262); + QString key = settings->get("styleName").toString(); + if("" != key){ + if(key == "ukui-black" || key == "ukui-dark"){ + pixmap.load(":/imgres/img_res/ukui-occupation-map-dark.png"); + }else{ + pixmap.load(":/imgres/img_res/ukui-occupation-map.png"); + } + } + pixmap = pixmap.scaled(128,128,Qt::KeepAspectRatio); m_labelLoadIcon->setPixmap(pixmap); m_labelLoadText = new QLabel(); @@ -53,3 +66,20 @@ void LoadingWidget::initUI() m_hLayout->addLayout(m_vLayout); this->setLayout(m_hLayout); } + +void LoadingWidget::slot_SettingsChange(const QString &key) +{ + if(key == "styleName"){ + if(settings->get("styleName").toString() == "ukui-black" || settings->get("styleName").toString() == "ukui-dark"){ + QPixmap pixmap; + pixmap.load(":/imgres/img_res/ukui-occupation-map-dark.png"); + pixmap = pixmap.scaled(128,128,Qt::KeepAspectRatio); + m_labelLoadIcon->setPixmap(pixmap); + }else{ + QPixmap pixmap; + pixmap.load(":/imgres/img_res/ukui-occupation-map.png"); + pixmap = pixmap.scaled(128,128,Qt::KeepAspectRatio); + m_labelLoadIcon->setPixmap(pixmap); + } + } +} diff --git a/CommonControl/loadingwidget.h b/CommonControl/loadingwidget.h index fe17ab2..c989cea 100644 --- a/CommonControl/loadingwidget.h +++ b/CommonControl/loadingwidget.h @@ -25,6 +25,8 @@ #include #include #include +#include +#include class LoadingWidget : public QWidget { @@ -39,6 +41,10 @@ private: QHBoxLayout *m_hLayout = nullptr; QLabel *m_labelLoadIcon = nullptr; QLabel *m_labelLoadText = nullptr; + QGSettings *settings; + +private slots: + void slot_SettingsChange(const QString &key); }; #endif // LOADINGWIDGET_H diff --git a/data/kylin-assistant/en_US/image/1.png b/data/kylin-assistant/en_US/image/1.png new file mode 100644 index 0000000..0888df4 Binary files /dev/null and b/data/kylin-assistant/en_US/image/1.png differ diff --git a/data/kylin-assistant/en_US/image/2.png b/data/kylin-assistant/en_US/image/2.png new file mode 100644 index 0000000..a85da69 Binary files /dev/null and b/data/kylin-assistant/en_US/image/2.png differ diff --git a/data/kylin-assistant/en_US/image/3.png b/data/kylin-assistant/en_US/image/3.png new file mode 100644 index 0000000..52bcb41 Binary files /dev/null and b/data/kylin-assistant/en_US/image/3.png differ diff --git a/data/kylin-assistant/en_US/image/4.png b/data/kylin-assistant/en_US/image/4.png new file mode 100644 index 0000000..494832d Binary files /dev/null and b/data/kylin-assistant/en_US/image/4.png differ diff --git a/data/toolkit/en_US/image/5.png b/data/kylin-assistant/en_US/image/5.png similarity index 100% rename from data/toolkit/en_US/image/5.png rename to data/kylin-assistant/en_US/image/5.png diff --git a/data/toolkit/en_US/image/6.png b/data/kylin-assistant/en_US/image/6.png similarity index 100% rename from data/toolkit/en_US/image/6.png rename to data/kylin-assistant/en_US/image/6.png diff --git a/data/toolkit/en_US/image/8.png b/data/kylin-assistant/en_US/image/8.png similarity index 100% rename from data/toolkit/en_US/image/8.png rename to data/kylin-assistant/en_US/image/8.png diff --git a/data/kylin-assistant/en_US/index.md b/data/kylin-assistant/en_US/index.md new file mode 100644 index 0000000..3fed883 --- /dev/null +++ b/data/kylin-assistant/en_US/index.md @@ -0,0 +1,24 @@ +# Toolkit + +The toolkit provides the functions of machine information, hardware parameters, hardware monitoring and drive management. +
+ +## Complete machine information +The whole machine information interface can view the basic information and hardware information of the machine, including processor, motherboard, hard disk, network card, video card, sound card, etc. +![Figure 1 Complete machine information](image/1.png) +
+ +## Hardware parameters +The hardware parameter interface allows you to view the details of the processor, memory, video card, motherboard, network card, hard disk, display, sound card, keyboard, mouse, optical drive, and Bluetooth. +![Figure 2 Hardware Parameters](image/2.png) +
+ +## Hardware monitoring +In the hardware monitoring interface, the device detection interface can view the hardware device temperature and utilization rate in real time. +![Figure 3 Hardware Monitoring](image/3.png) +
+ +## Drive management +Drive management can view various driver information in the computer for later driver update. +![Figure 4 Drive management](image/4.png) +
\ No newline at end of file diff --git a/data/toolkit/toolkit.png b/data/kylin-assistant/kylin-assistant.png similarity index 100% rename from data/toolkit/toolkit.png rename to data/kylin-assistant/kylin-assistant.png diff --git a/data/kylin-assistant/zh_CN/image/1.png b/data/kylin-assistant/zh_CN/image/1.png new file mode 100644 index 0000000..6bf7b8e Binary files /dev/null and b/data/kylin-assistant/zh_CN/image/1.png differ diff --git a/data/kylin-assistant/zh_CN/image/2.png b/data/kylin-assistant/zh_CN/image/2.png new file mode 100644 index 0000000..add6d5c Binary files /dev/null and b/data/kylin-assistant/zh_CN/image/2.png differ diff --git a/data/kylin-assistant/zh_CN/image/3.png b/data/kylin-assistant/zh_CN/image/3.png new file mode 100644 index 0000000..0895680 Binary files /dev/null and b/data/kylin-assistant/zh_CN/image/3.png differ diff --git a/data/kylin-assistant/zh_CN/image/4.png b/data/kylin-assistant/zh_CN/image/4.png new file mode 100644 index 0000000..f84c91e Binary files /dev/null and b/data/kylin-assistant/zh_CN/image/4.png differ diff --git a/data/toolkit/zh_CN/image/5.png b/data/kylin-assistant/zh_CN/image/5.png similarity index 100% rename from data/toolkit/zh_CN/image/5.png rename to data/kylin-assistant/zh_CN/image/5.png diff --git a/data/toolkit/zh_CN/image/6.png b/data/kylin-assistant/zh_CN/image/6.png similarity index 100% rename from data/toolkit/zh_CN/image/6.png rename to data/kylin-assistant/zh_CN/image/6.png diff --git a/data/toolkit/zh_CN/image/7.png b/data/kylin-assistant/zh_CN/image/7.png similarity index 100% rename from data/toolkit/zh_CN/image/7.png rename to data/kylin-assistant/zh_CN/image/7.png diff --git a/data/toolkit/zh_CN/image/8.png b/data/kylin-assistant/zh_CN/image/8.png similarity index 100% rename from data/toolkit/zh_CN/image/8.png rename to data/kylin-assistant/zh_CN/image/8.png diff --git a/data/kylin-assistant/zh_CN/index.md b/data/kylin-assistant/zh_CN/index.md new file mode 100644 index 0000000..3d5b729 --- /dev/null +++ b/data/kylin-assistant/zh_CN/index.md @@ -0,0 +1,32 @@ +# 工具箱 + +工具箱提供了整机信息,硬件参数,硬件监测、驱动管理的功能。 +
+ +## 整机信息 + +整机信息界面可查看本机基本信息和本机硬件信息,包括处理器、主板、硬盘、网卡、显卡、声卡等。 + +![图 1 整机信息-big](image/1.png) +
+ +## 硬件参数 + +硬件参数界面可查看本机处理器、内存、显卡、主板、网卡、硬盘、显示器、声卡、键盘、鼠标、光驱、蓝牙的详细信息。 + +![图 2 硬件参数-big](image/2.png) +
+ +## 硬件监测 + +硬件监测界面中,设备检测界面可实时查看硬件设备温度和使用率 + +![图 3 硬件监测-big](image/3.png) +
+ +## 驱动管理 +驱动管理可查看计算机中的各个驱动信息,便于后期更新驱动程序。 + +![图 4 驱动管理-big](image/4.png) +
+ diff --git a/data/toolkit/en_US/image/1.png b/data/toolkit/en_US/image/1.png deleted file mode 100644 index 7e30375..0000000 Binary files a/data/toolkit/en_US/image/1.png and /dev/null differ diff --git a/data/toolkit/en_US/image/2.png b/data/toolkit/en_US/image/2.png deleted file mode 100644 index 00bcf9c..0000000 Binary files a/data/toolkit/en_US/image/2.png and /dev/null differ diff --git a/data/toolkit/en_US/image/3.png b/data/toolkit/en_US/image/3.png deleted file mode 100644 index 364d929..0000000 Binary files a/data/toolkit/en_US/image/3.png and /dev/null differ diff --git a/data/toolkit/en_US/image/4.png b/data/toolkit/en_US/image/4.png deleted file mode 100644 index 28e5f90..0000000 Binary files a/data/toolkit/en_US/image/4.png and /dev/null differ diff --git a/data/toolkit/en_US/index.md b/data/toolkit/en_US/index.md deleted file mode 100644 index 81de787..0000000 --- a/data/toolkit/en_US/index.md +++ /dev/null @@ -1,50 +0,0 @@ -# ToolKit -## Overview -ToolKit provides some extended functions and users can query the hardware details of the current computer. The main interface as shown in Fig 1. - -![Fig 1 ToolKit-big](image/1.png) -
- -## MachineInformation - -As shown in Figure 2, the general information of the whole machine is displayed. - -![Fig 2 Machine Information-big](image/1.png) -
- -## HardwareParameters - -1) Processor: displays details of the computer's processor. - -![Fig 3 Processor-big](image/2.png) - -2)Memory: displays details of the computer's memory. - -![Fig 4 Memory-big](image/3.png) - -3)Click other items to switch to the hardware details tab. - -![Fig 5 MotherBoard-big](image/4.png) - -
- -## HardwareMonitoring - -1)Equipment monitoring, users can view the temperature and utilization of hardware equipment. - -![Fig 6 Device Monitor-big](image/5.png) - -2)CPU frequency modulation, user can set CPU management policy. - -(Note: CPU management policies may be different under different machines, the following content is for reference only) - -![Fig 7 CPU FM-big](image/6.png) -
- -## DriveManager - -The interface is shown in Figure 9, which displays each driver information in the computer. - -![Fig 9 Drive Manager-big](image/8.png) -
- diff --git a/data/toolkit/zh_CN/image/1.png b/data/toolkit/zh_CN/image/1.png deleted file mode 100644 index ba9ae29..0000000 Binary files a/data/toolkit/zh_CN/image/1.png and /dev/null differ diff --git a/data/toolkit/zh_CN/image/2.png b/data/toolkit/zh_CN/image/2.png deleted file mode 100644 index 40d77d1..0000000 Binary files a/data/toolkit/zh_CN/image/2.png and /dev/null differ diff --git a/data/toolkit/zh_CN/image/3.png b/data/toolkit/zh_CN/image/3.png deleted file mode 100644 index 1fe1176..0000000 Binary files a/data/toolkit/zh_CN/image/3.png and /dev/null differ diff --git a/data/toolkit/zh_CN/image/4.png b/data/toolkit/zh_CN/image/4.png deleted file mode 100644 index 745b46a..0000000 Binary files a/data/toolkit/zh_CN/image/4.png and /dev/null differ diff --git a/data/toolkit/zh_CN/index.md b/data/toolkit/zh_CN/index.md deleted file mode 100644 index d69c928..0000000 --- a/data/toolkit/zh_CN/index.md +++ /dev/null @@ -1,52 +0,0 @@ -# 工具箱 -## 概 述 -工具箱提供了整机信息,硬件参数,硬件监测等功能。主界面如图1所示。 - -![图 1 工具箱-big](image/1.png) -
- -## 整机信息 - -如图2所示,展示整机的概要信息。 - -![图 2 整机信息-big](image/1.png) -
- -## 硬件参数 - -1)处理器:显示计算机处理器的详细信息。 - -![图 3 处理器-big](image/2.png) - -2)内存:显示计算机内存的详细信息。 - -![图 4 内存-big](image/3.png) - -3)点击其他项目,切换到该硬件的详细信息标签页。 - -![图 5 主板-big](image/4.png) - -
- -## 硬件监测 -1)设备监测,用户可查看硬件设备温度和使用率。 - -![图 6 设备监测-big](image/5.png) - -2)CPU调频,用户可设置CPU管理策略。 - -(注意:不同机器下CPU管理策略可能有差异,以下内容仅供参考) - -![图 7 CPU调频-big](image/6.png) - -自定义模式如图8所示。 - -![图 8 自定义模式](image/7.png) -
- -## 驱动管理 -界面如图9所示,显示了计算机中的各个驱动信息。 - -![图 9 驱动管理-big](image/8.png) -
- diff --git a/dataworker/dataworker.cpp b/dataworker/dataworker.cpp index a71cb19..054265b 100644 --- a/dataworker/dataworker.cpp +++ b/dataworker/dataworker.cpp @@ -1135,3 +1135,83 @@ bool DataWorker::exitSessionDaemonDbus() } return false; } + +void DataWorker::disableBluetooth() +{ + initDbusInterface(&m_dbusHardwareInfo, DBUSPATH_HARDWAREINFO); + if (m_dbusHardwareInfo && m_dbusHardwareInfo->isValid()) { + QDBusPendingCall asyncCall = m_dbusHardwareInfo->asyncCall("disableBluetooth"); + if (!asyncCall.isError()) { + getBluetoothInfo(); + } + } else { + qWarning()<<"call hardwareinfo dbus failed!!"; + } +} + +void DataWorker::enableBluetooth() +{ + initDbusInterface(&m_dbusHardwareInfo, DBUSPATH_HARDWAREINFO); + if (m_dbusHardwareInfo && m_dbusHardwareInfo->isValid()) { + QDBusPendingCall asyncCall = m_dbusHardwareInfo->asyncCall("enableBluetooth"); + if (!asyncCall.isError()) { + getBluetoothInfo(); + } + } else { + qWarning()<<"call hardwareinfo dbus failed!!"; + } +} + +void DataWorker::disableSoundCard(QString strProduct,QString sysPciPath) +{ + QString productAndPci = strProduct+"|"+sysPciPath; + initDbusInterface(&m_dbusHardwareInfo, DBUSPATH_HARDWAREINFO); + if (m_dbusHardwareInfo && m_dbusHardwareInfo->isValid()) { + QDBusReply reply = m_dbusHardwareInfo->call("disableAudioAdaptor",productAndPci); + if (reply.isValid()) { + qWarning()<<"call disableSoundCard dbus failed!!"; + } + } else { + qWarning()<<"call hardwareinfo dbus failed!!"; + } +} + +void DataWorker::enableSoundCard(QString productAndPci) +{ + initDbusInterface(&m_dbusHardwareInfo, DBUSPATH_HARDWAREINFO); + if (m_dbusHardwareInfo && m_dbusHardwareInfo->isValid()) { + QDBusReply reply = m_dbusHardwareInfo->call("enableAudioAdaptor",productAndPci); + if (reply.isValid()) { + qWarning()<<"call enableSoundCard dbus failed!!"; + } + } else { + qWarning()<<"call hardwareinfo dbus failed!!"; + } +} + +void DataWorker::enableNetCard(QString productAndPci) +{ + initDbusInterface(&m_dbusHardwareInfo, DBUSPATH_HARDWAREINFO); + if (m_dbusHardwareInfo && m_dbusHardwareInfo->isValid()) { + QDBusReply reply = m_dbusHardwareInfo->call("enableNetworkAdaptor",productAndPci); + if (reply.isValid()) { + qWarning()<<"call enableNetworkAdaptor dbus failed!!"; + } + } else { + qWarning()<<"call hardwareinfo dbus failed!!"; + } +} + +void DataWorker::disableNetCard(QString strProduct,QString sysPciPath) +{ + QString productAndPci = strProduct+"|"+sysPciPath; + initDbusInterface(&m_dbusHardwareInfo, DBUSPATH_HARDWAREINFO); + if (m_dbusHardwareInfo && m_dbusHardwareInfo->isValid()) { + QDBusReply reply = m_dbusHardwareInfo->call("disableNetworkAdaptor",productAndPci); + if (reply.isValid()) { + qWarning()<<"call disableNetworkAdaptor dbus failed!!"; + } + } else { + qWarning()<<"call hardwareinfo dbus failed!!"; + } +} diff --git a/dataworker/dataworker.h b/dataworker/dataworker.h index 65e81d4..3e95f4e 100644 --- a/dataworker/dataworker.h +++ b/dataworker/dataworker.h @@ -63,6 +63,13 @@ public: bool exitSystemDaemonDbus(); //退出dbus bool exitSessionDaemonDbus(); //退出sessiondbus + void disableBluetooth(); + void enableBluetooth(); + void disableSoundCard(QString strProduct,QString sysPciPath); + void enableSoundCard(QString productAndPci); + void disableNetCard(QString strProduct,QString sysPciPath); + void enableNetCard(QString productAndPci); + public slots: // 异步获取接口 void getCpuFMInfo(); diff --git a/debian/control b/debian/control index a0b1609..20d3143 100644 --- a/debian/control +++ b/debian/control @@ -27,6 +27,8 @@ Build-Depends: debhelper (>= 9), libkf5screen-dev, libkf5screen-bin, libkysdk-waylandhelper-dev, + libkysdk-qtwidgets-dev (>= 1.0.0kylin12+0422), + libkysdk-utils-dev (>= 1.2.0.5), Standards-Version: 4.5.0 Rules-Requires-Root: no Homepage: https://github.com/ubuntukylin/youker-assistant diff --git a/debian/install b/debian/install index e93a9d5..304fa34 100644 --- a/debian/install +++ b/debian/install @@ -1,3 +1,3 @@ -data/toolkit/ /usr/share/kylin-user-guide/data/guide/ man/*.1 /usr/share/man/man1/ src/translation/*.qm /usr/share/youker-assistant/translations/ +data/kylin-assistant/ /usr/share/kylin-user-guide/data/guide/ diff --git a/debian/kylin-assistant.manpages b/debian/kylin-assistant.manpages index 74092e6..760d6c5 100644 --- a/debian/kylin-assistant.manpages +++ b/debian/kylin-assistant.manpages @@ -1,2 +1,2 @@ -man/kylin-assistant-systemdaemon.1 man/kylin-assistant.1 +man/kylin-assistant-systemdaemon.1 diff --git a/debian/kylin-assistant.postinst b/debian/kylin-assistant.postinst new file mode 100644 index 0000000..e361a40 --- /dev/null +++ b/debian/kylin-assistant.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +#判断命令是否存在 + +if [ -x /usr/share/kylin-system-updater/kylin-reboot-required ]; then + +#执行请求重启提示 + +/usr/share/kylin-system-updater/kylin-reboot-required + +fi \ No newline at end of file diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..06e1ae9 --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +include-binaries diff --git a/kyasDbus/systemdaemon/__pycache__/kacmdtool.cpython-38.pyc b/kyasDbus/systemdaemon/__pycache__/kacmdtool.cpython-38.pyc deleted file mode 100644 index 8ed45d4..0000000 Binary files a/kyasDbus/systemdaemon/__pycache__/kacmdtool.cpython-38.pyc and /dev/null differ diff --git a/kyasDbus/systemdaemon/__pycache__/kajsondef.cpython-38.pyc b/kyasDbus/systemdaemon/__pycache__/kajsondef.cpython-38.pyc deleted file mode 100644 index 856be08..0000000 Binary files a/kyasDbus/systemdaemon/__pycache__/kajsondef.cpython-38.pyc and /dev/null differ diff --git a/kyasDbus/systemdaemon/__pycache__/kathread.cpython-38.pyc b/kyasDbus/systemdaemon/__pycache__/kathread.cpython-38.pyc deleted file mode 100644 index 3d08f53..0000000 Binary files a/kyasDbus/systemdaemon/__pycache__/kathread.cpython-38.pyc and /dev/null differ diff --git a/kyasDbus/systemdaemon/audioadaptorthread.py b/kyasDbus/systemdaemon/audioadaptorthread.py index 76f5744..f6521bc 100644 --- a/kyasDbus/systemdaemon/audioadaptorthread.py +++ b/kyasDbus/systemdaemon/audioadaptorthread.py @@ -28,6 +28,7 @@ import re import json import subprocess +import time from pprint import pprint @@ -67,7 +68,7 @@ class AudioAdaptor(): def getAudioAdaptorInfo(self): summary = {"list":[]} index = 0 - self.cmdTool.loadInfoFromLshw(False) + self.cmdTool.loadInfoFromLshw(True) audioAdaptorList = self.cmdTool.lshwMultimediaList adaptorList = self.cmdTool.loadInfoFromHwinfo("--sound")["list"] length = len(audioAdaptorList) @@ -212,10 +213,11 @@ class AudioAdaptor(): if len(words) == 2 : keyWord = words[0].strip() valWord = words[1].strip() - if keyWord == "Status" : - result = re.findall("[\s]*([0-9]+MHz)-.*", valWord) - if result and len(result) > 0 : - pciStatusClock = result[0] + # 采用lshw 里面的声卡时钟频率,不采用pci里面的 + # if keyWord == "Status" : + # result = re.findall("[\s]*([0-9]+MHz)-.*", valWord) + # if result and len(result) > 0 : + # pciStatusClock = result[0] if len(pciStatusClock) > 0 : summary["list"][index][AudioAdaptor_Clock] = pciStatusClock @@ -272,9 +274,59 @@ class AudioAdaptor(): # pci bus devices have been parsed # other bus device is unsupported pass - + + # 添加集成声卡信息集成方案 + # 非990/9A0机型采用此方案 + if not Judgment_HW990() and not Judgment_HW9A0() and not Judgment_PANGUW(): + sound_card_paths = glob.glob('/sys/class/sound/card*') + for sound_card_path in sound_card_paths: + card_num = sound_card_path.split('/')[-1][4:] + uevent_path = sound_card_path + '/device/uevent' + if os.path.exists(uevent_path): + #飞腾集成声卡无pci信息,通过uevent进行筛选 + with open(uevent_path, 'r', encoding="utf-8") as f: + lines = f.readlines() + if 'PCI_ID' in "".join(lines): + continue + else: + driver = '' + vendor = '' + model = '' + for line in lines: + if line.startswith('DRIVER='): + driver = line.strip().split('=', 1)[-1] + vendor, model = self.cmdTool.getSoundVendorProduct(card_num) + if ''!=vendor and ''!=model and ''!=driver: + summary["list"].append({ + AudioAdaptor_Driver:driver, + AudioAdaptor_Manufacturer:vendor, + AudioAdaptor_Model:model}) + + # ## 添加集成声卡信息集成方案 + # pacmdSoundList = self.cmdTool.loadSoundInfoFromPacmd(False); + # for mapInfo in pacmdSoundList : + # if len(mapInfo) > 0 : + # if "sound_busaddr" in mapInfo: + # # 判断当前信息是否已经放入声卡信息中 + # if mapInfo["sound_busaddr"].replace("-","@") in [mapInfo[AudioAdaptor_Businfo] for mapInfo in summary["list"]]: + # continue; + # else: + # soundDict = {}; + # if "sound_vendor" in mapInfo: + # soundDict[AudioAdaptor_Manufacturer] = mapInfo["sound_vendor"]; + # if "sound_driver" in mapInfo: + # soundDict[AudioAdaptor_Driver] = mapInfo["sound_driver"]; + # if "sound_busaddr" in mapInfo: + # soundDict[AudioAdaptor_Businfo] = mapInfo["sound_busaddr"]; + # if "sound_name" in mapInfo: + # soundDict[AudioAdaptor_Product] = mapInfo["sound_name"]; + # if "sound_model" in mapInfo: + # soundDict[AudioAdaptor_Manufacturer] = mapInfo["sound_model"]; + # if len(soundDict) > 0: + # summary["list"].append(soundDict); + if len(summary["list"]) == 0 : - return "" + return json.dumps(summary) return json.dumps(summary) @@ -301,6 +353,85 @@ class AudioAdaptor(): nIndex = nIndex + 1 return outLine + #禁用声卡设备 + def disableSoundCard(self,strProductAndPath) : + print(strProductAndPath) + # try: + if("|" in strProductAndPath): + strProduct,pciPath = strProductAndPath.split("|") + sysPciPath = "/sys/devices/pci0000:00/" + if not os.path.exists(sysPciPath+pciPath+"/remove") : + return False + youkerConfigDir = "/etc/youker-assistant" + if os.path.exists(youkerConfigDir): + pass + else: + os.mkdir(youkerConfigDir) + #写文件 + if not os.path.exists(youkerConfigDir+"/"+"soundCard"): + os.popen('touch %s'%(youkerConfigDir+"/"+"soundCard")) + os.popen('echo "%s|%s" >> %s'%(strProduct,pciPath,youkerConfigDir+"/"+"soundCard")) + print('echo "%s|%s" >> %s'%(strProduct,pciPath,youkerConfigDir+"/"+"soundCard")) + #保存设备名称和pci写到文件中 设备名称+pci地址 而且要做区分 + os.popen('echo 1 > %s'%(sysPciPath+pciPath+"/remove")) + # except Exception as e: + # print(e) + return True + + #启用声卡设备 + def enableSoundCard(self, productAndPci) : + configFile = "/etc/youker-assistant/soundCard" + youkerConfigDir = "/etc/youker-assistant" + sysPciRescanPath = "/sys/bus/pci/rescan" + if not os.path.exists(sysPciRescanPath) or not os.path.exists(configFile) : + return False + # 去除禁用信息 + allData = [] + with open(configFile,'r')as fd: + print(fd.readlines) + #with open(configFile,'r') as fd: + file = open(configFile,'r') + allInfo = file.readlines() + for info in allInfo: + #info = fd.readline() + if '' != info: + if productAndPci in info: + pass + else: + allData.append(info) + fw = open(configFile, 'w') + fw.writelines(allData) + fw.close() + # os.popen('sed -i "s/%s//g" %s'%(productAndPci,configFile)) +# os.popen('echo 1 > %s'%(sysPciRescanPath)) + subprocess.Popen("echo 1 > %s"%(sysPciRescanPath), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 扫描当前所有需要禁用的设备 + disableList = ["netCard","soundCard"] + commands = [] + for item in disableList: + if os.path.exists(youkerConfigDir + "/" + item): + with open(youkerConfigDir + "/" + item, "r" ,encoding="utf-8") as file: + allLines = file.readlines() + for line in set(allLines): + line = line.strip() + if "|" in line : + strProduct,pciPath = line.strip().split("|") + sysPciPath = "/sys/devices/pci0000:00/" + count = 0 + while True and count < 30 : + if os.path.exists(sysPciPath+pciPath.strip()+"/remove"): + break + time.sleep(1) + count += 1 + if not os.path.exists(sysPciPath+pciPath.strip()+"/remove") : + return False + commands.append("echo 1 > %s"%(sysPciPath+pciPath.strip()+"/remove")) + # subprocess.Popen("echo 1 > %s"%(sysPciPath+pciPath.strip()+"/remove"), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) +# os.popen('echo 1 > %s'%(sysPciPath+pciPath.strip()+"/remove")) + # 遍历命令列表,并逐一执行 + for cmd in commands: subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + return True + if __name__ == "__main__": cmdTool = KACmdTool() cmdTool.loadInfoFromLshw() diff --git a/kyasDbus/systemdaemon/kabatteryinfo.py b/kyasDbus/systemdaemon/kabatteryinfo.py index 6940179..77f1bb9 100644 --- a/kyasDbus/systemdaemon/kabatteryinfo.py +++ b/kyasDbus/systemdaemon/kabatteryinfo.py @@ -138,9 +138,9 @@ class KABatteryInfo(): batOne[BTI_MODEL] = batModel if len(batOne) > 0 and batSupply : if len(sysProductName) > 0 : - if "TN140A2" in sysProductName : ##长城笔记本 - batOne[BTI_MANUFACTURER] = "飞毛腿(福建)电子有限公司" - batOne[BTI_MODEL] = "SNGW001" + if "TN140A2" in sysProductName or "TN133A2" in sysProductName : ##长城笔记本 + # batOne[BTI_MANUFACTURER] = "飞毛腿(福建)电子有限公司" + # batOne[BTI_MODEL] = "SNGW001" batOne[BTI_ENERGY] = "" batOne[BTI_ENERGYFULL] = "60Wh" elif "F860-T1" in sysProductName : ##清华同方笔记本 diff --git a/kyasDbus/systemdaemon/kabluetoothinfo.py b/kyasDbus/systemdaemon/kabluetoothinfo.py index 0c27600..1e1f978 100644 --- a/kyasDbus/systemdaemon/kabluetoothinfo.py +++ b/kyasDbus/systemdaemon/kabluetoothinfo.py @@ -45,6 +45,7 @@ class KABluetoothInfo(): baseList = self.cmdTool.loadInfoFromHciconfig() hwinfoList = self.cmdTool.loadInfoFromHwinfo("--usb")["list"] + bThwinfoList = self.cmdTool.loadInfoFromHwinfo("--bluetooth")["list"] length = len(baseList) for i in range(length) : if len(baseList[i]) == 0 : @@ -125,6 +126,9 @@ class KABluetoothInfo(): ##型号 if "Model" in mapInfo : summary["list"][index][BLI_DEVMODEL] = mapInfo["Model"].strip("\"") + #优化获取方案 hwinfo --bluetooth获取 + elif index < len(bThwinfoList) and "Model" in bThwinfoList[index]: + summary["list"][index][BLI_DEVMODEL] = bThwinfoList[index]["Model"].strip("\"") ##驱动 if "Driver" in mapInfo : @@ -204,6 +208,34 @@ class KABluetoothInfo(): outLine += " / " + info[BLI_DEVMODEL] nIndex = nIndex + 1 return outLine + + #禁用蓝牙驱动 + def disableBluetoothDriver(self) : + blacklistPath = "/etc/modprobe.d/blacklist.conf" + if not os.path.exists(blacklistPath) : + return False + os.popen('modprobe -r btusb') + os.popen('modprobe -r rtk_btusb') + # 将驱动写入黑名单 - 追加方式 + # /etc/modprobe.d/blacklist.conf + # blacklist rtk_btusb + os.popen('echo "blacklist rtk_btusb" >> %s'%(blacklistPath)) + os.popen('echo "blacklist btusb" >> %s'%(blacklistPath)) + return True + + #启用蓝牙驱动 + def enableBluetoothDriver(self) : + blacklistPath = "/etc/modprobe.d/blacklist.conf" + if not os.path.exists(blacklistPath) : + return False + os.popen('modprobe btusb') + os.popen('modprobe rtk_btusb') + # sed -i "s/alidata/data/g" test.txt + os.popen('sed -i "s/blacklist rtk_btusb//g" %s'%(blacklistPath)) + os.popen('sed -i "s/blacklist btusb//g" %s'%(blacklistPath)) + os.popen('sed "/^$/d" %s'%(blacklistPath)) + + return True if __name__ == "__main__": cmdtool = KACmdTool() diff --git a/kyasDbus/systemdaemon/kacmdtool.py b/kyasDbus/systemdaemon/kacmdtool.py index 4df89bc..e811b50 100644 --- a/kyasDbus/systemdaemon/kacmdtool.py +++ b/kyasDbus/systemdaemon/kacmdtool.py @@ -80,6 +80,77 @@ class KACmdTool(): if add : summary["list"].append(mapInfo) + def loadHwinfoUsbMouseinfo(self, param): + summary = {"list":[]} + + args = ["hwinfo", param] + pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = pipe.stdout.readlines() + + allinfo = "" + for l in output: + result = bytes.decode(l, "utf-8", "ignore") + if result : + allinfo += result + + infoList = allinfo.split("\n\n") + for info in infoList: + if len(info) != 0 : + mapInfo = {} + infoLines = info.split("\n") + for line in infoLines: + words = line.split(": ") + if len(words) != 2 : + continue + keyInfo = words[0].strip() + if keyInfo in mapInfo: + mapInfo[keyInfo] += " " + result = re.findall(".*\"(.*)\".*", words[1]) + if result and len(result) > 0 : + key = keyInfo + value = result[0] + ##这里是为了防止 "usb-storage", "sr" -》 usb-storage", "sr + if key == "Driver" : + value = value.replace("\"", ""); + if key in mapInfo : + mapInfo[key] += value; + else : + mapInfo[key] = value; + else : + if keyInfo == "Resolution" and keyInfo in mapInfo : + mapInfo[keyInfo] += words[1].strip(); + else : + mapInfo[keyInfo] = words[1].strip(); + + if "Vendor" == keyInfo : + result = re.findall("usb 0x([0-9]*)", words[1]) + if result and len(result) > 0 : + mapInfo["usb_vendor"] = result[0] + elif "Device" == keyInfo : + result = re.findall("usb 0x([0-9]*)", words[1]) + if result and len(result) > 0 : + mapInfo["usb_device"] = result[0] + + if "--usb" == param : + add = False + for item in summary: + if "SysFS BusID" in item: + curBus = item["SysFS BusID"] + newBus = mapInfo["SysFS BusID"] + curBus = re.sub("\\.[0-9]{1,2}$", "", curBus) + newBus = re.sub("\\.[0-9]{1,2}$", "", newBus) + if curBus == newBus : + add = False + break + + ## 鼠标信息 + if "mouse".lower() in info.lower() : + add = True + + if add : + summary["list"].append(mapInfo) + return summary + def loadInfoFromHwinfo(self, param): summary = {"list":[]} @@ -389,6 +460,27 @@ class KACmdTool(): self.getInfoFromLshw(item, mapInfo) self.lshwCDRomList.append(mapInfo) + elif item.startswith("virtio") : + #从hwinfo里面获取 + args = ["hwinfo","--network"] + pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = pipe.stdout.readlines() + busLink = "" + for l in output: + line = bytes.decode(l.strip(),"utf-8","ignore") + if line.find("SysFS Device Link") >= 0: + if ":" in line: + busLink = line.split("/")[-1] + netBusLink = '' + for netItem in self.lshwNetworkList: + if 'bus info' in netItem: + netBusLink = netItem['bus info'].replace('pci@','') + if netBusLink in netItem['bus info']: + result = re.findall("logical name: (\S+)", item) + if result and len(result) > 0 and '/dev/' not in result: + netItem['logical name'] = result[0] + break + def loadNetworkInfoFromIfconfig(self): args = ["ifconfig"] pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -476,6 +568,8 @@ class KACmdTool(): words = pair.strip().split(": ") if len(words) == 2 : mapInfo[words[0].strip()] = words[1].strip() + # 增加默认蓝牙驱动 btusb 已确认蓝牙内嵌外接都为usb方式; + mapInfo["driver"] = "btusb"; self.loadBluetoothInfo(mapInfo) if len(mapInfo) > 0 : infoList.append(mapInfo) @@ -750,6 +844,21 @@ class KACmdTool(): product = retProduct[0] return vendor,product + + def getSoundVendorProduct(self, cardNum) : + vendor,model = '','' + if not os.path.exists("/proc/asound/card"+str(cardNum)+"/codec#0") : + return vendor,model + cmd = ["cat","/proc/asound/card"+str(cardNum)+"/codec#0","|","grep","Codec"] + # Codec: Realtek ALC257 + # Codec: Intel Kabylake HDMI + fp = os.popen(" ".join(cmd)) + msg = fp.read() + if ":" in msg: + tmp = msg.strip().split(':', 1)[-1].strip() + if " " in tmp: + vendor,model = tmp.split(' ', 1) + return vendor,model if __name__ == "__main__": cc = KACmdTool() diff --git a/kyasDbus/systemdaemon/kacpufm.py b/kyasDbus/systemdaemon/kacpufm.py index f6b5883..4a2073e 100644 --- a/kyasDbus/systemdaemon/kacpufm.py +++ b/kyasDbus/systemdaemon/kacpufm.py @@ -153,6 +153,18 @@ class KACpuFM(dbus.service.Object): origin = {Cpufm_Average_Corefreq:""} if(not os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq")): + # 存在机型没有开启动态调频,默认为cpu频率方案移植 + if(Judgment_3A5000() or Judgment_SW()): + args = ["cat /proc/cpuinfo | grep -i 'cpu MHz'"] + pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE , shell=True) + output = pipe.stdout.readlines() + + cpuFreq = "" + if len(output) != 0: + cpuFreq = bytes.decode(output[0],"utf-8","ignore") + if "cpu mhz" in cpuFreq.lower(): + cpuFreq = cpuFreq.split(":")[-1].strip() + origin[Cpufm_Average_Corefreq] = self.num_convert(str(int(float(cpuFreq)*1000))); return origin v = 0 diff --git a/kyasDbus/systemdaemon/kadevmonitor.py b/kyasDbus/systemdaemon/kadevmonitor.py index 21223f1..6a85f94 100644 --- a/kyasDbus/systemdaemon/kadevmonitor.py +++ b/kyasDbus/systemdaemon/kadevmonitor.py @@ -95,10 +95,9 @@ class KADevMonitor(dbus.service.Object): return strJson def chkCpuUsageTimer(self): - cmd = "cat " + CPUSTAT_FILE - fp = os.popen(cmd) - msg = fp.read() - fp.close() + msg = "" + with open ("/proc/stat" , "r" ) as f: + msg = "".join(f.readlines()) result = re.findall('cpu\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)', msg); self.preTotalTime = self.totalTime self.preWorkTime = self.workTime diff --git a/kyasDbus/systemdaemon/kagraphicscardinfo.py b/kyasDbus/systemdaemon/kagraphicscardinfo.py index 499d004..6ada6dd 100644 --- a/kyasDbus/systemdaemon/kagraphicscardinfo.py +++ b/kyasDbus/systemdaemon/kagraphicscardinfo.py @@ -60,9 +60,13 @@ class KAGraphicsCardInfo() : wayland_sock = glob.glob('/run/user/*/wayland-0')[0] xdg_runtime_dir = wayland_sock[:-10] # /run/user/1000 gpuinfo_env = {'XDG_RUNTIME_DIR' : xdg_runtime_dir} - process = subprocess.run('gpuinfo', env=gpuinfo_env, capture_output=True) - output = process.stdout.decode() - ret = process.returncode + # 判断是否有gpuinfo命令 + try: + process = subprocess.run('gpuinfo', env=gpuinfo_env, capture_output=True) + output = process.stdout.decode() + ret = process.returncode + except: + ret = 0 if ret == 1: ## ??? lines = output.strip().split('\n') for line in lines: @@ -147,7 +151,7 @@ class KAGraphicsCardInfo() : # JJW显卡的特殊处理 tmpVendor = mapInfo["vendor"] - if tmpVendor.find("JJM") != -1: + if str(tmpVendor).lower().find("jingjia") != -1: isJJM = True tmpResult = get_interface(subsystem_id, subsystem_id_re) summary["list"][index][GSI_NAME] = tmpResult.strip() @@ -226,47 +230,60 @@ class KAGraphicsCardInfo() : if (GSI_NAME in summary["list"][index] and "X100" in summary["list"][index][GSI_NAME]) or \ (GSI_MANUFACTURER in summary["list"][index] and "X100" in summary["list"][index][GSI_MANUFACTURER]): ## X100 - args3 = ["lspci", "-n"] - pipe3 = subprocess.Popen(args3, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - output3 = pipe3.stdout.readlines() - totalMem = 0 - for line in [ bytes.decode(l.strip(),"utf-8","ignore") for l in output3]: - if "1db7:dc20" not in line and "1db7:dc21" not in line and "1db7:dc22" not in line : - continue - infoItems = line.split(" ") - if len(infoItems) != 3 : - continue - args4 = ["lspci", "-vs"] - args4.append(infoItems[0].strip()) - pipe4 = subprocess.Popen(args4, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - output4 = pipe4.stdout.readlines() - singleMem = 0 - for line1 in [ bytes.decode(l.strip(),"utf-8","ignore") for l in output4]: - if "Memory" not in line1: - continue - - results = [ v.strip().strip("\)") for v in line1.split() ] - if "prefetchable" in results : - ## Memory at a0000000 (64-bit, prefetchable) [size=256M] - for session in results : - if "size" not in session : - continue - strMem = session.strip("[").strip("]").split("=") - if len(strMem) == 2 : - sizeN = re.findall("([0-9]+)M.*",strMem[1]) - if sizeN and len(sizeN) > 0 and sizeN[0].isdigit() : - if int(sizeN[0]) > singleMem : - singleMem = int(sizeN[0]) - sizeN = re.findall("([0-9]+)G.*",strMem[1]) - if sizeN and len(sizeN) > 0 and sizeN[0].isdigit() : - if int(sizeN[0])*1024 > singleMem : - singleMem = int(sizeN[0])*1024 - totalMem += singleMem - if totalMem > 0 : + if os.path.exists("/sys/kernel/debug/pvr/physical_vram_size"): + args3 = ["cat", "/sys/kernel/debug/pvr/physical_vram_size"] + pipe3 = subprocess.Popen(args3, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output3 = pipe3.stdout.readlines() + totalMem = 0 + for line in [ bytes.decode(l.strip(),"utf-8","ignore") for l in output3]: + if line.strip().isdigit(): + totalMem = int(line) + if totalMem > 0 : + # 单位为字节 转换成 MB + totalMem /= 1024*1024 if totalMem > 1024 : summary["list"][index][GSI_CAPCITY] = str(float("%0.1f"%(float(totalMem)/1024)))+"GB" else : summary["list"][index][GSI_CAPCITY] = str(totalMem)+"MB" + else: + totalMem = 0 + for line in [ bytes.decode(l.strip(),"utf-8","ignore") for l in output3]: + if "1db7:dc20" not in line and "1db7:dc21" not in line and "1db7:dc22" not in line : + continue + infoItems = line.split(" ") + if len(infoItems) != 3 : + continue + args4 = ["lspci", "-vs"] + args4.append(infoItems[0].strip()) + pipe4 = subprocess.Popen(args4, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output4 = pipe4.stdout.readlines() + singleMem = 0 + for line1 in [ bytes.decode(l.strip(),"utf-8","ignore") for l in output4]: + if "Memory" not in line1: + continue + + results = [ v.strip().strip("\)") for v in line1.split() ] + if "prefetchable" in results : + ## Memory at a0000000 (64-bit, prefetchable) [size=256M] + for session in results : + if "size" not in session : + continue + strMem = session.strip("[").strip("]").split("=") + if len(strMem) == 2 : + sizeN = re.findall("([0-9]+)M.*",strMem[1]) + if sizeN and len(sizeN) > 0 and sizeN[0].isdigit() : + if int(sizeN[0]) > singleMem : + singleMem = int(sizeN[0]) + sizeN = re.findall("([0-9]+)G.*",strMem[1]) + if sizeN and len(sizeN) > 0 and sizeN[0].isdigit() : + if int(sizeN[0])*1024 > singleMem : + singleMem = int(sizeN[0])*1024 + totalMem += singleMem + if totalMem > 0 : + if totalMem > 1024 : + summary["list"][index][GSI_CAPCITY] = str(float("%0.1f"%(float(totalMem)/1024)))+"GB" + else : + summary["list"][index][GSI_CAPCITY] = str(totalMem)+"MB" if GSI_CAPCITY not in summary["list"][index] : if "size" in mapInfo and len(mapInfo["size"]) > 0: @@ -325,10 +342,11 @@ class KAGraphicsCardInfo() : valWord = words[1].strip() if keyWord == "Subsystem" : subSystemInfo = valWord - elif keyWord == "Status" : - result = re.findall("[\s]*([0-9]+MHz)-.*", valWord) - if result and len(result) > 0 : - pciStatusClock = result[0] + # 采用lshw 里面的显卡时钟频率,不采用pci里面的 + # elif keyWord == "Status" : + # result = re.findall("[\s]*([0-9]+MHz)-.*", valWord) + # if result and len(result) > 0 : + # pciStatusClock = result[0] if len(subSystemInfo) > 0 : summary["list"][index][GSI_SUBSYSTEM] = subSystemInfo if len(pciStatusClock) > 0 : @@ -341,6 +359,12 @@ class KAGraphicsCardInfo() : if GSI_MANUFACTURER in summary["list"][index] and \ summary["list"][index][GSI_MANUFACTURER] != summary["list"][index][GSI_NAME] : summary["list"][index][GSI_MODEL] = summary["list"][index][GSI_NAME] + if "vendor" in mapInfo: + # subsytem 放到 product里面(Jingjia Microelectronics Co Ltd JM7201)--- 根据制造商裁剪型号,作为设备名称和型号 + if get_url(mapInfo["vendor"],mapInfo["vendor"]).find("jingjia") != -1: + tmpName = summary["list"][index][GSI_SUBSYSTEM].split(summary["list"][index][GSI_MANUFACTURER])[-1].strip(); + summary["list"][index][GSI_NAME] = tmpName; + summary["list"][index][GSI_MODEL] = tmpName; else : if GSI_NAME in summary["list"][index] : summary["list"][index][GSI_MODEL] = summary["list"][index][GSI_NAME] diff --git a/kyasDbus/systemdaemon/kaharddiskinfo.py b/kyasDbus/systemdaemon/kaharddiskinfo.py index 4404af2..e986f48 100644 --- a/kyasDbus/systemdaemon/kaharddiskinfo.py +++ b/kyasDbus/systemdaemon/kaharddiskinfo.py @@ -154,12 +154,13 @@ class KAHarddiskInfo() : and mapInfo["dev_name"] in diskList["list"][i]["Device File"] : diskList["list"][i].update(mapInfo) flag = Judgment_HW990() + flag9A0 = Judgment_HW9A0() # 判断是否为联想定制 customedType = Judgment_LENOVO() for diskInfo in diskList["list"] : disk = {} - DiskProduct,DiskVendor,DiskCapacity,DiskName,DiskFw,DiskSerial,DiskRota,DiskInterface = '','','','','','','','' + DiskProduct,DiskVendor,DiskCapacity,DiskName,DiskFw,DiskSerial,DiskRota,DiskInterface,DiskUFS = '','','','','','','','','' devName = "" IsRemoveable = False if "dev_name" in diskInfo : @@ -181,7 +182,8 @@ class KAHarddiskInfo() : if result and len(result) > 0: if result[0].isdigit() : jinzhi = 1000.0 - if majorId[0] == "252" : + # 判断是否为虚拟机 + if Judgment_Virt(): jinzhi = 1024.0 size = float(result[0])/jinzhi/jinzhi/jinzhi if size >= jinzhi : @@ -211,6 +213,9 @@ class KAHarddiskInfo() : DiskCapacity = result[0] if DiskCapacity.startswith("0") or DiskCapacity == "" : continue + #优化 sw /dev/ram*设备挂载分区为空 + if "" == devName: + continue; DiskName = ("/dev/" + devName) IsMainDisk = self.chkIsMainDisk(DiskName) IsSSD = "0" @@ -304,8 +309,63 @@ class KAHarddiskInfo() : disk[HDI_ROTA] = DiskRota if len(DiskInterface) > 0: disk[HDI_INTERFACE] = DiskInterface - # 联想定制 - if(1 == customedType): + + # 990/9A0 特殊处理 + if (flag or flag9A0) and len(DiskCapacity) > 0 : + def transHumanReadableSize(disSize): + diffMap = {} + destList = [1, 2, 4, 8, 16, 32, 64, 80, 100, 120, 128, 160, 256, 320, 500, 512, 750] + for size in destList: + diffMap[abs(disSize - size)] = destList.index(size) + return destList[diffMap.get(min(diffMap.keys()))] + if DiskCapacity.find(".") < 0 : # 非浮点数值 + result = re.findall("([0-9]+)", DiskCapacity) + if result and len(result) > 0 : + originInfo = result[0] + humanReadableSize = transHumanReadableSize(int(originInfo)) + disk[HDI_CAPACITY] = DiskCapacity.replace(originInfo, str(humanReadableSize)) + # if IsSSD == "1" : + # if flag : + # disk[HDI_UFS] = "UFS 3.0" + # elif flag9A0 : + # disk[HDI_UFS] = "UFS 3.1" + + # 当读取cat /sys/devices/platform/f8200000.ufs/host0/scsi_host/host0/wb_en中数值为true, + # 且cat /sys/block/sdd/device/spec_version中数值为310时显示UFS 3.1,; + if IsSSD == "1" : + if flag9A0: + disk[HDI_UFS] = "UFS 3.1" + # 990 + elif flag: + # 非L410为UFS3.0 + if not Judgment_L410(): + disk[HDI_UFS] = "UFS 3.0" + else: + disk[HDI_UFS] = "UFS 3.0" + ufsPath = "/sys/devices/platform/f8200000.ufs/host0/scsi_host/host0/wb_en" + ufsVersion = "/sys/block/sdd/device/spec_version" + if os.path.exists(ufsPath) and os.path.exists(ufsVersion): + args = ["cat", ufsPath] + pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = pipe.stdout.readlines() + for l in output: + line = bytes.decode(l.strip(),"utf-8","ignore") + if line.find("true") >= 0: + args1 = ["cat", ufsVersion] + pipe1 = subprocess.Popen(args1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output1 = pipe1.stdout.readlines() + for l in output1: + line = bytes.decode(l.strip(),"utf-8","ignore") + if line.find("310") >= 0: + disk[HDI_UFS] = "UFS 3.1" + else: + disk[HDI_UFS] = "UFS 3.0" + else: + disk[HDI_UFS] = "UFS 3.0" + else: + disk[HDI_UFS] = "UFS 3.0" + # 联想定制 DATANG不走定制 + if(1 == customedType and HDI_MANUFACTURER in disk and "DATANG" not in disk[HDI_MANUFACTURER]): disk[HDI_MODEL] = self.exchangeModel([disk]) disklist.append(disk) @@ -378,4 +438,4 @@ if __name__ == "__main__": # print(capacityTmp) # print(capacityTmp[-1].split(" ")) # # capacity = capacityTmp[0].split(".")[0] + ".00"+" TB" -# #print(capacity) \ No newline at end of file +# #print(capacity) diff --git a/kyasDbus/systemdaemon/kahwinfo.py b/kyasDbus/systemdaemon/kahwinfo.py index 7bcd5c9..d6d43b1 100644 --- a/kyasDbus/systemdaemon/kahwinfo.py +++ b/kyasDbus/systemdaemon/kahwinfo.py @@ -217,6 +217,52 @@ class HardwareInfo(dbus.service.Object): bluetoothInfo = KABluetoothInfo(self.cmdtool) return bluetoothInfo.getBluetoothInfo() + # 禁用蓝牙驱动 + @dbus.service.method(INTERFACE, in_signature='', out_signature='s', sender_keyword='sender') + def disableBluetooth(self, sender=None): + bluetoothInfo = KABluetoothInfo(self.cmdtool) + bluetoothInfo.disableBluetoothDriver() + return "true" + + # 启用蓝牙驱动 + @dbus.service.method(INTERFACE, in_signature='', out_signature='s', sender_keyword='sender') + def enableBluetooth(self, sender=None): + bluetoothInfo = KABluetoothInfo(self.cmdtool) + bluetoothInfo.enableBluetoothDriver() + return "true" + + # 禁用声卡设备 + @dbus.service.method(INTERFACE, in_signature='s', out_signature='s', sender_keyword='sender') + def disableAudioAdaptor(self, strProductAndPath, sender=None): + print(strProductAndPath) + audioAdaptorInfo = AudioAdaptor(self.cmdtool) + audioAdaptorInfo.disableSoundCard(strProductAndPath) + return "true" + + # 启用声卡设备 + @dbus.service.method(INTERFACE, in_signature='s', out_signature='s', sender_keyword='sender') + def enableAudioAdaptor(self, strProductAndPath, sender=None): + print(strProductAndPath) + audioAdaptorInfo = AudioAdaptor(self.cmdtool) + audioAdaptorInfo.enableSoundCard(strProductAndPath) + return "true" + + # 禁用网卡设备 + @dbus.service.method(INTERFACE, in_signature='s', out_signature='s', sender_keyword='sender') + def disableNetworkAdaptor(self, strProductAndPath, sender=None): + print(strProductAndPath) + networkAdaptorInfo = NetworkAdaptor(self.cmdtool) + networkAdaptorInfo.disableNetCard(strProductAndPath) + return "true" + + # 启用网卡设备 + @dbus.service.method(INTERFACE, in_signature='s', out_signature='s', sender_keyword='sender') + def enableNetworkAdaptor(self, strProductAndPath, sender=None): + print(strProductAndPath) + networkAdaptorInfo = NetworkAdaptor(self.cmdtool) + networkAdaptorInfo.enableNetCard(strProductAndPath) + return "true" + #keyboard info @dbus.service.signal(INTERFACE, signature='us') def signalKBUpdateInfo(self, status, msg): @@ -244,7 +290,7 @@ class HardwareInfo(dbus.service.Object): @dbus.service.method(INTERFACE, in_signature='', out_signature='s', sender_keyword='sender') def readMNInfo(self, sender=None): - monitorInfo = KAMonitor() + monitorInfo = KAMonitor(self.cmdtool) return monitorInfo.getMonitorsInfo() #cddrive info @@ -411,6 +457,9 @@ class HardwareInfo(dbus.service.Object): if os.path.exists(path): return True else: + #判断3A500机器 - 动态调频没有的情况下走/proc/cpuinfo + if(Judgment_3A5000() or Judgment_SW()): + return True return False @dbus.service.signal(INTERFACE, signature='') diff --git a/kyasDbus/systemdaemon/kajsondef.py b/kyasDbus/systemdaemon/kajsondef.py index 794e04c..3f62252 100644 --- a/kyasDbus/systemdaemon/kajsondef.py +++ b/kyasDbus/systemdaemon/kajsondef.py @@ -114,6 +114,7 @@ HDI_READSPEED = "read_speed" #磁盘读取速度 HDI_WRITESPEED = "write_speed" #磁盘写入速度 HDI_FIRMWAREVER = "firmware_ver" #固件版本 HDI_ROTA = "rota" #机械转速 +HDI_UFS = "disk_ufs" #UFS 版本 ###DEV MONITOR DEVMONITOR_ROOT = "device_monitor" #设备监测 diff --git a/kyasDbus/systemdaemon/kakeyboardinfo.py b/kyasDbus/systemdaemon/kakeyboardinfo.py index 19ad628..773eb89 100644 --- a/kyasDbus/systemdaemon/kakeyboardinfo.py +++ b/kyasDbus/systemdaemon/kakeyboardinfo.py @@ -57,8 +57,8 @@ class KAKeyboardInfo(): else : kbName = mapInfo["Device"] - ##AT Raw键盘 - if "AT Raw" in kbName: + ##蓝牙设备 手机,耳机 + if "(AVRCP)" in kbName: continue; ##panguw键盘 if "lsadc" in kbName: diff --git a/kyasDbus/systemdaemon/kamachineinfo.py b/kyasDbus/systemdaemon/kamachineinfo.py index 02b3ae4..1a6c730 100644 --- a/kyasDbus/systemdaemon/kamachineinfo.py +++ b/kyasDbus/systemdaemon/kamachineinfo.py @@ -281,6 +281,14 @@ class KAMachineInfo(): platValue = front elif os.path.exists("/etc/os-release"): tmp = tmp1 = "" + # 优先获取version 和 控制面板保持一致 + with open("/etc/os-release", "r" ,encoding="utf-8") as fsys: + for line in fsys: + if line.startswith("VERSION"): + tmp = line + if tmp != "": + platValue = tmp.split('=')[1].replace('"', '').replace('\n', ''); + return platValue with open("/etc/os-release", "r") as fsys: for line in fsys: if line.startswith("NAME"): @@ -409,7 +417,7 @@ class KAMachineInfo(): summary[MI_HARDDISK] = harddiskInfo.getOutline(customedType) graphicsCardInfo = KAGraphicsCardInfo(self.cmdTool) summary[MI_GRAPHICSCARD] = graphicsCardInfo.getOutline(customedType) - monitorInfo = KAMonitor() + monitorInfo = KAMonitor(self.cmdTool) summary[MI_MONITOR] = monitorInfo.getOutline() networkInfo = NetworkAdaptor(self.cmdTool) summary[MI_NETWORKCARD] = networkInfo.getOutline() diff --git a/kyasDbus/systemdaemon/kamonitorthread.py b/kyasDbus/systemdaemon/kamonitorthread.py index a0c48f0..96f5528 100644 --- a/kyasDbus/systemdaemon/kamonitorthread.py +++ b/kyasDbus/systemdaemon/kamonitorthread.py @@ -38,7 +38,8 @@ from utils import * class KAMonitor() : - def __init__(self): + def __init__(self, cmdtool): + self.cmdTool = cmdtool pass def getMonitorsInfo(self) : @@ -47,13 +48,25 @@ class KAMonitor() : if os.path.exists("/tmp/youker-assistant-monitorinfo.dat"): status, xrandrDat = subprocess.getstatusoutput('cat /tmp/youker-assistant-monitorinfo.dat') value = re.findall("(.*) connected", xrandrDat) + connectList =[] + hwinfoList = self.cmdTool.loadInfoFromHwinfo("--monitor")["list"] for monitor in value : - p = re.compile(r'%s connected' % monitor) + if Judgment_HW990(): + if "eDP-1" == monitor: + continue + p = re.compile(r'\n%s connected' % monitor) + nIndex = 0 for m in p.finditer(xrandrDat): + #去重 + connectInterface=m.group() + if connectInterface in connectList: + continue + else: + connectList.append(connectInterface) monitorOne = {} mnManufacturer,mnName,mnSize,mnRatio,mnResolution,mnMaxResolution,mnIsMain,mnGamma,mnInterface, \ mnModel,mnVisibleArea,mnYear,mnWeek,mnSerial = "","","","","","","","","","","","","","" - localinfo = xrandrDat.split("%s connected" % monitor)[1].split("connected")[0] + localinfo = xrandrDat.split("\n%s connected" % monitor)[1].split("connected")[0] mnInterface = monitor if "primary" in localinfo : mnIsMain = "1" @@ -64,6 +77,12 @@ class KAMonitor() : curResolutionWidth = int(curResolution[0][0]) curResolutionHeight = int(curResolution[0][1]) mnResolution = str(curResolutionWidth)+"X"+str(curResolutionHeight) + # 新增分辨率 + refreshRate = re.findall('(\d*).(\d*)\*', localinfo) + if refreshRate: + for item in refreshRate : + if item[0].isdigit() and item[1].isdigit(): + mnResolution += "@"+item[0]+"."+item[1]+"Hz" if curResolutionHeight > 0 : ratio = int(curResolutionWidth*100/curResolutionHeight) if ratio == 125 : #5:4 @@ -82,6 +101,7 @@ class KAMonitor() : fp.write(edidinfoline) # 1920x1080 59.93*+ result = re.findall('\s*(\d*)x(\d*)\s\s\s', localinfo) + refreshRateMax = "" if result: nMaxRes = 0 for item in result : @@ -89,10 +109,32 @@ class KAMonitor() : tempRes = int(item[0])*int(item[1]) if tempRes > nMaxRes : nMaxRes = tempRes + for line in localinfo.split('\n'): + if line.strip().startswith(item[0]+"x"+item[1]): + tmp = line.strip().split(" ") + tmp = [i for i in tmp if i != ''] + if(len(tmp) > 1): + refreshRateMax = tmp[1] mnMaxResolution = (item[0] + "X" + item[1]) + if refreshRateMax != "": + if "+" in refreshRateMax: + refreshRateMax = refreshRateMax.replace("+","") + if "*" in refreshRateMax: + refreshRateMax = refreshRateMax.replace("*","") + mnMaxResolution += "@"+refreshRateMax+"Hz" + is323F = Judgment_323F() if os.path.exists("/tmp/edid.dat"): status, ediddecret = subprocess.getstatusoutput('/usr/bin/edid-decode /tmp/edid.dat') + if is323F and os.path.exists("/sys/class/drm"): + dirList = os.listdir("/sys/class/drm") + monDir = "" + for dirItem in dirList: + if (r"-"+mnInterface) in dirItem: + monDir = dirItem + break + if "" != monDir and os.path.exists("/sys/class/drm/"+monDir+"/edid"): + status, ediddecret = subprocess.getstatusoutput('/usr/bin/edid-decode %s' % ("/sys/class/drm/"+monDir+"/edid")) #Display Product Name: LEN T2224rbA #Manufacturer: LEN Model 24810 Serial Number 16843009 result_bak = re.findall("Manufacturer:\s*(\w*)\s*Model\s*(\w*)", ediddecret) @@ -119,18 +161,27 @@ class KAMonitor() : if len(result[0]) > 0 : mnManufacturer = result[0] if len(result) >= 2 and len(result[1]) > 0 : - mnName = result[1] + #CEC model 和 Alphanumeric Data String 不一致 + if result_bak and result[0] in result_bak[0] or "CEC" in result[0]: + mnName = result[1] + else: + #Alphanumeric Data String: N140HCE-EN2 + #Alphanumeric Data String: CMN + #Alphanumeric Data String: N140HCE-EN2 + mnManufacturer = result[1] + mnName = result[0] #Maximum image size: 48 cm x 27 cm result = re.findall("Maximum image size:\s*(\d*)\s*cm\s*x\s*(\d*)\s*cm", ediddecret) result2 = re.findall("Detailed mode: Clock (\d*\.\d*) MHz,\s*(\d*)\s*mm\s*x\s*(\d*)\s*mm", ediddecret) isTN133A2 = Judgment_TN133A2() + is323F = Judgment_323F() if result2: mx = float(result2[0][1]); my = float(result2[0][2]) md = math.sqrt(mx**2 + my**2)/25.4 - mnVisibleArea = (str(mx) + " X " + str(my) + " cm") + mnVisibleArea = (str(mx) + " X " + str(my) + " mm") # 熊猫华星笔记本屏幕尺寸 - if md > 13 and md <= 14 and len(mnName) > 0 and True != isTN133A2: + if md > 13 and md <= 14 and len(mnName) > 0 and True != isTN133A2 and True != is323F: md = 14 mnSize = str("%.1f" %md) elif result: @@ -138,7 +189,7 @@ class KAMonitor() : md = math.sqrt(mx**2 + my**2)/2.54 mnVisibleArea = (str(mx) + " X " + str(my) + " cm") # 熊猫华星笔记本屏幕尺寸 - if md > 13 and md <= 14 and len(mnName) > 0 and True != isTN133A2: + if md > 13 and md <= 14 and len(mnName) > 0 and True != isTN133A2 and True != is323F : md = 14 mnSize = str("%.1f" %md) @@ -166,6 +217,16 @@ class KAMonitor() : monitorOne[MNI_NAME] = mnName if len(mnSize) > 0 : monitorOne[MNI_SIZE] = mnSize + # hwinfo 有可能获取不到显示器信息,hwinfo只是用于最后做一个优化 + if len(hwinfoList) > nIndex: + mapInfo = hwinfoList[nIndex] + if "Model" in mapInfo : + mnModel = mapInfo["Model"].split("\"") + if len(mnModel) > 1 : + mnModel = mnModel[0] + else : + mnModel = mapInfo["Model"] + monitorOne[MNI_NAME] = mnModel if len(mnRatio) > 0 : monitorOne[MNI_RATIO] = mnRatio if len(mnResolution) > 0 : @@ -189,13 +250,15 @@ class KAMonitor() : if len(mnSerial) > 0 : monitorOne[MNI_SERIALNUM] = mnSerial + nIndex = nIndex + 1 + if len(monitorOne) > 0 : infoList["list"].append(monitorOne) if Judgment_HW990(): - for i in range(len(infoList["list"])-1, -1, -1): - if MNI_MANUFACTURER not in infoList["list"][i] : - infoList["list"].pop(i) + # for i in range(len(infoList["list"])-1, -1, -1): + # if MNI_MANUFACTURER not in infoList["list"][i] : + # infoList["list"].pop(i) if os.path.exists("/sys/class/drm"): edid_files = glob.glob("/sys/class/drm/*/edid") @@ -226,8 +289,15 @@ class KAMonitor() : outLine += info[MNI_NAME] else : outLine += " / " + info[MNI_NAME] + # 华为机型如果没有型号则用厂商+屏幕尺寸 + elif Judgment_PANGUW() or Judgment_HW990() or Judgment_HW9A0(): + if MNI_MANUFACTURER in info: + if nIndex == 0 : + outLine += info[MNI_MANUFACTURER] + else: + outLine += " / " + info[MNI_MANUFACTURER] if MNI_SIZE in info : - outLine += "("+info[MNI_SIZE]+")" + outLine += "("+info[MNI_SIZE]+")" nIndex = nIndex + 1 return outLine diff --git a/kyasDbus/systemdaemon/kamouseinfo.py b/kyasDbus/systemdaemon/kamouseinfo.py index 42bc46f..3d23c5f 100644 --- a/kyasDbus/systemdaemon/kamouseinfo.py +++ b/kyasDbus/systemdaemon/kamouseinfo.py @@ -33,6 +33,7 @@ from pprint import pprint from kajsondef import * from kathread import * +from utils import * class KAMouseInfo(): @@ -43,7 +44,15 @@ class KAMouseInfo(): def getMouseInfo(self): summary = {"list":[]} - hwinfoList = self.cmdTool.loadInfoFromHwinfo("--mouse")["list"] + customedType = Judgment_m70zg1ts() + + hwinfoList = [] + + if 1 == customedType: + hwinfoList = self.cmdTool.loadHwinfoUsbMouseinfo("--usb")["list"] + else: + hwinfoList = self.cmdTool.loadInfoFromHwinfo("--mouse")["list"] + for mapInfo in hwinfoList : if len(mapInfo) == 0 : continue diff --git a/kyasDbus/systemdaemon/karealization.py b/kyasDbus/systemdaemon/karealization.py index 5e8cde9..d115d3f 100644 --- a/kyasDbus/systemdaemon/karealization.py +++ b/kyasDbus/systemdaemon/karealization.py @@ -134,6 +134,19 @@ class DetailInfo: corePerSocket = line.split(":", 1)[1].strip() if line.startswith("Thread(s) per core:"): thread = line.split(":", 1)[1].strip() + + #采用读取/proc/cpuinfo作为备选 + if Pro_Product not in info or "" == info[Pro_Product]: + args = ["cat", "/proc/cpuinfo"] + # command = "cat /proc/cpuinfo | grep 'model name'" + extPipe = subprocess.Popen(args, env={'LANGUAGE':'en:'}, stdout=subprocess.PIPE) + extOutput = extPipe.stdout.readlines() + for extLine in extOutput: + extLine = bytes.decode(extLine.strip(),"utf-8","ignore") + if "model name" in extLine: + # print(extLine.split(":", 1)[1].strip() if info[Pro_Product] == "" else "") + info[Pro_Product] = extLine.split(":", 1)[1].strip() if info[Pro_Product] == "" else "" + break if socket != "" and corePerSocket != "" and thread != "" and info[Pro_Cores] != "" and \ socket.isdigit() and corePerSocket.isdigit() and thread.isdigit() and info[Pro_Cores].isdigit() : diff --git a/kyasDbus/systemdaemon/memoryinfothread.py b/kyasDbus/systemdaemon/memoryinfothread.py index f45fb36..d92c735 100644 --- a/kyasDbus/systemdaemon/memoryinfothread.py +++ b/kyasDbus/systemdaemon/memoryinfothread.py @@ -29,6 +29,7 @@ import json import subprocess from pprint import pprint +from string import digits from kajsondef import * from kathread import * @@ -332,6 +333,24 @@ class MemoryInfo(): summary["list"][index][MMI_TOTALCAPACITY] = str(float("%.1f" % size))+"GB" else : summary["list"][index][MMI_TOTALCAPACITY] = tempSize + elif MMI_TOTALCAPACITY in summary["list"][index]: + # 判断lshw和dmi获取的大小比较 + dmiSize = summary["list"][index][MMI_TOTALCAPACITY].replace(" ","").upper() + lshwSize = mapInfo["size"] + lshwSize = lshwSize.replace("GiB","GB") + lshwSize = lshwSize.replace("MiB","MB") + units = ["B","KB","MB","GB","TB"] + tempTable= str.maketrans('', '', digits) + size_1 = [float(s) for s in re.findall(r'-?\d+\.?\d*', lshwSize)][0] * 1024 ** units.index(lshwSize.translate(tempTable)) + size_2 = [float(s) for s in re.findall(r'-?\d+\.?\d*', dmiSize)][0] * 1024 ** units.index(dmiSize.translate(tempTable)) + if(size_1 > size_2): + if "MB" in lshwSize : + lshwSize = lshwSize.replace("MB","") + if lshwSize.isdigit() : + size = float(lshwSize)/1024.0 + summary["list"][index][MMI_TOTALCAPACITY] = str(float("%.1f" % size))+"GB" + else : + summary["list"][index][MMI_TOTALCAPACITY] = lshwSize if "vendor" in mapInfo and MMI_MANUFACTURER not in summary["list"][index]: summary["list"][index][MMI_MANUFACTURER] = mapInfo["vendor"] if "product" in mapInfo and MMI_PARTNUMBER not in summary["list"][index]: diff --git a/kyasDbus/systemdaemon/networkadaptorthread.py b/kyasDbus/systemdaemon/networkadaptorthread.py index 019957d..abcd4fc 100644 --- a/kyasDbus/systemdaemon/networkadaptorthread.py +++ b/kyasDbus/systemdaemon/networkadaptorthread.py @@ -29,6 +29,7 @@ import json import subprocess import copy import utils +import time from pprint import pprint @@ -74,7 +75,7 @@ class NetworkAdaptor(): def getNetworkAdaptorInfo(self): summary = {"list":[]} - self.cmdTool.loadInfoFromLshw(False) + self.cmdTool.loadInfoFromLshw(True) networkAdaptorList = copy.deepcopy(self.cmdTool.lshwNetworkList) for usbNetwork in self.cmdTool.lshwUsbList : if "capabilities" in usbNetwork and "Bluetooth".lower() not in usbNetwork["capabilities"].lower() and \ @@ -112,6 +113,16 @@ class NetworkAdaptor(): ##名称 if "product" in mapInfo : summary["list"][index][NetAdaptor_Product] = mapInfo["product"] + elif "bus info" in mapInfo: + if "usb" in mapInfo["bus info"] and "NetMac" in mapInfo: + # usb网卡用mac去检索hwinfo --usb + usbNetMac = mapInfo["NetMac"] + usbNetList = self.cmdTool.loadInfoFromHwinfo("--usb")["list"] + for usbItem in usbNetList: + if "HW Address" in usbItem: + if usbNetMac == usbItem["HW Address"]: + summary["list"][index][NetAdaptor_Product] = usbItem["Device"] + break ##制造商 if "Vendor" in mapInfo : @@ -120,6 +131,17 @@ class NetworkAdaptor(): summary["list"][index][NetAdaptor_Manufacturer] = hwVendor[1] else : summary["list"][index][NetAdaptor_Manufacturer] = mapInfo["Vendor"] + elif "bus info" in mapInfo: + if "usb" in mapInfo["bus info"] and "NetMac" in mapInfo: + # usb网卡用mac去检索hwinfo --usb + usbNetMac = mapInfo["NetMac"] + usbNetList = self.cmdTool.loadInfoFromHwinfo("--usb")["list"] + for usbItem in usbNetList: + if "HW Address" in usbItem: + if usbNetMac == usbItem["HW Address"]: + summary["list"][index][NetAdaptor_Manufacturer] = usbItem["Vendor"] + break + if "SubVendor" in mapInfo : hwVendor = mapInfo["SubVendor"].split("\"") if len(hwVendor) > 1 : @@ -285,6 +307,101 @@ class NetworkAdaptor(): nIndex = nIndex + 1 return outLine + #禁用网卡设备 + def disableNetCard(self, strProductAndPath) : + print(strProductAndPath) + # try: + if("|" in strProductAndPath): + strProduct,pciPath = strProductAndPath.split("|") + sysPciPath = "/sys/devices/pci0000:00/" + if Judgment_SW(): + if not os.path.exists("/sys/devices/pci0000:02/"+pciPath+"/remove") : + return False + else: + if not os.path.exists(sysPciPath+pciPath+"/remove") : + return False + youkerConfigDir = "/etc/youker-assistant" + if os.path.exists(youkerConfigDir): + pass + else: + os.mkdir(youkerConfigDir) + #写文件 + if not os.path.exists(youkerConfigDir+"/"+"netCard"): + os.popen('touch %s'%(youkerConfigDir+"/"+"netCard")) + if Judgment_SW(): + os.popen('echo "%s|%s" >> %s'%(strProduct,pciPath,youkerConfigDir+"/"+"netCard")) + os.popen('echo 1 > %s'%("/sys/devices/pci0000:02/"+pciPath+"/remove")) + else: + os.popen('echo "%s|%s" >> %s'%(strProduct,pciPath,youkerConfigDir+"/"+"netCard")) + #保存设备名称和pci写到文件中 设备名称+pci地址 而且要做区分 + os.popen('echo 1 > %s'%(sysPciPath+pciPath+"/remove")) + # except Exception as e: + # print(e) + return True + + #启用网卡设备 + def enableNetCard(self, productAndPci) : + print('------------------------------------') + print(productAndPci) + configFile = "/etc/youker-assistant/netCard" + sysPciRescanPath = "/sys/bus/pci/rescan" + youkerConfigDir = "/etc/youker-assistant" + if not os.path.exists(sysPciRescanPath) or not os.path.exists(configFile) : + return False + # 去除禁用信息 + allData = [] + with open(configFile,'r')as fd: + print(fd.readlines) + #with open(configFile,'r') as fd: + file = open(configFile,'r') + allInfo = file.readlines() + print(allInfo) + print('====================') + for info in allInfo: + #info = fd.readline() + if '' != info: + if productAndPci in info: + pass + else: + allData.append(info) + fw = open(configFile, 'w') + fw.writelines(allData) + fw.close() + # os.popen('sed -i "s/%s//g" %s'%(productAndPci,configFile)) +# os.popen('echo 1 > %s'%(sysPciRescanPath)) + subprocess.Popen("echo 1 > %s"%(sysPciRescanPath), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 扫描当前所有需要禁用的设备 + disableList = ["netCard","soundCard"] + commands = [] + for item in disableList: + print('-----------------disableList-------------------') + print(os.path.exists(youkerConfigDir + "/" + item)) + print(youkerConfigDir + "/" + item) + if os.path.exists(youkerConfigDir + "/" + item): + with open(youkerConfigDir + "/" + item, "r" ,encoding="utf-8") as file: + allLines = file.readlines() + for line in set(allLines): + line = line.strip() + print(line) + if "|" in line : + sysPciPath = "/sys/devices/pci0000:00/" + if Judgment_SW(): + sysPciPath = "/sys/devices/pci0000:02/" + strProduct,pciPath = line.strip().split("|") + count = 0 + while True and count < 30 : + if os.path.exists(sysPciPath+pciPath.strip()+"/remove"): + break + time.sleep(1) + count += 1 + if not os.path.exists(sysPciPath+pciPath.strip()+"/remove") : + return False + print('echo 1 > %s'%(sysPciPath+pciPath.strip()+"/remove")) + commands.append("echo 1 > %s"%(sysPciPath+pciPath.strip()+"/remove")) + # 遍历命令列表,并逐一执行 + for cmd in commands: subprocess.call(cmd, shell=True) + return True + if __name__ == "__main__": cmdTool = KACmdTool() cmdTool.loadInfoFromLshw() diff --git a/kyasDbus/systemdaemon/utils.py b/kyasDbus/systemdaemon/utils.py index 6e6c3e7..0c3001b 100644 --- a/kyasDbus/systemdaemon/utils.py +++ b/kyasDbus/systemdaemon/utils.py @@ -4,6 +4,7 @@ import os import re import binascii from systemboardthread import * +import platform KILOBYTE_FACTOR = 1000.0 MEGABYTE_FACTOR = (1000.0 * 1000.0) @@ -21,6 +22,16 @@ def Judgment_LENOVO(): customedType = 1 return customedType +def Judgment_m70zg1ts(): + sysBoardInfo = SystemBoard() + sysInfo = sysBoardInfo.getSystemInfo() + baseBoardInfo = sysBoardInfo.getBaseBoardInfo() + customedType = 0 ## 0 通用,1 联想 主板名称: + if Board_Manufacturer in baseBoardInfo and "lenovo" in baseBoardInfo[Board_Manufacturer].lower() \ + and Board_Product in baseBoardInfo and ("3157" in baseBoardInfo[Board_Product]) : + customedType = 1 + return customedType + def Judgment_TN133A2(): # getSystemInfo sysBoardInfo = SystemBoard() @@ -29,6 +40,17 @@ def Judgment_TN133A2(): return True return False +def Judgment_323F(): + # getSystemInfo + args = ["dmidecode","--type","11"] + pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = pipe.stdout.readlines() + for l in output: + line = bytes.decode(l.strip(),"utf-8","ignore") + if line.find("323F") >= 0: + return True + return False + def Judgment_PANGUW(): args = ["lscpu"] pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -39,11 +61,21 @@ def Judgment_PANGUW(): return True return False +def Judgment_L410(): + args = ["dmidecode", "|","grep","'String 4'"] + pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = pipe.stdout.readlines() + for l in output: + line = bytes.decode(l.strip(),"utf-8","ignore") + if line.find("KVK90") >= 0 or line.find("KVK90A"): + return True + return False + def Judgment_HW990(): if os.path.exists("/proc/hardware"): with open("/proc/hardware",'r') as fd: info = fd.readline() - if info.find("HUAWEI Kirin 990") >= 0 or info.find("kirin990") >= 0 or info.find("HUAWEI Kirin 9006C") >= 0: + if re.findall("kirin.*990", info.lower()) or info.find("HUAWEI Kirin 990") >= 0 or info.find("kirin990") >= 0 or info.find("HUAWEI Kirin 9006C") >= 0: return True else: return False @@ -54,13 +86,37 @@ def Judgment_HW9A0(): if os.path.exists("/proc/hardware"): with open("/proc/hardware",'r') as fd: info = fd.readline() - if info.find("HUAWEI Kirin 9006C") >= 0: + if re.findall("kirin.*9006c", info.lower()) or info.find("HUAWEI Kirin 9006C") >= 0: return True else: return False else: return False +def Judgment_Virt(): + args = ["systemd-detect-virt"] + pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = pipe.stdout.readlines() + for l in output: + line = bytes.decode(l.strip(),"utf-8","ignore") + if "none" == line: + return False + return True + +def Judgment_3A5000(): + arch = platform.machine() + if "loongarch64" == arch: + return True + else: + return False + +def Judgment_SW(): + arch = platform.machine() + if "sw_64" == arch: + return True + else: + return False + def myctoascii(buf): ch = bytes(buf.encode('utf-8')) asci = binascii.b2a_hex(ch) @@ -313,4 +369,4 @@ def exchangeManufacturer(manufacturer) : return manufacturer if __name__ == "__main__": - Judgment_TN133A2(); \ No newline at end of file + Judgment_TN133A2(); diff --git a/plugins/drivemanage/driveinfopage.cpp b/plugins/drivemanage/driveinfopage.cpp index ae1d9fe..c590ed8 100644 --- a/plugins/drivemanage/driveinfopage.cpp +++ b/plugins/drivemanage/driveinfopage.cpp @@ -33,6 +33,8 @@ #include #include #include +#include +#include DriveInfoPage::DriveInfoPage(QWidget *parent) : QWidget(parent) @@ -63,10 +65,38 @@ void DriveInfoPage::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){DriveInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void DriveInfoPage::onCopyContent(QString strPageInfo) +{ + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(strPageInfo); +} + +int DriveInfoPage::getBlankNum(){ + QString locale = QLocale::system().name(); + if(locale == "zh_CN"){ + return BLANKNUM; + }else{ + return BLANKNUM_EN; + } +} + +void DriveInfoPage::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + // KABaseInfoPage::mousePressEvent(event); +} + void DriveInfoPage::clearInfoItems() { QMap>::iterator itDriveInfoItems = m_mapItems.begin(); @@ -99,33 +129,37 @@ void DriveInfoPage::refreshInfoItems() driveInfo.strType == "USB controller" || driveInfo.strType == "PCI bridge" || driveInfo.strType == "SA bridge") { // 主板 - itemIcon = ":/imgres/img_res/mother-board.svg"; + itemIcon = "ukui-mother-board-symbolic"; itemName = tr("Motherboard"); uType = DRIVEINFOTYPE_MOTHERBOCARD; } else if (driveInfo.strType == "VGA compatible controller") { // 显卡 - itemIcon = ":/imgres/img_res/graphics-card.svg"; + itemIcon = "ukui-graphics-card-symbolic"; itemName = tr("Graphics Card"); uType = DRIVEINFOTYPE_GRPHICS; } else if (driveInfo.strType == "Ethernet controller") { // 网卡 - itemIcon = ":/imgres/img_res/wired.svg"; + itemIcon = "network-wired-symbolic"; itemName = tr("Wired Network Card"); uType = DRIVEINFOTYPE_NETWORK; } else if (driveInfo.strType == "Audio device") { // 声卡 - itemIcon = ":/imgres/img_res/soundcard.svg"; + itemIcon = "audio-volume-high-symbolic"; itemName = tr("Sound Card"); uType = DRIVEINFOTYPE_AUDIO; } else if (driveInfo.strType == "Network controller") { //无线网卡 - itemIcon = ":/imgres/img_res/wireless.svg"; + itemIcon = "network-wireless-signal-excellent-symbolic"; itemName = tr("Wireless Network Card"); uType = DRIVEINFOTYPE_WIFI; + } else if (driveInfo.strType == "Bluetooth Device") { //蓝牙 + itemIcon = "bluetooth-symbolic"; + itemName = tr("Bluetooth"); + uType = DRIVEINFOTYPE_BLUETOOTH; } else if (driveInfo.strType == "RAM memory" || driveInfo.strType == "SATA controller" || driveInfo.strType == "SMBus") { // 其他 - itemIcon = ":/imgres/img_res/monitor.svg"; + itemIcon = "computer-symbolic"; itemName = tr("Other"); uType = DRIVEINFOTYPE_OTHER; } else { - itemIcon = ":/imgres/img_res/monitor.svg"; + itemIcon = "computer-symbolic"; itemName = tr("Other"); uType = DRIVEINFOTYPE_OTHER; } @@ -141,6 +175,28 @@ void DriveInfoPage::refreshInfoItems() m_mapItems[uType] = listItems; } nCurIndex++; + if(driveInfo.strVersion.isEmpty()){ + mapPageInfo.insert(std::pair(QString::number(nCurIndex,10),itemName+"|"+driveInfo.strName)); + }else{ + mapPageInfo.insert(std::pair(QString::number(nCurIndex,10),itemName+"|"+driveInfo.strName+" "+driveInfo.strVersion)); + } + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(nCurIndex,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(nCurIndex,10)); + } + } + } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int i=0;i #include @@ -28,6 +30,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "kdriveinfoitem.h" #include "../../src/commondef.h" @@ -39,6 +47,7 @@ enum DI_TYPE{ DRIVEINFOTYPE_NETWORK, // 有线网卡 DRIVEINFOTYPE_AUDIO, // 声卡 DRIVEINFOTYPE_WIFI, // 无线网卡 + DRIVEINFOTYPE_BLUETOOTH, // 蓝牙 DRIVEINFOTYPE_OTHER, // 其他 }; @@ -59,9 +68,14 @@ public: void initConnections(); void updateInfoItems(QString strInfoJson); + int getBlankNum(); public slots: void onUpdateInfo(QString strInfoJson); + void onCopyContent(QString strPageInfo); + +protected: + void mousePressEvent(QMouseEvent *event); private: void clearInfoItems(); @@ -70,6 +84,9 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::map mapPageInfo; QHBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; @@ -78,6 +95,7 @@ private: QMap> m_mapItems; QMap> m_mapDriveInfo; + QMenu *m_rkeyMenu = nullptr; }; #endif // DRIVEINFOPAGE_H diff --git a/plugins/drivemanage/drivemanage.cpp b/plugins/drivemanage/drivemanage.cpp index 02dcfd6..a454fba 100644 --- a/plugins/drivemanage/drivemanage.cpp +++ b/plugins/drivemanage/drivemanage.cpp @@ -185,6 +185,16 @@ QStringList DriveManage::getDeviceDriveInfo() } } } +// 判断是否有蓝牙设备,存在蓝牙设备则添加驱动 btusb + QString btcmd = "hciconfig -a"; + + QProcess *btp = new QProcess(); + btp->start(btcmd); + btp->waitForFinished(); + if(btp->canReadLine()){ + deviceMsgList.append("Bluetooth Device: btusb;driver in use: btusb"); + } + if(tmps != ""){ deviceMsgList.append(tmps); } diff --git a/plugins/drivemanage/drivemanage.pro b/plugins/drivemanage/drivemanage.pro index 2886f44..fdea64e 100644 --- a/plugins/drivemanage/drivemanage.pro +++ b/plugins/drivemanage/drivemanage.pro @@ -1,5 +1,5 @@ -QT += widgets dbus x11extras charts +QT += widgets dbus x11extras charts svg TEMPLATE = lib CONFIG += plugin \ diff --git a/plugins/hwmonitor/hwmonitor.pro b/plugins/hwmonitor/hwmonitor.pro index 1b0445a..fc86509 100644 --- a/plugins/hwmonitor/hwmonitor.pro +++ b/plugins/hwmonitor/hwmonitor.pro @@ -1,5 +1,5 @@ -QT += widgets dbus x11extras charts +QT += widgets dbus x11extras charts svg TEMPLATE = lib CONFIG += plugin \ diff --git a/plugins/hwparam/batteryinfo.cpp b/plugins/hwparam/batteryinfo.cpp index 105e53e..702ad23 100644 --- a/plugins/hwparam/batteryinfo.cpp +++ b/plugins/hwparam/batteryinfo.cpp @@ -58,10 +58,23 @@ void BatteryInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void BatteryInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void BatteryInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -88,6 +101,9 @@ void BatteryInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -116,13 +132,33 @@ void BatteryInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Battery")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[BATTERYINFO_TITLE] = infoTitle; @@ -133,7 +169,48 @@ void BatteryInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Battery")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -60,17 +66,26 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; QMap> m_mapInfoItems; }; diff --git a/plugins/hwparam/bluetoothinfo.cpp b/plugins/hwparam/bluetoothinfo.cpp index dbde841..0c81209 100644 --- a/plugins/hwparam/bluetoothinfo.cpp +++ b/plugins/hwparam/bluetoothinfo.cpp @@ -58,10 +58,23 @@ void BluetoothInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void BluetoothInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void BluetoothInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -89,6 +102,9 @@ void BluetoothInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -114,13 +130,33 @@ void BluetoothInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Bluetooth")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[BLUETOOTHINFO_TITLE] = infoTitle; @@ -131,13 +167,92 @@ void BluetoothInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Bluetooth")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;iclear(); + if(KABaseInfoPage::bluetoothExist()){ + // 禁/启用状态判断 + bool needAdd = true; + if(KABaseInfoPage::bluetoothStatus().contains("disable")){ + QAction *enableAction = new QAction(tr("Enable "), this); + connect(enableAction, &QAction::triggered, this, [=](){enableBluetooth();}); + QList actList = m_rkeyMenu->actions(); + + for(int i = 0; i < actList.length(); i++){ + if((tr("Enable "))==actList[i]->text()){ + needAdd = false; + } + if((tr("Disable "))==actList[i]->text()){ + m_rkeyMenu->removeAction(actList[i]); + } + } + if(needAdd){ + m_rkeyMenu->addAction(enableAction); + } + }else{ + QAction *disableAction = new QAction(tr("Disable "), this); + connect(disableAction, &QAction::triggered, this, [=](){disableBluetooth();}); + QList actList = m_rkeyMenu->actions(); + + for(int i = 0; i < actList.length(); i++){ + if((tr("Disable "))==actList[i]->text()){ + needAdd = false; + } + if((tr("Enable "))==actList[i]->text()){ + m_rkeyMenu->removeAction(actList[i]); + } + } + if(needAdd){ + m_rkeyMenu->addAction(disableAction); + } + } + } qInfo()<<"Cur info:"< actList = m_rkeyMenu->actions(); + // 0表示禁用,1表示启用,2表示启用中 + int btStatus = 1; + for(int i = 0;itext()){ + btStatus = 0; + break; + }else if ((tr("Disable "))==actList[i]->text()) + { + btStatus = 2; + break; + } + } + if(0 == btStatus || 2 == btStatus){ + if(!KABaseInfoPage::bluetoothExist()){ + addInfoItems(0, BLUETOOTHINFO_INVALID, "", tr("Device not exitst or Get Device is Empty"), false); + }else{ + addInfoItems(0, BLUETOOTHINFO_INVALID, "", tr("Bluetooth Disable"), false); + } + }else{ + addInfoItems(0, BLUETOOTHINFO_INVALID, "", tr("Device not exitst or Get Device is Empty"), false); + } + } } + +void BluetoothInfo::enterLoadingPage() +{ + m_scrollFrame->hide(); + m_loadWidget = new LoadWidget(m_strDevStatus); + m_loadWidget->setModal(true); + m_loadWidget->show(); + m_refreshInfoTimer->stop(); +} + +void BluetoothInfo::exitLoadingPage() +{ + m_scrollFrame->show(); + m_loadWidget->close(); + m_refreshInfoTimer->stop(); +} + +void BluetoothInfo::disableBluetooth(){ + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = "disable"; + if(nullptr == m_refreshInfoTimer){ + m_refreshInfoTimer = new QTimer(); + } + enterLoadingPage(); + DataWorker::getInstance()->disableBluetooth(); + QObject::connect(m_refreshInfoTimer, &QTimer::timeout, [&]() { + if("" == m_strDevStatus || nullptr == m_strDevStatus || m_strInfoLastJson != m_strInfoJson ){ + exitLoadingPage(); + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = ""; + } + onRefreshInfo(); + }); + m_refreshInfoTimer->start(1000); // Start timer with 1 second interval +} + +void BluetoothInfo::enableBluetooth(){ + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = "enable"; + if(nullptr == m_refreshInfoTimer){ + m_refreshInfoTimer = new QTimer(); + } + enterLoadingPage(); + DataWorker::getInstance()->enableBluetooth(); + QObject::connect(m_refreshInfoTimer, &QTimer::timeout, [&]() { + if("" == m_strDevStatus || nullptr == m_strDevStatus || m_strInfoLastJson != m_strInfoJson ){ + exitLoadingPage(); + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = ""; + } + onRefreshInfo(); + }); + m_refreshInfoTimer->start(1000); // Start timer with 1 second interval + +} diff --git a/plugins/hwparam/bluetoothinfo.h b/plugins/hwparam/bluetoothinfo.h index 1a2f29e..8590a8d 100644 --- a/plugins/hwparam/bluetoothinfo.h +++ b/plugins/hwparam/bluetoothinfo.h @@ -26,10 +26,17 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" #include "kabaseinfopage.h" +#include "../../src/loadwidget.h" enum BLI_INDEX{ BLUETOOTHINFO_TITLE, @@ -75,20 +82,37 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); void chkNoDevice(); + void disableBluetooth(); + void enableBluetooth(); + void enterLoadingPage(); + void exitLoadingPage(); private: QString m_strInfoJson; + QString m_strPageInfo; + QString m_strInfoLastJson; + QString m_strDevStatus = nullptr; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; + LoadWidget *m_loadWidget = nullptr; QMap> m_mapInfoItems; + QTimer *m_refreshInfoTimer = nullptr; }; #endif // BLUETOOTHINFO_H diff --git a/plugins/hwparam/camerainfo.cpp b/plugins/hwparam/camerainfo.cpp index 4442635..efa7afc 100644 --- a/plugins/hwparam/camerainfo.cpp +++ b/plugins/hwparam/camerainfo.cpp @@ -58,10 +58,23 @@ void CameraInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void CameraInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void CameraInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -88,6 +101,9 @@ void CameraInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -113,13 +129,33 @@ void CameraInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, Q listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Camera")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[CAMERAINFO_TITLE] = infoTitle; @@ -130,7 +166,48 @@ void CameraInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, Q m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Camera")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -60,17 +66,26 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; QMap> m_mapInfoItems; }; diff --git a/plugins/hwparam/cdrominfo.cpp b/plugins/hwparam/cdrominfo.cpp index 25afd3e..b17be5d 100644 --- a/plugins/hwparam/cdrominfo.cpp +++ b/plugins/hwparam/cdrominfo.cpp @@ -58,10 +58,23 @@ void CDRomInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void CDRomInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void CDRomInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -89,6 +102,9 @@ void CDRomInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -117,13 +133,33 @@ void CDRomInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QS listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("CD-ROM")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[CDROMINFO_TITLE] = infoTitle; @@ -134,7 +170,48 @@ void CDRomInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QS m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("CD-ROM")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -60,6 +66,9 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); @@ -67,11 +76,17 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; QMap> m_mapInfoItems; }; diff --git a/plugins/hwparam/faninfo.cpp b/plugins/hwparam/faninfo.cpp index da40277..9e857da 100644 --- a/plugins/hwparam/faninfo.cpp +++ b/plugins/hwparam/faninfo.cpp @@ -58,11 +58,24 @@ void FanInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); m_refreshInfoTimer = new QTimer(this); } +void FanInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void FanInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -92,6 +105,9 @@ void FanInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -117,13 +133,33 @@ void FanInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QStr listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Fan")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[FANINFO_TITLE] = infoTitle; @@ -134,7 +170,48 @@ void FanInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QStr m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Network Card")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -53,6 +59,9 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); @@ -60,11 +69,17 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; QMap> m_mapInfoItems; QTimer *m_refreshInfoTimer = nullptr; diff --git a/plugins/hwparam/graphicscardinfo.cpp b/plugins/hwparam/graphicscardinfo.cpp index 377eb54..1e5341e 100644 --- a/plugins/hwparam/graphicscardinfo.cpp +++ b/plugins/hwparam/graphicscardinfo.cpp @@ -20,6 +20,7 @@ #include "graphicscardinfo.h" #include "dataworker.h" +#include "../../src/util.h" #include #include @@ -28,6 +29,7 @@ #include #include #include +#include // 格兰菲显存获取方案 #include @@ -67,10 +69,23 @@ void GraphicsCardInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void GraphicsCardInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void GraphicsCardInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -98,6 +113,9 @@ void GraphicsCardInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -125,13 +143,33 @@ void GraphicsCardInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTi listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Graphics Card")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[GRAPHICSCARDINFO_TITLE] = infoTitle; @@ -142,7 +180,48 @@ void GraphicsCardInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTi m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Graphics Card")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -72,6 +78,9 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); @@ -79,11 +88,17 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; QMap> m_mapInfoItems; }; diff --git a/plugins/hwparam/harddiskinfo.cpp b/plugins/hwparam/harddiskinfo.cpp index e83c5a3..040c2ea 100644 --- a/plugins/hwparam/harddiskinfo.cpp +++ b/plugins/hwparam/harddiskinfo.cpp @@ -20,6 +20,7 @@ #include "harddiskinfo.h" #include "dataworker.h" +#include "../../src/util.h" #include #include @@ -28,6 +29,7 @@ #include #include #include +#include HardDiskInfo::HardDiskInfo(QWidget *parent) : KABaseInfoPage(parent) @@ -58,10 +60,23 @@ void HardDiskInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void HardDiskInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void HardDiskInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -89,6 +104,9 @@ void HardDiskInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -116,13 +134,33 @@ void HardDiskInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Hard Disk Info")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[HARDDISKINFO_TITLE] = infoTitle; @@ -133,7 +171,48 @@ void HardDiskInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Hard Disk Info")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -64,6 +70,9 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); @@ -71,11 +80,17 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; QMap> m_mapInfoItems; }; diff --git a/plugins/hwparam/hwparam.pro b/plugins/hwparam/hwparam.pro index 371a7e0..18dbc9e 100644 --- a/plugins/hwparam/hwparam.pro +++ b/plugins/hwparam/hwparam.pro @@ -1,5 +1,5 @@ -QT += widgets dbus x11extras KScreen +QT += widgets dbus x11extras KScreen svg TEMPLATE = lib CONFIG += plugin \ @@ -23,8 +23,10 @@ LIBS += -lXrandr LIBS += -ludev LIBS += -lepoxy LIBS += -lSDL2 +LIBS += -lpthread PKGCONFIG += gsettings-qt +PKGCONFIG += kysdk-utils SOURCES += \ batteryinfo.cpp \ diff --git a/plugins/hwparam/kabaseinfopage.cpp b/plugins/hwparam/kabaseinfopage.cpp index 04a5b79..66c166f 100644 --- a/plugins/hwparam/kabaseinfopage.cpp +++ b/plugins/hwparam/kabaseinfopage.cpp @@ -19,6 +19,12 @@ */ #include "kabaseinfopage.h" +#include +#include +#include +#include "dataworker.h" +#include +#include KABaseInfoPage::KABaseInfoPage(QWidget *parent) : QWidget(parent) @@ -41,3 +47,154 @@ void KABaseInfoPage::onUpdateInfo(unsigned uStatus, QString strInfoJson) Q_UNUSED(uStatus); onUpdateInfo(strInfoJson); } + +void KABaseInfoPage::onCopyContent(QString strPageInfo) +{ + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(strPageInfo); +} + +void KABaseInfoPage::disableMouse(QString strProduct) +{ + QString mouseId = queryMouseId(strProduct); + if(""!=mouseId){ + QProcess p(0); + p.start("xinput disable "+mouseId); + p.waitForStarted(); + p.waitForFinished(); + }else{ + disableTooltip(); +// 该设备禁用失败 + } +// 刷新页面 + onRefreshInfo(); +} + +void KABaseInfoPage::enableMouse(QString strProduct) +{ + QString mouseId = queryMouseId(strProduct); + if(""!=mouseId){ + QProcess p(0); + p.start("xinput enable "+mouseId); + p.waitForStarted(); + p.waitForFinished(); + }else{ +// 该设备启用失败 + disableTooltip(); + } +// 刷新页面 + onRefreshInfo(); +} + +QString KABaseInfoPage::mouseStatus(QString strProduct) + { + QString status = ""; + QString mouseId = queryMouseId(strProduct); + if(""!=mouseId){ + QProcess p(0); + p.start("xinput list-props "+mouseId); + p.waitForStarted(); + p.waitForFinished(); + QString strTemp=QString::fromLocal8Bit(p.readAllStandardOutput()); //获得输出 + QStringList strList = strTemp.split("\n"); + for(int i=0;i args; + QStringList actions; //跳转动作 + QMap hints; + args< +#include class KABaseInfoPage : public QWidget { Q_OBJECT public: explicit KABaseInfoPage(QWidget *parent = nullptr); + int getBlankNum(); public slots: virtual void onRefreshInfo(); virtual void onUpdateInfo(QString strInfoJson); virtual void onUpdateInfo(unsigned uStatus, QString strInfoJson); + void onCopyContent(QString strPageInfo); + void disableMouse(QString strProduct); + void enableMouse(QString strProduct); + QString queryMouseId(QString strProduct); + QString mouseStatus(QString strProduct); + QString bluetoothStatus(); + bool bluetoothExist(); + void disableTooltip(); }; #endif // KABASEINFOPAGE_H diff --git a/plugins/hwparam/keyboardinfo.cpp b/plugins/hwparam/keyboardinfo.cpp index e2d459a..6e45bba 100644 --- a/plugins/hwparam/keyboardinfo.cpp +++ b/plugins/hwparam/keyboardinfo.cpp @@ -58,10 +58,23 @@ void KeyboardInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void KeyboardInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void KeyboardInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -89,6 +102,9 @@ void KeyboardInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -117,13 +133,33 @@ void KeyboardInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Keyboard")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[KEYBOARDINFO_TITLE] = infoTitle; @@ -134,7 +170,48 @@ void KeyboardInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Keyboard")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -58,6 +64,9 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); @@ -65,11 +74,17 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; QMap> m_mapInfoItems; }; diff --git a/plugins/hwparam/memoryinfo.cpp b/plugins/hwparam/memoryinfo.cpp index 71b5cb8..699f9cf 100644 --- a/plugins/hwparam/memoryinfo.cpp +++ b/plugins/hwparam/memoryinfo.cpp @@ -20,6 +20,7 @@ #include "memoryinfo.h" #include "dataworker.h" +#include "../../src/util.h" #include #include @@ -28,6 +29,7 @@ #include #include #include +#include MemoryInfo::MemoryInfo(QWidget *parent) : KABaseInfoPage(parent) @@ -58,10 +60,23 @@ void MemoryInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void MemoryInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void MemoryInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -89,6 +104,9 @@ void MemoryInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -114,13 +132,33 @@ void MemoryInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, Q listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Memory Info")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[MEMORYINFO_TITLE] = infoTitle; @@ -131,7 +169,48 @@ void MemoryInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, Q m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Memory Info")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -68,6 +74,9 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); @@ -75,11 +84,17 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + QMenu *m_rkeyMenu = nullptr; QMap> m_mapInfoItems; }; diff --git a/plugins/hwparam/monitorinfo.cpp b/plugins/hwparam/monitorinfo.cpp index 2555306..4c40f43 100644 --- a/plugins/hwparam/monitorinfo.cpp +++ b/plugins/hwparam/monitorinfo.cpp @@ -71,14 +71,21 @@ void MonitorInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); +} -// QObject::connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, -// [&](KScreen::ConfigOperation *op) { -// this->setConfig(qobject_cast(op)->config()); -// }); - +void MonitorInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); } void MonitorInfo::onUpdateInfo(QString strInfoJson) @@ -160,6 +167,9 @@ void MonitorInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -187,13 +197,33 @@ void MonitorInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Monitor")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[MONITORINFO_TITLE] = infoTitle; @@ -204,7 +234,48 @@ void MonitorInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Monitor")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -74,6 +80,7 @@ private Q_SLOTS: protected: virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; + void mousePressEvent(QMouseEvent *event); private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); @@ -85,6 +92,11 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; @@ -94,7 +106,7 @@ private: QMap> m_mapInfoItems; int m_xrrEventBase = 0; int m_xrrErrorBase = 0; - + QMenu *m_rkeyMenu = nullptr; #if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0) KScreen::ConfigPtr mConfig; KScreen::ConfigPtr mPrevConfig; @@ -104,7 +116,6 @@ private: KScreen::ConfigPtr mPrevConfig = nullptr; KScreen::OutputPtr res = nullptr; #endif - }; #endif // MONITORINFO_H diff --git a/plugins/hwparam/motherboardinfo.cpp b/plugins/hwparam/motherboardinfo.cpp index 27fa5e1..f349392 100644 --- a/plugins/hwparam/motherboardinfo.cpp +++ b/plugins/hwparam/motherboardinfo.cpp @@ -57,10 +57,23 @@ void MotherBoardInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void MotherBoardInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void MotherBoardInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -99,6 +112,24 @@ void MotherBoardInfo::addInfoItems(unsigned uId, QString strTitle, QString strCo listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); m_mapItem[uId] = listItem; + mapPageInfo.insert(std::pair( QString::number(uId,10),strTitle+"|"+strContent)); + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kabaseinfopage.h" @@ -57,6 +63,9 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uId, QString strTitle, QString strContent); void clearInfoItems(); @@ -64,6 +73,9 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::map mapPageInfo; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; @@ -71,6 +83,7 @@ private: QScrollArea *m_scrollFrame = nullptr; QMap m_mapItem; + QMenu *m_rkeyMenu = nullptr; }; #endif // MOTHERBOARDINFO_H diff --git a/plugins/hwparam/mouseinfo.cpp b/plugins/hwparam/mouseinfo.cpp index 2a05976..c6debe7 100644 --- a/plugins/hwparam/mouseinfo.cpp +++ b/plugins/hwparam/mouseinfo.cpp @@ -58,10 +58,23 @@ void MouseInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void MouseInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void MouseInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -89,6 +102,9 @@ void MouseInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -117,13 +133,33 @@ void MouseInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QS listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Mouse")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[MOUSEINFO_TITLE] = infoTitle; @@ -134,11 +170,56 @@ void MouseInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QS m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Mouse")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;iclear(); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); if (strInfoJson.isEmpty()) return; qInfo()<<"Cur info:"< actList = m_rkeyMenu->actions(); + + for(int i=0;itext()){ + needAdd = false; + break; + } + } + if(needAdd){ + m_rkeyMenu->addAction(enableAction); + } + continue; + }else{ + QAction *disableAction = new QAction(tr("Disabled ")+strContent, this); + connect(disableAction, &QAction::triggered, this, [=](){KABaseInfoPage::disableMouse(strContent);}); + QList actList = m_rkeyMenu->actions(); + + for(int i=0;itext()){ + needAdd = false; + break; + } + } + if(needAdd){ + m_rkeyMenu->addAction(disableAction); + } + } + } addInfoItems(n, MOUSEINFO_NAME, tr("Name"), subItemValue.toString(), bMulti); } // subItemValue = subItemObj.value(MSI_DEVTYPE); @@ -178,7 +294,11 @@ void MouseInfo::updateInfoItems(QString strInfoJson) } subItemValue = subItemObj.value(MSI_MANUFACTURER); if (subItemValue.isString()) { - addInfoItems(n, MOUSEINFO_MANUFACTURER, tr("Manufacurer"), subItemValue.toString(), bMulti); + if(QString::fromLocal8Bit("0x0911") == subItemValue.toString() ){ + addInfoItems(n, MOUSEINFO_MANUFACTURER, tr("Manufacurer"), QString::fromLocal8Bit("Hantick"), bMulti); + }else{ + addInfoItems(n, MOUSEINFO_MANUFACTURER, tr("Manufacurer"), subItemValue.toString(), bMulti); + } } subItemValue = subItemObj.value(MSI_INTERFACE); if (subItemValue.isString()) { @@ -211,6 +331,19 @@ void MouseInfo::chkNoDevice() infoSize += itMapInfoItems.value().size(); } if (infoSize == 0) { - addInfoItems(0, MOUSEINFO_INVALID, "", tr("Device not exitst or Get Device is Empty"), false); + QList actList = m_rkeyMenu->actions(); + // 0表示Disabled ,1表示Enable ,2表示Enable 中 + int btStatus = 1; + for(int i=0;itext().contains(tr("Enable "))){ + btStatus = 0; + break; + } + } + if( 0 == btStatus ){ + addInfoItems(0, MOUSEINFO_INVALID, "", tr("Mouse device disabled"), false); + }else{ + addInfoItems(0, MOUSEINFO_INVALID, "", tr("Device not exitst or Get Device is Empty"), false); + } } } diff --git a/plugins/hwparam/mouseinfo.h b/plugins/hwparam/mouseinfo.h index 48eae84..8302f3c 100644 --- a/plugins/hwparam/mouseinfo.h +++ b/plugins/hwparam/mouseinfo.h @@ -26,6 +26,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" @@ -58,6 +64,9 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); @@ -65,6 +74,11 @@ private: private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; @@ -72,6 +86,7 @@ private: QScrollArea *m_scrollFrame = nullptr; QMap> m_mapInfoItems; + QMenu *m_rkeyMenu = nullptr; }; #endif // MOUSEINFO_H diff --git a/plugins/hwparam/netcardinfo.cpp b/plugins/hwparam/netcardinfo.cpp index 8ff859c..b56b45d 100644 --- a/plugins/hwparam/netcardinfo.cpp +++ b/plugins/hwparam/netcardinfo.cpp @@ -20,6 +20,7 @@ #include "netcardinfo.h" #include "dataworker.h" +#include "../../src/util.h" #include #include @@ -28,11 +29,13 @@ #include #include #include +#include NetCardInfo::NetCardInfo(QWidget *parent) : KABaseInfoPage(parent) { m_strInfoJson = ""; + m_strInfoLastJson = ""; initUI(); initConnections(); } @@ -58,8 +61,22 @@ void NetCardInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); + m_refreshInfoTimer = new QTimer(this); +} + +void NetCardInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); } void NetCardInfo::onUpdateInfo(QString strInfoJson) @@ -89,6 +106,9 @@ void NetCardInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -114,13 +134,33 @@ void NetCardInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Network Card")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[NETCARDINFO_TITLE] = infoTitle; @@ -131,13 +171,84 @@ void NetCardInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Network Card")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i 0 ){ + for(int i = 0 ; i < disableList.size() ; i++){ + if(disableList[i].contains("|")){ + QString strProduct = disableList[i].split("|")[0]; + QString strPciPath = disableList[i].split("|")[1]; + if(!strProduct.isEmpty()){ + bool needAdd = true; + QAction *disableAction = new QAction(tr("Enable ") + strProduct, this); + qDebug()<<"---------------------------------------"< actList = m_rkeyMenu->actions(); + for(int i = 0 ; i < actList.length() ; i++){ + if((tr("Enable ") + strProduct) == actList[i]->text()){ + needAdd = false; + } + if((tr("Disable ") + strProduct) == actList[i]->text()){ + m_rkeyMenu->removeAction(actList[i]); + } + } + if(needAdd){ + m_rkeyMenu->addAction(disableAction); + } +// addInfoItems(0, VOICECARDINFO_NAME, tr("Name"), strProduct, true); + // onRefreshInfo(); + } + } + } + } qInfo()<<"Cur info:"< actList = m_rkeyMenu->actions(); + + for(int i=0;itext()){ + needAdd = false; + } + if((tr("Enable ")+strContent)==actList[i]->text()){ + m_rkeyMenu->removeAction(actList[i]); + } + } + if(needAdd){ + m_rkeyMenu->addAction(disableAction); + } + } addInfoItems(n, NETCARDINFO_NAME, tr("Name"), subItemValue.toString(), bMulti); } subItemValue = subItemObj.value(NWI_TYPE); @@ -222,11 +353,29 @@ void NetCardInfo::updateInfoItems(QString strInfoJson) } subItemValue = subItemObj.value(NWI_RECVBYTES); if (subItemValue.isString()) { - addInfoItems(n, NETCARDINFO_RECVBYTES, tr("Bytes Received"), subItemValue.toString(), bMulti); + QString data = subItemValue.toString(); + char result_data[128] = {0}; + KDKVolumeBaseType unit = Util::getVolumeUnit(data); + + char* volume = Util::getVolume(data,unit); + if(kdkVolumeBaseCharacterConvert(volume, unit, result_data) == KDK_NOERR){ + addInfoItems(n, NETCARDINFO_RECVBYTES, tr("Bytes Received"), QString::fromUtf8(result_data), bMulti); + }else{ + addInfoItems(n, NETCARDINFO_RECVBYTES, tr("Bytes Received"), subItemValue.toString(), bMulti); + } } subItemValue = subItemObj.value(NWI_SENDBYTES); if (subItemValue.isString()) { - addInfoItems(n, NETCARDINFO_SENDBYTES, tr("Bytes Sent"), subItemValue.toString(), bMulti); + QString data = subItemValue.toString(); + char result_data[128] = {0}; + KDKVolumeBaseType unit = Util::getVolumeUnit(data); + + char* volume = Util::getVolume(data,unit); + if(kdkVolumeBaseCharacterConvert(volume, unit, result_data) == KDK_NOERR){ + addInfoItems(n, NETCARDINFO_SENDBYTES, tr("Bytes Sent"), QString::fromUtf8(result_data), bMulti); + }else{ + addInfoItems(n, NETCARDINFO_SENDBYTES, tr("Bytes Sent"), subItemValue.toString(), bMulti); + } } } } @@ -247,6 +396,168 @@ void NetCardInfo::chkNoDevice() infoSize += itMapInfoItems.value().size(); } if (infoSize == 0) { - addInfoItems(0, NETCARDINFO_INVALID, "", tr("Device not exitst or Get Device is Empty"), false); + QStringList disableList = NetCardInfo::netCardStatus(); + if(disableList.size() > 0 ){ + for(int i = 0 ; i < disableList.size() ; i++){ + if(disableList[i].contains("|")){ + QString strProduct = disableList[i].split("|")[0]; + QString strPciPath = disableList[i].split("|")[1]; + if(!strProduct.isEmpty()){ + bool needAdd = true; + QAction *disableAction = new QAction(tr("Enable ") + strProduct, this); + connect(disableAction, &QAction::triggered, this, [=](){NetCardInfo::enableNetCard(disableList[i]);}); + QList actList = m_rkeyMenu->actions(); + for(int i = 0 ; i < actList.length() ; i++){ + if((tr("Enable ") + strProduct) == actList[i]->text()){ + needAdd = false; + } + if((tr("Disable ") + strProduct) == actList[i]->text()){ + m_rkeyMenu->removeAction(actList[i]); + } + } + if(needAdd){ + m_rkeyMenu->addAction(disableAction); + } +// addInfoItems(0, VOICECARDINFO_NAME, tr("Name"), strProduct, true); + // onRefreshInfo(); + } + } + } + addInfoItems(0, NETCARDINFO_INVALID, "", tr("Network card device is disabled"), false); + }else{ + addInfoItems(0, NETCARDINFO_INVALID, "", tr("Device not exitst or Get Device is Empty"), false); + } } } + +void NetCardInfo::enterLoadingPage() +{ + m_refreshInfoTimer->stop(); + m_scrollFrame->hide(); + m_loadWidget = new LoadWidget(m_strDevStatus); + m_loadWidget->setModal(true); + m_loadWidget->show(); +} + +void NetCardInfo::exitLoadingPage() +{ + m_refreshInfoTimer->stop(); + m_scrollFrame->show(); + m_loadWidget->close(); +} + +void NetCardInfo::disableNetCard(QString strProduct) +{ + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = "disable"; + // 拉起加载中后,重置status + enterLoadingPage(); + m_strDevStatus = ""; + qDebug()<<"--------------------"<disableNetCard(strProduct,sysPciPath); + m_strDevStatus = "disable"; + }else{ + // sw架构单独处理 + QProcess p(0); + p.start("uname -a"); + p.waitForStarted(); + p.waitForFinished(); + QString strArchTemp=QString::fromLocal8Bit(p.readAllStandardOutput()); + if(strArchTemp.contains("sw_64") and sysPciPath.contains("/devices/pci0000:02") and !(sysPciPath.contains("usb"))){ + sysPciPath = sysPciPath.replace(" SysFS Device Link: /devices/pci0000:02/",""); + DataWorker::getInstance()->disableNetCard(strProduct,sysPciPath); + m_strDevStatus = "disable"; + }else{ + break; + } + } + }else{ + break; + } + qDebug()<start(5000); // Start timer with 1 second interval + //exitLoadingPage(); + }else{ + disableTooltip(); + exitLoadingPage(); + } +} + +void NetCardInfo::enableNetCard(QString strProductAndPci) +{ + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = "enable"; + enterLoadingPage(); + if(!strProductAndPci.isEmpty()){ + DataWorker::getInstance()->enableNetCard(strProductAndPci); + // m_strDevStatus = "enable"; + } + // 当数据和上一次数据不同时,表示刷新完成 + // QTimer *timer = new QTimer(); + if(nullptr == m_refreshInfoTimer){ + m_refreshInfoTimer = new QTimer(); + } + QObject::connect(m_refreshInfoTimer, &QTimer::timeout, [&]() { + if("" == m_strDevStatus || nullptr == m_strDevStatus || m_strInfoLastJson != m_strInfoJson ){ + exitLoadingPage(); + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = ""; + } + onRefreshInfo(); + }); + m_refreshInfoTimer->start(5000); // Start timer with 1 second interval +} + +/* + 返回禁用的声卡设备 +*/ +QStringList NetCardInfo::netCardStatus() +{ + QStringList disableList; + QProcess p(0); + p.start("cat /etc/youker-assistant/netCard"); + p.waitForStarted(); + p.waitForFinished(); + QString strTemp=QString::fromLocal8Bit(p.readAllStandardOutput()); //获得输出 + if(strTemp.isEmpty() || strTemp.contains("/etc/youker-assistant/netCard")){ + return disableList; + } + disableList = strTemp.split("\n"); + return disableList; +} diff --git a/plugins/hwparam/netcardinfo.h b/plugins/hwparam/netcardinfo.h index 03b2da0..89e813a 100644 --- a/plugins/hwparam/netcardinfo.h +++ b/plugins/hwparam/netcardinfo.h @@ -26,10 +26,17 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" #include "kabaseinfopage.h" +#include "../../src/loadwidget.h" enum NWI_INDEX{ NETCARDINFO_TITLE, @@ -66,20 +73,38 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); void chkNoDevice(); + void enterLoadingPage(); + void exitLoadingPage(); + void disableNetCard(QString strProduct); + void enableNetCard(QString strProduct); + QStringList netCardStatus(); private: QString m_strInfoJson; + QString m_strPageInfo; + QString m_strInfoLastJson; + QString m_strDevStatus = nullptr; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + LoadWidget *m_loadWidget = nullptr; QMap> m_mapInfoItems; + QMenu *m_rkeyMenu = nullptr; + QTimer *m_refreshInfoTimer = nullptr; }; #endif // NETCARDINFO_H diff --git a/plugins/hwparam/processorinfo.cpp b/plugins/hwparam/processorinfo.cpp index 92fa628..57ac897 100644 --- a/plugins/hwparam/processorinfo.cpp +++ b/plugins/hwparam/processorinfo.cpp @@ -20,6 +20,7 @@ #include "processorinfo.h" #include "dataworker.h" +#include "../../src/util.h" #include #include @@ -27,6 +28,7 @@ #include #include #include +#include ProcessorInfo::ProcessorInfo(QWidget *parent) : KABaseInfoPage(parent) @@ -57,10 +59,23 @@ void ProcessorInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void ProcessorInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); +} + void ProcessorInfo::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -98,6 +113,24 @@ void ProcessorInfo::addInfoItems(unsigned uId, QString strTitle, QString strCont listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); m_mapItem[uId] = listItem; + mapPageInfo.insert(std::pair( QString::number(uId,10),strTitle+"|"+strContent)); + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int i=0;i #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kabaseinfopage.h" @@ -65,12 +71,18 @@ public slots: void onUpdateInfo(QString strInfoJson) override; void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uId, QString strTitle, QString strContent); void clearInfoItems(); private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::map mapPageInfo; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; @@ -78,6 +90,7 @@ private: QScrollArea *m_scrollFrame = nullptr; QMap m_mapItem; + QMenu *m_rkeyMenu = nullptr; }; #endif // PROCESSORINFO_H diff --git a/plugins/hwparam/voicecardinfo.cpp b/plugins/hwparam/voicecardinfo.cpp index 57b472c..5db230d 100644 --- a/plugins/hwparam/voicecardinfo.cpp +++ b/plugins/hwparam/voicecardinfo.cpp @@ -28,11 +28,15 @@ #include #include #include +#include +#include +#include "../../src/kaaboutdialog.h" VoiceCardInfo::VoiceCardInfo(QWidget *parent) : KABaseInfoPage(parent) { m_strInfoJson = ""; + m_strInfoLastJson = ""; initUI(); initConnections(); } @@ -58,8 +62,22 @@ void VoiceCardInfo::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){KABaseInfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); + m_refreshInfoTimer = new QTimer(this); +} + +void VoiceCardInfo::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + KABaseInfoPage::mousePressEvent(event); } void VoiceCardInfo::onUpdateInfo(QString strInfoJson) @@ -105,6 +123,9 @@ void VoiceCardInfo::clearInfoItems() } itMapInfoItems.value().clear(); } + mapPageInfo.clear(); + vecItems.clear(); + vecMapItems.clear(); m_mapInfoItems.clear(); } @@ -130,13 +151,33 @@ void VoiceCardInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); itMapInfoItems.value()[uId] = listItem; + m_strPageInfo.append("|"+strTitle+"|"+strContent+"\n"); + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } } } else { QMap mapItems; if (bMulti) { KAInfoTitle *infoTitle = new KAInfoTitle(QString("%1%2").arg(tr("Sound Card")).arg(m_mapInfoItems.size()+1)); - infoTitle->setMinimumHeight(30); + infoTitle->setMinimumHeight(50); infoTitle->setFixedWidth(666); m_listLayout->addWidget(infoTitle); mapItems[VOICECARDINFO_TITLE] = infoTitle; @@ -147,13 +188,81 @@ void VoiceCardInfo::addInfoItems(unsigned uGroup, unsigned uId, QString strTitle m_listLayout->addWidget(listItem); mapItems[uId] = listItem; m_mapInfoItems[uGroup] = mapItems; + if (vecMapItems.size() <= int(uGroup)){ + mapPageInfo[QString::number(uId,10)] = strTitle+"|"+strContent; + vecMapItems.push_back(mapPageInfo); + }else{ + vecMapItems[int(uGroup)][QString::number(uId,10)] = strTitle+"|"+strContent; + } + if(vecItems.size()==0){ + vecItems.push_back(vecIndex); + } + if(vecItems.size() == int(uGroup)+1){ + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + vecItems[int(uGroup)]=vecIndex; + }else{ + vecIndex.clear(); + vecIndex.push_back(QString::number(uId,10)); + vecItems.push_back(vecIndex); + } } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int j=0;j1){ + m_strPageInfo.append(QString("%1%2").arg(tr("Sound Card")).arg(j+1)+"\n"); + } + std::map temMap = vecMapItems[j]; + for(int i=0;i 0 ){ + for(int i = 0 ; i < disableList.size() ; i++){ + if(disableList[i].contains("|")){ + QString strProduct = disableList[i].split("|")[0]; + QString strPciPath = disableList[i].split("|")[1]; + if(!strProduct.isEmpty()){ + bool needAdd = true; + QAction *disableAction = new QAction(tr("Enable ") + strProduct, this); + connect(disableAction, &QAction::triggered, this, [=](){enableVoiceCard(disableList[i]);}); + QList actList = m_rkeyMenu->actions(); + for(int i = 0 ; i < actList.length() ; i++){ + if((tr("Enable ") + strProduct) == actList[i]->text()){ + needAdd = false; + } + if((tr("Disabled ") + strProduct) == actList[i]->text()){ + m_rkeyMenu->removeAction(actList[i]); + } + } + if(needAdd){ + m_rkeyMenu->addAction(disableAction); + } + // onRefreshInfo(); + } + } + } + } qDebug()<<"Cur info:"< 0 ){ + // for(int i = 0 ; i < disableList.size() ; i++){ + // if(disableList[i].contains("|")){ + // QString strProduct = disableList[i].split("|")[0]; + // QString strPciPath = disableList[i].split("|")[1]; + // if(strProduct==strTitle){ + // needAdd = false; + // break; + // } + // } + // } + // } + if(tr("Model")==strTitle){ + QAction *disableAction = new QAction(tr("Disabled ")+strContent, this); + connect(disableAction, &QAction::triggered, this, [=](){disableVoiceCard(strContent);}); + QList actList = m_rkeyMenu->actions(); + + for(int i = 0; i < actList.length() ; i++){ + if((tr("Disabled ")+strContent)==actList[i]->text()){ + needAdd = false; + } + if((tr("Enable ")+strContent)==actList[i]->text()){ + m_rkeyMenu->removeAction(actList[i]); + } + } + if(needAdd){ + m_rkeyMenu->addAction(disableAction); + } + } + addInfoItems(n, VOICECARDINFO_NAME, tr("Name"), subItemValue.toString(), bMulti); + } + subItemValue = subItemObj.value(VCI_BUSADDR); if (subItemValue.isString()) { addInfoItems(n, VOICECARDINFO_BUSADDR, tr("Bus Address"), subItemValue.toString(), bMulti); } - subItemValue = subItemObj.value(VCI_NAME); - if (subItemValue.isString()) { - addInfoItems(n, VOICECARDINFO_NAME, tr("Name"), subItemValue.toString(), bMulti); - } subItemValue = subItemObj.value(VCI_DRIVE); if (subItemValue.isString()) { addInfoItems(n, VOICECARDINFO_DRIVE, tr("Drive"), subItemValue.toString(), bMulti); @@ -224,6 +367,211 @@ void VoiceCardInfo::chkNoDevice() infoSize += itMapInfoItems.value().size(); } if (infoSize == 0) { - addInfoItems(0, VOICECARDINFO_INVALID, "", tr("Device not exitst or Get Device is Empty"), false); + qDebug()<<"==================infoSize============"; + QStringList disableList = soundCardStatus(); + qDebug()< 0 ){ + for(int i = 0 ; i < disableList.size() ; i++){ + if(disableList[i].contains("|")){ + QString strProduct = disableList[i].split("|")[0]; + QString strPciPath = disableList[i].split("|")[1]; + if(!strProduct.isEmpty()){ + bool needAdd = true; + QAction *disableAction = new QAction(tr("Enable ") + strProduct, this); + connect(disableAction, &QAction::triggered, this, [=](){enableVoiceCard(disableList[i]);}); + QList actList = m_rkeyMenu->actions(); + for(int i = 0 ; i < actList.length() ; i++){ + if((tr("Enable ") + strProduct) == actList[i]->text()){ + needAdd = false; + } + if((tr("Disabled ") + strProduct) == actList[i]->text()){ + m_rkeyMenu->removeAction(actList[i]); + } + } + if(needAdd){ + m_rkeyMenu->addAction(disableAction); + } +// addInfoItems(0, VOICECARDINFO_NAME, tr("Name"), strProduct, true); + // onRefreshInfo(); + } + } + } + addInfoItems(0, VOICECARDINFO_INVALID, "", tr("Sound card device is disabled"), false); + }else{ + addInfoItems(0, VOICECARDINFO_INVALID, "", tr("Device not exitst or Get Device is Empty"), false); + } } } + +void VoiceCardInfo::enterLoadingPage() +{ + m_refreshInfoTimer->stop(); + m_scrollFrame->hide(); + m_loadWidget = new LoadWidget(m_strDevStatus); + m_loadWidget->setModal(true); + m_loadWidget->show(); +} + +void VoiceCardInfo::exitLoadingPage() +{ + m_refreshInfoTimer->stop(); + m_scrollFrame->show(); + m_loadWidget->close(); +} + +void VoiceCardInfo::enableVoiceCard(QString strProductAndPci) +{ + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = "enable"; + this->enterLoadingPage(); + + if(!strProductAndPci.isEmpty()){ + DataWorker::getInstance()->enableSoundCard(strProductAndPci); + // DevControl *dev = new DevControl(); + // dev->setMethod("enableSoundCard"); + // dev->setProductAndPci(strProductAndPci); + // dev->start(); + // dev->quit(); + // delete dev; + // m_strDevStatus = "enable"; + } + // 当数据和上一次数据不同时,表示刷新完成 + // QTimer *timer = new QTimer(); + if(nullptr == m_refreshInfoTimer){ + m_refreshInfoTimer = new QTimer(); + } + QObject::connect(m_refreshInfoTimer, &QTimer::timeout, [&]() { + if("" == m_strDevStatus || nullptr == m_strDevStatus || m_strInfoLastJson != m_strInfoJson ){ + exitLoadingPage(); + m_strInfoLastJson = m_strInfoJson; + m_strDevStatus = ""; + } + qDebug() << "------------------上一次信息" <start(5000); // Start timer with 1 second interval +} + +/* + 返回禁用的声卡设备 +*/ +QStringList VoiceCardInfo::soundCardStatus() +{ + QStringList disableList; + QProcess p(0); + p.start("cat /etc/youker-assistant/soundCard"); + p.waitForStarted(); + p.waitForFinished(); + QString strTemp=QString::fromLocal8Bit(p.readAllStandardOutput()); //获得输出 + qDebug()<<"\\\\\\\\"<enterLoadingPage(); + m_strDevStatus = ""; + qDebug()<<"--------------------"<disableSoundCard(strProduct,sysPciPath); + m_strDevStatus = "disable"; + // DevControl *dev = new DevControl(); + // dev->setMethod("disableSoundCard"); + // dev->setProduct(strProduct); + // dev->setSysPciPath(sysPciPath); + // dev->start(); + // dev->quit(); + // delete dev; + // onRefreshInfo(); + }else{ + // disableTooltip(); + // exitLoadingPage(); + // m_strDevStatus = ""; + break; + } + }else{ + if(strList.at(i-4).contains("SysFS ID")){ + sysPciPath = ((QString)strList.at(i-4)); + // /devices/pci0000:00/0000:00:14.3 + if(sysPciPath.contains("/devices/pci0000:00") and !(sysPciPath.contains("usb"))){ + sysPciPath = sysPciPath.replace(" SysFS ID: /devices/pci0000:00/",""); + DataWorker::getInstance()->disableSoundCard(strProduct,sysPciPath); + m_strDevStatus = "disable"; + // DevControl *dev = new DevControl(); + // dev->setMethod("disableSoundCard"); + // dev->setProduct(strProduct); + // dev->setSysPciPath(sysPciPath); + // dev->start(); + // dev->quit(); + // delete dev; + // m_strDevStatus = "disable"; + // onRefreshInfo(); + }else{ + // disableTooltip(); + // m_strDevStatus = ""; + // exitLoadingPage(); + break; + } + }else{ + // disableTooltip(); + // m_strDevStatus = ""; + // exitLoadingPage(); + break; + } + } + qDebug()<start(5000); // Start timer with 1 second interval + }else{ + disableTooltip(); + this->exitLoadingPage(); + } + + //exitLoadingPage(); +} diff --git a/plugins/hwparam/voicecardinfo.h b/plugins/hwparam/voicecardinfo.h index 98bee54..d6c493c 100644 --- a/plugins/hwparam/voicecardinfo.h +++ b/plugins/hwparam/voicecardinfo.h @@ -26,10 +26,17 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "../../src/kajsondef.h" #include "kainfotitle.h" #include "kabaseinfopage.h" +#include "../../src/loadwidget.h" enum VCI_INDEX{ VOICECARDINFO_TITLE, @@ -59,20 +66,38 @@ public slots: void onUpdateExtInfo(uint uStatus, QString strInfoJson); void onRefreshInfo() override; +protected: + void mousePressEvent(QMouseEvent *event); + private: void addInfoItems(unsigned uGroup, unsigned uId, QString strTitle, QString strContent, bool bMulti); void clearInfoItems(); void chkNoDevice(); + void enterLoadingPage(); + void exitLoadingPage(); + void disableVoiceCard(QString strProduct); + void enableVoiceCard(QString strProduct); + QStringList soundCardStatus(); private: QString m_strInfoJson; + QString m_strPageInfo; + QString m_strInfoLastJson; + QString m_strDevStatus = nullptr; + std::vector vecIndex; + std::vector> vecItems; + std::map mapPageInfo; + std::vector> vecMapItems; QVBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; QVBoxLayout *m_listLayout = nullptr; QScrollArea *m_scrollFrame = nullptr; + LoadWidget *m_loadWidget = nullptr; QMap> m_mapInfoItems; + QMenu *m_rkeyMenu = nullptr; + QTimer *m_refreshInfoTimer = nullptr; }; #endif // VOICECARDINFO_H diff --git a/plugins/machineinfo/infopage.cpp b/plugins/machineinfo/infopage.cpp index 882d2cd..5a1deb7 100644 --- a/plugins/machineinfo/infopage.cpp +++ b/plugins/machineinfo/infopage.cpp @@ -20,6 +20,7 @@ #include "infopage.h" #include "dataworker.h" +#include "../../src/util.h" #include #include @@ -33,6 +34,9 @@ #include #include #include +#include +#include +#include InfoPage::InfoPage(QWidget *parent) : QWidget(parent) @@ -63,10 +67,38 @@ void InfoPage::initUI() m_scrollFrame->setWidgetResizable(true); m_scrollFrame->setWidget(m_listFrame); + m_rkeyMenu = new QMenu(this); + QAction *copyAction = new QAction(tr("CopyAll"), this); + connect(copyAction, &QAction::triggered, this, [=](){InfoPage::onCopyContent(m_strPageInfo);}); + m_rkeyMenu->addAction(copyAction); + m_mainLayout->addWidget(m_scrollFrame); this->setLayout(m_mainLayout); } +void InfoPage::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + m_rkeyMenu->popup(event->globalPos()); + } + // KABaseInfoPage::mousePressEvent(event); +} + +void InfoPage::onCopyContent(QString strPageInfo) +{ + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(strPageInfo); +} + +int InfoPage::getBlankNum(){ + QString locale = QLocale::system().name(); + if(locale == "zh_CN"){ + return BLANKNUM; + }else{ + return BLANKNUM_EN; + } +} + void InfoPage::onUpdateInfo(QString strInfoJson) { m_strInfoJson = strInfoJson; @@ -109,6 +141,24 @@ void InfoPage::addInfoItems(unsigned uId, QString strTitle, QString strIcon, QSt listItem->setFixedWidth(666); m_listLayout->addWidget(listItem); m_mapItem[uId] = listItem; + mapPageInfo.insert(std::pair( QString::number(uId,10),strTitle+"|"+strContent)); + if (!(std::find(vecIndex.begin(),vecIndex.end(),QString::number(uId,10))!=vecIndex.end())){ + vecIndex.push_back(QString::number(uId,10)); + } + } + // 利用UID实现有序 + m_strPageInfo.clear(); + for(int i=0;i -1) { + version = rx.cap(1); + } + } + } else if (!QLocale::system().name().compare("en_US", Qt::CaseInsensitive)) { + if (str.contains("VERSION_US=")) { + QRegExp rx("VERSION_US=\"(.*)\"$"); + int pos = rx.indexIn(str); + if (pos > -1) { + version = rx.cap(1); + } + } + } else { + version = tr("Kylin Linux Desktop V10 (SP1)"); + } + } + + if (!version.isEmpty()) { addInfoItems(MACHINEINFO_OSVERSION, tr("OS Version"), - ":/imgres/img_res/osversion.svg", - valJson.toString()); + "ukui-zs-neicun-symbolic", + version); } + valJson = rootObj.value(MI_KERNELVERSION); if (valJson.isString()) { addInfoItems(MACHINEINFO_KERNELVERSION, tr("Kernel Version"), - ":/imgres/img_res/kernel-version.svg", + "ukui-zs-kernel-version-symbolic", valJson.toString()); } valJson = rootObj.value(MI_PROCESSOR); if (valJson.isString()) { addInfoItems(MACHINEINFO_PROCESSOR, tr("Processor"), - ":/imgres/img_res/processor.svg", + "ukui-zs-processor-symbolic", valJson.toString()); } valJson = rootObj.value(MI_MEMORY); if (valJson.isString()) { - addInfoItems(MACHINEINFO_MEMORY, tr("Memory"), - ":/imgres/img_res/memory.svg", - valJson.toString()); + // 判断是否为多个内存 + if(valJson.toString().contains(" / ")){ + QStringList valList = valJson.toString().split(" / "); + for (int i = 0; i < valList.size(); ++i){ + QStringList itemList = valList[i].split(" "); + QString data; + int index = 1; + if(itemList.length() >= 2) { + if(Util::isVolumeUnit(itemList[1])) { + data = itemList[0]+itemList[1]; + index = 2; + } else { + data = itemList[0]; + } + } else { + data = itemList[0]; + } + char result_data[128] = {0}; + KDKVolumeBaseType unit = Util::getVolumeUnit(data); + char* volume = Util::getVolume(data,unit); + if(kdkVolumeBaseCharacterConvert(volume, unit, result_data) == KDK_NOERR){ + QString tmpStr = QString::fromUtf8(result_data); + // 替换原数组值 + for(int j = index ; j < itemList.size() ; j++) { + tmpStr += " "+itemList[j]; + } + valList[i] = tmpStr; + addInfoItems(MACHINEINFO_MEMORY, tr("Memory"), + "ukui-zs-memory-symbolic", + valList.join(" / ")); + }else{ + addInfoItems(MACHINEINFO_MEMORY, tr("Memory"), + "ukui-zs-memory-symbolic", + valJson.toString()); + } + } + }else{ + QString valStr = valJson.toString(); + QStringList itemList = valStr.split(" "); + QString data; + int index = 1; + if(itemList.length() >= 2) { + if(Util::isVolumeUnit(itemList[1])) { + data = itemList[0]+itemList[1]; + index = 2; + } else { + data = itemList[0]; + } + } else { + data = itemList[0]; + } + char result_data[128] = {0}; + KDKVolumeBaseType unit = Util::getVolumeUnit(data); + char* volume = Util::getVolume(data,unit); + if(kdkVolumeBaseCharacterConvert(volume, unit, result_data) == KDK_NOERR){ + QString tmpStr = QString::fromUtf8(result_data); + // 替换原数组值 + for(int j = index; j < itemList.size(); j++) { + tmpStr += " "+itemList[j]; + } + addInfoItems(MACHINEINFO_MEMORY, tr("Memory"), + "ukui-zs-memory-symbolic", + tmpStr); + }else{ + addInfoItems(MACHINEINFO_MEMORY, tr("Memory"), + "ukui-zs-memory-symbolic", + valJson.toString()); + } + } } valJson = rootObj.value(MI_MAINBOARD); if (valJson.isString()) { addInfoItems(MACHINEINFO_MAINBOARD, tr("Mother Board"), - ":/imgres/img_res/mother-board.svg", + "ukui-mother-board-symbolic", valJson.toString()); } valJson = rootObj.value(MI_HARDDISK); if (valJson.isString()) { - addInfoItems(MACHINEINFO_HARDDISK, tr("Hard Disk"), - ":/imgres/img_res/hard-disk.svg", - valJson.toString()); + if(valJson.toString().contains("(") && valJson.toString().contains(")")){ + QString data = valJson.toString().split("(")[1].replace(")",""); + char result_data[128] = {0}; + KDKVolumeBaseType unit = Util::getVolumeUnit(data); + + char* volume = Util::getVolume(data,unit); + if(kdkVolumeBaseCharacterConvert(volume, unit, result_data) == KDK_NOERR){ + addInfoItems(MACHINEINFO_HARDDISK, tr("Hard Disk"), + "ukui-zs-hard-disk-symbolic", + valJson.toString().split("(")[0]+"("+QString::fromUtf8(result_data)+")"); + } + }else{ + addInfoItems(MACHINEINFO_HARDDISK, tr("Hard Disk"), + "ukui-zs-hard-disk-symbolic", + valJson.toString()); + } } valJson = rootObj.value(MI_GRAPHICSCARD); if (valJson.isString()) { addInfoItems(MACHINEINFO_GRAPHICSCARD, tr("Graphics Card"), - ":/imgres/img_res/graphics-card.svg", + "ukui-graphics-card-symbolic", valJson.toString()); } valJson = rootObj.value(MI_MONITOR); if (valJson.isString()) { addInfoItems(MACHINEINFO_MONITOR, tr("Monitor"), - ":/imgres/img_res/monitor.svg", + "computer-symbolic", valJson.toString()); } valJson = rootObj.value(MI_NETWORKCARD); if (valJson.isString()) { addInfoItems(MACHINEINFO_NETWORKCARD, tr("Network Card"), - ":/imgres/img_res/network-card.svg", + "ukui-zs-network-card-symbolic", valJson.toString()); } valJson = rootObj.value(MI_SOUNDCARD); if (valJson.isString()) { addInfoItems(MACHINEINFO_SOUNDCARD, tr("Sound Card"), - ":/imgres/img_res/soundcard.svg", + "audio-volume-high-symbolic", valJson.toString()); } } } +/* 读取/etc/os-release文件的内容 */ +QStringList InfoPage::readFile(QString filepath) +{ + QStringList fileCont; + QFile file(filepath); + if (file.exists()) { + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + qWarning() << "ReadFile() failed to open" << filepath; + return QStringList(); + } + QTextStream textStream(&file); + while (!textStream.atEnd()) { + QString line = textStream.readLine(); + line.remove('\n'); + fileCont<getOutline(); diff --git a/plugins/machineinfo/infopage.h b/plugins/machineinfo/infopage.h index 5483ece..87671a9 100644 --- a/plugins/machineinfo/infopage.h +++ b/plugins/machineinfo/infopage.h @@ -21,12 +21,21 @@ #ifndef INFOPAGE_H #define INFOPAGE_H +#define BLANKNUM 10 +#define BLANKNUM_EN 20 + #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include #include "kinfolistitem.h" #include "../../src/commondef.h" @@ -61,21 +70,30 @@ public: void initConnections(); void updateInfoItems(QString strInfoJson); + int getBlankNum(); public slots: void onUpdateInfo(QString strInfoJson); void onUpdateInfo(unsigned uStatus, QString strInfoJson); void onRefreshInfo(); +protected: + void mousePressEvent(QMouseEvent *event); + signals: void updateInfo(unsigned, QString); private: void addInfoItems(unsigned uId, QString strTitle, QString strIcon, QString strContent); void clearInfoItems(); + void onCopyContent(QString strPageInfo); + QStringList readFile(QString filepath); private: QString m_strInfoJson; + QString m_strPageInfo; + std::vector vecIndex; + std::map mapPageInfo; QHBoxLayout *m_mainLayout = nullptr; QFrame *m_listFrame = nullptr; @@ -83,6 +101,7 @@ private: QScrollArea *m_scrollFrame = nullptr; QMap m_mapItem; + QMenu *m_rkeyMenu = nullptr; }; #endif // INFOPAGE_H diff --git a/plugins/machineinfo/machineinfo.pro b/plugins/machineinfo/machineinfo.pro index c875597..7b52c56 100644 --- a/plugins/machineinfo/machineinfo.pro +++ b/plugins/machineinfo/machineinfo.pro @@ -1,5 +1,5 @@ -QT += widgets dbus x11extras +QT += widgets dbus x11extras svg TEMPLATE = lib CONFIG += plugin \ @@ -18,6 +18,7 @@ INSTALLS += target LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt PKGCONFIG += gsettings-qt +PKGCONFIG += kysdk-utils SOURCES += \ infopage.cpp \ diff --git a/src/img_res/ukui-occupation-map-dark.png b/src/img_res/ukui-occupation-map-dark.png new file mode 100644 index 0000000..bfddd4e Binary files /dev/null and b/src/img_res/ukui-occupation-map-dark.png differ diff --git a/src/img_res/ukui-occupation-map.png b/src/img_res/ukui-occupation-map.png new file mode 100644 index 0000000..839dc40 Binary files /dev/null and b/src/img_res/ukui-occupation-map.png differ diff --git a/src/kajsondef.h b/src/kajsondef.h index 3d2d01e..8146ab6 100644 --- a/src/kajsondef.h +++ b/src/kajsondef.h @@ -146,6 +146,7 @@ #define HDI_READSPEED "read_speed" //磁盘读取速度 #define HDI_WRITESPEED "write_speed" //磁盘写入速度 #define HDI_FIRMWAREVER "firmware_ver" //固件版本 +#define HDI_UFS "disk_ufs" //UFS 版本 #define MNI_ROOT "monitor" //显示器 #define MNI_MANUFACTURER "manufacturer" //显示器厂商 diff --git a/src/kleftwidget.cpp b/src/kleftwidget.cpp index 0332a9a..669e13c 100644 --- a/src/kleftwidget.cpp +++ b/src/kleftwidget.cpp @@ -82,6 +82,16 @@ void KLeftWidget::initUI() m_buttonGroup = new QButtonGroup(this); m_buttonGroup->setExclusive(true); + m_kNavigationBar = new KNavigationBar(this); +// QStandardItem* item = new QStandardItem("this"); +// QStandardItem* item2 = new QStandardItem("this2"); +// m_nav->addItem(item); +// m_nav->addItem(item2); +// new QStandardItem(QIcon(":/res/img/txt.png"),QStringLiteral("文本")); + + m_itemsLayout->addWidget(m_kNavigationBar); + + m_verticalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Expanding); m_itemsLayout->addItem(m_verticalSpacer); @@ -102,23 +112,48 @@ int KLeftWidget::addItems(QString strText, QString strTip, QString strIcon) int nLength = m_buttonGroup->buttons().length(); leftsidebarBtn->setChecked(false); - m_buttonGroup->addButton(leftsidebarBtn, nLength); - m_itemsLayout->addWidget(leftsidebarBtn); + // m_buttonGroup->addButton(leftsidebarBtn, nLength); + // m_itemsLayout->addWidget(leftsidebarBtn); m_itemsLayout->removeItem(m_verticalSpacer); m_itemsLayout->addItem(m_verticalSpacer); + + QIcon leftItemIcon(strIcon); + QStandardItem *leftsidebarItem = new QStandardItem(leftItemIcon,strText); + m_kNavigationBar->addItem(leftsidebarItem); + return nLength; } void KLeftWidget::initConnections() { - connect(m_buttonGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(switchPage(int))); +// connect(m_buttonGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(switchPage(int))); + connect(m_kNavigationBar->listview(), SIGNAL(clicked(QModelIndex)), this, SIGNAL(switchPage(QModelIndex))); +// QModelIndex } -void KLeftWidget::onSwichPanel(int nIndex) +// void KLeftWidget::onSwichPanel(int nIndex) +// { +// // QPushButton *sideButton = qobject_cast(m_buttonGroup->button(nIndex)); +// // if (sideButton) { +// // sideButton->setChecked(true); +// // } + +// QStandardItem *sideButton = qobject_cast(m_kNavigationBar->model()->itemFromIndex(nIndex)); +// if (sideButton) { +// sideButton->setCheckState(true); +// } +// } + +void KLeftWidget::onSwichPanel(QModelIndex nIndex) { - QPushButton *sideButton = qobject_cast(m_buttonGroup->button(nIndex)); +// QPushButton *sideButton = qobject_cast(m_buttonGroup->button(nIndex)); +// if (sideButton) { +// sideButton->setChecked(true); +// } + + QStandardItem *sideButton = (m_kNavigationBar->model()->itemFromIndex(nIndex)); if (sideButton) { - sideButton->setChecked(true); + sideButton->setCheckState(Qt::Checked); } } diff --git a/src/kleftwidget.h b/src/kleftwidget.h index b02a305..53e3caa 100644 --- a/src/kleftwidget.h +++ b/src/kleftwidget.h @@ -31,6 +31,10 @@ #include #include "kleftsideitem.h" +#include "kwidget.h" +#include +#include +using namespace kdk; class KLeftWidget : public QWidget { @@ -45,10 +49,11 @@ public: int currentIndex(); public slots: - void onSwichPanel(int nIndex); + // void onSwichPanel(int nIndex); + void onSwichPanel(QModelIndex nIndex); signals: - void switchPage(int nIndex); + void switchPage(QModelIndex nIndex); private: void initThemeMode(); @@ -57,6 +62,7 @@ private: QButtonGroup *m_buttonGroup = nullptr; QLabel *m_labelTitle = nullptr; QLabel *m_labelTitleIcon = nullptr; + KNavigationBar *m_kNavigationBar = nullptr; QVBoxLayout *m_mainLayout = nullptr; QHBoxLayout *m_titleLayout = nullptr; diff --git a/src/krightwidget.cpp b/src/krightwidget.cpp index a0f93dc..c18eac7 100644 --- a/src/krightwidget.cpp +++ b/src/krightwidget.cpp @@ -20,12 +20,19 @@ #include "krightwidget.h" #include "commondef.h" +#include #include #include #include #include #include #include +#include +#include +#include +#include "utils.h" +//#include "kdialog.h" +//using namespace kdk; KRightWidget::KRightWidget(QWidget *parent) : QWidget(parent) @@ -49,7 +56,7 @@ void KRightWidget::initUI() // 初始化控件 m_btnOption = new QToolButton(this); - m_btnOption->setToolTip(tr("menu")); + m_btnOption->setToolTip(tr("options")); m_btnOption->setProperty("isWindowButton", 0x01); m_btnOption->setProperty("useIconHighlightEffect", 0x2); m_btnOption->setIcon(QIcon::fromTheme("open-menu-symbolic")); @@ -87,12 +94,16 @@ void KRightWidget::initUI() m_aboutDlg->setModal(true); m_aboutDlg->show(); }else if(action->text() == tr("Help")){ - QProcess *process = new QProcess(this); - QString cmd = "kylin-user-guide"; - QStringList arg; - qDebug() << Q_FUNC_INFO; - arg << "-A" << "toolkit"; - process->start(cmd,arg); + QString serviceName = KYLIN_USER_GUIDE_SERVICE + QString("%1%2").arg("_").arg(QString::number(getuid())); + + QDBusInterface * iface = new QDBusInterface(serviceName, + KYLIN_USER_GUIDE_PATH, + KYLIN_USER_GUIDE_INTERFACE, + QDBusConnection::sessionBus(), + this); + QDBusMessage msg = iface->call(QString("showGuide"), "kylin-assistant"); + + delete iface; }else if(action->text() == tr("Exit")){ this->onCloseBtnClicked(); } @@ -141,8 +152,14 @@ void KRightWidget::initConnections() void KRightWidget::createAboutDialog() { QApplication::setOverrideCursor(Qt::WaitCursor); - - m_aboutDlg = new KAAboutDialog(this); + QApplication::setApplicationName(tr("ToolKit")); + // m_aboutDlg = new KAAboutDialog(this); + // 使用sdk + m_aboutDlg =new KAboutDialog(); + m_aboutDlg->setAppName(tr("ToolKit")); + m_aboutDlg->setAppIcon(QIcon::fromTheme("kylin-assistant")); + m_aboutDlg->setAppVersion(tr("Version:")+getKAVersion()); + m_aboutDlg->setAppSupport(tr("Service & Support: support@kylinos.cn")); QApplication::restoreOverrideCursor(); } diff --git a/src/krightwidget.h b/src/krightwidget.h index 5b3a2a4..18e31c9 100644 --- a/src/krightwidget.h +++ b/src/krightwidget.h @@ -27,7 +27,9 @@ #include #include -#include "kaaboutdialog.h" +//#include "kaaboutdialog.h" +#include "kaboutdialog.h" +using namespace kdk; class KRightWidget : public QWidget { @@ -62,7 +64,7 @@ private: QMenu *m_mainMenu = nullptr; QStackedWidget *m_stackedWidget = nullptr; - KAAboutDialog *m_aboutDlg = nullptr; + KAboutDialog *m_aboutDlg = nullptr; QVBoxLayout *m_mainLayout = nullptr; QHBoxLayout *m_titleLayout = nullptr; diff --git a/src/loadwidget.cpp b/src/loadwidget.cpp new file mode 100644 index 0000000..3a0bc55 --- /dev/null +++ b/src/loadwidget.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2021 KylinSoft Co., Ltd. + * + * Authors: + * Yang Min yangmin@kylinos.cn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "loadwidget.h" +#include "xatom-helper.h" +#include "commondef.h" + +#include +#include + +LoadWidget::LoadWidget(QWidget *parent): + QDialog(parent) +{ + this->setFixedSize(200,60); +// this->setFixedSize(600,600); + + // 添加窗管协议 + MotifWmHints hints; + hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; + hints.functions = MWM_FUNC_ALL; + hints.decorations = MWM_DECOR_BORDER; + XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints); + + initUI(); + +} + +LoadWidget::LoadWidget(QString devStatus , QWidget *parent): + QDialog(parent),m_status(devStatus) +{ + this->setFixedSize(200,60); +// this->setFixedSize(600,600); + + // 添加窗管协议 + MotifWmHints hints; + hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; + hints.functions = MWM_FUNC_ALL; + hints.decorations = MWM_DECOR_BORDER; + XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints); + + initUI(); + +} + +LoadWidget::~LoadWidget() +{ + if (qtSettings) { + delete qtSettings; + qtSettings = nullptr; + } +} + +void LoadWidget::initUI() +{ + QFont font; + font.setPixelSize(16); + + QLabel *tooltip = new QLabel(this); + tooltip->setGeometry(0,0,200,60); + tooltip->setAlignment(Qt::AlignCenter); + tooltip->setFont(font); + + if("enable" == m_status){ + tooltip->setText(tr("Enabling, please wait")); + } + + if("disable" == m_status){ + tooltip->setText(tr("Disabling, please wait")); + } + + initThemeMode(); +} + +void LoadWidget::setAppIcon(const QString &text) +{ + if(text.isEmpty() || text == ""){ + qDebug() << Q_FUNC_INFO << "arg is empty!!!"; + return; + }else{ + if(QIcon::hasThemeIcon(text)){ + title_icon->setPixmap(QIcon::fromTheme(text).pixmap(24,24)); + app_icon->setPixmap(QIcon::fromTheme(text).pixmap(96,96)); + }else{ + qDebug() << Q_FUNC_INFO << "No icon exists: " << text << " !!!"; + } + } +} + +void LoadWidget::setAppName(const QString &text) +{ + if(text.isEmpty() || text == ""){ + qDebug() << Q_FUNC_INFO << "APP name should not be empty!!!"; + return; + }else{ + title_name->setText(text); + this->setWindowTitle(text); + title_name->update(); + app_name->setText(text); + } +} + +void LoadWidget::setAppVersion(const QString &text) +{ + if(text.isEmpty() || text == ""){ + qDebug() << Q_FUNC_INFO << "APP version should not be empty!!!"; + return; + }else{ + app_version->setText(tr("VERSION")+": "+text); + } +} + +void LoadWidget::setAppDescription(const QString &text) +{ + app_description->append(text); +} + +//void AboutWidget::closeEvent(QCloseEvent *event) +//{ +// Q_UNUSED(event); +// qDebug() << Q_FUNC_INFO; +//} + +void LoadWidget::initThemeMode() +{ + const QByteArray idd(THEME_QT_SCHEMA); + if(QGSettings::isSchemaInstalled(idd)) { + qtSettings = new QGSettings(idd); + } + if (qtSettings) { + //监听主题改变 + connect(qtSettings, &QGSettings::changed, this, [=](const QString &key) + { + if (key == "styleName") { + } else if ("iconThemeName" == key) { + setAppIcon("kylin-assistant"); + } + }); + } +} + +void LoadWidget::paintEvent(QPaintEvent *event) +{ + QPainterPath path; + QPainter painter(this); + + path.addRect(this->rect()); + path.setFillRule(Qt::WindingFill); + painter.setBrush(this->palette().base()); + painter.setPen(Qt::transparent); + painter.drawPath(path); + QDialog::paintEvent(event); +} + +void LoadWidget::keyPressEvent(QKeyEvent *event) +{ + // switch (event->key()) + // { + // case Qt::Key_Escape: + // break; + // default: + QDialog::keyPressEvent(event); + // } +} diff --git a/src/loadwidget.h b/src/loadwidget.h new file mode 100644 index 0000000..784109f --- /dev/null +++ b/src/loadwidget.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2021 KylinSoft Co., Ltd. + * + * Authors: + * Yang Min yangmin@kylinos.cn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef LOADWIDGET_H +#define LOADWIDGET_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class LoadWidget : public QDialog +{ + Q_OBJECT +public: + explicit LoadWidget(QWidget *parent = nullptr); + explicit LoadWidget(QString devStatus, QWidget *parent = nullptr); + ~LoadWidget(); + + void initUI(); + // void initUI(QString *devStatus); + void setAppIcon(const QString &text); + void setAppName(const QString &text); + void setAppVersion(const QString &text); + void setAppDescription(const QString &text); +protected: +// void closeEvent(QCloseEvent *event); + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *event); + +private: + void initThemeMode(); + +private: + QString m_status; + QVBoxLayout *main_layout = nullptr; + + QLabel *title_icon = nullptr; + QLabel *title_name = nullptr; + QPushButton *close_btn = nullptr; + + QLabel *app_icon = nullptr; + QLabel *app_name = nullptr; + QLabel *app_version = nullptr; + QTextBrowser *app_description = nullptr; + + QGSettings *qtSettings = nullptr; +}; + +#endif // LOADWIDGET_H diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cd1643e..f62ce22 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -37,6 +37,7 @@ #include #include #include +#include MainWindow::MainWindow(QWidget *parent) : QFrame(parent) @@ -47,6 +48,19 @@ MainWindow::MainWindow(QWidget *parent) //this->setWindowIcon(QIcon::fromTheme("kylin-assistant")); this->setFixedSize(MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT); this->installEventFilter(this); + connect(WindowManager::self(),&WindowManager::windowAdded,this,[=](const WindowId& windowId){ + /*注意: + * 最新创建的窗体被设置为操作窗体,此demo中每个按钮对应一个接口函数调用,所有接口函数操作的窗口都是该最新创建的窗体 + */ + if (getpid() == WindowManager::getPid(windowId)) { + m_listWinIds.append(windowId); + } + }); + connect(WindowManager::self(),&WindowManager::windowRemoved,this,[=](const WindowId& windowId){ + if (m_listWinIds.contains(windowId)) { + m_listWinIds.removeOne(windowId); + } + }); initOpacityGSettings(); initUI(); initConnections(); @@ -66,7 +80,14 @@ MainWindow::~MainWindow() void MainWindow::handleMessage(const QString &msg) { qDebug() << Q_FUNC_INFO << msg; - this->hide(); + QString platform = QGuiApplication::platformName(); + if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive)) { + if (!m_listWinIds.isEmpty()) { + WindowManager::activateWindow(m_listWinIds.back()); + } + } else { + KWindowSystem::forceActiveWindow(this->winId()); + } this->show(); this->showNormal(); } @@ -87,8 +108,14 @@ void MainWindow::initUI() this->setLayout(m_mainLayout); int nDefautPage = 0; + QModelIndex* index = new QModelIndex(); +// index->row(0); +// QModelIndex +// QTimer::singleShot(0, this, [&,this,nDefautPage](){ +// this->switchPage(nDefautPage); +// }); QTimer::singleShot(0, this, [&,this,nDefautPage](){ - this->switchPage(nDefautPage); + this->switchPage(QModelIndex()); }); } @@ -141,12 +168,12 @@ void MainWindow::paintEvent(QPaintEvent *event) void MainWindow::initConnections() { - connect(m_leftWidget, SIGNAL(switchPage(int)), this, SLOT(onSwitchPage(int))); + connect(m_leftWidget, SIGNAL(switchPage(QModelIndex)), this, SLOT(onSwitchPage(QModelIndex))); connect(m_rightWidget, SIGNAL(maximizeWindow()), this, SLOT(onMaximizeWindow())); connect(m_rightWidget, SIGNAL(minimizeWindow()), this, SLOT(onMinimizeWindow())); } -void MainWindow::onSwitchPage(int nIndex) +void MainWindow::onSwitchPage(QModelIndex nIndex) { qDebug()<<"SwitchPage:"<currentIndex() != nIndex) + if (m_leftWidget->currentIndex() != nIndex.row()) m_leftWidget->onSwichPanel(nIndex); - if (m_rightWidget->currentIndex() != nIndex) { - int nListIndex = panelIndex2ListIndex(nIndex); + if (m_rightWidget->currentIndex() != nIndex.row()) { + int nListIndex = panelIndex2ListIndex(nIndex.row()); if (nListIndex >= 0 && nListIndex < m_pluginsList.size()) { PluginInterface *pluginInstance = qobject_cast(m_pluginsList[nListIndex]); pluginInstance->updatePluginContent(); } - m_rightWidget->onSwichPanel(nIndex); + m_rightWidget->onSwichPanel(nIndex.row()); } } +//void MainWindow::switchPage(int nIndex) +//{ +// if (nIndex < 0) +// return; +// if (m_leftWidget->currentIndex() != nIndex) +// m_leftWidget->onSwichPanel(nIndex); +// if (m_rightWidget->currentIndex() != nIndex) { +// int nListIndex = panelIndex2ListIndex(nIndex); +// if (nListIndex >= 0 && nListIndex < m_pluginsList.size()) { +// PluginInterface *pluginInstance = qobject_cast(m_pluginsList[nListIndex]); +// pluginInstance->updatePluginContent(); +// } +// m_rightWidget->onSwichPanel(nIndex); +// } +//} + void MainWindow::mousePressEvent(QMouseEvent *event) { QFrame::mousePressEvent(event); @@ -286,7 +329,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) KYLIN_USER_GUIDE_INTERFACE, QDBusConnection::sessionBus(), this); - QDBusMessage msg = iface->call(QString("showGuide"), "toolkit"); + QDBusMessage msg = iface->call(QString("showGuide"), "kylin-assistant"); delete iface; } diff --git a/src/mainwindow.h b/src/mainwindow.h index ed11079..0b3bae5 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -33,6 +33,9 @@ #include "kleftwidget.h" #include "krightwidget.h" +#include "windowmanager/windowmanager.h" + +using namespace kdk; class MainWindow : public QFrame { @@ -51,10 +54,11 @@ public: public slots: void handleMessage(const QString &); - void onSwitchPage(int nIndex); + void onSwitchPage(QModelIndex nIndex); void onMinimizeWindow(); void onMaximizeWindow(); - void switchPage(int nIndex); + void switchPage(QModelIndex nIndex); +// void switchPage(int nIndex); protected: void loadPlugins(); @@ -83,5 +87,7 @@ private: // plugins QDir m_pluginsDir; QList m_pluginsList; + + QList m_listWinIds; }; #endif // MAINWINDOW_H diff --git a/src/res.qrc b/src/res.qrc index ba2ef36..f97d3ad 100644 --- a/src/res.qrc +++ b/src/res.qrc @@ -34,5 +34,7 @@ img_res/wireless.svg img_res/machineinfo.svg img_res/ukui-occupation-map@2x.png + img_res/ukui-occupation-map.png + img_res/ukui-occupation-map-dark.png diff --git a/src/src.pro b/src/src.pro index 6a35dc2..30d5e4a 100644 --- a/src/src.pro +++ b/src/src.pro @@ -5,7 +5,9 @@ CONFIG += c++11 #CONFIG += qt warn_on #CONFIG += release CONFIG += link_pkgconfig -PKGCONFIG += glib-2.0 gio-unix-2.0 gsettings-qt kysdk-waylandhelper +PKGCONFIG += kysdk-qtwidgets +PKGCONFIG += glib-2.0 gio-unix-2.0 gsettings-qt +PKGCONFIG += kysdk-utils kysdk-waylandhelper QT += core dbus network charts svg KWindowSystem x11extras LIBS += -lukui-log4qt @@ -51,7 +53,9 @@ SOURCES += \ imageutil.cpp \ mainwindow.cpp \ xatom-helper.cpp \ - kaaboutdialog.cpp + kaaboutdialog.cpp \ + util.cpp \ + loadwidget.cpp HEADERS += \ commondef.h \ @@ -63,7 +67,9 @@ HEADERS += \ kleftwidget.h \ mainwindow.h \ xatom-helper.h \ - kaaboutdialog.h + kaaboutdialog.h \ + util.h \ + loadwidget.h RESOURCES += \ res.qrc diff --git a/src/translation/kylin-assistant_bo.qm b/src/translation/kylin-assistant_bo.qm index be651ee..3b997ab 100644 Binary files a/src/translation/kylin-assistant_bo.qm and b/src/translation/kylin-assistant_bo.qm differ diff --git a/src/translation/kylin-assistant_bo.ts b/src/translation/kylin-assistant_bo.ts index ff22d2c..7bf4fae 100644 --- a/src/translation/kylin-assistant_bo.ts +++ b/src/translation/kylin-assistant_bo.ts @@ -4,309 +4,363 @@ BatteryInfo - - + + + Battery - + གློག་སྨན། - + Serail Number - + སའེ་ལའེ་ཨང་གྲངས། - + Name - + མིང་། - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Model - + དཔེ་དབྱིབས་ - + State - + རྒྱལ་ཁབ། - + Percentage - + བརྒྱ་ཆའི་བསྡུར་ཚད - + Energy - + ནུས་ཁུངས། - + Energy Full - + ནུས་ཚད་ཀྱིས་ཁེངས་པ། - + Time To Empty - + སྟོང་པར་ལུས་པའི་དུས་ཚོད། - + Used Times - + བཀོལ་སྤྱོད་བྱེད་པའི་དུས་ BluetoothInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Bluetooth - + ཁ་དོག་སྔོན་པོ། - + + + + + Enable + ཇགས་གློག་ཀླད + + + + + + + Disable + བདེ་འཇགས་གློག་ཀླད་ + + + Bus Address - + སྤྱི་སྤྱོད་རླངས་འཁོར་གྱི་ - + Function - + བྱེད་ནུས། - + Frequency - + ཐེངས་གྲངས། - + Configuration - + བཀོད་སྒྲིག - + Type - + རིགས་དབྱིབས་ - + ID - + ཐོབ་ཐང་ལག་ཁྱེར། - + Model - + དཔེ་དབྱིབས་ - + Resource - + ཐོན་ཁུངས། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Version - + པར་གཞི། - + Data Width - + གཞི་གྲངས་ཀྱི་ཞེང་ཚད། - + Name - + མིང་། - + Driver - + ཁ་ལོ་བ། - + Speed - + མྱུར་ཚད། - + Serial Number - + གོ་རིམ་གྱི་ཨང་གྲངས། - + Address - + སྡོད་གནས། - + Link Mode - + སྦྲེལ་མཐུད་བྱེད་སྟངས། - + Link Policy - + སྦྲེལ་མཐུད་སྲིད་ཇུས། - + Capabilities - + ནུས་པ། - + Bus - + སྤྱི་སྤྱོད་རླངས་འཁོར། - + SCO MTU - + ཧྲང་ཧེ་མཉམ་ལས་རྩ་འཛུགས། - + ACL MTU - + ACL MTU - + Packet Type - + ཁུག་མའི་རིགས་དབྱིབས། - + Features - + ཁྱད་ཆོས། - + + Bluetooth Disable + ཁ་དོག་སྔོན་པོ།བདེ་འཇགས་གློག་ཀླད་ + + + Bluetooth Disable or Device not exitst + ལན་ཡ་བཀོལ་མི་ཆོག་པའམ་ཡང་ན་སྔོན་པོ་སོ་སྒྲིག་ཆས་ཆད་། + + + Bluetooth Disable + བདེ་འཇགས་གློག་ཀླད་ + + + + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ CDRomInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + CD-ROM - + CD-ROM - + Name - + མིང་། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Version - + པར་གཞི། - + Model - + དཔེ་དབྱིབས་ - + Serail Number - + སའེ་ལའེ་ཨང་གྲངས། - + Bus Info - + སྤྱི་སྤྱོད་རླངས་འཁོར་གྱི་ཆ་འཕྲིན - + Driver - + ཁ་ལོ་བ། - + Speed - + མྱུར་ཚད། - + Device Number - + སྒྲིག་ཆས་ཀྱི་ཨང་གྲངས། - + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ CameraInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Camera - + པར་ཆས། - + Name - + མིང་། - + Resolution - + གྲོས་ཆོད། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Model - + དཔེ་དབྱིབས་ - + Interface - + འབྲེལ་མཐུད་བྱེད་སྟངས། - + Driver - + ཁ་ལོ་བ། - + Type - + རིགས་དབྱིབས་ - + Version - + པར་གཞི། - + Bus Info - + སྤྱི་སྤྱོད་རླངས་འཁོར་གྱི་ཆ་འཕྲིན - + Speed - + མྱུར་ཚད། @@ -314,22 +368,22 @@ Current CPU frequency - + མིག་སྔའི་CPUའཕྲུལ་འཕྲིན། Current average CPU core frequency - + མིག་སྔར་ཆ་སྙོམས་ཀྱི་CPUལ་ལྟེ་བའི་ཟློས་ཕྱོད CPU FM Note: The CPU FM function has some risks, please use it carefully! After FM is completed, restarting will restore the default configuration! - + CPU FM Note: CPU FMནི་ཉེན་ཁ་ངེས་ཅན་ཞིག་ཡོད་པས་ཁྱེད་ཀྱིས་ནན་ཏན་གྱིས་བཀོལ་སྤྱོད་བྱེད་རོགས། FMལེགས་འགྲུབ་བྱུང་རྗེས་ཡང་བསྐྱར་བསྐྱར་དུ་བཀོད་སྒྲིག་བྱས་ན་སྔོན་ཆད་ཀྱི་བཀོད་སྒྲིག་སླར་གསོ་བྱེད་ཐུབ། Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ @@ -337,37 +391,37 @@ CPU Management Strategy - + CPU དོ་དམ་འཐབ་ཇུས། performance - + འཁྲབ་སྟོན་གྱི་ནུས་ powersave - + སྟོབས་ཤུགས་ཡོད་ཚད། userspace - + སྤྱོད་མཁན་གྱི་བར་སྟོང་། schedutil - + ཧྲི་ཏེ་ཐུའུ་ཨར། ondemand - + ondemand conservative - + རྙིང་ཞེན་བག་འཁུམ @@ -375,86 +429,96 @@ The equipment is normal and the heat dissipation is good - + སྒྲིག་ཆས་རྒྱུན་ལྡན་ཡིན་པ་དང་། ཚ་ནུས་མེད་པར་གྱུར་པ་ཧ་ཅང་བཟང་། Equipment temperature is high, please pay attention to heat dissipation - + སྒྲིག་ཆས་ཀྱི་དྲོད་ཚད་མཐོ་བས་ཚ་བ་སེལ་རྒྱུར་མཉམ་འཇོག་བྱོས། Equipment temperature is abnormal, please pay attention to heat dissipation - + སྒྲིག་ཆས་ཀྱི་དྲོད་ཚད་རྒྱུན་ལྡན་མིན་པས་ཚ་བ་སེལ་རྒྱུར་མཉམ་འཇོག་བྱོས། CPU Temp - + CPU Temp HARDDISK Temp - + སྲ་ཞིང་མཁྲེགས་པའི་གནས་སྐབས་ GPU Temp - + GPU Temp DEV Temp - + DEV Temp DEV Usage - + DEV བཀོལ་སྤྱོད་བྱེད་པ། CPU Usage - + CPUབཀོལ་སྤྱོད་བྱེད་པ། Memory Usage - + དྲན་ཤེས་བཀོལ་སྤྱོད་བྱེད་པ། DriveInfoPage - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + Motherboard - + པང་ལེབ། - + Graphics Card - + རི་མོའི་བྱང་བུ། - + Wired Network Card - + སྐུད་ཡོད་དྲ་རྒྱའི་བྱང་བུ། - + Sound Card - + སྒྲའི་བྱང་བུ། - + Wireless Network Card - + སྐུད་མེད་དྲ་བའི་བྱང་བུ། - - + + Bluetooth + ཁ་དོག་སྔོན་པོ། + + + + Other - + དེ་མིན། @@ -462,146 +526,164 @@ DriveManager - + ཁ་ལོ་བའི་ལག་ཤེས་འཕྲུལ་ཆས། FanInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + Fan - + རླུང་གཡབ། - + + Network Card + དྲ་རྒྱའི་བྱང་བུ། + + + Speed - + མྱུར་ཚད། - + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ GraphicsCardInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Graphics Card - + རི་མོའི་བྱང་བུ། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + SubSystem - + ཡན་ལག་མ་ལག - + Name - + མིང་། - + IsDiscrete - + དབྱི་སི་ལན་ཆོས་ཁང་། - + Memory - + དྲན་ཤེས་ - - - - + + + + + + Video Memory - + བརྙན་ཕབ་ཀྱི་དྲན་ཤེས་ - + Memory Type - + དྲན་ཤེས་ཀྱི་རིགས་ - + Model - + དཔེ་དབྱིབས་ - + Version - + པར་གཞི། - + Bit Width - + སོ་བཏབ་པའི་ཞེང་ཚད། - + Funtion - + སྤྲོ་སྣང་ལྡན་པ། - + Clock - + ཆུ་ཚོད་འཁོར་ལོ། - + Driver - + ཁ་ལོ་བ། - + Dbus Info - + Dbus ཆ་འཕྲིན། - + ID - + ཐོབ་ཐང་ལག་ཁྱེར། - + Device - + སྒྲིག་ཆས། - + GDDR Capacity - + GDDR ཤོང་ཚད། - + EGL Version - + EGLཔར་གཞི། - + EGL Client APIs - + EGL Client AIs - + GL Version - + GLཔར་གཞི། - + GLSL Version - + GLSLཔར་གཞི། - + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ @@ -609,7 +691,7 @@ HardwareMonitor - + མཁྲེགས་ཆས་ཚོད་འཛིན་བྱེད་མཁན། @@ -617,188 +699,209 @@ HardwareParam - + མཁྲེགས་ཆས་ཀྱི་ཕ་ལ་མུའུ། HardDiskInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Hard Disk Info - + སྲ་ཞིང་མཁྲེགས་པའི་ཁབ་ལེན་གྱི་ཆ་འཕྲིན། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Name - + མིང་། - + + Capacity - + ནུས་པ། - + Used Times - + བཀོལ་སྤྱོད་བྱེད་པའི་དུས་ - + Interface - + འབྲེལ་མཐུད་བྱེད་སྟངས། - + Yes - + རེད། - + No - + མིན། - + Main Disk - + གཙོ་བོ་ཁབ་ལེན་འཁོར་ལོ། - + SSD - + SSD - + HDD - + HDD - + Type - + རིགས་དབྱིབས་ - + Serial Num - + གོ་རིམ་ལྡན་པའི་ནུའུ་མུའུ། - + Model - + དཔེ་དབྱིབས་ - + Transfer Rate - + བཤུག་སྤྲོད་བྱེད་ཚད། - + Read Speed - + ཀློག་འདོན་གྱི་མྱུར་ཚད། - + Write Speed - + མྱུར་ཚད་འབྲི་བ། - + Firmware Version - + སྲ་མཁྲེགས་ཀྱི་གནས་ པར་གཞི། - + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ InfoPage - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Machine Model - + འཕྲུལ་འཁོར་གྱི་དཔེ་དབྱིབས། - + Serial Number - + གོ་རིམ་གྱི་ཨང་གྲངས། - + System Bits - + མ་ལག་གི་སོ་བཏབ་པ། - + Kernel Arch - + ནང་ཉིང་སྒྲོམ་གཞིའི་སྒྲིག་གཞི། - + Host Name + གཙོ་སྐྱོང་བྱེད་མཁན་གྱི་མིང + + + + Kylin Linux Desktop V10 (SP1) - + OS Version - + OSཔར་གཞི། - + Kernel Version - + ནང་སྙིང་གི་པར་གཞི། - + Processor - + ལས་སྣོན་འཕྲུལ་ཆས། - + + + + Memory - + དྲན་ཤེས་ - + Mother Board - + ཨ་མའི་ལས་འཛིན་ལྷན་ཚོགས - + + Hard Disk - + སྲ་ཞིང་མཁྲེགས་པའི་ཁབ་ལེན་ - + Graphics Card - + རི་མོའི་བྱང་བུ། - + Network Card - + དྲ་རྒྱའི་བྱང་བུ། - + Sound Card - + སྒྲའི་བྱང་བུ། - + Monitor - + ལྟ་ཞིབ་ཡོ་བྱད། @@ -807,22 +910,40 @@ ToolKit - + ཡོ་བྱད་ཀྱི་ཁའེ་ཐེ། VERSION: - + པར་གཞི་འདི་ལྟ་སྟེ། ToolKit provides some extended functions and users can query the hardware details of the current computer. - + ToolKitཡིས་ཁྱབ་གདལ་གྱི་ནུས་པ་ཁ་ཤས་འདོན་སྤྲོད་བྱས་ཡོད་པས། བེད་སྤྱོད་བྱེད་མཁན་གྱིས་ད་ལྟའི་རྩིས་འཁོར་གྱི་མཁྲེགས་ཆས་ཞིབ་ཕྲའི་གནས་ཚུལ་ལ་འདྲི་རྩད་བྱས་ཆོག Service & Support : - + ཞབས་ཞུ ། རྒྱབ་སྐྱོར། + + + + KABaseInfoPage + + + kylin-assistant + ཡོ་བྱད་ཀྱི་ཁའེ་ཐེ། + + + + kylin-assistant info + ལག་ཆའི་སྒམ་ཆ་འཕྲིན་ + + + + Disable failed + སྤྱོད་མི་ཆོག་པའི་ཕམ་ཁ། @@ -830,28 +951,12 @@ Used - + བཀོལ་སྤྱོད་བྱེད་པ། Left - - - - - KDriveInfoItem - - - Copy - - - - - KInfoListItem - - - Copy - + གཡོན་ཕྱོགས་པ། @@ -859,94 +964,137 @@ ToolKit - + ཡོ་བྱད་ཀྱི་ཁའེ་ཐེ། KRightWidget - menu - + ཟས་ཐོ། - + + options + གདམ་ཁ་རྐྱབས། + + + minimize - + ཉུང་དུ་གཏོང་གང་ཐུབ་བྱ་དགོས། - + close - + སྒོ་རྒྱག་པ། - - + + Help - + རོགས་རམ་བྱེད་པ། - - + + About + འབྲེལ་ཡོད་ཀྱི་སྐོར། + + + + + Exit + ཕྱིར་འཐེན་བྱེད་པ། + + + + ToolKit + ཡོ་བྱད་ཀྱི་ཁའེ་ཐེ། + + + + Version: - - - Exit + + Service & Support: <a style='color: #464646;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a> KeyboardInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Keyboard - + མཐེབ་གཞོང་། - + Name - + མིང་། - + Model - + དཔེ་དབྱིབས་ - + Manufacurer - + མན་ནུའུ་ཧྥ་ཁེ་ཡིས་བཤད་རྒྱུར། - + Interface - + འབྲེལ་མཐུད་བྱེད་སྟངས། - + Driver - + ཁ་ལོ་བ། - + Device Address - + སྒྲིག་ཆས་ཀྱི་སྡོད་གནས། - + Device not exitst or Get Device is Empty + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ + + + + LoadWidget + + + Enabling, please wait + འོག་ཏུ་འཇུག་བཞིན་འདུག + + + + Disabling, please wait + བདེ་སྲུང་གི་གནས་ཚུལ། + + + + VERSION LoadingWidget - + Scanning, please wait - + ཞིབ་བཤེར་བྱས་ནས་སྒུག་རོགས། @@ -954,7 +1102,7 @@ MachineInfo - + འཕྲུལ་ཆས་ཀྱི་ཆ་འཕྲིན། @@ -962,546 +1110,632 @@ Processor - + ལས་སྣོན་འཕྲུལ་ཆས། Memory - + དྲན་ཤེས་ Graphics Card - + རི་མོའི་བྱང་བུ། Motherboard - + པང་ལེབ། Network Card - + དྲ་རྒྱའི་བྱང་བུ། Hard Disk - + སྲ་ཞིང་མཁྲེགས་པའི་ཁབ་ལེན་ Monitor - + ལྟ་ཞིབ་ཡོ་བྱད། Sound Card - + སྒྲའི་བྱང་བུ། Keyboard - + མཐེབ་གཞོང་། Mouse - + བྱི་བ། Battery - + གློག་སྨན། CD-ROM - + CD-ROM Camera - + པར་ཆས། Bluetooth - + ཁ་དོག་སྔོན་པོ། Fan - + རླུང་གཡབ། MainWindow - + ToolKit - + ཡོ་བྱད་ཀྱི་ཁའེ་ཐེ། MemoryInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Memory Info - + དྲན་ཤེས་ཀྱི་ཆ་འཕྲིན། - + Slot - + བྲན་གཡོག - + Name - + མིང་། - + Freq - + ཧྥུ་ལེ་ཆི། - + Bus Width - + སྤྱི་སྤྱོད་རླངས་འཁོར་གྱི་ཞེང་ - + + Total Capacity - + སྤྱིའི་ཤོང་ཚད། - + Used Capacity - + བཀོལ་སྤྱོད་བྱེད་ནུས། - + Serail Num - + སེ་ར་ནུའུ་མུའུ། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Data Width - + གཞི་གྲངས་ཀྱི་ཞེང་ཚད། - + Type - + རིགས་དབྱིབས་ - + Speed - + མྱུར་ཚད། - + Config Speed - + ཁུང་ཙིའི་མྱུར་ཚད། - + Channel - + ཐབས་ལམ། - + Array Handle - + སྒྲིག་ཆས་ཀྱི་ཡུ་བ། - + Part Number - + ཆ་ཤས་ཀྱི་ཨང་གྲངས། - + Physical ID - + དངོས་པོའི་ཐོབ་ཐང་ལག་ཁྱེར - + Model - + དཔེ་དབྱིབས་ - + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ MonitorInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Monitor - + ལྟ་ཞིབ་ཡོ་བྱད། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Name - + མིང་། - + Size - + ཆེ་ཆུང་། - + Ratio - + བསྡུར་ཚད། - + Resolution - + གྲོས་ཆོད། - + MAX Resolution - + MAXཡི་གྲོས་ཆོད། - + Yes - + རེད། - + No - + མིན། - + Main Screen - + བརྙན་ཤེལ་གཙོ་བོ། - + Interface - + འབྲེལ་མཐུད་བྱེད་སྟངས། - + Visible Area - + མཐོང་ཐུབ་པའི་ས་ཁོངས། - + Product Week - + ཐོན་རྫས་གཟའ་འཁོར། - + Product Year - + ཐོན་རྫས་ལོ་འཁོར། - + Gamma - + ཀམ་མ། - + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ MotherBoardInfo - + Name - + མིང་། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Chipset - + ཉིང་ལྷེབ་ཀུང་སི། - + Serial Num - + གོ་རིམ་ལྡན་པའི་ནུའུ་མུའུ། - + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ - + Version - + པར་གཞི། - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + Publish Date - + ཁྱབ་བསྒྲགས་བྱས་པའི་ཚེས་ - + BIOS Manufacturer - + སྐྱེ་དངོས་ཐོན་སྐྱེད་བྱེད་མཁན། - + BIOS Version - + BIOSཔར་གཞི། MouseInfo - + + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Mouse - + བྱི་བ། - + + + Name - + མིང་། - + + + + Enable + ཇགས་གློག་ཀླད + + + + + Disabled + བདེ་འཇགས་གློག་ཀླད་ + + + Model - + དཔེ་དབྱིབས་ - + Manufacurer - + མན་ནུའུ་ཧྥ་ཁེ་ཡིས་བཤད་རྒྱུར། - + Interface - + འབྲེལ་མཐུད་བྱེད་སྟངས། - + Driver - + ཁ་ལོ་བ། - + Device Address - + སྒྲིག་ཆས་ཀྱི་སྡོད་གནས། - + + Mouse device disabled + བྱི་བ།བདེ་འཇགས་གློག་ཀླད་ + + + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ NetCardInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Network Card - + དྲ་རྒྱའི་བྱང་བུ། - + + + + + + Enable + ཇགས་གློག་ཀླད + + + + + Name - + མིང་། - - - + + + + + Disable + བདེ་འཇགས་གློག་ཀླད་ + + + + + Type - + རིགས་དབྱིབས་ - + Wired - + སྐུད་པ་འཐེན་པ། - + Wireless - + སྐུད་མེད་གློག་འཕྲིན། - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + Bus Address - + སྤྱི་སྤྱོད་རླངས་འཁོར་གྱི་ - + MAC - + MAC - + Driver - + ཁ་ལོ་བ། - + Link Speed - + སྦྲེལ་མཐུད་མྱུར་ཚད། - + MTU - + MTU - + IP - + ཤེས་བྱའི་ཐོན་དངོས - + Model - + དཔེ་དབྱིབས་ - + Subnet Mask - + དྲ་རྒྱའི་ཁ་བཏུམ་པ། - + Gateway - + སྒོ་ཆེན། - + DNS Server - + DNS 服务器 - + + Bytes Received - + འབྱོར་བའི་པི་ཐི་སི། - + + Bytes Sent - + པི་ཐི་སི་ཡིས་བསྐུར་བའི་འཕྲིན་ཡིག - + + Network card device is disabled + དྲ་རྒྱའི་བྱང་བུ།བདེ་འཇགས་གློག་ཀླད་ + + + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ ProcessorInfo - + Processor - + ལས་སྣོན་འཕྲུལ་ཆས། - + Slot - + བྲན་གཡོག - + Manufacturer - + ཐོན་སྐྱེད་བྱེད་མཁན། - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + Architecture - + བཟོ་སྐྲུན་རིག་པ། - + Core Num - + ལྟེ་བའི་ནུའུ་མུའུ། - + Core Online Num - + ལྟེ་བའི་དྲ་ཐོག་ནུའུ་མུའུ། - + Thread - + སྐུད་པ་ - + Max Frequency - + ཆེས་ཆེ་བའི་ཟློས་ཕྱོད། - + Frequency - + ཐེངས་གྲངས། - + L1 Cache - + L1 མྱུར་ཚད། - + + L1d Cache - + L1d མྱུར་ཚད། - + + L1i Cache - + L1i མྱུར་ཚད། - + + L2 Cache - + L2 མྱུར་ཚད། - + + L3 Cache - + L3 མྱུར་ཚད། - + Instruction Set - + མཛུབ་སྟོན་ཆ་ཚང་། - + EXT Instruction Set - + EXTཡི་མཛུབ་སྟོན་ཆ་ཚང་། - + Used - + བཀོལ་སྤྱོད་བྱེད་པ། @@ -1509,55 +1743,85 @@ app is already running! - + ཉེར་སྤྱོད་གོ་རིམ་འཁོར་སྐྱོད་བྱེད་བཞིན་ཡོད། VoiceCardInfo - + + CopyAll + འདྲ་བཟོ་བྱས་པ། + + + + Sound Card - + སྒྲའི་བྱང་བུ། - + Bus Address - + སྤྱི་སྤྱོད་རླངས་འཁོར་གྱི་ - + Name - + མིང་། - + Drive - + སྒུལ་ཤུགས་ - + + + Model - + དཔེ་དབྱིབས་ - + + + + + + Enable + ཇགས་གློག་ཀླད + + + + + + + Disabled + བདེ་འཇགས་གློག་ཀླད་ + + + Manufacurer - + མན་ནུའུ་ཧྥ་ཁེ་ཡིས་བཤད་རྒྱུར། - + Clock - + ཆུ་ཚོད་འཁོར་ལོ། - + Bit Width - + སོ་བཏབ་པའི་ཞེང་ཚད། - + + Sound card device is disabled + སྒྲའི་བྱང་བུ།བདེ་འཇགས་གློག་ཀླད་ + + + Device not exitst or Get Device is Empty - + སྒྲིག་ཆས་ཕྱིར་འབུད་མི་བྱེད་པའམ་ཡང་ན་Getསྒྲིག་ཆས་སྟོང་བ diff --git a/src/translation/kylin-assistant_de.ts b/src/translation/kylin-assistant_de.ts index c5d1686..2c73e77 100644 --- a/src/translation/kylin-assistant_de.ts +++ b/src/translation/kylin-assistant_de.ts @@ -4,58 +4,64 @@ BatteryInfo - - + + + Battery - + Serail Number - + Name - + + CopyAll + + + + Manufacturer - + Model - + State - + Percentage - + Energy - + Energy Full - + Time To Empty - + Used Times @@ -63,132 +69,164 @@ BluetoothInfo - + + CopyAll + + + + + Bluetooth - + + + + + Enable + + + + + + + + Disable + + + + Bus Address - + Function - + Frequency - + Configuration - + Type - + ID - + Model - + Resource - + Manufacturer - + Version - + Data Width - + Name - + Driver - + Speed - + Serial Number - + Address - + Link Mode - + Link Policy - + Capabilities - + Bus - + SCO MTU - + ACL MTU - + Packet Type - + Features - + + Bluetooth Disable + + + + Bluetooth Disable or Device not exitst + 蓝牙驱动已禁用或缺失蓝牙设备 + + + + Device not exitst or Get Device is Empty @@ -196,57 +234,63 @@ CDRomInfo - + + CopyAll + + + + + CD-ROM - + Name - + Manufacturer - + Version - + Model - + Serail Number - + Bus Info - + Driver - + Speed - + Device Number - + Device not exitst or Get Device is Empty @@ -254,57 +298,63 @@ CameraInfo - + + CopyAll + + + + + Camera - + Name - + Resolution - + Manufacturer - + Model - + Interface - + Driver - + Type - + Version - + Bus Info - + Speed @@ -426,33 +476,43 @@ DriveInfoPage - + + CopyAll + + + + Motherboard - + Graphics Card - + Wired Network Card - + Sound Card - + Wireless Network Card - - + + Bluetooth + + + + + Other @@ -468,17 +528,27 @@ FanInfo - + + CopyAll + + + + Fan - + + Network Card + + + + Speed - + Device not exitst or Get Device is Empty @@ -486,120 +556,128 @@ GraphicsCardInfo - + + CopyAll + + + + + Graphics Card - + Manufacturer - + SubSystem - + Name - + IsDiscrete - + Memory - - - - + + + + + + Video Memory - + Memory Type - + Model - + Version - + Bit Width - + Funtion - + Clock - + Driver - + Dbus Info - + ID - + Device - + GDDR Capacity - + EGL Version - + EGL Client APIs - + GL Version - + GLSL Version - + Device not exitst or Get Device is Empty @@ -623,97 +701,104 @@ HardDiskInfo - + + CopyAll + + + + + Hard Disk Info - + Manufacturer - + Name - + + Capacity - + Used Times - + Interface - + Yes - + No - + Main Disk - + SSD - + HDD - + Type - + Serial Num - + Model - + Transfer Rate - + Read Speed - + Write Speed - + Firmware Version - + Device not exitst or Get Device is Empty @@ -721,82 +806,96 @@ InfoPage - + + CopyAll + + + + Manufacturer - + Machine Model - + Serial Number - + System Bits - + Kernel Arch - + Host Name - + + Kylin Linux Desktop V10 (SP1) + + + + OS Version - + Kernel Version - + Processor - + + + + Memory - + Mother Board - + + Hard Disk - + Graphics Card - + Network Card - + Sound Card - + Monitor @@ -825,6 +924,24 @@ + + KABaseInfoPage + + + kylin-assistant + + + + + kylin-assistant info + + + + + Disable failed + + + KAUsageItem @@ -838,22 +955,6 @@ - - KDriveInfoItem - - - Copy - - - - - KInfoListItem - - - Copy - - - KLeftWidget @@ -865,86 +966,125 @@ KRightWidget - - menu + + options - + minimize - + close - - + + Help - - + + About - - + + Exit + + + ToolKit + + + + + Version: + + + + + Service & Support: <a style='color: #464646;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a> + + KeyboardInfo - + + CopyAll + + + + + Keyboard - + Name - + Model - + Manufacurer - + Interface - + Driver - + Device Address - + Device not exitst or Get Device is Empty + + LoadWidget + + + Enabling, please wait + + + + + Disabling, please wait + + + + + VERSION + + + LoadingWidget - + Scanning, please wait @@ -1039,7 +1179,7 @@ MainWindow - + ToolKit @@ -1047,97 +1187,104 @@ MemoryInfo - + + CopyAll + + + + + Memory Info - + Slot - + Name - + Freq - + Bus Width - + + Total Capacity - + Used Capacity - + Serail Num - + Manufacturer - + Data Width - + Type - + Speed - + Config Speed - + Channel - + Array Handle - + Part Number - + Physical ID - + Model - + Device not exitst or Get Device is Empty @@ -1145,82 +1292,88 @@ MonitorInfo - + + CopyAll + + + + + Monitor - + Manufacturer - + Name - + Size - + Ratio - + Resolution - + MAX Resolution - + Yes - + No - + Main Screen - + Interface - + Visible Area - + Product Week - + Product Year - + Gamma - + Device not exitst or Get Device is Empty @@ -1228,47 +1381,52 @@ MotherBoardInfo - + Name - + Manufacturer - + Chipset - + Serial Num - + Device not exitst or Get Device is Empty - + Version - + + CopyAll + + + + Publish Date - + BIOS Manufacturer - + BIOS Version @@ -1276,42 +1434,69 @@ MouseInfo - + + + CopyAll + + + + + Mouse - + + + Name - + + + + Enable + + + + + + Disabled + + + + Model - + Manufacurer - + Interface - + Driver - + Device Address - + + Mouse device disabled + + + + Device not exitst or Get Device is Empty @@ -1319,99 +1504,131 @@ NetCardInfo - + + CopyAll + + + + + Network Card - + + + + + + Enable + + + + + + Name - - - + + + + + Disable + + + + + + Type - + Wired - + Wireless - + Manufacturer - + Bus Address - + MAC - + Driver - + Link Speed - + MTU - + IP - + Model - + Subnet Mask - + Gateway - + DNS Server - + + Bytes Received - + + Bytes Sent - + + Network card device is disabled + + + + Device not exitst or Get Device is Empty @@ -1419,87 +1636,96 @@ ProcessorInfo - + Processor - + Slot - + Manufacturer - + + CopyAll + + + + Architecture - + Core Num - + Core Online Num - + Thread - + Max Frequency - + Frequency - + L1 Cache - + + L1d Cache - + + L1i Cache - + + L2 Cache - + + L3 Cache - + Instruction Set - + EXT Instruction Set - + Used @@ -1515,47 +1741,77 @@ VoiceCardInfo - + + CopyAll + + + + + Sound Card - + Bus Address - + Name - + Drive - + + + Model - + + + + + + Enable + + + + + + + + Disabled + + + + Manufacurer - + Clock - + Bit Width - + + Sound card device is disabled + + + + Device not exitst or Get Device is Empty diff --git a/src/translation/kylin-assistant_es.ts b/src/translation/kylin-assistant_es.ts index 79234e7..09582de 100644 --- a/src/translation/kylin-assistant_es.ts +++ b/src/translation/kylin-assistant_es.ts @@ -4,58 +4,64 @@ BatteryInfo - - + + + Battery - + Serail Number - + Name - + + CopyAll + + + + Manufacturer - + Model - + State - + Percentage - + Energy - + Energy Full - + Time To Empty - + Used Times @@ -63,132 +69,160 @@ BluetoothInfo - + + CopyAll + + + + + Bluetooth - + + + + + Enable + + + + + + + + Disable + + + + Bus Address - + Function - + Frequency - + Configuration - + Type - + ID - + Model - + Resource - + Manufacturer - + Version - + Data Width - + Name - + Driver - + Speed - + Serial Number - + Address - + Link Mode - + Link Policy - + Capabilities - + Bus - + SCO MTU - + ACL MTU - + Packet Type - + Features - + + Bluetooth Disable + + + + + Device not exitst or Get Device is Empty @@ -196,57 +230,63 @@ CDRomInfo - + + CopyAll + + + + + CD-ROM - + Name - + Manufacturer - + Version - + Model - + Serail Number - + Bus Info - + Driver - + Speed - + Device Number - + Device not exitst or Get Device is Empty @@ -254,57 +294,63 @@ CameraInfo - + + CopyAll + + + + + Camera - + Name - + Resolution - + Manufacturer - + Model - + Interface - + Driver - + Type - + Version - + Bus Info - + Speed @@ -426,33 +472,43 @@ DriveInfoPage - + + CopyAll + + + + Motherboard - + Graphics Card - + Wired Network Card - + Sound Card - + Wireless Network Card - - + + Bluetooth + + + + + Other @@ -468,17 +524,27 @@ FanInfo - + + CopyAll + + + + Fan - + + Network Card + + + + Speed - + Device not exitst or Get Device is Empty @@ -486,120 +552,128 @@ GraphicsCardInfo - + + CopyAll + + + + + Graphics Card - + Manufacturer - + SubSystem - + Name - + IsDiscrete - + Memory - - - - + + + + + + Video Memory - + Memory Type - + Model - + Version - + Bit Width - + Funtion - + Clock - + Driver - + Dbus Info - + ID - + Device - + GDDR Capacity - + EGL Version - + EGL Client APIs - + GL Version - + GLSL Version - + Device not exitst or Get Device is Empty @@ -623,97 +697,104 @@ HardDiskInfo - + + CopyAll + + + + + Hard Disk Info - + Manufacturer - + Name - + + Capacity - + Used Times - + Interface - + Yes - + No - + Main Disk - + SSD - + HDD - + Type - + Serial Num - + Model - + Transfer Rate - + Read Speed - + Write Speed - + Firmware Version - + Device not exitst or Get Device is Empty @@ -721,82 +802,96 @@ InfoPage - + + CopyAll + + + + Manufacturer - + Machine Model - + Serial Number - + System Bits - + Kernel Arch - + Host Name - + + Kylin Linux Desktop V10 (SP1) + + + + OS Version - + Kernel Version - + Processor - + + + + Memory - + Mother Board - + + Hard Disk - + Graphics Card - + Network Card - + Sound Card - + Monitor @@ -825,6 +920,24 @@ + + KABaseInfoPage + + + kylin-assistant + + + + + kylin-assistant info + + + + + Disable failed + + + KAUsageItem @@ -838,22 +951,6 @@ - - KDriveInfoItem - - - Copy - - - - - KInfoListItem - - - Copy - - - KLeftWidget @@ -865,86 +962,125 @@ KRightWidget - - menu + + options - + minimize - + close - - + + Help - - + + About - - + + Exit + + + ToolKit + + + + + Version: + + + + + Service & Support: <a style='color: #464646;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a> + + KeyboardInfo - + + CopyAll + + + + + Keyboard - + Name - + Model - + Manufacurer - + Interface - + Driver - + Device Address - + Device not exitst or Get Device is Empty + + LoadWidget + + + Enabling, please wait + + + + + Disabling, please wait + + + + + VERSION + + + LoadingWidget - + Scanning, please wait @@ -1039,7 +1175,7 @@ MainWindow - + ToolKit @@ -1047,97 +1183,104 @@ MemoryInfo - + + CopyAll + + + + + Memory Info - + Slot - + Name - + Freq - + Bus Width - + + Total Capacity - + Used Capacity - + Serail Num - + Manufacturer - + Data Width - + Type - + Speed - + Config Speed - + Channel - + Array Handle - + Part Number - + Physical ID - + Model - + Device not exitst or Get Device is Empty @@ -1145,82 +1288,88 @@ MonitorInfo - + + CopyAll + + + + + Monitor - + Manufacturer - + Name - + Size - + Ratio - + Resolution - + MAX Resolution - + Yes - + No - + Main Screen - + Interface - + Visible Area - + Product Week - + Product Year - + Gamma - + Device not exitst or Get Device is Empty @@ -1228,47 +1377,52 @@ MotherBoardInfo - + Name - + Manufacturer - + Chipset - + Serial Num - + Device not exitst or Get Device is Empty - + Version - + + CopyAll + + + + Publish Date - + BIOS Manufacturer - + BIOS Version @@ -1276,42 +1430,69 @@ MouseInfo - + + + CopyAll + + + + + Mouse - + + + Name - + + + + Enable + + + + + + Disabled + + + + Model - + Manufacurer - + Interface - + Driver - + Device Address - + + Mouse device disabled + + + + Device not exitst or Get Device is Empty @@ -1319,99 +1500,131 @@ NetCardInfo - + + CopyAll + + + + + Network Card - + + + + + + Enable + + + + + + Name - - - + + + + + Disable + + + + + + Type - + Wired - + Wireless - + Manufacturer - + Bus Address - + MAC - + Driver - + Link Speed - + MTU - + IP - + Model - + Subnet Mask - + Gateway - + DNS Server - + + Bytes Received - + + Bytes Sent - + + Network card device is disabled + + + + Device not exitst or Get Device is Empty @@ -1419,87 +1632,96 @@ ProcessorInfo - + Processor - + Slot - + Manufacturer - + + CopyAll + + + + Architecture - + Core Num - + Core Online Num - + Thread - + Max Frequency - + Frequency - + L1 Cache - + + L1d Cache - + + L1i Cache - + + L2 Cache - + + L3 Cache - + Instruction Set - + EXT Instruction Set - + Used @@ -1515,47 +1737,77 @@ VoiceCardInfo - + + CopyAll + + + + + Sound Card - + Bus Address - + Name - + Drive - + + + Model - + + + + + + Enable + + + + + + + + Disabled + + + + Manufacurer - + Clock - + Bit Width - + + Sound card device is disabled + + + + Device not exitst or Get Device is Empty diff --git a/src/translation/kylin-assistant_fr.ts b/src/translation/kylin-assistant_fr.ts index d7b40d4..d06dc4b 100644 --- a/src/translation/kylin-assistant_fr.ts +++ b/src/translation/kylin-assistant_fr.ts @@ -4,58 +4,64 @@ BatteryInfo - - + + + Battery - + Serail Number - + Name - + + CopyAll + + + + Manufacturer - + Model - + State - + Percentage - + Energy - + Energy Full - + Time To Empty - + Used Times @@ -63,132 +69,160 @@ BluetoothInfo - + + CopyAll + + + + + Bluetooth - + + + + + Enable + + + + + + + + Disable + + + + Bus Address - + Function - + Frequency - + Configuration - + Type - + ID - + Model - + Resource - + Manufacturer - + Version - + Data Width - + Name - + Driver - + Speed - + Serial Number - + Address - + Link Mode - + Link Policy - + Capabilities - + Bus - + SCO MTU - + ACL MTU - + Packet Type - + Features - + + Bluetooth Disable + + + + + Device not exitst or Get Device is Empty @@ -196,57 +230,63 @@ CDRomInfo - + + CopyAll + + + + + CD-ROM - + Name - + Manufacturer - + Version - + Model - + Serail Number - + Bus Info - + Driver - + Speed - + Device Number - + Device not exitst or Get Device is Empty @@ -254,57 +294,63 @@ CameraInfo - + + CopyAll + + + + + Camera - + Name - + Resolution - + Manufacturer - + Model - + Interface - + Driver - + Type - + Version - + Bus Info - + Speed @@ -426,33 +472,43 @@ DriveInfoPage - + + CopyAll + + + + Motherboard - + Graphics Card - + Wired Network Card - + Sound Card - + Wireless Network Card - - + + Bluetooth + + + + + Other @@ -468,17 +524,27 @@ FanInfo - + + CopyAll + + + + Fan - + + Network Card + + + + Speed - + Device not exitst or Get Device is Empty @@ -486,120 +552,128 @@ GraphicsCardInfo - + + CopyAll + + + + + Graphics Card - + Manufacturer - + SubSystem - + Name - + IsDiscrete - + Memory - - - - + + + + + + Video Memory - + Memory Type - + Model - + Version - + Bit Width - + Funtion - + Clock - + Driver - + Dbus Info - + ID - + Device - + GDDR Capacity - + EGL Version - + EGL Client APIs - + GL Version - + GLSL Version - + Device not exitst or Get Device is Empty @@ -623,97 +697,104 @@ HardDiskInfo - + + CopyAll + + + + + Hard Disk Info - + Manufacturer - + Name - + + Capacity - + Used Times - + Interface - + Yes - + No - + Main Disk - + SSD - + HDD - + Type - + Serial Num - + Model - + Transfer Rate - + Read Speed - + Write Speed - + Firmware Version - + Device not exitst or Get Device is Empty @@ -721,82 +802,96 @@ InfoPage - + + CopyAll + + + + Manufacturer - + Machine Model - + Serial Number - + System Bits - + Kernel Arch - + Host Name - + + Kylin Linux Desktop V10 (SP1) + + + + OS Version - + Kernel Version - + Processor - + + + + Memory - + Mother Board - + + Hard Disk - + Graphics Card - + Network Card - + Sound Card - + Monitor @@ -825,6 +920,24 @@ + + KABaseInfoPage + + + kylin-assistant + + + + + kylin-assistant info + + + + + Disable failed + + + KAUsageItem @@ -838,22 +951,6 @@ - - KDriveInfoItem - - - Copy - - - - - KInfoListItem - - - Copy - - - KLeftWidget @@ -865,86 +962,125 @@ KRightWidget - - menu + + options - + minimize - + close - - + + Help - - + + About - - + + Exit + + + ToolKit + + + + + Version: + + + + + Service & Support: <a style='color: #464646;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a> + + KeyboardInfo - + + CopyAll + + + + + Keyboard - + Name - + Model - + Manufacurer - + Interface - + Driver - + Device Address - + Device not exitst or Get Device is Empty + + LoadWidget + + + Enabling, please wait + + + + + Disabling, please wait + + + + + VERSION + + + LoadingWidget - + Scanning, please wait @@ -1039,7 +1175,7 @@ MainWindow - + ToolKit @@ -1047,97 +1183,104 @@ MemoryInfo - + + CopyAll + + + + + Memory Info - + Slot - + Name - + Freq - + Bus Width - + + Total Capacity - + Used Capacity - + Serail Num - + Manufacturer - + Data Width - + Type - + Speed - + Config Speed - + Channel - + Array Handle - + Part Number - + Physical ID - + Model - + Device not exitst or Get Device is Empty @@ -1145,82 +1288,88 @@ MonitorInfo - + + CopyAll + + + + + Monitor - + Manufacturer - + Name - + Size - + Ratio - + Resolution - + MAX Resolution - + Yes - + No - + Main Screen - + Interface - + Visible Area - + Product Week - + Product Year - + Gamma - + Device not exitst or Get Device is Empty @@ -1228,47 +1377,52 @@ MotherBoardInfo - + Name - + Manufacturer - + Chipset - + Serial Num - + Device not exitst or Get Device is Empty - + Version - + + CopyAll + + + + Publish Date - + BIOS Manufacturer - + BIOS Version @@ -1276,42 +1430,69 @@ MouseInfo - + + + CopyAll + + + + + Mouse - + + + Name - + + + + Enable + + + + + + Disabled + + + + Model - + Manufacurer - + Interface - + Driver - + Device Address - + + Mouse device disabled + + + + Device not exitst or Get Device is Empty @@ -1319,99 +1500,131 @@ NetCardInfo - + + CopyAll + + + + + Network Card - + + + + + + Enable + + + + + + Name - - - + + + + + Disable + + + + + + Type - + Wired - + Wireless - + Manufacturer - + Bus Address - + MAC - + Driver - + Link Speed - + MTU - + IP - + Model - + Subnet Mask - + Gateway - + DNS Server - + + Bytes Received - + + Bytes Sent - + + Network card device is disabled + + + + Device not exitst or Get Device is Empty @@ -1419,87 +1632,96 @@ ProcessorInfo - + Processor - + Slot - + Manufacturer - + + CopyAll + + + + Architecture - + Core Num - + Core Online Num - + Thread - + Max Frequency - + Frequency - + L1 Cache - + + L1d Cache - + + L1i Cache - + + L2 Cache - + + L3 Cache - + Instruction Set - + EXT Instruction Set - + Used @@ -1515,47 +1737,77 @@ VoiceCardInfo - + + CopyAll + + + + + Sound Card - + Bus Address - + Name - + Drive - + + + Model - + + + + + + Enable + + + + + + + + Disabled + + + + Manufacurer - + Clock - + Bit Width - + + Sound card device is disabled + + + + Device not exitst or Get Device is Empty diff --git a/src/translation/kylin-assistant_ru.ts b/src/translation/kylin-assistant_ru.ts index 27fcf70..474311f 100644 --- a/src/translation/kylin-assistant_ru.ts +++ b/src/translation/kylin-assistant_ru.ts @@ -4,58 +4,64 @@ BatteryInfo - - + + + Battery - + Serail Number - + Name - + + CopyAll + + + + Manufacturer - + Model - + State - + Percentage - + Energy - + Energy Full - + Time To Empty - + Used Times @@ -63,132 +69,160 @@ BluetoothInfo - + + CopyAll + + + + + Bluetooth - + + + + + Enable + + + + + + + + Disable + + + + Bus Address - + Function - + Frequency - + Configuration - + Type - + ID - + Model - + Resource - + Manufacturer - + Version - + Data Width - + Name - + Driver - + Speed - + Serial Number - + Address - + Link Mode - + Link Policy - + Capabilities - + Bus - + SCO MTU - + ACL MTU - + Packet Type - + Features - + + Bluetooth Disable + + + + + Device not exitst or Get Device is Empty @@ -196,57 +230,63 @@ CDRomInfo - + + CopyAll + + + + + CD-ROM - + Name - + Manufacturer - + Version - + Model - + Serail Number - + Bus Info - + Driver - + Speed - + Device Number - + Device not exitst or Get Device is Empty @@ -254,57 +294,63 @@ CameraInfo - + + CopyAll + + + + + Camera - + Name - + Resolution - + Manufacturer - + Model - + Interface - + Driver - + Type - + Version - + Bus Info - + Speed @@ -426,33 +472,43 @@ DriveInfoPage - + + CopyAll + + + + Motherboard - + Graphics Card - + Wired Network Card - + Sound Card - + Wireless Network Card - - + + Bluetooth + + + + + Other @@ -468,17 +524,27 @@ FanInfo - + + CopyAll + + + + Fan - + + Network Card + + + + Speed - + Device not exitst or Get Device is Empty @@ -486,120 +552,128 @@ GraphicsCardInfo - + + CopyAll + + + + + Graphics Card - + Manufacturer - + SubSystem - + Name - + IsDiscrete - + Memory - - - - + + + + + + Video Memory - + Memory Type - + Model - + Version - + Bit Width - + Funtion - + Clock - + Driver - + Dbus Info - + ID - + Device - + GDDR Capacity - + EGL Version - + EGL Client APIs - + GL Version - + GLSL Version - + Device not exitst or Get Device is Empty @@ -623,97 +697,104 @@ HardDiskInfo - + + CopyAll + + + + + Hard Disk Info - + Manufacturer - + Name - + + Capacity - + Used Times - + Interface - + Yes - + No - + Main Disk - + SSD - + HDD - + Type - + Serial Num - + Model - + Transfer Rate - + Read Speed - + Write Speed - + Firmware Version - + Device not exitst or Get Device is Empty @@ -721,82 +802,96 @@ InfoPage - + + CopyAll + + + + Manufacturer - + Machine Model - + Serial Number - + System Bits - + Kernel Arch - + Host Name - + + Kylin Linux Desktop V10 (SP1) + + + + OS Version - + Kernel Version - + Processor - + + + + Memory - + Mother Board - + + Hard Disk - + Graphics Card - + Network Card - + Sound Card - + Monitor @@ -825,6 +920,24 @@ + + KABaseInfoPage + + + kylin-assistant + + + + + kylin-assistant info + + + + + Disable failed + + + KAUsageItem @@ -838,22 +951,6 @@ - - KDriveInfoItem - - - Copy - - - - - KInfoListItem - - - Copy - - - KLeftWidget @@ -865,86 +962,125 @@ KRightWidget - - menu + + options - + minimize - + close - - + + Help - - + + About - - + + Exit + + + ToolKit + + + + + Version: + + + + + Service & Support: <a style='color: #464646;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a> + + KeyboardInfo - + + CopyAll + + + + + Keyboard - + Name - + Model - + Manufacurer - + Interface - + Driver - + Device Address - + Device not exitst or Get Device is Empty + + LoadWidget + + + Enabling, please wait + + + + + Disabling, please wait + + + + + VERSION + + + LoadingWidget - + Scanning, please wait @@ -1039,7 +1175,7 @@ MainWindow - + ToolKit @@ -1047,97 +1183,104 @@ MemoryInfo - + + CopyAll + + + + + Memory Info - + Slot - + Name - + Freq - + Bus Width - + + Total Capacity - + Used Capacity - + Serail Num - + Manufacturer - + Data Width - + Type - + Speed - + Config Speed - + Channel - + Array Handle - + Part Number - + Physical ID - + Model - + Device not exitst or Get Device is Empty @@ -1145,82 +1288,88 @@ MonitorInfo - + + CopyAll + + + + + Monitor - + Manufacturer - + Name - + Size - + Ratio - + Resolution - + MAX Resolution - + Yes - + No - + Main Screen - + Interface - + Visible Area - + Product Week - + Product Year - + Gamma - + Device not exitst or Get Device is Empty @@ -1228,47 +1377,52 @@ MotherBoardInfo - + Name - + Manufacturer - + Chipset - + Serial Num - + Device not exitst or Get Device is Empty - + Version - + + CopyAll + + + + Publish Date - + BIOS Manufacturer - + BIOS Version @@ -1276,42 +1430,69 @@ MouseInfo - + + + CopyAll + + + + + Mouse - + + + Name - + + + + Enable + + + + + + Disabled + + + + Model - + Manufacurer - + Interface - + Driver - + Device Address - + + Mouse device disabled + + + + Device not exitst or Get Device is Empty @@ -1319,99 +1500,131 @@ NetCardInfo - + + CopyAll + + + + + Network Card - + + + + + + Enable + + + + + + Name - - - + + + + + Disable + + + + + + Type - + Wired - + Wireless - + Manufacturer - + Bus Address - + MAC - + Driver - + Link Speed - + MTU - + IP - + Model - + Subnet Mask - + Gateway - + DNS Server - + + Bytes Received - + + Bytes Sent - + + Network card device is disabled + + + + Device not exitst or Get Device is Empty @@ -1419,87 +1632,96 @@ ProcessorInfo - + Processor - + Slot - + Manufacturer - + + CopyAll + + + + Architecture - + Core Num - + Core Online Num - + Thread - + Max Frequency - + Frequency - + L1 Cache - + + L1d Cache - + + L1i Cache - + + L2 Cache - + + L3 Cache - + Instruction Set - + EXT Instruction Set - + Used @@ -1515,47 +1737,77 @@ VoiceCardInfo - + + CopyAll + + + + + Sound Card - + Bus Address - + Name - + Drive - + + + Model - + + + + + + Enable + + + + + + + + Disabled + + + + Manufacurer - + Clock - + Bit Width - + + Sound card device is disabled + + + + Device not exitst or Get Device is Empty diff --git a/src/translation/kylin-assistant_zh_CN.qm b/src/translation/kylin-assistant_zh_CN.qm index 5c59e35..9ecf5f7 100644 Binary files a/src/translation/kylin-assistant_zh_CN.qm and b/src/translation/kylin-assistant_zh_CN.qm differ diff --git a/src/translation/kylin-assistant_zh_CN.ts b/src/translation/kylin-assistant_zh_CN.ts index f633fa9..28064af 100644 --- a/src/translation/kylin-assistant_zh_CN.ts +++ b/src/translation/kylin-assistant_zh_CN.ts @@ -15,7 +15,7 @@ BatteryInfo - + Model 电池型号 @@ -28,53 +28,59 @@ 预计使用时间 - - + + + Battery 电池 - + Serail Number 序列号 - + Name 名称 - + + CopyAll + 复制全部 + + + Manufacturer 制造商 - + State 状态 - + Percentage 电量 - + Energy 容量 - + Energy Full 完全充满容量 - + Time To Empty 预计使用时间 - + Used Times 使用次数 @@ -82,132 +88,168 @@ BluetoothInfo - + + CopyAll + 复制全部 + + + + Bluetooth 蓝牙 - + + + + + Enable + 启用 + + + + + + + Disable + 禁用 + + + Bus Address 总线地址 - + Function 功能 - + Frequency 频率 - + Configuration 配置 - + Type 设备类型 - + ID ID号 - + Model 设备型号 - + Resource 资源 - + Manufacturer 制造商 - + Version 设备版本 - + Data Width 数据宽度 - + Name 名称 - + Driver 驱动 - + Speed 速率 - + Serial Number 序列号 - + Address 地址 - + Link Mode 连接模式 - + Link Policy 连接策略 - + Capabilities 功能 - + Bus 总线 - + SCO MTU - + ACL MTU - + Packet Type 数据包类型 - + Features 特征 - + + Bluetooth Disable + 蓝牙已禁用 + + + Bluetooth Disable or Device not exitst + 蓝牙驱动已禁用或者缺失蓝牙设备 + + + Bluetooth Disable + 蓝牙已禁用 + + + + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -215,57 +257,63 @@ CDRomInfo - + + CopyAll + 复制全部 + + + + CD-ROM 光驱 - + Name 名称 - + Manufacturer 制造商 - + Version 版本 - + Model 型号 - + Serail Number 序列号 - + Bus Info 总线信息 - + Driver 驱动 - + Speed 速度 - + Device Number 设备编号 - + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -273,57 +321,63 @@ CameraInfo - + + CopyAll + 复制全部 + + + + Camera 摄像头 - + Name 设备名称 - + Resolution 分辨率 - + Manufacturer 制造商 - + Model 型号 - + Interface 接口 - + Driver 驱动 - + Type 类型 - + Version 版本 - + Bus Info 总线信息 - + Speed 速度 @@ -449,33 +503,43 @@ DriveInfoPage - + + CopyAll + 复制全部 + + + Motherboard 主板 - + Graphics Card 显卡 - + Wired Network Card 有线网卡 - + Sound Card 声卡 - + Wireless Network Card 无线网卡 - - + + Bluetooth + 蓝牙 + + + + Other 其他 @@ -491,17 +555,27 @@ FanInfo - + + CopyAll + 复制全部 + + + Fan 风扇 - + + Network Card + 网卡 + + + Speed 转速 - + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -509,120 +583,128 @@ GraphicsCardInfo - + + CopyAll + 复制全部 + + + + Graphics Card 显卡 - + Manufacturer 制造商 - + SubSystem 子制造商 - + Name 设备名称 - + IsDiscrete 独立显卡(是/否) - + Memory 显存 - - - - + + + + + + Video Memory 显存 - + Memory Type 显存类型 - + Model 型号 - + Version 版本 - + Bit Width 数据位宽 - + Funtion 功能 - + Clock 时钟频率 - + Driver 驱动 - + Dbus Info 总线信息 - + ID ID号 - + Device 设备 - + GDDR Capacity GDDR容量 - + EGL Version EGL版本 - + EGL Client APIs EGL接口 - + GL Version GL版本 - + GLSL Version GLSL版本 - + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -657,97 +739,104 @@ HardDiskInfo - + + CopyAll + 复制全部 + + + + Hard Disk Info 硬盘信息 - + Manufacturer 制造商 - + Name 硬盘名称 - + + Capacity 容量 - + Used Times 使用次数 - + Interface 接口 - + Yes - + No - + Main Disk 主硬盘(是/否) - + SSD 固态 - + HDD 机械 - + Type 类型(固态/机械) - + Serial Num 序列号 - + Model 型号 - + Transfer Rate 数据传输率 - + Read Speed 磁盘读取速度 - + Write Speed 磁盘写入速度 - + Firmware Version 固件版本 - + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -755,7 +844,7 @@ InfoPage - + Manufacturer 整机制造商 @@ -788,72 +877,86 @@ 内核版本 - + + CopyAll + 复制全部 + + + Machine Model 整机型号 - + Serial Number 序列号 - + System Bits 系统位数 - + Kernel Arch 内核架构 - + Host Name 主机名 - + + Kylin Linux Desktop V10 (SP1) + + + + OS Version 操作系统版本 - + Kernel Version 内核版本 - + Processor 处理器 - + + + + Memory 内存 - + Mother Board 主板 - + + Hard Disk 硬盘 - + Graphics Card 显卡 - + Network Card 网卡 - + Sound Card 声卡 @@ -870,7 +973,7 @@ 显卡 - + Monitor 显示器 @@ -911,6 +1014,24 @@ 服务和支持: + + KABaseInfoPage + + + kylin-assistant + 工具箱 + + + + kylin-assistant info + 工具箱 信息 + + + + Disable failed + 禁用失败 + + KALabel @@ -934,17 +1055,15 @@ KDriveInfoItem - Copy - 复制 + 复制 KInfoListItem - Copy - 复制 + 复制 @@ -958,41 +1077,56 @@ KRightWidget - menu - 菜单 + 菜单 - + + options + 选项 + + + minimize 最小化 - + close 关闭 - - + + Help 帮助 - - + + About 关于 - - + + Exit 退出 + ToolKit - 工具箱 + 工具箱 + + + + Version: + 版本: + + + + Service & Support: <a style='color: #464646;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a> + <p>服务与支持: <a style='color: #464646;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a></p> <p>ToolKit is a powerful system supporting software which is developed by Kylin team. Mainly for the naive user, it can help users manage the system. At present, It provides system junk scanning and cleaning, viewing the system hardware and software information, task manager, and some other functions.</p> @@ -1000,13 +1134,14 @@ <p>Service & Support : <a style='color: black;' href='mailto:support@kylinos.cn'>support@kylinos.cn</a></p> - <p>服务和支持: <a style='color: black;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a></p> + <p>服务与支持: <a style='color: black;' href='mailto://support@kylinos.cn'>support@kylinos.cn</a></p> KeyboardInfo - + + Keyboard 键盘 @@ -1015,45 +1150,68 @@ 设备类型 - + + CopyAll + 复制全部 + + + Name 设备名称 - + Model 设备型号 - + Manufacurer 制造商 - + Interface 接口 - + Driver 驱动 - + Device Address 设备地址 - + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 + + LoadWidget + + + Enabling, please wait + 正在启用,请稍等 + + + + Disabling, please wait + 正在禁用,请稍等 + + + + VERSION + 版本号 + + LoadingWidget - + Scanning, please wait 正在扫描,请稍等 @@ -1152,7 +1310,7 @@ MainWindow - + ToolKit 工具箱 @@ -1168,97 +1326,104 @@ MemoryInfo - + + CopyAll + 复制全部 + + + + Memory Info 内存信息 - + Slot 插槽 - + Name 名称 - + Freq 频率 - + Bus Width 总位宽 - + + Total Capacity 总容量 - + Used Capacity 已用容量 - + Serail Num 序列号 - + Manufacturer 制造商 - + Data Width 数据位宽 - + Type 类型 - + Speed 速率 - + Config Speed 配置速率 - + Channel 插槽号 - + Array Handle 数组程序 - + Part Number 产品型号 - + Physical ID 物理ID - + Model 型号 - + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -1266,82 +1431,88 @@ MonitorInfo - + + CopyAll + 复制全部 + + + + Monitor 显示器 - + Manufacturer 显示器厂商 - + Name 显示器型号 - + Size - 屏幕尺寸 + 屏幕尺寸/英寸 - + Ratio 图像高宽比 - + Resolution 分辨率 - + MAX Resolution 最大可用分辨率 - + Yes - + No - + Main Screen 主显示器(是/否) - + Interface 接口 - + Visible Area 可视面积 - + Product Week 生产日期/周 - + Product Year 生产日期/年 - + Gamma 伽马值 - + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -1349,47 +1520,52 @@ MotherBoardInfo - + Name 主板名称 - + Manufacturer 制造商 - + Chipset 芯片组 - + Serial Num 序列号 - + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 - + Version 主板版本 - + + CopyAll + 复制全部 + + + Publish Date 发布日期 - + BIOS Manufacturer BIOS制造商 - + BIOS Version BIOS版本 @@ -1397,7 +1573,8 @@ MouseInfo - + + Mouse 鼠标 @@ -1406,37 +1583,63 @@ 设备类型 - + + + CopyAll + 复制全部 + + + + + Name 设备名称 - + + + + Enable + 启用 + + + + + Disabled + 禁用 + + + Model 设备型号 - + Manufacurer 制造商 - + Interface 接口 - + Driver 驱动 - + Device Address 设备地址 - + + Mouse device disabled + 鼠标已禁用 + + + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -1444,99 +1647,131 @@ NetCardInfo - + + CopyAll + 复制全部 + + + + Network Card 网卡 - + + + + + + Enable + 启用 + + + + + Name 网卡名称 - - - + + + + + Disable + 禁用 + + + + + Type 网卡类型 - + Wired 有线 - + Wireless 无线 - + Manufacturer 制造商 - + Bus Address 总线地址 - + MAC MAC地址 - + Driver 驱动 - + Link Speed 连接速度 - + MTU MTU - + IP IP地址 - + Model 型号 - + Subnet Mask 子网掩码 - + Gateway 网关地址 - + DNS Server DNS服务器 - + + Bytes Received 已接收字节 - + + Bytes Sent 已发送字节 - + + Network card device is disabled + 网卡设备已禁用 + + + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 @@ -1544,7 +1779,7 @@ ProcessorInfo - + Processor 处理器 @@ -1557,7 +1792,7 @@ 线程数 - + Slot 插槽 @@ -1566,77 +1801,86 @@ 基准频率 - + + CopyAll + 复制全部 + + + Manufacturer 制造商 - + Architecture 架构 - + Core Num 核心数 - + Core Online Num 在线核心数 - + Thread 每核线程数 - + Max Frequency 最大主频 - + Frequency 频率 - + L1 Cache 一级缓存 - + + L1d Cache 一级缓存(数据) - + + L1i Cache 一级缓存(指令) - + + L2 Cache 二级缓存 - + + L3 Cache 三级缓存 - + Instruction Set 指令集 - + EXT Instruction Set 扩展指令集 - + Used 使用率 @@ -1656,47 +1900,77 @@ 声卡 - + + CopyAll + 复制全部 + + + + Sound Card 声卡 - + Bus Address 总线地址 - + Name 声卡名称 - + Drive 声卡驱动 - + + + Model 声卡型号 - + + + + + + Enable + 启用 + + + + + + + Disabled + 禁用 + + + Manufacurer 制造商 - + Clock 时钟频率 - + Bit Width 数据位宽 - + + Sound card device is disabled + 声卡设备已禁用 + + + Device not exitst or Get Device is Empty 设备不存在或者获取到的设备信息为空 diff --git a/src/util.cpp b/src/util.cpp new file mode 100644 index 0000000..a5b5040 --- /dev/null +++ b/src/util.cpp @@ -0,0 +1,77 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "util.h" + +KDKVolumeBaseType Util::getVolumeUnit(const QString &unit) +{ + qDebug()< +#include +#include +#include + +class Util +{ +public: + static KDKVolumeBaseType getVolumeUnit(const QString &unit); + static char* getVolume(const QString &volume, KDKVolumeBaseType unit); + static bool isVolumeUnit(const QString &str); +}; + +#endif // UTIL_H diff --git a/src/xatom-helper.h b/src/xatom-helper.h index 4cfaf48..a35748c 100644 --- a/src/xatom-helper.h +++ b/src/xatom-helper.h @@ -26,7 +26,7 @@ #include #include -#include +//#include struct UnityCorners { ulong topLeft = 0;