Skip to content

Commit

Permalink
refactor: migrate to Qt6 and clean up codebase
Browse files Browse the repository at this point in the history
- Move Qt5 components and translations
- Add Qt6/DTK6 dependencies
- Update installation paths

Log: migrate to Qt6 and clean up codebase
  • Loading branch information
wyu71 committed Nov 7, 2024
1 parent 1534ac9 commit f8b58a3
Show file tree
Hide file tree
Showing 232 changed files with 474 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build/*
*.kdev4
.kdev_include_paths
.directory
*.user
*.kate-swp
*.orig
*~
Expand Down
22 changes: 1 addition & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,11 @@ add_definitions(-DTRANSLATION_DOMAIN=\"org.fcitx.fcitx5.kcm\")
add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-configtool\")
add_definitions(-DQT_NO_KEYWORDS)

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets X11Extras Concurrent)
find_package(DtkCore REQUIRED)
find_package(DtkWidget REQUIRED)

find_package(KF5ItemViews REQUIRED)

find_package(Fcitx5Core 5.0.4 REQUIRED)
find_package(Fcitx5Config REQUIRED)
find_package(Fcitx5Utils REQUIRED)
find_package(Fcitx5Qt5DBusAddons REQUIRED)
find_package(Fcitx5Qt5WidgetsAddons 5.0.2 REQUIRED)
find_package(Qt5Svg)
set_package_properties(Qt5Svg PROPERTIES
DESCRIPTION "May be used for show icons"
TYPE RUNTIME)

get_target_property(FCITX5_QT5_GUI_WRAPPER Fcitx5Qt5::gui-wrapper IMPORTED_LOCATION)

find_package(KF5WidgetsAddons REQUIRED)
find_package(IsoCodes REQUIRED)
kde_enable_exceptions()

include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")

Expand All @@ -60,11 +44,7 @@ pkg_check_modules(XkbFile "xkbfile" REQUIRED IMPORTED_TARGET)

set(DEFAULT_XKB_RULES "evdev" CACHE STRING "Xkb rules name")

configure_file(config.h.in config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

add_subdirectory(po)
add_subdirectory(src-old)
add_subdirectory(src)
add_subdirectory(layout)

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
6 changes: 6 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Build-Depends:
qtquickcontrols2-5-dev,
qttools5-dev,
xkb-data,
libfcitx5-qt6-dev,
qt6-base-dev,
qt6-declarative-dev,
qt6-tools-dev,
libdtk6widget-dev,
libdtk6core-dev,
Standards-Version: 4.6.2
Rules-Requires-Root: no
Homepage: https://github.com/fcitx/fcitx5-configtool
Expand Down
2 changes: 1 addition & 1 deletion debian/install
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
usr/lib/*/dde-control-center/modules/libdcc-fcitx5configtool-plugin.so
usr/lib/*/dde-control-center
usr/share/dde-control-center/translations/*
24 changes: 24 additions & 0 deletions src-old/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets X11Extras Concurrent)
find_package(DtkCore REQUIRED)
find_package(DtkWidget REQUIRED)

find_package(KF5ItemViews REQUIRED)

find_package(Fcitx5Qt5DBusAddons REQUIRED)
find_package(Fcitx5Qt5WidgetsAddons 5.0.2 REQUIRED)
find_package(Qt5Svg)
set_package_properties(Qt5Svg PROPERTIES
DESCRIPTION "May be used for show icons"
TYPE RUNTIME)

get_target_property(FCITX5_QT5_GUI_WRAPPER Fcitx5Qt5::gui-wrapper IMPORTED_LOCATION)

find_package(KF5WidgetsAddons REQUIRED)
kde_enable_exceptions()

configure_file(config.h.in config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

add_subdirectory(po)
add_subdirectory(src)
add_subdirectory(layout)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src-old/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(lib)
add_subdirectory(dcc-module)
54 changes: 54 additions & 0 deletions src-old/src/dcc-fcitx5configtool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.7)

set(PLUGIN_NAME "deepin-fcitx5configtool-plugin")

project(${PLUGIN_NAME})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_FLAGS "-g -Wall")

# 增加安全编译参数
ADD_DEFINITIONS("-fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy")

# 指定要用到的库
# -DQT_MAJOR_VERSION=6
# find_package(QT NAMES Qt6 Qt5)
# set(QT_MAJOR_VERSION 6)
# set(QT_DEFAULT_MAJOR_VERSION 6)
find_package(Qt6 COMPONENTS Core Gui DBus LinguistTools REQUIRED)
find_package(DdeControlCenter REQUIRED)
find_package(Dtk6 COMPONENTS Core REQUIRED)
find_package(PkgConfig REQUIRED)


set(DccFcitx5configtool_Name fcitx5configtool)
file(GLOB_RECURSE DccFcitx5configtool_SRCS
"*.cpp"
"*.h"
"operation/*.cpp"
"operation/*.h"
)

add_library(${DccFcitx5configtool_Name} MODULE
${DccFcitx5configtool_SRCS}
)

target_include_directories(${DccFcitx5configtool_Name} PUBLIC
Dde::Control-Center
)

set(DccFcitx5configtool_Libraries
Qt6::DBus
Qt6::Gui
Dtk6::Core
Dde::Control-Center
)

target_link_libraries(${DccFcitx5configtool_Name} PRIVATE
${DccFcitx5configtool_Libraries}
)

dcc_install_plugin(NAME ${DccFcitx5configtool_Name} TARGET ${DccFcitx5configtool_Name})
27 changes: 27 additions & 0 deletions src-old/src/dcc-fcitx5configtool/operation/fcitx5configtool.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: 2024 - 2027 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "fcitx5configtool.h"

#include "dde-control-center/dccfactory.h"

#include <QCoreApplication>
#include <QDebug>
#include <QGuiApplication>
#include <QtQml/QQmlEngine>

// #include "dccfactory.h"

namespace deepin {
namespace fcitx5configtool {
Fcitx5ConfigToolWorker::Fcitx5ConfigToolWorker(QObject *parent)
: QObject(parent)
{

}

DCC_FACTORY_CLASS(Fcitx5ConfigToolWorker)
} // namespace fcitx5configtool
} // namespace deepin

#include "fcitx5configtool.moc"
24 changes: 24 additions & 0 deletions src-old/src/dcc-fcitx5configtool/operation/fcitx5configtool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-FileCopyrightText: 2024 - 2027 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef FCITX5CONFIGTOOL_H
#define FCITX5CONFIGTOOL_H

#include <QObject>
#include <QVariant>
#include <QVariantMap>

namespace deepin {
namespace fcitx5configtool {

class Fcitx5ConfigToolWorker : public QObject
{
Q_OBJECT

public:
explicit Fcitx5ConfigToolWorker(QObject *parent = nullptr);
};
} // namespace fcitx5configtool
} // namespace deepin

#endif // FCITX5CONFIGTOOL_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/icons/deepin/builtin">
<file>icons/dcc_nav_keyboard_42px.svg</file>
<file>icons/dcc_nav_keyboard_84px.svg</file>
</qresource>
</RCC>
Loading

0 comments on commit f8b58a3

Please sign in to comment.