diff --git a/README.md b/README.md
index b9b88f8..6724643 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,19 @@
deepin社区商店,由社区维护
web页面部分正在开发当中
+#### 说明
+
+需要在运行目录下放置服务器线路列表`server.list`,每行一个,在末尾需要添加“/”
+
+当前服务器线路列表(直接复制到相应文件即可):
+
+```
+http://dcstore.shenmo.tech/
+http://store.shenmo.tech/
+http://store2.shenmo.tech/
+http://store.moshengren.xyz/
+```
+
#### 参与贡献
1. Fork 本仓库
diff --git a/deepin-community-store.pro b/deepin-community-store.pro
index a823fef..49b4326 100644
--- a/deepin-community-store.pro
+++ b/deepin-community-store.pro
@@ -30,8 +30,7 @@ SOURCES += main.cpp\
HEADERS += mainwindow.h \
widget.h \
- downloadlist.h \
- urls.h
+ downloadlist.h
CONFIG += link_pkgconfig
PKGCONFIG += dtkwidget
diff --git a/deepin-community-store.pro.user b/deepin-community-store.pro.user
new file mode 100644
index 0000000..0f83753
--- /dev/null
+++ b/deepin-community-store.pro.user
@@ -0,0 +1,326 @@
+
+
+
+
+
+ EnvironmentId
+ {ff08b897-ff9f-49db-9ac7-48af5bfb9f72}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ 桌面
+ 桌面
+ {497b0bdb-382d-4878-b6a7-69d35c33276e}
+ 0
+ 0
+ 0
+
+ /home/maicss/git/build-deepin-community-store-unknown-Debug
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+ true
+
+
+ /home/maicss/git/build-deepin-community-store-unknown-Release
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+
+ /home/maicss/git/build-deepin-community-store-unknown-Profile
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+ 3
+
+
+ 0
+ 部署
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy Configuration
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ deepin-community-store
+
+ Qt4ProjectManager.Qt4RunConfiguration:/home/maicss/git/deepin-community-store/deepin-community-store.pro
+ deepin-community-store.pro
+
+ 3768
+ false
+ true
+ true
+ false
+ false
+ true
+
+ /home/maicss/git/build-deepin-community-store-unknown-Debug
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 20
+
+
+ Version
+ 20
+
+
diff --git a/main.cpp b/main.cpp
index a488af3..e34471e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,4 +1,4 @@
- #include "mainwindow.h"
+#include "mainwindow.h"
#include
#include //Dtk::Widget::moveToCenter(&w); 要调用它,就得引用DWidgetUtil
diff --git a/urls.h b/urls.h
deleted file mode 100644
index 50b2247..0000000
--- a/urls.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef URLS_H
-#define URLS_H
-#define URL_MAIN "http://store2.shenmo.tech/store/"
-#define URL_NETWORK "http://store2.shenmo.tech/store/network/"
-#define URL_CHAT "http://store2.shenmo.tech/store/chat/"
-#define URL_MUSIC "http://store2.shenmo.tech/store/music"
-#define URL_VIDEO "http://store2.shenmo.tech/store/video"
-#define URL_PHOTO "http://store2.shenmo.tech/store/image_graphic/"
-#define URL_GAME "http://store2.shenmo.tech/store/games/"
-#define URL_OFFICE "http://store2.shenmo.tech/store/"
-#define URL_READ "http://store2.shenmo.tech/store/reading/"
-#define URL_DEV "http://store2.shenmo.tech/store/development/"
-#define URL_SYSTEM "http://store2.shenmo.tech/store/tools/"
-#define URL_OTHER "http://store2.shenmo.tech/store/others/"
-#define URL_THEME "http://store2.shenmo.tech/store/themes/"
-#endif // URLS_H
diff --git a/widget.cpp b/widget.cpp
index d26cb86..c093356 100644
--- a/widget.cpp
+++ b/widget.cpp
@@ -5,7 +5,7 @@
#include
#include
#include
-#include "urls.h"
+#include
#include
#include
#include
@@ -14,59 +14,65 @@
#include
#include
#include //并发
+#include
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
+ QString serverUrl;
+ std::fstream server;
+
ui->setupUi(this);
- ui->webView->setUrl(QUrl(URL_MAIN));
- ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+ ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);//用来激活接受linkClicked信号
ui->stackedWidget->setCurrentIndex(0);
ui->listWidget->hide();
+ ui->label_setting1->hide();
manager = new QNetworkAccessManager(this);
+ left_list[0]=ui->menu_btn_main;left_menu_bg[0]=ui->menu_bg_main;
+ left_list[1]=ui->menu_btn_network;left_menu_bg[1]=ui->menu_bg_network;
+ left_list[2]=ui->menu_btn_chat;left_menu_bg[2]=ui->menu_bg_chat;
+ left_list[3]=ui->menu_btn_music;left_menu_bg[3]=ui->menu_bg_music;
+ left_list[4]=ui->menu_btn_video;left_menu_bg[4]=ui->menu_bg_video;
+ left_list[5]=ui->menu_btn_photo;left_menu_bg[5]=ui->menu_bg_photo;
+ left_list[6]=ui->menu_btn_game;left_menu_bg[6]=ui->menu_bg_game;
+ left_list[7]=ui->menu_btn_office;left_menu_bg[7]=ui->menu_bg_office;
+ left_list[8]=ui->menu_btn_read;left_menu_bg[8]=ui->menu_bg_read;
+ left_list[9]=ui->menu_btn_dev;left_menu_bg[9]=ui->menu_bg_dev;
+ left_list[10]=ui->menu_btn_system;left_menu_bg[10]=ui->menu_bg_system;
+ left_list[11]=ui->menu_btn_other;left_menu_bg[11]=ui->menu_bg_other;
+ 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);
+ std::string lineTmp;
+ while (getline(server,lineTmp)) {
+ ui->comboBox_server->addItem(QString::fromStdString(lineTmp));
+ }
+ 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());
+ serverUrl=readConfig.value("server/choose").toString();
+ }else {
+ serverUrl="http://dcstore.shenmo.tech/";
+ }
+ ui->webView->setUrl(serverUrl+"store/");
- left_list[0]=ui->menu_btn_main;
- left_list[1]=ui->menu_btn_network;
- left_list[2]=ui->menu_btn_chat;
- left_list[3]=ui->menu_btn_music;
- left_list[4]=ui->menu_btn_video;
- left_list[5]=ui->menu_btn_photo;
- left_list[6]=ui->menu_btn_game;
- left_list[7]=ui->menu_btn_office;
- left_list[8]=ui->menu_btn_read;
- left_list[9]=ui->menu_btn_dev;
- left_list[10]=ui->menu_btn_system;
- left_list[11]=ui->menu_btn_other;
- left_list[12]=ui->menu_btn_theme;
- left_list[13]=ui->menu_btn_download;
- left_menu_bg[0]=ui->menu_bg_main;
- left_menu_bg[1]=ui->menu_bg_network;
- left_menu_bg[2]=ui->menu_bg_chat;
- left_menu_bg[3]=ui->menu_bg_music;
- left_menu_bg[4]=ui->menu_bg_video;
- left_menu_bg[5]=ui->menu_bg_photo;
- left_menu_bg[6]=ui->menu_bg_game;
- left_menu_bg[7]=ui->menu_bg_office;
- left_menu_bg[8]=ui->menu_bg_read;
- left_menu_bg[9]=ui->menu_bg_dev;
- left_menu_bg[10]=ui->menu_bg_system;
- left_menu_bg[11]=ui->menu_bg_other;
- left_menu_bg[12]=ui->menu_bg_theme;
- left_menu_bg[13]=ui->menu_bg_download;
- menuUrl[0]=URL_MAIN;
- menuUrl[1]=URL_NETWORK;
- menuUrl[2]=URL_CHAT;
- menuUrl[3]=URL_MUSIC;
- menuUrl[4]=URL_VIDEO;
- menuUrl[5]=URL_PHOTO;
- menuUrl[6]=URL_GAME;
- menuUrl[7]=URL_OFFICE;
- menuUrl[8]=URL_READ;
- menuUrl[9]=URL_DEV;
- menuUrl[10]=URL_SYSTEM;
- menuUrl[11]=URL_OTHER;
- menuUrl[12]=URL_THEME;
+ configCanSeve=true;
+ qDebug()<webView->setUrl(arg1);
@@ -129,12 +136,6 @@ void Widget::loadappinfo(QUrl arg1)
ui->label_appname->setText(appName);
system("rm -r *.png");
ui->label_show->show();
- //图标加载
- get_json.start("wget -O icon.png "+urladdress+"icon.png");
- get_json.waitForFinished();
- QPixmap appicon;
- qDebug()<label_appicon->setPixmap(appicon);
//软件信息加载
QString info;
info="版本号:"+json["version"].toString()+"\n";
@@ -142,7 +143,13 @@ void Widget::loadappinfo(QUrl arg1)
info+="官网:"+json["website"].toString()+"\n";
ui->label_info->setText(info);
ui->label_more->setText(json["more"].toString());
-
+ //图标加载
+ get_json.start("wget -O icon.png "+urladdress+"icon.png");
+ get_json.waitForFinished();
+ QPixmap appicon;
+ qDebug()<label_appicon->setPixmap(appicon);
+ //截图展示加载
get_json.start("wget "+urladdress+"screen_1.png");
get_json.waitForFinished();
if(screen[0].load("screen_1.png")){
@@ -187,17 +194,21 @@ void Widget::loadappinfo(QUrl arg1)
void Widget::chooseLeftMenu(int index)
{
- for (int i=0;i<14;i++) {
+ for (int i=0;i<15;i++) {
left_list[i]->setStyleSheet("");
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]);
+ qDebug()<stackedWidget->setCurrentIndex(0);
}else if (index==13) {
ui->stackedWidget->setCurrentIndex(1);
+ }else if (index==14) {
+ ui->stackedWidget->setCurrentIndex(3);
}
}
@@ -358,6 +369,10 @@ void Widget::on_menu_btn_download_clicked()
{
chooseLeftMenu(13);
}
+void Widget::on_menu_btn_settings_clicked()
+{
+ chooseLeftMenu(14);
+}
void Widget::on_pushButton_2_clicked()
{
ui->stackedWidget->setCurrentIndex(0);
@@ -375,3 +390,16 @@ void Widget::on_webView_loadFinished(bool arg1)
ui->label_show->hide();
}
+
+
+
+
+void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1)
+{
+ if(configCanSeve){
+ ui->label_setting1->show();
+ QSettings *setConfig=new QSettings(QDir::homePath()+"/.config/deepin-community-store/config.ini",QSettings::IniFormat);
+ qDebug()<setValue("server/choose",arg1);
+ }
+}
diff --git a/widget.h b/widget.h
index 3e441d2..6bc5e75 100644
--- a/widget.h
+++ b/widget.h
@@ -78,6 +78,10 @@ private slots:
void on_menu_btn_theme_clicked();
+ void on_menu_btn_settings_clicked();
+
+ void on_comboBox_server_currentIndexChanged(const QString &arg1);
+
private:
QUrl url;
bool isBusy=false;
@@ -89,9 +93,10 @@ private:
QFile *file;
QString appName;
QString urladdress;
- QToolButton * left_list[14];
- QWidget * left_menu_bg[14];
- QUrl menuUrl[14];
+ QToolButton * left_list[15];
+ QWidget * left_menu_bg[15];
+ QUrl menuUrl[13];
+ bool configCanSeve=false;
};
diff --git a/widget.ui b/widget.ui
index c84ac52..fdeec09 100644
--- a/widget.ui
+++ b/widget.ui
@@ -26,7 +26,10 @@
0
- -
+
+ 0
+
+
-
@@ -55,7 +58,7 @@
- https://bbs.deepin.org/
+ http://0.0.0.1/
@@ -122,6 +125,9 @@
c
+
+ 0
+
true
@@ -130,7 +136,7 @@
0
0
- 786
+ 781
770
@@ -361,7 +367,7 @@
0
0
- 752
+ 747
325
@@ -474,6 +480,134 @@
+
+
+ -
+
+
+ 0
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 547
+ 130
+
+
+
+
-
+
+
+
-
+
+
+
+ 18
+
+
+
+ 线路设置
+
+
+
+ -
+
+
+
-
+
+
+
+ 100
+ 16777215
+
+
+
+ 线路选择:
+
+
+
+ -
+
+
+
+ 300
+ 0
+
+
+
+
+ 300
+ 16777215
+
+
+
+
+ -
+
+
+
+ 160
+ 16777215
+
+
+
+ 重启商店后生效
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ Qt::AlignCenter
+
-
@@ -501,7 +635,13 @@
-
+
+
+ 5
+
+
+ 5
+
-
@@ -1171,6 +1311,52 @@
+ -
+
+
+
+ 0
+ 30
+
+
+
+
+ 16777215
+ 30
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ 高级设置
+
+
+
+
+
+
-
@@ -1187,13 +1373,22 @@
- -
-
-
-
+
-
+
+
+
+ 1
+ 0
+
-
- Qt::AlignCenter
+
+
+ 4
+ 16777215
+
+
+
+ background-color:#cccccc