Commit 6d265480 authored by Mladen Milinkovic's avatar Mladen Milinkovic
Browse files

Fixed theme/icons/look outside KDE environment

parent 3c90b06a
......@@ -2,6 +2,9 @@
set -e
_pr="$(readlink -f "$(dirname "$0")/../..")"
cd "$_pr"
appver="$(git describe --always --abbrev=8 | sed 's/-g/./;s/-/./;s/^v//g')"
rm -rf build &>/dev/null || true
mkdir -p build/nsis
......@@ -20,9 +23,6 @@ sudo pacman -Sdd --noconfirm --needed kauth kbookmarks kcodecs kcompletion \
knotifications kross ktextwidgets kwidgetsaddons kwindowsystem kxmlgui \
solid sonnet
# package icons into .qrc
pkg/mingw/icons-find.sh > src/subtitlecomposer.qrc
i686-w64-mingw32-cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DKDE_INSTALL_LIBDIR=lib \
......@@ -32,4 +32,4 @@ i686-w64-mingw32-cmake -B build \
-DKCONFIGCOMPILER_PATH=/usr/lib/cmake/KF5Config/KF5ConfigCompilerTargets.cmake \
-DTARGETSFILE=/usr/lib/cmake/KF5CoreAddons/KF5CoreAddonsToolingTargets.cmake
cmake --build build -j$(nproc)
DESTDIR="$PWD/build/nsis" cmake --build build --target nsis
DESTDIR="$_pr/build/nsis" cmake --build build --target nsis
#!/bin/bash
set -e
_rt="$(cd "$(dirname "$0")/../.." && pwd)"
icons=(`grep -hr QIcon::fromTheme "$_rt/src" \
| sed -n -E -e '/.*QIcon::fromTheme\((QStringLiteral\()?"([^"]+)"\)?\).*/ s|.*QIcon::fromTheme\((QStringLiteral\()?"([^"]+)"\)?\).*|\2| p'`)
icons+=(
subtitlecomposer
waveform
mediaplayer
pocketsphinx
)
icons=(`(for i in "${icons[@]}" ; do echo $i ; done) | sort -u`)
iconfiles=()
for icon in "${icons[@]}"; do
_icon="${icon/-/_}"
file="$_rt/src/icons/sc-actions-$_icon.svg"
[[ ! -f "$file" ]] && file="$(ls "$_rt/src/icons/"*"-actions-$_icon.png" 2>/dev/null | sort -n | head -n 1 || true)"
[[ ! -f "$file" ]] && file="$(ls "$_rt/src/icons/"*"-categories-$_icon.png" 2>/dev/null | sort -n | head -n 1 || true)"
[[ ! -f "$file" ]] && file="$(ls "$_rt/src/icons/"*"-apps-$_icon.png" 2>/dev/null | sort -n | head -n 1 || true)"
[[ ! -f "$file" ]] && file="/usr/share/icons/breeze/actions/22/$icon.svg"
[[ ! -f "$file" ]] && file="/usr/share/icons/breeze/actions/24/$icon.svg"
[[ ! -f "$file" ]] && file="/usr/share/icons/breeze/status/22/$icon.svg"
[[ ! -f "$file" ]] && file="/usr/share/icons/breeze/places/22/$icon.svg"
[[ ! -f "$file" ]] && echo "MISSING: $file" 1>&2 && find /usr/share/icons/ -name "$icon*" -printf "\tCANDIDATE: %p\n" 1>&2 || iconfiles+=("\n<file alias=\"actions/22/$icon.${file##*.}\">$(echo "$file" | sed -Ee "s|$_rt/src/||")</file>")
done
echo '<!DOCTYPE RCC><RCC version="1.0">'
echo '<qresource prefix="/icons/breeze">'
echo -n '<file alias="index.theme">/usr/share/icons/breeze/index.theme</file>'
echo -e "${iconfiles[@]}" | sort
echo '</qresource>'
echo '</RCC>'
......@@ -21,6 +21,9 @@ ecm_setup_version(${PROJECT_VERSION}
add_definitions(-DHAVE_CONFIG_H)
add_definitions(-D_DEFAULT_SOURCE)
if(APPIMAGE)
set(SC_APPIMAGE 1 CACHE INTERNAL EXPORTEDVARIABLE)
endif()
find_package(FFmpeg 57.83.100 REQUIRED)
find_package(OpenAL REQUIRED)
......@@ -90,22 +93,7 @@ set(subtitlecomposer_SRCS
CACHE INTERNAL EXPORTEDVARIABLE
)
if(MINGW)
qt5_add_resources(subtitlecomposer_SRCS subtitlecomposer.qrc)
list(APPEND subtitlecomposer_SRCS subtitlecomposer.rc)
else()
ecm_install_icons(ICONS
icons/16-apps-subtitlecomposer.png icons/32-apps-subtitlecomposer.png icons/128-apps-subtitlecomposer.png icons/256-apps-subtitlecomposer.png
DESTINATION ${ICON_INSTALL_DIR}
THEME hicolor)
ecm_install_icons(ICONS
icons/128-categories-waveform.png icons/16-actions-select_stream.png icons/16-actions-time_from_video.png icons/48-actions-audio_extract.png
icons/48-apps-mediaplayer.png icons/64-apps-pocketsphinx.png icons/sc-actions-anchor.svg icons/sc-actions-current_line_follows_video.svg
icons/sc-actions-playrate_minus.svg icons/sc-actions-playrate_plus.svg icons/sc-actions-set_hide_time.svg icons/sc-actions-set_show_time.svg
DESTINATION ${DATA_INSTALL_DIR}/subtitlecomposer/icons
THEME hicolor)
endif()
add_subdirectory(icons)
kconfig_add_kcfg_files(subtitlecomposer_SRCS GENERATE_MOC scconfig.kcfgc)
......@@ -116,6 +104,8 @@ ki18n_wrap_ui(subtitlecomposer_SRCS
#[[ scripting ]] scripting/scriptsmanager.ui
)
qt5_add_resources(subtitlecomposer_SRCS ${subtitlecomposer_RES})
add_executable(subtitlecomposer WIN32 ${subtitlecomposer_SRCS})
if(ICU_FOUND)
......
......@@ -540,7 +540,7 @@ Application::setupActions()
QAction *speechImportStreamAction = new KSelectAction(actionCollection);
QMenu *speechImportStreamActionMenu = new QMenu(m_mainWindow);
speechImportStreamAction->setMenu(speechImportStreamActionMenu);
speechImportStreamAction->setIcon(QIcon::fromTheme("select-stream"));
speechImportStreamAction->setIcon(QIcon::fromTheme("select_stream"));
speechImportStreamAction->setText(i18n("Recognize Speech"));
speechImportStreamAction->setStatusTip(i18n("Recognize speech in audio stream"));
connect(speechImportStreamActionMenu, &QMenu::triggered, [this](QAction *action){ speechImportAudioStream(action->data().value<int>()); });
......@@ -716,7 +716,7 @@ Application::setupActions()
actionCollection->addAction(ACT_DECREASE_VOLUME, decreaseVolumeAction);
KSelectAction *setActiveAudioStreamAction = new KSelectAction(actionCollection);
setActiveAudioStreamAction->setIcon(QIcon::fromTheme(QStringLiteral("select_stream")));
setActiveAudioStreamAction->setIcon(QIcon::fromTheme(QStringLiteral("languages")));
setActiveAudioStreamAction->setText(i18n("Audio Streams"));
setActiveAudioStreamAction->setStatusTip(i18n("Select active audio stream"));
connect(setActiveAudioStreamAction, QOverload<int>::of(&KSelectAction::triggered), m_player, &VideoPlayer::selectAudioStream);
......@@ -740,7 +740,7 @@ Application::setupActions()
actionCollection->addAction(ACT_DECREASE_SUBTITLE_FONT, decreaseSubtitleFontAction);
KSelectAction *setActiveSubtitleStreamAction = new KSelectAction(actionCollection);
setActiveSubtitleStreamAction->setIcon(QIcon::fromTheme(QStringLiteral("select_stream")));
setActiveSubtitleStreamAction->setIcon(QIcon::fromTheme(QStringLiteral("languages")));
setActiveSubtitleStreamAction->setText(i18n("Displayed Subtitle Text"));
setActiveSubtitleStreamAction->setStatusTip(i18n("Select visible subtitle text"));
connect(setActiveSubtitleStreamAction, QOverload<int>::of(&KSelectAction::triggered), this, &Application::setActiveSubtitleStream);
......@@ -748,6 +748,7 @@ Application::setupActions()
actionManager->addAction(setActiveSubtitleStreamAction, UserAction::SubTrOpened);
QAction *toggleAnchor = new QAction(actionCollection);
toggleAnchor->setIcon(QIcon::fromTheme(QStringLiteral("anchor")));
toggleAnchor->setText(i18n("Toggle Anchor"));
toggleAnchor->setStatusTip(i18n("(Un)Anchor current line's show time to timeline (Editing anchored line's show time will stretch/compact the timeline between adjacent anchors)"));
actionCollection->setDefaultShortcut(toggleAnchor, QKeySequence("Alt+A"));
......
......@@ -5,6 +5,12 @@
#define SC_INSTALL_BIN "@CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@"
#define SC_INSTALL_PLUGIN "@SC_PLUGIN_INSTALL_DIR@"
// Building AppImage distro
#cmakedefine SC_APPIMAGE
// Whether system icon theme is bundled
#cmakedefine SC_BUNDLE_SYSTEM_THEME
// Whether ICU was found
#cmakedefine HAVE_ICU
......
list(APPEND subtitlecomposer_RES ${CMAKE_CURRENT_SOURCE_DIR}/icon-bundle.qrc)
if(MINGW)
list(APPEND subtitlecomposer_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/subtitlecomposer.rc)
set(BUNDLE_THEME_ICONS 1)
elseif(APPIMAGE)
ecm_install_icons(ICONS
256-apps-subtitlecomposer.png
DESTINATION ${ICON_INSTALL_DIR}
THEME hicolor)
set(BUNDLE_THEME_ICONS 1)
else()
ecm_install_icons(ICONS
16-apps-subtitlecomposer.png 32-apps-subtitlecomposer.png 128-apps-subtitlecomposer.png 256-apps-subtitlecomposer.png
DESTINATION ${ICON_INSTALL_DIR}
THEME hicolor)
endif()
if(BUNDLE_THEME_ICONS)
if(BUNDLE_THEME_ICONS EQUAL 1)
if(CMAKE_CROSSCOMPILING)
set(BUNDLE_THEME_ICONS "/usr/share/icons/breeze") # how do you get host's install_prefix when cross compiling?
else()
set(BUNDLE_THEME_ICONS "${CMAKE_INSTALL_PREFIX}/${ICON_INSTALL_DIR}/breeze")
endif()
endif()
message(STATUS "Bundling system icon theme...'")
execute_process(COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/theme-icons-bundle.sh" "${BUNDLE_THEME_ICONS}"
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/theme-icons-bundle.qrc)
list(APPEND subtitlecomposer_RES ${CMAKE_CURRENT_BINARY_DIR}/theme-icons-bundle.qrc)
set(SC_BUNDLE_SYSTEM_THEME 1 CACHE INTERNAL EXPORTEDVARIABLE)
endif()
# export vars
set(subtitlecomposer_SRCS "${subtitlecomposer_SRCS}" PARENT_SCOPE)
set(subtitlecomposer_RES "${subtitlecomposer_RES}" PARENT_SCOPE)
[Icon Theme]
Name=Breeze
Directories=actions/22,apps/16,apps/32,apps/48,apps/128,apps/256
[actions/22]
Size=22
Context=Actions
Type=Fixed
[apps/16]
Size=16
Context=Applications
Type=Fixed
[apps/32]
Size=32
Context=Applications
Type=Fixed
[apps/48]
Size=48
Context=Applications
Type=Fixed
[apps/128]
Size=128
Context=Applications
Type=Fixed
[apps/256]
Size=256
Context=Applications
Type=Fixed
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/icons-fallback/breeze">
<file alias="index.theme">breeze.theme</file>
</qresource>
<qresource prefix="/icons-fallback/breeze/apps">
<file alias="16/subtitlecomposer.png">16-apps-subtitlecomposer.png</file>
<file alias="32/subtitlecomposer.png">32-apps-subtitlecomposer.png</file>
<file alias="48/subtitlecomposer.png">48-apps-subtitlecomposer.png</file>
<file alias="128/subtitlecomposer.png">128-apps-subtitlecomposer.png</file>
<file alias="256/subtitlecomposer.png">256-apps-subtitlecomposer.png</file>
<file alias="48/pocketsphinx.png">apps/pocketsphinx.png</file>
<file alias="32/mediaplayer.png">apps/mediaplayer.png</file>
</qresource>
<qresource prefix="/icons-fallback/breeze/actions/22">
<file alias="anchor.svg">actions/anchor.svg</file>
<file alias="audio_extract.png">actions/audio-extract.png</file>
<file alias="current_line_follows_video.svg">actions/curline-follows-video.svg</file>
<file alias="playrate_minus.svg">actions/playrate-minus.svg</file>
<file alias="playrate_plus.svg">actions/playrate-plus.svg</file>
<file alias="select_stream.png">actions/select-stream.png</file>
<file alias="set_hide_time.svg">actions/set-hide-time.svg</file>
<file alias="set_show_time.svg">actions/set-show-time.svg</file>
<file alias="time_from_video.png">actions/time-from-video.png</file>
<file alias="waveform.png">actions/waveform.png</file>
</qresource>
</RCC>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment