支持 Debian / GXDE 系统识别

This commit is contained in:
shenmo 2025-02-24 21:11:51 +08:00
parent 0566d546df
commit 46a1daeafc
6 changed files with 48 additions and 35 deletions

@ -63,5 +63,6 @@
<file>tags/uos-small.png</file>
<file>tags/uos.svg</file>
<file>translations/qtwebengine_zh.qm</file>
<file>tags/debian.svg</file>
</qresource>
</RCC>

File diff suppressed because one or more lines are too long

After

(image error) Size: 5.3 KiB

@ -231,6 +231,7 @@ void AppIntoPage::clear()
ui->tag_deepin->hide();
ui->tag_dwine2->hide();
ui->tag_dwine5->hide();
ui->tag_debian->hide();
ui->tag_ubuntu->hide();
ui->tag_community->hide();
ui->icon->clear();
@ -402,12 +403,18 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList)
bool ubuntuSupport = false;
bool deepinSupport = false;
bool uosSupport = false;
bool debianSupport = false;
foreach (const QString &tag, tagList)
{
if (tag == "community")
{
ui->tag_community->show();
}
else if (tag == "debian")
{
ui->tag_debian->show();
debianSupport = true;
}
else if (tag == "ubuntu")
{
ui->tag_ubuntu->show();
@ -441,10 +448,10 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList)
ui->tag_a2d->show();
}
}
notifyUserUnsupportedTags(ubuntuSupport, deepinSupport, uosSupport);
notifyUserUnsupportedTags(ubuntuSupport, deepinSupport, uosSupport ,debianSupport);
}
void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport)
void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport, bool debianSupport)
{
if (!SettingsPage::needUncompatibleNotification) {
return;
@ -455,30 +462,21 @@ void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSuppo
bool checkdeepin = (isDeepin && !deepinSupport);
bool checkuos = (isUOS && !uosSupport);
bool isUbuntu = false;
bool isDebian = false;
if (!checkdeepin && !checkuos)
{
// 检查是否为 ubuntu 系统
QFile lsb("/etc/lsb-release");
if (!lsb.open(QIODevice::ReadOnly))
{
qDebug() << "打开 /etc/lsb-release 失败";
}
else {
QString lsbInfo = lsb.readAll(); // 因为使用 readAll 读取后会默认跳转到文件末尾导致读出的数据为空,所以用单独一个 string 存储
if (lsbInfo.contains("Ubuntu"))
{
isUbuntu = true;
lsb.close();
}
else if (lsbInfo.contains("GXDE"))
{
// GXDE 使用 Ubuntu 的 tag
isUbuntu = true;
lsb.close();
}
// 使用更可靠的/etc/os-release检测
QFile osRelease("/etc/os-release");
if (osRelease.open(QIODevice::ReadOnly)) {
QString content = osRelease.readAll();
isUbuntu = content.contains("ID=ubuntu");
isDebian = content.contains("ID=debian") || content.contains("ID_LIKE=debian"); // 合并Debian系检测
osRelease.close();
}
}
bool checkubuntu = (isUbuntu && !ubuntuSupport);
bool checkdebian = (isDebian && !debianSupport);
if (checkdeepin)
{
@ -492,12 +490,17 @@ void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSuppo
{
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on Ubuntu, there may be problems"));
}
else if (!isUbuntu && !isDeepin && !isUOS)
else if (checkdebian)
{
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on Debian, there may be problems"));
}
if (!isUbuntu && !isDeepin && !isUOS && !isDebian)
{
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on current platform, there may be problems"));
}
return;
}
void AppIntoPage::on_downloadButton_clicked()

@ -29,7 +29,7 @@ private:
void initConnections();
void isDownloading(const QUrl &url);
void setAppinfoTags(const QStringList &tagList);
void notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport);
void notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport, bool debianSupport);
signals:
void clickedDownloadBtn();

@ -160,7 +160,6 @@
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -413,7 +412,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/community-small.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/community.svg&quot; height=30 width=30 /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -432,7 +431,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Capable to Ubuntu 22.04&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/ubuntu-small.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/ubuntu.png&quot; width=30 height=30 /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -451,7 +450,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Capable to UOS home 20&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/uos-small.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/uos-authorize.svg&quot; height=30 width=30 /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -489,7 +488,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/dtk-small.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/logo_icon.svg&quot; height=30 width=30 /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -508,7 +507,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Capable to deepin 20&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/deepin-small.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/deepin.svg&quot; height=30 width=30 /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -527,7 +526,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;An Appimage to deb app.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/a2d-small.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/a2d.png&quot;height=30 width=30 /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -546,7 +545,17 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A Wine app.Spark Store will automatically configure the wine kit for you&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/dwine5-small.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/dwine5.svg&quot; height=30 width=30 /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="tag_debian">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Capable to Debian Stable&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/debian.svg&quot; height=&quot;30&quot; width=&quot;30&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -676,7 +685,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>482</width>
<width>477</width>
<height>601</height>
</rect>
</property>
@ -757,7 +766,6 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -895,7 +903,6 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1060,7 +1067,6 @@ QListWidget::item::selected
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>

@ -106,3 +106,5 @@ TRANSLATIONS += \
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/durapps/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES +=