支持 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-small.png</file>
<file>tags/uos.svg</file> <file>tags/uos.svg</file>
<file>translations/qtwebengine_zh.qm</file> <file>translations/qtwebengine_zh.qm</file>
<file>tags/debian.svg</file>
</qresource> </qresource>
</RCC> </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_deepin->hide();
ui->tag_dwine2->hide(); ui->tag_dwine2->hide();
ui->tag_dwine5->hide(); ui->tag_dwine5->hide();
ui->tag_debian->hide();
ui->tag_ubuntu->hide(); ui->tag_ubuntu->hide();
ui->tag_community->hide(); ui->tag_community->hide();
ui->icon->clear(); ui->icon->clear();
@ -402,12 +403,18 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList)
bool ubuntuSupport = false; bool ubuntuSupport = false;
bool deepinSupport = false; bool deepinSupport = false;
bool uosSupport = false; bool uosSupport = false;
bool debianSupport = false;
foreach (const QString &tag, tagList) foreach (const QString &tag, tagList)
{ {
if (tag == "community") if (tag == "community")
{ {
ui->tag_community->show(); ui->tag_community->show();
} }
else if (tag == "debian")
{
ui->tag_debian->show();
debianSupport = true;
}
else if (tag == "ubuntu") else if (tag == "ubuntu")
{ {
ui->tag_ubuntu->show(); ui->tag_ubuntu->show();
@ -441,10 +448,10 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList)
ui->tag_a2d->show(); 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) { if (!SettingsPage::needUncompatibleNotification) {
return; return;
@ -455,30 +462,21 @@ void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSuppo
bool checkdeepin = (isDeepin && !deepinSupport); bool checkdeepin = (isDeepin && !deepinSupport);
bool checkuos = (isUOS && !uosSupport); bool checkuos = (isUOS && !uosSupport);
bool isUbuntu = false; bool isUbuntu = false;
bool isDebian = false;
if (!checkdeepin && !checkuos) if (!checkdeepin && !checkuos)
{ {
// 检查是否为 ubuntu 系统 // 使用更可靠的/etc/os-release检测
QFile lsb("/etc/lsb-release"); QFile osRelease("/etc/os-release");
if (!lsb.open(QIODevice::ReadOnly)) if (osRelease.open(QIODevice::ReadOnly)) {
{ QString content = osRelease.readAll();
qDebug() << "打开 /etc/lsb-release 失败"; isUbuntu = content.contains("ID=ubuntu");
} isDebian = content.contains("ID=debian") || content.contains("ID_LIKE=debian"); // 合并Debian系检测
else { osRelease.close();
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();
}
} }
} }
bool checkubuntu = (isUbuntu && !ubuntuSupport); bool checkubuntu = (isUbuntu && !ubuntuSupport);
bool checkdebian = (isDebian && !debianSupport);
if (checkdeepin) 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")); 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")); Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on current platform, there may be problems"));
} }
return; return;
} }
void AppIntoPage::on_downloadButton_clicked() void AppIntoPage::on_downloadButton_clicked()

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

@ -160,7 +160,6 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </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> <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>
<property name="text"> <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> </property>
</widget> </widget>
</item> </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> <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>
<property name="text"> <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> </property>
</widget> </widget>
</item> </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> <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>
<property name="text"> <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> </property>
</widget> </widget>
</item> </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> <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>
<property name="text"> <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> </property>
</widget> </widget>
</item> </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> <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>
<property name="text"> <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> </property>
</widget> </widget>
</item> </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> <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>
<property name="text"> <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> </property>
</widget> </widget>
</item> </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> <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>
<property name="text"> <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> </property>
</widget> </widget>
</item> </item>
@ -676,7 +685,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>482</width> <width>477</width>
<height>601</height> <height>601</height>
</rect> </rect>
</property> </property>
@ -757,7 +766,6 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
@ -895,7 +903,6 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
@ -1060,7 +1067,6 @@ QListWidget::item::selected
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>

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