more space for script lines in feed edit dialog

This commit is contained in:
Martin Rotter 2021-02-04 09:15:41 +01:00
parent a9efaac825
commit 65ec98daff
9 changed files with 146 additions and 66 deletions

View File

@ -30,7 +30,7 @@
<url type="donation">https://martinrotter.github.io/donate/</url> <url type="donation">https://martinrotter.github.io/donate/</url>
<content_rating type="oars-1.1" /> <content_rating type="oars-1.1" />
<releases> <releases>
<release version="3.8.4" date="2021-02-03"/> <release version="3.8.4" date="2021-02-04"/>
</releases> </releases>
<content_rating type="oars-1.0"> <content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute> <content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -3,6 +3,7 @@
* [Downloads](Downloads.md) * [Downloads](Downloads.md)
* [Philosophy](#philosophy) * [Philosophy](#philosophy)
* [Versioning](#versioning) * [Versioning](#versioning)
* [How to contribute](#how-to-contribute)
* [Reporting bugs](#reporting-bugs) * [Reporting bugs](#reporting-bugs)
* [Localizations](#localizations) * [Localizations](#localizations)
* [Web-based and lite app variants](#web-based-and-lite-app-variants) * [Web-based and lite app variants](#web-based-and-lite-app-variants)
@ -34,7 +35,7 @@ I am glad to accept any kind of donations, see ♥ **Sponsor** button on the top
Note that some more elaborate parts of this documentation are placed in separate files for practical purposes. Note that some more elaborate parts of this documentation are placed in separate files for practical purposes.
## Philosophy ## Philosophy
RSS Guard tends to be independent software. It's free, it's open-source. RSS Guard accepts donations but only as a way of saying "thank you for RSS Guard". RSS Guard tends to be independent software. It's free, it's open-source.
## Versioning ## Versioning
RSS Guard uses [semantic versioning](https://semver.org/). The versioning scheme is `X.Y.Z`, where: RSS Guard uses [semantic versioning](https://semver.org/). The versioning scheme is `X.Y.Z`, where:
@ -43,6 +44,16 @@ RSS Guard uses [semantic versioning](https://semver.org/). The versioning scheme
* `Y` indicates that there is new major feature available. * `Y` indicates that there is new major feature available.
* `Z` indicates that there are newly fixed bugs or small features introduced. * `Z` indicates that there are newly fixed bugs or small features introduced.
## How to contribute
RSS Guard is open source application with free GNU GPLv3 license. Everyone willing to contribute is welcomed. You can contribute in many ways by:
* fixing bugs and requesting PRs (pull requests),
* [localizing](#localizations) to other languages,
* supporting author with [donations](https://github.com/sponsors/martinrotter),
* spreading the word,
* reporting discovered [bugs](#reporting-bugs).
If you decide to contribute code, then please try to follow the style and formatting of existing source code. Also, I use [uncrustify](https://github.com/martinrotter/rssguard/blob/master/resources/scripts/uncrustify/uncrustify.cfg) to format source code.
## Reporting bugs ## Reporting bugs
Please report all issues/bugs/ideas to [Issues](https://github.com/martinrotter/rssguard/issues) section. Describe your problem as precisely as possible, along with steps taken leading up to the issue occurring. Please report all issues/bugs/ideas to [Issues](https://github.com/martinrotter/rssguard/issues) section. Describe your problem as precisely as possible, along with steps taken leading up to the issue occurring.

@ -1 +1 @@
Subproject commit 9c10723bfbaf6cb85107d6ee16e0324e9e487749 Subproject commit 47f4125753452eff8800dbd6600c5a05540b15d9

View File

@ -21,3 +21,18 @@ LineEditWithStatus::LineEditWithStatus(QWidget* parent)
m_layout->addWidget(m_wdgInput); m_layout->addWidget(m_wdgInput);
m_layout->addWidget(m_btnStatus); m_layout->addWidget(m_btnStatus);
} }
TextEditWithStatus::TextEditWithStatus(QWidget* parent)
: WidgetWithStatus(parent) {
m_wdgInput = new QPlainTextEdit(this);
setFocusProxy(m_wdgInput);
// Set correct size for the tool button.
const int txt_input_height = QLineEdit().sizeHint().height();
m_btnStatus->setFixedSize(txt_input_height, txt_input_height);
// Compose the layout.
m_layout->addWidget(m_wdgInput);
m_layout->addWidget(m_btnStatus);
}

View File

@ -7,6 +7,8 @@
#include "gui/baselineedit.h" #include "gui/baselineedit.h"
#include <QPlainTextEdit>
class LineEditWithStatus : public WidgetWithStatus { class LineEditWithStatus : public WidgetWithStatus {
Q_OBJECT Q_OBJECT
@ -21,4 +23,18 @@ inline BaseLineEdit* LineEditWithStatus::lineEdit() const {
return static_cast<BaseLineEdit*>(m_wdgInput); return static_cast<BaseLineEdit*>(m_wdgInput);
} }
class TextEditWithStatus : public WidgetWithStatus {
Q_OBJECT
public:
explicit TextEditWithStatus(QWidget* parent = nullptr);
// Access to line edit.
QPlainTextEdit* textEdit() const;
};
inline QPlainTextEdit* TextEditWithStatus::textEdit() const {
return static_cast<QPlainTextEdit*>(m_wdgInput);
}
#endif // LINEEDITWITHSTATUS_H #endif // LINEEDITWITHSTATUS_H

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>500</width> <width>500</width>
<height>450</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">

View File

@ -48,16 +48,16 @@ int FormStandardFeedDetails::addEditFeed(StandardFeed* input_feed, RootItem* par
void FormStandardFeedDetails::guessFeed() { void FormStandardFeedDetails::guessFeed() {
m_standardFeedDetails->guessFeed(m_standardFeedDetails->sourceType(), m_standardFeedDetails->guessFeed(m_standardFeedDetails->sourceType(),
m_standardFeedDetails->m_ui.m_txtSource->lineEdit()->text(), m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText(),
m_standardFeedDetails->m_ui.m_txtPostProcessScript->lineEdit()->text(), m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText(),
m_authDetails->m_txtUsername->lineEdit()->text(), m_authDetails->m_txtUsername->lineEdit()->text(),
m_authDetails->m_txtPassword->lineEdit()->text()); m_authDetails->m_txtPassword->lineEdit()->text());
} }
void FormStandardFeedDetails::guessIconOnly() { void FormStandardFeedDetails::guessIconOnly() {
m_standardFeedDetails->guessIconOnly(m_standardFeedDetails->sourceType(), m_standardFeedDetails->guessIconOnly(m_standardFeedDetails->sourceType(),
m_standardFeedDetails->m_ui.m_txtSource->lineEdit()->text(), m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText(),
m_standardFeedDetails->m_ui.m_txtPostProcessScript->lineEdit()->text(), m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText(),
m_authDetails->m_txtUsername->lineEdit()->text(), m_authDetails->m_txtUsername->lineEdit()->text(),
m_authDetails->m_txtPassword->lineEdit()->text()); m_authDetails->m_txtPassword->lineEdit()->text());
} }
@ -79,8 +79,8 @@ void FormStandardFeedDetails::apply() {
new_feed->setEncoding(m_standardFeedDetails->m_ui.m_cmbEncoding->currentText()); new_feed->setEncoding(m_standardFeedDetails->m_ui.m_cmbEncoding->currentText());
new_feed->setType(type); new_feed->setType(type);
new_feed->setSourceType(m_standardFeedDetails->sourceType()); new_feed->setSourceType(m_standardFeedDetails->sourceType());
new_feed->setPostProcessScript(m_standardFeedDetails->m_ui.m_txtPostProcessScript->lineEdit()->text()); new_feed->setPostProcessScript(m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText());
new_feed->setUrl(m_standardFeedDetails->m_ui.m_txtSource->lineEdit()->text()); new_feed->setUrl(m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText());
new_feed->setPasswordProtected(m_authDetails->m_gbAuthentication->isChecked()); new_feed->setPasswordProtected(m_authDetails->m_gbAuthentication->isChecked());
new_feed->setUsername(m_authDetails->m_txtUsername->lineEdit()->text()); new_feed->setUsername(m_authDetails->m_txtUsername->lineEdit()->text());
new_feed->setPassword(m_authDetails->m_txtPassword->lineEdit()->text()); new_feed->setPassword(m_authDetails->m_txtPassword->lineEdit()->text());

View File

@ -21,10 +21,10 @@ StandardFeedDetails::StandardFeedDetails(QWidget* parent) : QWidget(parent) {
m_ui.m_txtTitle->lineEdit()->setToolTip(tr("Set title for your feed.")); m_ui.m_txtTitle->lineEdit()->setToolTip(tr("Set title for your feed."));
m_ui.m_txtDescription->lineEdit()->setPlaceholderText(tr("Feed description")); m_ui.m_txtDescription->lineEdit()->setPlaceholderText(tr("Feed description"));
m_ui.m_txtDescription->lineEdit()->setToolTip(tr("Set description for your feed.")); m_ui.m_txtDescription->lineEdit()->setToolTip(tr("Set description for your feed."));
m_ui.m_txtSource->lineEdit()->setPlaceholderText(tr("Full feed source identifier")); m_ui.m_txtSource->textEdit()->setPlaceholderText(tr("Full feed source identifier"));
m_ui.m_txtSource->lineEdit()->setToolTip(tr("Full feed source identifier which can be URL.")); m_ui.m_txtSource->textEdit()->setToolTip(tr("Full feed source identifier which can be URL."));
m_ui.m_txtPostProcessScript->lineEdit()->setPlaceholderText(tr("Full command to execute")); m_ui.m_txtPostProcessScript->textEdit()->setPlaceholderText(tr("Full command to execute"));
m_ui.m_txtPostProcessScript->lineEdit()->setToolTip(tr("You can enter full command including interpreter here.")); m_ui.m_txtPostProcessScript->textEdit()->setToolTip(tr("You can enter full command including interpreter here."));
// Add source types. // Add source types.
m_ui.m_cmbSourceType->addItem(StandardFeed::sourceTypeToString(StandardFeed::SourceType::Url), m_ui.m_cmbSourceType->addItem(StandardFeed::sourceTypeToString(StandardFeed::SourceType::Url),
@ -71,7 +71,7 @@ StandardFeedDetails::StandardFeedDetails(QWidget* parent) : QWidget(parent) {
m_iconMenu->addAction(m_actionLoadIconFromFile); m_iconMenu->addAction(m_actionLoadIconFromFile);
m_iconMenu->addAction(m_actionUseDefaultIcon); m_iconMenu->addAction(m_actionUseDefaultIcon);
m_ui.m_btnIcon->setMenu(m_iconMenu); m_ui.m_btnIcon->setMenu(m_iconMenu);
m_ui.m_txtSource->lineEdit()->setFocus(Qt::TabFocusReason); m_ui.m_txtSource->textEdit()->setFocus(Qt::FocusReason::TabFocusReason);
// Set feed metadata fetch label. // Set feed metadata fetch label.
m_ui.m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Information, m_ui.m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Information,
@ -82,10 +82,14 @@ StandardFeedDetails::StandardFeedDetails(QWidget* parent) : QWidget(parent) {
connect(m_ui.m_txtDescription->lineEdit(), &BaseLineEdit::textChanged, this, &StandardFeedDetails::onDescriptionChanged); connect(m_ui.m_txtDescription->lineEdit(), &BaseLineEdit::textChanged, this, &StandardFeedDetails::onDescriptionChanged);
connect(m_ui.m_cmbSourceType, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(m_ui.m_cmbSourceType, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [this]() { this, [this]() {
onUrlChanged(m_ui.m_txtSource->lineEdit()->text()); onUrlChanged(m_ui.m_txtSource->textEdit()->toPlainText());
});
connect(m_ui.m_txtSource->textEdit(), &QPlainTextEdit::textChanged, this, [this]() {
onUrlChanged(m_ui.m_txtSource->textEdit()->toPlainText());
});
connect(m_ui.m_txtPostProcessScript->textEdit(), &QPlainTextEdit::textChanged, this, [this]() {
onPostProcessScriptChanged(m_ui.m_txtPostProcessScript->textEdit()->toPlainText());
}); });
connect(m_ui.m_txtSource->lineEdit(), &BaseLineEdit::textChanged, this, &StandardFeedDetails::onUrlChanged);
connect(m_ui.m_txtPostProcessScript->lineEdit(), &BaseLineEdit::textChanged, this, &StandardFeedDetails::onPostProcessScriptChanged);
connect(m_actionLoadIconFromFile, &QAction::triggered, this, &StandardFeedDetails::onLoadIconFromFile); connect(m_actionLoadIconFromFile, &QAction::triggered, this, &StandardFeedDetails::onLoadIconFromFile);
connect(m_actionUseDefaultIcon, &QAction::triggered, this, &StandardFeedDetails::onUseDefaultIcon); connect(m_actionUseDefaultIcon, &QAction::triggered, this, &StandardFeedDetails::onUseDefaultIcon);
@ -94,9 +98,9 @@ StandardFeedDetails::StandardFeedDetails(QWidget* parent) : QWidget(parent) {
setTabOrder(m_ui.m_cmbEncoding, m_ui.m_txtTitle->lineEdit()); setTabOrder(m_ui.m_cmbEncoding, m_ui.m_txtTitle->lineEdit());
setTabOrder(m_ui.m_txtTitle->lineEdit(), m_ui.m_txtDescription->lineEdit()); setTabOrder(m_ui.m_txtTitle->lineEdit(), m_ui.m_txtDescription->lineEdit());
setTabOrder(m_ui.m_txtDescription->lineEdit(), m_ui.m_cmbSourceType); setTabOrder(m_ui.m_txtDescription->lineEdit(), m_ui.m_cmbSourceType);
setTabOrder(m_ui.m_cmbSourceType, m_ui.m_txtSource->lineEdit()); setTabOrder(m_ui.m_cmbSourceType, m_ui.m_txtSource->textEdit());
setTabOrder(m_ui.m_txtSource->lineEdit(), m_ui.m_txtPostProcessScript->lineEdit()); setTabOrder(m_ui.m_txtSource->textEdit(), m_ui.m_txtPostProcessScript->textEdit());
setTabOrder(m_ui.m_txtPostProcessScript->lineEdit(), m_ui.m_btnFetchMetadata); setTabOrder(m_ui.m_txtPostProcessScript->textEdit(), m_ui.m_btnFetchMetadata);
setTabOrder(m_ui.m_btnFetchMetadata, m_ui.m_btnIcon); setTabOrder(m_ui.m_btnFetchMetadata, m_ui.m_btnIcon);
GuiUtilities::setLabelAsNotice(*m_ui.m_lblScriptInfo, false); GuiUtilities::setLabelAsNotice(*m_ui.m_lblScriptInfo, false);
@ -309,10 +313,10 @@ void StandardFeedDetails::prepareForNewFeed(RootItem* parent_to_select, const QS
} }
if (!url.isEmpty()) { if (!url.isEmpty()) {
m_ui.m_txtSource->lineEdit()->setText(url); m_ui.m_txtSource->textEdit()->setPlainText(url);
} }
else if (Application::clipboard()->mimeData()->hasText()) { else if (Application::clipboard()->mimeData()->hasText()) {
m_ui.m_txtSource->lineEdit()->setText(Application::clipboard()->text()); m_ui.m_txtSource->textEdit()->setPlainText(Application::clipboard()->text());
} }
m_ui.m_txtSource->setFocus(); m_ui.m_txtSource->setFocus();
@ -324,8 +328,8 @@ void StandardFeedDetails::setExistingFeed(StandardFeed* feed) {
m_ui.m_txtTitle->lineEdit()->setText(feed->title()); m_ui.m_txtTitle->lineEdit()->setText(feed->title());
m_ui.m_txtDescription->lineEdit()->setText(feed->description()); m_ui.m_txtDescription->lineEdit()->setText(feed->description());
m_ui.m_btnIcon->setIcon(feed->icon()); m_ui.m_btnIcon->setIcon(feed->icon());
m_ui.m_txtSource->lineEdit()->setText(feed->url()); m_ui.m_txtSource->textEdit()->setPlainText(feed->url());
m_ui.m_txtPostProcessScript->lineEdit()->setText(feed->postProcessScript()); m_ui.m_txtPostProcessScript->textEdit()->setPlainText(feed->postProcessScript());
m_ui.m_cmbType->setCurrentIndex(m_ui.m_cmbType->findData(QVariant::fromValue(int(feed->type())))); m_ui.m_cmbType->setCurrentIndex(m_ui.m_cmbType->findData(QVariant::fromValue(int(feed->type()))));
m_ui.m_cmbEncoding->setCurrentIndex(m_ui.m_cmbEncoding->findData(feed->encoding(), m_ui.m_cmbEncoding->setCurrentIndex(m_ui.m_cmbEncoding->findData(feed->encoding(),
Qt::ItemDataRole::DisplayRole, Qt::ItemDataRole::DisplayRole,

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>429</width> <width>400</width>
<height>321</height> <height>460</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -111,23 +111,61 @@
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="m_cmbSourceType"/> <widget class="QComboBox" name="m_cmbSourceType"/>
</item> </item>
<item> <item row="6" column="1">
<widget class="LineEditWithStatus" name="m_txtSource" native="true"> <widget class="TextEditWithStatus" name="m_txtSource" native="true">
<property name="sizePolicy"> <property name="minimumSize">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <size>
<horstretch>1</horstretch> <width>0</width>
<verstretch>0</verstretch> <height>50</height>
</sizepolicy> </size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Post-process script</string>
</property>
</widget>
</item> </item>
<item row="8" column="0"> <item row="7" column="1">
<widget class="TextEditWithStatus" name="m_txtPostProcessScript" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="m_lblScriptInfo">
<property name="text">
<string>You can use URL as a source of your feed or you can produce your feed with custom script. Also, you can post-process generated feed data with yet another script if you wish. These are advanced features and make sure to read the documentation before your use them.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Fetch metadata</string> <string>Fetch metadata</string>
@ -137,7 +175,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="9" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QPushButton" name="m_btnFetchMetadata"> <widget class="QPushButton" name="m_btnFetchMetadata">
@ -161,7 +199,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="9" column="0"> <item row="10" column="0">
<widget class="QLabel" name="m_lblIcon"> <widget class="QLabel" name="m_lblIcon">
<property name="text"> <property name="text">
<string>Icon</string> <string>Icon</string>
@ -171,7 +209,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="10" column="1">
<widget class="QToolButton" name="m_btnIcon"> <widget class="QToolButton" name="m_btnIcon">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -208,28 +246,18 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="11" column="0" colspan="2">
<widget class="LineEditWithStatus" name="m_txtPostProcessScript" native="true"/> <spacer name="verticalSpacer">
</item> <property name="orientation">
<item row="6" column="0"> <enum>Qt::Vertical</enum>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Post-process script</string>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
</item> <size>
<item row="7" column="0" colspan="2"> <width>20</width>
<widget class="QLabel" name="m_lblScriptInfo"> <height>40</height>
<property name="text"> </size>
<string>You can use URL as a source of your feed or you can produce your feed with custom script. Also, you can post-process generated feed data with yet another script if you wish. These are advanced features and make sure to read the documentation before your use them.</string>
</property> </property>
<property name="alignment"> </spacer>
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -246,6 +274,12 @@
<header>lineeditwithstatus.h</header> <header>lineeditwithstatus.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>TextEditWithStatus</class>
<extends>QWidget</extends>
<header>lineeditwithstatus.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>