添加 返回列表按钮

This commit is contained in:
Maicss 2020-08-08 09:12:46 +08:00
parent 3ca8fac6f9
commit f39890240f
10 changed files with 306 additions and 45 deletions

@ -1,8 +1,5 @@
<RCC>
<qresource prefix="/icons">
<file>icons/category_active_16px.svg</file>
<file>icons/category_active_22px.png</file>
<file>icons/category_active_22px@2x.png</file>
<file>icons/category_chat_dark.svg</file>
<file>icons/category_chat.svg</file>
<file>icons/category_develop_dark.svg</file>
@ -31,5 +28,7 @@
<file>icons/theme-symbolic.svg</file>
<file>icons/homepage.svg</file>
<file>icons/homepage_dark.svg</file>
<file>icons/category_active_dark.svg</file>
<file>icons/category_active.svg</file>
</qresource>
</RCC>

125
icons/category_active.svg Normal file

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16px"
height="16px"
viewBox="0 0 16 16"
version="1.1"
id="svg22"
sodipodi:docname="category_active_16px_l.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
<metadata
id="metadata26">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>category_active_16px</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="987"
id="namedview24"
showgrid="false"
inkscape:zoom="14.75"
inkscape:cx="-4"
inkscape:cy="8"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg22" />
<!-- Generator: Sketch 3.6.1 (26313) - http://www.bohemiancoding.com/sketch -->
<title
id="title2">category_active_16px</title>
<desc
id="desc4">Created with Sketch.</desc>
<defs
id="defs6" />
<g
id="Page-1"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd"
style="fill:#000000;fill-opacity:0.94999999">
<g
id="category_active_16px"
style="fill:#000000;fill-opacity:0.94999999">
<rect
id="Rectangle-1-Copy-44"
fill="#747568"
opacity="0"
x="0"
y="0"
width="16"
height="16"
style="fill:#000000;fill-opacity:0.94999999" />
<g
id="Group-2"
transform="translate(2.000000, 2.000000)"
fill="#FFFFFF"
style="fill:#000000;fill-opacity:0.94999999">
<rect
id="Rectangle-94"
x="0"
y="0"
width="2"
height="2"
style="fill:#000000;fill-opacity:0.94999999" />
<rect
id="Rectangle-97"
x="3"
y="0"
width="9"
height="2"
style="fill:#000000;fill-opacity:0.94999999" />
<rect
id="rect11"
x="0"
y="5"
width="2"
height="2"
style="fill:#000000;fill-opacity:0.94999999" />
<rect
id="rect13"
x="3"
y="5"
width="9"
height="2"
style="fill:#000000;fill-opacity:0.94999999" />
<rect
id="rect15"
x="0"
y="10"
width="2"
height="2"
style="fill:#000000;fill-opacity:0.94999999" />
<rect
id="rect17"
x="3"
y="10"
width="9"
height="2"
style="fill:#000000;fill-opacity:0.94999999" />
</g>
</g>
</g>
</svg>

After

(image error) Size: 3.3 KiB

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.6.1 (26313) - http://www.bohemiancoding.com/sketch -->
<title>category_active_16px</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="category_active_16px">
<rect id="Rectangle-1-Copy-44" fill="#747568" opacity="0" x="0" y="0" width="16" height="16"></rect>
<g id="Group-2" transform="translate(2.000000, 2.000000)" fill="#FFFFFF">
<rect id="Rectangle-94" x="0" y="0" width="2" height="2"></rect>
<rect id="Rectangle-97" x="3" y="0" width="9" height="2"></rect>
<rect id="Rectangle-94" x="0" y="5" width="2" height="2"></rect>
<rect id="Rectangle-97" x="3" y="5" width="9" height="2"></rect>
<rect id="Rectangle-94" x="0" y="10" width="2" height="2"></rect>
<rect id="Rectangle-97" x="3" y="10" width="9" height="2"></rect>
</g>
</g>
</g>
</svg>

Before

(image error) Size: 1.2 KiB

Binary file not shown.

Before

(image error) Size: 146 B

Binary file not shown.

Before

(image error) Size: 227 B

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16px"
height="16px"
viewBox="0 0 16 16"
version="1.1"
id="svg22"
sodipodi:docname="category_active_16px.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
<metadata
id="metadata26">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="987"
id="namedview24"
showgrid="false"
inkscape:zoom="14.75"
inkscape:cx="8"
inkscape:cy="8"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg22" />
<!-- Generator: Sketch 3.6.1 (26313) - http://www.bohemiancoding.com/sketch -->
<title
id="title2">category_active_16px</title>
<desc
id="desc4">Created with Sketch.</desc>
<defs
id="defs6" />
<g
id="Page-1"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd"
style="fill:#ffffff;fill-opacity:0.60000002">
<g
id="category_active_16px"
style="fill:#ffffff;fill-opacity:0.60000002">
<rect
id="Rectangle-1-Copy-44"
fill="#747568"
opacity="0"
x="0"
y="0"
width="16"
height="16"
style="fill:#ffffff;fill-opacity:0.60000002" />
<g
id="Group-2"
transform="translate(2.000000, 2.000000)"
fill="#FFFFFF"
style="fill:#ffffff;fill-opacity:0.60000002">
<rect
id="Rectangle-94"
x="0"
y="0"
width="2"
height="2"
style="fill:#ffffff;fill-opacity:0.60000002" />
<rect
id="Rectangle-97"
x="3"
y="0"
width="9"
height="2"
style="fill:#ffffff;fill-opacity:0.60000002" />
<rect
id="rect11"
x="0"
y="5"
width="2"
height="2"
style="fill:#ffffff;fill-opacity:0.60000002" />
<rect
id="rect13"
x="3"
y="5"
width="9"
height="2"
style="fill:#ffffff;fill-opacity:0.60000002" />
<rect
id="rect15"
x="0"
y="10"
width="2"
height="2"
style="fill:#ffffff;fill-opacity:0.60000002" />
<rect
id="rect17"
x="3"
y="10"
width="9"
height="2"
style="fill:#ffffff;fill-opacity:0.60000002" />
</g>
</g>
</g>
</svg>

After

(image error) Size: 3.3 KiB

@ -42,6 +42,7 @@ int main(int argc, char *argv[])
w.setMinimumHeight(760);
w.resize(1180,760);
}
// w.resize(925,650);
w.show();
QString arg1=argv[1];

@ -119,6 +119,7 @@ void Widget::initUI()
ui->pushButton_uninstall->hide();
ui->line1_widget->setStyleSheet("background-color:#808080");
ui->icon->setPixmap(QIcon::fromTheme("spark-store").pixmap(36,36));
ui->titlebar->setFixedHeight(48);
@ -130,12 +131,20 @@ void Widget::initUI()
//搜索框
QWidget *w_titlebar=new QWidget;
QHBoxLayout *ly_titlebar=new QHBoxLayout;
w_titlebar->setLayout(ly_titlebar);
ly_titlebar->addWidget(ui->pushButton_return);
ly_titlebar->addStretch();
ly_titlebar->addSpacing(50);
ly_titlebar->addWidget(searchEdit);
ly_titlebar->addStretch();
titlebar=ui->titlebar;
titlebar->addWidget(searchEdit);
titlebar->setCustomWidget(w_titlebar);
// titlebar->setIcon(QIcon::fromTheme("spark-store"));
titlebar->setTitle("星火应用商店");
searchEdit->setPlaceholderText("搜索或打开链接");
searchEdit->setMaximumWidth(300);
searchEdit->setFixedWidth(300);
titlebar->setSeparatorVisible(true);
// titlebar->setAutoHideOnFullscreen(true);
@ -261,6 +270,7 @@ void Widget::setTheme(bool isDark,QColor color)
ui->label->setStyleSheet("background-color:#252525");
ui->scrollArea->setStyleSheet("#scrollArea{background-color:#252525}");
ui->label_show->setStyleSheet("background-color:#252525");
ui->pushButton_return->setIcon(QIcon(":/icons/icons/category_active_dark.svg"));
//菜单图标
@ -274,6 +284,7 @@ void Widget::setTheme(bool isDark,QColor color)
ui->label->setStyleSheet("background-color:#FFFFFF");
ui->scrollArea->setStyleSheet("#scrollArea{background-color:#F8F8F8}");
ui->label_show->setStyleSheet("background-color:#F8F8F8");
ui->pushButton_return->setIcon(QIcon(":/icons/icons/category_active.svg"));
}
main_color=color;
@ -292,7 +303,6 @@ DTitlebar* Widget::getTitlebar()
void Widget::on_webView_loadStarted()
{
m_loadweb->setValue(0);
m_loadweb->show();
m_loaderror->hide();
@ -699,21 +709,25 @@ void Widget::httpFinished() //完成下载
void Widget::on_pushButton_return_clicked()
{
ui->stackedWidget->setCurrentIndex(0);
if(themeIsDark){
QString darkurl=menuUrl[nowMenu].toString();
QStringList tmp=darkurl.split("/");
darkurl.clear();
for (int i=0;i<tmp.size()-1;i++) {
darkurl+=tmp[i]+"/";
}
darkurl+="dark"+tmp[tmp.size()-1];
ui->webView->setUrl(darkurl);
qDebug()<<darkurl;
}else {
ui->webView->setUrl(menuUrl[nowMenu]);
}
// ui->stackedWidget->setCurrentIndex(0);
// if(nowMenu==13){
// chooseLeftMenu(13);
// return;
// }
chooseLeftMenu(nowMenu);
// if(themeIsDark){
// QString darkurl=menuUrl[nowMenu].toString();
// QStringList tmp=darkurl.split("/");
// darkurl.clear();
// for (int i=0;i<tmp.size()-1;i++) {
// darkurl+=tmp[i]+"/";
// }
// darkurl+="dark"+tmp[tmp.size()-1];
// ui->webView->setUrl(darkurl);
// qDebug()<<darkurl;
// }else {
// ui->webView->setUrl(menuUrl[nowMenu]);
// }
}
void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1)
@ -910,3 +924,13 @@ void Widget::on_btn_openDir_clicked()
QDesktopServices::openUrl(QUrl("file:///tmp/spark-store", QUrl::TolerantMode));
}
void Widget::on_stackedWidget_currentChanged(int arg1)
{
qDebug()<<arg1;
if(arg1==0 || arg1==1){
ui->pushButton_return->setEnabled(false);
}else {
ui->pushButton_return->setEnabled(true);
}
}

@ -67,6 +67,8 @@ private slots:
void on_btn_openDir_clicked();
void on_stackedWidget_currentChanged(int arg1);
public:
QUrl url;

@ -649,7 +649,11 @@
</size>
</property>
<property name="text">
<string>&lt;</string>
<string/>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/icons/category_active.svg</normaloff>:/icons/icons/category_active.svg</iconset>
</property>
</widget>
</item>
@ -1059,8 +1063,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>901</width>
<height>786</height>
<width>687</width>
<height>830</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@ -1364,6 +1368,8 @@
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="icons.qrc"/>
</resources>
<connections/>
</ui>