add m_isKylin

This commit is contained in:
likehomedream 2024-01-02 10:05:14 +08:00
parent 23143fd937
commit a3d296b6e2
6 changed files with 22 additions and 80 deletions

4
debian/control vendored
View File

@ -15,7 +15,9 @@ Build-Depends: debhelper-compat (= 13),
libkysdk-qtwidgets-dev,
libkysdk-waylandhelper,
libkysdk-waylandhelper-dev,
libukui-log4qt-dev
libukui-log4qt-dev,
libkysdk-sysinfo,
libkysdk-sysinfo-dev
Standards-Version: 4.6.0
Homepage: https://gitee.com/openkylin/kylin-theme-builder
#Vcs-Browser: https://salsa.debian.org/debian/kylin-theme-builder

View File

@ -4,7 +4,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11 link_pkgconfig
PKGCONFIG += kysdk-qtwidgets kysdk-waylandhelper
PKGCONFIG += kysdk-qtwidgets kysdk-waylandhelper kysdk-sysinfo
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings

View File

@ -1,5 +1,7 @@
#include "mainwindow.h"
#include "ukuistylehelper/ukuistylehelper.h"
#include "kysdk/kysdk-system/libkysysinfo.h"
#include <QUrl>
#include <QDesktopServices>
MainWindow::MainWindow(QWidget *parent)
@ -9,7 +11,13 @@ MainWindow::MainWindow(QWidget *parent)
lf->removeHeader(this);
this->setMouseTracking(true);
this->setFocus();
char* systemtype = kdk_system_get_systemName();
qDebug()<<"system ==" << systemtype;
if(systemtype == " Kylin"){
m_isKylin = true;
}else{
m_isKylin = false;
}
m_bridge = Bridge::getInstance();
FileProcess();
m_bridge->createSavePathConfig();

View File

@ -66,5 +66,6 @@ private:
buildResultWidget *m_buildResult;
bool m_ishistory = false;
bool m_isKylin = false;
};
#endif // MAINWINDOW_H

View File

@ -138,83 +138,6 @@ void CursorImageWidget::updateImage(const QString& imagePath)
void CursorImageWidget::updateIconMap(const QMap<QString, QString> *newIconMap)
{
m_iconMap = newIconMap;
// 清空场景
QGraphicsScene* scene = graphicsView->scene();
scene->clear();
QPixmap image(":/resource/background/background-light.png");
if (image.isNull()) {
qDebug() << "Failed to load image.";
}
// 创建 QGraphicsPixmapItem 并添加到 QGraphicsScene
QGraphicsPixmapItem* backgroundItem = scene->addPixmap(image);
// 创建 QGraphicsBlurEffect 并设置模糊半径
QGraphicsBlurEffect* blurEffect = new QGraphicsBlurEffect;
blurEffect->setBlurRadius(10);
// 将模糊效果应用到 QGraphicsPixmapItem 上
backgroundItem->setGraphicsEffect(blurEffect);
// 创建有序的键值对列表
QList<QPair<QString, QString>> sortedList;
for (auto it = m_iconMap->begin(); it != m_iconMap->end(); ++it) {
sortedList.append(qMakePair(it.key(), it.value()));
}
std::sort(sortedList.begin(), sortedList.end(), [this](const QPair<QString, QString>& pair1, const QPair<QString, QString>& pair2) {
QStringList order1 = QStringList() << "left_ptr" << "dnd-none" << "hand1" << "hand2" << "right_ptr"
<< "dnd-ask"<< "dnd-copy" << "dnd-link"
<< "h_double_arrow" << "v_double_arrow" << "ul_angle" << "ur_angle"
<< "left_tee" << "bottom_tee"<< "top_tee" << "right_tee" << "cross" << "tcross"
<< "sb_up_arrow" << "sb_left_arrow" << "sb_down_arrow" << "sb_right_arrow" << "all-scroll"
<< "sb_h_double_arrow" << "sb_v_double_arrow" << "vertical_text" << "xterm"
<< "zoom-in" << "zoom-out"
<< "circle" << "color-picker" << "pencil" << "dotbox" << "X_cursor" << "plus";
QStringList order2 = QStringList() << "left_ptr_watch_1" << "left_ptr_watch_2" << "left_ptr_watch_3" << "left_ptr_watch_4" << "left_ptr_watch_5"
<< "watch_1" << "watch_2" << "watch_3" << "watch_4" << "watch_5" << "watch_6" << "watch_7" << "watch_8" << "watch_9" << "watch_10";
if (m_iconMap->contains("left_ptr_watch_1")) {
return order2.indexOf(pair1.first) < order2.indexOf(pair2.first);
} else {
return order1.indexOf(pair1.first) < order1.indexOf(pair2.first);
}
});
int columnCount = 15;
int row = 1;
int col = 0;
// 添加新的图像项到场景中
for (const auto& pair : sortedList) {
const QString& widgetName = pair.first;
const QString& filePath = pair.second;
QPixmap pixmap(filePath);
if (!pixmap.isNull()) {
QGraphicsPixmapItem* item = scene->addPixmap(pixmap.scaled(128, 128));
item->setPos(col * 128, row * 128);
item->setScale(1.0);
item->setData(0, widgetName);
item->setData(1, filePath);
col++;
if (col >= columnCount) {
col = 0;
row++;
}
} else {
qDebug() << "Failed to load image:" << filePath;
}
}
// 重新调整视图和显示场景
graphicsView->fitInView(scene->sceneRect(), Qt::KeepAspectRatio);
graphicsView->show();
}
/**

View File

@ -120,6 +120,14 @@ void CursorThemeWidget::refresh()
updateCustomPathMap(m_iconpathmap,"cursor");
m_preview2->updateIconMap(m_timeiconpathmap);
updateCustomPathMap(m_timeiconpathmap,"timecursor");
if(m_info.wallpaperpath != nullptr){
m_preview->updateImage(m_info.wallpaperpath);
m_preview2->updateImage(m_info.wallpaperpath);
}else{
m_preview->updateImage(":/resource/background/1-openkylin.jpg");
m_preview2->updateImage(":/resource/background/1-openkylin.jpg");
}
}
/**