Compare commits

..

7 Commits

Author SHA1 Message Date
68269577c0 beta3更新 2020-07-03 11:53:47 +08:00
58304f2c19 优化了app.json解析 2020-07-01 20:54:42 +08:00
4a4c1ce5a6 更新readme 2020-06-27 16:27:45 +08:00
536377d013 对接了web 2020-06-26 18:34:15 +08:00
72501163d4 更新 2020-06-26 14:34:49 +08:00
8e3f235910 跟随
提交者:沫 <jifengshenmo@outlook.com>
	修改:     downloadlist.cpp
	修改:     downloadlist.h
	修改:     downloadlist.ui
	新文件:   server.list
	修改:     widget.cpp
	修改:     widget.h
	修改:     widget.ui
2020-06-26 08:22:04 +08:00
5c8ee91a76 优化下载列表 2020-06-25 18:43:28 +08:00
16 changed files with 623 additions and 510 deletions

View File

@@ -1,22 +1,27 @@
# deepin-community-store
# 深度社区应用商店
#### 介绍
deepin社区商店由社区维护
web页面部分正在开发当中
web页面部分正在开发当中,详情请见[web仓库](https://gitee.com/deepin-community-store/DCSAPP_WEB)
#### 说明
需要在运行目录下放置服务器线路列表`server.list`,每行一个,在末尾需要添加“/”
当前服务器线路列表(直接复制到相应文件即可):
当前服务器线路列表(项目中包含):
```
http://dcstore.shenmo.tech/
http://store.shenmo.tech/
http://store2.shenmo.tech/
http://store.moshengren.xyz/
```
#### 目录结构
安装软件过程中产生的包,图标,截图等被储存到`/tmp/deepin-community-store/`中。
配置文件被储存到`~/.config/deepin-community-store/`中。
线路文件:新版的线路文件被放置于源服务器中,可随时刷新更新源列表
#### 参与贡献
1. Fork 本仓库

View File

@@ -26,11 +26,13 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += main.cpp\
mainwindow.cpp \
widget.cpp \
downloadlist.cpp
downloadlist.cpp \
outputwindow.cpp
HEADERS += mainwindow.h \
widget.h \
downloadlist.h
downloadlist.h \
outputwindow.h
CONFIG += link_pkgconfig
PKGCONFIG += dtkwidget
@@ -39,4 +41,5 @@ CONFIG += c++11
FORMS += \
widget.ui \
downloadlist.ui
downloadlist.ui \
outputwindow.ui

View File

@@ -1,326 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2020-06-25T14:44:37. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{964ed9bf-1dd7-4af2-8a95-0a12891624cd}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{10c1a6c8-39fd-4308-b111-0e790b25d916}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/vsesm/Desktop/新建文件夹/build-deepin-community-store-unknown-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/vsesm/Desktop/新建文件夹/build-deepin-community-store-unknown-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/vsesm/Desktop/新建文件夹/build-deepin-community-store-unknown-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Configuration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">deepin-community-store</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/vsesm/Desktop/新建文件夹/deepin-community-store/deepin-community-store.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">deepin-community-store.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/vsesm/Desktop/新建文件夹/build-deepin-community-store-unknown-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">20</value>
</data>
<data>
<variable>Version</variable>
<value type="int">20</value>
</data>
</qtcreator>

View File

@@ -1,6 +1,12 @@
#include "downloadlist.h"
#include "ui_downloadlist.h"
#include <QDebug>
#include <QIcon>
#include <QPixmap>
#include <QtConcurrent>
#include <QProcess>
bool downloadlist::isInstall=false;
downloadlist::downloadlist(QWidget *parent) :
QWidget(parent),
ui(new Ui::downloadlist)
@@ -9,6 +15,8 @@ downloadlist::downloadlist(QWidget *parent) :
ui->pushButton->setEnabled(false);
ui->progressBar->setValue(0);
ui->label_filename->hide();
ui->pushButton->hide();
ui->pushButton_3->hide();
ui->label->setStyleSheet("color:#000000");
}
@@ -20,6 +28,10 @@ downloadlist::~downloadlist()
void downloadlist::setValue(long long value)
{
ui->progressBar->setValue(value);
ui->label_2->setText(QString::number((double)value/100)+"% ("+speed+")");
if(ui->label_2->text()=="100%"){
ui->label_2->setText("已完成,等待安装");
}
}
void downloadlist::setMax(long long max)
@@ -39,17 +51,23 @@ QString downloadlist::getName()
void downloadlist::readyInstall()
{
ui->progressBar->hide();
ui->pushButton->setEnabled(true);
system("notify-send \""+ui->label->text().toUtf8()+"下载完成,等待安装\"");
if(!close){
ui->progressBar->hide();
ui->pushButton->setEnabled(true);
ui->pushButton->show();
ui->pushButton_2->hide();
system("notify-send \""+ui->label->text().toUtf8()+"下载完成,等待安装\"" +" --icon=/tmp/deepin-community-store/icon_"+QString::number(num).toUtf8()+".png");
}
}
void downloadlist::choose(bool isChoosed)
{
if(isChoosed){
ui->label->setStyleSheet("color:#FFFFFF");
ui->label_2->setStyleSheet("color:#FFFFFF");
}else {
ui->label->setStyleSheet("color:#000000");
ui->label_2->setStyleSheet("color:#000000");
}
}
@@ -58,8 +76,80 @@ void downloadlist::setFileName(QString fileName)
ui->label_filename->setText(fileName);
}
void downloadlist::seticon(const QPixmap icon)
{
ui->label_3->setPixmap(icon);
}
void downloadlist::closeDownload()
{
on_pushButton_2_clicked();
}
void downloadlist::setSpeed(QString s)
{
speed=s;
}
void downloadlist::on_pushButton_clicked()
{
system("x-terminal-emulator -e sudo apt install -y ./"+ui->label_filename->text().toUtf8());
qDebug()<<ui->label_filename->text().toUtf8();
if(!isInstall){
isInstall=true;
ui->pushButton->setEnabled(false);
ui->label_2->setText("正在安装,请稍候");
QtConcurrent::run([=](){
QProcess installer;
if(reinstall){
installer.start("pkexec apt reinstall -y /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8());
}else {
installer.start("pkexec apt install -y /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8());
}
installer.waitForFinished();
QString error=QString::fromStdString(installer.readAllStandardError().toStdString());
out=installer.readAllStandardOutput();
QStringList everyError=error.split("\n");
bool haveError=false;
bool notRoot=false;
for (int i=0;i<everyError.size();i++) {
qDebug()<<everyError[i].left(2);
if(everyError[i].left(2)=="E:"){
haveError=true;
}
if(everyError[i].right(14)=="Not authorized"){
notRoot=true;
}
}
if(!haveError && !notRoot){
ui->pushButton->hide();
ui->label_2->setText("安装完成");
ui->pushButton_3->show();
}else if(haveError){
ui->pushButton->hide();
ui->label_2->setText("安装出现错误");
ui->pushButton_3->show();
}else {
ui->label_2->setText("安装被终止");
ui->pushButton->setEnabled(true);
}
isInstall=false;
});
qDebug()<<ui->label_filename->text().toUtf8();
}
}
void downloadlist::on_pushButton_2_clicked()
{
ui->label_2->setText("已取消下载");
ui->pushButton_2->setEnabled(false);
ui->progressBar->hide();
close=true;
}
void downloadlist::on_pushButton_3_clicked()
{
output_w.setoutput(out);
output_w.show();
}

View File

@@ -2,7 +2,7 @@
#define DOWNLOADLIST_H
#include <QWidget>
#include <outputwindow.h>
namespace Ui {
class downloadlist;
}
@@ -22,13 +22,28 @@ public:
void choose(bool);
bool free;
void setFileName(QString);
public: signals:
void seticon(const QPixmap);
void closeDownload();
void setSpeed(QString);
int num;
bool close=false;
QString out;
outputwindow output_w;
bool reinstall=false;
private slots:
void on_pushButton_clicked();
void on_pushButton_2_clicked();
void on_pushButton_3_clicked();
private:
Ui::downloadlist *ui;
};
static bool isInstall;
QString speed;
};
//bool downloadlist::isInstall=false;
#endif // DOWNLOADLIST_H

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>636</width>
<height>52</height>
<width>786</width>
<height>54</height>
</rect>
</property>
<property name="windowTitle">
@@ -16,55 +16,37 @@
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="3">
<widget class="QProgressBar" name="progressBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="maximumSize">
<size>
<width>500</width>
<height>10</height>
</size>
</property>
<property name="value">
<number>24</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pushButton">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>安装</string>
<string>icon</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QLabel" name="label_filename">
<property name="maximumSize">
<size>
<width>0</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
@@ -88,7 +70,96 @@
</property>
</widget>
</item>
<item row="0" column="4">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>10</height>
</size>
</property>
<property name="value">
<number>24</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>等待开始下载</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -104,23 +175,60 @@
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<item>
<widget class="QPushButton" name="pushButton">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_filename">
<property name="text">
<string>TextLabel</string>
<string>安装</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>详情</string>
</property>
</widget>
</item>

View File

@@ -11,10 +11,10 @@ int main(int argc, char *argv[])
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
a.loadTranslator();
a.setOrganizationName("deepin");
a.setApplicationVersion(DApplication::buildVersion("1.0"));
a.setApplicationVersion(DApplication::buildVersion("1.0-beta3"));
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/deepin-community-store");
a.setProductIcon(QIcon::fromTheme("deepin-community-store")); //设置Logo
a.setProductName("deepin-community-store");
a.setProductName("深度社区应用商店");
a.setApplicationName("社区应用商店"); //只有在这儿修改窗口标题才有效
MainWindow w;

View File

@@ -10,7 +10,7 @@ MainWindow::MainWindow(QWidget *parent)
w = new Widget;
resize(w->size()); //设置窗口大小
setMinimumSize(900,700);
setMinimumSize(950,700);
setCentralWidget(w);
}
@@ -18,3 +18,4 @@ MainWindow::~MainWindow()
{
}

View File

@@ -3,18 +3,20 @@
#include <DMainWindow>
#include "widget.h"
#include <QThread>
DWIDGET_USE_NAMESPACE
class MainWindow : public DMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Widget *w;
};

24
outputwindow.cpp Normal file
View File

@@ -0,0 +1,24 @@
#include "outputwindow.h"
#include "ui_outputwindow.h"
#include <QDebug>
#include <QDesktopWidget>
outputwindow::outputwindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::outputwindow)
{
ui->setupUi(this);
setWindowTitle("安装详情");
QDesktopWidget *desktop = QApplication::desktop();
move((desktop->width() - width())/ 2, (desktop->height() - height()) /2);
}
outputwindow::~outputwindow()
{
delete ui;
}
void outputwindow::setoutput(QString output)
{
qDebug()<<output;
ui->textBrowser->setText(output);
}

22
outputwindow.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef OUTPUTWINDOW_H
#define OUTPUTWINDOW_H
#include <QWidget>
namespace Ui {
class outputwindow;
}
class outputwindow : public QWidget
{
Q_OBJECT
public:
explicit outputwindow(QWidget *parent = nullptr);
~outputwindow();
void setoutput(QString);
private:
Ui::outputwindow *ui;
};
#endif // OUTPUTWINDOW_H

24
outputwindow.ui Normal file
View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>outputwindow</class>
<widget class="QWidget" name="outputwindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>391</width>
<height>372</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextBrowser" name="textBrowser"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

5
server.list Normal file
View File

@@ -0,0 +1,5 @@
http://dcstore.shenmo.tech/
http://store.shenmo.tech/
http://store2.shenmo.tech/
http://store.moshengren.xyz/
http://127.0.0.1:8000/#/

View File

@@ -15,6 +15,9 @@
#include <QPixmap>
#include <QtConcurrent> //并发
#include <QSettings>
#include <QIcon>
#include <QWebFrame>
#include <QGraphicsOpacityEffect>
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
@@ -24,6 +27,7 @@ Widget::Widget(QWidget *parent) :
ui->setupUi(this);
ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);//用来激活接受linkClicked信号
ui->webView->page()->settings()->setAttribute(QWebSettings::JavascriptEnabled,true);
ui->stackedWidget->setCurrentIndex(0);
ui->listWidget->hide();
ui->label_setting1->hide();
@@ -43,11 +47,19 @@ Widget::Widget(QWidget *parent) :
left_list[12]=ui->menu_btn_theme;left_menu_bg[12]=ui->menu_bg_theme;
left_list[13]=ui->menu_btn_download;left_menu_bg[13]=ui->menu_bg_download;
left_list[14]=ui->menu_btn_settings;left_menu_bg[14]=ui->menu_bg_settings;
server.open("server.list",std::ios::in);
server.open(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list",std::ios::in);
// system("mkdir /etc/deepin-community-store/");
// server.open("/etc/deepin-community-store/server.list",std::ios::in);
std::string lineTmp;
while (getline(server,lineTmp)) {
ui->comboBox_server->addItem(QString::fromStdString(lineTmp));
if(server){
while (getline(server,lineTmp)) {
ui->comboBox_server->addItem(QString::fromStdString(lineTmp));
}
}else {
ui->comboBox_server->addItem("http://dcstore.shenmo.tech/");
}
QSettings readConfig(QDir::homePath()+"/.config/deepin-community-store/config.ini",QSettings::IniFormat);
if(readConfig.value("server/choose").toString()!=""){
ui->comboBox_server->setCurrentText(readConfig.value("server/choose").toString());
@@ -55,39 +67,72 @@ Widget::Widget(QWidget *parent) :
}else {
serverUrl="http://dcstore.shenmo.tech/";
}
ui->webView->setUrl(serverUrl+"store/");
configCanSeve=true;
qDebug()<<serverUrl;
menuUrl[0]=serverUrl + "store/frontpage/";
menuUrl[1]=serverUrl + "store/network/";
menuUrl[2]=serverUrl + "store/chat/";
menuUrl[3]=serverUrl + "store/music/";
menuUrl[4]=serverUrl + "store/video";
menuUrl[5]=serverUrl + "store/image_graphics/";
menuUrl[6]=serverUrl + "store/games/";
menuUrl[7]=serverUrl + "store/office/";
menuUrl[8]=serverUrl + "store/reading/";
menuUrl[9]=serverUrl + "store/development/";
menuUrl[10]=serverUrl + "store/tools/";
menuUrl[11]=serverUrl + "store/others/";
menuUrl[12]=serverUrl + "store/themes/";
menuUrl[0]=serverUrl + "store/#/";
menuUrl[1]=serverUrl + "store/#/network/";
menuUrl[2]=serverUrl + "store/#/relations";
menuUrl[3]=serverUrl + "store/#/musicandsound";
menuUrl[4]=serverUrl + "store/#/videos";
menuUrl[5]=serverUrl + "store/#/photos";
menuUrl[6]=serverUrl + "store/#/games/";
menuUrl[7]=serverUrl + "store/#/office";
menuUrl[8]=serverUrl + "store/#/reading/";
menuUrl[9]=serverUrl + "store/#/programming";
menuUrl[10]=serverUrl + "store/#/tools/";
menuUrl[11]=serverUrl + "store/#/others/";
menuUrl[12]=serverUrl + "store/#/themes";
ui->webView->setUrl(menuUrl[0]);
for (int i =0; i<15;i++){
download_list[i].num=i;
}
QGraphicsOpacityEffect *opacityEffect_1=new QGraphicsOpacityEffect;
QGraphicsOpacityEffect *opacityEffect_2=new QGraphicsOpacityEffect;
ui->line1_widget->setStyleSheet("background-color:#808080");
ui->line2_widget->setStyleSheet("background-color:#808080");
opacityEffect_1->setOpacity(0.2);
opacityEffect_2->setOpacity(0.2);
ui->line1_widget->setGraphicsEffect(opacityEffect_1);
ui->line2_widget->setGraphicsEffect(opacityEffect_2);
connect(ui->webView->page(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT([=](){qDebug()<<" ";}));
download_speed.setInterval(1000);
download_speed.start();
connect(&download_speed,&QTimer::timeout,[=](){
if(isdownload){
size1=download_size;
QString theSpeed;
double bspeed;
bspeed=size1-size2;
if(bspeed<1024){
theSpeed=QString::number(bspeed)+"B";
}else if (bspeed<(1024*1024)) {
theSpeed=QString::number(0.01*int(100*(bspeed/1024)))+"KB";
}else if (bspeed<(1024*1024*1024)) {
theSpeed=QString::number(0.01*int(100*(bspeed/(1024*1024))))+"MB";
}else {
theSpeed=QString::number(0.01*int(100*(bspeed/(1024*1024*1024))))+"GB";
}
download_list[nowDownload-1].setSpeed(theSpeed);
size2=download_size;
}
});
chooseLeftMenu(0);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_webView_linkClicked(const QUrl &arg1)
void Widget::on_webView_loadStarted()
{
QUrl arg1=ui->webView->page()->mainFrame()->requestedUrl().toString();
//判断,如果末尾是/就直接访问如果是app.json就打开详情页
if(arg1.path().right(1)=="/"){
ui->webView->setUrl(arg1);
}else if(arg1.path().right(8)=="app.json"){
if(arg1.path().right(8)=="app.json"){
load.cancel();//打开并发加载线程前关闭正在执行的线程
load.waitForFinished();
QPixmap pixmap_null;//一个空的图片指针,用来清空先有内容
ui->label_appicon->setPixmap(pixmap_null);
ui->screen_1->setPixmap(pixmap_null);
@@ -104,7 +149,9 @@ void Widget::on_webView_linkClicked(const QUrl &arg1)
ui->label_more->setText("");//清空详情介绍
ui->label_info->setText("");
ui->label_appname->setText("");
ui->pushButton->setEnabled(false);
ui->stackedWidget->setCurrentIndex(2);
load.cancel();//打开并发加载线程前关闭正在执行的线程
load = QtConcurrent::run([=](){
loadappinfo(arg1);
});
@@ -114,8 +161,7 @@ void Widget::loadappinfo(QUrl arg1)
{
ui->label_show->setText("正在加载,请稍候");
ui->label_show->show();
QProcess get_json;
QDir dir;
dir.cd("/tmp");
@@ -125,9 +171,16 @@ void Widget::loadappinfo(QUrl arg1)
get_json.waitForFinished();
QFile app_json("app.json");
if(app_json.open(QIODevice::ReadOnly)){
// //成功得到json文件
// //成功得到json文件
QByteArray json_array=app_json.readAll();
//将路径转化为相应源的下载路径
urladdress=arg1.toString().left(arg1.toString().length()-8);
QStringList downloadurl=urladdress.split("/");
urladdress=ui->comboBox_server->currentText();
for (int i=3;i<downloadurl.size();i++) {
urladdress+="/"+downloadurl[i];
}
//路径转化完成
QJsonObject json= QJsonDocument::fromJson(json_array).object();
appName = json["Name"].toString();
url=urladdress + json["Filename"].toString();
@@ -136,12 +189,18 @@ void Widget::loadappinfo(QUrl arg1)
ui->label_show->show();
//软件信息加载
QString info;
info="版本号:"+json["Version"].toString()+"\n";
info+="作者:"+json["Author"].toString()+"\n";
info+="官网:"+json["Website"].toString()+"\n";
info+="投稿者:"+json["Contributor"].toString()+"\n";
info+="更新时间:"+json["Update"].toString()+"\n";
info+="大小:"+json["Size"].toString()+"\n";
info="包名: "+json["Pkgname"].toString()+"\n";
info+="版本号: "+json["Version"].toString()+"\n";
if(json["Author"].toString()!="" && json["Author"].toString()!=" "){
info+="者: "+json["Author"].toString()+"\n";
}
if(json["Website"].toString()!="" && json["Website"].toString()!=" "){
info+="官网: "+json["Website"].toString()+"\n";
}
info+="投稿者: "+json["Contributor"].toString()+"\n";
info+="更新时间: "+json["Update"].toString()+"\n";
info+="大小: "+json["Size"].toString()+"\n";
ui->label_info->setText(info);
ui->label_more->setText(json["More"].toString());
QProcess isInstall;
@@ -150,6 +209,7 @@ void Widget::loadappinfo(QUrl arg1)
int error=QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
if(error==0){
ui->pushButton->setText("重新安装");
}else {
ui->pushButton->setText("安装");
}
@@ -159,6 +219,7 @@ void Widget::loadappinfo(QUrl arg1)
QPixmap appicon;
qDebug()<<appicon.load("icon.png");
ui->label_appicon->setPixmap(appicon);
ui->pushButton->setEnabled(true);
//截图展示加载
get_json.start("wget "+urladdress+"screen_1.png");
get_json.waitForFinished();
@@ -166,6 +227,11 @@ void Widget::loadappinfo(QUrl arg1)
ui->screen_1->show();
ui->screen_1->setPixmap(screen[0]);
ui->screen_1->setScaledContents(true);
ui->screen_2->hide();
ui->screen_3->hide();
ui->screen_4->hide();
ui->screen_5->hide();
}
get_json.start("wget "+urladdress+"screen_2.png");
get_json.waitForFinished();
@@ -173,6 +239,9 @@ void Widget::loadappinfo(QUrl arg1)
ui->screen_2->show();
ui->screen_2->setPixmap(screen[1]);
ui->screen_2->setScaledContents(true);
ui->screen_3->hide();
ui->screen_4->hide();
ui->screen_5->hide();
}
get_json.start("wget "+urladdress+"screen_3.png");
get_json.waitForFinished();
@@ -180,6 +249,8 @@ void Widget::loadappinfo(QUrl arg1)
ui->screen_3->show();
ui->screen_3->setPixmap(screen[2]);
ui->screen_3->setScaledContents(true);
ui->screen_4->hide();
ui->screen_5->hide();
}
get_json.start("wget "+urladdress+"screen_4.png");
get_json.waitForFinished();
@@ -187,6 +258,7 @@ void Widget::loadappinfo(QUrl arg1)
ui->screen_4->show();
ui->screen_4->setPixmap(screen[3]);
ui->screen_4->setScaledContents(true);
ui->screen_5->hide();
}
get_json.start("wget "+urladdress+"screen_5.png");
get_json.waitForFinished();
@@ -204,13 +276,15 @@ void Widget::loadappinfo(QUrl arg1)
void Widget::chooseLeftMenu(int index)
{
nowMenu=index;
for (int i=0;i<15;i++) {
left_list[i]->setStyleSheet("");
left_list[i]->setFont(QFont("",11));
left_menu_bg[i]->setStyleSheet("");
}
left_list[index]->setStyleSheet("color:#FFFFFF");
left_menu_bg[index]->setStyleSheet("background-color:#0081FF;border-radius:8");
if(index<=12){
ui->webView->setUrl(menuUrl[index]);
ui->stackedWidget->setCurrentIndex(0);
@@ -239,16 +313,23 @@ void Widget::on_pushButton_clicked()
urList.append(url);
download_list[allDownload-1].setName(appName);
download_list[allDownload-1].setFileName(fileName);
QPixmap icon;
icon.load("icon.png");
system("cp icon.png icon_"+QString::number(allDownload-1).toUtf8()+".png");
download_list[allDownload-1].seticon(icon);
if(!isBusy){
file = new QFile(fileName);
if(!file->open(QIODevice::WriteOnly)){
delete file;
file = 0;
file = nullptr;
return ;
}
nowDownload+=1;
startRequest(urList.at(nowDownload-1)); //进行链接请求
}
if(ui->pushButton->text()=="重新安装"){
download_list[allDownload-1].reinstall=true;
}
}
void Widget::startRequest(QUrl url)
@@ -257,6 +338,7 @@ void Widget::startRequest(QUrl url)
ui->label->hide();
isBusy=true;
isdownload=true;
download_list[allDownload-1].free=false;
reply = manager->get(QNetworkRequest(url));
connect(reply,SIGNAL(finished()),this,SLOT(httpFinished()));
connect(reply,SIGNAL(readyRead()),this,SLOT(httpReadyRead()));
@@ -264,11 +346,6 @@ void Widget::startRequest(QUrl url)
}
void Widget::closeList(int)
{
}
void Widget::httpReadyRead()
{
@@ -279,37 +356,44 @@ void Widget::httpReadyRead()
}
void Widget::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
{
download_list[nowDownload-1].setMax(1000); //最大值
download_list[nowDownload-1].setValue((bytesRead*1000)/totalBytes); //当前值
// download_list[nowDownload-1].setMax(bytesRead/10);
// download_list[nowDownload-1].setValue(totalBytes/10);
download_list[nowDownload-1].setMax(10000); //最大值
download_list[nowDownload-1].setValue((bytesRead*10000)/totalBytes); //当前值
download_size=bytesRead;
if(download_list[nowDownload-1].close){
download_list[nowDownload-1].closeDownload();
httpFinished();
}
}
void Widget::httpFinished() //完成下载
{
file->flush();
file->close();
reply->deleteLater();
reply = 0;
delete file;
file = 0;
isdownload=false;
isBusy=false;
download_list[nowDownload-1].readyInstall();
if(nowDownload<allDownload){
QString fileName=download_list[nowDownload].getName();
file = new QFile(fileName);
if(!file->open(QIODevice::WriteOnly))
{
qDebug()<<"file open error";
delete file;
file = 0;
return ;
file->flush();
file->close();
reply->deleteLater();
reply = nullptr;
delete file;
file = nullptr;
isdownload=false;
isBusy=false;
download_list[nowDownload-1].readyInstall();
download_list[nowDownload-1].free=true;
if(nowDownload<allDownload){
nowDownload+=1;
while (download_list[nowDownload-1].close) {
nowDownload+=1;
}
QString fileName=download_list[nowDownload-1].getName();
file = new QFile(fileName);
if(!file->open(QIODevice::WriteOnly))
{
delete file;
file = nullptr;
return ;
}
startRequest(urList.at(nowDownload-1));
}
nowDownload+=1;
startRequest(urList.at(nowDownload-1));
}
}
void Widget::on_listWidget_currentRowChanged(int currentRow)
{
@@ -330,7 +414,7 @@ void Widget::on_menu_btn_network_clicked() //网络应用
}
void Widget::on_menu_btn_chat_clicked()//社交沟通
{
chooseLeftMenu(2);
chooseLeftMenu(2);
}
void Widget::on_menu_btn_music_clicked()//音乐欣赏
{
@@ -342,7 +426,7 @@ void Widget::on_menu_btn_video_clicked()//视频播放
}
void Widget::on_menu_btn_photo_clicked()//图形图像
{
chooseLeftMenu(5);
chooseLeftMenu(5);
}
void Widget::on_menu_btn_game_clicked()//游戏娱乐
{
@@ -382,19 +466,18 @@ void Widget::on_menu_btn_settings_clicked()
}
void Widget::on_pushButton_2_clicked()
{
ui->webView->setUrl(menuUrl[nowMenu]);
ui->stackedWidget->setCurrentIndex(0);
}
void Widget::on_webView_loadStarted()
{
ui->label_show->setText("正在加载,请稍候");
ui->label_show->show();
}
void Widget::on_webView_loadFinished(bool arg1)
void Widget::on_webView_loadFinished()
{
ui->label_show->setText("");
ui->label_show->hide();
if(ui->webView->page()->mainFrame()->requestedUrl().toString().right(5)!=".json"){
ui->label_show->setText("正在加载,请稍候");
ui->label_show->hide();
}
}
@@ -410,3 +493,26 @@ void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1)
setConfig->setValue("server/choose",arg1);
}
}
void Widget::on_pushButton_3_clicked()
{
QtConcurrent::run([=](){
ui->pushButton_3->setEnabled(false);
ui->comboBox_server->clear();
system(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list");
system("wget -P "+QDir::homePath().toUtf8()+"/.config/deepin-community-store http://store2.shenmo.tech/store/server.list");
std::fstream server;
server.open(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list",std::ios::in);
std::string lineTmp;
if(server){
while (getline(server,lineTmp)) {
ui->comboBox_server->addItem(QString::fromStdString(lineTmp));
}
}else {
ui->comboBox_server->addItem("http://dcstore.shenmo.tech/");
}
ui->pushButton_3->setEnabled(true);
ui->comboBox_server->setCurrentIndex(0);
});
}

View File

@@ -11,15 +11,18 @@
#include <QProcess>
#include <QFuture>
#include <QToolButton>
#include <QTimer>
#define LIST_MAX 99
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
@@ -27,16 +30,14 @@ public:
int nowDownload=0;
int allDownload=0;
int isdownload=false;
void closeList(int);
void loadappinfo(QUrl);
void chooseLeftMenu(int index);
QPixmap screen[5];
QFuture<void> load;
QTimer download_speed;
private slots:
void on_webView_linkClicked(const QUrl &arg1);
void httpFinished();
void httpReadyRead();
void updateDataReadProgress(qint64,qint64);
@@ -74,7 +75,7 @@ private slots:
void on_webView_loadStarted();
void on_webView_loadFinished(bool arg1);
void on_webView_loadFinished();
void on_menu_btn_theme_clicked();
@@ -82,7 +83,9 @@ private slots:
void on_comboBox_server_currentIndexChanged(const QString &arg1);
private:
void on_pushButton_3_clicked();
public:
QUrl url;
bool isBusy=false;
downloadlist download_list[LIST_MAX];
@@ -97,6 +100,11 @@ private:
QWidget * left_menu_bg[15];
QUrl menuUrl[13];
bool configCanSeve=false;
int nowMenu=0;
long download_size=0;
long size1=0;
long size2=0;
};

View File

@@ -38,7 +38,7 @@
<number>0</number>
</property>
<property name="currentIndex">
<number>2</number>
<number>3</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_4">
@@ -87,7 +87,7 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color:#FFFFFF</string>
<string notr="true"/>
</property>
<property name="text">
<string>当前下载列表为空</string>
@@ -123,7 +123,7 @@
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="styleSheet">
<string notr="true">c</string>
<string notr="true"/>
</property>
<property name="lineWidth">
<number>0</number>
@@ -137,7 +137,7 @@
<x>0</x>
<y>0</y>
<width>781</width>
<height>769</height>
<height>815</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
@@ -474,6 +474,19 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
@@ -495,8 +508,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>535</width>
<height>130</height>
<width>765</width>
<height>595</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -547,6 +560,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>刷新</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_setting1">
<property name="maximumSize">
@@ -600,16 +620,6 @@
</widget>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_show">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QWidget" name="widget" native="true">
<property name="minimumSize">
@@ -684,10 +694,10 @@
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color:#FFFFFF</string>
<string notr="true"/>
</property>
<property name="text">
<string>首页推荐</string>
<string>商店首页</string>
</property>
</widget>
</item>
@@ -1147,7 +1157,7 @@
</sizepolicy>
</property>
<property name="text">
<string>工具插件</string>
<string>系统工具</string>
</property>
</widget>
</item>
@@ -1247,7 +1257,7 @@
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<widget class="QWidget" name="line1_widget" native="true">
<property name="minimumSize">
<size>
<width>0</width>
@@ -1257,11 +1267,11 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
<height>4</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color:#E0E0E1</string>
<string notr="true">background-color:#808080</string>
</property>
</widget>
</item>
@@ -1374,7 +1384,7 @@
</widget>
</item>
<item row="0" column="1" rowspan="2">
<widget class="QWidget" name="widget_8" native="true">
<widget class="QWidget" name="line2_widget" native="true">
<property name="minimumSize">
<size>
<width>1</width>
@@ -1388,7 +1398,23 @@
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color:#cccccc</string>
<string notr="true">background-color:#808080</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_show">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>