fix(license info & audio): license information display in different colors;Fix an error where the sound output left/right balance function fails
- 激活信息已不同的显示进行显示 - 修复声音输出左/右平衡功能失效的错误
This commit is contained in:
parent
bb140aa3c0
commit
a6d6327ff4
125
0001-fix-license-info-license-information-display-in-diff.patch
Normal file
125
0001-fix-license-info-license-information-display-in-diff.patch
Normal file
@ -0,0 +1,125 @@
|
||||
From aa8145a1e83cf4e0e4349728bd7f1f66d02684a0 Mon Sep 17 00:00:00 2001
|
||||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||||
Date: Tue, 21 Feb 2023 16:47:56 +0800
|
||||
Subject: [PATCH 1/2] fix(license info): license information display in
|
||||
different colors
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 激活信息已不同的显示进行显示
|
||||
---
|
||||
.../system-information/system-information.cpp | 40 +++++++++++--------
|
||||
1 file changed, 24 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/plugins/system/src/pages/system-information/system-information.cpp b/plugins/system/src/pages/system-information/system-information.cpp
|
||||
index 0fb839f..c249b69 100644
|
||||
--- a/plugins/system/src/pages/system-information/system-information.cpp
|
||||
+++ b/plugins/system/src/pages/system-information/system-information.cpp
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "ui_system-information.h"
|
||||
|
||||
#include <kiran-log/qt5-log-i.h>
|
||||
+#include <kiran-message-box.h>
|
||||
#include <style-property.h>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusConnectionInterface>
|
||||
@@ -29,9 +30,7 @@
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QPainter>
|
||||
-#include <QDateTime>
|
||||
#include <QProcess>
|
||||
-#include <kiran-message-box.h>
|
||||
|
||||
#define HOST_NAME "host_name"
|
||||
#define ARCH "arch"
|
||||
@@ -135,7 +134,7 @@ bool SystemInformation::initUI()
|
||||
}
|
||||
|
||||
QList<KiranFrame*> kiranFrames = findChildren<KiranFrame*>();
|
||||
- for (int i = 0; i < kiranFrames.count();i++)
|
||||
+ for (int i = 0; i < kiranFrames.count(); i++)
|
||||
{
|
||||
KiranFrame* frame = kiranFrames.at(i);
|
||||
frame->setRadius(6);
|
||||
@@ -212,16 +211,19 @@ bool SystemInformation::getLicenseDesc(QString& licenseStatus)
|
||||
QJsonObject rootObj = jsonDocument.object();
|
||||
QStringList keys = rootObj.keys();
|
||||
|
||||
- QSet<QString> keySet = {"expired_time","activation_status"};
|
||||
- for( auto key:keySet )
|
||||
+ QSet<QString> keySet = {"expired_time", "activation_status"};
|
||||
+ for (auto key : keySet)
|
||||
{
|
||||
- if( !keys.contains(key) )
|
||||
+ if (!keys.contains(key))
|
||||
{
|
||||
KLOG_ERROR() << "KylinSecOS GetLicense missing key:" << key;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+ bool expired = false;
|
||||
+ QString statusDesc("");
|
||||
+
|
||||
QVariant expiredTimeVar = rootObj["expired_time"].toVariant();
|
||||
qlonglong expiredTimeSinceEpoch = expiredTimeVar.toULongLong();
|
||||
|
||||
@@ -229,27 +231,33 @@ bool SystemInformation::getLicenseDesc(QString& licenseStatus)
|
||||
qulonglong activationStatus = activationStatusVar.toULongLong();
|
||||
|
||||
QDateTime expiredTime = QDateTime::fromSecsSinceEpoch(expiredTimeSinceEpoch);
|
||||
- if (activationStatus == 0) //未激活
|
||||
+ if (activationStatus == 0) // 未激活
|
||||
{
|
||||
- licenseStatus = tr("UnActivated");
|
||||
+ statusDesc = tr("UnActivated");
|
||||
+ expired = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
QDateTime currentDateTime = QDateTime::currentDateTime();
|
||||
|
||||
- if( currentDateTime > expiredTime ) //激活码已过期
|
||||
+ if (currentDateTime > expiredTime) // 激活码已过期
|
||||
{
|
||||
- licenseStatus = tr("Activation code has expired");
|
||||
+ statusDesc = tr("Activation code has expired");
|
||||
+ expired = true;
|
||||
}
|
||||
- else if( expiredTime.date().year() >= 2100 ) //永久激活
|
||||
+ else if (expiredTime.date().year() >= 2100) // 永久激活
|
||||
{
|
||||
- licenseStatus = tr("Permanently activated");
|
||||
+ statusDesc = tr("Permanently activated");
|
||||
+ expired = false;
|
||||
}
|
||||
- else //已激活
|
||||
+ else // 已激活
|
||||
{
|
||||
- licenseStatus = tr("Activated");
|
||||
+ statusDesc = tr("Activated");
|
||||
+ expired = false;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ licenseStatus = QString("<font color=%1>%2</font>").arg(expired?"#ff3838":"#5ab940").arg(statusDesc);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -285,9 +293,9 @@ void SystemInformation::updateHostName(bool isChanged, QString name)
|
||||
|
||||
void SystemInformation::handleShowLicenseDialog()
|
||||
{
|
||||
- if( !QProcess::startDetached("/usr/bin/ksl-os-gui") )
|
||||
+ if (!QProcess::startDetached("/usr/bin/ksl-os-gui"))
|
||||
{
|
||||
- KiranMessageBox::message(this, tr("Error"), tr("Failed to open the license activator"),KiranMessageBox::Ok);
|
||||
+ KiranMessageBox::message(this, tr("Error"), tr("Failed to open the license activator"), KiranMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
From 73b3469f25ac345abb66621b9cb34cdd2839e3f6 Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Mon, 27 Mar 2023 16:34:04 +0800
|
||||
Subject: [PATCH 2/2] fix(audio):Fix an error where the sound output left/right
|
||||
balance function fails
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复声音输出左/右平衡功能失效的错误
|
||||
---
|
||||
plugins/audio/src/plugin/input-page.cpp | 4 ++--
|
||||
plugins/audio/src/plugin/output-page.cpp | 8 ++++----
|
||||
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/plugins/audio/src/plugin/input-page.cpp b/plugins/audio/src/plugin/input-page.cpp
|
||||
index e9f5018..00826b4 100644
|
||||
--- a/plugins/audio/src/plugin/input-page.cpp
|
||||
+++ b/plugins/audio/src/plugin/input-page.cpp
|
||||
@@ -256,7 +256,7 @@ void InputPage::initInputSettins()
|
||||
|
||||
void InputPage::initConnet()
|
||||
{
|
||||
- connect(ui->inputDevices, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), [=](int index)
|
||||
+ connect(ui->inputDevices, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), [this](int index)
|
||||
{
|
||||
QString namePort = ui->inputDevices->itemData(index, Qt::UserRole).toString();
|
||||
if (!namePort.isNull())
|
||||
@@ -272,7 +272,7 @@ void InputPage::initConnet()
|
||||
else
|
||||
KLOG_DEBUG() << "namePort is null"; });
|
||||
|
||||
- connect(ui->volumeSetting, &QSlider::valueChanged, [=](int value)
|
||||
+ connect(ui->volumeSetting, &QSlider::valueChanged, [this](int value)
|
||||
{
|
||||
double volumeValue = static_cast<double>(value) / static_cast<double>(100);
|
||||
if (m_defaultSource != nullptr)
|
||||
diff --git a/plugins/audio/src/plugin/output-page.cpp b/plugins/audio/src/plugin/output-page.cpp
|
||||
index b28ba53..ef52165 100644
|
||||
--- a/plugins/audio/src/plugin/output-page.cpp
|
||||
+++ b/plugins/audio/src/plugin/output-page.cpp
|
||||
@@ -167,7 +167,7 @@ void OutputPage::initConnect()
|
||||
connect(m_audioInterface, &AudioInterface::SinkDelete, this, &OutputPage::handleSinkDelete);
|
||||
connect(m_audioInterface, &AudioInterface::DefaultSinkChange, this, &OutputPage::handleDefaultSinkChanged, Qt::QueuedConnection);
|
||||
|
||||
- connect(ui->outputDevices, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index)
|
||||
+ connect(ui->outputDevices, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this](int index)
|
||||
{
|
||||
QString namePort = ui->outputDevices->itemData(index, Qt::UserRole).toString();
|
||||
KLOG_DEBUG() << "SetActivePort:" << namePort;
|
||||
@@ -176,7 +176,7 @@ void OutputPage::initConnect()
|
||||
else
|
||||
KLOG_DEBUG() << "m_defaultSink is null"; });
|
||||
|
||||
- connect(ui->volumeSetting, &QSlider::valueChanged, [=](int value)
|
||||
+ connect(ui->volumeSetting, &QSlider::valueChanged, [this](int value)
|
||||
{
|
||||
double volumeValue = static_cast<double>(ui->volumeSetting->sliderPosition()) / static_cast<double>(100);
|
||||
if(m_defaultSink != nullptr)
|
||||
@@ -187,10 +187,10 @@ void OutputPage::initConnect()
|
||||
else
|
||||
KLOG_DEBUG() << "m_defaultSink is null"; });
|
||||
|
||||
- connect(ui->volumeBalance, &QSlider::valueChanged, [=](int value)
|
||||
+ connect(ui->volumeBalance, &QSlider::valueChanged, [this](int value)
|
||||
{
|
||||
double balanceValue = static_cast<double>(value) / static_cast<double>(100);
|
||||
- if (m_defaultSink == nullptr)
|
||||
+ if (m_defaultSink != nullptr)
|
||||
{
|
||||
m_defaultSink->SetBalance(balanceValue);
|
||||
KLOG_DEBUG() << "balanceValue" << balanceValue;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user