fix cacheconfirmwidget error

This commit is contained in:
likehomedream 2023-12-15 17:03:52 +08:00
parent e91803379b
commit 33be23b581
6 changed files with 36 additions and 16 deletions

View File

@ -8,8 +8,8 @@ MainWindow::MainWindow(QWidget *parent)
m_bridge = Bridge::getInstance();
FileProcess();
m_bridge->createSavePathConfig();
initUI();
m_titlebar = new TitleBar(this);
initUI();
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0,0 );
layout->setSpacing(0);
@ -181,7 +181,7 @@ void MainWindow::initUI()
m_stackedWidget = new QStackedWidget(this);
m_stackedWidget->addWidget(scrollArea);
m_stackedWidget->addWidget(m_maininterface);
m_titlebar->setGoHomeBtn(false);
QVBoxLayout* mainLayout = new QVBoxLayout;
mainLayout->addWidget(m_stackedWidget);
@ -198,6 +198,7 @@ void MainWindow::initUI()
buttonGroup->addButton(m_grubbtn);
connect(m_historywidget,&HistoryWidget::startSecondEdit,[=](HistoryInfo InfoData){
m_titlebar->setGoHomeBtn(true);
m_maininterface->isHistory(true);
m_stackedWidget->setCurrentWidget(m_maininterface);
@ -210,6 +211,8 @@ void MainWindow::initUI()
connect(buttonGroup, QOverload<QAbstractButton*>::of(&QButtonGroup::buttonClicked), [=](QAbstractButton* button) {
m_stackedWidget->setCurrentWidget(m_maininterface);
m_ishistory = false;
m_titlebar->setGoHomeBtn(true);
m_maininterface->isHistory(false);
if (button == m_globalbtn) {
m_maininterface->setGlobalTheme();
@ -361,6 +364,7 @@ void MainWindow::onGoHomeClicked()
GrubThemeWidget::g_themeChange = false;
GlobalThemeWidget::g_themeChange = false;
m_ishistory = false;
m_titlebar->setGoHomeBtn(false);
});
connect(m_cacheConfirmedWidget, &cacheConfirmedWidget::cacheSave, this, [=](){
m_historywidget->updateHistoryDir();
@ -377,6 +381,10 @@ void MainWindow::onGoHomeClicked()
GrubThemeWidget::g_themeChange = false;
GlobalThemeWidget::g_themeChange = false;
m_ishistory = false;
m_titlebar->setGoHomeBtn(false);
});
connect(m_cacheConfirmedWidget, &cacheConfirmedWidget::cacheCancel, this, [=](){
m_titlebar->setGoHomeBtn(true);
});
} else {
if(!m_ishistory){
@ -398,6 +406,7 @@ void MainWindow::onGoHomeClicked()
m_ishistory = false;
m_stackedWidget->setCurrentIndex(0);
}
m_titlebar->setGoHomeBtn(false);
} else {
m_stackedWidget->setCurrentIndex(0);
}

View File

@ -46,6 +46,7 @@ cacheConfirmedWidget::cacheConfirmedWidget(QWidget *parent)
this->close();
});
QObject::connect(m_cancel,&QPushButton::clicked,this,[=](){
emit cacheCancel();
this->close();
});
}

View File

@ -20,7 +20,7 @@ public:
signals:
void cacheSave();
void cacheClean();
void cacheCancel();
private:
QVBoxLayout *m_cacheConfirmedWidget;
QLabel *m_questionMessage;

View File

@ -95,19 +95,6 @@ void GlobalThemeWidget::eidtInitWidget(const HistoryInfo &InfoData)
*/
void GlobalThemeWidget::refresh()
{
this->setRadiusSetting(6);
this->setAccentColor("#3790FA");
this->setWindowRadius(6);
this->setTransparency(65);
this->setCover(":/resource/background/custom-preview.png");
this->setWallpaper(":/resource/background/1-openkylin.jpg");
this->setStyle("light");
m_preview->updateWidgetBackgroundColor(QColor(255, 255, 255));
m_preview->updateOverlayImage(":/resource/background/panel-light.png");
m_preview->updateWallpaper(":/resource/background/background-light.png");
m_preview->updatescale1();
m_info.coverpath = ":/resource/background/custom-preview.png";
m_info.wallpaperpath = ":/resource/background/1-openkylin.jpg";
m_info.widgetstyle = "light";
@ -116,6 +103,18 @@ void GlobalThemeWidget::refresh()
m_info.transparency = 65;
m_info.windowradius = 6;
this->setRadiusSetting(m_info.radius);
this->setAccentColor(m_info.accentcolor);
this->setWindowRadius(m_info.windowradius);
this->setTransparency(m_info.transparency);
this->setCover(m_info.coverpath);
this->setWallpaper(m_info.wallpaperpath);
this->setStyle(m_info.widgetstyle);
m_preview->updateWidgetBackgroundColor(QColor(255, 255, 255));
m_preview->updateOverlayImage(":/resource/background/panel-light.png");
m_preview->updateWallpaper(":/resource/background/background-light.png");
m_preview->updatescale1();
m_globalPresenceMap->clear();
m_globalPresenceMap->insert("cover",false);
m_globalPresenceMap->insert("wallpaper",false);

View File

@ -136,3 +136,13 @@ void TitleBar::toggleMaximize()
m_maximumbtn->setIcon(QIcon::fromTheme("window-maximize-symbolic"));
}
}
void TitleBar::setGoHomeBtn(bool isable)
{
if(isable){
m_gohomebtn->setDisabled(false);
}else{
m_gohomebtn->setDisabled(true);
}
}

View File

@ -22,6 +22,7 @@ public:
void toggleMaximize();
QPushButton *m_gohomebtn = nullptr;
void setGoHomeBtn(bool isable);
signals:
void gohomesignal(); // 声明自定义信号
void savePathUpdate(const QString& filePath);