Big refactorings.
This commit is contained in:
parent
0fc62ef28a
commit
a136de363e
@ -26,7 +26,7 @@ FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget* parent) : QDialo
|
|||||||
selectFolder(qApp->documentsFolder());
|
selectFolder(qApp->documentsFolder());
|
||||||
m_ui->m_txtBackupName->lineEdit()->setText(QString(APP_LOW_NAME) + QL1S("_") +
|
m_ui->m_txtBackupName->lineEdit()->setText(QString(APP_LOW_NAME) + QL1S("_") +
|
||||||
QDateTime::currentDateTime().toString(QSL("yyyyMMddHHmm")));
|
QDateTime::currentDateTime().toString(QSL("yyyyMMddHHmm")));
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
||||||
|
|
||||||
if (qApp->database()->activeDatabaseDriver() != DatabaseFactory::UsedDriver::SQLITE &&
|
if (qApp->database()->activeDatabaseDriver() != DatabaseFactory::UsedDriver::SQLITE &&
|
||||||
qApp->database()->activeDatabaseDriver() != DatabaseFactory::UsedDriver::SQLITE_MEMORY) {
|
qApp->database()->activeDatabaseDriver() != DatabaseFactory::UsedDriver::SQLITE_MEMORY) {
|
||||||
@ -42,12 +42,12 @@ void FormBackupDatabaseSettings::performBackup() {
|
|||||||
try {
|
try {
|
||||||
qApp->backupDatabaseSettings(m_ui->m_checkBackupDatabase->isChecked(), m_ui->m_checkBackupSettings->isChecked(),
|
qApp->backupDatabaseSettings(m_ui->m_checkBackupDatabase->isChecked(), m_ui->m_checkBackupSettings->isChecked(),
|
||||||
m_ui->m_lblSelectFolder->label()->text(), m_ui->m_txtBackupName->lineEdit()->text());
|
m_ui->m_lblSelectFolder->label()->text(), m_ui->m_txtBackupName->lineEdit()->text());
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Ok,
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
tr("Backup was created successfully and stored in target directory."),
|
tr("Backup was created successfully and stored in target directory."),
|
||||||
tr("Backup was created successfully."));
|
tr("Backup was created successfully."));
|
||||||
}
|
}
|
||||||
catch (const ApplicationException& ex) {
|
catch (const ApplicationException& ex) {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Error, ex.message(), tr("Backup failed."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Error, ex.message(), tr("Backup failed."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,17 +61,17 @@ void FormBackupDatabaseSettings::selectFolder(QString path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
m_ui->m_lblSelectFolder->setStatus(WidgetWithStatus::Ok, QDir::toNativeSeparators(path),
|
m_ui->m_lblSelectFolder->setStatus(WidgetWithStatus::StatusType::Ok, QDir::toNativeSeparators(path),
|
||||||
tr("Good destination directory is specified."));
|
tr("Good destination directory is specified."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormBackupDatabaseSettings::checkBackupNames(const QString& name) {
|
void FormBackupDatabaseSettings::checkBackupNames(const QString& name) {
|
||||||
if (name.simplified().isEmpty()) {
|
if (name.simplified().isEmpty()) {
|
||||||
m_ui->m_txtBackupName->setStatus(WidgetWithStatus::Error, tr("Backup name cannot be empty."));
|
m_ui->m_txtBackupName->setStatus(WidgetWithStatus::StatusType::Error, tr("Backup name cannot be empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtBackupName->setStatus(WidgetWithStatus::Ok, tr("Backup name looks okay."));
|
m_ui->m_txtBackupName->setStatus(WidgetWithStatus::StatusType::Ok, tr("Backup name looks okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ FormDatabaseCleanup::FormDatabaseCleanup(QWidget* parent) : QDialog(parent), m_u
|
|||||||
connect(&m_cleaner, &DatabaseCleaner::purgeFinished, this, &FormDatabaseCleanup::onPurgeFinished);
|
connect(&m_cleaner, &DatabaseCleaner::purgeFinished, this, &FormDatabaseCleanup::onPurgeFinished);
|
||||||
|
|
||||||
m_ui->m_spinDays->setValue(DEFAULT_DAYS_TO_DELETE_MSG);
|
m_ui->m_spinDays->setValue(DEFAULT_DAYS_TO_DELETE_MSG);
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Information, tr("I am ready."), tr("I am ready."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Information, tr("I am ready."), tr("I am ready."));
|
||||||
|
|
||||||
loadDatabaseInfo();
|
loadDatabaseInfo();
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ void FormDatabaseCleanup::keyPressEvent(QKeyEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormDatabaseCleanup::updateDaysSuffix(int number) {
|
void FormDatabaseCleanup::updateDaysSuffix(int number) {
|
||||||
m_ui->m_spinDays->setSuffix(tr(" day(s)", 0, number));
|
m_ui->m_spinDays->setSuffix(tr(" day(s)", nullptr, number));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormDatabaseCleanup::startPurging() {
|
void FormDatabaseCleanup::startPurging() {
|
||||||
@ -61,6 +61,7 @@ void FormDatabaseCleanup::startPurging() {
|
|||||||
orders.m_removeReadMessages = m_ui->m_checkRemoveReadMessages->isChecked();
|
orders.m_removeReadMessages = m_ui->m_checkRemoveReadMessages->isChecked();
|
||||||
orders.m_shrinkDatabase = m_ui->m_checkShrink->isEnabled() && m_ui->m_checkShrink->isChecked();
|
orders.m_shrinkDatabase = m_ui->m_checkShrink->isEnabled() && m_ui->m_checkShrink->isChecked();
|
||||||
orders.m_removeStarredMessages = m_ui->m_checkRemoveStarredMessages->isChecked();
|
orders.m_removeStarredMessages = m_ui->m_checkRemoveStarredMessages->isChecked();
|
||||||
|
|
||||||
emit purgeRequested(orders);
|
emit purgeRequested(orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,12 +69,13 @@ void FormDatabaseCleanup::onPurgeStarted() {
|
|||||||
m_ui->m_progressBar->setValue(0);
|
m_ui->m_progressBar->setValue(0);
|
||||||
m_ui->m_progressBar->setEnabled(true);
|
m_ui->m_progressBar->setEnabled(true);
|
||||||
m_ui->m_btnBox->setEnabled(false);
|
m_ui->m_btnBox->setEnabled(false);
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Information, tr("Database cleanup is running."), tr("Database cleanup is running."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Information, tr("Database cleanup is running."),
|
||||||
|
tr("Database cleanup is running."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormDatabaseCleanup::onPurgeProgress(int progress, const QString& description) {
|
void FormDatabaseCleanup::onPurgeProgress(int progress, const QString& description) {
|
||||||
m_ui->m_progressBar->setValue(progress);
|
m_ui->m_progressBar->setValue(progress);
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Information, description, description);
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Information, description, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormDatabaseCleanup::onPurgeFinished(bool finished) {
|
void FormDatabaseCleanup::onPurgeFinished(bool finished) {
|
||||||
@ -82,10 +84,12 @@ void FormDatabaseCleanup::onPurgeFinished(bool finished) {
|
|||||||
m_ui->m_btnBox->setEnabled(true);
|
m_ui->m_btnBox->setEnabled(true);
|
||||||
|
|
||||||
if (finished) {
|
if (finished) {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Ok, tr("Database cleanup is completed."), tr("Database cleanup is completed."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
|
tr("Database cleanup is completed."),
|
||||||
|
tr("Database cleanup is completed."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Error, tr("Database cleanup failed."), tr("Database cleanup failed."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Error, tr("Database cleanup failed."), tr("Database cleanup failed."));
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDatabaseInfo();
|
loadDatabaseInfo();
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
FormMain::FormMain(QWidget* parent, Qt::WindowFlags f)
|
FormMain::FormMain(QWidget* parent, Qt::WindowFlags f)
|
||||||
: QMainWindow(parent, f), m_ui(new Ui::FormMain) {
|
: QMainWindow(parent, f), m_ui(new Ui::FormMain), m_trayMenu(nullptr), m_statusBar(nullptr) {
|
||||||
qDebug().nospace() << "Creating main application form in thread: \'" << QThread::currentThreadId() << "\'.";
|
qDebug().nospace() << "Creating main application form in thread: \'" << QThread::currentThreadId() << "\'.";
|
||||||
|
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
@ -358,7 +358,7 @@ void FormMain::updateAccountsMenu() {
|
|||||||
m_ui->m_menuAccounts->addMenu(root_menu);
|
m_ui->m_menuAccounts->addMenu(root_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ui->m_menuAccounts->actions().size() > 0) {
|
if (!m_ui->m_menuAccounts->actions().isEmpty()) {
|
||||||
m_ui->m_menuAccounts->addSeparator();
|
m_ui->m_menuAccounts->addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ void FormMain::restoreDatabaseSettings() {
|
|||||||
void FormMain::changeEvent(QEvent* event) {
|
void FormMain::changeEvent(QEvent* event) {
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::WindowStateChange: {
|
case QEvent::WindowStateChange: {
|
||||||
if (windowState() & Qt::WindowMinimized &&
|
if ((windowState() & Qt::WindowState::WindowMinimized) == Qt::WindowState::WindowMinimized &&
|
||||||
SystemTrayIcon::isSystemTrayActivated() &&
|
SystemTrayIcon::isSystemTrayActivated() &&
|
||||||
qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideMainWindowWhenMinimized)).toBool()) {
|
qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideMainWindowWhenMinimized)).toBool()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
#include "QFileDialog"
|
#include "QFileDialog"
|
||||||
|
|
||||||
FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget& parent) : QDialog(&parent),
|
FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget& parent) : QDialog(&parent),
|
||||||
m_shouldRestart(false) {
|
m_shouldRestart(false) {
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
m_btnRestart = m_ui.m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ActionRole);
|
m_btnRestart = m_ui.m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ActionRole);
|
||||||
m_ui.m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
m_ui.m_lblResult->setStatus(WidgetWithStatus::StatusType::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
||||||
setWindowIcon(qApp->icons()->fromTheme(QSL("document-import")));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("document-import")));
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||||
connect(m_btnRestart, &QPushButton::clicked, this, [=]() {
|
connect(m_btnRestart, &QPushButton::clicked, this, [=]() {
|
||||||
@ -42,11 +42,11 @@ void FormRestoreDatabaseSettings::performRestoration() {
|
|||||||
m_ui.m_listSettings->currentRow() >= 0 ? m_ui.m_listSettings->currentItem()->data(
|
m_ui.m_listSettings->currentRow() >= 0 ? m_ui.m_listSettings->currentItem()->data(
|
||||||
Qt::UserRole).toString() : QString());
|
Qt::UserRole).toString() : QString());
|
||||||
m_btnRestart->setEnabled(true);
|
m_btnRestart->setEnabled(true);
|
||||||
m_ui.m_lblResult->setStatus(WidgetWithStatus::Ok, tr("Restoration was initiated. Restart to proceed."),
|
m_ui.m_lblResult->setStatus(WidgetWithStatus::StatusType::Ok, tr("Restoration was initiated. Restart to proceed."),
|
||||||
tr("You need to restart application for restoration process to finish."));
|
tr("You need to restart application for restoration process to finish."));
|
||||||
}
|
}
|
||||||
catch (const ApplicationException& ex) {
|
catch (const ApplicationException& ex) {
|
||||||
m_ui.m_lblResult->setStatus(WidgetWithStatus::Error, ex.message(),
|
m_ui.m_lblResult->setStatus(WidgetWithStatus::StatusType::Error, ex.message(),
|
||||||
tr("Database and/or settings were not copied to restoration directory successully."));
|
tr("Database and/or settings were not copied to restoration directory successully."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +70,8 @@ void FormRestoreDatabaseSettings::selectFolder(QString folder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!folder.isEmpty()) {
|
if (!folder.isEmpty()) {
|
||||||
m_ui.m_lblSelectFolder->setStatus(WidgetWithStatus::Ok, QDir::toNativeSeparators(folder), tr("Good source directory is specified."));
|
m_ui.m_lblSelectFolder->setStatus(WidgetWithStatus::StatusType::Ok, QDir::toNativeSeparators(folder),
|
||||||
|
tr("Good source directory is specified."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "gui/settings/settingsshortcuts.h"
|
#include "gui/settings/settingsshortcuts.h"
|
||||||
|
|
||||||
FormSettings::FormSettings(QWidget& parent)
|
FormSettings::FormSettings(QWidget& parent)
|
||||||
: QDialog(&parent), m_panels(QList<SettingsPanel*>()), m_settings(*qApp->settings()) {
|
: QDialog(&parent), m_settings(*qApp->settings()) {
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
|
@ -43,8 +43,6 @@ FormUpdate::FormUpdate(QWidget* parent)
|
|||||||
checkForUpdates();
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
FormUpdate::~FormUpdate() {}
|
|
||||||
|
|
||||||
bool FormUpdate::isSelfUpdateSupported() const {
|
bool FormUpdate::isSelfUpdateSupported() const {
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||||
return true;
|
return true;
|
||||||
@ -54,7 +52,10 @@ bool FormUpdate::isSelfUpdateSupported() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormUpdate::checkForUpdates() {
|
void FormUpdate::checkForUpdates() {
|
||||||
connect(qApp->system(), &SystemFactory::updatesChecked, this, [this](QPair<QList<UpdateInfo>, QNetworkReply::NetworkError> update) {
|
connect(qApp->system(),
|
||||||
|
&SystemFactory::updatesChecked,
|
||||||
|
this,
|
||||||
|
[this](const QPair<QList<UpdateInfo>, QNetworkReply::NetworkError>& update) {
|
||||||
m_ui.m_buttonBox->setEnabled(true);
|
m_ui.m_buttonBox->setEnabled(true);
|
||||||
disconnect(qApp->system(), &SystemFactory::updatesChecked, nullptr, nullptr);
|
disconnect(qApp->system(), &SystemFactory::updatesChecked, nullptr, nullptr);
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ void FormUpdate::checkForUpdates() {
|
|||||||
//: Unknown release.
|
//: Unknown release.
|
||||||
m_ui.m_lblAvailableRelease->setText(tr("unknown"));
|
m_ui.m_lblAvailableRelease->setText(tr("unknown"));
|
||||||
m_ui.m_txtChanges->clear();
|
m_ui.m_txtChanges->clear();
|
||||||
m_ui.m_lblStatus->setStatus(WidgetWithStatus::Error,
|
m_ui.m_lblStatus->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Error: '%1'.").arg(NetworkFactory::networkErrorText(update.second)),
|
tr("Error: '%1'.").arg(NetworkFactory::networkErrorText(update.second)),
|
||||||
tr("List with updates was not\ndownloaded successfully."));
|
tr("List with updates was not\ndownloaded successfully."));
|
||||||
}
|
}
|
||||||
@ -78,7 +79,7 @@ void FormUpdate::checkForUpdates() {
|
|||||||
|
|
||||||
if (SystemFactory::isVersionNewer(m_updateInfo.m_availableVersion, APP_VERSION)) {
|
if (SystemFactory::isVersionNewer(m_updateInfo.m_availableVersion, APP_VERSION)) {
|
||||||
m_btnUpdate->setVisible(true);
|
m_btnUpdate->setVisible(true);
|
||||||
m_ui.m_lblStatus->setStatus(WidgetWithStatus::Ok,
|
m_ui.m_lblStatus->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
tr("New release available."),
|
tr("New release available."),
|
||||||
tr("This is new version which can be\ndownloaded."));
|
tr("This is new version which can be\ndownloaded."));
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ void FormUpdate::checkForUpdates() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui.m_lblStatus->setStatus(WidgetWithStatus::Warning,
|
m_ui.m_lblStatus->setStatus(WidgetWithStatus::StatusType::Warning,
|
||||||
tr("No new release available."),
|
tr("No new release available."),
|
||||||
tr("This release is not newer than\ncurrently installed one."));
|
tr("This release is not newer than\ncurrently installed one."));
|
||||||
}
|
}
|
||||||
@ -98,13 +99,13 @@ void FormUpdate::checkForUpdates() {
|
|||||||
|
|
||||||
void FormUpdate::updateProgress(qint64 bytes_received, qint64 bytes_total) {
|
void FormUpdate::updateProgress(qint64 bytes_received, qint64 bytes_total) {
|
||||||
if (bytes_received - m_lastDownloadedBytes > 500000 || m_lastDownloadedBytes == 0) {
|
if (bytes_received - m_lastDownloadedBytes > 500000 || m_lastDownloadedBytes == 0) {
|
||||||
m_ui.m_lblStatus->setStatus(WidgetWithStatus::Information,
|
m_ui.m_lblStatus->setStatus(WidgetWithStatus::StatusType::Information,
|
||||||
tr("Downloaded %1% (update size is %2 kB).").arg(QString::number(bytes_total ==
|
tr("Downloaded %1% (update size is %2 kB).").arg(QString::number(bytes_total == 0L
|
||||||
0 ? 0 : (bytes_received * 100.0) /
|
? 0L
|
||||||
bytes_total,
|
: (bytes_received * 100.0) / bytes_total,
|
||||||
'f',
|
'f',
|
||||||
2),
|
2),
|
||||||
QString::number(bytes_total / 1000,
|
QString::number(bytes_total / 1000.0,
|
||||||
'f',
|
'f',
|
||||||
2)),
|
2)),
|
||||||
tr("Downloading update..."));
|
tr("Downloading update..."));
|
||||||
@ -165,20 +166,21 @@ void FormUpdate::loadAvailableFiles() {
|
|||||||
m_ui.m_tabInfo->setCurrentIndex(1);
|
m_ui.m_tabInfo->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormUpdate::updateCompleted(QNetworkReply::NetworkError status, QByteArray contents) {
|
void FormUpdate::updateCompleted(QNetworkReply::NetworkError status, const QByteArray& contents) {
|
||||||
qDebug("Download of application update file was completed with code '%d'.", status);
|
qDebug("Download of application update file was completed with code '%d'.", status);
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case QNetworkReply::NoError:
|
case QNetworkReply::NoError:
|
||||||
saveUpdateFile(contents);
|
saveUpdateFile(contents);
|
||||||
m_ui.m_lblStatus->setStatus(WidgetWithStatus::Ok, tr("Downloaded successfully"),
|
m_ui.m_lblStatus->setStatus(WidgetWithStatus::StatusType::Ok, tr("Downloaded successfully"),
|
||||||
tr("Package was downloaded successfully.\nYou can install it now."));
|
tr("Package was downloaded successfully.\nYou can install it now."));
|
||||||
m_btnUpdate->setText(tr("Install"));
|
m_btnUpdate->setText(tr("Install"));
|
||||||
m_btnUpdate->setEnabled(true);
|
m_btnUpdate->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m_ui.m_lblStatus->setStatus(WidgetWithStatus::Error, tr("Error occured"), tr("Error occured during downloading of the package."));
|
m_ui.m_lblStatus->setStatus(WidgetWithStatus::StatusType::Error, tr("Error occured"),
|
||||||
|
tr("Error occured during downloading of the package."));
|
||||||
m_btnUpdate->setText(tr("Error occured"));
|
m_btnUpdate->setText(tr("Error occured"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -207,7 +209,7 @@ void FormUpdate::startUpdate() {
|
|||||||
nullptr,
|
nullptr,
|
||||||
SW_NORMAL);
|
SW_NORMAL);
|
||||||
|
|
||||||
if (exec_result <= (HINSTANCE)32) {
|
if (exec_result <= HINSTANCE(32)) {
|
||||||
qDebug("External updater was not launched due to error.");
|
qDebug("External updater was not launched due to error.");
|
||||||
qApp->showGuiMessage(tr("Cannot update application"),
|
qApp->showGuiMessage(tr("Cannot update application"),
|
||||||
tr("Cannot launch external updater. Update application manually."),
|
tr("Cannot launch external updater. Update application manually."),
|
||||||
|
@ -20,7 +20,6 @@ class RSSGUARD_DLLSPEC FormUpdate : public QDialog {
|
|||||||
|
|
||||||
// Constructors and destructors.
|
// Constructors and destructors.
|
||||||
explicit FormUpdate(QWidget* parent);
|
explicit FormUpdate(QWidget* parent);
|
||||||
virtual ~FormUpdate();
|
|
||||||
|
|
||||||
// Returns true if application can self-update
|
// Returns true if application can self-update
|
||||||
// on current platform.
|
// on current platform.
|
||||||
@ -33,7 +32,7 @@ class RSSGUARD_DLLSPEC FormUpdate : public QDialog {
|
|||||||
void startUpdate();
|
void startUpdate();
|
||||||
|
|
||||||
void updateProgress(qint64 bytes_received, qint64 bytes_total);
|
void updateProgress(qint64 bytes_received, qint64 bytes_total);
|
||||||
void updateCompleted(QNetworkReply::NetworkError status, QByteArray contents);
|
void updateCompleted(QNetworkReply::NetworkError status, const QByteArray& contents);
|
||||||
void saveUpdateFile(const QByteArray& file_contents);
|
void saveUpdateFile(const QByteArray& file_contents);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
EditTableView::EditTableView(QWidget* parent) : QTableView(parent) {}
|
EditTableView::EditTableView(QWidget* parent) : QTableView(parent) {}
|
||||||
|
|
||||||
void EditTableView::keyPressEvent(QKeyEvent* event) {
|
void EditTableView::keyPressEvent(QKeyEvent* event) {
|
||||||
if (model() && event->key() == Qt::Key_Delete) {
|
if (model() != nullptr && event->key() == Qt::Key::Key_Delete) {
|
||||||
removeSelected();
|
removeSelected();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
@ -17,7 +17,7 @@ void EditTableView::keyPressEvent(QKeyEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditTableView::removeSelected() {
|
void EditTableView::removeSelected() {
|
||||||
if (!model() || !selectionModel() || !selectionModel()->hasSelection()) {
|
if (model() != nullptr || selectionModel() != nullptr || !selectionModel()->hasSelection()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void FeedMessageViewer::setListHeadersEnabled(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FeedMessageViewer::switchFeedComponentVisibility() {
|
void FeedMessageViewer::switchFeedComponentVisibility() {
|
||||||
QAction* sen = qobject_cast<QAction*>(sender());
|
auto* sen = qobject_cast<QAction*>(sender());
|
||||||
|
|
||||||
if (sen != nullptr) {
|
if (sen != nullptr) {
|
||||||
m_feedsWidget->setVisible(sen->isChecked());
|
m_feedsWidget->setVisible(sen->isChecked());
|
||||||
@ -237,9 +237,9 @@ void FeedMessageViewer::initializeViews() {
|
|||||||
m_messageSplitter = new QSplitter(Qt::Vertical, this);
|
m_messageSplitter = new QSplitter(Qt::Vertical, this);
|
||||||
|
|
||||||
// Instantiate needed components.
|
// Instantiate needed components.
|
||||||
QVBoxLayout* central_layout = new QVBoxLayout(this);
|
auto* central_layout = new QVBoxLayout(this);
|
||||||
QVBoxLayout* feed_layout = new QVBoxLayout(m_feedsWidget);
|
auto* feed_layout = new QVBoxLayout(m_feedsWidget);
|
||||||
QVBoxLayout* message_layout = new QVBoxLayout(m_messagesWidget);
|
auto* message_layout = new QVBoxLayout(m_messagesWidget);
|
||||||
|
|
||||||
// Set layout properties.
|
// Set layout properties.
|
||||||
central_layout->setMargin(0);
|
central_layout->setMargin(0);
|
||||||
|
@ -16,8 +16,6 @@ FeedsToolBar::FeedsToolBar(const QString& title, QWidget* parent) : BaseToolBar(
|
|||||||
setContentsMargins(margins);
|
setContentsMargins(margins);
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedsToolBar::~FeedsToolBar() {}
|
|
||||||
|
|
||||||
QList<QAction*> FeedsToolBar::availableActions() const {
|
QList<QAction*> FeedsToolBar::availableActions() const {
|
||||||
return qApp->userActions();
|
return qApp->userActions();
|
||||||
}
|
}
|
||||||
@ -45,17 +43,17 @@ QList<QAction*> FeedsToolBar::getSpecificActions(const QStringList& actions) {
|
|||||||
}
|
}
|
||||||
else if (action_name == SEPARATOR_ACTION_NAME) {
|
else if (action_name == SEPARATOR_ACTION_NAME) {
|
||||||
// Add new separator.
|
// Add new separator.
|
||||||
QAction* act = new QAction(this);
|
auto* act = new QAction(this);
|
||||||
|
|
||||||
act->setSeparator(true);
|
act->setSeparator(true);
|
||||||
spec_actions.append(act);
|
spec_actions.append(act);
|
||||||
}
|
}
|
||||||
else if (action_name == SPACER_ACTION_NAME) {
|
else if (action_name == SPACER_ACTION_NAME) {
|
||||||
// Add new spacer.
|
// Add new spacer.
|
||||||
QWidget* spacer = new QWidget(this);
|
auto* spacer = new QWidget(this);
|
||||||
|
|
||||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
QWidgetAction* action = new QWidgetAction(this);
|
auto* action = new QWidgetAction(this);
|
||||||
|
|
||||||
action->setDefaultWidget(spacer);
|
action->setDefaultWidget(spacer);
|
||||||
action->setIcon(qApp->icons()->fromTheme(QSL("system-search")));
|
action->setIcon(qApp->icons()->fromTheme(QSL("system-search")));
|
||||||
@ -71,17 +69,16 @@ QList<QAction*> FeedsToolBar::getSpecificActions(const QStringList& actions) {
|
|||||||
void FeedsToolBar::loadSpecificActions(const QList<QAction*>& actions) {
|
void FeedsToolBar::loadSpecificActions(const QList<QAction*>& actions) {
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
foreach (QAction* act, actions) {
|
for (QAction* act : actions) {
|
||||||
addAction(act);
|
addAction(act);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList FeedsToolBar::defaultActions() const {
|
QStringList FeedsToolBar::defaultActions() const {
|
||||||
return QString(GUI::FeedsToolbarActionsDef).split(',',
|
return QString(GUI::FeedsToolbarActionsDef).split(',', QString::SkipEmptyParts);
|
||||||
QString::SkipEmptyParts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList FeedsToolBar::savedActions() const {
|
QStringList FeedsToolBar::savedActions() const {
|
||||||
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::FeedsToolbarActions)).toString().split(',',
|
return qApp->settings()->value(GROUP(GUI),
|
||||||
QString::SkipEmptyParts);
|
SETTING(GUI::FeedsToolbarActions)).toString().split(',', QString::SkipEmptyParts);
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,7 @@ class FeedsToolBar : public BaseToolBar {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit FeedsToolBar(const QString& title, QWidget* parent = nullptr);
|
||||||
// Constructors and destructors.
|
|
||||||
explicit FeedsToolBar(const QString& title, QWidget* parent = 0);
|
|
||||||
virtual ~FeedsToolBar();
|
|
||||||
|
|
||||||
QList<QAction*> availableActions() const;
|
QList<QAction*> availableActions() const;
|
||||||
QList<QAction*> changeableActions() const;
|
QList<QAction*> changeableActions() const;
|
||||||
|
@ -20,8 +20,6 @@ LabelWithStatus::LabelWithStatus(QWidget* parent)
|
|||||||
m_layout->addWidget(m_btnStatus);
|
m_layout->addWidget(m_btnStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelWithStatus::~LabelWithStatus() {}
|
|
||||||
|
|
||||||
void LabelWithStatus::setStatus(WidgetWithStatus::StatusType status,
|
void LabelWithStatus::setStatus(WidgetWithStatus::StatusType status,
|
||||||
const QString& label_text,
|
const QString& label_text,
|
||||||
const QString& status_text) {
|
const QString& status_text) {
|
||||||
|
@ -11,18 +11,16 @@ class LabelWithStatus : public WidgetWithStatus {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit LabelWithStatus(QWidget* parent = nullptr);
|
||||||
// Constructors and destructors.
|
|
||||||
explicit LabelWithStatus(QWidget* parent = 0);
|
|
||||||
virtual ~LabelWithStatus();
|
|
||||||
|
|
||||||
void setStatus(StatusType status, const QString& label_text, const QString& status_text);
|
void setStatus(StatusType status, const QString& label_text, const QString& status_text);
|
||||||
|
|
||||||
// Access to label.
|
// Access to label.
|
||||||
inline QLabel* label() const {
|
QLabel* label() const;
|
||||||
return static_cast<QLabel*>(m_wdgInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline QLabel* LabelWithStatus::label() const {
|
||||||
|
return static_cast<QLabel*>(m_wdgInput);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // LABELWITHSTATUS_H
|
#endif // LABELWITHSTATUS_H
|
||||||
|
@ -21,5 +21,3 @@ LineEditWithStatus::LineEditWithStatus(QWidget* parent)
|
|||||||
m_layout->addWidget(m_wdgInput);
|
m_layout->addWidget(m_wdgInput);
|
||||||
m_layout->addWidget(m_btnStatus);
|
m_layout->addWidget(m_btnStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
LineEditWithStatus::~LineEditWithStatus() {}
|
|
||||||
|
@ -11,16 +11,14 @@ class LineEditWithStatus : public WidgetWithStatus {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit LineEditWithStatus(QWidget* parent = nullptr);
|
||||||
// Constructors and destructors.
|
|
||||||
explicit LineEditWithStatus(QWidget* parent = 0);
|
|
||||||
virtual ~LineEditWithStatus();
|
|
||||||
|
|
||||||
// Access to line edit.
|
// Access to line edit.
|
||||||
inline BaseLineEdit* lineEdit() const {
|
BaseLineEdit* lineEdit() const;
|
||||||
return static_cast<BaseLineEdit*>(m_wdgInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline BaseLineEdit* LineEditWithStatus::lineEdit() const {
|
||||||
|
return static_cast<BaseLineEdit*>(m_wdgInput);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // LINEEDITWITHSTATUS_H
|
#endif // LINEEDITWITHSTATUS_H
|
||||||
|
@ -14,11 +14,9 @@
|
|||||||
|
|
||||||
MessageBox::MessageBox(QWidget* parent) : QMessageBox(parent) {}
|
MessageBox::MessageBox(QWidget* parent) : QMessageBox(parent) {}
|
||||||
|
|
||||||
MessageBox::~MessageBox() {}
|
|
||||||
|
|
||||||
void MessageBox::setIcon(QMessageBox::Icon icon) {
|
void MessageBox::setIcon(QMessageBox::Icon icon) {
|
||||||
// Determine correct status icon size.
|
// Determine correct status icon size.
|
||||||
const int icon_size = qApp->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this);
|
const int icon_size = qApp->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, nullptr, this);
|
||||||
|
|
||||||
// Setup status icon.
|
// Setup status icon.
|
||||||
setIconPixmap(iconForStatus(icon).pixmap(icon_size, icon_size));
|
setIconPixmap(iconForStatus(icon).pixmap(icon_size, icon_size));
|
||||||
@ -26,7 +24,7 @@ void MessageBox::setIcon(QMessageBox::Icon icon) {
|
|||||||
|
|
||||||
void MessageBox::setCheckBox(QMessageBox* msg_box, const QString& text, bool* data) {
|
void MessageBox::setCheckBox(QMessageBox* msg_box, const QString& text, bool* data) {
|
||||||
// Add "don't show this again checkbox.
|
// Add "don't show this again checkbox.
|
||||||
QCheckBox* check_box = new QCheckBox(msg_box);
|
auto* check_box = new QCheckBox(msg_box);
|
||||||
|
|
||||||
check_box->setChecked(*data);
|
check_box->setChecked(*data);
|
||||||
check_box->setText(text);
|
check_box->setText(text);
|
||||||
@ -50,7 +48,6 @@ QIcon MessageBox::iconForStatus(QMessageBox::Icon status) {
|
|||||||
case QMessageBox::Question:
|
case QMessageBox::Question:
|
||||||
return qApp->icons()->fromTheme(QSL("dialog-question"));
|
return qApp->icons()->fromTheme(QSL("dialog-question"));
|
||||||
|
|
||||||
case QMessageBox::NoIcon:
|
|
||||||
default:
|
default:
|
||||||
return QIcon();
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,7 @@ class MessageBox : public QMessageBox {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors and destructors.
|
// Constructors and destructors.
|
||||||
explicit MessageBox(QWidget* parent = 0);
|
explicit MessageBox(QWidget* parent = nullptr);
|
||||||
virtual ~MessageBox();
|
|
||||||
|
|
||||||
// Custom icon setting.
|
// Custom icon setting.
|
||||||
void setIcon(Icon icon);
|
void setIcon(Icon icon);
|
||||||
|
@ -102,7 +102,7 @@ void MessagePreviewer::createConnections() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagePreviewer::MessagePreviewer(QWidget* parent) : QWidget(parent), m_pictures(QStringList()) {
|
MessagePreviewer::MessagePreviewer(QWidget* parent) : QWidget(parent) {
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
m_ui.m_txtMessage->viewport()->setAutoFillBackground(true);
|
m_ui.m_txtMessage->viewport()->setAutoFillBackground(true);
|
||||||
m_toolBar = new QToolBar(this);
|
m_toolBar = new QToolBar(this);
|
||||||
@ -203,8 +203,8 @@ void MessagePreviewer::switchMessageImportance(bool checked) {
|
|||||||
bool MessagePreviewer::eventFilter(QObject* watched, QEvent* event) {
|
bool MessagePreviewer::eventFilter(QObject* watched, QEvent* event) {
|
||||||
Q_UNUSED(watched)
|
Q_UNUSED(watched)
|
||||||
|
|
||||||
if (event->type() == QEvent::KeyPress) {
|
if (event->type() == QEvent::Type::KeyPress) {
|
||||||
QKeyEvent* key_event = static_cast<QKeyEvent*>(event);
|
auto* key_event = static_cast<QKeyEvent*>(event);
|
||||||
|
|
||||||
if (key_event->matches(QKeySequence::StandardKey::Find)) {
|
if (key_event->matches(QKeySequence::StandardKey::Find)) {
|
||||||
m_ui.m_searchWidget->clear();
|
m_ui.m_searchWidget->clear();
|
||||||
|
@ -3,5 +3,3 @@
|
|||||||
#include "gui/messagessearchlineedit.h"
|
#include "gui/messagessearchlineedit.h"
|
||||||
|
|
||||||
MessagesSearchLineEdit::MessagesSearchLineEdit(QWidget* parent) : BaseLineEdit(parent) {}
|
MessagesSearchLineEdit::MessagesSearchLineEdit(QWidget* parent) : BaseLineEdit(parent) {}
|
||||||
|
|
||||||
MessagesSearchLineEdit::~MessagesSearchLineEdit() {}
|
|
||||||
|
@ -11,10 +11,7 @@ class MessagesSearchLineEdit : public BaseLineEdit {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit MessagesSearchLineEdit(QWidget* parent = nullptr);
|
||||||
// Constructors and destructors.
|
|
||||||
explicit MessagesSearchLineEdit(QWidget* parent = 0);
|
|
||||||
virtual ~MessagesSearchLineEdit();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MESSAGESEARCHLINEEDIT_H
|
#endif // MESSAGESEARCHLINEEDIT_H
|
||||||
|
@ -18,8 +18,6 @@ MessagesToolBar::MessagesToolBar(const QString& title, QWidget* parent)
|
|||||||
initializeHighlighter();
|
initializeHighlighter();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagesToolBar::~MessagesToolBar() {}
|
|
||||||
|
|
||||||
QList<QAction*> MessagesToolBar::availableActions() const {
|
QList<QAction*> MessagesToolBar::availableActions() const {
|
||||||
QList<QAction*> available_actions = qApp->userActions();
|
QList<QAction*> available_actions = qApp->userActions();
|
||||||
available_actions.append(m_actionSearchMessages);
|
available_actions.append(m_actionSearchMessages);
|
||||||
@ -47,7 +45,7 @@ QList<QAction*> MessagesToolBar::getSpecificActions(const QStringList& actions)
|
|||||||
|
|
||||||
// Iterate action names and add respectable actions into the toolbar.
|
// Iterate action names and add respectable actions into the toolbar.
|
||||||
foreach (const QString& action_name, actions) {
|
foreach (const QString& action_name, actions) {
|
||||||
QAction* matching_action = findMatchingAction(action_name, available_actions);
|
auto* matching_action = findMatchingAction(action_name, available_actions);
|
||||||
|
|
||||||
if (matching_action != nullptr) {
|
if (matching_action != nullptr) {
|
||||||
// Add existing standard action.
|
// Add existing standard action.
|
||||||
@ -55,7 +53,7 @@ QList<QAction*> MessagesToolBar::getSpecificActions(const QStringList& actions)
|
|||||||
}
|
}
|
||||||
else if (action_name == SEPARATOR_ACTION_NAME) {
|
else if (action_name == SEPARATOR_ACTION_NAME) {
|
||||||
// Add new separator.
|
// Add new separator.
|
||||||
QAction* act = new QAction(this);
|
auto* act = new QAction(this);
|
||||||
|
|
||||||
act->setSeparator(true);
|
act->setSeparator(true);
|
||||||
spec_actions.append(act);
|
spec_actions.append(act);
|
||||||
@ -70,10 +68,10 @@ QList<QAction*> MessagesToolBar::getSpecificActions(const QStringList& actions)
|
|||||||
}
|
}
|
||||||
else if (action_name == SPACER_ACTION_NAME) {
|
else if (action_name == SPACER_ACTION_NAME) {
|
||||||
// Add new spacer.
|
// Add new spacer.
|
||||||
QWidget* spacer = new QWidget(this);
|
auto* spacer = new QWidget(this);
|
||||||
|
|
||||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
QWidgetAction* action = new QWidgetAction(this);
|
auto* action = new QWidgetAction(this);
|
||||||
|
|
||||||
action->setDefaultWidget(spacer);
|
action->setDefaultWidget(spacer);
|
||||||
action->setIcon(qApp->icons()->fromTheme(QSL("go-jump")));
|
action->setIcon(qApp->icons()->fromTheme(QSL("go-jump")));
|
||||||
|
@ -16,15 +16,10 @@ class MessagesToolBar : public BaseToolBar {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit MessagesToolBar(const QString& title, QWidget* parent = nullptr);
|
||||||
// Constructors and destructors.
|
|
||||||
explicit MessagesToolBar(const QString& title, QWidget* parent = 0);
|
|
||||||
virtual ~MessagesToolBar();
|
|
||||||
|
|
||||||
// External access to search line edit.
|
// External access to search line edit.
|
||||||
inline MessagesSearchLineEdit* searchLineEdit() {
|
inline MessagesSearchLineEdit* searchLineEdit();
|
||||||
return m_txtSearchMessages;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implementation of BaseToolBar interface.
|
// Implementation of BaseToolBar interface.
|
||||||
QList<QAction*> availableActions() const;
|
QList<QAction*> availableActions() const;
|
||||||
@ -65,4 +60,8 @@ class MessagesToolBar : public BaseToolBar {
|
|||||||
MessagesSearchLineEdit* m_txtSearchMessages;
|
MessagesSearchLineEdit* m_txtSearchMessages;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline MessagesSearchLineEdit* MessagesToolBar::searchLineEdit() {
|
||||||
|
return m_txtSearchMessages;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NEWSTOOLBAR_H
|
#endif // NEWSTOOLBAR_H
|
||||||
|
@ -520,7 +520,7 @@ void MessagesView::selectNextUnreadItem() {
|
|||||||
void MessagesView::searchMessages(const QString& pattern) {
|
void MessagesView::searchMessages(const QString& pattern) {
|
||||||
m_proxyModel->setFilterRegExp(pattern);
|
m_proxyModel->setFilterRegExp(pattern);
|
||||||
|
|
||||||
if (selectionModel()->selectedRows().size() == 0) {
|
if (selectionModel()->selectedRows().isEmpty()) {
|
||||||
emit currentMessageRemoved();
|
emit currentMessageRemoved();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -534,7 +534,7 @@ void MessagesView::filterMessages(MessagesModel::MessageHighlighter filter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MessagesView::openSelectedMessagesWithExternalTool() {
|
void MessagesView::openSelectedMessagesWithExternalTool() {
|
||||||
QAction* sndr = qobject_cast<QAction*>(sender());
|
auto* sndr = qobject_cast<QAction*>(sender());
|
||||||
|
|
||||||
if (sndr != nullptr) {
|
if (sndr != nullptr) {
|
||||||
auto tool = sndr->data().value<ExternalTool>();
|
auto tool = sndr->data().value<ExternalTool>();
|
||||||
|
@ -9,21 +9,19 @@
|
|||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
NewspaperPreviewer::NewspaperPreviewer(RootItem* root, QList<Message> messages, QWidget* parent)
|
NewspaperPreviewer::NewspaperPreviewer(RootItem* root, QList<Message> messages, QWidget* parent)
|
||||||
: TabContent(parent), m_ui(new Ui::NewspaperPreviewer), m_root(root), m_messages(messages) {
|
: TabContent(parent), m_ui(new Ui::NewspaperPreviewer), m_root(root), m_messages(std::move(messages)) {
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
connect(m_ui->m_btnShowMoreMessages, &QPushButton::clicked, this, &NewspaperPreviewer::showMoreMessages);
|
connect(m_ui->m_btnShowMoreMessages, &QPushButton::clicked, this, &NewspaperPreviewer::showMoreMessages);
|
||||||
showMoreMessages();
|
showMoreMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
NewspaperPreviewer::~NewspaperPreviewer() {}
|
|
||||||
|
|
||||||
void NewspaperPreviewer::showMoreMessages() {
|
void NewspaperPreviewer::showMoreMessages() {
|
||||||
if (!m_root.isNull()) {
|
if (!m_root.isNull()) {
|
||||||
int current_scroll = m_ui->scrollArea->verticalScrollBar()->value();
|
int current_scroll = m_ui->scrollArea->verticalScrollBar()->value();
|
||||||
|
|
||||||
for (int i = 0; i < 10 && !m_messages.isEmpty(); i++) {
|
for (int i = 0; i < 10 && !m_messages.isEmpty(); i++) {
|
||||||
Message msg = m_messages.takeFirst();
|
Message msg = m_messages.takeFirst();
|
||||||
MessagePreviewer* prev = new MessagePreviewer(this);
|
auto* prev = new MessagePreviewer(this);
|
||||||
QMargins margins = prev->layout()->contentsMargins();
|
QMargins margins = prev->layout()->contentsMargins();
|
||||||
|
|
||||||
connect(prev, &MessagePreviewer::requestMessageListReload, this, &NewspaperPreviewer::requestMessageListReload);
|
connect(prev, &MessagePreviewer::requestMessageListReload, this, &NewspaperPreviewer::requestMessageListReload);
|
||||||
|
@ -24,8 +24,7 @@ class NewspaperPreviewer : public TabContent {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NewspaperPreviewer(RootItem* root, QList<Message> messages, QWidget* parent = 0);
|
explicit NewspaperPreviewer(RootItem* root, QList<Message> messages, QWidget* parent = nullptr);
|
||||||
virtual ~NewspaperPreviewer();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showMoreMessages();
|
void showMoreMessages();
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
PlainToolButton::PlainToolButton(QWidget* parent) : QToolButton(parent), m_padding(0) {}
|
PlainToolButton::PlainToolButton(QWidget* parent) : QToolButton(parent), m_padding(0) {}
|
||||||
|
|
||||||
PlainToolButton::~PlainToolButton() {}
|
|
||||||
|
|
||||||
void PlainToolButton::paintEvent(QPaintEvent* e) {
|
void PlainToolButton::paintEvent(QPaintEvent* e) {
|
||||||
Q_UNUSED(e)
|
Q_UNUSED(e)
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
|
@ -9,10 +9,7 @@ class PlainToolButton : public QToolButton {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit PlainToolButton(QWidget* parent = nullptr);
|
||||||
// Contructors and destructors.
|
|
||||||
explicit PlainToolButton(QWidget* parent = 0);
|
|
||||||
virtual ~PlainToolButton();
|
|
||||||
|
|
||||||
// Padding changers.
|
// Padding changers.
|
||||||
int padding() const;
|
int padding() const;
|
||||||
|
@ -54,48 +54,48 @@ void SettingsDatabase::mysqlTestConnection() {
|
|||||||
switch (error_code) {
|
switch (error_code) {
|
||||||
case DatabaseFactory::MySQLError::MySQLOk:
|
case DatabaseFactory::MySQLError::MySQLOk:
|
||||||
case DatabaseFactory::MySQLError::MySQLUnknownDatabase:
|
case DatabaseFactory::MySQLError::MySQLUnknownDatabase:
|
||||||
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::Ok, interpretation, interpretation);
|
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::StatusType::Ok, interpretation, interpretation);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::Error, interpretation, interpretation);
|
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::StatusType::Error, interpretation, interpretation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDatabase::onMysqlHostnameChanged(const QString& new_hostname) {
|
void SettingsDatabase::onMysqlHostnameChanged(const QString& new_hostname) {
|
||||||
if (new_hostname.isEmpty()) {
|
if (new_hostname.isEmpty()) {
|
||||||
m_ui->m_txtMysqlHostname->setStatus(LineEditWithStatus::Warning, tr("Hostname is empty."));
|
m_ui->m_txtMysqlHostname->setStatus(LineEditWithStatus::StatusType::Warning, tr("Hostname is empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtMysqlHostname->setStatus(LineEditWithStatus::Ok, tr("Hostname looks ok."));
|
m_ui->m_txtMysqlHostname->setStatus(LineEditWithStatus::StatusType::Ok, tr("Hostname looks ok."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDatabase::onMysqlUsernameChanged(const QString& new_username) {
|
void SettingsDatabase::onMysqlUsernameChanged(const QString& new_username) {
|
||||||
if (new_username.isEmpty()) {
|
if (new_username.isEmpty()) {
|
||||||
m_ui->m_txtMysqlUsername->setStatus(LineEditWithStatus::Warning, tr("Username is empty."));
|
m_ui->m_txtMysqlUsername->setStatus(LineEditWithStatus::StatusType::Warning, tr("Username is empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtMysqlUsername->setStatus(LineEditWithStatus::Ok, tr("Username looks ok."));
|
m_ui->m_txtMysqlUsername->setStatus(LineEditWithStatus::StatusType::Ok, tr("Username looks ok."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDatabase::onMysqlPasswordChanged(const QString& new_password) {
|
void SettingsDatabase::onMysqlPasswordChanged(const QString& new_password) {
|
||||||
if (new_password.isEmpty()) {
|
if (new_password.isEmpty()) {
|
||||||
m_ui->m_txtMysqlPassword->setStatus(LineEditWithStatus::Warning, tr("Password is empty."));
|
m_ui->m_txtMysqlPassword->setStatus(LineEditWithStatus::StatusType::Warning, tr("Password is empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtMysqlPassword->setStatus(LineEditWithStatus::Ok, tr("Password looks ok."));
|
m_ui->m_txtMysqlPassword->setStatus(LineEditWithStatus::StatusType::Ok, tr("Password looks ok."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDatabase::onMysqlDatabaseChanged(const QString& new_database) {
|
void SettingsDatabase::onMysqlDatabaseChanged(const QString& new_database) {
|
||||||
if (new_database.isEmpty()) {
|
if (new_database.isEmpty()) {
|
||||||
m_ui->m_txtMysqlDatabase->setStatus(LineEditWithStatus::Warning, tr("Working database is empty."));
|
m_ui->m_txtMysqlDatabase->setStatus(LineEditWithStatus::StatusType::Warning, tr("Working database is empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtMysqlDatabase->setStatus(LineEditWithStatus::Ok, tr("Working database is ok."));
|
m_ui->m_txtMysqlDatabase->setStatus(LineEditWithStatus::StatusType::Ok, tr("Working database is ok."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ void SettingsDatabase::switchMysqlPasswordVisiblity(bool visible) {
|
|||||||
void SettingsDatabase::loadSettings() {
|
void SettingsDatabase::loadSettings() {
|
||||||
onBeginLoadSettings();
|
onBeginLoadSettings();
|
||||||
m_ui->m_checkUseTransactions->setChecked(qApp->settings()->value(GROUP(Database), SETTING(Database::UseTransactions)).toBool());
|
m_ui->m_checkUseTransactions->setChecked(qApp->settings()->value(GROUP(Database), SETTING(Database::UseTransactions)).toBool());
|
||||||
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::Information, tr("No connection test triggered so far."),
|
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::StatusType::Information, tr("No connection test triggered so far."),
|
||||||
tr("You did not executed any connection test yet."));
|
tr("You did not executed any connection test yet."));
|
||||||
|
|
||||||
// Load SQLite.
|
// Load SQLite.
|
||||||
|
@ -66,8 +66,8 @@ SettingsGui::~SettingsGui() {
|
|||||||
bool SettingsGui::eventFilter(QObject* obj, QEvent* e) {
|
bool SettingsGui::eventFilter(QObject* obj, QEvent* e) {
|
||||||
Q_UNUSED(obj)
|
Q_UNUSED(obj)
|
||||||
|
|
||||||
if (e->type() == QEvent::Drop) {
|
if (e->type() == QEvent::Type::Drop) {
|
||||||
QDropEvent* drop_event = static_cast<QDropEvent*>(e);
|
auto* drop_event = static_cast<QDropEvent*>(e);
|
||||||
|
|
||||||
if (drop_event->keyboardModifiers() != Qt::NoModifier) {
|
if (drop_event->keyboardModifiers() != Qt::NoModifier) {
|
||||||
drop_event->setDropAction(Qt::MoveAction);
|
drop_event->setDropAction(Qt::MoveAction);
|
||||||
@ -118,7 +118,7 @@ void SettingsGui::loadSettings() {
|
|||||||
m_ui->m_checkMonochromeIcons->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::MonochromeTrayIcon)).toBool());
|
m_ui->m_checkMonochromeIcons->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::MonochromeTrayIcon)).toBool());
|
||||||
|
|
||||||
// Mark active theme.
|
// Mark active theme.
|
||||||
if (current_theme == QSL(APP_NO_THEME)) {
|
if (current_theme == QL1S(APP_NO_THEME)) {
|
||||||
// Because "no icon theme" lies at the index 0.
|
// Because "no icon theme" lies at the index 0.
|
||||||
m_ui->m_cmbIconTheme->setCurrentIndex(0);
|
m_ui->m_cmbIconTheme->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<enum>QTabWidget::North</enum>
|
<enum>QTabWidget::North</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="m_tabIconSkin">
|
<widget class="QWidget" name="m_tabIconSkin">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -216,7 +216,7 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="m_checkCloseTabsDoubleClick">
|
<widget class="QCheckBox" name="m_checkCloseTabsDoubleClick">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Right mouse button double-click</string>
|
<string>Left mouse button double-click</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -33,7 +33,7 @@ void SettingsLocalization::loadSettings() {
|
|||||||
onBeginLoadSettings();
|
onBeginLoadSettings();
|
||||||
|
|
||||||
foreach (const Language& language, qApp->localization()->installedLanguages()) {
|
foreach (const Language& language, qApp->localization()->installedLanguages()) {
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem(m_ui->m_treeLanguages);
|
auto* item = new QTreeWidgetItem(m_ui->m_treeLanguages);
|
||||||
|
|
||||||
item->setText(0, language.m_name);
|
item->setText(0, language.m_name);
|
||||||
item->setText(1, language.m_code);
|
item->setText(1, language.m_code);
|
||||||
|
@ -135,7 +135,7 @@ QList<QAction*> StatusBar::getSpecificActions(const QStringList& actions) {
|
|||||||
}
|
}
|
||||||
else if (matching_action != nullptr) {
|
else if (matching_action != nullptr) {
|
||||||
// Add originally toolbar action.
|
// Add originally toolbar action.
|
||||||
PlainToolButton* tool_button = new PlainToolButton(this);
|
auto* tool_button = new PlainToolButton(this);
|
||||||
|
|
||||||
tool_button->reactOnActionChange(matching_action);
|
tool_button->reactOnActionChange(matching_action);
|
||||||
widget_to_add = tool_button;
|
widget_to_add = tool_button;
|
||||||
|
@ -4,14 +4,12 @@
|
|||||||
|
|
||||||
StyledItemDelegateWithoutFocus::StyledItemDelegateWithoutFocus(QObject* parent) : QStyledItemDelegate(parent) {}
|
StyledItemDelegateWithoutFocus::StyledItemDelegateWithoutFocus(QObject* parent) : QStyledItemDelegate(parent) {}
|
||||||
|
|
||||||
StyledItemDelegateWithoutFocus::~StyledItemDelegateWithoutFocus() {}
|
|
||||||
|
|
||||||
void StyledItemDelegateWithoutFocus::paint(QPainter* painter, const QStyleOptionViewItem& option,
|
void StyledItemDelegateWithoutFocus::paint(QPainter* painter, const QStyleOptionViewItem& option,
|
||||||
const QModelIndex& index) const {
|
const QModelIndex& index) const {
|
||||||
QStyleOptionViewItem itemOption(option);
|
QStyleOptionViewItem itemOption(option);
|
||||||
|
|
||||||
if (itemOption.state & QStyle::State_HasFocus) {
|
if ((itemOption.state & QStyle::StateFlag::State_HasFocus) == QStyle::StateFlag::State_HasFocus) {
|
||||||
itemOption.state = itemOption.state ^ QStyle::State_HasFocus;
|
itemOption.state = itemOption.state ^ QStyle::StateFlag::State_HasFocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStyledItemDelegate::paint(painter, itemOption, index);
|
QStyledItemDelegate::paint(painter, itemOption, index);
|
||||||
|
@ -10,27 +10,24 @@ class StyledItemDelegateWithoutFocus : public QStyledItemDelegate {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit StyledItemDelegateWithoutFocus(QObject* parent = nullptr);
|
||||||
|
|
||||||
// Constructors.
|
QSize sizeHint ( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||||
explicit StyledItemDelegateWithoutFocus(QObject* parent = 0);
|
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||||
virtual ~StyledItemDelegateWithoutFocus();
|
|
||||||
|
|
||||||
QSize sizeHint ( const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
};
|
||||||
{
|
|
||||||
QSize siz = QStyledItemDelegate::sizeHint(option, index);
|
|
||||||
|
|
||||||
/* QStyleOptionViewItem opt = option;
|
inline QSize StyledItemDelegateWithoutFocus::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const {
|
||||||
|
QSize siz = QStyledItemDelegate::sizeHint(option, index);
|
||||||
|
|
||||||
|
/* QStyleOptionViewItem opt = option;
|
||||||
|
|
||||||
initStyleOption(&opt, index);
|
initStyleOption(&opt, index);
|
||||||
QStyle* style = widget ? widget->style() : QApplication::style();
|
QStyle* style = widget ? widget->style() : QApplication::style();
|
||||||
|
|
||||||
return style->sizeFromContents(QStyle::CT_ItemViewItem, &opt, QSize(), widget);*/
|
return style->sizeFromContents(QStyle::CT_ItemViewItem, &opt, QSize(), widget);*/
|
||||||
|
|
||||||
return siz;
|
return siz;
|
||||||
}
|
}
|
||||||
|
|
||||||
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // STYLEDITEMDELEGATEWITHOUTFOCUS_H
|
#endif // STYLEDITEMDELEGATEWITHOUTFOCUS_H
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
TrayIconMenu::TrayIconMenu(const QString& title, QWidget* parent) : QMenu(title, parent) {}
|
TrayIconMenu::TrayIconMenu(const QString& title, QWidget* parent) : QMenu(title, parent) {}
|
||||||
|
|
||||||
TrayIconMenu::~TrayIconMenu() {}
|
|
||||||
|
|
||||||
bool TrayIconMenu::event(QEvent* event) {
|
bool TrayIconMenu::event(QEvent* event) {
|
||||||
if (event->type() == QEvent::Show && Application::activeModalWidget() != nullptr) {
|
if (event->type() == QEvent::Show && Application::activeModalWidget() != nullptr) {
|
||||||
QTimer::singleShot(0, this, SLOT(hide()));
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
@ -159,7 +157,7 @@ void SystemTrayIcon::setNumber(int number, bool any_new_message) {
|
|||||||
|
|
||||||
void SystemTrayIcon::showMessage(const QString& title, const QString& message, QSystemTrayIcon::MessageIcon icon,
|
void SystemTrayIcon::showMessage(const QString& title, const QString& message, QSystemTrayIcon::MessageIcon icon,
|
||||||
int milliseconds_timeout_hint, std::function<void()> functor) {
|
int milliseconds_timeout_hint, std::function<void()> functor) {
|
||||||
if (m_connection) {
|
if (m_connection != nullptr) {
|
||||||
// Disconnect previous bubble click signalling.
|
// Disconnect previous bubble click signalling.
|
||||||
disconnect(m_connection);
|
disconnect(m_connection);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ class TrayIconMenu : public QMenu {
|
|||||||
|
|
||||||
// Constructors and destructors.
|
// Constructors and destructors.
|
||||||
explicit TrayIconMenu(const QString& title, QWidget* parent);
|
explicit TrayIconMenu(const QString& title, QWidget* parent);
|
||||||
virtual ~TrayIconMenu();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent* event);
|
bool event(QEvent* event);
|
||||||
|
@ -20,14 +20,14 @@ TabBar::~TabBar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TabBar::setTabType(int index, const TabBar::TabType& type) {
|
void TabBar::setTabType(int index, const TabBar::TabType& type) {
|
||||||
const QTabBar::ButtonPosition button_position = static_cast<ButtonPosition>(style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition,
|
const auto button_position = static_cast<ButtonPosition>(style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition,
|
||||||
0,
|
nullptr,
|
||||||
this));
|
this));
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TabBar::DownloadManager:
|
case TabBar::DownloadManager:
|
||||||
case TabBar::Closable: {
|
case TabBar::Closable: {
|
||||||
PlainToolButton* close_button = new PlainToolButton(this);
|
auto* close_button = new PlainToolButton(this);
|
||||||
|
|
||||||
close_button->setIcon(qApp->icons()->fromTheme(QSL("application-exit")));
|
close_button->setIcon(qApp->icons()->fromTheme(QSL("application-exit")));
|
||||||
close_button->setToolTip(tr("Close this tab."));
|
close_button->setToolTip(tr("Close this tab."));
|
||||||
@ -40,10 +40,8 @@ void TabBar::setTabType(int index, const TabBar::TabType& type) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TabBar::NonClosable:
|
|
||||||
case TabBar::FeedReader:
|
|
||||||
default:
|
default:
|
||||||
setTabButton(index, button_position, 0);
|
setTabButton(index, button_position, nullptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +49,10 @@ void TabBar::setTabType(int index, const TabBar::TabType& type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TabBar::closeTabViaButton() {
|
void TabBar::closeTabViaButton() {
|
||||||
const QAbstractButton* close_button = qobject_cast<QAbstractButton*>(sender());
|
const auto* close_button = qobject_cast<QAbstractButton*>(sender());
|
||||||
const QTabBar::ButtonPosition button_position = static_cast<ButtonPosition>(style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition,
|
const auto button_position = static_cast<ButtonPosition>(style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition,
|
||||||
0,
|
nullptr,
|
||||||
this));
|
this));
|
||||||
|
|
||||||
if (close_button != nullptr) {
|
if (close_button != nullptr) {
|
||||||
// Find index of tab for this close button.
|
// Find index of tab for this close button.
|
||||||
@ -91,6 +89,7 @@ void TabBar::wheelEvent(QWheelEvent* event) {
|
|||||||
|
|
||||||
void TabBar::mousePressEvent(QMouseEvent* event) {
|
void TabBar::mousePressEvent(QMouseEvent* event) {
|
||||||
QTabBar::mousePressEvent(event);
|
QTabBar::mousePressEvent(event);
|
||||||
|
|
||||||
const int tab_index = tabAt(event->pos());
|
const int tab_index = tabAt(event->pos());
|
||||||
|
|
||||||
// Check if user clicked on some tab or on empty space.
|
// Check if user clicked on some tab or on empty space.
|
||||||
@ -98,7 +97,8 @@ void TabBar::mousePressEvent(QMouseEvent* event) {
|
|||||||
// Check if user clicked tab with middle button.
|
// Check if user clicked tab with middle button.
|
||||||
// NOTE: This needs to be done here because
|
// NOTE: This needs to be done here because
|
||||||
// destination does not know the original event.
|
// destination does not know the original event.
|
||||||
if (event->button() & Qt::MiddleButton && qApp->settings()->value(GROUP(GUI), SETTING(GUI::TabCloseMiddleClick)).toBool()) {
|
if ((event->button() & Qt::MiddleButton) == Qt::MiddleButton &&
|
||||||
|
qApp->settings()->value(GROUP(GUI), SETTING(GUI::TabCloseMiddleClick)).toBool()) {
|
||||||
if (tabType(tab_index) == TabBar::Closable || tabType(tab_index) == TabBar::DownloadManager) {
|
if (tabType(tab_index) == TabBar::Closable || tabType(tab_index) == TabBar::DownloadManager) {
|
||||||
// This tab is closable, so we can close it.
|
// This tab is closable, so we can close it.
|
||||||
emit tabCloseRequested(tab_index);
|
emit tabCloseRequested(tab_index);
|
||||||
@ -116,7 +116,8 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent* event) {
|
|||||||
// Check if user clicked tab with middle button.
|
// Check if user clicked tab with middle button.
|
||||||
// NOTE: This needs to be done here because
|
// NOTE: This needs to be done here because
|
||||||
// destination does not know the original event.
|
// destination does not know the original event.
|
||||||
if (event->button() & Qt::LeftButton && qApp->settings()->value(GROUP(GUI), SETTING(GUI::TabCloseDoubleClick)).toBool()) {
|
if ((event->button() & Qt::LeftButton) == Qt::LeftButton &&
|
||||||
|
qApp->settings()->value(GROUP(GUI), SETTING(GUI::TabCloseDoubleClick)).toBool()) {
|
||||||
if ((tabType(tab_index) & (TabBar::Closable | TabBar::DownloadManager)) > 0) {
|
if ((tabType(tab_index) & (TabBar::Closable | TabBar::DownloadManager)) > 0) {
|
||||||
// This tab is closable, so we can close it.
|
// This tab is closable, so we can close it.
|
||||||
emit tabCloseRequested(tab_index);
|
emit tabCloseRequested(tab_index);
|
||||||
|
@ -27,7 +27,7 @@ class TabBar : public QTabBar {
|
|||||||
void setTabType(int index, const TabBar::TabType& type);
|
void setTabType(int index, const TabBar::TabType& type);
|
||||||
|
|
||||||
inline TabBar::TabType tabType(int index) const {
|
inline TabBar::TabType tabType(int index) const {
|
||||||
return static_cast<TabBar::TabType>(tabData(index).value<int>());
|
return static_cast<TabBar::TabType>(tabData(index).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -3,5 +3,3 @@
|
|||||||
#include "gui/tabcontent.h"
|
#include "gui/tabcontent.h"
|
||||||
|
|
||||||
TabContent::TabContent(QWidget* parent) : QWidget(parent), m_index(-1) {}
|
TabContent::TabContent(QWidget* parent) : QWidget(parent), m_index(-1) {}
|
||||||
|
|
||||||
TabContent::~TabContent() {}
|
|
||||||
|
@ -14,21 +14,13 @@ class TabContent : public QWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit TabContent(QWidget* parent = nullptr);
|
||||||
// Contructors.
|
|
||||||
explicit TabContent(QWidget* parent = 0);
|
|
||||||
virtual ~TabContent();
|
|
||||||
|
|
||||||
// Gets/sets current index of this TabContent.
|
// Gets/sets current index of this TabContent.
|
||||||
// NOTE: This is the index under which this object lies
|
// NOTE: This is the index under which this object lies
|
||||||
// in parent tab widget.
|
// in parent tab widget.
|
||||||
inline virtual int index() const {
|
virtual int index() const;
|
||||||
return m_index;
|
virtual void setIndex(int index);
|
||||||
}
|
|
||||||
|
|
||||||
inline virtual void setIndex(int index) {
|
|
||||||
m_index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(USE_WEBENGINE)
|
#if defined(USE_WEBENGINE)
|
||||||
|
|
||||||
@ -41,4 +33,12 @@ class TabContent : public QWidget {
|
|||||||
int m_index;
|
int m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline int TabContent::index() const {
|
||||||
|
return m_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void TabContent::setIndex(int index) {
|
||||||
|
m_index = index;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // TABCONTENT_H
|
#endif // TABCONTENT_H
|
||||||
|
@ -89,8 +89,8 @@ void TabWidget::checkTabBarVisibility() {
|
|||||||
m_btnMainMenu->setVisible(true);
|
m_btnMainMenu->setVisible(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setCornerWidget(0, Qt::TopLeftCorner);
|
setCornerWidget(nullptr, Qt::TopLeftCorner);
|
||||||
setCornerWidget(0, Qt::TopRightCorner);
|
setCornerWidget(nullptr, Qt::TopRightCorner);
|
||||||
m_btnMainMenu->setVisible(false);
|
m_btnMainMenu->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ void TabWidget::fixContentsAfterMove(int from, int to) {
|
|||||||
to = qMax(from, to);
|
to = qMax(from, to);
|
||||||
|
|
||||||
for (; from <= to; from++) {
|
for (; from <= to; from++) {
|
||||||
TabContent* content = static_cast<TabContent*>(widget(from));
|
auto* content = static_cast<TabContent*>(widget(from));
|
||||||
|
|
||||||
content->setIndex(from);
|
content->setIndex(from);
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@ TimeSpinBox::TimeSpinBox(QWidget* parent) : QDoubleSpinBox(parent) {
|
|||||||
setMaximum(10000000.0);
|
setMaximum(10000000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeSpinBox::~TimeSpinBox() {}
|
|
||||||
|
|
||||||
double TimeSpinBox::valueFromText(const QString& text) const {
|
double TimeSpinBox::valueFromText(const QString& text) const {
|
||||||
bool ok;
|
bool ok;
|
||||||
double value = text.toDouble(&ok);
|
double value = text.toDouble(&ok);
|
||||||
|
@ -9,8 +9,7 @@ class TimeSpinBox : public QDoubleSpinBox {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TimeSpinBox(QWidget* parent = 0);
|
explicit TimeSpinBox(QWidget* parent = nullptr);
|
||||||
virtual ~TimeSpinBox();
|
|
||||||
|
|
||||||
double valueFromText(const QString& text) const;
|
double valueFromText(const QString& text) const;
|
||||||
QString textFromValue(double val) const;
|
QString textFromValue(double val) const;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
ToolBarEditor::ToolBarEditor(QWidget* parent)
|
ToolBarEditor::ToolBarEditor(QWidget* parent)
|
||||||
: QWidget(parent), m_ui(new Ui::ToolBarEditor) {
|
: QWidget(parent), m_ui(new Ui::ToolBarEditor), m_toolBar(nullptr) {
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
// Create connections.
|
// Create connections.
|
||||||
@ -35,10 +35,6 @@ ToolBarEditor::ToolBarEditor(QWidget* parent)
|
|||||||
m_ui->m_btnReset->setIcon(qApp->icons()->fromTheme(QSL("reload")));
|
m_ui->m_btnReset->setIcon(qApp->icons()->fromTheme(QSL("reload")));
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolBarEditor::~ToolBarEditor() {
|
|
||||||
qDebug("Destroying ToolBarEditor instance.");
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToolBarEditor::loadFromToolBar(BaseBar* tool_bar) {
|
void ToolBarEditor::loadFromToolBar(BaseBar* tool_bar) {
|
||||||
m_toolBar = tool_bar;
|
m_toolBar = tool_bar;
|
||||||
|
|
||||||
@ -116,18 +112,18 @@ void ToolBarEditor::loadEditor(const QList<QAction*> activated_actions, const QL
|
|||||||
|
|
||||||
bool ToolBarEditor::eventFilter(QObject* object, QEvent* event) {
|
bool ToolBarEditor::eventFilter(QObject* object, QEvent* event) {
|
||||||
if (object == m_ui->m_listActivatedActions) {
|
if (object == m_ui->m_listActivatedActions) {
|
||||||
if (event->type() == QEvent::KeyPress) {
|
if (event->type() == QEvent::Type::KeyPress) {
|
||||||
const QKeyEvent* key_event = static_cast<QKeyEvent*>(event);
|
const auto* key_event = static_cast<QKeyEvent*>(event);
|
||||||
|
|
||||||
if (key_event->key() == Qt::Key_Delete) {
|
if (key_event->key() == Qt::Key_Delete) {
|
||||||
deleteSelectedAction();
|
deleteSelectedAction();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (key_event->key() == Qt::Key_Down && key_event->modifiers() & Qt::ControlModifier) {
|
else if (key_event->key() == Qt::Key_Down && (key_event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
|
||||||
moveActionDown();
|
moveActionDown();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (key_event->key() == Qt::Key_Up && key_event->modifiers() & Qt::ControlModifier) {
|
else if (key_event->key() == Qt::Key_Up && (key_event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
|
||||||
moveActionUp();
|
moveActionUp();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -149,7 +145,7 @@ void ToolBarEditor::updateActionsAvailability() {
|
|||||||
|
|
||||||
void ToolBarEditor::insertSpacer() {
|
void ToolBarEditor::insertSpacer() {
|
||||||
const int current_row = m_ui->m_listActivatedActions->currentRow();
|
const int current_row = m_ui->m_listActivatedActions->currentRow();
|
||||||
QListWidgetItem* item = new QListWidgetItem(tr("Toolbar spacer"));
|
auto* item = new QListWidgetItem(tr("Toolbar spacer"));
|
||||||
|
|
||||||
item->setIcon(qApp->icons()->fromTheme(QSL("go-jump")));
|
item->setIcon(qApp->icons()->fromTheme(QSL("go-jump")));
|
||||||
item->setData(Qt::UserRole, SPACER_ACTION_NAME);
|
item->setData(Qt::UserRole, SPACER_ACTION_NAME);
|
||||||
@ -239,7 +235,7 @@ void ToolBarEditor::deleteAllActions() {
|
|||||||
QListWidgetItem* taken_item;
|
QListWidgetItem* taken_item;
|
||||||
QString data_item;
|
QString data_item;
|
||||||
|
|
||||||
while ((taken_item = m_ui->m_listActivatedActions->takeItem(0)) != 0) {
|
while ((taken_item = m_ui->m_listActivatedActions->takeItem(0)) != nullptr) {
|
||||||
data_item = taken_item->data(Qt::UserRole).toString();
|
data_item = taken_item->data(Qt::UserRole).toString();
|
||||||
|
|
||||||
if (data_item != SEPARATOR_ACTION_NAME && data_item != SPACER_ACTION_NAME) {
|
if (data_item != SEPARATOR_ACTION_NAME && data_item != SPACER_ACTION_NAME) {
|
||||||
|
@ -19,20 +19,14 @@ class ToolBarEditor : public QWidget {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors and destructors.
|
// Constructors and destructors.
|
||||||
explicit ToolBarEditor(QWidget* parent = 0);
|
explicit ToolBarEditor(QWidget* parent = nullptr);
|
||||||
virtual ~ToolBarEditor();
|
|
||||||
|
|
||||||
// Toolbar operations.
|
// Toolbar operations.
|
||||||
void loadFromToolBar(BaseBar* tool_bar);
|
void loadFromToolBar(BaseBar* tool_bar);
|
||||||
void saveToolBar();
|
void saveToolBar();
|
||||||
|
|
||||||
inline QListWidget* activeItemsWidget() const {
|
QListWidget* activeItemsWidget() const;
|
||||||
return m_ui->m_listActivatedActions;
|
QListWidget* availableItemsWidget() const;
|
||||||
}
|
|
||||||
|
|
||||||
inline QListWidget* availableItemsWidget() const {
|
|
||||||
return m_ui->m_listAvailableActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject* object, QEvent* event);
|
bool eventFilter(QObject* object, QEvent* event);
|
||||||
@ -63,4 +57,12 @@ class ToolBarEditor : public QWidget {
|
|||||||
BaseBar* m_toolBar;
|
BaseBar* m_toolBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline QListWidget* ToolBarEditor::activeItemsWidget() const {
|
||||||
|
return m_ui->m_listActivatedActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QListWidget* ToolBarEditor::availableItemsWidget() const {
|
||||||
|
return m_ui->m_listAvailableActions;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // TOOLBAREDITOR_H
|
#endif // TOOLBAREDITOR_H
|
||||||
|
@ -8,8 +8,6 @@ TreeViewColumnsMenu::TreeViewColumnsMenu(QHeaderView* parent) : QMenu(parent) {
|
|||||||
connect(this, &TreeViewColumnsMenu::aboutToShow, this, &TreeViewColumnsMenu::prepareMenu);
|
connect(this, &TreeViewColumnsMenu::aboutToShow, this, &TreeViewColumnsMenu::prepareMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeViewColumnsMenu::~TreeViewColumnsMenu() {}
|
|
||||||
|
|
||||||
void TreeViewColumnsMenu::prepareMenu() {
|
void TreeViewColumnsMenu::prepareMenu() {
|
||||||
QHeaderView* header_view = header();
|
QHeaderView* header_view = header();
|
||||||
|
|
||||||
@ -24,9 +22,11 @@ void TreeViewColumnsMenu::prepareMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TreeViewColumnsMenu::actionTriggered(bool toggle) {
|
void TreeViewColumnsMenu::actionTriggered(bool toggle) {
|
||||||
Q_UNUSED(toggle)
|
auto* send_act = qobject_cast<QAction*>(sender());
|
||||||
QAction * send_act = qobject_cast<QAction*>(sender());
|
|
||||||
header()->setSectionHidden(send_act->data().toInt(), !send_act->isChecked());
|
header()->setSectionHidden(send_act->data().toInt(), !send_act->isChecked());
|
||||||
|
|
||||||
|
Q_UNUSED(toggle)
|
||||||
}
|
}
|
||||||
|
|
||||||
QHeaderView* TreeViewColumnsMenu::header() {
|
QHeaderView* TreeViewColumnsMenu::header() {
|
||||||
|
@ -10,7 +10,6 @@ class QHeaderView;
|
|||||||
class TreeViewColumnsMenu : public QMenu {
|
class TreeViewColumnsMenu : public QMenu {
|
||||||
public:
|
public:
|
||||||
explicit TreeViewColumnsMenu(QHeaderView* parent);
|
explicit TreeViewColumnsMenu(QHeaderView* parent);
|
||||||
virtual ~TreeViewColumnsMenu();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void prepareMenu();
|
void prepareMenu();
|
||||||
|
@ -21,32 +21,30 @@ WidgetWithStatus::WidgetWithStatus(QWidget* parent)
|
|||||||
// Set layout properties.
|
// Set layout properties.
|
||||||
m_layout->setMargin(0);
|
m_layout->setMargin(0);
|
||||||
setLayout(m_layout);
|
setLayout(m_layout);
|
||||||
setStatus(Information, QString());
|
setStatus(StatusType::Information, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetWithStatus::~WidgetWithStatus() {}
|
|
||||||
|
|
||||||
void WidgetWithStatus::setStatus(WidgetWithStatus::StatusType status, const QString& tooltip_text) {
|
void WidgetWithStatus::setStatus(WidgetWithStatus::StatusType status, const QString& tooltip_text) {
|
||||||
m_status = status;
|
m_status = status;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case Information:
|
case StatusType::Information:
|
||||||
m_btnStatus->setIcon(m_iconInformation);
|
m_btnStatus->setIcon(m_iconInformation);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Progress:
|
case StatusType::Progress:
|
||||||
m_btnStatus->setIcon(m_iconProgress);
|
m_btnStatus->setIcon(m_iconProgress);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Warning:
|
case StatusType::Warning:
|
||||||
m_btnStatus->setIcon(m_iconWarning);
|
m_btnStatus->setIcon(m_iconWarning);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Error:
|
case StatusType::Error:
|
||||||
m_btnStatus->setIcon(m_iconError);
|
m_btnStatus->setIcon(m_iconError);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Ok:
|
case StatusType::Ok:
|
||||||
m_btnStatus->setIcon(m_iconOk);
|
m_btnStatus->setIcon(m_iconOk);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class WidgetWithStatus : public QWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum StatusType {
|
enum class StatusType {
|
||||||
Information,
|
Information,
|
||||||
Warning,
|
Warning,
|
||||||
Error,
|
Error,
|
||||||
@ -21,16 +21,10 @@ class WidgetWithStatus : public QWidget {
|
|||||||
Progress
|
Progress
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constructors and destructors.
|
|
||||||
explicit WidgetWithStatus(QWidget* parent);
|
explicit WidgetWithStatus(QWidget* parent);
|
||||||
virtual ~WidgetWithStatus();
|
|
||||||
|
|
||||||
// Sets custom status for this control.
|
|
||||||
void setStatus(StatusType status, const QString& tooltip_text);
|
void setStatus(StatusType status, const QString& tooltip_text);
|
||||||
|
StatusType status() const;
|
||||||
inline StatusType status() const {
|
|
||||||
return m_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StatusType m_status;
|
StatusType m_status;
|
||||||
@ -44,4 +38,8 @@ class WidgetWithStatus : public QWidget {
|
|||||||
QIcon m_iconOk;
|
QIcon m_iconOk;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline WidgetWithStatus::StatusType WidgetWithStatus::status() const {
|
||||||
|
return m_status;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // WIDGETWITHSTATUS_H
|
#endif // WIDGETWITHSTATUS_H
|
||||||
|
@ -146,11 +146,11 @@ MessagesModel* FeedReader::messagesModel() const {
|
|||||||
|
|
||||||
void FeedReader::executeNextAutoUpdate() {
|
void FeedReader::executeNextAutoUpdate() {
|
||||||
if (qApp->mainFormWidget()->isActiveWindow() && m_globalAutoUpdateOnlyUnfocused) {
|
if (qApp->mainFormWidget()->isActiveWindow() && m_globalAutoUpdateOnlyUnfocused) {
|
||||||
qDebug("Delaying scheduled feed auto-update for one minute since window is focused and updates"
|
qDebug("Delaying scheduled feed auto-update for one minute since window is focused and updates"
|
||||||
"while focused are disabled by the user.");
|
"while focused are disabled by the user.");
|
||||||
|
|
||||||
// Cannot update, quit.
|
// Cannot update, quit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qApp->feedUpdateLock()->tryLock()) {
|
if (!qApp->feedUpdateLock()->tryLock()) {
|
||||||
@ -203,7 +203,7 @@ void FeedReader::checkServicesForAsyncOperations() {
|
|||||||
|
|
||||||
void FeedReader::asyncCacheSaveFinished() {
|
void FeedReader::asyncCacheSaveFinished() {
|
||||||
qDebug("I will start next check for cached service data in 30 seconds.");
|
qDebug("I will start next check for cached service data in 30 seconds.");
|
||||||
QTimer::singleShot(60000, [&] {
|
QTimer::singleShot(60000, this, [&] {
|
||||||
qDebug("Starting next check for cached service data in NOW.");
|
qDebug("Starting next check for cached service data in NOW.");
|
||||||
checkServicesForAsyncOperations();
|
checkServicesForAsyncOperations();
|
||||||
});
|
});
|
||||||
|
@ -373,8 +373,8 @@ DVALUE(QStringList) Browser::ExternalToolsDef = QStringList();
|
|||||||
// Categories.
|
// Categories.
|
||||||
DKEY CategoriesExpandStates::ID = "categories_expand_states";
|
DKEY CategoriesExpandStates::ID = "categories_expand_states";
|
||||||
|
|
||||||
Settings::Settings(const QString& file_name, Format format, const SettingsProperties::SettingsType& status, QObject* parent)
|
Settings::Settings(const QString& file_name, Format format, const SettingsProperties::SettingsType& type, QObject* parent)
|
||||||
: QSettings(file_name, format, parent), m_initializationStatus(status) {}
|
: QSettings(file_name, format, parent), m_initializationStatus(type) {}
|
||||||
|
|
||||||
Settings::~Settings() = default;
|
Settings::~Settings() = default;
|
||||||
|
|
||||||
|
@ -90,35 +90,35 @@ int FormFeedDetails::addEditFeed(Feed* input_feed, RootItem* parent_to_select, c
|
|||||||
|
|
||||||
void FormFeedDetails::onTitleChanged(const QString& new_title) {
|
void FormFeedDetails::onTitleChanged(const QString& new_title) {
|
||||||
if (new_title.simplified().size() >= MIN_CATEGORY_NAME_LENGTH) {
|
if (new_title.simplified().size() >= MIN_CATEGORY_NAME_LENGTH) {
|
||||||
m_ui->m_txtTitle->setStatus(LineEditWithStatus::Ok, tr("Feed name is ok."));
|
m_ui->m_txtTitle->setStatus(LineEditWithStatus::StatusType::Ok, tr("Feed name is ok."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtTitle->setStatus(LineEditWithStatus::Error, tr("Feed name is too short."));
|
m_ui->m_txtTitle->setStatus(LineEditWithStatus::StatusType::Error, tr("Feed name is too short."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::onDescriptionChanged(const QString& new_description) {
|
void FormFeedDetails::onDescriptionChanged(const QString& new_description) {
|
||||||
if (new_description.simplified().isEmpty()) {
|
if (new_description.simplified().isEmpty()) {
|
||||||
m_ui->m_txtDescription->setStatus(LineEditWithStatus::Warning, tr("Description is empty."));
|
m_ui->m_txtDescription->setStatus(LineEditWithStatus::StatusType::Warning, tr("Description is empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtDescription->setStatus(LineEditWithStatus::Ok, tr("The description is ok."));
|
m_ui->m_txtDescription->setStatus(LineEditWithStatus::StatusType::Ok, tr("The description is ok."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::onUrlChanged(const QString& new_url) {
|
void FormFeedDetails::onUrlChanged(const QString& new_url) {
|
||||||
if (QRegularExpression(URL_REGEXP).match(new_url).hasMatch()) {
|
if (QRegularExpression(URL_REGEXP).match(new_url).hasMatch()) {
|
||||||
// New url is well-formed.
|
// New url is well-formed.
|
||||||
m_ui->m_txtUrl->setStatus(LineEditWithStatus::Ok, tr("The URL is ok."));
|
m_ui->m_txtUrl->setStatus(LineEditWithStatus::StatusType::Ok, tr("The URL is ok."));
|
||||||
}
|
}
|
||||||
else if (!new_url.simplified().isEmpty()) {
|
else if (!new_url.simplified().isEmpty()) {
|
||||||
// New url is not well-formed but is not empty on the other hand.
|
// New url is not well-formed but is not empty on the other hand.
|
||||||
m_ui->m_txtUrl->setStatus(LineEditWithStatus::Warning,
|
m_ui->m_txtUrl->setStatus(LineEditWithStatus::StatusType::Warning,
|
||||||
tr(R"(The URL does not meet standard pattern. Does your URL start with "http://" or "https://" prefix.)"));
|
tr(R"(The URL does not meet standard pattern. Does your URL start with "http://" or "https://" prefix.)"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// New url is empty.
|
// New url is empty.
|
||||||
m_ui->m_txtUrl->setStatus(LineEditWithStatus::Error, tr("The URL is empty."));
|
m_ui->m_txtUrl->setStatus(LineEditWithStatus::StatusType::Error, tr("The URL is empty."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +126,8 @@ void FormFeedDetails::onUsernameChanged(const QString& new_username) {
|
|||||||
bool is_username_ok = !m_ui->m_gbAuthentication->isChecked() || !new_username.simplified().isEmpty();
|
bool is_username_ok = !m_ui->m_gbAuthentication->isChecked() || !new_username.simplified().isEmpty();
|
||||||
|
|
||||||
m_ui->m_txtUsername->setStatus(is_username_ok ?
|
m_ui->m_txtUsername->setStatus(is_username_ok ?
|
||||||
LineEditWithStatus::Ok :
|
LineEditWithStatus::StatusType::Ok :
|
||||||
LineEditWithStatus::Warning,
|
LineEditWithStatus::StatusType::Warning,
|
||||||
is_username_ok ?
|
is_username_ok ?
|
||||||
tr("Username is ok or it is not needed.") :
|
tr("Username is ok or it is not needed.") :
|
||||||
tr("Username is empty."));
|
tr("Username is empty."));
|
||||||
@ -137,8 +137,8 @@ void FormFeedDetails::onPasswordChanged(const QString& new_password) {
|
|||||||
bool is_password_ok = !m_ui->m_gbAuthentication->isChecked() || !new_password.simplified().isEmpty();
|
bool is_password_ok = !m_ui->m_gbAuthentication->isChecked() || !new_password.simplified().isEmpty();
|
||||||
|
|
||||||
m_ui->m_txtPassword->setStatus(is_password_ok ?
|
m_ui->m_txtPassword->setStatus(is_password_ok ?
|
||||||
LineEditWithStatus::Ok :
|
LineEditWithStatus::StatusType::Ok :
|
||||||
LineEditWithStatus::Warning,
|
LineEditWithStatus::StatusType::Warning,
|
||||||
is_password_ok ?
|
is_password_ok ?
|
||||||
tr("Password is ok or it is not needed.") :
|
tr("Password is ok or it is not needed.") :
|
||||||
tr("Password is empty."));
|
tr("Password is empty."));
|
||||||
@ -158,7 +158,6 @@ void FormFeedDetails::onAutoUpdateTypeChanged(int new_index) {
|
|||||||
m_ui->m_spinAutoUpdateInterval->setEnabled(false);
|
m_ui->m_spinAutoUpdateInterval->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Feed::SpecificAutoUpdate:
|
|
||||||
default:
|
default:
|
||||||
m_ui->m_spinAutoUpdateInterval->setEnabled(true);
|
m_ui->m_spinAutoUpdateInterval->setEnabled(true);
|
||||||
}
|
}
|
||||||
@ -213,12 +212,12 @@ void FormFeedDetails::guessFeed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.second == QNetworkReply::NoError) {
|
if (result.second == QNetworkReply::NoError) {
|
||||||
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::Ok,
|
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
tr("All metadata fetched successfully."),
|
tr("All metadata fetched successfully."),
|
||||||
tr("Feed and icon metadata fetched."));
|
tr("Feed and icon metadata fetched."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::Warning,
|
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Warning,
|
||||||
tr("Result: %1.").arg(NetworkFactory::networkErrorText(result.second)),
|
tr("Result: %1.").arg(NetworkFactory::networkErrorText(result.second)),
|
||||||
tr("Feed or icon metadata not fetched."));
|
tr("Feed or icon metadata not fetched."));
|
||||||
}
|
}
|
||||||
@ -228,7 +227,7 @@ void FormFeedDetails::guessFeed() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// No feed guessed, even no icon available.
|
// No feed guessed, even no icon available.
|
||||||
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Error: %1.").arg(NetworkFactory::networkErrorText(result.second)),
|
tr("Error: %1.").arg(NetworkFactory::networkErrorText(result.second)),
|
||||||
tr("No metadata fetched."));
|
tr("No metadata fetched."));
|
||||||
}
|
}
|
||||||
@ -244,12 +243,12 @@ void FormFeedDetails::guessIconOnly() {
|
|||||||
m_ui->m_btnIcon->setIcon(result.first->icon());
|
m_ui->m_btnIcon->setIcon(result.first->icon());
|
||||||
|
|
||||||
if (result.second == QNetworkReply::NoError) {
|
if (result.second == QNetworkReply::NoError) {
|
||||||
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::Ok,
|
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
tr("Icon fetched successfully."),
|
tr("Icon fetched successfully."),
|
||||||
tr("Icon metadata fetched."));
|
tr("Icon metadata fetched."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::Warning,
|
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Warning,
|
||||||
tr("Result: %1.").arg(NetworkFactory::networkErrorText(result.second)),
|
tr("Result: %1.").arg(NetworkFactory::networkErrorText(result.second)),
|
||||||
tr("Icon metadata not fetched."));
|
tr("Icon metadata not fetched."));
|
||||||
}
|
}
|
||||||
@ -259,7 +258,7 @@ void FormFeedDetails::guessIconOnly() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// No feed guessed, even no icon available.
|
// No feed guessed, even no icon available.
|
||||||
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Error: %1.").arg(NetworkFactory::networkErrorText(result.second)),
|
tr("Error: %1.").arg(NetworkFactory::networkErrorText(result.second)),
|
||||||
tr("No icon fetched."));
|
tr("No icon fetched."));
|
||||||
}
|
}
|
||||||
@ -353,7 +352,7 @@ void FormFeedDetails::initialize() {
|
|||||||
m_ui->m_btnIcon->setMenu(m_iconMenu);
|
m_ui->m_btnIcon->setMenu(m_iconMenu);
|
||||||
|
|
||||||
// Set feed metadata fetch label.
|
// Set feed metadata fetch label.
|
||||||
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::Information,
|
m_ui->m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Information,
|
||||||
tr("No metadata fetched so far."),
|
tr("No metadata fetched so far."),
|
||||||
tr("No metadata fetched so far."));
|
tr("No metadata fetched so far."));
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
RootItem::RootItem(RootItem* parent_item)
|
RootItem::RootItem(RootItem* parent_item)
|
||||||
: QObject(nullptr), m_kind(RootItemKind::Root), m_id(NO_PARENT_CATEGORY), m_customId(QSL("")),
|
: QObject(nullptr), m_kind(RootItemKind::Root), m_id(NO_PARENT_CATEGORY), m_customId(QL1S("")),
|
||||||
m_title(QString()), m_description(QString()), m_keepOnTop(false), m_parentItem(parent_item) {}
|
m_title(QString()), m_description(QString()), m_keepOnTop(false), m_parentItem(parent_item) {}
|
||||||
|
|
||||||
RootItem::RootItem(const RootItem& other) : RootItem(nullptr) {
|
RootItem::RootItem(const RootItem& other) : RootItem(nullptr) {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
EmailRecipientControl::EmailRecipientControl(const QString& recipient, QWidget* parent) : QWidget(parent) {
|
EmailRecipientControl::EmailRecipientControl(const QString& recipient, QWidget* parent) : QWidget(parent) {
|
||||||
QHBoxLayout* lay = new QHBoxLayout(this);
|
auto* lay = new QHBoxLayout(this);
|
||||||
|
|
||||||
lay->addWidget(m_cmbRecipientType = new QComboBox(this));
|
lay->addWidget(m_cmbRecipientType = new QComboBox(this));
|
||||||
lay->addWidget(m_txtRecipient = new QLineEdit(this), 1);
|
lay->addWidget(m_txtRecipient = new QLineEdit(this), 1);
|
||||||
|
@ -27,7 +27,7 @@ void FormAddEditEmail::execForAdd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormAddEditEmail::removeRecipientRow() {
|
void FormAddEditEmail::removeRecipientRow() {
|
||||||
EmailRecipientControl* sndr = static_cast<EmailRecipientControl*>(sender());
|
auto* sndr = static_cast<EmailRecipientControl*>(sender());
|
||||||
|
|
||||||
m_ui.m_layout->takeRow(sndr);
|
m_ui.m_layout->takeRow(sndr);
|
||||||
m_recipientControls.removeOne(sndr);
|
m_recipientControls.removeOne(sndr);
|
||||||
|
@ -21,7 +21,7 @@ FormDownloadAttachment::FormDownloadAttachment(const QString& target_file, Downl
|
|||||||
connect(downloader,
|
connect(downloader,
|
||||||
&Downloader::completed,
|
&Downloader::completed,
|
||||||
this,
|
this,
|
||||||
[this, downloader, target_file](QNetworkReply::NetworkError status, QByteArray contents) {
|
[this, downloader, target_file](QNetworkReply::NetworkError status, const QByteArray& contents) {
|
||||||
if (status == QNetworkReply::NetworkError::NoError) {
|
if (status == QNetworkReply::NetworkError::NoError) {
|
||||||
QString data = QJsonDocument::fromJson(contents).object()["data"].toString();
|
QString data = QJsonDocument::fromJson(contents).object()["data"].toString();
|
||||||
|
|
||||||
|
@ -185,10 +185,10 @@ void FormEditGmailAccount::checkOAuthValue(const QString& value) {
|
|||||||
|
|
||||||
if (line_edit != nullptr) {
|
if (line_edit != nullptr) {
|
||||||
if (value.isEmpty()) {
|
if (value.isEmpty()) {
|
||||||
line_edit->setStatus(WidgetWithStatus::Error, tr("Empty value is entered."));
|
line_edit->setStatus(WidgetWithStatus::StatusType::Error, tr("Empty value is entered."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
line_edit->setStatus(WidgetWithStatus::Ok, tr("Some value is entered."));
|
line_edit->setStatus(WidgetWithStatus::StatusType::Ok, tr("Some value is entered."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,10 +182,10 @@ void FormEditInoreaderAccount::checkOAuthValue(const QString& value) {
|
|||||||
|
|
||||||
if (line_edit != nullptr) {
|
if (line_edit != nullptr) {
|
||||||
if (value.isEmpty()) {
|
if (value.isEmpty()) {
|
||||||
line_edit->setStatus(WidgetWithStatus::Error, tr("Empty value is entered."));
|
line_edit->setStatus(WidgetWithStatus::StatusType::Error, tr("Empty value is entered."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
line_edit->setStatus(WidgetWithStatus::Ok, tr("Some value is entered."));
|
line_edit->setStatus(WidgetWithStatus::StatusType::Ok, tr("Some value is entered."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ FormEditOwnCloudAccount::FormEditOwnCloudAccount(QWidget* parent)
|
|||||||
m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your ownCloud account"));
|
m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your ownCloud account"));
|
||||||
m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your ownCloud account"));
|
m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your ownCloud account"));
|
||||||
m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("URL of your ownCloud server, without any API path"));
|
m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("URL of your ownCloud server, without any API path"));
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Information,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Information,
|
||||||
tr("No test done yet."),
|
tr("No test done yet."),
|
||||||
tr("Here, results of connection test are shown."));
|
tr("Here, results of connection test are shown."));
|
||||||
m_ui->m_lblLimitMessages->setText(
|
m_ui->m_lblLimitMessages->setText(
|
||||||
@ -106,7 +106,7 @@ void FormEditOwnCloudAccount::performTest() {
|
|||||||
|
|
||||||
if (result.isLoaded()) {
|
if (result.isLoaded()) {
|
||||||
if (!SystemFactory::isVersionEqualOrNewer(result.version(), OWNCLOUD_MIN_VERSION)) {
|
if (!SystemFactory::isVersionEqualOrNewer(result.version(), OWNCLOUD_MIN_VERSION)) {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr(
|
tr(
|
||||||
"Selected ownCloud News server is running unsupported version (%1). At least version %2 is required.").arg(
|
"Selected ownCloud News server is running unsupported version (%1). At least version %2 is required.").arg(
|
||||||
result.version(),
|
result.version(),
|
||||||
@ -114,7 +114,7 @@ void FormEditOwnCloudAccount::performTest() {
|
|||||||
tr("Selected ownCloud News server is running unsupported version."));
|
tr("Selected ownCloud News server is running unsupported version."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Ok,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
tr(
|
tr(
|
||||||
"ownCloud News server is okay, running with version %1, while at least version %2 is required.").arg(
|
"ownCloud News server is okay, running with version %1, while at least version %2 is required.").arg(
|
||||||
result.version(),
|
result.version(),
|
||||||
@ -123,12 +123,12 @@ void FormEditOwnCloudAccount::performTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (factory.lastError() != QNetworkReply::NoError) {
|
else if (factory.lastError() != QNetworkReply::NoError) {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Network error: '%1'.").arg(NetworkFactory::networkErrorText(factory.lastError())),
|
tr("Network error: '%1'.").arg(NetworkFactory::networkErrorText(factory.lastError())),
|
||||||
tr("Network error, have you entered correct ownCloud endpoint and password?"));
|
tr("Network error, have you entered correct ownCloud endpoint and password?"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Unspecified error, did you enter correct URL?"),
|
tr("Unspecified error, did you enter correct URL?"),
|
||||||
tr("Unspecified error, did you enter correct URL?"));
|
tr("Unspecified error, did you enter correct URL?"));
|
||||||
}
|
}
|
||||||
@ -166,10 +166,10 @@ void FormEditOwnCloudAccount::onUsernameChanged() {
|
|||||||
const QString username = m_ui->m_txtUsername->lineEdit()->text();
|
const QString username = m_ui->m_txtUsername->lineEdit()->text();
|
||||||
|
|
||||||
if (username.isEmpty()) {
|
if (username.isEmpty()) {
|
||||||
m_ui->m_txtUsername->setStatus(WidgetWithStatus::Error, tr("Username cannot be empty."));
|
m_ui->m_txtUsername->setStatus(WidgetWithStatus::StatusType::Error, tr("Username cannot be empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtUsername->setStatus(WidgetWithStatus::Ok, tr("Username is okay."));
|
m_ui->m_txtUsername->setStatus(WidgetWithStatus::StatusType::Ok, tr("Username is okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,10 +177,10 @@ void FormEditOwnCloudAccount::onPasswordChanged() {
|
|||||||
const QString password = m_ui->m_txtPassword->lineEdit()->text();
|
const QString password = m_ui->m_txtPassword->lineEdit()->text();
|
||||||
|
|
||||||
if (password.isEmpty()) {
|
if (password.isEmpty()) {
|
||||||
m_ui->m_txtPassword->setStatus(WidgetWithStatus::Error, tr("Password cannot be empty."));
|
m_ui->m_txtPassword->setStatus(WidgetWithStatus::StatusType::Error, tr("Password cannot be empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtPassword->setStatus(WidgetWithStatus::Ok, tr("Password is okay."));
|
m_ui->m_txtPassword->setStatus(WidgetWithStatus::StatusType::Ok, tr("Password is okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,10 +188,10 @@ void FormEditOwnCloudAccount::onUrlChanged() {
|
|||||||
const QString url = m_ui->m_txtUrl->lineEdit()->text();
|
const QString url = m_ui->m_txtUrl->lineEdit()->text();
|
||||||
|
|
||||||
if (url.isEmpty()) {
|
if (url.isEmpty()) {
|
||||||
m_ui->m_txtUrl->setStatus(WidgetWithStatus::Error, tr("URL cannot be empty."));
|
m_ui->m_txtUrl->setStatus(WidgetWithStatus::StatusType::Error, tr("URL cannot be empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtUrl->setStatus(WidgetWithStatus::Ok, tr("URL is okay."));
|
m_ui->m_txtUrl->setStatus(WidgetWithStatus::StatusType::Ok, tr("URL is okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,20 +136,20 @@ void FormStandardCategoryDetails::apply() {
|
|||||||
void FormStandardCategoryDetails::onTitleChanged(const QString& new_title) {
|
void FormStandardCategoryDetails::onTitleChanged(const QString& new_title) {
|
||||||
if (new_title.simplified().size() >= MIN_CATEGORY_NAME_LENGTH) {
|
if (new_title.simplified().size() >= MIN_CATEGORY_NAME_LENGTH) {
|
||||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||||
m_ui->m_txtTitle->setStatus(WidgetWithStatus::Ok, tr("Category name is ok."));
|
m_ui->m_txtTitle->setStatus(WidgetWithStatus::StatusType::Ok, tr("Category name is ok."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
m_ui->m_txtTitle->setStatus(WidgetWithStatus::Error, tr("Category name is too short."));
|
m_ui->m_txtTitle->setStatus(WidgetWithStatus::StatusType::Error, tr("Category name is too short."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormStandardCategoryDetails::onDescriptionChanged(const QString& new_description) {
|
void FormStandardCategoryDetails::onDescriptionChanged(const QString& new_description) {
|
||||||
if (new_description.simplified().isEmpty()) {
|
if (new_description.simplified().isEmpty()) {
|
||||||
m_ui->m_txtDescription->setStatus(LineEditWithStatus::Warning, tr("Description is empty."));
|
m_ui->m_txtDescription->setStatus(LineEditWithStatus::StatusType::Warning, tr("Description is empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtDescription->setStatus(LineEditWithStatus::Ok, tr("The description is ok."));
|
m_ui->m_txtDescription->setStatus(LineEditWithStatus::StatusType::Ok, tr("The description is ok."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ FormStandardImportExport::FormStandardImportExport(StandardServiceRoot* service_
|
|||||||
connect(m_model, &FeedsImportExportModel::parsingFinished, this, &FormStandardImportExport::onParsingFinished);
|
connect(m_model, &FeedsImportExportModel::parsingFinished, this, &FormStandardImportExport::onParsingFinished);
|
||||||
connect(m_model, &FeedsImportExportModel::parsingProgress, this, &FormStandardImportExport::onParsingProgress);
|
connect(m_model, &FeedsImportExportModel::parsingProgress, this, &FormStandardImportExport::onParsingProgress);
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||||
m_ui->m_lblSelectFile->setStatus(WidgetWithStatus::Error, tr("No file is selected."), tr("No file is selected."));
|
m_ui->m_lblSelectFile->setStatus(WidgetWithStatus::StatusType::Error, tr("No file is selected."), tr("No file is selected."));
|
||||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->disconnect();
|
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->disconnect();
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
||||||
connect(m_ui->m_buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &FormStandardImportExport::performAction);
|
connect(m_ui->m_buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &FormStandardImportExport::performAction);
|
||||||
connect(m_ui->m_btnSelectFile, &QPushButton::clicked, this, &FormStandardImportExport::selectFile);
|
connect(m_ui->m_btnSelectFile, &QPushButton::clicked, this, &FormStandardImportExport::selectFile);
|
||||||
connect(m_ui->m_btnCheckAllItems, &QPushButton::clicked, m_model, &FeedsImportExportModel::checkAllItems);
|
connect(m_ui->m_btnCheckAllItems, &QPushButton::clicked, m_model, &FeedsImportExportModel::checkAllItems);
|
||||||
@ -92,7 +92,7 @@ void FormStandardImportExport::selectFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormStandardImportExport::onParsingStarted() {
|
void FormStandardImportExport::onParsingStarted() {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Progress, tr("Parsing data..."), tr("Parsing data..."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Progress, tr("Parsing data..."), tr("Parsing data..."));
|
||||||
m_ui->m_btnSelectFile->setEnabled(false);
|
m_ui->m_btnSelectFile->setEnabled(false);
|
||||||
m_ui->m_groupFeeds->setEnabled(false);
|
m_ui->m_groupFeeds->setEnabled(false);
|
||||||
m_ui->m_progressBar->setValue(0);
|
m_ui->m_progressBar->setValue(0);
|
||||||
@ -108,7 +108,7 @@ void FormStandardImportExport::onParsingFinished(int count_failed, int count_suc
|
|||||||
m_model->checkAllItems();
|
m_model->checkAllItems();
|
||||||
|
|
||||||
if (!parsing_error) {
|
if (!parsing_error) {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Ok, tr("Feeds were loaded."), tr("Feeds were loaded."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Ok, tr("Feeds were loaded."), tr("Feeds were loaded."));
|
||||||
m_ui->m_groupFeeds->setEnabled(true);
|
m_ui->m_groupFeeds->setEnabled(true);
|
||||||
m_ui->m_btnSelectFile->setEnabled(true);
|
m_ui->m_btnSelectFile->setEnabled(true);
|
||||||
m_ui->m_treeFeeds->setModel(m_model);
|
m_ui->m_treeFeeds->setModel(m_model);
|
||||||
@ -116,7 +116,7 @@ void FormStandardImportExport::onParsingFinished(int count_failed, int count_suc
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_groupFeeds->setEnabled(false);
|
m_ui->m_groupFeeds->setEnabled(false);
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Error, tr("Error, file is not well-formed. Select another file."),
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Error, tr("Error, file is not well-formed. Select another file."),
|
||||||
tr("Error occurred. File is not well-formed. Select another file."));
|
tr("Error occurred. File is not well-formed. Select another file."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,10 +157,10 @@ void FormStandardImportExport::selectExportFile() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->m_lblSelectFile->setStatus(WidgetWithStatus::Ok, QDir::toNativeSeparators(selected_file), tr("File is selected."));
|
m_ui->m_lblSelectFile->setStatus(WidgetWithStatus::StatusType::Ok, QDir::toNativeSeparators(selected_file), tr("File is selected."));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(m_ui->m_lblSelectFile->status() == WidgetWithStatus::Ok);
|
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(m_ui->m_lblSelectFile->status() == WidgetWithStatus::StatusType::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormStandardImportExport::selectImportFile() {
|
void FormStandardImportExport::selectImportFile() {
|
||||||
@ -184,7 +184,7 @@ void FormStandardImportExport::selectImportFile() {
|
|||||||
m_conversionType = TXTUrlPerLine;
|
m_conversionType = TXTUrlPerLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->m_lblSelectFile->setStatus(WidgetWithStatus::Ok, QDir::toNativeSeparators(selected_file), tr("File is selected."));
|
m_ui->m_lblSelectFile->setStatus(WidgetWithStatus::StatusType::Ok, QDir::toNativeSeparators(selected_file), tr("File is selected."));
|
||||||
QMessageBox::StandardButton answer = MessageBox::show(this,
|
QMessageBox::StandardButton answer = MessageBox::show(this,
|
||||||
QMessageBox::Warning,
|
QMessageBox::Warning,
|
||||||
tr("Get online metadata"),
|
tr("Get online metadata"),
|
||||||
@ -207,7 +207,7 @@ void FormStandardImportExport::parseImportFile(const QString& file_name, bool fe
|
|||||||
input_file.close();
|
input_file.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Error, tr("Cannot open source file."), tr("Cannot open source file."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Error, tr("Cannot open source file."), tr("Cannot open source file."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,14 +260,15 @@ void FormStandardImportExport::exportFeeds() {
|
|||||||
if (result_export) {
|
if (result_export) {
|
||||||
try {
|
try {
|
||||||
IOFactory::writeFile(m_ui->m_lblSelectFile->label()->text(), result_data);
|
IOFactory::writeFile(m_ui->m_lblSelectFile->label()->text(), result_data);
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Ok, tr("Feeds were exported successfully."), tr("Feeds were exported successfully."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Ok, tr("Feeds were exported successfully."),
|
||||||
|
tr("Feeds were exported successfully."));
|
||||||
}
|
}
|
||||||
catch (IOException& ex) {
|
catch (IOException& ex) {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Error, tr("Cannot write into destination file: '%1'."), ex.message());
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Error, tr("Cannot write into destination file: '%1'."), ex.message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Error, tr("Critical error occurred."), tr("Critical error occurred."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Error, tr("Critical error occurred."), tr("Critical error occurred."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,10 +278,10 @@ void FormStandardImportExport::importFeeds() {
|
|||||||
|
|
||||||
if (m_serviceRoot->mergeImportExportModel(m_model, parent, output_message)) {
|
if (m_serviceRoot->mergeImportExportModel(m_model, parent, output_message)) {
|
||||||
m_serviceRoot->requestItemExpand(parent->getSubTree(), true);
|
m_serviceRoot->requestItemExpand(parent->getSubTree(), true);
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Ok, output_message, output_message);
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Ok, output_message, output_message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Error, output_message, output_message);
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::StatusType::Error, output_message, output_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ FormEditTtRssAccount::FormEditTtRssAccount(QWidget* parent)
|
|||||||
m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your TT-RSS account"));
|
m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your TT-RSS account"));
|
||||||
m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your TT-RSS account"));
|
m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your TT-RSS account"));
|
||||||
m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("URL of your TT-RSS instance WITHOUT trailing \"/api/\" string"));
|
m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("URL of your TT-RSS instance WITHOUT trailing \"/api/\" string"));
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Information,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Information,
|
||||||
tr("No test done yet."),
|
tr("No test done yet."),
|
||||||
tr("Here, results of connection test are shown."));
|
tr("Here, results of connection test are shown."));
|
||||||
|
|
||||||
@ -115,23 +115,23 @@ void FormEditTtRssAccount::performTest() {
|
|||||||
QString error = result.error();
|
QString error = result.error();
|
||||||
|
|
||||||
if (error == TTRSS_API_DISABLED) {
|
if (error == TTRSS_API_DISABLED) {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("API access on selected server is not enabled."),
|
tr("API access on selected server is not enabled."),
|
||||||
tr("API access on selected server is not enabled."));
|
tr("API access on selected server is not enabled."));
|
||||||
}
|
}
|
||||||
else if (error == TTRSS_LOGIN_ERROR) {
|
else if (error == TTRSS_LOGIN_ERROR) {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Entered credentials are incorrect."),
|
tr("Entered credentials are incorrect."),
|
||||||
tr("Entered credentials are incorrect."));
|
tr("Entered credentials are incorrect."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Other error occurred, contact developers."),
|
tr("Other error occurred, contact developers."),
|
||||||
tr("Other error occurred, contact developers."));
|
tr("Other error occurred, contact developers."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (result.apiLevel() < TTRSS_MINIMAL_API_LEVEL) {
|
else if (result.apiLevel() < TTRSS_MINIMAL_API_LEVEL) {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr(
|
tr(
|
||||||
"Selected Tiny Tiny RSS server is running unsupported version of API (%1). At least API level %2 is required.").arg(
|
"Selected Tiny Tiny RSS server is running unsupported version of API (%1). At least API level %2 is required.").arg(
|
||||||
QString::number(
|
QString::number(
|
||||||
@ -144,7 +144,7 @@ void FormEditTtRssAccount::performTest() {
|
|||||||
tr("Selected Tiny Tiny RSS server is running unsupported version of API."));
|
tr("Selected Tiny Tiny RSS server is running unsupported version of API."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Ok,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
tr(
|
tr(
|
||||||
"Tiny Tiny RSS server is okay, running with API level %1, while at least API level %2 is required.").arg(
|
"Tiny Tiny RSS server is okay, running with API level %1, while at least API level %2 is required.").arg(
|
||||||
QString::number(
|
QString::number(
|
||||||
@ -158,12 +158,12 @@ void FormEditTtRssAccount::performTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (factory.lastError() != QNetworkReply::NoError) {
|
else if (factory.lastError() != QNetworkReply::NoError) {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Network error: '%1'.").arg(NetworkFactory::networkErrorText(factory.lastError())),
|
tr("Network error: '%1'.").arg(NetworkFactory::networkErrorText(factory.lastError())),
|
||||||
tr("Network error, have you entered correct Tiny Tiny RSS API endpoint and password?"));
|
tr("Network error, have you entered correct Tiny Tiny RSS API endpoint and password?"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr("Unspecified error, did you enter correct URL?"),
|
tr("Unspecified error, did you enter correct URL?"),
|
||||||
tr("Unspecified error, did you enter correct URL?"));
|
tr("Unspecified error, did you enter correct URL?"));
|
||||||
}
|
}
|
||||||
@ -204,10 +204,10 @@ void FormEditTtRssAccount::onUsernameChanged() {
|
|||||||
const QString username = m_ui->m_txtUsername->lineEdit()->text();
|
const QString username = m_ui->m_txtUsername->lineEdit()->text();
|
||||||
|
|
||||||
if (username.isEmpty()) {
|
if (username.isEmpty()) {
|
||||||
m_ui->m_txtUsername->setStatus(WidgetWithStatus::Error, tr("Username cannot be empty."));
|
m_ui->m_txtUsername->setStatus(WidgetWithStatus::StatusType::Error, tr("Username cannot be empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtUsername->setStatus(WidgetWithStatus::Ok, tr("Username is okay."));
|
m_ui->m_txtUsername->setStatus(WidgetWithStatus::StatusType::Ok, tr("Username is okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,10 +215,10 @@ void FormEditTtRssAccount::onPasswordChanged() {
|
|||||||
const QString password = m_ui->m_txtPassword->lineEdit()->text();
|
const QString password = m_ui->m_txtPassword->lineEdit()->text();
|
||||||
|
|
||||||
if (password.isEmpty()) {
|
if (password.isEmpty()) {
|
||||||
m_ui->m_txtPassword->setStatus(WidgetWithStatus::Error, tr("Password cannot be empty."));
|
m_ui->m_txtPassword->setStatus(WidgetWithStatus::StatusType::Error, tr("Password cannot be empty."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtPassword->setStatus(WidgetWithStatus::Ok, tr("Password is okay."));
|
m_ui->m_txtPassword->setStatus(WidgetWithStatus::StatusType::Ok, tr("Password is okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +226,8 @@ void FormEditTtRssAccount::onHttpUsernameChanged() {
|
|||||||
const bool is_username_ok = !m_ui->m_gbHttpAuthentication->isChecked() || !m_ui->m_txtHttpUsername->lineEdit()->text().isEmpty();
|
const bool is_username_ok = !m_ui->m_gbHttpAuthentication->isChecked() || !m_ui->m_txtHttpUsername->lineEdit()->text().isEmpty();
|
||||||
|
|
||||||
m_ui->m_txtHttpUsername->setStatus(is_username_ok ?
|
m_ui->m_txtHttpUsername->setStatus(is_username_ok ?
|
||||||
LineEditWithStatus::Ok :
|
LineEditWithStatus::StatusType::Ok :
|
||||||
LineEditWithStatus::Warning,
|
LineEditWithStatus::StatusType::Warning,
|
||||||
is_username_ok ?
|
is_username_ok ?
|
||||||
tr("Username is ok or it is not needed.") :
|
tr("Username is ok or it is not needed.") :
|
||||||
tr("Username is empty."));
|
tr("Username is empty."));
|
||||||
@ -237,8 +237,8 @@ void FormEditTtRssAccount::onHttpPasswordChanged() {
|
|||||||
const bool is_username_ok = !m_ui->m_gbHttpAuthentication->isChecked() || !m_ui->m_txtHttpPassword->lineEdit()->text().isEmpty();
|
const bool is_username_ok = !m_ui->m_gbHttpAuthentication->isChecked() || !m_ui->m_txtHttpPassword->lineEdit()->text().isEmpty();
|
||||||
|
|
||||||
m_ui->m_txtHttpPassword->setStatus(is_username_ok ?
|
m_ui->m_txtHttpPassword->setStatus(is_username_ok ?
|
||||||
LineEditWithStatus::Ok :
|
LineEditWithStatus::StatusType::Ok :
|
||||||
LineEditWithStatus::Warning,
|
LineEditWithStatus::StatusType::Warning,
|
||||||
is_username_ok ?
|
is_username_ok ?
|
||||||
tr("Password is ok or it is not needed.") :
|
tr("Password is ok or it is not needed.") :
|
||||||
tr("Password is empty."));
|
tr("Password is empty."));
|
||||||
@ -248,13 +248,13 @@ void FormEditTtRssAccount::onUrlChanged() {
|
|||||||
const QString url = m_ui->m_txtUrl->lineEdit()->text();
|
const QString url = m_ui->m_txtUrl->lineEdit()->text();
|
||||||
|
|
||||||
if (url.isEmpty()) {
|
if (url.isEmpty()) {
|
||||||
m_ui->m_txtUrl->setStatus(WidgetWithStatus::Error, tr("URL cannot be empty."));
|
m_ui->m_txtUrl->setStatus(WidgetWithStatus::StatusType::Error, tr("URL cannot be empty."));
|
||||||
}
|
}
|
||||||
else if (url.endsWith(QL1S("/api/")) || url.endsWith(QL1S("/api"))) {
|
else if (url.endsWith(QL1S("/api/")) || url.endsWith(QL1S("/api"))) {
|
||||||
m_ui->m_txtUrl->setStatus(WidgetWithStatus::Warning, tr("URL should NOT end with \"/api/\"."));
|
m_ui->m_txtUrl->setStatus(WidgetWithStatus::StatusType::Warning, tr("URL should NOT end with \"/api/\"."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtUrl->setStatus(WidgetWithStatus::Ok, tr("URL is okay."));
|
m_ui->m_txtUrl->setStatus(WidgetWithStatus::StatusType::Ok, tr("URL is okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user