Compare commits
3 Commits
451859e976
...
46e9b7b584
Author | SHA1 | Date | |
---|---|---|---|
46e9b7b584 | |||
0eb935ad9f | |||
c75de30765 |
@ -188,10 +188,51 @@ endif (NOT WIN32)
|
||||
|
||||
# The same for the alternative GTK+ UI
|
||||
if (WITH_GUI)
|
||||
add_executable (sdgui WIN32
|
||||
find_program (rsvg_convert_EXECUTABLE rsvg-convert REQUIRED)
|
||||
set (icon_svg ${PROJECT_SOURCE_DIR}/sdgui.svg)
|
||||
set (icon_base ${PROJECT_BINARY_DIR}/icons)
|
||||
set (icon_png_list)
|
||||
|
||||
# The largest size is mainly for an appropriately sized Windows icon
|
||||
foreach (icon_number 16 32 48 256)
|
||||
set (icon_size ${icon_number}x${icon_number})
|
||||
set (icon_png_path ${icon_base}/hicolor/${icon_size}/apps)
|
||||
set (icon_png ${icon_png_path}/sdgui.png)
|
||||
list (APPEND icon_png_list ${icon_png})
|
||||
|
||||
add_custom_command (OUTPUT ${icon_png}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${icon_png_path}
|
||||
COMMAND ${rsvg_convert_EXECUTABLE} --output=${icon_png}
|
||||
--width=${icon_number} --height=${icon_number} ${icon_svg}
|
||||
DEPENDS ${icon_svg}
|
||||
COMMENT "Generating ${icon_size} application icon" VERBATIM)
|
||||
endforeach (icon_number)
|
||||
|
||||
add_custom_target (sdgui-icons ALL DEPENDS ${icon_png_list})
|
||||
|
||||
set (sdgui_sources
|
||||
src/sdgui.c
|
||||
src/stardict-view.c
|
||||
${project_common_sources})
|
||||
|
||||
if (WIN32)
|
||||
find_program (icotool_EXECUTABLE icotool REQUIRED)
|
||||
set (icon_ico ${PROJECT_BINARY_DIR}/sdgui.ico)
|
||||
add_custom_command (OUTPUT ${icon_ico}
|
||||
COMMAND ${icotool_EXECUTABLE} -c -o ${icon_ico} ${icon_png_list}
|
||||
DEPENDS ${icon_png_list}
|
||||
COMMENT "Generating Windows program icon" VERBATIM)
|
||||
|
||||
set (resource_file ${PROJECT_BINARY_DIR}/sdgui.rc)
|
||||
list (APPEND sdgui_sources ${resource_file})
|
||||
add_custom_command (OUTPUT ${resource_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "1 ICON \"sdgui.ico\""
|
||||
> ${resource_file} VERBATIM)
|
||||
set_property (SOURCE ${resource_file}
|
||||
APPEND PROPERTY OBJECT_DEPENDS ${icon_ico})
|
||||
endif ()
|
||||
|
||||
add_executable (sdgui WIN32 ${sdgui_sources})
|
||||
target_include_directories (sdgui PUBLIC ${gtk_INCLUDE_DIRS})
|
||||
target_link_libraries (sdgui ${project_common_libraries} ${gtk_LIBRARIES})
|
||||
endif ()
|
||||
@ -229,6 +270,10 @@ if (NOT WIN32)
|
||||
|
||||
if (WITH_GUI)
|
||||
install (TARGETS sdgui DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install (FILES sdgui.svg
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
|
||||
install (DIRECTORY ${PROJECT_BINARY_DIR}/icons
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR})
|
||||
install (FILES sdgui.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
||||
install (FILES sdgui.xml
|
||||
@ -264,6 +309,7 @@ elseif (WITH_GUI)
|
||||
install (FILES
|
||||
${WIN32_DEPENDS_PATH}/share/icons/hicolor/index.theme
|
||||
DESTINATION share/icons/hicolor)
|
||||
install (DIRECTORY ${icon_base} DESTINATION share)
|
||||
|
||||
install (SCRIPT cmake/Win32Cleanup.cmake)
|
||||
install (CODE "execute_process (COMMAND
|
||||
|
@ -28,10 +28,10 @@ The rest of this README will concern itself with externalities.
|
||||
|
||||
Building and Running
|
||||
--------------------
|
||||
Build dependencies: CMake, pkg-config, asciidoctor +
|
||||
Build dependencies: CMake, pkg-config, asciidoctor, librsvg (for the GUI) +
|
||||
Runtime dependencies: ncursesw, zlib, ICU, termo (included), glib-2.0 >= 2.38,
|
||||
pango, xcb, xcb-xfixes (the latter two optional for the TUI),
|
||||
gtk+-3.0 (for the alternative graphical UI)
|
||||
gtk+-3.0 (for the GUI)
|
||||
|
||||
$ git clone --recursive https://git.janouch.name/p/sdtui.git
|
||||
$ mkdir sdtui/build
|
||||
|
@ -2,6 +2,7 @@
|
||||
Type=Application
|
||||
Name=sdgui
|
||||
GenericName=StarDict GUI
|
||||
Icon=sdgui
|
||||
Exec=sdgui %F
|
||||
StartupNotify=true
|
||||
MimeType=application/x-stardict-ifo;
|
||||
|
51
sdgui.svg
Normal file
51
sdgui.svg
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" width="48" height="48" viewBox="0 0 48 48"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
color-interpolation="linearRGB"
|
||||
color-interpolation-filters="linearRGB">
|
||||
|
||||
<defs>
|
||||
<rect id="text" width="13" height="3" fill="#d0d0d0" />
|
||||
<filter id="shadow" x="-25%" y="-25%" width="150%" height="150%">
|
||||
<feFlood flood-color="#000000" flood-opacity=".5" result="flood" />
|
||||
<feComposite in="SourceGraphic" in2="flood" operator="in" />
|
||||
<feGaussianBlur stdDeviation="1.25" />
|
||||
<feOffset dx="1" dy="1" result="offset" />
|
||||
<feComposite in="SourceGraphic" in2="offset" />
|
||||
</filter>
|
||||
<mask id="hole">
|
||||
<rect x="-25%" y="-25%" width="150%" height="150%" fill="#ffffff" />
|
||||
<circle r="10.5" />
|
||||
</mask>
|
||||
</defs>
|
||||
|
||||
<rect x="5" y="1" width="38" height="46" ry="2"
|
||||
fill="#ffffff" stroke="#606060" stroke-width="1.25" />
|
||||
|
||||
<use xlink:href="#text" x="9" y="5" />
|
||||
<use xlink:href="#text" x="9" y="10" />
|
||||
<use xlink:href="#text" x="9" y="15" />
|
||||
<use xlink:href="#text" x="9" y="20" />
|
||||
<use xlink:href="#text" x="9" y="25" />
|
||||
<use xlink:href="#text" x="9" y="30" />
|
||||
<use xlink:href="#text" x="9" y="35" />
|
||||
<use xlink:href="#text" x="9" y="40" />
|
||||
|
||||
<use xlink:href="#text" x="26" y="5" />
|
||||
<use xlink:href="#text" x="26" y="10" />
|
||||
<use xlink:href="#text" x="26" y="15" />
|
||||
<use xlink:href="#text" x="26" y="20" />
|
||||
<use xlink:href="#text" x="26" y="25" />
|
||||
<use xlink:href="#text" x="26" y="30" />
|
||||
<use xlink:href="#text" x="26" y="35" />
|
||||
<use xlink:href="#text" x="26" y="40" />
|
||||
|
||||
<circle cx="21" cy="19" r="9" fill="#ffffff" fill-opacity=".5"
|
||||
stroke-width="2" stroke="#000000" filter="url(#shadow)" />
|
||||
<g filter="url(#shadow)">
|
||||
<rect x="-1.75" y="0" width="3.5" height="22.5"
|
||||
transform="translate(21 19) rotate(-30)" mask="url(#hole)" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.9 KiB |
@ -27,6 +27,9 @@
|
||||
#include "utils.h"
|
||||
#include "stardict-view.h"
|
||||
|
||||
#undef PROJECT_NAME
|
||||
#define PROJECT_NAME "sdgui"
|
||||
|
||||
static struct
|
||||
{
|
||||
GtkWidget *window; ///< Top-level window
|
||||
@ -385,6 +388,8 @@ main (int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
gtk_window_set_default_icon_name (PROJECT_NAME);
|
||||
|
||||
g.dictionaries =
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) dictionary_destroy);
|
||||
if (filenames)
|
||||
@ -467,6 +472,7 @@ main (int argc, char *argv[])
|
||||
g_signal_connect (g.entry, "changed", G_CALLBACK (on_changed), g.view);
|
||||
|
||||
g.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (g.window), PROJECT_NAME);
|
||||
gtk_window_set_default_size (GTK_WINDOW (g.window), 300, 600);
|
||||
g_signal_connect (g.window, "destroy",
|
||||
G_CALLBACK (on_destroy), NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user