diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b08919a..23899cf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -95,6 +95,14 @@ ecm_target_qml_sources(qtpotato SOURCES qml/VolumeSlider.qml ) +# Bundled copy of the app icon, used when the installed one is not in the icon theme +# (e.g. running from the build directory). +qt_add_resources(qtpotato "icons" + PREFIX "/" + BASE icons + FILES icons/dev.trivk.qtpotato.svg +) + target_include_directories(qtpotato PRIVATE models mpris mpv playlist translate) target_compile_definitions(qtpotato PRIVATE QTPOTATO_VERSION_STRING="${PROJECT_VERSION}") @@ -121,3 +129,5 @@ target_link_libraries(qtpotato PRIVATE ) install(TARGETS qtpotato ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) +install(FILES dev.trivk.qtpotato.desktop DESTINATION ${KDE_INSTALL_APPDIR}) +install(FILES icons/dev.trivk.qtpotato.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps) diff --git a/src/dev.trivk.qtpotato.desktop b/src/dev.trivk.qtpotato.desktop new file mode 100644 index 0000000..bd0213d --- /dev/null +++ b/src/dev.trivk.qtpotato.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Name=QtPotato +GenericName=Video Player +Comment=Video player with subtitle translation +Exec=qtpotato %U +Icon=dev.trivk.qtpotato +Terminal=false +Categories=Qt;KDE;AudioVideo;Video;Player; +MimeType=video/mp4;video/x-matroska;video/webm;video/x-msvideo;video/quicktime;video/mpeg;video/ogg;video/x-flv;video/x-ms-wmv; +Keywords=video;movie;player;subtitle;translate;mpv; diff --git a/src/icons/dev.trivk.qtpotato.svg b/src/icons/dev.trivk.qtpotato.svg new file mode 100644 index 0000000..58e98b1 --- /dev/null +++ b/src/icons/dev.trivk.qtpotato.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.cpp b/src/main.cpp index dd9349c..0d6d604 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,8 +27,11 @@ int main(int argc, char *argv[]) // libmpv parses numbers with the C locale; Qt sets the locale from the environment. std::setlocale(LC_NUMERIC, "C"); - // Use the Plasma style unless the user picked another one explicitly. - if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) { + // On Plasma the platform theme has already picked the QtQuick style that matches the + // widget style (org.kde.union, org.kde.breeze, ...). Forcing org.kde.desktop over it + // renders controls as scaled QStyle pixmaps: blurry at fractional scales and without + // proper padding or hover/focus states. Only fall back to it when nothing was chosen. + if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE") && QQuickStyle::name().isEmpty()) { QQuickStyle::setStyle(u"org.kde.desktop"_s); } @@ -42,12 +45,13 @@ int main(int argc, char *argv[]) i18n("© 2026 Tri Vo Khac")); aboutData.addAuthor(i18n("Tri Vo Khac"), i18nc("@info:credit", "Author"), QString(), u"https://github.com/vokhactri"_s); aboutData.setDesktopFileName(u"dev.trivk.qtpotato"_s); - aboutData.setProgramLogo(u"multimedia-video-player"_s); + const QIcon appIcon = QIcon::fromTheme(u"dev.trivk.qtpotato"_s, QIcon(u":/dev.trivk.qtpotato.svg"_s)); + aboutData.setProgramLogo(appIcon); aboutData.setHomepage(u"https://github.com/vokhactri/QtPotato"_s); aboutData.setBugAddress("https://github.com/vokhactri/QtPotato/issues"); aboutData.setOrganizationDomain("trivk.dev"); KAboutData::setApplicationData(aboutData); - QApplication::setWindowIcon(QIcon::fromTheme(u"multimedia-video-player"_s)); + QApplication::setWindowIcon(appIcon); KCrash::initialize(); diff --git a/src/qml/MpvVideo.qml b/src/qml/MpvVideo.qml index 19a10c1..d7992e8 100644 --- a/src/qml/MpvVideo.qml +++ b/src/qml/MpvVideo.qml @@ -67,7 +67,6 @@ MpvItem { icon.name: "video-symbolic" text: KI18n.i18nc("@info:placeholder", "No video open") explanation: KI18n.i18nc("@info:placeholder", "Open a file or drop one here") - helpfulAction: root.actions.openFile } Timer {