From a3d296b6e278e8f25ba6948829e44c22fd1b01aa Mon Sep 17 00:00:00 2001 From: likehomedream Date: Tue, 2 Jan 2024 10:05:14 +0800 Subject: [PATCH] add m_isKylin --- debian/control | 4 +- kylin-theme-builder.pro | 2 +- src/mainwindow.cpp | 10 +++- src/mainwindow.h | 1 + src/module/cursorthemefeature.cpp | 77 ------------------------------- src/module/cursorthemewidget.cpp | 8 ++++ 6 files changed, 22 insertions(+), 80 deletions(-) diff --git a/debian/control b/debian/control index 806d4f6..76b6802 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/kylin-theme-builder.pro b/kylin-theme-builder.pro index 59a3d2e..ce81880 100644 --- a/kylin-theme-builder.pro +++ b/kylin-theme-builder.pro @@ -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 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 144737d..746938c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,5 +1,7 @@ #include "mainwindow.h" #include "ukuistylehelper/ukuistylehelper.h" +#include "kysdk/kysdk-system/libkysysinfo.h" + #include #include 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(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 069c720..e93e682 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -66,5 +66,6 @@ private: buildResultWidget *m_buildResult; bool m_ishistory = false; + bool m_isKylin = false; }; #endif // MAINWINDOW_H diff --git a/src/module/cursorthemefeature.cpp b/src/module/cursorthemefeature.cpp index be2ede0..0017192 100644 --- a/src/module/cursorthemefeature.cpp +++ b/src/module/cursorthemefeature.cpp @@ -138,83 +138,6 @@ void CursorImageWidget::updateImage(const QString& imagePath) void CursorImageWidget::updateIconMap(const QMap *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> 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& pair1, const QPair& 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(); } /** diff --git a/src/module/cursorthemewidget.cpp b/src/module/cursorthemewidget.cpp index ab87707..f5bff73 100644 --- a/src/module/cursorthemewidget.cpp +++ b/src/module/cursorthemewidget.cpp @@ -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"); + } + } /**