!75 fix some error

Merge pull request !75 from likehomedream/plymouthshow
This commit is contained in:
KevinDuan 2023-12-12 02:47:54 +00:00 committed by Gitee
commit 9ae8a848c1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 31 additions and 11 deletions

View File

@ -377,7 +377,7 @@ RoundedWidget::RoundedWidget(QWidget *parent)
: QWidget(parent), m_radius(0)
{
setAttribute(Qt::WA_TranslucentBackground);
setRadius(6);
// setRadius(6);
setTransparency(65);
}

View File

@ -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<int>::of(&QComboBox::currentIndexChanged), this, [=](int index){
QColor selectedColor = combobox->itemData(index).value<QColor>();
m_exteriorcombobox->addItem(tr("light"),QColor(255, 255, 255));
m_exteriorcombobox->addItem(tr("dark"), QColor(29, 29, 29));
connect(m_exteriorcombobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](int index){
QColor selectedColor = m_exteriorcombobox->itemData(index).value<QColor>();
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
*

View File

@ -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;

View File

@ -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;
@ -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);
}
}
@ -222,6 +221,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("···");

View File

@ -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));