From ed0e61b855bc5ec3c88a1a6f3344e8821c3761ff Mon Sep 17 00:00:00 2001 From: likehomedream Date: Mon, 11 Dec 2023 16:08:44 +0800 Subject: [PATCH 1/3] add widgetstyle refresh and set history --- src/module/globalthemewidget.cpp | 31 ++++++++++++++++++++++++------- src/module/globalthemewidget.h | 2 ++ src/module/historywidget.cpp | 1 + 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/module/globalthemewidget.cpp b/src/module/globalthemewidget.cpp index d5abcef..666f9f5 100644 --- a/src/module/globalthemewidget.cpp +++ b/src/module/globalthemewidget.cpp @@ -53,7 +53,7 @@ void GlobalThemeWidget::eidtInitWidget(const HistoryInfo &InfoData) this->setWallpaper(m_info.wallpaperpath); this->setTransparency(m_info.transparency); this->setWindowRadius(m_info.windowradius); - + this->setStyle(m_info.widgetstyle); m_preview->updateWallpaper(m_info.wallpaperpath); // this->update(); } @@ -72,6 +72,9 @@ void GlobalThemeWidget::refresh() 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(); } @@ -290,12 +293,12 @@ void GlobalThemeWidget::initExteriorWidget() title->setFixedWidth(m_exteriorwidget->width()); title->setText(tr("Window appearance")); QHBoxLayout *layout = new QHBoxLayout(); - QComboBox *combobox = new QComboBox(m_exteriorwidget); + m_exteriorcombobox = new QComboBox(m_exteriorwidget); - combobox->addItem(tr("light"),QColor(255, 255, 255)); - combobox->addItem(tr("dark"), QColor(29, 29, 29)); - connect(combobox, QOverload::of(&QComboBox::currentIndexChanged), this, [=](int index){ - QColor selectedColor = combobox->itemData(index).value(); + m_exteriorcombobox->addItem(tr("light"),QColor(255, 255, 255)); + m_exteriorcombobox->addItem(tr("dark"), QColor(29, 29, 29)); + connect(m_exteriorcombobox, QOverload::of(&QComboBox::currentIndexChanged), this, [=](int index){ + QColor selectedColor = m_exteriorcombobox->itemData(index).value(); QString overlayImage; if (index == 0) { @@ -313,7 +316,7 @@ void GlobalThemeWidget::initExteriorWidget() }); layout->addWidget(title); - layout->addWidget(combobox); + layout->addWidget(m_exteriorcombobox); m_exteriorwidget->setLayout(layout); } @@ -508,6 +511,20 @@ void GlobalThemeWidget::addspaceritem() m_previewlayout->addItem(spacer2); } +void GlobalThemeWidget::setStyle(QString style) +{ + QColor widgetColor; + if("light" == style){ + widgetColor = QColor(255,255,255); + }else{ + widgetColor = QColor(29, 29, 29); + } + int index = m_exteriorcombobox->findData(widgetColor); + if (index != -1) { + m_exteriorcombobox->setCurrentIndex(index); + } +} + /** * @brief 设置圆角设置 * diff --git a/src/module/globalthemewidget.h b/src/module/globalthemewidget.h index 7d2826c..d5bf9e5 100644 --- a/src/module/globalthemewidget.h +++ b/src/module/globalthemewidget.h @@ -48,6 +48,7 @@ private: void initWindowFilletWidget(); void addspaceritem(); + void setStyle(QString style); void setRadiusSetting(int radius); void setAccentColor(QString accentcolor); void setTransparency(int transparency); @@ -74,6 +75,7 @@ private: HistoryInfo m_info; QComboBox *m_combobox; QComboBox *m_filletcombobox; + QComboBox *m_exteriorcombobox; EditButton *m_coverbtn; EditButton *wallpaperbtn; BasePreviewWidget *m_previewwidget; diff --git a/src/module/historywidget.cpp b/src/module/historywidget.cpp index fa645a4..e7e6e8b 100644 --- a/src/module/historywidget.cpp +++ b/src/module/historywidget.cpp @@ -222,6 +222,7 @@ void HistoryButton::initUI() QWidget * btnwidget = new QWidget(this); QHBoxLayout * btnwidgetlayout = new QHBoxLayout(btnwidget); + btnwidgetlayout->setContentsMargins(0,0,0,0); QPushButton* button = new QPushButton(m_themetype); QPushButton* btn_menu = new QPushButton("···"); From 0ae13d0b0972a395ba2ed5d931fb0e210a9b1f30 Mon Sep 17 00:00:00 2001 From: likehomedream Date: Mon, 11 Dec 2023 16:48:12 +0800 Subject: [PATCH 2/3] fix history order --- src/module/historywidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/module/historywidget.cpp b/src/module/historywidget.cpp index e7e6e8b..f841170 100644 --- a/src/module/historywidget.cpp +++ b/src/module/historywidget.cpp @@ -103,8 +103,7 @@ void HistoryWidget::updateHistoryDir() QDateTime folderDateTime = QDateTime::fromString(yearStr + monthStr + dayStr + hourStr + minuteStr + secondStr, "yyyyMMddhhmmss"); if (folderDateTime.isValid() && folderDateTime.daysTo(currentDate) <= 30) { - qDebug() << "Processing folder222: " << folder; - validFolders.append(folder); + validFolders.prepend(folder); } } From d50f8f0a0f13a2eabca5797fa91e1b119dad0d9e Mon Sep 17 00:00:00 2001 From: likehomedream Date: Mon, 11 Dec 2023 20:27:28 +0800 Subject: [PATCH 3/3] fix plymouth show error --- src/module/globalthemefeature.cpp | 2 +- src/module/historywidget.cpp | 2 +- src/module/plymouththemefeature.cpp | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/module/globalthemefeature.cpp b/src/module/globalthemefeature.cpp index bb91c1f..d1bfb7a 100644 --- a/src/module/globalthemefeature.cpp +++ b/src/module/globalthemefeature.cpp @@ -377,7 +377,7 @@ RoundedWidget::RoundedWidget(QWidget *parent) : QWidget(parent), m_radius(0) { setAttribute(Qt::WA_TranslucentBackground); - setRadius(6); +// setRadius(6); setTransparency(65); } diff --git a/src/module/historywidget.cpp b/src/module/historywidget.cpp index f841170..a6bd7d6 100644 --- a/src/module/historywidget.cpp +++ b/src/module/historywidget.cpp @@ -41,7 +41,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent) if (folderDateTime.isValid() && folderDateTime.daysTo(currentDate) <= 30) { qDebug() << "Processing folder: " << folder; - validFolders.append(folder); + validFolders.prepend(folder); } } QGridLayout *layout = new QGridLayout; diff --git a/src/module/plymouththemefeature.cpp b/src/module/plymouththemefeature.cpp index 8cd23e4..ffa7a98 100644 --- a/src/module/plymouththemefeature.cpp +++ b/src/module/plymouththemefeature.cpp @@ -99,6 +99,7 @@ void PlymouthImageWidget::updatePlymouth(const QString &imagePath) void PlymouthImageWidget::showPlymouth() { index = 0; + QObject::disconnect(&timer, &QTimer::timeout, nullptr, nullptr); QObject::connect(&timer, &QTimer::timeout, [&]() { if (index < pixmaps.size()) { pixmapItem->setPixmap(pixmaps.at(index));