From 4120af7e242b93709d3fce3889fa9dae4d91a34d Mon Sep 17 00:00:00 2001
From: zty199 <46324746+zty199@users.noreply.github.com>
Date: Sat, 31 Dec 2022 22:03:05 +0800
Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Deepin/UOS=20?=
=?UTF-8?q?=E4=B8=8A=E5=A7=8B=E7=BB=88=E8=AE=A4=E4=B8=BA=E5=BC=80=E5=8F=91?=
=?UTF-8?q?=E8=80=85=E6=A8=A1=E5=BC=8F=E6=9C=AA=E6=89=93=E5=BC=80=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
读取 /var/lib/deepin/developer-mode/enabled 文件之前,QFile 未 open
Log: 判断条件中添加 QFile::open 操作;去除没啥意义的 QTextStream,直接使用 QIODevice::readLine 读取文件第一行
---
src/main.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
index 6f8b915..9846a35 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -71,12 +71,11 @@ int main(int argc, char *argv[])
// Check UOS developer mode.
QFile UOSDevelopFile(UOSCheckFile);
- if (UOSDevelopFile.exists() && isDeepinOS)
+ if (isDeepinOS && UOSDevelopFile.exists() && UOSDevelopFile.open(QFile::ReadOnly | QFile::Text))
{
config.setValue("UOS/isUOS", true);
- QTextStream UOStextStream(&UOSDevelopFile);
- QString lineData = UOStextStream.readLine();
- bool devmode = lineData.toInt();
+ QString lineData = UOSDevelopFile.readLine();
+ bool devmode = lineData.trimmed().toInt();
qDebug() << "UOS Developer Mode Status:" << devmode;
config.setValue("UOS/EnableDeveloperMode", devmode);
}
@@ -88,6 +87,7 @@ int main(int argc, char *argv[])
config.remove("UOS/EnableDeveloperMode");
}
}
+ UOSDevelopFile.close();
config.sync(); // 写入更改至 config.ini,并同步最新内容
// 龙芯机器配置,使得 DApplication 能正确加载 QTWEBENGINE
From c636e0882be1f33e7fa09125d65f802edc0249c3 Mon Sep 17 00:00:00 2001
From: zty199 <46324746+zty199@users.noreply.github.com>
Date: Sat, 31 Dec 2022 23:05:36 +0800
Subject: [PATCH 2/4] =?UTF-8?q?fix:=20ISSUE=20#I68566=20=E4=B8=8B=E8=BD=BD?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E9=94=99=E4=BD=8D=EF=BC=8C=E5=9B=BE=E6=A0=87?=
=?UTF-8?q?=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
DownloadItem 原始定义高度为 54px,上下边距各 4px;然而图片 label 高度定义为 48,且宽度未定义,明显放不下;DownloadListWidget 中添加 item 时,设置每个 item sizeHint 高度只有 50px,与 item 高度不一致
Log: 固定 DownloadItem 高度为 56px;修改 DownloadListWidget 添加 item 时每个 item 的 sizeHint 高度;使用 DLabel 替换 QLabel 用于单个 item 中应用名称显示,使用 setElideMode 保证名称过长时右边显示省略号,并添加鼠标悬浮提示
---
src/widgets/common/downloaditem.cpp | 3 +
src/widgets/common/downloaditem.ui | 95 +++++++++++++++++++----------
src/widgets/downloadlistwidget.cpp | 2 +-
src/widgets/downloadlistwidget.ui | 8 ++-
4 files changed, 75 insertions(+), 33 deletions(-)
diff --git a/src/widgets/common/downloaditem.cpp b/src/widgets/common/downloaditem.cpp
index 30047f8..4c1e179 100644
--- a/src/widgets/common/downloaditem.cpp
+++ b/src/widgets/common/downloaditem.cpp
@@ -22,6 +22,8 @@ DownloadItem::DownloadItem(QWidget *parent) : QWidget(parent),
ui->pushButton_3->hide();
ui->widget_spinner->start();
ui->widget_spinner->hide();
+
+ ui->label->setElideMode(Qt::TextElideMode::ElideRight);
}
DownloadItem::~DownloadItem()
@@ -48,6 +50,7 @@ void DownloadItem::setMax(qint64 max)
void DownloadItem::setName(QString name)
{
ui->label->setText(name);
+ ui->label->setToolTip(name);
}
QString DownloadItem::getName()
diff --git a/src/widgets/common/downloaditem.ui b/src/widgets/common/downloaditem.ui
index 2d57cf3..a02e136 100644
--- a/src/widgets/common/downloaditem.ui
+++ b/src/widgets/common/downloaditem.ui
@@ -7,13 +7,25 @@
0
0
666
- 54
+ 56
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 56
+
+
16777215
- 54
+ 56
@@ -40,10 +52,22 @@
-
+
+
+ 0
+ 0
+
+
+
+
+ 48
+ 48
+
+
48
- 16777215
+ 48
@@ -52,6 +76,9 @@
true
+
+ Qt::AlignCenter
+
-
@@ -70,6 +97,31 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 80
+ 48
+
+
+
+
+ 120
+ 48
+
+
+
+ Name
+
+
+
-
@@ -83,33 +135,6 @@
- -
-
-
-
- 80
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
-
- 13
-
-
-
- Name
-
-
- true
-
-
-
-
@@ -153,11 +178,14 @@
0
+
+ 8
+
0
- 0
+ 8
-
@@ -297,6 +325,11 @@
1
+
+ DLabel
+ QLabel
+
+
diff --git a/src/widgets/downloadlistwidget.cpp b/src/widgets/downloadlistwidget.cpp
index 01a7157..28a31f3 100644
--- a/src/widgets/downloadlistwidget.cpp
+++ b/src/widgets/downloadlistwidget.cpp
@@ -91,7 +91,7 @@ void DownloadListWidget::addItem(QString name, QString fileName, QString pkgName
di->pkgName = pkgName;
di->seticon(icon);
QListWidgetItem *pItem = new QListWidgetItem();
- pItem->setSizeHint(QSize(240, 50));
+ pItem->setSizeHint(QSize(240, 56)); // ui 中单个 downloaditem 高度固定 56px(上下 margin 8px,图片固定 48x48)
ui->listWidget->addItem(pItem);
ui->listWidget->setItemWidget(pItem, di);
if (!isBusy)
diff --git a/src/widgets/downloadlistwidget.ui b/src/widgets/downloadlistwidget.ui
index 16cb680..e46a655 100644
--- a/src/widgets/downloadlistwidget.ui
+++ b/src/widgets/downloadlistwidget.ui
@@ -85,7 +85,7 @@ QListWidget::item::selected
}
- QFrame::StyledPanel
+ QFrame::NoFrame
Qt::ScrollBarAsNeeded
@@ -99,9 +99,15 @@ QListWidget::item::selected
10
+
+ QAbstractItemView::NoEditTriggers
+
QListView::Fixed
+
+ 4
+
-
From cc54014b299a943970ebe5d50ac1e3d867022b98 Mon Sep 17 00:00:00 2001
From: zty199 <46324746+zty199@users.noreply.github.com>
Date: Sat, 31 Dec 2022 23:53:06 +0800
Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BA=94=E7=94=A8?=
=?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E5=8D=B8=E8=BD=BD=E5=BA=94=E7=94=A8?=
=?UTF-8?q?=E5=90=8E=E7=82=B9=E5=87=BB=E2=80=9C=E5=AE=89=E8=A3=85=E2=80=9D?=
=?UTF-8?q?=E6=8C=89=E9=92=AE=E5=90=8E=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=B4=A9?=
=?UTF-8?q?=E6=BA=83=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
应用卸载后,按钮文字被设置为“安装”,导致点击按钮时判断要从下载列表中找到对应 DownloadItem 并触发安装;此时列表中并不存在此应用,list 访问下标越界导致崩溃
Log: 卸载后将按钮文字设置为“下载”避免该问题
---
src/pages/appintopage.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/appintopage.cpp b/src/pages/appintopage.cpp
index 507f2b5..acf1ce9 100644
--- a/src/pages/appintopage.cpp
+++ b/src/pages/appintopage.cpp
@@ -363,7 +363,7 @@ void AppIntoPage::on_pushButton_3_clicked()
if (check.readAllStandardOutput().isEmpty())
{
- ui->downloadButton->setText(tr("Install"));
+ ui->downloadButton->setText(tr("Download"));
ui->pushButton_3->hide();
updatesEnabled();
From c169622806b015973a17869daf842c5faf812bea Mon Sep 17 00:00:00 2001
From: zty199 <46324746+zty199@users.noreply.github.com>
Date: Sun, 1 Jan 2023 00:27:04 +0800
Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BA=94=E7=94=A8?=
=?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E2=80=9C=E5=BA=94=E7=94=A8=E5=8F=8D?=
=?UTF-8?q?=E9=A6=88=E2=80=9D=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=E5=90=8E?=
=?UTF-8?q?=E6=97=A0=E6=B3=95=E8=B0=83=E8=B5=B7=E4=BA=A4=E6=B5=81=E5=B9=B3?=
=?UTF-8?q?=E5=8F=B0=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
QProcess::startDetached 函数调用入参错误
Log: 修改调用方式,拆开 sh 和启动脚本地址分别用于 program 和 arguments
---
src/pages/appintopage.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pages/appintopage.cpp b/src/pages/appintopage.cpp
index acf1ce9..9bd5339 100644
--- a/src/pages/appintopage.cpp
+++ b/src/pages/appintopage.cpp
@@ -386,11 +386,11 @@ void AppIntoPage::on_shareButton_clicked()
void AppIntoPage::on_updateButton_clicked()
{
QString feedbackSpk = "spk://store/chat/store.spark-app.feedback";
- QFile actionSubmissionClientStatus("/opt/durapps/store.spark-app.feedback");
- if (actionSubmissionClientStatus.exists())
+ QFileInfo actionSubmissionClientStatus("/opt/durapps/store.spark-app.feedback");
+ if (actionSubmissionClientStatus.exists() && actionSubmissionClientStatus.isDir())
{
qDebug() << "反馈器存在";
- QProcess::startDetached("sh /opt/durapps/store.spark-app.feedback/launch.sh", QStringList());
+ QProcess::startDetached("sh", QStringList() << "/opt/durapps/store.spark-app.feedback/launch.sh");
}
else
{