0 | |
From: Weng Xuetian <wengxt@gmail.com>
|
1 | |
Date: Thu, 28 Sep 2017 18:31:02 -0700
|
2 | |
Subject: [unikey] port editor to qt5.
|
3 | |
|
4 | |
Fix #20.
|
5 | |
---
|
6 | |
CMakeLists.txt | 5 +++--
|
7 | |
macro-editor/CMakeLists.txt | 24 ++++++++----------------
|
8 | |
macro-editor/editor.h | 2 +-
|
9 | |
macro-editor/macro-editor.json | 2 ++
|
10 | |
macro-editor/main.cpp | 3 ---
|
11 | |
macro-editor/main.h | 3 ++-
|
12 | |
6 files changed, 16 insertions(+), 23 deletions(-)
|
13 | |
create mode 100644 macro-editor/macro-editor.json
|
14 | |
|
15 | |
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
16 | |
index 280330c..8b8eb11 100644
|
17 | |
--- a/CMakeLists.txt
|
18 | |
+++ b/CMakeLists.txt
|
19 | |
@@ -25,9 +25,10 @@ find_package(Gettext REQUIRED)
|
20 | |
find_package(LibIntl REQUIRED)
|
21 | |
|
22 | |
if (ENABLE_QT)
|
23 | |
-find_package(Qt4 4.8)
|
24 | |
+find_package(Qt5 5.7 REQUIRED COMPONENTS Core Gui Widgets)
|
25 | |
+find_package(FcitxQt5WidgetsAddons 1.1 REQUIRED)
|
26 | |
+find_package(FcitxQt5DBusAddons 1.1 REQUIRED)
|
27 | |
|
28 | |
-pkg_check_modules(FCITX_QT "fcitx-qt>=4.2.8")
|
29 | |
endif (ENABLE_QT)
|
30 | |
|
31 | |
configure_file(config.h.in config.h)
|
32 | |
diff --git a/macro-editor/CMakeLists.txt b/macro-editor/CMakeLists.txt
|
33 | |
index cc57ea2..71aaabd 100644
|
34 | |
--- a/macro-editor/CMakeLists.txt
|
35 | |
+++ b/macro-editor/CMakeLists.txt
|
36 | |
@@ -16,14 +16,11 @@ fcitx_translate_add_sources(
|
37 | |
${MACRO_EDITOR_SRCS}
|
38 | |
${MACRO_EDITOR_HDRS})
|
39 | |
|
40 | |
-if (NOT QT_FOUND OR NOT FCITX_QT_FOUND OR NOT ENABLE_QT)
|
41 | |
+if (NOT ENABLE_QT)
|
42 | |
return()
|
43 | |
-endif (NOT QT_FOUND OR NOT FCITX_QT_FOUND OR NOT ENABLE_QT)
|
44 | |
+endif (NOT ENABLE_QT)
|
45 | |
|
46 | |
include_directories(
|
47 | |
- ${FCITX_QT_INCLUDE_DIRS}
|
48 | |
- ${QT_QTCORE_INCLUDE_DIR}
|
49 | |
- ${QT_QTGUI_INCLUDE_DIR}
|
50 | |
${CMAKE_CURRENT_BINARY_DIR}
|
51 | |
${PROJECT_SOURCE_DIR}/unikey
|
52 | |
)
|
53 | |
@@ -31,27 +28,22 @@ include_directories(
|
54 | |
link_directories(
|
55 | |
${FCITX4_FCITX_UTILS_LIBRARY_DIRS}
|
56 | |
${FCITX4_FCITX_CONFIG_LIBRARY_DIRS}
|
57 | |
-${FCITX_QT_LIBRARY_DIRS}
|
58 | |
)
|
59 | |
-qt4_wrap_cpp(MACRO_EDITOR_MOCS ${MACRO_EDITOR_HDRS})
|
60 | |
-qt4_wrap_ui(MACRO_EDITOR_SRCS editor.ui dialog.ui)
|
61 | |
+qt5_wrap_ui(MACRO_EDITOR_SRCS editor.ui dialog.ui)
|
62 | |
add_library(fcitx-unikey-macro-editor
|
63 | |
MODULE ${MACRO_EDITOR_SRCS} ${MACRO_EDITOR_MOCS})
|
64 | |
set_target_properties(fcitx-unikey-macro-editor PROPERTIES
|
65 | |
LINK_FLAGS "-Wl,--no-undefined"
|
66 | |
+ AUTOMOC TRUE
|
67 | |
)
|
68 | |
target_link_libraries(fcitx-unikey-macro-editor
|
69 | |
- debug ${QT_QTCORE_LIBRARY_DEBUG}
|
70 | |
- debug ${QT_QTDBUS_LIBRARY_DEBUG}
|
71 | |
- debug ${QT_QTGUI_LIBRARY_DEBUG}
|
72 | |
- optimized ${QT_QTCORE_LIBRARY_RELEASE}
|
73 | |
- optimized ${QT_QTDBUS_LIBRARY_RELEASE}
|
74 | |
- optimized ${QT_QTGUI_LIBRARY_RELEASE}
|
75 | |
+ Qt5::Core
|
76 | |
+ Qt5::Widgets
|
77 | |
+ FcitxQt5::WidgetsAddons
|
78 | |
+ LibIntl::LibIntl
|
79 | |
unikey
|
80 | |
${FCITX4_FCITX_UTILS_LIBRARIES}
|
81 | |
${FCITX4_FCITX_CONFIG_LIBRARIES}
|
82 | |
- ${FCITX_QT_LIBRARIES}
|
83 | |
- LibIntl::LibIntl
|
84 | |
)
|
85 | |
|
86 | |
install(TARGETS fcitx-unikey-macro-editor DESTINATION ${FCITX4_ADDON_INSTALL_DIR}/qt)
|
87 | |
diff --git a/macro-editor/editor.h b/macro-editor/editor.h
|
88 | |
index 2426032..137e0b0 100644
|
89 | |
--- a/macro-editor/editor.h
|
90 | |
+++ b/macro-editor/editor.h
|
91 | |
@@ -17,7 +17,7 @@
|
92 | |
* *
|
93 | |
***************************************************************************/
|
94 | |
|
95 | |
-#include <fcitx-qt/fcitxqtconfiguiwidget.h>
|
96 | |
+#include <fcitxqtconfiguiwidget.h>
|
97 | |
|
98 | |
class CMacroTable;
|
99 | |
namespace Ui {
|
100 | |
diff --git a/macro-editor/macro-editor.json b/macro-editor/macro-editor.json
|
101 | |
new file mode 100644
|
102 | |
index 0000000..2c63c08
|
103 | |
--- /dev/null
|
104 | |
+++ b/macro-editor/macro-editor.json
|
105 | |
@@ -0,0 +1,2 @@
|
106 | |
+{
|
107 | |
+}
|
108 | |
diff --git a/macro-editor/main.cpp b/macro-editor/main.cpp
|
109 | |
index 12b769a..890eade 100644
|
110 | |
--- a/macro-editor/main.cpp
|
111 | |
+++ b/macro-editor/main.cpp
|
112 | |
@@ -50,6 +50,3 @@ QString MacroEditorPlugin::domain()
|
113 | |
{
|
114 | |
return "fcitx-unikey";
|
115 | |
}
|
116 | |
-
|
117 | |
-
|
118 | |
-Q_EXPORT_PLUGIN2 (fcitx_macro_editor, MacroEditorPlugin)
|
119 | |
diff --git a/macro-editor/main.h b/macro-editor/main.h
|
120 | |
index dfd06fc..e6a62c6 100644
|
121 | |
--- a/macro-editor/main.h
|
122 | |
+++ b/macro-editor/main.h
|
123 | |
@@ -20,11 +20,12 @@
|
124 | |
#ifndef _MAIN_H_
|
125 | |
#define _MAIN_H_
|
126 | |
|
127 | |
-#include <fcitx-qt/fcitxqtconfiguiplugin.h>
|
128 | |
+#include <fcitxqtconfiguiplugin.h>
|
129 | |
|
130 | |
class MacroEditorPlugin : public FcitxQtConfigUIPlugin {
|
131 | |
Q_OBJECT
|
132 | |
public:
|
133 | |
+ Q_PLUGIN_METADATA(IID FcitxQtConfigUIFactoryInterface_iid FILE "macro-editor.json")
|
134 | |
explicit MacroEditorPlugin(QObject* parent = 0);
|
135 | |
virtual QString name();
|
136 | |
virtual QStringList files();
|