Further improvements for the 'Lite' Flatpak variant (#836)

These changes should only affect the Linux build.

Co-authored-by: guihkx <guihkx@users.noreply.github.com>
This commit is contained in:
Guilherme Silva 2022-12-21 11:02:27 -03:00 committed by GitHub
parent 954b097cf9
commit f64c46c6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 73 additions and 48 deletions

View File

@ -193,16 +193,19 @@ else()
endif()
if(NOT USE_WEBENGINE)
set(APP_REVERSE_NAME "io.github.martinrotter.rssguardlite")
set(APP_REVISION "${APP_REVISION}-nowebengine")
endif()
set(APP_LOW_NAME "${CMAKE_PROJECT_NAME}")
# Pass common defines.
add_compile_definitions(
APP_NAME="${APP_NAME}"
APP_VERSION="${CMAKE_PROJECT_VERSION}"
APP_URL="${APP_URL}"
APP_LONG_NAME="${APP_NAME} ${CMAKE_PROJECT_VERSION}"
APP_LOW_NAME="${CMAKE_PROJECT_NAME}"
APP_LOW_NAME="${APP_LOW_NAME}"
APP_REVERSE_NAME="${APP_REVERSE_NAME}"
QT_USE_QSTRINGBUILDER
@ -240,6 +243,12 @@ elseif(APPLE)
resources/macosx/Info.plist.in
${CMAKE_BINARY_DIR}/Info.plist
)
elseif(UNIX AND NOT ANDROID)
add_subdirectory(resources/desktop)
add_compile_definitions(
APPDATA_NAME="${APPDATA_NAME}"
APPDATA_SUMMARY="${APPDATA_SUMMARY}"
)
endif()
# Generate localizations, build library and application.

View File

@ -0,0 +1,24 @@
set(APPDATA_NAME_REGULAR ${APP_NAME})
set(APPDATA_NAME_LITE "${APP_NAME} Lite")
set(APPDATA_SUMMARY_REGULAR "Simple, yet powerful news feed reader")
set(APPDATA_SUMMARY_LITE "${APPDATA_SUMMARY_REGULAR} (no built-in web browser)")
if(USE_WEBENGINE)
set(APPDATA_NAME "${APPDATA_NAME_REGULAR}")
set(APPDATA_SUMMARY "${APPDATA_SUMMARY_REGULAR}")
else()
set(APPDATA_NAME "${APPDATA_NAME_LITE}")
set(APPDATA_SUMMARY "${APPDATA_SUMMARY_LITE}")
endif()
configure_file(
rssguard.desktop.in
${CMAKE_BINARY_DIR}/${APP_REVERSE_NAME}.desktop
)
configure_file(
rssguard.metainfo.xml.in
${CMAKE_BINARY_DIR}/${APP_REVERSE_NAME}.metainfo.xml
)
set(APPDATA_NAME ${APPDATA_NAME} PARENT_SCOPE)
set(APPDATA_SUMMARY ${APPDATA_SUMMARY} PARENT_SCOPE)

View File

@ -1,9 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=RSS Guard
Exec=%1
Hidden=false
X-GNOME-Autostart-Delay=15
X-LXQt-Need-Tray=true

View File

@ -1,17 +0,0 @@
[Desktop Entry]
Type=Application
Version=1.0
Exec=rssguard
X-GNOME-Autostart-Delay=15
X-LXQt-Need-Tray=true
Name=RSS Guard
GenericName=Feed reader
GenericName[cs]=Velmi jednoduchá čtečka kanálů
GenericName[de]=Feedreader
Comment=Tiny yet feature rich Qt feed reader
Comment[cs]=Velmi jednoduchá čtečka kanálů
Comment[de]=Qt Feedreader mit großem Funktionsumfang bei geringem Ressourcenbedarf
Icon=rssguard
Terminal=false
Categories=Qt;Network;News;
StartupWMClass=rssguard

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=@APPDATA_NAME@
Comment=@APPDATA_SUMMARY@
Icon=@APP_REVERSE_NAME@
Exec=@APP_LOW_NAME@
Categories=Feed;News;Network;Qt;
StartupWMClass=@APP_LOW_NAME@
X-GNOME-SingleWindow=true
X-GNOME-Autostart-Delay=15
X-LXQt-Need-Tray=true

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2017-2022 Martin Rotter <rotter.martinos@gmail.com> -->
<component type="desktop-application">
<id>io.github.martinrotter.rssguard</id>
<id>@APP_REVERSE_NAME@</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<name>RSS Guard</name>
<name>@APPDATA_NAME@</name>
<developer_name>Martin Rotter</developer_name>
<update_contact>rotter.martinos_AT_gmail.com</update_contact>
<summary>Simple (yet powerful) feed reader</summary>
<summary>@APPDATA_SUMMARY@</summary>
<description>
<p>
RSS Guard is a simple (yet powerful) feed reader, written in C++ and Qt.
@APPDATA_NAME@ is a news feed reader, written in C++ and Qt.
</p>
<p>
It supports many feed formats, such as:
@ -31,7 +31,7 @@
<li>Tiny Tiny RSS</li>
</ul>
</description>
<launchable type="desktop-id">io.github.martinrotter.rssguard.desktop</launchable>
<launchable type="desktop-id">@APP_REVERSE_NAME@.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/martinrotter/rssguard/master/resources/docs/images/rssguard-window.png</image>
@ -63,6 +63,6 @@
<release version="4.2.6" date="2022-12-21" />
</releases>
<provides>
<binary>rssguard</binary>
<binary>@APP_LOW_NAME@</binary>
</provides>
</component>

View File

@ -91,8 +91,7 @@
<file>initial_feeds/feeds-en_US.opml</file>
<file>desktop/io.github.martinrotter.rssguard.desktop</file>
<file>desktop/io.github.martinrotter.rssguard.autostart</file>
<file>desktop/rssguard.desktop.in</file>
<file>../localization/rssguard_cs.qm</file>
<file>../localization/rssguard_da.qm</file>

View File

@ -10,7 +10,11 @@ if [[ "$os" == *"ubuntu"* ]]; then
echo "We are building for GNU/Linux on Ubuntu."
is_linux=true
prefix="AppDir/usr"
app_id="io.github.martinrotter.rssguard"
if [[ "$webengine" == "ON" ]]; then
app_id="io.github.martinrotter.rssguard"
else
app_id="io.github.martinrotter.rssguardlite"
fi
else
echo "We are building for macOS."
is_linux=false

View File

@ -4,7 +4,7 @@ changelog_file="resources/text/CHANGELOG"
datestring="$(date +%F)"
versionstring="$(head -n 1 "$changelog_file")"
for appdata_file in resources/desktop/*.metainfo.xml; do
for appdata_file in resources/desktop/*.metainfo.xml.in; do
appdata_file_n="${appdata_file}.n"
# Set version and date.

View File

@ -345,8 +345,7 @@
#define APP_LANG_PATH QSL(":/localization")
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#define APP_DESKTOP_SOURCE_ENTRY_FILE APP_REVERSE_NAME ".autostart"
#define APP_DESKTOP_ENTRY_FILE APP_REVERSE_NAME ".desktop"
#define APP_DESKTOP_ENTRY_FILE "rssguard.desktop.in"
#define APP_DESKTOP_ENTRY_PATH QSL(":/desktop")
#endif

View File

@ -765,7 +765,7 @@ void Application::showMessagesNumber(int unread_messages, bool any_feed_has_new_
bool task_bar_count_enabled = settings()->value(GROUP(GUI), SETTING(GUI::UnreadNumbersOnTaskBar)).toBool();
QDBusMessage signal = QDBusMessage::createSignal(QSL("/"), QSL("com.canonical.Unity.LauncherEntry"), QSL("Update"));
signal << QSL("application://%1").arg(APP_DESKTOP_ENTRY_FILE);
signal << QSL("application://%1.desktop").arg(APP_REVERSE_NAME);
QVariantMap setProperty;

View File

@ -94,7 +94,7 @@ QString SystemFactory::autostartDesktopFileLocation() const {
if (!xdg_config_path.isEmpty()) {
// XDG_CONFIG_HOME variable is specified. Look for .desktop file
// in 'autostart' subdirectory.
desktop_file_location = xdg_config_path + QSL("/autostart/") + APP_DESKTOP_ENTRY_FILE;
desktop_file_location = xdg_config_path + QSL("/autostart/") + APP_REVERSE_NAME + QSL(".desktop");
}
else {
// Desired variable is not set, look for the default 'autostart' subdirectory.
@ -103,7 +103,7 @@ QString SystemFactory::autostartDesktopFileLocation() const {
if (!home_directory.isEmpty()) {
// Home directory exists. Check if target .desktop file exists and
// return according status.
desktop_file_location = home_directory + QSL("/.config/autostart/") + APP_DESKTOP_ENTRY_FILE;
desktop_file_location = home_directory + QSL("/.config/autostart/") + APP_REVERSE_NAME + QSL(".desktop");
}
}
@ -170,7 +170,7 @@ bool SystemFactory::setAutoStartStatus(AutoStartStatus new_status) {
}
const QString source_autostart_desktop_file =
QString(APP_DESKTOP_ENTRY_PATH) + QDir::separator() + APP_DESKTOP_SOURCE_ENTRY_FILE;
QString(APP_DESKTOP_ENTRY_PATH) + QDir::separator() + APP_DESKTOP_ENTRY_FILE;
try {
QString desktop_file_contents = QString::fromUtf8(IOFactory::readFile(source_autostart_desktop_file));
@ -189,13 +189,17 @@ bool SystemFactory::setAutoStartStatus(AutoStartStatus new_status) {
args = FROM_STD_LIST(QStringList, std_args);
#if defined(IS_FLATPAK_BUILD)
const QString flatpak_run = QSL("flatpak run %1").arg(QSL(APP_REVERSE_NAME));
const QString flatpak_run = QSL("flatpak run %1").arg(APP_REVERSE_NAME);
args = args.mid(1);
args.prepend(flatpak_run);
#endif
desktop_file_contents = desktop_file_contents.arg(args.join(QL1C(' ')));
desktop_file_contents.replace("Exec=@APP_LOW_NAME@", QSL("Exec=") + args.join(QL1C(' ')));
desktop_file_contents.replace("@APPDATA_SUMMARY@", APPDATA_SUMMARY);
desktop_file_contents.replace("@APPDATA_NAME@", APPDATA_NAME);
desktop_file_contents.replace("@APP_REVERSE_NAME@", APP_REVERSE_NAME);
desktop_file_contents.replace("@APP_LOW_NAME@", APP_LOW_NAME);
IOFactory::writeFile(destination_file, desktop_file_contents.toUtf8());
}

View File

@ -63,14 +63,15 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
install(TARGETS app
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES ${CMAKE_SOURCE_DIR}/resources/desktop/${APP_REVERSE_NAME}.desktop
install(FILES ${CMAKE_BINARY_DIR}/${APP_REVERSE_NAME}.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications
)
install(FILES ${CMAKE_SOURCE_DIR}/resources/desktop/${APP_REVERSE_NAME}.metainfo.xml
install(FILES ${CMAKE_BINARY_DIR}/${APP_REVERSE_NAME}.metainfo.xml
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo
)
install(FILES ${CMAKE_SOURCE_DIR}/resources/graphics/${CMAKE_PROJECT_NAME}.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps
RENAME ${APP_REVERSE_NAME}.png
)
elseif(APPLE)
install(TARGETS app

View File

@ -32,7 +32,7 @@ int main(int argc, char* argv[]) {
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QApplication::setDesktopFileName(APP_DESKTOP_ENTRY_FILE);
QApplication::setDesktopFileName(APP_REVERSE_NAME + QSL(".desktop"));
#endif
#if defined(QT_STATIC)