跟随到beta5

This commit is contained in:
shenmo 2020-07-09 09:05:50 +08:00
parent a3ca04ddc5
commit 892766470c
10 changed files with 103 additions and 39 deletions

View File

@ -11,7 +11,8 @@ web页面部分正在开发当中详情请见[web仓库](https://gitee.com/de
``` ```
http://dcstore.shenmo.tech/ http://dcstore.shenmo.tech/
http://store.shenmo.tech/ http://store.shenmo.tech/
http://store2.shenmo.tech/ http://store.moshengren.xyz/
http://store.jerrywang.top/
``` ```
#### 目录结构 #### 目录结构

View File

@ -96,17 +96,18 @@ void downloadlist::on_pushButton_clicked()
if(!isInstall){ if(!isInstall){
isInstall=true; isInstall=true;
ui->pushButton->setEnabled(false); ui->pushButton->setEnabled(false);
qDebug()<<"/tmp/deepin-community-store/"+ui->label_filename->text().toUtf8();
ui->label_2->setText("正在安装,请稍候"); ui->label_2->setText("正在安装,请稍候");
QtConcurrent::run([=](){ QtConcurrent::run([=](){
QProcess installer; QProcess installer;
if(reinstall){ if(reinstall){
installer.start("pkexec apt reinstall -y /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8()); installer.start("pkexec ssinstall /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8());
}else { }else {
installer.start("pkexec apt install -y /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8()); installer.start("pkexec ssinstall /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8());
} }
installer.waitForFinished(); installer.waitForFinished();
QString error=QString::fromStdString(installer.readAllStandardError().toStdString()); error=installer.readAllStandardError();
out=installer.readAllStandardOutput(); out=installer.readAllStandardOutput();
QStringList everyError=error.split("\n"); QStringList everyError=error.split("\n");
bool haveError=false; bool haveError=false;
@ -120,20 +121,23 @@ void downloadlist::on_pushButton_clicked()
notRoot=true; notRoot=true;
} }
} }
if(!haveError && !notRoot){ QProcess isInstall;
isInstall.start("dpkg -s "+pkgName);
isInstall.waitForFinished();
int error=QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
if(error==0){
ui->pushButton->hide(); ui->pushButton->hide();
ui->label_2->setText("安装完成"); ui->label_2->setText("安装完成");
ui->pushButton_3->show(); ui->pushButton_3->show();
}else if(haveError){ }else {
ui->pushButton->hide(); ui->pushButton->hide();
ui->label_2->setText("安装出现错误"); ui->label_2->setText("安装出现错误");
ui->pushButton_3->show(); ui->pushButton_3->show();
}
}else { if(notRoot){
ui->label_2->setText("安装被终止"); ui->label_2->setText("安装被终止");
ui->pushButton->setEnabled(true); ui->pushButton->setEnabled(true);
} }
isInstall=false;
}); });
qDebug()<<ui->label_filename->text().toUtf8(); qDebug()<<ui->label_filename->text().toUtf8();
} }
@ -150,6 +154,6 @@ void downloadlist::on_pushButton_2_clicked()
void downloadlist::on_pushButton_3_clicked() void downloadlist::on_pushButton_3_clicked()
{ {
output_w.setoutput(out); output_w.setoutput(out+"\nERROR:\n"+error);
output_w.show(); output_w.show();
} }

View File

@ -30,6 +30,8 @@ public:
QString out; QString out;
outputwindow output_w; outputwindow output_w;
bool reinstall=false; bool reinstall=false;
QString error;
QString pkgName;
private slots: private slots:
void on_pushButton_clicked(); void on_pushButton_clicked();

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>786</width> <width>684</width>
<height>54</height> <height>54</height>
</rect> </rect>
</property> </property>
@ -50,7 +50,7 @@
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>100</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -90,7 +90,7 @@
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>350</width> <width>280</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -123,7 +123,7 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>350</width> <width>300</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>

View File

@ -1,7 +1,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <DApplication> #include <DApplication>
#include <DWidgetUtil> //Dtk::Widget::moveToCenter(&w); 要调用它就得引用DWidgetUtil #include <DWidgetUtil> //Dtk::Widget::moveToCenter(&w); 要调用它就得引用DWidgetUtil
#include <QDesktopWidget>
DWIDGET_USE_NAMESPACE DWIDGET_USE_NAMESPACE
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -10,13 +10,37 @@ int main(int argc, char *argv[])
a.setAttribute(Qt::AA_UseHighDpiPixmaps); a.setAttribute(Qt::AA_UseHighDpiPixmaps);
a.loadTranslator(); a.loadTranslator();
a.setOrganizationName("community"); a.setOrganizationName("community");
a.setApplicationVersion(DApplication::buildVersion("1.0-beta3.2")); a.setApplicationVersion(DApplication::buildVersion("1.0-beta5"));
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/deepin-community-store"); a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/deepin-community-store");
a.setProductIcon(QIcon::fromTheme("spark-store")); //设置Logo a.setProductIcon(QIcon::fromTheme("spark-store")); //设置Logo
a.setProductName("星火应用商店"); a.setProductName("Spark应用商店");
a.setApplicationName("星火应用商店"); //只有在这儿修改窗口标题才有效 a.setApplicationName("Spark应用商店"); //只有在这儿修改窗口标题才有效
MainWindow w; MainWindow w;
QDesktopWidget *s=DApplication::desktop();
int d_w=s->width();
int d_h=s->height();
if(d_w<=1366){
w.setMinimumWidth(820);
w.resize(820,640);
}else if(d_w<=1920){
w.setMinimumWidth(1140);
w.resize(1140,760);
}else {
w.setMinimumWidth(1140);
w.resize(1140,760);
}
if(d_h<=768){
w.setMinimumHeight(640);
w.resize(820,640);
}else if(d_h<=1080){
w.setMinimumHeight(760);
w.resize(1140,760);
}else {
w.setMinimumHeight(760);
w.resize(1140,760);
}
w.show(); w.show();
//让打开时界面显示在正中 //让打开时界面显示在正中

View File

@ -1,7 +1,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <DMainWindow> #include <DMainWindow>
#include <QDesktopWidget>
DWIDGET_USE_NAMESPACE DWIDGET_USE_NAMESPACE
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
@ -10,7 +10,8 @@ MainWindow::MainWindow(QWidget *parent)
w = new Widget; w = new Widget;
resize(w->size()); //设置窗口大小 resize(w->size()); //设置窗口大小
setMinimumSize(950,700);
// setMinimumSize(950,700);
setCentralWidget(w); setCentralWidget(w);
// searchEdit->setParent(this); // searchEdit->setParent(this);
// searchEdit->move(1,1); // searchEdit->move(1,1);

View File

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

View File

@ -126,6 +126,7 @@ Widget::Widget(QWidget *parent) :
ui->label_aptserver->setText("不存在"); ui->label_aptserver->setText("不存在");
} }
aptserver.close(); aptserver.close();
ui->pushButton_5->hide();
} }
@ -167,6 +168,8 @@ void Widget::on_webView_loadStarted()
} }
void Widget::loadappinfo(QUrl arg1) void Widget::loadappinfo(QUrl arg1)
{ {
ui->pushButton_5->hide();
ui->label_show->setText("正在加载,请稍候"); ui->label_show->setText("正在加载,请稍候");
ui->label_show->show(); ui->label_show->show();
@ -212,11 +215,13 @@ void Widget::loadappinfo(QUrl arg1)
ui->label_info->setText(info); ui->label_info->setText(info);
ui->label_more->setText(json["More"].toString()); ui->label_more->setText(json["More"].toString());
QProcess isInstall; QProcess isInstall;
pkgName=json["Pkgname"].toString();
isInstall.start("dpkg -s "+json["Pkgname"].toString()); isInstall.start("dpkg -s "+json["Pkgname"].toString());
isInstall.waitForFinished(); isInstall.waitForFinished();
int error=QString::fromStdString(isInstall.readAllStandardError().toStdString()).length(); int error=QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
if(error==0){ if(error==0){
ui->pushButton->setText("重新安装"); ui->pushButton->setText("重新安装");
ui->pushButton_5->show();
}else { }else {
ui->pushButton->setText("安装"); ui->pushButton->setText("安装");
@ -309,6 +314,7 @@ void Widget::on_pushButton_clicked()
allDownload+=1; allDownload+=1;
QFileInfo info(url.path()); QFileInfo info(url.path());
QString fileName(info.fileName()); //获取文件名 QString fileName(info.fileName()); //获取文件名
download_list[allDownload-1].pkgName=pkgName;
if(fileName.isEmpty()) if(fileName.isEmpty())
{ {
fileName = "index.html"; fileName = "index.html";
@ -319,6 +325,7 @@ void Widget::on_pushButton_clicked()
item->setSizeHint(download_list[allDownload-1].size()); item->setSizeHint(download_list[allDownload-1].size());
ui->listWidget->setItemWidget(item,&download_list[allDownload-1]); ui->listWidget->setItemWidget(item,&download_list[allDownload-1]);
urList.append(url); urList.append(url);
qDebug()<<"下载:"<<url;
download_list[allDownload-1].setName(appName); download_list[allDownload-1].setName(appName);
download_list[allDownload-1].setFileName(fileName); download_list[allDownload-1].setFileName(fileName);
QPixmap icon; QPixmap icon;
@ -508,8 +515,8 @@ void Widget::on_pushButton_3_clicked()
QtConcurrent::run([=](){ QtConcurrent::run([=](){
ui->pushButton_3->setEnabled(false); ui->pushButton_3->setEnabled(false);
ui->comboBox_server->clear(); ui->comboBox_server->clear();
system(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list"); system("rm "+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"); system("wget -P "+QDir::homePath().toUtf8()+"/.config/deepin-community-store http://dcstore.shenmo.tech/store/server.list");
std::fstream server; std::fstream server;
server.open(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list",std::ios::in); server.open(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list",std::ios::in);
std::string lineTmp; std::string lineTmp;
@ -536,7 +543,7 @@ void Widget::on_pushButton_4_clicked()
if(sourcesList){ if(sourcesList){
sourcesList<<"deb [by-hash=force] "; sourcesList<<"deb [by-hash=force] ";
sourcesList<<QString::fromUtf8(ui->comboBox_server->currentText().toUtf8()).toStdString(); sourcesList<<QString::fromUtf8(ui->comboBox_server->currentText().toUtf8()).toStdString();
sourcesList<<" ./"; sourcesList<<" /";
std::fstream update; std::fstream update;
update.open("/tmp/spark-store/update.sh",std::ios::out); update.open("/tmp/spark-store/update.sh",std::ios::out);
update<<"#!/bin/sh\n"; update<<"#!/bin/sh\n";
@ -557,7 +564,7 @@ void Widget::on_pushButton_4_clicked()
} }
} }
if(!haveError){ if(!haveError){
ui->label_aptserver->setText("deb [by-hash=force] "+ui->comboBox_server->currentText().toUtf8()+" ./"); ui->label_aptserver->setText("deb [by-hash=force] "+ui->comboBox_server->currentText().toUtf8()+" /");
}else { }else {
ui->label_aptserver->setText("更新中发生错误请在终端使用apt update来查看错误原因"); ui->label_aptserver->setText("更新中发生错误请在终端使用apt update来查看错误原因");
} }
@ -568,3 +575,20 @@ void Widget::on_pushButton_4_clicked()
ui->pushButton_4->setEnabled(true); ui->pushButton_4->setEnabled(true);
}); });
} }
void Widget::on_pushButton_5_clicked()
{
QtConcurrent::run([=](){
ui->pushButton->setEnabled(false);
ui->pushButton_5->setEnabled(false);
QProcess uninstall;
uninstall.start("pkexec apt purge -y "+pkgName);
uninstall.waitForFinished();
ui->pushButton->setEnabled(true);
ui->pushButton->setText("安装");
ui->pushButton_5->hide();
ui->pushButton_5->setEnabled(true);
updatesEnabled();
system("notify-send 卸载完成 --icon=spark-store");
});
}

View File

@ -87,6 +87,8 @@ private slots:
void on_pushButton_4_clicked(); void on_pushButton_4_clicked();
void on_pushButton_5_clicked();
public: public:
QUrl url; QUrl url;
bool isBusy=false; bool isBusy=false;
@ -98,6 +100,7 @@ public:
QFile *file; QFile *file;
QString appName; QString appName;
QString urladdress; QString urladdress;
QString pkgName;
QToolButton * left_list[15]; QToolButton * left_list[15];
QWidget * left_menu_bg[15]; QWidget * left_menu_bg[15];
QUrl menuUrl[13]; QUrl menuUrl[13];

View File

@ -934,8 +934,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>299</width> <width>298</width>
<height>815</height> <height>814</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_17">
@ -1000,7 +1000,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1" rowspan="2"> <item row="5" column="1" rowspan="2">
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -1054,7 +1054,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3" rowspan="4"> <item row="1" column="3" rowspan="5">
<widget class="QLabel" name="label_info"> <widget class="QLabel" name="label_info">
<property name="font"> <property name="font">
<font> <font>
@ -1088,6 +1088,13 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="1">
<widget class="QPushButton" name="pushButton_5">
<property name="text">
<string>卸载</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -1165,8 +1172,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>376</width> <width>351</width>
<height>325</height> <height>38</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
@ -1306,8 +1313,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>807</width> <width>765</width>
<height>595</height> <height>662</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_23"> <layout class="QVBoxLayout" name="verticalLayout_23">
@ -1403,7 +1410,10 @@
<string notr="true">color:#808080</string> <string notr="true">color:#808080</string>
</property> </property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;源服务器的作用是保证软件更新并且支持使用apt工具获取软件。通常我们更建议你使用第一个线路作为更新源。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;源服务器的作用是保证软件更新并且支持使用apt工具获取软件。通常我们更建议你使用第一个线路作为更新源。虽然它可能偶尔有些慢。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -1465,7 +1475,7 @@
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;我们并不是官方团队和你一样我们也只是众多Linux/deepin系统爱好者和用户之中的一员我们开发并且运营这个“星火应用商店”,是为了让社区的朋友们一起分享好用的软件,或者一起参与开发,让大家都用到最新的,最优秀的软件。&lt;/p&gt;&lt;p&gt;如果你也想参与我们,不管是参与开发,设计,投递还是投稿作品,我们都欢迎你的加入。&lt;/p&gt;&lt;p&gt;QQ群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;我们并不是官方团队和你一样我们也只是众多Linux/deepin系统爱好者和用户之中的一员我们开发并且运营这个“Spark应用商店”,是为了让社区的朋友们一起分享好用的软件,或者一起参与开发,让大家都用到最新的,最优秀的软件。&lt;/p&gt;&lt;p&gt;我们并没有因此盈利,所有开发和维护人员都不会获得报酬,我们的主要支出大部分依赖于社区对我们的捐助,很感谢大家,这部分捐助让我们并不需要耗费太多精力去担心资金问题。&lt;/p&gt;&lt;p&gt;我们的服务和开发的软件都是免费供给大家使用,交流,学习的,但是在您的使用过程中一定要遵守当地的法律法规,否则出现任何问题和我们无关。&lt;/p&gt;&lt;p&gt;如果商店中任何一部分有侵犯您权益的行为,请告知我们&amp;lt;jifengshenmo@outlook.com&amp;gt;,我们会第一时间删除侵权内容。&lt;/p&gt;&lt;p&gt;如果你也想参与我们,不管是参与开发,设计,投递还是投稿作品,我们都欢迎你的加入。&lt;/p&gt;&lt;p&gt;QQ群872690351&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>