add transparencywidget and windowfilletwidget

This commit is contained in:
likehomedream 2023-11-02 17:40:58 +08:00
parent 5f00061f31
commit 8469269eeb
3 changed files with 68 additions and 7 deletions

View File

@ -10,8 +10,8 @@ ConfigFileManager::ConfigFileManager(bool ishistory, const QString& time, QObjec
createJson();
}else{
m_time = time;
jsonFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/scr/config/"+ "default.json";
confFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/scr/config/"+ "theme.conf";
jsonFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/src/config/"+ "default.json";
confFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/src/config/"+ "theme.conf";
qDebug()<<"have";
}
@ -67,7 +67,7 @@ bool ConfigFileManager::modifyRadiusJson(int radius)
QFile configFile(confFilePath);
if (!configFile.open(QIODevice::ReadWrite | QIODevice::Text))
{
qDebug() << "Failed to open config file";
qDebug() << "Failed to open config file"<<configFile.AbortError<<confFilePath;
return false;
}

View File

@ -61,7 +61,10 @@ void GlobalThemeWidget::initRightWidget()
initWallPaperWidget();
initExteriorWidget();
initFilletWidget();
AccentColorWidget();
initAccentColorWidget();
initTransparencyWidget();
initWindowFilletWidget();
mainLayout->addWidget(m_coverwidget);
mainLayout->addStretch(1);
mainLayout->addWidget(m_wallpaperwidget);
@ -72,6 +75,10 @@ void GlobalThemeWidget::initRightWidget()
mainLayout->addStretch(1);
mainLayout->addWidget(m_accentcolorwidget);
mainLayout->addStretch(1);
mainLayout->addWidget(m_transparencywidget);
mainLayout->addStretch(1);
mainLayout->addWidget(m_windowfilletwidget);
mainLayout->addStretch(1);
m_viewportwidget->setLayout(mainLayout);
@ -255,9 +262,8 @@ void GlobalThemeWidget::initFilletWidget()
m_filletwidget->setLayout(layout);
}
void GlobalThemeWidget::AccentColorWidget()
void GlobalThemeWidget::initAccentColorWidget()
{
m_accentcolorwidget = new QWidget(m_viewportwidget);
m_accentcolorwidget = new QWidget(m_viewportwidget);
m_accentcolorwidget->setFixedHeight(65);
QLabel *title = new QLabel(m_accentcolorwidget);
@ -291,6 +297,55 @@ void GlobalThemeWidget::AccentColorWidget()
m_accentcolorwidget->setLayout(layout);
}
void GlobalThemeWidget::initTransparencyWidget()
{
m_transparencywidget = new QWidget(m_viewportwidget);
m_transparencywidget->setFixedHeight(65);
QHBoxLayout *layout = new QHBoxLayout();
QLabel *title = new QLabel(tr("Window transparency"));
m_transparencyslider = new QSlider(m_filletwidget);
m_transparencyslider->setOrientation(Qt::Horizontal);
m_transparencyslider->setFixedWidth(210);
m_transparencyslider->setRange(0,100);
m_transparencyslider->setSingleStep(1);
m_transparencyslider->setTickInterval(1);
m_transparencyslider->setFixedWidth(120);
m_transparencyslider->setValue(65);
QPushButton *showButton = new QPushButton(m_filletwidget);
showButton->setDisabled(true);
showButton->setFixedSize(60,36);
int value = 0;
value = m_transparencyslider->value();
showButton->setText(QString::number(m_transparencyslider->value())+"%");
QObject::connect(m_transparencyslider, &QSlider::valueChanged, [=](int value) {
showButton->setText(QString::number(value)+"%");
});
layout->addWidget(title);
layout->addWidget(m_transparencyslider);
layout->addWidget(showButton);
m_transparencywidget->setLayout(layout);
}
void GlobalThemeWidget::initWindowFilletWidget()
{
m_windowfilletwidget = new QWidget(m_viewportwidget);
m_transparencywidget->setFixedHeight(65);
QHBoxLayout *layout = new QHBoxLayout();
QLabel *title = new QLabel(tr("Window fillet"));
m_filletcombobox = new QComboBox(m_windowfilletwidget);
m_filletcombobox->addItem(tr("Large"),QColor(55, 144, 250));
m_filletcombobox->addItem(tr("Medium"), QColor(120, 115, 245));
m_filletcombobox->addItem(tr("Small"), QColor(120, 115, 245));
layout->addWidget(title);
layout->addWidget(m_filletcombobox);
m_windowfilletwidget->setLayout(layout);
}
void GlobalThemeWidget::updateWallpaperFilePath(const QString& coverFilePath) {
m_wallpaperpath = coverFilePath;

View File

@ -38,7 +38,9 @@ private:
void initWallPaperWidget();
void initExteriorWidget();
void initFilletWidget();
void AccentColorWidget();
void initAccentColorWidget();
void initTransparencyWidget();
void initWindowFilletWidget();
void updateWallpaperFilePath(const QString& coverFilePath);
void addspaceritem();
@ -52,16 +54,20 @@ private:
QWidget *m_exteriorwidget;
QWidget *m_filletwidget;
QWidget *m_accentcolorwidget;
QWidget *m_transparencywidget;
QWidget *m_windowfilletwidget;
QVBoxLayout *m_previewlayout;
QString m_wallpaperpath = ":/resource/background/background-light.png";
QString m_coverpath = ":/resource/background/background-glazing.png";
QWidget *m_viewportwidget;
QScrollArea *m_scrollArea;
QSlider *m_filletslider;
QSlider *m_transparencyslider;
QHBoxLayout *m_globalthemelayout;
QWidget *m_rightwidget;
HistoryInfo m_info;
QComboBox *m_combobox;
QComboBox *m_filletcombobox;
QPushButton *m_coverbtn;
QPushButton *wallpaperbtn;
QWidget *m_previewwidget;