mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-10-09 11:52:21 +08:00
Merge branch 'dev' into Reason
This commit is contained in:
commit
d3b71fbacc
@ -14,6 +14,7 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define AppPageApplist 0
|
#define AppPageApplist 0
|
||||||
#define AppPageSearchlist 1
|
#define AppPageSearchlist 1
|
||||||
@ -32,11 +33,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
initTmpDir();
|
|
||||||
|
|
||||||
initUI();
|
initUI();
|
||||||
initConnections();
|
initConnections();
|
||||||
|
|
||||||
|
initTmpDir();
|
||||||
|
|
||||||
ui->appintopage->setDownloadWidget(downloadlistwidget);
|
ui->appintopage->setDownloadWidget(downloadlistwidget);
|
||||||
|
|
||||||
emit DGuiApplicationHelper::instance()->themeTypeChanged(DGuiApplicationHelper::instance()->themeType());
|
emit DGuiApplicationHelper::instance()->themeTypeChanged(DGuiApplicationHelper::instance()->themeType());
|
||||||
@ -393,6 +394,28 @@ void MainWindow::initTmpDir()
|
|||||||
// 新建临时文件夹
|
// 新建临时文件夹
|
||||||
QDir dir;
|
QDir dir;
|
||||||
dir.mkpath("/tmp/spark-store");
|
dir.mkpath("/tmp/spark-store");
|
||||||
|
|
||||||
|
// 检查写入权限
|
||||||
|
QFileInfo info("/tmp/spark-store");
|
||||||
|
|
||||||
|
if (info.isWritable() == false)
|
||||||
|
{
|
||||||
|
QtConcurrent::run([=]
|
||||||
|
{
|
||||||
|
sleep(3);
|
||||||
|
auto upgradeP = new QProcess();
|
||||||
|
upgradeP->startDetached("zenity", QStringList() << "--warning"
|
||||||
|
<< "--text"
|
||||||
|
<< "用户未拥有 /tmp/spark-store 写入权限,星火商店会因此工作异常,请检查!"
|
||||||
|
<< "--title"
|
||||||
|
<< "权限受限提示"
|
||||||
|
<< "--width"
|
||||||
|
<< "360"
|
||||||
|
);
|
||||||
|
upgradeP->waitForStarted();
|
||||||
|
upgradeP->waitForFinished(30);
|
||||||
|
upgradeP->deleteLater(); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::switchPage(int now) // 临时方案,回家后修改
|
void MainWindow::switchPage(int now) // 临时方案,回家后修改
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
#include <DSysInfo>
|
||||||
|
|
||||||
AppIntoPage::AppIntoPage(QWidget *parent)
|
AppIntoPage::AppIntoPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@ -336,6 +339,9 @@ void AppIntoPage::isDownloading(const QUrl &url)
|
|||||||
|
|
||||||
void AppIntoPage::setAppinfoTags(const QStringList &tagList)
|
void AppIntoPage::setAppinfoTags(const QStringList &tagList)
|
||||||
{
|
{
|
||||||
|
bool ubuntuSupport = false;
|
||||||
|
bool deepinSupport = false;
|
||||||
|
bool uosSupport = false;
|
||||||
foreach (const QString &tag, tagList)
|
foreach (const QString &tag, tagList)
|
||||||
{
|
{
|
||||||
if (tag == "community")
|
if (tag == "community")
|
||||||
@ -345,14 +351,18 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList)
|
|||||||
else if (tag == "ubuntu")
|
else if (tag == "ubuntu")
|
||||||
{
|
{
|
||||||
ui->tag_ubuntu->show();
|
ui->tag_ubuntu->show();
|
||||||
|
ubuntuSupport = true;
|
||||||
}
|
}
|
||||||
else if (tag == "deepin")
|
else if (tag == "deepin")
|
||||||
{
|
{
|
||||||
ui->tag_deepin->show();
|
ui->tag_deepin->show();
|
||||||
|
deepinSupport = true;
|
||||||
}
|
}
|
||||||
else if (tag == "uos")
|
else if (tag == "uos")
|
||||||
{
|
{
|
||||||
ui->tag_uos->show();
|
ui->tag_uos->show();
|
||||||
|
uosSupport = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (tag == "dtk5")
|
else if (tag == "dtk5")
|
||||||
{
|
{
|
||||||
@ -371,6 +381,44 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList)
|
|||||||
ui->tag_a2d->show();
|
ui->tag_a2d->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
notifyUserUnsupportedTags(ubuntuSupport, deepinSupport, uosSupport);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport)
|
||||||
|
{
|
||||||
|
bool checkdeepin = (Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Deepin && !deepinSupport);
|
||||||
|
bool checkuos = (Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Uos && !uosSupport);
|
||||||
|
bool isUbuntu = false;
|
||||||
|
if (!checkdeepin && !checkuos)
|
||||||
|
{
|
||||||
|
// 检查是否为 ubuntu 系统
|
||||||
|
QFile lsb("/etc/lsb-release");
|
||||||
|
if (lsb.open(QIODevice::ReadOnly) && lsb.readAll().contains("Ubuntu"))
|
||||||
|
{
|
||||||
|
isUbuntu = true;
|
||||||
|
lsb.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool checkubuntu = (isUbuntu && !ubuntuSupport);
|
||||||
|
|
||||||
|
if (checkdeepin)
|
||||||
|
{
|
||||||
|
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support deepin, there may be problems"));
|
||||||
|
}
|
||||||
|
else if (checkuos)
|
||||||
|
{
|
||||||
|
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support UOS, there may be problems"));
|
||||||
|
}
|
||||||
|
else if (checkubuntu)
|
||||||
|
{
|
||||||
|
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support Ubuntu, there may be problems"));
|
||||||
|
}
|
||||||
|
else if (!isUbuntu)
|
||||||
|
{
|
||||||
|
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support current platform, there may be problems"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppIntoPage::on_downloadButton_clicked()
|
void AppIntoPage::on_downloadButton_clicked()
|
||||||
|
@ -29,6 +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);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void clickedDownloadBtn();
|
void clickedDownloadBtn();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user