Skip to content

Commit

Permalink
Format project code
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Ricchi <[email protected]>
  • Loading branch information
AndreaRicchi committed Apr 30, 2024
1 parent 6371090 commit d28018d
Show file tree
Hide file tree
Showing 19 changed files with 197 additions and 151 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.16)
project(cutekeyboardplugin VERSION 1.0 LANGUAGES C CXX)
project(
cutekeyboardplugin
VERSION 1.0
LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -12,13 +15,13 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Qml Quick)
set(BUILD_EXAMPLES OFF)

if(QT_KNOWN_POLICY_QTP0001)
qt_policy(SET QTP0001 NEW)
qt_policy(SET QTP0001 NEW)
endif()

qt_standard_project_setup()

add_subdirectory(src)

if(BUILD_EXAMPLES)
add_subdirectory(example)
add_subdirectory(example)
endif()
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@ make -j4
make install
```

### Custom Installation

```bash
mkdir build && cd build
qmake .. INSTALL_PREFIX=/home/custom_dir/custom_root
make -j4
make install
```

## Examples

```bash
mkdir build && cd build
qmake .. CONFIG+=BUILD_EXAMPLES
make -j4
make
make install
```

## Usage
Expand Down
40 changes: 11 additions & 29 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,17 @@
qt_add_executable(example WIN32 MACOSX_BUNDLE
main.cpp
)
target_compile_definitions(example PRIVATE
QT_DEPRECATED_WARNINGS
)
qt_add_executable(example WIN32 MACOSX_BUNDLE main.cpp)
target_compile_definitions(example PRIVATE QT_DEPRECATED_WARNINGS)

target_link_libraries(example PRIVATE
Qt::Core
Qt::Gui
Qt::Quick
)
target_link_libraries(example PRIVATE Qt::Core Qt::Gui Qt::Quick)

set(qml_resource_files
"main.qml"
)
set(qml_resource_files "main.qml")

qt_add_resources(example "qml"
PREFIX
"/"
FILES
${qml_resource_files}
)
qt_add_resources(example "qml" PREFIX "/" FILES ${qml_resource_files})

install(TARGETS example
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
TARGETS example
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

qt_generate_deploy_app_script(
TARGET example
FILENAME_VARIABLE deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
qt_generate_deploy_app_script(TARGET example FILENAME_VARIABLE deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR)
install(SCRIPT ${deploy_script})
1 change: 1 addition & 0 deletions example/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Window {
anchors.left: parent.left
anchors.right: parent.right
languageLayout: "It"
availableLanguageLayouts: ["It", "En"]

states: State {
name: "visible"
Expand Down
102 changes: 41 additions & 61 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
set(HEADERS
"EnterKeyAction.hpp"
"EnterKeyActionAttachedType.hpp"
"InputPanelIface.hpp"
"VirtualKeyboardInputContextPlugin.h"
"VirtualKeyboardInputContext.h"
"DeclarativeInputEngine.h"
)
"EnterKeyAction.hpp" "EnterKeyActionAttachedType.hpp" "InputPanelIface.hpp"
"VirtualKeyboardInputContextPlugin.h" "VirtualKeyboardInputContext.h"
"DeclarativeInputEngine.h")

set(SOURCES
"EnterKeyAction.cpp"
"EnterKeyActionAttachedType.cpp"
"InputPanelIface.cpp"
"VirtualKeyboardInputContextPlugin.cpp"
"VirtualKeyboardInputContext.cpp"
"DeclarativeInputEngine.cpp"
)
"EnterKeyAction.cpp" "EnterKeyActionAttachedType.cpp" "InputPanelIface.cpp"
"VirtualKeyboardInputContextPlugin.cpp" "VirtualKeyboardInputContext.cpp"
"DeclarativeInputEngine.cpp")

set(QML_FILES
"qml/AlternativeKeysPopup.qml"
Expand All @@ -40,61 +32,49 @@ set(QML_FILES
"qml/ShiftKey.qml"
"qml/SpaceKey.qml"
"qml/SymbolKey.qml"
"qml/SymbolLayout.qml"
)
"qml/SymbolLayout.qml")

foreach(_file IN_LISTS QML_FILES)
cmake_path(GET _file FILENAME _fileName)
set_source_files_properties(${_file} PROPERTIES
QT_RESOURCE_ALIAS ${_fileName}
)
cmake_path(GET _file FILENAME _fileName)
set_source_files_properties(${_file} PROPERTIES QT_RESOURCE_ALIAS
${_fileName})
endforeach()

qt_add_qml_module(${PROJECT_NAME}
URI
"QtQuick.CuteKeyboard"
VERSION
1.0
PLUGIN_TARGET
${PROJECT_NAME}
OUTPUT_DIRECTORY
"QtQuick/CuteKeyboard"
RESOURCE_PREFIX
"/"
CLASS_NAME
"VirtualKeyboardInputContextPlugin"
SOURCES
${HEADERS}
${SOURCES}
QML_FILES
${QML_FILES}
NO_GENERATE_PLUGIN_SOURCE
)
qt_add_qml_module(
${PROJECT_NAME}
URI
"QtQuick.CuteKeyboard"
VERSION
1.0
PLUGIN_TARGET
${PROJECT_NAME}
OUTPUT_DIRECTORY
"QtQuick/CuteKeyboard"
RESOURCE_PREFIX
"/"
CLASS_NAME
"VirtualKeyboardInputContextPlugin"
SOURCES
${HEADERS}
${SOURCES}
QML_FILES
${QML_FILES}
NO_GENERATE_PLUGIN_SOURCE)

qt_add_resources(${PROJECT_NAME} "icons"
PREFIX "/"
FILES
"resources.qrc"
)
qt_add_resources(${PROJECT_NAME} "icons" PREFIX "/" FILES "resources.qrc")

target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Core
Qt::Gui
Qt::GuiPrivate
Qt::Qml
Qt::Quick
Qt::QuickPrivate
)
target_link_libraries(
${PROJECT_NAME} PRIVATE Qt::Core Qt::Gui Qt::GuiPrivate Qt::Qml Qt::Quick
Qt::QuickPrivate)

if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
set(INSTALL_DIR ${QT_DIR}/../../../plugins/platforminputcontexts)
set(INSTALL_DIR ${QT_DIR}/../../../plugins/platforminputcontexts)
else()
set(INSTALL_DIR ${CMAKE_INSTALL_BINDIR}/platforminputcontexts)
set_target_properties(${PROJECT_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/platforminputcontexts"
)
set(INSTALL_DIR ${CMAKE_INSTALL_BINDIR}/platforminputcontexts)
set_target_properties(
${PROJECT_NAME}
PROPERTIES LIBRARY_OUTPUT_DIRECTORY
"$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/platforminputcontexts")
endif()

install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${INSTALL_DIR}
)
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${INSTALL_DIR})
3 changes: 2 additions & 1 deletion src/InputPanelIface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class InputPanelIface : public QObject {
void setLanguageIcon(const QString &languageIcon);

QStringList availableLanguageLayouts() const;
void setAvailableLanguageLayouts(const QStringList &availableLanguageLayouts);
void setAvailableLanguageLayouts(
const QStringList &availableLanguageLayouts);

QString languageLayout() const;
void setLanguageLayout(const QString &languageIcon);
Expand Down
8 changes: 7 additions & 1 deletion src/qml/CsLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}

}

RowLayout {
Expand Down Expand Up @@ -150,12 +151,14 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}

}

RowLayout {
property real keyWeight: 156

ShiftKey {}
ShiftKey {
}

Key {
btnKey: Qt.Key_Y
Expand Down Expand Up @@ -217,6 +220,7 @@ ColumnLayout {
ShiftKey {
weight: 204
}

}

RowLayout {
Expand Down Expand Up @@ -246,5 +250,7 @@ ColumnLayout {
HideKey {
weight: 205
}

}

}
8 changes: 7 additions & 1 deletion src/qml/DeLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}

}

RowLayout {
Expand Down Expand Up @@ -159,12 +160,14 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}

}

RowLayout {
property real keyWeight: 156

ShiftKey {}
ShiftKey {
}

Key {
btnKey: Qt.Key_Y
Expand Down Expand Up @@ -229,6 +232,7 @@ ColumnLayout {
ShiftKey {
weight: 204
}

}

RowLayout {
Expand Down Expand Up @@ -258,5 +262,7 @@ ColumnLayout {
HideKey {
weight: 205
}

}

}
8 changes: 7 additions & 1 deletion src/qml/ElLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}

}

RowLayout {
Expand Down Expand Up @@ -127,12 +128,14 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}

}

RowLayout {
property real keyWeight: 156

ShiftKey {}
ShiftKey {
}

Key {
btnText: "ζ"
Expand Down Expand Up @@ -186,6 +189,7 @@ ColumnLayout {
ShiftKey {
weight: 204
}

}

RowLayout {
Expand Down Expand Up @@ -215,5 +219,7 @@ ColumnLayout {
HideKey {
weight: 205
}

}

}
8 changes: 7 additions & 1 deletion src/qml/EnLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}

}

RowLayout {
Expand Down Expand Up @@ -152,12 +153,14 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}

}

RowLayout {
property real keyWeight: 156

ShiftKey {}
ShiftKey {
}

Key {
btnKey: Qt.Key_Z
Expand Down Expand Up @@ -219,6 +222,7 @@ ColumnLayout {
ShiftKey {
weight: 204
}

}

RowLayout {
Expand Down Expand Up @@ -248,5 +252,7 @@ ColumnLayout {
HideKey {
weight: 205
}

}

}
Loading

0 comments on commit d28018d

Please sign in to comment.