Merge branch 'master' of github.com:martinrotter/rssguard

This commit is contained in:
Martin Rotter 2022-02-01 08:16:52 +01:00
commit 65d59eb70c
15 changed files with 84 additions and 43 deletions

View File

@ -27,7 +27,7 @@
# {FEEDLY,GMAIL,INOREADER}_CLIENT_SECRET - preconfigured OAuth cliend SECRET.
#
# Other information:
# - supports Windows, Linux, macOS, OS/2, Android,
# - supports Windows, Linux, *BSD, macOS, OS/2, Android,
# - Qt 5.9.0 or newer is required,
# - cmake 3.9.0 or newer is required,
# - if you wish to make packages for Windows, then you must initialize all submodules within repository before compilation,
@ -38,13 +38,13 @@
# your OS/2 distro is up-to-date and you have all dependencies installed: os2-base, all gcc-* packages,
# libc and libcx up-to-date, kbuild-make, ash, binutils, all relevant qt5-* packages.
#
# After your dependecies are installed, then you can compile via standard `qmake -> make -> make install` steps
# After your dependecies are installed, then you can compile via standard `cmake -> make -> make install` steps
# and package with: 7z.exe a -t7z -mmt -mx9 "rssguard.7z" "<build-folder\src\rssguard\app\*" command.
#
# Authors and contributors:
# - Martin Rotter (project leader),
# - Elbert Pol (OS/2-related contributions),
# - CyberTailor (cmake-related contributions.
# - Anna Vyalkova (cmake-related contributions).
#
#################################################################
@ -98,7 +98,11 @@ if(${FORCE_COLORED_OUTPUT})
endif()
endif()
# Aux files not used for build but include in project.
add_custom_target(AuxFiles SOURCES "resources/scripts/uncrustify/uncrustify.cfg")
# Global compilation switches.
option(BUILD_WITH_QT6 "Build application with Qt 6" OFF)
option(USE_WEBENGINE "Use QtWebEngine for embedded web browser" ON)
option(UPDATE_TRANSLATIONS "Call lupdate to update translation files from source" OFF)
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GCC/Clang only)" OFF)
@ -114,8 +118,7 @@ set(INOREADER_CLIENT_ID "" CACHE STRING "Inoreader client ID")
set(INOREADER_CLIENT_SECRET "" CACHE STRING "Inoreader client secret")
# Import Qt libraries.
find_package(QT NAMES Qt6 Qt5 REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS
set(QT_COMPONENTS
Core
Gui
LinguistTools
@ -126,26 +129,52 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS
Xml
)
if(QT_VERSION_MAJOR EQUAL 6)
find_package(Qt6 COMPONENTS Core5Compat REQUIRED)
if(NOT OS2)
list(APPEND QT_COMPONENTS Multimedia)
endif()
if(USE_WEBENGINE)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WebEngineWidgets REQUIRED)
list(APPEND QT_COMPONENTS WebEngineWidgets)
add_compile_definitions(USE_WEBENGINE)
endif()
if(NOT OS2)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Multimedia REQUIRED)
macro(qt_add_resources)
qt_add_big_resources(${ARGN})
endmacro()
if(UNIX AND NOT APPLE AND NOT ANDROID)
list(APPEND QT_COMPONENTS DBus)
endif()
if(UNIX AND NOT APPLE AND NOT ANDROID)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED)
if(BUILD_WITH_QT6)
find_package(QT NAMES Qt6)
find_package(Qt6 COMPONENTS ${QT_COMPONENTS} Core5Compat REQUIRED)
else()
find_package(QT NAMES Qt5)
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
if(Qt5Core_VERSION VERSION_LESS 5.15.0)
# Compatibility macros.
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
macro(qt_add_big_resources)
qt5_add_big_resources(${ARGN})
endmacro()
macro(qt_create_translation)
qt5_create_translation(${ARGN})
endmacro()
macro(qt_add_translation)
qt5_add_translation(${ARGN})
endmacro()
endif()
endif()
#if(NOT OS2)
# macro(qt_add_resources)
# qt_add_big_resources(${ARGN})
# endmacro()
#endif()
# Process oauth service secrets.
if(NOT FEEDLY_CLIENT_ID STREQUAL "" AND NOT FEEDLY_CLIENT_SECRET STREQUAL "")
add_compile_definitions(

View File

@ -45,6 +45,7 @@ I highly recommend to download RSS Guard only from reputable sources.
RSS Guard is a cross-platform application, and at this point it is known to work on:
* Windows 7+
* GNU/Linux (including PinePhone and other Linux-based phone operating systems)
* BSD (FreeBSD, OpenBSD, NetBSD, etc.)
* macOS 10.10+
* OS/2 (ArcaOS, eComStation)

View File

@ -197,7 +197,7 @@
#define APP_SKIN_METADATA_FILE "metadata.xml"
#define APP_STYLE_DEFAULT "Fusion"
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#define APP_THEME_DEFAULT ""
#else
#define APP_THEME_DEFAULT "Breeze"
@ -268,6 +268,12 @@
#if defined(Q_OS_LINUX)
#define OS_ID "Linux"
#elif defined(Q_OS_FREEBSD)
#define OS_ID "FreeBSD"
#elif defined(Q_OS_NETBSD)
#define OS_ID "NetBSD"
#elif defined(Q_OS_OPENBSD)
#define OS_ID "OpenBSD"
#elif defined(Q_OS_OS2)
#define OS_ID "OS/2"
#elif defined(Q_OS_OSX)
@ -276,6 +282,8 @@
#define OS_ID "Windows"
#elif defined(Q_OS_ANDROID)
#define OS_ID "Android"
#elif defined(Q_OS_UNIX)
#define OS_ID "Unix"
#else
#define OS_ID ""
#endif
@ -295,7 +303,7 @@
#define APP_INITIAL_FEEDS_PATH QSL(":/initial_feeds")
#define APP_LANG_PATH QSL(":/localization")
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#define APP_DESKTOP_SOURCE_ENTRY_FILE "com.github.rssguard.desktop.autostart"
#define APP_DESKTOP_ENTRY_FILE "com.github.rssguard.desktop"

View File

@ -17,7 +17,7 @@
HelpSpoiler::HelpSpoiler(QWidget* parent) : QWidget(parent),
m_btnToggle(new QToolButton(this)), m_content(new QScrollArea(this)), m_animation(new QParallelAnimationGroup(this)),
m_layout(new QGridLayout(this)), m_text(new QLabel(this)) {
m_layout(new QGridLayout(this)), m_text(new QLabel(this)), m_btnHelp(new PlainToolButton(this)) {
m_btnToggle->setStyleSheet(QSL("QToolButton { border: none; }"));
m_btnToggle->setToolButtonStyle(Qt::ToolButtonStyle::ToolButtonTextBesideIcon);
@ -29,6 +29,7 @@ HelpSpoiler::HelpSpoiler(QWidget* parent) : QWidget(parent),
m_content->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Fixed);
m_content->setMaximumHeight(0);
m_content->setMinimumHeight(0);
m_content->setContentsMargins({ 0, 0, 0, 0 });
m_animation->addAnimation(new QPropertyAnimation(this, QSL("minimumHeight").toLocal8Bit()));
m_animation->addAnimation(new QPropertyAnimation(this, QSL("maximumHeight").toLocal8Bit()));
@ -39,12 +40,9 @@ HelpSpoiler::HelpSpoiler(QWidget* parent) : QWidget(parent),
m_layout->setVerticalSpacing(0);
m_layout->setContentsMargins(0, 0, 0, 0);
PlainToolButton* btn_help = new PlainToolButton(this);
m_btnHelp->setPadding(0);
btn_help->setPadding(0);
btn_help->setIcon(qApp->icons()->fromTheme(QSL("dialog-question")));
m_layout->addWidget(btn_help, 0, 0);
m_layout->addWidget(m_btnHelp, 0, 0);
m_layout->addWidget(m_btnToggle, 0, 1, 1, 1, Qt::AlignmentFlag::AlignLeft);
m_layout->addWidget(m_content, 1, 0, 1, 2);
@ -79,6 +77,7 @@ HelpSpoiler::HelpSpoiler(QWidget* parent) : QWidget(parent),
m_animation->start();
});
m_text->setMargin(0);
m_text->setWordWrap(true);
auto* content_layout = new QVBoxLayout(m_content);
@ -93,5 +92,7 @@ void HelpSpoiler::setHelpText(const QString& title, const QString& text, bool is
void HelpSpoiler::setHelpText(const QString& text, bool is_warning) {
m_text->setText(text);
GuiUtilities::setLabelAsNotice(*m_text, is_warning, false);
m_btnHelp->setIcon(is_warning
? qApp->icons()->fromTheme(QSL("dialog-warning"))
: qApp->icons()->fromTheme(QSL("dialog-question")));
}

View File

@ -10,6 +10,7 @@ class QGridLayout;
class QToolButton;
class QParallelAnimationGroup;
class QScrollArea;
class PlainToolButton;
class HelpSpoiler : public QWidget {
Q_OBJECT
@ -26,6 +27,7 @@ class HelpSpoiler : public QWidget {
QParallelAnimationGroup* m_animation;
QGridLayout* m_layout;
QLabel* m_text;
PlainToolButton* m_btnHelp;
};
#endif // HELPSPOILER_H

View File

@ -82,7 +82,7 @@ void SettingsBrowserMail::selectBrowserExecutable() {
qApp->homeFolder(),
//: File filter for external browser selection dialog.
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
tr("Executables (*)"));
#else
tr("Executables (*.*)"));
@ -126,7 +126,7 @@ void SettingsBrowserMail::selectEmailExecutable() {
qApp->homeFolder(),
//: File filter for external e-mail selection dialog.
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
tr("Executables (*)"));
#else
tr("Executables (*.*)"));

View File

@ -132,7 +132,7 @@ void SettingsGui::loadSettings() {
if (icon_theme_name == QSL(APP_NO_THEME)) {
// Add just "no theme" on other systems.
//: Label for disabling icon theme.
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
m_ui->m_cmbIconTheme->addItem(tr("system icon theme"), APP_NO_THEME);
#else
m_ui->m_cmbIconTheme->addItem(tr("no icon theme"), APP_NO_THEME);

View File

@ -31,7 +31,7 @@
#include <QSslSocket>
#include <QTimer>
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
#include <QDBusConnection>
#include <QDBusMessage>
#endif
@ -91,7 +91,7 @@ Application::Application(const QString& id, int& argc, char** argv)
connect(this, &Application::commitDataRequest, this, &Application::onCommitData);
connect(this, &Application::saveStateRequest, this, &Application::onSaveState);
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QString app_dir = QString::fromLocal8Bit(qgetenv("APPDIR"));
if (!app_dir.isEmpty()) {
@ -623,7 +623,7 @@ void Application::showMessagesNumber(int unread_messages, bool any_feed_has_unre
m_trayIcon->setNumber(unread_messages, any_feed_has_unread_messages);
}
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QDBusMessage signal = QDBusMessage::createSignal(QSL("/"),
QSL("com.canonical.Unity.LauncherEntry"),
QSL("Update"));

View File

@ -92,7 +92,7 @@ void IconFactory::loadCurrentIconTheme() {
if (installed_themes.contains(theme_name_from_settings)) {
// Desired icon theme is installed and can be loaded.
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if (theme_name_from_settings.isEmpty()) {
qDebugNN << LOGSEC_GUI << "Loading default system icon theme.";
}
@ -108,7 +108,7 @@ void IconFactory::loadCurrentIconTheme() {
else {
// Desired icon theme is not currently available.
// Activate "default" or "no" icon theme instead.
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
qWarningNN << "Icon theme"
<< QUOTE_W_SPACE(theme_name_from_settings)
<< "cannot be loaded because it is not installed. Activating \"no\" icon theme.";

View File

@ -491,8 +491,8 @@ SettingsProperties Settings::determineProperties() {
else {
// We will use PORTABLE settings only and only if it is available and NON-PORTABLE
// settings was not initialized before.
#if defined(Q_OS_LINUX) || defined (Q_OS_ANDROID) || defined (Q_OS_MACOSOS)
// DO NOT use portable settings for Linux, it is really not used on that platform.
#if defined(Q_OS_UNIX)
// DO NOT use portable settings for *nix, it is really not used on that platform.
const bool will_we_use_portable_settings = false;
#else
const QString exe_path = qApp->applicationDirPath();

View File

@ -58,8 +58,8 @@ SystemFactory::AutoStartStatus SystemFactory::autoStartStatus() const {
else {
return AutoStartStatus::Disabled;
}
#elif defined(Q_OS_LINUX)
// Use proper freedesktop.org way to auto-start the application on Linux.
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// Use proper freedesktop.org way to auto-start the application.
// INFO: http://standards.freedesktop.org/autostart-spec/latest/
const QString desktop_file_location = autostartDesktopFileLocation();
@ -86,7 +86,7 @@ SystemFactory::AutoStartStatus SystemFactory::autoStartStatus() const {
#endif
}
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QString SystemFactory::autostartDesktopFileLocation() const {
const QString xdg_config_path(qgetenv("XDG_CONFIG_HOME"));
QString desktop_file_location;
@ -136,7 +136,7 @@ bool SystemFactory::setAutoStartStatus(AutoStartStatus new_status) {
default:
return false;
}
#elif defined(Q_OS_LINUX)
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// Note that we expect here that no other program uses
// "rssguard.desktop" desktop file.
const QString destination_file = autostartDesktopFileLocation();

View File

@ -55,7 +55,7 @@ class SystemFactory : public QObject {
// new status failed.
bool setAutoStartStatus(AutoStartStatus new_status);
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// Returns standard location where auto-start .desktop files
// should be placed.
QString autostartDesktopFileLocation() const;

View File

@ -306,7 +306,7 @@ void WebFactory::createMenu(QMenu* menu) {
actions << createEngineSettingsAction(tr("Plugins enabled"), QWebEngineSettings::WebAttribute::PluginsEnabled);
actions << createEngineSettingsAction(tr("Fullscreen enabled"), QWebEngineSettings::WebAttribute::FullScreenSupportEnabled);
#if !defined(Q_OS_LINUX)
#if !defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
actions << createEngineSettingsAction(tr("Screen capture enabled"), QWebEngineSettings::WebAttribute::ScreenCaptureEnabled);
actions << createEngineSettingsAction(tr("WebGL enabled"), QWebEngineSettings::WebAttribute::WebGLEnabled);
actions << createEngineSettingsAction(tr("Accelerate 2D canvas"), QWebEngineSettings::WebAttribute::Accelerated2dCanvasEnabled);

View File

@ -112,7 +112,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>70</height>
<height>50</height>
</size>
</property>
<property name="maximumSize">
@ -138,7 +138,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>70</height>
<height>50</height>
</size>
</property>
<property name="maximumSize">

View File

@ -33,7 +33,7 @@ int main(int argc, char* argv[]) {
QApplication::setAttribute(Qt::ApplicationAttribute::AA_EnableHighDpiScaling);
#endif
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QApplication::setDesktopFileName(APP_DESKTOP_ENTRY_FILE);
#endif