新增qt6适配

This commit is contained in:
gfdgd xi 2025-05-24 19:47:59 +08:00
parent bed4c66530
commit e0b30c6af7
6 changed files with 94 additions and 85 deletions

2
.gitignore vendored
View File

@ -72,3 +72,5 @@ CMakeLists.txt.user*
# Visual Studio Code
.vscode
build/

88
CMakeLists.txt Normal file
View File

@ -0,0 +1,88 @@
cmake_minimum_required(VERSION 3.16)
project(gxde-kernel-manager VERSION 1.0 LANGUAGES C CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Set up AUTOMOC and some sensible defaults for runtime execution
# When using Qt 6.3, you can replace the code block below with
# qt_standard_project_setup()
set(CMAKE_AUTOMOC ON)
include(GNUInstallDirs)
set(CMAKE_AUTOUIC ON)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Network)
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Widgets)
qt_add_executable(gxde-kernel-manager WIN32 MACOSX_BUNDLE
aboutwindow.cpp aboutwindow.h aboutwindow.ui
aptpkginfo.cpp aptpkginfo.h
kernelinformation.cpp kernelinformation.h
kernelinformationdialog.cpp kernelinformationdialog.h kernelinformationdialog.ui
kernelinstaller.cpp kernelinstaller.h kernelinstaller.ui
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
programinfo.cpp programinfo.h
)
target_link_libraries(gxde-kernel-manager PRIVATE
Qt::Core
Qt::Gui
Qt::Network
)
# Resources:
set(Resource_resource_files
"Donate/Alipay.jpg"
"Donate/QQ.png"
"Donate/Wechat.png"
"Donate/advertisement0.jpg"
"data/new/en_US.html"
"data/new/zh_CN.html"
"data/version"
"icon/dialog-apply.svg"
"icon/dialog-cancel.svg"
"icon/dialog-error.svg"
"icon/dialog-information.svg"
"icon/dialog-ok.svg"
"icon/dialog-question.svg"
"icon/dialog-warning.svg"
"icon/gxde-kernel-manager.svg"
"icon/icon1.png"
"icon/tux.png"
"shell/kernel-installer-reconfigure-template.sh"
"shell/kernel-installer-remove-template.sh"
"shell/kernel-installer-root-loader-template.sh"
"shell/kernel-installer-template.sh"
"shell/kernel-installer-update-template.sh"
"shell/kernel-installer-upgrade-template.sh"
"translation/gxde-kernel-manager_zh_CN.qm"
)
qt_add_resources(gxde-kernel-manager "Resource"
PREFIX
"/"
FILES
${Resource_resource_files}
)
if((QT_VERSION_MAJOR GREATER 4))
target_link_libraries(gxde-kernel-manager PRIVATE
Qt::Widgets
)
endif()
if(UNIX AND NOT MACOS)
target_link_libraries(gxde-kernel-manager PRIVATE
qtermwidget6
)
endif()
install(TARGETS gxde-kernel-manager
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# Consider using qt_generate_deploy_app_script() for app deployment if
# the project can use Qt 6.3. In that case rerun qmake2cmake with
# --min-qt-version=6.3.

View File

@ -169,7 +169,7 @@ void AptPkgInfo::SetPkgName(QString pkgName)
QString AptPkgInfo::GetPkgInfo(QString pkgName) const
{
if(pkgName == NULL) {
if(pkgName == "") {
pkgName = this->pkgName;
}
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();

2
debian/control vendored
View File

@ -8,7 +8,7 @@ Build-Depends:
qtbase5-dev,
qtbase5-dev-tools,
qtbase5-private-dev,
libqtermwidget5-1-dev | libqtermwidget5-0-dev,
libqtermwidget-dev | libqtermwidget5-1-dev | libqtermwidget5-0-dev,
qttools5-dev-tools
Standards-Version: 4.6.2
Homepage: https://gitee.com/GXDE-OS/gxde-kernel-manager

View File

@ -1,82 +0,0 @@
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
aboutwindow.cpp \
aptpkginfo.cpp \
kernelinformation.cpp \
kernelinformationdialog.cpp \
kernelinstaller.cpp \
main.cpp \
mainwindow.cpp \
programinfo.cpp
HEADERS += \
aboutwindow.h \
aptpkginfo.h \
kernelinformation.h \
kernelinformationdialog.h \
kernelinstaller.h \
mainwindow.h \
programinfo.h
FORMS += \
aboutwindow.ui \
kernelinformationdialog.ui \
kernelinstaller.ui \
mainwindow.ui
# 更新翻译
system(lrelease translation/gxde-kernel-manager_zh_CN.ts translation/gxde-kernel-manager_zh_CN.qm)
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
unix:!macx: LIBS += -lqtermwidget5
# 使用 GXDE 系统源里含有的内核
#aptsource.path = /etc/apt/sources.list.d/
#aptsource.files = $$PWD/AptSources/gxde-kernel-manager.list
aptsourcegpg.path = /etc/apt/trusted.gpg.d/
aptsourcegpg.files = $$PWD/AptSources/gxde-kernel-manager.gpg
debiandesktop.path = /usr/share/applications/
debiandesktop.files = $$PWD/gxde-kernel-manager.desktop
#uosdesktop.path = /opt/apps/gxde-kernel-manager/entries/applications
#uosdesktop.files = $$PWD/gxde-kernel-manager.desktop
icon.path = /usr/share/icons/
icon.files = $$PWD/icon/gxde-kernel-manager.svg
#icon.path = /opt/apps/gxde-kernel-manager/
#icon.files = $$PWD/icon/icon.svg
# GXDE 下不需要该脚本
#targetrunner.path = /opt/apps/gxde-kernel-manager/
#targetrunner.files = $$PWD/gxde-kernel-manager-runner.sh
#libinclude.path = /opt/apps/gxde-kernel-manager/
#libinclude.files = $$PWD/lib
#target.path = /opt/apps/gxde-kernel-manager/
target.path = /usr/bin
sysbro.path = /usr/share/GXDE/gxde-system-assistant/tool-extensions
sysbro.files = $$PWD/gxde-kernel-manager.desktop
#INSTALLS += aptsourcegpg aptsource target debiandesktop uosdesktop icon targetrunner
INSTALLS += target icon sysbro
TRANSLATIONS += translation/gxde-kernel-manager_zh_CN.ts
RESOURCES += \
Resource.qrc

View File

@ -3,7 +3,8 @@
#include <QMainWindow>
#include <qtermwidget5/qtermwidget.h>
//#include <qtermwidget5/qtermwidget.h>
#include <qtermwidget6/qtermwidget.h>
namespace Ui {
class KernelInstaller;