This commit is contained in:
Martin Rotter 2024-03-22 10:46:43 +01:00
parent 202da682b8
commit 75fdd81bad
7 changed files with 63 additions and 32 deletions

View File

@ -42,7 +42,7 @@
#
# Other information:
# - supports Windows, Linux, *BSD, macOS, OS/2, Android,
# - Qt 5.12.0 or newer is required,
# - Qt 5.14.0 or newer is required,
# - Qt 6.3.0 or newer is required,
# - cmake 3.14.0 or newer is required,
# - if you wish to make packages for Windows, then you must initialize all submodules
@ -133,7 +133,7 @@ option(MEDIAPLAYER_FORCE_OPENGL "Use opengl-based render API with libmpv." ON)
# Import Qt libraries.
set(QT6_MIN_VERSION 6.3.0)
set(QT5_MIN_VERSION 5.12.0)
set(QT5_MIN_VERSION 5.14.0)
set(QT_COMPONENTS
Core

View File

@ -11,6 +11,7 @@
#include "miscellaneous/textfactory.h"
#include "network-web/webfactory.h"
#include <QClipboard>
#include <QFile>
#include <QJsonArray>
#include <QJsonObject>
@ -24,9 +25,13 @@
FormAbout::FormAbout(bool go_to_changelog, QWidget* parent) : QDialog(parent) {
m_ui.setupUi(this);
m_ui.m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH));
m_ui.m_btnCopyInfo->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
GuiUtilities::applyDialogProperties(*this,
qApp->icons()->fromTheme(QSL("help-about")),
tr("About %1").arg(QSL(APP_NAME)));
connect(m_ui.m_btnCopyInfo, &QPushButton::clicked, this, &FormAbout::copyInfoToClipboard);
loadLicenseAndInformation();
loadSettingsAndPaths();
@ -37,6 +42,21 @@ FormAbout::FormAbout(bool go_to_changelog, QWidget* parent) : QDialog(parent) {
FormAbout::~FormAbout() {}
void FormAbout::copyInfoToClipboard() {
auto* clip = QGuiApplication::clipboard();
if (clip != nullptr) {
clip->setText(m_ui.m_lblDesc->text().replace(QSL("<br/>"), QSL("\n")));
}
else {
qApp->showGuiMessage(Notification::Event::GeneralEvent,
GuiMessage(tr("Cannot copy"),
tr("Cannot copy info to clipboard."),
QSystemTrayIcon::MessageIcon::Critical),
GuiMessageDestination(true, true));
}
}
void FormAbout::displayLicense() {
m_ui.m_tbLicenses->setPlainText(m_ui.m_cbLicenses->currentData().toString());
}
@ -110,11 +130,13 @@ void FormAbout::loadLicenseAndInformation() {
}
// Set other informative texts.
m_ui.m_lblDesc->setText(tr("<b>%8</b><br>"
"<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>")
m_ui.m_lblDesc->setTextFormat(Qt::TextFormat::MarkdownText);
m_ui.m_lblDesc->setText(tr("### %8<br/>"
"**Version:** %1 (built on %2/%3)<br/>"
"**Revision:** %4<br/>"
"**Build date:** %5<br/>"
"**OS:** %9<br/>"
"**Qt:** %6 (compiled against %7)")
.arg(qApp->applicationVersion(),
QSL(APP_SYSTEM_NAME),
QSL(APP_SYSTEM_VERSION),
@ -125,7 +147,8 @@ void FormAbout::loadLicenseAndInformation() {
QLocale::FormatType::ShortFormat),
qVersion(),
QSL(QT_VERSION_STR),
QSL(APP_NAME)));
QSL(APP_NAME),
QSysInfo::prettyProductName()));
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."

View File

@ -15,6 +15,7 @@ class RSSGUARD_DLLSPEC FormAbout : public QDialog {
virtual ~FormAbout();
private slots:
void copyInfoToClipboard();
void displayLicense();
private:

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>727</width>
<height>446</height>
<width>562</width>
<height>373</height>
</rect>
</property>
<property name="windowTitle">
@ -18,11 +18,8 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="m_formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="m_lblIcon">
<property name="minimumSize">
<size>
@ -56,7 +53,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QLabel" name="m_lblDesc">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -84,6 +81,19 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_btnCopyInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Copy info to clipboard</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -123,6 +133,9 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
hr { height: 1px; border-width: 0; }
li.unchecked::marker { content: &quot;\2610&quot;; }
li.checked::marker { content: &quot;\2612&quot;; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -179,6 +192,9 @@ p, li { white-space: pre-wrap; }
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
hr { height: 1px; border-width: 0; }
li.unchecked::marker { content: &quot;\2610&quot;; }
li.checked::marker { content: &quot;\2612&quot;; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>405</width>
<height>409</height>
<height>305</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -15,7 +15,7 @@ PluginFactory::PluginFactory() {}
QList<ServiceEntryPoint*> PluginFactory::loadPlugins() const {
QList<ServiceEntryPoint*> plugins;
const QString plugin_name_wildcard = pluginNameWildCard() + pluginNameSuffix();
const QString plugin_name_wildcard = pluginNameWildCard();
const auto plugins_paths = pluginPaths();
const auto backup_current_dir = QDir::currentPath();
@ -23,7 +23,11 @@ QList<ServiceEntryPoint*> PluginFactory::loadPlugins() const {
QDirIterator dir_iter(plugin_folder,
{plugin_name_wildcard},
QDir::Filter::Files,
#if !defined(NDEBUG)
QDirIterator::IteratorFlag::Subdirectories);
#else
QDirIterator::IteratorFlag::NoIteratorFlags);
#endif
while (dir_iter.hasNext()) {
dir_iter.next();
@ -74,18 +78,6 @@ QStringList PluginFactory::pluginPaths() const {
return paths;
}
QString PluginFactory::pluginNameSuffix() const {
#if defined(Q_OS_LINUX)
return QSL(".so");
#elif defined(Q_OS_WIN)
return QSL(".dll");
#elif defined(Q_OS_MACOS)
return QSL(".dylib");
#else
return QSL("");
#endif
}
QString PluginFactory::pluginNameWildCard() const {
return QSL("*rssguard-*");
return QSL("*rssguard-*.*");
}

View File

@ -15,7 +15,6 @@ class PluginFactory {
private:
QStringList pluginPaths() const;
QString pluginNameSuffix() const;
QString pluginNameWildCard() const;
};