new initial feeds

This commit is contained in:
Martin Rotter 2023-08-18 18:11:41 +02:00
parent 5a3f538abb
commit 0abef3faac
12 changed files with 87 additions and 85 deletions

File diff suppressed because one or more lines are too long

View file

@ -284,7 +284,7 @@ void MessagesModel::setupHeaderData() {
/*: Tooltip for "pdeleted" column in msg list.*/ tr("Permanently deleted") << /*: Tooltip for "pdeleted" column in msg list.*/ tr("Permanently deleted") <<
/*: Tooltip for custom ID of feed of message.*/ tr("Feed ID") << /*: Tooltip for custom ID of feed of message.*/ tr("Feed ID") <<
/*: Tooltip for title of message.*/ tr("Title") << /*: Tooltip for title of message.*/ tr("Title") <<
/*: Tooltip for url of message.*/ tr("Url") << /*: Tooltip for url of message.*/ tr("URL") <<
/*: Tooltip for author of message.*/ tr("Author") << /*: Tooltip for author of message.*/ tr("Author") <<
/*: Tooltip for creation date of message.*/ tr("Date") << /*: Tooltip for creation date of message.*/ tr("Date") <<
/*: Tooltip for contents of message.*/ tr("Contents") << /*: Tooltip for contents of message.*/ tr("Contents") <<

View file

@ -91,7 +91,7 @@ QString MariaDbDriver::interpretErrorCode(MariaDbDriver::MariaDbError error_code
} }
QString MariaDbDriver::humanDriverType() const { QString MariaDbDriver::humanDriverType() const {
return tr("MariaDB"); return QSL("MariaDB");
} }
QString MariaDbDriver::qtDriverCode() const { QString MariaDbDriver::qtDriverCode() const {

View file

@ -2,31 +2,38 @@
#include "gui/reusable/networkproxydetails.h" #include "gui/reusable/networkproxydetails.h"
#include "gui/guiutilities.h" #include "definitions/definitions.h"
#include <QNetworkProxy> #include <QNetworkProxy>
NetworkProxyDetails::NetworkProxyDetails(QWidget* parent) : QWidget(parent) { NetworkProxyDetails::NetworkProxyDetails(QWidget* parent) : QWidget(parent) {
m_ui.setupUi(this); m_ui.setupUi(this);
m_ui.m_lblProxyInfo->setHelpText(tr("Note that these settings are applied only on newly established connections."), false); m_ui.m_lblProxyInfo->setHelpText(tr("Note that these settings are applied only on newly established connections."),
false);
m_ui.m_txtProxyPassword->setPasswordMode(true); m_ui.m_txtProxyPassword->setPasswordMode(true);
connect(m_ui.m_cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_ui.m_cmbProxyType,
this, &NetworkProxyDetails::onProxyTypeChanged); static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this,
&NetworkProxyDetails::onProxyTypeChanged);
m_ui.m_cmbProxyType->addItem(tr("No proxy"), QNetworkProxy::ProxyType::NoProxy); m_ui.m_cmbProxyType->addItem(tr("No proxy"), QNetworkProxy::ProxyType::NoProxy);
m_ui.m_cmbProxyType->addItem(tr("System proxy"), QNetworkProxy::ProxyType::DefaultProxy); m_ui.m_cmbProxyType->addItem(tr("System proxy"), QNetworkProxy::ProxyType::DefaultProxy);
m_ui.m_cmbProxyType->addItem(tr("Socks5"), QNetworkProxy::ProxyType::Socks5Proxy); m_ui.m_cmbProxyType->addItem(QSL("Socks5"), QNetworkProxy::ProxyType::Socks5Proxy);
m_ui.m_cmbProxyType->addItem(tr("Http"), QNetworkProxy::ProxyType::HttpProxy); m_ui.m_cmbProxyType->addItem(QSL("Http"), QNetworkProxy::ProxyType::HttpProxy);
connect(m_ui.m_cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_ui.m_cmbProxyType,
this, &NetworkProxyDetails::changed); static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this,
&NetworkProxyDetails::changed);
connect(m_ui.m_txtProxyHost, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed); connect(m_ui.m_txtProxyHost, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
connect(m_ui.m_txtProxyPassword, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed); connect(m_ui.m_txtProxyPassword, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
connect(m_ui.m_txtProxyUsername, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed); connect(m_ui.m_txtProxyUsername, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
connect(m_ui.m_spinProxyPort, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), connect(m_ui.m_spinProxyPort,
this, &NetworkProxyDetails::changed); static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this,
&NetworkProxyDetails::changed);
} }
QNetworkProxy NetworkProxyDetails::proxy() const { QNetworkProxy NetworkProxyDetails::proxy() const {
@ -48,9 +55,10 @@ void NetworkProxyDetails::setProxy(const QNetworkProxy& proxy) {
} }
void NetworkProxyDetails::onProxyTypeChanged(int index) { void NetworkProxyDetails::onProxyTypeChanged(int index) {
const QNetworkProxy::ProxyType selected_type = static_cast<QNetworkProxy::ProxyType>(m_ui.m_cmbProxyType->itemData(index).toInt()); const QNetworkProxy::ProxyType selected_type =
const bool is_proxy_selected = selected_type != QNetworkProxy::ProxyType::NoProxy && static_cast<QNetworkProxy::ProxyType>(m_ui.m_cmbProxyType->itemData(index).toInt());
selected_type != QNetworkProxy::ProxyType::DefaultProxy; const bool is_proxy_selected =
selected_type != QNetworkProxy::ProxyType::NoProxy && selected_type != QNetworkProxy::ProxyType::DefaultProxy;
m_ui.m_proxyDetails->setEnabled(is_proxy_selected); m_ui.m_proxyDetails->setEnabled(is_proxy_selected);
} }

View file

@ -384,9 +384,6 @@
<property name="toolTip"> <property name="toolTip">
<string>Text foreground color</string> <string>Text foreground color</string>
</property> </property>
<property name="text">
<string>.</string>
</property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>16</width> <width>16</width>
@ -415,9 +412,6 @@
<property name="toolTip"> <property name="toolTip">
<string>Text background color</string> <string>Text background color</string>
</property> </property>
<property name="text">
<string>.</string>
</property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>16</width> <width>16</width>
@ -447,11 +441,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="PlainToolButton" name="f_image"> <widget class="PlainToolButton" name="f_image"/>
<property name="text">
<string notr="true">...</string>
</property>
</widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
@ -467,11 +457,7 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="PlainToolButton" name="f_menu"> <widget class="PlainToolButton" name="f_menu"/>
<property name="text">
<string>...</string>
</property>
</widget>
</item> </item>
</layout> </layout>
<zorder>f_paragraph</zorder> <zorder>f_paragraph</zorder>
@ -515,6 +501,11 @@
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>ColorToolButton</class>
<extends>QToolButton</extends>
<header>colortoolbutton.h</header>
</customwidget>
<customwidget> <customwidget>
<class>PlainToolButton</class> <class>PlainToolButton</class>
<extends>QToolButton</extends> <extends>QToolButton</extends>
@ -525,11 +516,6 @@
<extends>QTextEdit</extends> <extends>QTextEdit</extends>
<header>mtextedit.h</header> <header>mtextedit.h</header>
</customwidget> </customwidget>
<customwidget>
<class>ColorToolButton</class>
<extends>QToolButton</extends>
<header>colortoolbutton.h</header>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>f_textedit</tabstop> <tabstop>f_textedit</tabstop>

View file

@ -182,7 +182,7 @@ void SettingsBrowserMail::loadSettings() {
->setChecked(settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool()); ->setChecked(settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool());
// Load settings of e-mail. // Load settings of e-mail.
m_ui->m_cmbExternalEmailPreset->addItem(tr("Mozilla Thunderbird"), QSL("-compose \"subject='%1',body='%2'\"")); m_ui->m_cmbExternalEmailPreset->addItem(QSL("Mozilla Thunderbird"), QSL("-compose \"subject='%1',body='%2'\""));
m_ui->m_txtExternalEmailExecutable m_ui->m_txtExternalEmailExecutable
->setText(settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString()); ->setText(settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString());
m_ui->m_txtExternalEmailArguments m_ui->m_txtExternalEmailArguments

View file

@ -13,6 +13,9 @@
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QTabWidget" name="m_tabBrowserProxy"> <widget class="QTabWidget" name="m_tabBrowserProxy">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="m_tabNetwork"> <widget class="QWidget" name="m_tabNetwork">
<attribute name="title"> <attribute name="title">
<string>Network</string> <string>Network</string>
@ -36,7 +39,7 @@
</widget> </widget>
<widget class="QWidget" name="m_tabWebEngine"> <widget class="QWidget" name="m_tabWebEngine">
<attribute name="title"> <attribute name="title">
<string>WebEngine</string> <string notr="true">WebEngine</string>
</attribute> </attribute>
<layout class="QFormLayout" name="formLayout_4"> <layout class="QFormLayout" name="formLayout_4">
<item row="1" column="0"> <item row="1" column="0">

View file

@ -107,7 +107,7 @@ void SettingsNodejs::testNodejs() {
tr("Node.js has version %1.").arg(node_version)); tr("Node.js has version %1.").arg(node_version));
} }
catch (const ApplicationException& ex) { catch (const ApplicationException& ex) {
m_ui.m_tbNodeExecutable->setStatus(WidgetWithStatus::StatusType::Error, tr("Node.js: %1.").arg(ex.message())); m_ui.m_tbNodeExecutable->setStatus(WidgetWithStatus::StatusType::Error, QSL("Node.js: %1.").arg(ex.message()));
} }
} }
@ -118,7 +118,7 @@ void SettingsNodejs::testNpm() {
m_ui.m_tbNpmExecutable->setStatus(WidgetWithStatus::StatusType::Ok, tr("NPM has version %1.").arg(npm_version)); m_ui.m_tbNpmExecutable->setStatus(WidgetWithStatus::StatusType::Ok, tr("NPM has version %1.").arg(npm_version));
} }
catch (const ApplicationException& ex) { catch (const ApplicationException& ex) {
m_ui.m_tbNpmExecutable->setStatus(WidgetWithStatus::StatusType::Error, tr("NPM: %1.").arg(ex.message())); m_ui.m_tbNpmExecutable->setStatus(WidgetWithStatus::StatusType::Error, QSL("NPM: %1.").arg(ex.message()));
} }
} }

View file

@ -23,8 +23,10 @@
#include <QMimeData> #include <QMimeData>
#include <QSettings> #include <QSettings>
DownloadItem::DownloadItem(QNetworkReply* reply, const QString& preferred_file_name, DownloadItem::DownloadItem(QNetworkReply* reply,
const std::function<void(DownloadItem*)>& run_on_finish, QWidget* parent) const QString& preferred_file_name,
const std::function<void(DownloadItem*)>& run_on_finish,
QWidget* parent)
: QWidget(parent), m_ui(new Ui::DownloadItem), m_reply(reply), m_preferredFileName(preferred_file_name), : QWidget(parent), m_ui(new Ui::DownloadItem), m_reply(reply), m_preferredFileName(preferred_file_name),
m_runOnFinish(run_on_finish), m_bytesReceived(0), m_requestFileName(false), m_startedSaving(false), m_runOnFinish(run_on_finish), m_bytesReceived(0), m_requestFileName(false), m_startedSaving(false),
m_finishedDownloading(false), m_gettingFileName(false), m_canceledFileSelect(false) { m_finishedDownloading(false), m_gettingFileName(false), m_canceledFileSelect(false) {
@ -66,7 +68,9 @@ void DownloadItem::init() {
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0 #if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
connect(m_reply, &QNetworkReply::errorOccurred, this, &DownloadItem::error); connect(m_reply, &QNetworkReply::errorOccurred, this, &DownloadItem::error);
#else #else
connect(m_reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, connect(m_reply,
static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error),
this,
&DownloadItem::error); &DownloadItem::error);
#endif #endif
@ -116,7 +120,8 @@ void DownloadItem::getFileName() {
const QFileInfo file_info = QFileInfo(chosen_filename); const QFileInfo file_info = QFileInfo(chosen_filename);
qApp->settings()->setValue(GROUP(Downloads), Downloads::TargetExplicitDirectory, qApp->settings()->setValue(GROUP(Downloads),
Downloads::TargetExplicitDirectory,
QDir::toNativeSeparators(QFileInfo(chosen_filename).absolutePath())); QDir::toNativeSeparators(QFileInfo(chosen_filename).absolutePath()));
qApp->downloadManager()->setDownloadDirectory(file_info.absoluteDir().absolutePath()); qApp->downloadManager()->setDownloadDirectory(file_info.absoluteDir().absolutePath());
} }
@ -209,7 +214,8 @@ void DownloadItem::stop() {
void DownloadItem::openFile() { void DownloadItem::openFile() {
if (!QDesktopServices::openUrl(QUrl::fromLocalFile(m_output.fileName()))) { if (!QDesktopServices::openUrl(QUrl::fromLocalFile(m_output.fileName()))) {
qApp->showGuiMessage(Notification::Event::GeneralEvent, qApp->showGuiMessage(Notification::Event::GeneralEvent,
{tr("Cannot open file"), tr("Cannot open output file. Open it manually."), {tr("Cannot open file"),
tr("Cannot open output file. Open it manually."),
QSystemTrayIcon::MessageIcon::Warning}); QSystemTrayIcon::MessageIcon::Warning});
} }
} }
@ -217,8 +223,12 @@ void DownloadItem::openFile() {
void DownloadItem::openFolder() { void DownloadItem::openFolder() {
if (m_output.exists()) { if (m_output.exists()) {
if (!SystemFactory::openFolderFile(m_output.fileName())) { if (!SystemFactory::openFolderFile(m_output.fileName())) {
MsgBox::show(this, QMessageBox::Icon::Warning, tr("Cannot open directory"), MsgBox::show(this,
tr("Cannot open output directory. Open it manually."), QString(), m_output.fileName()); QMessageBox::Icon::Warning,
tr("Cannot open directory"),
tr("Cannot open output directory. Open it manually."),
QString(),
m_output.fileName());
} }
} }
} }
@ -380,7 +390,8 @@ void DownloadItem::updateDownloadInfoLabel() {
info = QString(tr("%1 of %2 (%3 per second) - %4")) info = QString(tr("%1 of %2 (%3 per second) - %4"))
.arg(DownloadManager::dataString(m_bytesReceived), .arg(DownloadManager::dataString(m_bytesReceived),
bytes_total == 0 ? QSL("?") : DownloadManager::dataString(bytes_total), bytes_total == 0 ? QSL("?") : DownloadManager::dataString(bytes_total),
DownloadManager::dataString((int)speed), remaining); DownloadManager::dataString((int)speed),
remaining);
} }
else { else {
if (m_bytesReceived == bytes_total) { if (m_bytesReceived == bytes_total) {
@ -432,7 +443,8 @@ void DownloadItem::finished() {
tr("File '%1' is downloaded.\nClick here to open parent directory.") tr("File '%1' is downloaded.\nClick here to open parent directory.")
.arg(QDir::toNativeSeparators(m_output.fileName())), .arg(QDir::toNativeSeparators(m_output.fileName())),
QSystemTrayIcon::MessageIcon::Information}, QSystemTrayIcon::MessageIcon::Information},
{}, {tr("Open folder"), [this] { {},
{tr("Open folder"), [this] {
openFolder(); openFolder();
}}); }});
} }
@ -499,7 +511,8 @@ int DownloadManager::downloadProgress() const {
} }
} }
void DownloadManager::download(const QNetworkRequest& request, const QString& preferred_file_name, void DownloadManager::download(const QNetworkRequest& request,
const QString& preferred_file_name,
const std::function<void(DownloadItem*)>& run_on_finish) { const std::function<void(DownloadItem*)>& run_on_finish) {
if (!request.url().isEmpty()) { if (!request.url().isEmpty()) {
handleUnsupportedContent(m_networkManager->get(request), preferred_file_name, run_on_finish); handleUnsupportedContent(m_networkManager->get(request), preferred_file_name, run_on_finish);
@ -510,7 +523,8 @@ void DownloadManager::download(const QUrl& url) {
download(QNetworkRequest(url)); download(QNetworkRequest(url));
} }
void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const QString& preferred_file_name, void DownloadManager::handleUnsupportedContent(QNetworkReply* reply,
const QString& preferred_file_name,
const std::function<void(DownloadItem*)>& run_on_finish) { const std::function<void(DownloadItem*)>& run_on_finish) {
if (reply == nullptr || reply->url().isEmpty()) { if (reply == nullptr || reply->url().isEmpty()) {
return; return;
@ -535,7 +549,9 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const QStri
} }
void DownloadManager::addItem(DownloadItem* item) { void DownloadManager::addItem(DownloadItem* item) {
connect(item, &DownloadItem::statusChanged, this, connect(item,
&DownloadItem::statusChanged,
this,
static_cast<void (DownloadManager::*)()>(&DownloadManager::updateRow)); static_cast<void (DownloadManager::*)()>(&DownloadManager::updateRow));
connect(item, &DownloadItem::progress, this, &DownloadManager::itemProgress); connect(item, &DownloadItem::progress, this, &DownloadManager::itemProgress);
connect(item, &DownloadItem::downloadFinished, this, &DownloadManager::itemFinished); connect(item, &DownloadItem::downloadFinished, this, &DownloadManager::itemFinished);
@ -646,7 +662,8 @@ void DownloadManager::save() const {
// Save all download items. // Save all download items.
for (int i = 0; i < m_downloads.count(); i++) { for (int i = 0; i < m_downloads.count(); i++) {
settings->setValue(GROUP(Downloads), QString(Downloads::ItemUrl).arg(i), m_downloads[i]->m_url); settings->setValue(GROUP(Downloads), QString(Downloads::ItemUrl).arg(i), m_downloads[i]->m_url);
settings->setValue(GROUP(Downloads), QString(Downloads::ItemLocation).arg(i), settings->setValue(GROUP(Downloads),
QString(Downloads::ItemLocation).arg(i),
QFileInfo(m_downloads[i]->m_output).filePath()); QFileInfo(m_downloads[i]->m_output).filePath());
settings->setValue(GROUP(Downloads), QString(Downloads::ItemDone).arg(i), m_downloads[i]->downloadedSuccessfully()); settings->setValue(GROUP(Downloads), QString(Downloads::ItemDone).arg(i), m_downloads[i]->downloadedSuccessfully());
} }
@ -742,15 +759,15 @@ QString DownloadManager::dataString(qint64 size) {
} }
else if (size < 1024 * 1024) { else if (size < 1024 * 1024) {
new_size = (double)size / (double)1024; new_size = (double)size / (double)1024;
unit = tr("kB"); unit = QSL("kB");
} }
else if (size < 1024 * 1024 * 1024) { else if (size < 1024 * 1024 * 1024) {
new_size = (double)size / (double)(1024 * 1024); new_size = (double)size / (double)(1024 * 1024);
unit = tr("MB"); unit = QSL("MB");
} }
else { else {
new_size = (double)size / (double)(1024 * 1024 * 1024); new_size = (double)size / (double)(1024 * 1024 * 1024);
unit = tr("GB"); unit = QSL("GB");
} }
return QSL("%1 %2").arg(new_size, 0, 'f', 1).arg(unit); return QSL("%1 %2").arg(new_size, 0, 'f', 1).arg(unit);
@ -826,8 +843,8 @@ QMimeData* DownloadModel::mimeData(const QModelIndexList& indexes) const {
continue; continue;
} }
urls.append( urls.append(QUrl::fromLocalFile(QFileInfo(m_downloadManager->m_downloads.at(index.row())->m_output)
QUrl::fromLocalFile(QFileInfo(m_downloadManager->m_downloads.at(index.row())->m_output).absoluteFilePath())); .absoluteFilePath()));
} }
mimeData->setUrls(urls); mimeData->setUrls(urls);

View file

@ -14,11 +14,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="ColorToolButton" name="m_btnColor"> <widget class="ColorToolButton" name="m_btnColor"/>
<property name="text">
<string>...</string>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="LineEditWithStatus" name="m_txtName" native="true"/> <widget class="LineEditWithStatus" name="m_txtName" native="true"/>

View file

@ -12,11 +12,7 @@
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="ColorToolButton" name="m_btnColor"> <widget class="ColorToolButton" name="m_btnColor"/>
<property name="text">
<string>...</string>
</property>
</widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="LineEditWithStatus" name="m_txtName" native="true"/> <widget class="LineEditWithStatus" name="m_txtName" native="true"/>

View file

@ -30,11 +30,7 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="PlainToolButton" name="m_btnAdder"> <widget class="PlainToolButton" name="m_btnAdder"/>
<property name="text">
<string>...</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>