add cursor and global refresh and fix some bugs
This commit is contained in:
parent
0f2c3faea2
commit
334a1ec7ea
|
@ -4,19 +4,19 @@
|
|||
ConfigFileManager::ConfigFileManager(bool ishistory, const QString& time, QObject *parent) : QObject(parent)
|
||||
{
|
||||
//创建json、conf文件到指定目录,在这个类里进行修改。
|
||||
if(FileProcess::g_createThemeType == "globalTheme"){
|
||||
|
||||
if(!ishistory){
|
||||
m_time = time;
|
||||
createConf();
|
||||
createJson();
|
||||
if(FileProcess::g_createThemeType == "globalTheme"){
|
||||
m_time = time;
|
||||
createConf();
|
||||
createJson();
|
||||
}
|
||||
}else{
|
||||
m_time = time;
|
||||
jsonFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/src/globalTheme/"+ "default.json";
|
||||
confFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/src/globalTheme/"+ "theme.conf";
|
||||
qDebug()<<"have";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool ConfigFileManager::createJson()
|
||||
|
@ -63,7 +63,13 @@ bool ConfigFileManager::createConf()
|
|||
|
||||
bool ConfigFileManager::modifyRadiusJson(int radius)
|
||||
{
|
||||
QString confFilePath = jsonFilePath; // 替换为实际的文件路径
|
||||
QString confFilePath = "";
|
||||
if("" == jsonFilePath){
|
||||
confFilePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/src/globalTheme/"+ "default.json"; // 替换为实际的文件路径
|
||||
}else{
|
||||
confFilePath = jsonFilePath;
|
||||
}
|
||||
|
||||
// 读取配置文件
|
||||
QFile configFile(confFilePath);
|
||||
if (!configFile.open(QIODevice::ReadWrite | QIODevice::Text))
|
||||
|
@ -163,8 +169,6 @@ bool ConfigFileManager::modifyWallPaperConf(QString wallpaperpath)
|
|||
content.replace(startIndex, content.indexOf('\n', startIndex) - startIndex, substr);
|
||||
}
|
||||
|
||||
qDebug() << content;
|
||||
|
||||
// 写入文件
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&file);
|
||||
|
@ -224,7 +228,6 @@ bool ConfigFileManager::modifywindowRadiusConf(int windowradius)
|
|||
QString oldValue = "windowRadius=";
|
||||
QString newValue = QString("windowRadius=%1").arg(windowradius);
|
||||
content.replace(QRegExp(oldValue + "\\d+"), newValue);
|
||||
qDebug()<<content;
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&file);
|
||||
out << content;
|
||||
|
|
|
@ -19,7 +19,7 @@ HistoryInfoLoad::HistoryInfoLoad(const QString &date, QObject *parent)
|
|||
|
||||
QString HistoryInfoLoad::getCover()
|
||||
{
|
||||
QString filePath = m_historyInfo.filepath + "/src/config/preview";
|
||||
QString filePath = m_historyInfo.filepath + "/src/globalTheme/preview";
|
||||
QString previewFilePath;
|
||||
|
||||
QFileInfo pngFileInfo(filePath + ".png");
|
||||
|
@ -83,7 +83,7 @@ QString HistoryInfoLoad::getThemeType()
|
|||
|
||||
void HistoryInfoLoad::getRadius()
|
||||
{
|
||||
QString filePath = m_historyInfo.filepath + "/src/config/default.json";
|
||||
QString filePath = m_historyInfo.filepath + "/src/globalTheme/default.json";
|
||||
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
|
|
|
@ -53,8 +53,6 @@ MainInterface::MainInterface(QWidget *parent) : QWidget(parent)
|
|||
connect(m_grubthemewidget, &GrubThemeWidget::newGrubFilePath, this, [&](const QString& path) {
|
||||
emit grubPathChanged(path);
|
||||
});
|
||||
|
||||
m_iconpathmap = m_iconthemewidget->getAppIconsMap();
|
||||
}
|
||||
|
||||
void MainInterface::isHistory(bool ishistory)
|
||||
|
@ -266,6 +264,20 @@ QMap<QString, QString> *MainInterface::getTimeCurosrMap()
|
|||
return m_cursorthemewidget->getTimeCursorMap();
|
||||
}
|
||||
|
||||
void MainInterface::refresh(QString themeType)
|
||||
{
|
||||
if("global" == themeType){
|
||||
m_globalthemewidget->refresh();
|
||||
}else if("icon" == themeType){
|
||||
m_iconthemewidget->refresh();
|
||||
}else if("cursor" == themeType){
|
||||
m_cursorthemewidget->refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainInterface::updateButtonGroup(bool isGlobalTheme)
|
||||
{
|
||||
if(isGlobalTheme){
|
||||
|
|
|
@ -46,6 +46,8 @@ public:
|
|||
QMap<QString, QString>* getCurosrMap();
|
||||
QMap<QString, QString>* getTimeCurosrMap();
|
||||
|
||||
void refresh(QString themeType);
|
||||
|
||||
signals:
|
||||
void wallpaperupdate(const QString& filePath);
|
||||
void wallpaperPathChanged(QString path);
|
||||
|
|
|
@ -148,6 +148,7 @@ void MainWindow::initUI()
|
|||
m_bridge->createFileManager(false,FileProcess::g_date);
|
||||
m_bridge->updateIconCache(m_maininterface->getAppIconsMap(),"appicon");
|
||||
m_bridge->updateIconCache(m_maininterface->getSystemIconsMap(),"systemicon");
|
||||
m_maininterface->refresh("global");
|
||||
} else if (button == m_iconbtn) {
|
||||
m_maininterface->setIconTheme();
|
||||
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("iconTheme"), "recognise");
|
||||
|
@ -155,6 +156,7 @@ void MainWindow::initUI()
|
|||
m_bridge->createFileManager(false,FileProcess::g_date);
|
||||
m_bridge->updateIconCache(m_maininterface->getAppIconsMap(),"appicon");
|
||||
m_bridge->updateIconCache(m_maininterface->getSystemIconsMap(),"systemicon");
|
||||
m_maininterface->refresh("icon");
|
||||
} else if (button == m_cursorbtn) {
|
||||
m_maininterface->setCursorTheme();
|
||||
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("cursorTheme"), "recognise");
|
||||
|
@ -162,6 +164,7 @@ void MainWindow::initUI()
|
|||
m_bridge->createFileManager(false,FileProcess::g_date);
|
||||
m_bridge->updateIconCache(m_maininterface->getCurosrMap(),"cursor");
|
||||
m_bridge->updateIconCache(m_maininterface->getTimeCurosrMap(),"timecursor");
|
||||
m_maininterface->refresh("cursor");
|
||||
}else if (button == m_plymouthbtn) {
|
||||
m_maininterface->setPlymouthTheme();
|
||||
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("plymouthTheme"), "recognise");
|
||||
|
@ -223,24 +226,27 @@ void MainWindow::initEntry()
|
|||
m_grubbtn->setTip(tr("Modify GURB background wallpaper"));
|
||||
}
|
||||
|
||||
void MainWindow::refresh()
|
||||
{
|
||||
// m_maininterface->refresh();
|
||||
}
|
||||
|
||||
void MainWindow::onGoHomeClicked()
|
||||
{
|
||||
|
||||
if (FileProcess::g_date != nullptr){
|
||||
cacheConfirmedWidget *m_cacheConfirmedWidget = new cacheConfirmedWidget();
|
||||
m_cacheConfirmedWidget->show();
|
||||
connect(m_cacheConfirmedWidget, &cacheConfirmedWidget::cacheClean, this, [=](){
|
||||
m_stackedWidget->setCurrentIndex(0);
|
||||
//添加一个reflesh功能,清除所有界面上的改动
|
||||
});
|
||||
connect(m_cacheConfirmedWidget, &cacheConfirmedWidget::cacheSave, this, [=](){
|
||||
m_historywidget->updateHistoryDir();
|
||||
m_stackedWidget->setCurrentIndex(0);
|
||||
//添加一个reflesh功能,清除所有界面上的改动
|
||||
});
|
||||
} else {
|
||||
m_stackedWidget->setCurrentIndex(0);
|
||||
}
|
||||
// refresh();
|
||||
}
|
||||
|
||||
void EntryButton::setEntry(const QIcon &icon, const QString &text)
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
void initUI();
|
||||
void initEntry();
|
||||
|
||||
void refresh();
|
||||
public slots:
|
||||
|
||||
void onGoHomeClicked();
|
||||
|
|
|
@ -77,34 +77,51 @@ QStringList CursorThemeWidget::getWidgetNamesFromFilesInDirectory(const QString&
|
|||
return widgetNames;
|
||||
}
|
||||
|
||||
void CursorThemeWidget::refresh()
|
||||
{
|
||||
m_preview->updateIconMap(getResourcesAppIconMap("cursor"));
|
||||
updateCustomPathMap(m_iconpathmap,"cursor");
|
||||
m_preview2->updateIconMap(getResourcesAppIconMap("timecursor"));
|
||||
updateCustomPathMap(m_timeiconpathmap,"timecursor");
|
||||
}
|
||||
|
||||
QMap<QString, QString> *CursorThemeWidget::getResourcesAppIconMap(QString Type)
|
||||
{
|
||||
if("cursor" == Type){
|
||||
m_iconpathmap = new QMap<QString, QString>;
|
||||
QString directoryPath = ":/resource/cursor/";
|
||||
QStringList widgetNames = getWidgetNamesFromFilesInDirectory(directoryPath);
|
||||
|
||||
for (int i = 0; i < widgetNames.size(); ++i) {
|
||||
QString cursorFileName = directoryPath + widgetNames[i] + ".png";
|
||||
m_iconpathmap->insert(widgetNames[i], cursorFileName);
|
||||
}
|
||||
return m_iconpathmap;
|
||||
} else if ("timecursor" == Type){
|
||||
m_timeiconpathmap = new QMap<QString, QString>;
|
||||
QString directoryPath = ":/resource/time-cursor/";
|
||||
QStringList widgetNames = getWidgetNamesFromFilesInDirectory(directoryPath);
|
||||
|
||||
for (int i = 0; i < widgetNames.size(); ++i) {
|
||||
QString cursorFileName = directoryPath + widgetNames[i] + ".png";
|
||||
m_timeiconpathmap->insert(widgetNames[i], cursorFileName);
|
||||
}
|
||||
return m_timeiconpathmap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CursorThemeWidget::initMaps()
|
||||
{
|
||||
m_iconpathmap = new QMap<QString, QString>;
|
||||
QString directoryPath = ":/resource/cursor/";
|
||||
QStringList widgetNames = getWidgetNamesFromFilesInDirectory(directoryPath);
|
||||
|
||||
for (int i = 0; i < widgetNames.size(); ++i) {
|
||||
qDebug() << widgetNames[i];
|
||||
QString cursorFileName = directoryPath + widgetNames[i] + ".png";
|
||||
m_iconpathmap->insert(widgetNames[i], cursorFileName);
|
||||
}
|
||||
m_customiconpathmap= new QMap<QString, QString>;
|
||||
getResourcesAppIconMap("cursor");
|
||||
m_customiconpathmap= m_iconpathmap;
|
||||
m_pathWidgetMap = new QMap<QString, CursorEditWidget*>;
|
||||
}
|
||||
|
||||
void CursorThemeWidget::initTimeMaps()
|
||||
{
|
||||
m_timeiconpathmap = new QMap<QString, QString>;
|
||||
QString directoryPath = ":/resource/time-cursor/";
|
||||
QStringList widgetNames = getWidgetNamesFromFilesInDirectory(directoryPath);
|
||||
|
||||
for (int i = 0; i < widgetNames.size(); ++i) {
|
||||
qDebug() << widgetNames[i];
|
||||
QString cursorFileName = directoryPath + widgetNames[i] + ".png";
|
||||
m_timeiconpathmap->insert(widgetNames[i], cursorFileName);
|
||||
}
|
||||
|
||||
m_timecustomiconpathmap= new QMap<QString, QString>;
|
||||
getResourcesAppIconMap("timecursor");
|
||||
m_timecustomiconpathmap= m_timeiconpathmap;
|
||||
m_timepathWidgetMap = new QMap<QString, CursorEditWidget*>;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,9 @@ public:
|
|||
explicit CursorThemeWidget(QWidget *parent = nullptr);
|
||||
QMap<QString, QString>* getCursorMap();
|
||||
QMap<QString, QString> *getTimeCursorMap();
|
||||
|
||||
void eidtInitWidget(const HistoryInfo &InfoData);
|
||||
void refresh();
|
||||
|
||||
signals:
|
||||
void wallpaperupdate(const QString& filePath);
|
||||
void newCursorMap(QMap<QString, QString> *cursormap);
|
||||
|
@ -43,6 +44,8 @@ private:
|
|||
void setHistoryTimeCursor();
|
||||
QStringList getWidgetNamesFromFilesInDirectory(const QString& directoryPath);
|
||||
|
||||
QMap<QString, QString> *getResourcesAppIconMap(QString Type);
|
||||
|
||||
QHBoxLayout *m_cursorthemelayout;
|
||||
QWidget *m_rightwidget;
|
||||
QVBoxLayout *m_rightwidgetlayout;
|
||||
|
|
|
@ -89,6 +89,14 @@ void GlobalImageWidget::updatescale()
|
|||
graphicsView->scale(1, 1);
|
||||
}
|
||||
|
||||
void GlobalImageWidget::updatescale1()
|
||||
{
|
||||
graphicsView->resetTransform();
|
||||
QPointF centerPoint(1500, 600);
|
||||
graphicsView->centerOn(centerPoint);
|
||||
graphicsView->scale(0.3, 0.3);
|
||||
}
|
||||
|
||||
void GlobalImageWidget::updateControlRadius(int Value)
|
||||
{
|
||||
m_showbtn->setRadius(Value);
|
||||
|
@ -199,13 +207,13 @@ void RoundedWidget::setTransparency(int transparency)
|
|||
{
|
||||
m_transparency = transparency / 100.0;
|
||||
qDebug()<<m_transparency;
|
||||
update();
|
||||
// update();
|
||||
}
|
||||
|
||||
void RoundedWidget::setBackgroundColor(const QColor &color)
|
||||
{
|
||||
backgroundColor = color;
|
||||
update();
|
||||
// update();
|
||||
}
|
||||
|
||||
void RoundedWidget::paintEvent(QPaintEvent *event)
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
void updatescale();
|
||||
void updateControlRadius(int Value);
|
||||
void updateTransparency(int transparency);
|
||||
void updatescale1();
|
||||
private:
|
||||
CustomGraphicsView* graphicsView;
|
||||
QString m_coverFilePath;
|
||||
|
|
|
@ -26,7 +26,19 @@ void GlobalThemeWidget::eidtInitWidget(const HistoryInfo &InfoData)
|
|||
this->setWallpaper(m_info.wallpaperpath);
|
||||
this->setTransparency(m_info.transparency);
|
||||
this->setWindowRadius(m_info.windowradius);
|
||||
// this->update();
|
||||
// this->update();
|
||||
}
|
||||
|
||||
void GlobalThemeWidget::refresh()
|
||||
{
|
||||
|
||||
this->setRadiusSetting(6);
|
||||
this->setAccentColor("#3790FA");
|
||||
this->setWindowRadius(6);
|
||||
this->setTransparency(65);
|
||||
this->setCover(":/resource/background/background-glazing.png");
|
||||
this->setWallpaper(":/resource/background/background-light.png");
|
||||
m_preview->updatescale1();
|
||||
}
|
||||
|
||||
void GlobalThemeWidget::initPreviewWidget()
|
||||
|
@ -255,7 +267,7 @@ void GlobalThemeWidget::initFilletWidget()
|
|||
|
||||
QObject::connect(m_filletslider, &QSlider::valueChanged, [=](int value) {
|
||||
showButton->setText(QString::number(value)+"px");
|
||||
|
||||
m_preview->updatescale();
|
||||
m_preview->updateControlRadius(value);
|
||||
|
||||
emit newRadius(value);
|
||||
|
|
|
@ -23,6 +23,7 @@ public:
|
|||
QString getWallpaperPath();
|
||||
|
||||
void eidtInitWidget(const HistoryInfo &InfoData);
|
||||
void refresh();
|
||||
signals:
|
||||
void wallpaperupdate(const QString& filePath);
|
||||
void newWallpaperFilePath(const QString& path);
|
||||
|
|
|
@ -268,6 +268,7 @@ QMap<QString, QString> *IconThemeWidget::getResourcesAppIconMap(QString Type)
|
|||
|
||||
void IconThemeWidget::initSystemMaps()
|
||||
{
|
||||
//解决历史记录三次之后第单数历史记录窗出现段错误
|
||||
getResourcesAppIconMap("systemicon");
|
||||
|
||||
m_systemcustomiconpathmap= m_systemiconpathmap;
|
||||
|
@ -331,13 +332,13 @@ void IconThemeWidget::initRightWidget()
|
|||
|
||||
QMap<QString, QString>* IconThemeWidget::getAppIconsMap()
|
||||
{
|
||||
refresh();
|
||||
getResourcesAppIconMap("icon");
|
||||
return m_iconpathmap;
|
||||
}
|
||||
|
||||
QMap<QString, QString> *IconThemeWidget::getSystemIconsMap()
|
||||
{
|
||||
refresh();
|
||||
getResourcesAppIconMap("systemicon");
|
||||
return m_systemiconpathmap;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ void ImageWidget::updateIconMap(const QMap<QString, QString>* newIconMap)
|
|||
QList<QString> keys = m_iconMap->keys();
|
||||
QString positions[11] = { keys[0], keys[9], keys[4], keys[5], keys[6],
|
||||
keys[3], keys[10], keys[8], keys[1], keys[7], keys[2] };
|
||||
|
||||
//FIX ME:第三个了历史记录无法打开
|
||||
int posX[3] = { 208, 879, 1550 };
|
||||
int posY[4] = { 275, 535, 795, 1055 };
|
||||
int index = 0;
|
||||
|
|
Loading…
Reference in New Issue