mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-07-17 19:12:22 +08:00
新增 黑色模式
This commit is contained in:
parent
0e387acfb6
commit
070788d50d
14
main.cpp
14
main.cpp
@ -22,24 +22,24 @@ int main(int argc, char *argv[])
|
||||
int d_w=s->width();
|
||||
int d_h=s->height();
|
||||
if(d_w<=1366){
|
||||
w.setMinimumWidth(820);
|
||||
w.resize(820,640);
|
||||
w.setMinimumWidth(350);
|
||||
w.resize(835,640);
|
||||
}else if(d_w<=1920){
|
||||
w.setMinimumWidth(1140);
|
||||
w.resize(1140,760);
|
||||
w.resize(1180,760);
|
||||
}else {
|
||||
w.setMinimumWidth(1140);
|
||||
w.resize(1140,760);
|
||||
w.resize(1180,760);
|
||||
}
|
||||
if(d_h<=768){
|
||||
w.setMinimumHeight(640);
|
||||
w.resize(820,640);
|
||||
w.resize(835,640);
|
||||
}else if(d_h<=1080){
|
||||
w.setMinimumHeight(760);
|
||||
w.resize(1140,760);
|
||||
w.resize(1180,760);
|
||||
}else {
|
||||
w.setMinimumHeight(760);
|
||||
w.resize(1140,760);
|
||||
w.resize(1180,760);
|
||||
}
|
||||
|
||||
w.show();
|
||||
|
23
widget.cpp
23
widget.cpp
@ -165,7 +165,7 @@ void Widget::initConfig()
|
||||
configCanSave=true; //防止出发保存配置信号
|
||||
// ui->
|
||||
// menuUrl[0]="https://mp.weixin.qq.com/s/1OmCgJ13yVDSRebdgtW9fg";
|
||||
menuUrl[0]=serverUrl + "store/#";
|
||||
menuUrl[0]=serverUrl + "store/#/";
|
||||
menuUrl[1]=serverUrl + "store/#/network";
|
||||
menuUrl[2]=serverUrl + "store/#/relations";
|
||||
menuUrl[3]=serverUrl + "store/#/musicandsound";
|
||||
@ -212,18 +212,21 @@ void Widget::setTheme(bool isDark,QColor color)
|
||||
{
|
||||
if(isDark){
|
||||
//黑色模式
|
||||
themeIsDark=true;
|
||||
ui->widget_menuList->setStyleSheet("background-color:#282828");
|
||||
ui->webView->setStyleSheet("background-color:#282828");
|
||||
ui->btn_openDir->setStyleSheet("color:#8B91A1;background-color:#2E2F30;border:0px");
|
||||
|
||||
// ui->webView->page()->;
|
||||
}else {
|
||||
//亮色模式
|
||||
themeIsDark=false;
|
||||
ui->widget_menuList->setStyleSheet("background-color:#FFFFFF");
|
||||
ui->webView->setStyleSheet("background-color:#FFFFFF");
|
||||
ui->btn_openDir->setStyleSheet("color:#505050;background-color:#FBFBFB;border:0px");
|
||||
}
|
||||
main_color=color;
|
||||
left_list[nowMenu]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px");
|
||||
// left_list[nowMenu]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px");
|
||||
chooseLeftMenu(nowMenu);
|
||||
}
|
||||
|
||||
void Widget::on_webView_loadStarted()
|
||||
@ -280,7 +283,19 @@ void Widget::chooseLeftMenu(int index)
|
||||
}
|
||||
left_list[index]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px");
|
||||
if(index<=12){
|
||||
ui->webView->setUrl(menuUrl[index]);
|
||||
if(themeIsDark){
|
||||
QString darkurl=menuUrl[index].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[index]);
|
||||
}
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
}else if (index==13) {
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
|
1
widget.h
1
widget.h
@ -78,6 +78,7 @@ public:
|
||||
QString urladdress;
|
||||
QString pkgName;
|
||||
QString appweb;
|
||||
bool themeIsDark;
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
|
Loading…
x
Reference in New Issue
Block a user