From 3e827ab95407daa1fe336154e99ddd8d0ab54141 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Wed, 20 Apr 2022 08:20:17 +0200 Subject: [PATCH] bit better about -> resources --- .../desktop/com.github.rssguard.appdata.xml | 2 +- resources/docs/Documentation.md | 4 +- src/librssguard/gui/dialogs/formabout.cpp | 74 +++++++++++-------- src/librssguard/gui/dialogs/formabout.ui | 60 +-------------- 4 files changed, 51 insertions(+), 89 deletions(-) diff --git a/resources/desktop/com.github.rssguard.appdata.xml b/resources/desktop/com.github.rssguard.appdata.xml index 9edaf09d6..1efe3be33 100644 --- a/resources/desktop/com.github.rssguard.appdata.xml +++ b/resources/desktop/com.github.rssguard.appdata.xml @@ -26,7 +26,7 @@ https://github.com/sponsors/martinrotter - + none diff --git a/resources/docs/Documentation.md b/resources/docs/Documentation.md index 7ffdfb70b..3278e6708 100644 --- a/resources/docs/Documentation.md +++ b/resources/docs/Documentation.md @@ -359,13 +359,15 @@ Executable file must be always be specified, while arguments not. Be very carefu Note that the above examples are cross-platform and you can use the exact same command on Windows, Linux or macOS, if your operating system is properly configured. +This feature is very flexible and can be used to scrape data with [CSS selectors](https://www.w3schools.com/cssref/css_selectors.asp). There is ready-made [Python script](https://github.com/Owyn/CSS2RSS) which can be used to scrape websites with CSS selectors very easily. Make sure to give its author the credit he deserves. + RSS Guard offers [placeholder](#userd-plac) `%data%` which is automatically replaced with full path to RSS Guard's [user data folder](#userd), allowing you to make your configuration fully portable. You can, therefore, use something like this as source script line: `bash#%data%/scripts/download-feed.sh`. Also, working directory of process executing the script is set to point to RSS Guard's user data folder. There are some examples of website scrapers [here](https://github.com/martinrotter/rssguard/tree/master/resources/scripts/scrapers), most of them are written in Python 3, thus their execution line is similar to `python script.py`. Make sure to examine each script for more information on how to use it. -After your source feed data are downloaded either via URL or custom script, you can optionally post-process the data with one more custom script, which will take **raw source data as input** and must produce processed valid feed data to **standard output** while printing all error messages to **error output**. +After your source feed data are downloaded either via URL or custom script, you can optionally post-process the data with one more custom script, which will take **raw source data as input** and must produce valid feed data to **standard output** while printing all error messages to **error output**. Format of post-process script execution line is the same as above. diff --git a/src/librssguard/gui/dialogs/formabout.cpp b/src/librssguard/gui/dialogs/formabout.cpp index cf7304739..6f0be87a4 100644 --- a/src/librssguard/gui/dialogs/formabout.cpp +++ b/src/librssguard/gui/dialogs/formabout.cpp @@ -13,15 +13,17 @@ #include "miscellaneous/textfactory.h" #include -#include #include #include #include +#include FormAbout::FormAbout(QWidget* parent) : QDialog(parent) { m_ui.setupUi(this); m_ui.m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH)); - GuiUtilities::applyDialogProperties(*this, qApp->icons()->fromTheme(QSL("help-about")), tr("About %1").arg(QSL(APP_NAME))); + GuiUtilities::applyDialogProperties(*this, + qApp->icons()->fromTheme(QSL("help-about")), + tr("About %1").arg(QSL(APP_NAME))); loadLicenseAndInformation(); loadSettingsAndPaths(); } @@ -33,34 +35,42 @@ void FormAbout::displayLicense() { } void FormAbout::loadSettingsAndPaths() { + QString settings_type; + if (qApp->settings()->type() == SettingsProperties::SettingsType::Portable) { - m_ui.m_txtPathsSettingsType->setText(tr("FULLY portable")); + settings_type = tr("FULLY portable"); } else if (qApp->settings()->type() == SettingsProperties::SettingsType::Custom) { - m_ui.m_txtPathsSettingsType->setText(tr("CUSTOM")); + settings_type = tr("CUSTOM"); } else { - m_ui.m_txtPathsSettingsType->setText(tr("NOT portable")); + settings_type = tr("NOT portable"); } - m_ui.m_txtPathsDatabaseRoot->setText(qApp->database()->driver()->location()); - m_ui.m_txtPathsSettingsFile->setText(QDir::toNativeSeparators(qApp->settings()->fileName())); - m_ui.m_txtPathsSkinsRoot->setText(QDir::toNativeSeparators(qApp->skins()->customSkinBaseFolder())); + const QString user_data_path = QDir::toNativeSeparators(qApp->userDataFolder()); + + m_ui.m_tbResources->setPlainText(QSL("User data folder (\"%5\") -> \"%1\"\n\n" + "Settings file (%3) -> \"%2\"\n\n" + "Skins base folder -> \"%4\"") + .arg(user_data_path, + QDir::toNativeSeparators(qApp->settings()->fileName()) + .replace(user_data_path, QSL(USER_DATA_PLACEHOLDER)), + settings_type, + QDir::toNativeSeparators(qApp->skins()->customSkinBaseFolder()) + .replace(user_data_path, QSL(USER_DATA_PLACEHOLDER)), + QSL(USER_DATA_PLACEHOLDER))); } void FormAbout::loadLicenseAndInformation() { - connect(m_ui.m_cbLicenses, QOverload::of(&QComboBox::currentIndexChanged), - this, &FormAbout::displayLicense); + connect(m_ui.m_cbLicenses, QOverload::of(&QComboBox::currentIndexChanged), this, &FormAbout::displayLicense); QJsonDocument licenses_index = QJsonDocument::fromJson(IOFactory::readFile(APP_INFO_PATH + QSL("/licenses.json"))); for (const QJsonValue& license : licenses_index.array()) { const QJsonObject license_obj = license.toObject(); - const QString license_text = QString::fromUtf8(IOFactory::readFile(APP_INFO_PATH + - QSL("/") + - license_obj["file"].toString())); - const QString license_title = license_obj["title"].toString() + QSL(": ") + license_obj["components"].toString(); - + const QString license_text = + QString::fromUtf8(IOFactory::readFile(APP_INFO_PATH + QSL("/") + license_obj["file"].toString())); + const QString license_title = license_obj["title"].toString() + QSL(": ") + license_obj["components"].toString(); m_ui.m_cbLicenses->addItem(license_title, license_text); } @@ -81,23 +91,29 @@ void FormAbout::loadLicenseAndInformation() { "Version: %1 (built on %2/%3)
" "Revision: %4
" "Build date: %5
" - "Qt: %6 (compiled against %7)
").arg( - qApp->applicationVersion(), QSL(APP_SYSTEM_NAME), - QSL(APP_SYSTEM_VERSION), QSL(APP_REVISION), - qApp->localization()->loadedLocale().toString(TextFactory::parseDateTime(QSL("%1 %2").arg(__DATE__, - __TIME__)), - QLocale::FormatType::ShortFormat), - qVersion(), QSL(QT_VERSION_STR), - QSL(APP_NAME))); + "Qt: %6 (compiled against %7)
") + .arg(qApp->applicationVersion(), + QSL(APP_SYSTEM_NAME), + QSL(APP_SYSTEM_VERSION), + QSL(APP_REVISION), + qApp->localization() + ->loadedLocale() + .toString(TextFactory::parseDateTime(QSL("%1 %2").arg(__DATE__, __TIME__)), + QLocale::FormatType::ShortFormat), + qVersion(), + QSL(QT_VERSION_STR), + QSL(APP_NAME))); m_ui.m_txtInfo->setText(tr("%5 is a (very) tiny feed reader." - "

This software is distributed under the terms of GNU General Public License, version 3." + "

This software is distributed under the terms of GNU General " + "Public License, version 3." "

Contacts:" "
  • %1 ~e-mail
  • " "
  • %2 ~website
" "You can obtain source code for %5 from its website." - "


Copyright (C) 2011-%3 %4").arg(QSL(APP_EMAIL), QSL(APP_URL), - QString::number(QDateTime::currentDateTime() - .date() - .year()), - QSL(APP_AUTHOR), QSL(APP_NAME))); + "


Copyright (C) 2011-%3 %4") + .arg(QSL(APP_EMAIL), + QSL(APP_URL), + QString::number(QDateTime::currentDateTime().date().year()), + QSL(APP_AUTHOR), + QSL(APP_NAME))); } diff --git a/src/librssguard/gui/dialogs/formabout.ui b/src/librssguard/gui/dialogs/formabout.ui index 4c0831f1c..7e0ef702a 100644 --- a/src/librssguard/gui/dialogs/formabout.ui +++ b/src/librssguard/gui/dialogs/formabout.ui @@ -113,9 +113,6 @@ - - QFrame::NoFrame - false @@ -216,62 +213,13 @@ p, li { white-space: pre-wrap; } QFormLayout::ExpandingFieldsGrow - - - - Settings type - - - - - + + true - - - - Settings file - - - - - - - true - - - - - - - true - - - - - - - Database location - - - - - - - true - - - - - - - User skins root path - - - @@ -289,10 +237,6 @@ p, li { white-space: pre-wrap; } m_tabAbout m_txtInfo m_txtChangelog - m_txtPathsSettingsType - m_txtPathsSettingsFile - m_txtPathsDatabaseRoot - m_txtPathsSkinsRoot