commit
6d542c92eb
|
@ -0,0 +1,60 @@
|
|||
#include "bridge.h"
|
||||
|
||||
Bridge::Bridge(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Bridge::wallpaperPathChanged(QString path) {
|
||||
|
||||
}
|
||||
void Bridge::coverPathChanged(QString path) {
|
||||
|
||||
}
|
||||
|
||||
void Bridge::radiusChanged(int radius)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Bridge::accentColorChanged(QColor accentcolor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Bridge::exteriorChanged(QColor accentcolor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Bridge::appIconsMapChanged(QMap<QString, QString> *appiconsmaps)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it;
|
||||
for (it = appiconsmaps->begin(); it != appiconsmaps->end(); ++it) {
|
||||
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
||||
}
|
||||
}
|
||||
|
||||
void Bridge::systemIconsMapChanged(QMap<QString, QString> *systemiconsmaps)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it;
|
||||
for (it = systemiconsmaps->begin(); it != systemiconsmaps->end(); ++it) {
|
||||
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
||||
}
|
||||
}
|
||||
|
||||
void Bridge::cursorMapChanged(QMap<QString, QString> *cursormap)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it;
|
||||
for (it = cursormap->begin(); it != cursormap->end(); ++it) {
|
||||
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
||||
}
|
||||
}
|
||||
|
||||
void Bridge::timeCursorMapChanged(QMap<QString, QString> *timecursormap)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it;
|
||||
for (it = timecursormap->begin(); it != timecursormap->end(); ++it) {
|
||||
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef BRIDGE_H
|
||||
#define BRIDGE_H
|
||||
|
||||
#include <src/globalthemewidget.h>
|
||||
#include <src/iconthemewidget.h>
|
||||
#include <src/cursorthemewidget.h>
|
||||
#include <QObject>
|
||||
|
||||
class Bridge : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Bridge(QObject *parent = nullptr);
|
||||
|
||||
void wallpaperPathChanged(QString path);
|
||||
void coverPathChanged(QString path);
|
||||
void radiusChanged(int radius);
|
||||
void accentColorChanged(QColor accentcolor);
|
||||
void exteriorChanged(QColor accentcolor);
|
||||
void appIconsMapChanged(QMap<QString, QString> *appiconsmaps);
|
||||
void systemIconsMapChanged(QMap<QString, QString> *systemiconsmaps);
|
||||
void cursorMapChanged(QMap<QString, QString> *cursormap);
|
||||
void timeCursorMapChanged(QMap<QString, QString> *timecursormap);
|
||||
signals:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // BRIDGE_H
|
|
@ -118,11 +118,21 @@ void CursorThemeWidget::initRightWidget()
|
|||
if (clickedWidget) {
|
||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("选择SVG文件"), "", tr("SVG 文件 (*.svg)"));
|
||||
if (!newFilePath.isEmpty()) {
|
||||
if (m_iconpathmap->contains(widgetName)) {
|
||||
|
||||
m_customiconpathmap->insert(widgetName, newFilePath);
|
||||
clickedWidget->setcustomicon(newFilePath);
|
||||
emit newCursorMap(m_customiconpathmap);
|
||||
} else if (m_timeiconpathmap->contains(widgetName)) {
|
||||
|
||||
m_timecustomiconpathmap->insert(widgetName, newFilePath);
|
||||
emit newCursorMap(m_timecustomiconpathmap);
|
||||
}
|
||||
m_preview->updateIcon(widgetName, newFilePath);
|
||||
m_preview2->updateIcon(widgetName, newFilePath);
|
||||
clickedWidget->setcustomicon(newFilePath);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
|
||||
signals:
|
||||
void wallpaperupdate(const QString& filePath);
|
||||
void newCursorMap(QMap<QString, QString> *cursormap);
|
||||
void newTimeCursorMap(QMap<QString, QString> *timecursormap);
|
||||
private:
|
||||
void initPreviewWidget();
|
||||
void initMaps();
|
||||
|
|
|
@ -11,6 +11,11 @@ GlobalThemeWidget::GlobalThemeWidget(QWidget *parent) : QWidget(parent)
|
|||
this->setLayout(m_globalthemelayout);
|
||||
}
|
||||
|
||||
QString GlobalThemeWidget::getWallpaperPath()
|
||||
{
|
||||
return m_wallpaperpath;
|
||||
}
|
||||
|
||||
void GlobalThemeWidget::initPreviewWidget()
|
||||
{
|
||||
m_previewwidget = new QWidget(this);
|
||||
|
@ -91,12 +96,17 @@ void GlobalThemeWidget::initCoverWidget()
|
|||
if (newFilePath.isEmpty()) {
|
||||
qDebug() << "Selected file path:" << newFilePath;
|
||||
newFilePath = m_coverpath;
|
||||
}
|
||||
qDebug() << "Selected file path:<<<<<<<<<<<<<<,snewFilePath" << newFilePath;
|
||||
QPixmap pixmap(m_coverpath);
|
||||
coverbtn->setIcon(QIcon(pixmap));
|
||||
coverbtn->setIconSize(coverbtn->size());
|
||||
}else{
|
||||
m_coverpath = newFilePath;
|
||||
QPixmap pixmap(m_coverpath);
|
||||
coverbtn->setIcon(QIcon(pixmap));
|
||||
coverbtn->setIconSize(coverbtn->size());
|
||||
emit newCoverFilePath(newFilePath);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
layout->addStretch(1);
|
||||
|
@ -134,14 +144,15 @@ void GlobalThemeWidget::initWallPaperWidget()
|
|||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("选择PNG文件"), "", tr("PNG 文件 (*.png)"));
|
||||
if (newFilePath.isEmpty()) {
|
||||
qDebug() << "Selected file path:" << newFilePath;
|
||||
updateCoverFilePath(m_wallpaperpath);
|
||||
updateWallpaperFilePath(m_wallpaperpath);
|
||||
}else{
|
||||
|
||||
updateCoverFilePath(newFilePath);
|
||||
updateWallpaperFilePath(newFilePath);
|
||||
emit wallpaperupdate(newFilePath);
|
||||
emit newWallpaperFilePath(newFilePath);
|
||||
QPixmap pixmap(newFilePath);
|
||||
coverbtn->setIcon(QIcon(pixmap));
|
||||
coverbtn->setIconSize(coverbtn->size());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -177,7 +188,7 @@ void GlobalThemeWidget::initExteriorWidget()
|
|||
m_preview->updateOverlayImage(":/resource/background/panel-dark.png");
|
||||
m_preview->updatescale();
|
||||
}
|
||||
|
||||
emit newExterior(combobox->itemData(index).value<QColor>());
|
||||
});
|
||||
|
||||
layout->addWidget(title);
|
||||
|
@ -215,7 +226,7 @@ void GlobalThemeWidget::initFilletWidget()
|
|||
showButton->setText(QString::number(value)+"px");
|
||||
m_preview->updatescale();
|
||||
m_preview->updateWidgetRadius(value);
|
||||
|
||||
emit newRadius(value);
|
||||
});
|
||||
|
||||
layout->addWidget(title);
|
||||
|
@ -253,6 +264,7 @@ void GlobalThemeWidget::AccentColorWidget()
|
|||
qDebug() << "RGB values:" << selectedColor.red() << selectedColor.green() << selectedColor.blue();
|
||||
m_preview->updatescale();
|
||||
m_preview->updateButtonColor(selectedColor);
|
||||
emit newAccentColor(selectedColor);
|
||||
});
|
||||
|
||||
layout->addWidget(title);
|
||||
|
@ -261,7 +273,7 @@ void GlobalThemeWidget::AccentColorWidget()
|
|||
m_accentcolorwidget->setLayout(layout);
|
||||
}
|
||||
|
||||
void GlobalThemeWidget::updateCoverFilePath(const QString& coverFilePath) {
|
||||
void GlobalThemeWidget::updateWallpaperFilePath(const QString& coverFilePath) {
|
||||
m_wallpaperpath = coverFilePath;
|
||||
|
||||
if (m_preview != nullptr) {
|
||||
|
|
|
@ -20,9 +20,14 @@ class GlobalThemeWidget : public QWidget
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit GlobalThemeWidget(QWidget *parent = nullptr);
|
||||
|
||||
QString getWallpaperPath();
|
||||
signals:
|
||||
void wallpaperupdate(const QString& filePath);
|
||||
void newWallpaperFilePath(const QString& path);
|
||||
void newCoverFilePath(const QString& path);
|
||||
void newRadius(const int radius);
|
||||
void newAccentColor(const QColor selectedColor);
|
||||
void newExterior(const QColor selectedColor);
|
||||
private:
|
||||
void initPreviewWidget();
|
||||
void initRightWidget();
|
||||
|
@ -32,8 +37,9 @@ private:
|
|||
void initExteriorWidget();
|
||||
void initFilletWidget();
|
||||
void AccentColorWidget();
|
||||
void updateCoverFilePath(const QString& coverFilePath);
|
||||
void updateWallpaperFilePath(const QString& coverFilePath);
|
||||
void addspaceritem();
|
||||
|
||||
QWidget *m_globalthemewidget;
|
||||
QWidget *m_coverwidget;
|
||||
QWidget *m_wallpaperwidget;
|
||||
|
@ -42,7 +48,7 @@ private:
|
|||
QWidget *m_accentcolorwidget;
|
||||
QVBoxLayout *m_previewlayout;
|
||||
QString m_wallpaperpath = ":/resource/background/background-light.png";
|
||||
QString m_coverpath = "";
|
||||
QString m_coverpath = ":/resource/background/background-light.png";
|
||||
QWidget *m_viewportwidget;
|
||||
QScrollArea *m_scrollArea;
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ void IconThemeWidget::initEditWidget()
|
|||
clickedWidget->setcustomicon(newFilePath);
|
||||
qDebug() << "Selected file path:" << newFilePath<< "Corresponding widgetName:" << widgetName;
|
||||
m_preview->updateIcon(widgetName, newFilePath);
|
||||
|
||||
}
|
||||
emit newAppIconsMap(m_customiconpathmap);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -138,6 +138,7 @@ void IconThemeWidget::initSystemEditWidget()
|
|||
qDebug() << "Selected file path:" << newFilePath<< "Corresponding widgetName:" << widgetName;
|
||||
m_systempreview->updateIcon(widgetName, newFilePath);
|
||||
}
|
||||
emit newSystemIconsMap(m_systemcustomiconpathmap);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -194,7 +195,7 @@ void IconThemeWidget::initSystemMaps()
|
|||
qDebug() <<"key----------" <<m_systemiconpathmap->keys() <<"value-----------" <<value;
|
||||
}
|
||||
}
|
||||
m_systemcustomiconpathmap= new QMap<QString, QString>;
|
||||
m_systemcustomiconpathmap= m_systemiconpathmap;
|
||||
m_systempathWidgetMap = new QMap<QString, IconEditWidget*>;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
void initRightWidget();
|
||||
signals:
|
||||
void wallpaperupdate(const QString& filePath);
|
||||
void newAppIconsMap(QMap<QString, QString> *appiconsmap);
|
||||
void newSystemIconsMap(QMap<QString, QString> *systemiconsmap);
|
||||
private:
|
||||
QStringList getWidgetNamesFromFilesInDirectory(const QString& directoryPath);
|
||||
|
||||
|
|
|
@ -241,5 +241,3 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){
|
|||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#include "maininterface.h"
|
||||
|
||||
|
||||
|
||||
MainInterface::MainInterface(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
// this->setBackgroundRole(QPalette::Base);
|
||||
|
||||
m_belowwidget = new QWidget(this);
|
||||
|
||||
init();
|
||||
|
@ -12,7 +14,33 @@ MainInterface::MainInterface(QWidget *parent) : QWidget(parent)
|
|||
layout->addWidget(m_belowwidget);
|
||||
|
||||
this->setLayout(layout);
|
||||
|
||||
connect(m_globalthemewidget, &GlobalThemeWidget::newWallpaperFilePath, this, [&](const QString& path) {
|
||||
emit wallpaperPathChanged(path);
|
||||
});
|
||||
connect(m_globalthemewidget, &GlobalThemeWidget::newCoverFilePath, this, [&](const QString& path) {
|
||||
emit coverPathChanged(path);
|
||||
});
|
||||
connect(m_globalthemewidget, &GlobalThemeWidget::newRadius, this, [&](const int radius) {
|
||||
emit radiusChanged(radius);
|
||||
});
|
||||
connect(m_globalthemewidget, &GlobalThemeWidget::newAccentColor, this, [&](const QColor selectedColor) {
|
||||
emit accentColorChanged(selectedColor);
|
||||
});
|
||||
connect(m_globalthemewidget, &GlobalThemeWidget::newExterior, this, [&](const QColor selectedColor) {
|
||||
emit exteriorChanged(selectedColor);
|
||||
});
|
||||
connect(m_iconthemewidget, &IconThemeWidget::newAppIconsMap, this, [&]( QMap<QString, QString> *appiconsmaps) {
|
||||
emit appIconsMapChanged(appiconsmaps);
|
||||
});
|
||||
connect(m_iconthemewidget, &IconThemeWidget::newSystemIconsMap, this, [&]( QMap<QString, QString> *systemiconsmaps) {
|
||||
emit systemIconsMapChanged(systemiconsmaps);
|
||||
});
|
||||
connect(m_cursorthemewidget, &CursorThemeWidget::newCursorMap, this, [&]( QMap<QString, QString> *cursormaps) {
|
||||
emit cursorMapChanged(cursormaps);
|
||||
});
|
||||
connect(m_cursorthemewidget, &CursorThemeWidget::newTimeCursorMap, this, [&]( QMap<QString, QString> *timecursormaps) {
|
||||
emit timeCursorMapChanged(timecursormaps);
|
||||
});
|
||||
}
|
||||
|
||||
void MainInterface::init()
|
||||
|
|
|
@ -32,6 +32,15 @@ public:
|
|||
void setCursorTheme();
|
||||
signals:
|
||||
void wallpaperupdate(const QString& filePath);
|
||||
void wallpaperPathChanged(QString path);
|
||||
void coverPathChanged(QString path);
|
||||
void radiusChanged(int radius);
|
||||
void accentColorChanged(QColor accentcolor);
|
||||
void exteriorChanged(QColor exteriorcolor);
|
||||
void appIconsMapChanged(QMap<QString, QString> *appiconsmap);
|
||||
void systemIconsMapChanged(QMap<QString, QString> *systemiconsmap);
|
||||
void cursorMapChanged(QMap<QString, QString> *appiconsmap);
|
||||
void timeCursorMapChanged(QMap<QString, QString> *systemiconsmap);
|
||||
private:
|
||||
void init();
|
||||
void initLeftBar();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
// setWindowFlags(Qt::FramelessWindowHint);
|
||||
setWindowFlags(Qt::FramelessWindowHint);
|
||||
|
||||
initUI();
|
||||
m_titlebar = new TitleBar(this);
|
||||
|
@ -17,6 +17,15 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
setMouseTracking(true);
|
||||
connect(m_titlebar, &TitleBar::gohomesignal, this, &MainWindow::onGoHomeClicked);
|
||||
FileProcess();
|
||||
m_bridge = new Bridge();
|
||||
connect(m_maininterface, &MainInterface::wallpaperPathChanged, m_bridge, &Bridge::wallpaperPathChanged);
|
||||
connect(m_maininterface, &MainInterface::coverPathChanged, m_bridge, &Bridge::coverPathChanged);
|
||||
connect(m_maininterface, &MainInterface::radiusChanged, m_bridge, &Bridge::radiusChanged);
|
||||
connect(m_maininterface, &MainInterface::accentColorChanged, m_bridge, &Bridge::accentColorChanged);
|
||||
connect(m_maininterface, &MainInterface::exteriorChanged, m_bridge, &Bridge::exteriorChanged);
|
||||
connect(m_maininterface, &MainInterface::appIconsMapChanged, m_bridge, &Bridge::appIconsMapChanged);
|
||||
connect(m_maininterface, &MainInterface::systemIconsMapChanged, m_bridge, &Bridge::systemIconsMapChanged);
|
||||
connect(m_maininterface, &MainInterface::cursorMapChanged, m_bridge, &Bridge::systemIconsMapChanged);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define MAINWINDOW_H
|
||||
|
||||
#include "maininterface.h"
|
||||
#include "src/bridge.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
|
@ -64,6 +65,7 @@ private:
|
|||
EntryButton *m_iconbtn;
|
||||
EntryButton *m_cursorbtn;
|
||||
MainInterface *m_maininterface;
|
||||
Bridge *m_bridge;
|
||||
FileProcess m_fileProcess;
|
||||
TitleBar*m_titlebar;
|
||||
QPoint m_dragStartPosition;
|
||||
|
|
Loading…
Reference in New Issue