Add a Qt Widgets frontend to xC
This is very much a work in progress, though functional. Qt Widgets are basically non-working on Android, though Qt Quick requires a radically different approach.
This commit is contained in:
parent
21095a11d6
commit
918c589c65
@ -33,9 +33,9 @@ including link:xC.adoc#_key_bindings[keyboard shortcuts].
|
|||||||
|
|
||||||
image::xP.webp[align="center"]
|
image::xP.webp[align="center"]
|
||||||
|
|
||||||
xA, xW, xM
|
xA, xT, xW, xM
|
||||||
----------
|
--------------
|
||||||
The native frontends for 'xC'. Using them is not recommended.
|
Other frontends for 'xC'. Using them is not recommended.
|
||||||
|
|
||||||
xD
|
xD
|
||||||
--
|
--
|
||||||
|
2
liberty
2
liberty
@ -1 +1 @@
|
|||||||
Subproject commit 492815c8fc38ad6e333b2f1c5094a329e3076155
|
Subproject commit 149938cc445f99b1aa40c490014aad72cf698dec
|
99
xT/CMakeLists.txt
Normal file
99
xT/CMakeLists.txt
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
# As per Qt 6.8 documentation, at least 3.16 is necessary
|
||||||
|
cmake_minimum_required (VERSION 3.21.1)
|
||||||
|
|
||||||
|
file (READ ../xK-version project_version)
|
||||||
|
configure_file (../xK-version xK-version.tag COPYONLY)
|
||||||
|
string (STRIP "${project_version}" project_version)
|
||||||
|
|
||||||
|
# This is an entirely separate CMake project.
|
||||||
|
project (xT VERSION "${project_version}"
|
||||||
|
DESCRIPTION "Qt frontend for xC" LANGUAGES CXX)
|
||||||
|
|
||||||
|
set (CMAKE_CXX_STANDARD 17)
|
||||||
|
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
find_package (Qt6 REQUIRED COMPONENTS Widgets Network Multimedia)
|
||||||
|
qt_standard_project_setup ()
|
||||||
|
|
||||||
|
add_compile_options ("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||||
|
add_compile_options ("$<$<CXX_COMPILER_ID:GNU>:-Wall;-Wextra>")
|
||||||
|
add_compile_options ("$<$<CXX_COMPILER_ID:Clang>:-Wall;-Wextra>")
|
||||||
|
|
||||||
|
set (project_config "${PROJECT_BINARY_DIR}/config.h")
|
||||||
|
configure_file ("${PROJECT_SOURCE_DIR}/config.h.in" "${project_config}")
|
||||||
|
include_directories ("${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
|
||||||
|
|
||||||
|
# Produce a beep sample
|
||||||
|
find_program (sox_EXECUTABLE sox REQUIRED)
|
||||||
|
set (beep "${PROJECT_BINARY_DIR}/beep.wav")
|
||||||
|
add_custom_command (OUTPUT "${beep}"
|
||||||
|
COMMAND ${sox_EXECUTABLE} -b 16 -Dr 44100 -n "${beep}"
|
||||||
|
synth 0.1 0 25 triangle 800 vol 0.5 fade t 0 -0 0.005 pad 0 0.05
|
||||||
|
COMMENT "Generating a beep sample" VERBATIM)
|
||||||
|
set_property (SOURCE "${beep}" APPEND PROPERTY QT_RESOURCE_ALIAS beep.wav)
|
||||||
|
|
||||||
|
# Rasterize SVG icons
|
||||||
|
set (root "${PROJECT_SOURCE_DIR}/..")
|
||||||
|
set (CMAKE_MODULE_PATH "${root}/liberty/cmake")
|
||||||
|
include (IconUtils)
|
||||||
|
|
||||||
|
# It might generally be better to use QtSvg, though it is an extra dependency.
|
||||||
|
# The icon_to_png macro is not intended to be used like this.
|
||||||
|
foreach (icon xT xT-highlighted)
|
||||||
|
icon_to_png (${icon} "${PROJECT_SOURCE_DIR}/${icon}.svg"
|
||||||
|
48 "${PROJECT_BINARY_DIR}/resources" icon_png)
|
||||||
|
set_property (SOURCE "${icon_png}"
|
||||||
|
APPEND PROPERTY QT_RESOURCE_ALIAS "${icon}.png")
|
||||||
|
list (APPEND icon_rsrc_list "${icon_png}")
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
# The largest size is mainly for an appropriately sized Windows icon
|
||||||
|
set (icon_base "${PROJECT_BINARY_DIR}/icons")
|
||||||
|
set (icon_png_list)
|
||||||
|
foreach (icon_size 16 32 48 256)
|
||||||
|
icon_to_png (xT "${PROJECT_SOURCE_DIR}/xT.svg"
|
||||||
|
${icon_size} "${icon_base}" icon_png)
|
||||||
|
list (APPEND icon_png_list "${icon_png}")
|
||||||
|
endforeach ()
|
||||||
|
add_custom_target (icons ALL DEPENDS ${icon_png_list})
|
||||||
|
if (WIN32)
|
||||||
|
list (REMOVE_ITEM icon_png_list "${icon_png}")
|
||||||
|
set (icon_ico "${PROJECT_BINARY_DIR}/xT.ico")
|
||||||
|
icon_for_win32 ("${icon_ico}" "${icon_png_list}" "${icon_png}")
|
||||||
|
|
||||||
|
set (resource_file "${PROJECT_BINARY_DIR}/xT.rc")
|
||||||
|
list (APPEND project_sources "${resource_file}")
|
||||||
|
add_custom_command (OUTPUT "${resource_file}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo "1 ICON \"xT.ico\""
|
||||||
|
> ${resource_file} VERBATIM)
|
||||||
|
set_property (SOURCE "${resource_file}"
|
||||||
|
APPEND PROPERTY OBJECT_DEPENDS ${icon_ico})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Build the main executable and link it
|
||||||
|
find_program (awk_EXECUTABLE awk ${find_program_REQUIRE})
|
||||||
|
add_custom_command (OUTPUT xC-proto.cpp
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env LC_ALL=C ${awk_EXECUTABLE}
|
||||||
|
-f ${root}/liberty/tools/lxdrgen.awk
|
||||||
|
-f ${root}/liberty/tools/lxdrgen-cpp.awk
|
||||||
|
-v PrefixCamel=Relay
|
||||||
|
${root}/xC.lxdr > xC-proto.cpp
|
||||||
|
DEPENDS
|
||||||
|
${root}/liberty/tools/lxdrgen.awk
|
||||||
|
${root}/liberty/tools/lxdrgen-cpp.awk
|
||||||
|
${root}/xC.lxdr
|
||||||
|
COMMENT "Generating xC relay protocol code" VERBATIM)
|
||||||
|
add_custom_target (xC-proto DEPENDS ${PROJECT_BINARY_DIR}/xC-proto.cpp)
|
||||||
|
|
||||||
|
list (APPEND project_sources "${root}/liberty/tools/lxdrgen-cpp-qt.cpp")
|
||||||
|
qt_add_executable (xT xT.cpp ${project_config} ${project_sources})
|
||||||
|
add_dependencies (xT xC-proto)
|
||||||
|
qt_add_resources (xT "rsrc" PREFIX / FILES "${beep}" ${icon_rsrc_list})
|
||||||
|
target_link_libraries (xT PRIVATE Qt6::Widgets Qt6::Network Qt6::Multimedia)
|
||||||
|
set_target_properties (xT PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON)
|
||||||
|
|
||||||
|
# At least with MinGW, this is a fully independent portable executable
|
||||||
|
# TODO(p): Figure this out once it builds.
|
||||||
|
install (TARGETS xT DESTINATION .)
|
||||||
|
set (CPACK_GENERATOR ZIP)
|
||||||
|
include (CPack)
|
7
xT/config.h.in
Normal file
7
xT/config.h.in
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#define PROJECT_NAME "${PROJECT_NAME}"
|
||||||
|
#define PROJECT_VERSION "${project_version}"
|
||||||
|
|
||||||
|
#endif // ! CONFIG_H
|
29
xT/xT-highlighted.svg
Normal file
29
xT/xT-highlighted.svg
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg version="1.1" width="48" height="48" viewBox="0 0 48 48"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<radialGradient id="green-x">
|
||||||
|
<stop stop-color="hsl(66, 100%, 80%)" offset="0" />
|
||||||
|
<stop stop-color="hsl(66, 100%, 50%)" offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
<radialGradient id="orange">
|
||||||
|
<stop stop-color="hsl(36, 100%, 60%)" offset="0" />
|
||||||
|
<stop stop-color="hsl(23, 100%, 60%)" offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
<filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">
|
||||||
|
<feDropShadow dx="0" dy="0" stdDeviation="0.05"
|
||||||
|
flood-color="rgba(0, 0, 0, .5)" />
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- XXX: librsvg screws up shadows on rotated objects. -->
|
||||||
|
<g filter="url(#shadow)" transform="translate(24 3) scale(16)">
|
||||||
|
<path fill="url(#orange)" stroke="hsl(36, 100%, 20%)" stroke-width="0.1"
|
||||||
|
d="M-.8 0 H.8 V.5 H.25 V2.625 H-.25 V.5 H-.8 Z" />
|
||||||
|
</g>
|
||||||
|
<g filter="url(#shadow)" transform="translate(24 28) rotate(-45) scale(16)">
|
||||||
|
<path fill="url(#green-x)" stroke="hsl(66, 100%, 20%)" stroke-width="0.1"
|
||||||
|
d="M-.25 -1 H.25 V-.25 H1 V.25 H.25 V1 H-.25 V.25 H-1 V-.25 H-.25 Z" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
8
xT/xT.desktop
Normal file
8
xT/xT.desktop
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=xT
|
||||||
|
GenericName=IRC Client
|
||||||
|
Icon=xT
|
||||||
|
Exec=xT
|
||||||
|
StartupNotify=false
|
||||||
|
Categories=Network;Chat;IRCClient;
|
29
xT/xT.svg
Normal file
29
xT/xT.svg
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg version="1.1" width="48" height="48" viewBox="0 0 48 48"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<radialGradient id="grey-x">
|
||||||
|
<stop stop-color="hsl(66, 0%, 90%)" offset="0" />
|
||||||
|
<stop stop-color="hsl(66, 0%, 80%)" offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
<radialGradient id="orange">
|
||||||
|
<stop stop-color="hsl(36, 100%, 60%)" offset="0" />
|
||||||
|
<stop stop-color="hsl(23, 100%, 60%)" offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
<filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">
|
||||||
|
<feDropShadow dx="0" dy="0" stdDeviation="0.05"
|
||||||
|
flood-color="rgba(0, 0, 0, .5)" />
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- XXX: librsvg screws up shadows on rotated objects. -->
|
||||||
|
<g filter="url(#shadow)" transform="translate(24 28) rotate(-45) scale(16)">
|
||||||
|
<path fill="url(#grey-x)" stroke="hsl(66, 0%, 30%)" stroke-width="0.1"
|
||||||
|
d="M-.25 -1 H.25 V-.25 H1 V.25 H.25 V1 H-.25 V.25 H-1 V-.25 H-.25 Z" />
|
||||||
|
</g>
|
||||||
|
<g filter="url(#shadow)" transform="translate(24 3) scale(16)">
|
||||||
|
<path fill="url(#orange)" stroke="hsl(36, 100%, 20%)" stroke-width="0.1"
|
||||||
|
d="M-.8 0 H.8 V.5 H.25 V2.625 H-.25 V.5 H-.8 Z" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in New Issue
Block a user