!146 修正一些问题

Merge pull request !146 from Pluto/dev
This commit is contained in:
2022-11-26 02:06:19 +00:00
committed by Gitee
8 changed files with 82 additions and 22 deletions

View File

@@ -4,15 +4,27 @@
#include <DAboutDialog>
#include <QVector>
#include <QScreen>
#include <QDir>
#include <QSettings>
//新增dbus
#include <QDBusInterface>
#include <QDBusPendingCall>
// build time
#include <QDate>
#include <QTime>
#include "widget.h"
DWIDGET_USE_NAMESPACE
int main(int argc, char *argv[])
{
// Get build time
static const QString version = "Version 3.3.3~test4";
static const QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy");
static const QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
DApplication::loadDXcbPlugin(); // 已废弃但是对于非deepin桌面可以正常使用标题栏
DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持
// 程序内强制添加"-platformtheme deepin"参数喂给Qt让Qt正确使用Deepin主题修复各种奇怪样式问题
@@ -32,12 +44,25 @@ int main(int argc, char *argv[])
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
a.loadTranslator(); // 载入翻译
QSettings readConfig(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
if (readConfig.value("build/version").toString() != version){
qDebug() << "Spark Store has been updated!";
QSettings *setConfig = new QSettings(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
setConfig->setValue("build/version", "Version 3.3.3~test4");
setConfig->setValue("build/time", buildDate.toString("yyyy.MM.dd")+"-"+buildTime.toString());
setConfig->deleteLater();
}
//Customized DAboutDialog
DAboutDialog dialog;
a.setAboutDialog(&dialog);
dialog.setLicense(QObject::tr("We publish this program under GPL V3"));
dialog.setVersion(DApplication::buildVersion("Version 3.3.3~test4"));
dialog.setVersion(DApplication::buildVersion(readConfig.value("build/version").toString()+"-"+readConfig.value("build/time").toString()));
dialog.setProductIcon(QIcon::fromTheme("spark-store")); // 设置Logo
dialog.setProductName(QLabel::tr("Spark Store"));
dialog.setDescription(
@@ -58,7 +83,7 @@ int main(int argc, char *argv[])
a.setOrganizationName("spark-union");
a.setOrganizationDomain("https://www.deepinos.org/");
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
a.setApplicationVersion(DApplication::buildVersion("3.3.3~test4"));
a.setApplicationVersion(DApplication::buildVersion(readConfig.value("build/version").toString()));
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
a.setApplicationDescription(
QObject::tr(

View File

@@ -638,13 +638,15 @@ void Widget::chooseLeftMenu(int index)
ui->stackedWidget->setCurrentIndex(0);
}
else if (index == 13){
QtConcurrent::run([=]{
auto upgradeP = new QProcess();
upgradeP->startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh");
upgradeP->waitForStarted();
upgradeP->waitForFinished(-1);
});
QFile upgradeStatus("/tmp/spark-store/upgradeStatus.txt");
if (!upgradeStatus.exists()){
QtConcurrent::run([=]{
auto upgradeP = new QProcess();
upgradeP->startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh");
upgradeP->waitForStarted();
upgradeP->waitForFinished(-1);
});
}
ui->stackedWidget->setCurrentIndex(0);
}
else
@@ -743,9 +745,15 @@ void Widget::searchApp(QString text)
// 禁止同时进行多次搜索
if (!mutex.tryLock())
{
qDebug() << "Do not repeat searches";
sendNotification(tr("Do not repeat searches!"));
return;
}
//加载动画
spinner->show();
spinner->start();
// 关键字搜索处理
httpClient->get("https://search.deepinos.org.cn/appinfo/search")
.header("content-type", "application/json")
@@ -758,8 +766,14 @@ void Widget::searchApp(QString text)
qDebug() << "相关应用未找到!";
sendNotification(tr("Relative apps Not Found!"));
mutex.unlock();
clearSearchApp();
spinner->stop();
spinner->hide();
ui->stackedWidget->setCurrentIndex(0);
ui->webEngineView->setUrl(QUrl("https://wayou.github.io/t-rex-runner"));
return;
}
clearSearchApp();
displaySearchApp(json); })
.onError([this](QString errorStr)
{
@@ -779,9 +793,9 @@ void Widget::closeEvent(QCloseEvent *event)
}
/**
* @brief 展示搜索的APP信息
* @brief 清除搜索的APP信息
*/
void Widget::displaySearchApp(QJsonArray array)
void Widget::clearSearchApp()
{
ui->stackedWidget->setCurrentIndex(4);
@@ -796,13 +810,20 @@ void Widget::displaySearchApp(QJsonArray array)
}
main->removeItem(applist_grid);
spinner->show();
spinner->start();
}
/**
* @brief 展示搜索的APP信息
*/
void Widget::displaySearchApp(QJsonArray array)
{
for(int i = 0; i < array.size(); i++)
{
QJsonObject appInfo = array.at(i).toObject();
AppItem *appItem = new AppItem(this);
appItem->setAttribute(Qt::WA_DeleteOnClose);
QString url = QString("spk://store/%1/%2")
.arg(appInfo["category_slug"].toString())
.arg(appInfo["pkgname"].toString());
@@ -1088,6 +1109,7 @@ void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1)
QSettings *setConfig = new QSettings(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
setConfig->setValue("server/choose", arg1);
setConfig->setValue("server/updated", updatedInfo);
setConfig->deleteLater();
}
}
@@ -1384,7 +1406,17 @@ void Widget::on_webEngineView_loadFinished(bool arg1)
void Widget::on_pushButton_update_clicked()
{
QDesktopServices::openUrl(QUrl("https://www.deepinos.org/"));
QString feedbackSpk = "spk://store/chat/store.spark-app.feedback";
QFile actionSubmissionClientStatus("/opt/durapps/store.spark-app.feedback");
if (actionSubmissionClientStatus.exists())
{
qDebug() << "反馈器存在";
QProcess::startDetached("sh /opt/durapps/store.spark-app.feedback/launch.sh");
}
else{
qDebug() << "反馈器不存在,跳转页面";
openUrl(feedbackSpk);
}
}
void Widget::onGetUrl(const QString &url)

View File

@@ -82,6 +82,7 @@ private slots:
void sltAppinfoScreenshot(QPixmap *picture, int index);
void sltAppinfoFinish();
void clearSearchApp(); // 清除搜索的APP信息
void displaySearchApp(QJsonArray array); // 展示搜索的APP信息
void downloadIconsFinished(int arraysize); // 当前搜索列表图标是否下载完成

View File

@@ -1380,7 +1380,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;We are &lt;span style=&quot; font-weight:600;&quot;&gt;NOT&lt;/span&gt; the official team, just like you, we are just one of the many Linux/deepin system enthusiasts and users, we develop and run the &amp;quot;Spark Store&amp;quot;! &amp;quot;, is to bring the community together to share useful software, or to participate in development together, so that we all use the latest and greatest software. &lt;/p&gt;&lt;p&gt;We don't make a profit from this, all developers and maintainers don't get paid, and we rely on the community's donations to us for most of our expenses, which we are grateful for and which allow us not to spend too much energy worrying about funding. &lt;/p&gt;&lt;p&gt;Our service and software are free for everyone to use, communicate, and learn, but you must comply with local laws and regulations in the process of your use, otherwise any problems have nothing to do with us. &lt;/p&gt;&lt;p&gt;If any part of the store infringes your rights, please tell us &amp;lt;jifengshenmo@outlook.com&amp;gt; we will remove the infringing content as soon as possible. &lt;/p&gt;&lt;p&gt;If you'd like to get involved with us too, whether you're involved in development, design, pitching or submitting work, we welcome you to join us. &lt;/p&gt;&lt;p&gt;QQ group:872690351&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;We are &lt;span style=&quot; font-weight:600;&quot;&gt;NOT&lt;/span&gt; the official team, just like you, we are just one of the many Linux/deepin system enthusiasts and users, we develop and run the &amp;quot;Spark Store&amp;quot;! &amp;quot;, is to bring the community together to share useful software, or to participate in development together, so that we all use the latest and greatest software. &lt;/p&gt;&lt;p&gt;We don't make a profit from this, all developers and maintainers don't get paid, and we rely on the community's donations to us for most of our expenses, which we are grateful for and which allow us not to spend too much energy worrying about funding. &lt;/p&gt;&lt;p&gt;Our service and software are free for everyone to use, communicate, and learn, but you must comply with local laws and regulations in the process of your use, otherwise any problems have nothing to do with us. &lt;/p&gt;&lt;p&gt;If any part of the store infringes your rights, please tell us &amp;lt;jifengshenmo@outlook.com&amp;gt; we will remove the infringing content as soon as possible. &lt;/p&gt;&lt;p&gt;If you'd like to get involved with us too, whether you're involved in development, design, pitching or submitting work, we welcome you to join us. &lt;/p&gt;&lt;p&gt;Connect us on Spark IM: https://chat.shenmo.tech&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>