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 custom ID of feed of message.*/ tr("Feed ID") <<
/*: 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 creation date of message.*/ tr("Date") <<
/*: Tooltip for contents of message.*/ tr("Contents") <<

View File

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

View File

@ -2,31 +2,38 @@
#include "gui/reusable/networkproxydetails.h"
#include "gui/guiutilities.h"
#include "definitions/definitions.h"
#include <QNetworkProxy>
NetworkProxyDetails::NetworkProxyDetails(QWidget* parent) : QWidget(parent) {
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);
connect(m_ui.m_cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &NetworkProxyDetails::onProxyTypeChanged);
connect(m_ui.m_cmbProxyType,
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("System proxy"), QNetworkProxy::ProxyType::DefaultProxy);
m_ui.m_cmbProxyType->addItem(tr("Socks5"), QNetworkProxy::ProxyType::Socks5Proxy);
m_ui.m_cmbProxyType->addItem(tr("Http"), QNetworkProxy::ProxyType::HttpProxy);
m_ui.m_cmbProxyType->addItem(QSL("Socks5"), QNetworkProxy::ProxyType::Socks5Proxy);
m_ui.m_cmbProxyType->addItem(QSL("Http"), QNetworkProxy::ProxyType::HttpProxy);
connect(m_ui.m_cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &NetworkProxyDetails::changed);
connect(m_ui.m_cmbProxyType,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
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_txtProxyUsername, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
connect(m_ui.m_spinProxyPort, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this, &NetworkProxyDetails::changed);
connect(m_ui.m_spinProxyPort,
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this,
&NetworkProxyDetails::changed);
}
QNetworkProxy NetworkProxyDetails::proxy() const {
@ -48,9 +55,10 @@ void NetworkProxyDetails::setProxy(const QNetworkProxy& proxy) {
}
void NetworkProxyDetails::onProxyTypeChanged(int index) {
const QNetworkProxy::ProxyType selected_type = static_cast<QNetworkProxy::ProxyType>(m_ui.m_cmbProxyType->itemData(index).toInt());
const bool is_proxy_selected = selected_type != QNetworkProxy::ProxyType::NoProxy &&
selected_type != QNetworkProxy::ProxyType::DefaultProxy;
const QNetworkProxy::ProxyType selected_type =
static_cast<QNetworkProxy::ProxyType>(m_ui.m_cmbProxyType->itemData(index).toInt());
const bool is_proxy_selected =
selected_type != QNetworkProxy::ProxyType::NoProxy && selected_type != QNetworkProxy::ProxyType::DefaultProxy;
m_ui.m_proxyDetails->setEnabled(is_proxy_selected);
}

View File

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

View File

@ -182,7 +182,7 @@ void SettingsBrowserMail::loadSettings() {
->setChecked(settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool());
// 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
->setText(settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString());
m_ui->m_txtExternalEmailArguments

View File

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

View File

@ -107,7 +107,7 @@ void SettingsNodejs::testNodejs() {
tr("Node.js has version %1.").arg(node_version));
}
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));
}
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 <QSettings>
DownloadItem::DownloadItem(QNetworkReply* reply, const QString& preferred_file_name,
const std::function<void(DownloadItem*)>& run_on_finish, QWidget* parent)
DownloadItem::DownloadItem(QNetworkReply* reply,
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),
m_runOnFinish(run_on_finish), m_bytesReceived(0), m_requestFileName(false), m_startedSaving(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
connect(m_reply, &QNetworkReply::errorOccurred, this, &DownloadItem::error);
#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);
#endif
@ -116,7 +120,8 @@ void DownloadItem::getFileName() {
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()));
qApp->downloadManager()->setDownloadDirectory(file_info.absoluteDir().absolutePath());
}
@ -209,7 +214,8 @@ void DownloadItem::stop() {
void DownloadItem::openFile() {
if (!QDesktopServices::openUrl(QUrl::fromLocalFile(m_output.fileName()))) {
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});
}
}
@ -217,8 +223,12 @@ void DownloadItem::openFile() {
void DownloadItem::openFolder() {
if (m_output.exists()) {
if (!SystemFactory::openFolderFile(m_output.fileName())) {
MsgBox::show(this, QMessageBox::Icon::Warning, tr("Cannot open directory"),
tr("Cannot open output directory. Open it manually."), QString(), m_output.fileName());
MsgBox::show(this,
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"))
.arg(DownloadManager::dataString(m_bytesReceived),
bytes_total == 0 ? QSL("?") : DownloadManager::dataString(bytes_total),
DownloadManager::dataString((int)speed), remaining);
DownloadManager::dataString((int)speed),
remaining);
}
else {
if (m_bytesReceived == bytes_total) {
@ -432,9 +443,10 @@ void DownloadItem::finished() {
tr("File '%1' is downloaded.\nClick here to open parent directory.")
.arg(QDir::toNativeSeparators(m_output.fileName())),
QSystemTrayIcon::MessageIcon::Information},
{}, {tr("Open folder"), [this] {
openFolder();
}});
{},
{tr("Open folder"), [this] {
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) {
if (!request.url().isEmpty()) {
handleUnsupportedContent(m_networkManager->get(request), preferred_file_name, run_on_finish);
@ -510,7 +523,8 @@ void DownloadManager::download(const QUrl& 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) {
if (reply == nullptr || reply->url().isEmpty()) {
return;
@ -535,7 +549,9 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const QStri
}
void DownloadManager::addItem(DownloadItem* item) {
connect(item, &DownloadItem::statusChanged, this,
connect(item,
&DownloadItem::statusChanged,
this,
static_cast<void (DownloadManager::*)()>(&DownloadManager::updateRow));
connect(item, &DownloadItem::progress, this, &DownloadManager::itemProgress);
connect(item, &DownloadItem::downloadFinished, this, &DownloadManager::itemFinished);
@ -646,7 +662,8 @@ void DownloadManager::save() const {
// Save all download items.
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::ItemLocation).arg(i),
settings->setValue(GROUP(Downloads),
QString(Downloads::ItemLocation).arg(i),
QFileInfo(m_downloads[i]->m_output).filePath());
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) {
new_size = (double)size / (double)1024;
unit = tr("kB");
unit = QSL("kB");
}
else if (size < 1024 * 1024 * 1024) {
new_size = (double)size / (double)(1024 * 1024);
unit = tr("MB");
unit = QSL("MB");
}
else {
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);
@ -826,8 +843,8 @@ QMimeData* DownloadModel::mimeData(const QModelIndexList& indexes) const {
continue;
}
urls.append(
QUrl::fromLocalFile(QFileInfo(m_downloadManager->m_downloads.at(index.row())->m_output).absoluteFilePath()));
urls.append(QUrl::fromLocalFile(QFileInfo(m_downloadManager->m_downloads.at(index.row())->m_output)
.absoluteFilePath()));
}
mimeData->setUrls(urls);

View File

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

View File

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

View File

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