bit better about -> resources

This commit is contained in:
Martin Rotter 2022-04-20 08:20:17 +02:00
parent 08a67adc1c
commit 3e827ab954
4 changed files with 51 additions and 89 deletions

View File

@ -26,7 +26,7 @@
<url type="donation">https://github.com/sponsors/martinrotter</url>
<content_rating type="oars-1.1" />
<releases>
<release version="4.2.1" date="2022-04-07"/>
<release version="4.2.1" date="2022-04-20"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -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.

View File

@ -13,15 +13,17 @@
#include "miscellaneous/textfactory.h"
#include <QFile>
#include <QTextStream>
#include <QJsonArray>
#include <QJsonObject>
#include <QPlainTextEdit>
#include <QTextStream>
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,35 +35,43 @@ 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<int>::of(&QComboBox::currentIndexChanged),
this, &FormAbout::displayLicense);
connect(m_ui.m_cbLicenses, QOverload<int>::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_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() {
"<b>Version:</b> %1 (built on %2/%3)<br>"
"<b>Revision:</b> %4<br>"
"<b>Build date:</b> %5<br>"
"<b>Qt:</b> %6 (compiled against %7)<br>").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__)),
"<b>Qt:</b> %6 (compiled against %7)<br>")
.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),
qVersion(),
QSL(QT_VERSION_STR),
QSL(APP_NAME)));
m_ui.m_txtInfo->setText(tr("<body>%5 is a (very) tiny feed reader."
"<br><br>This software is distributed under the terms of GNU General Public License, version 3."
"<br><br>This software is distributed under the terms of GNU General "
"Public License, version 3."
"<br><br>Contacts:"
"<ul><li><a href=\"mailto://%1\">%1</a> ~e-mail</li>"
"<li><a href=\"%2\">%2</a> ~website</li></ul>"
"You can obtain source code for %5 from its website."
"<br><br><br>Copyright (C) 2011-%3 %4</body>").arg(QSL(APP_EMAIL), QSL(APP_URL),
QString::number(QDateTime::currentDateTime()
.date()
.year()),
QSL(APP_AUTHOR), QSL(APP_NAME)));
"<br><br><br>Copyright (C) 2011-%3 %4</body>")
.arg(QSL(APP_EMAIL),
QSL(APP_URL),
QString::number(QDateTime::currentDateTime().date().year()),
QSL(APP_AUTHOR),
QSL(APP_NAME)));
}

View File

@ -113,9 +113,6 @@
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
@ -216,62 +213,13 @@ p, li { white-space: pre-wrap; }
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Settings type</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="m_txtPathsSettingsType">
<item row="0" column="0" colspan="2">
<widget class="QPlainTextEdit" name="m_tbResources">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Settings file</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_txtPathsSettingsFile">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="m_txtPathsDatabaseRoot">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Database location</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="m_txtPathsSkinsRoot">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>User skins root path</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -289,10 +237,6 @@ p, li { white-space: pre-wrap; }
<tabstop>m_tabAbout</tabstop>
<tabstop>m_txtInfo</tabstop>
<tabstop>m_txtChangelog</tabstop>
<tabstop>m_txtPathsSettingsType</tabstop>
<tabstop>m_txtPathsSettingsFile</tabstop>
<tabstop>m_txtPathsDatabaseRoot</tabstop>
<tabstop>m_txtPathsSkinsRoot</tabstop>
</tabstops>
<resources/>
<connections>