diff --git a/resources/desktop/com.github.rssguard.appdata.xml b/resources/desktop/com.github.rssguard.appdata.xml index db56d6755..85711a815 100644 --- a/resources/desktop/com.github.rssguard.appdata.xml +++ b/resources/desktop/com.github.rssguard.appdata.xml @@ -26,7 +26,7 @@ https://github.com/sponsors/martinrotter - + none diff --git a/src/librssguard/core/feeddownloader.cpp b/src/librssguard/core/feeddownloader.cpp index d8363c0f0..3fc79da22 100644 --- a/src/librssguard/core/feeddownloader.cpp +++ b/src/librssguard/core/feeddownloader.cpp @@ -422,45 +422,57 @@ bool FeedDownloader::isCacheSynchronizationRunning() const { void FeedDownloader::removeDuplicateMessages(QList& messages) { auto idx = 0; + while (idx < messages.size()) { Message& message = messages[idx]; std::function is_duplicate; + if (message.m_id > 0) { is_duplicate = [](const Message& a, const Message& b) { - return a.m_id == b.m_id; - }; + return a.m_id == b.m_id; + }; } else if (message.m_customId.isEmpty()) { is_duplicate = [](const Message& a, const Message& b) { - return std::tie(a.m_title, a.m_url, a.m_author) == std::tie(b.m_title, b.m_url, b.m_author); - }; + return std::tie(a.m_title, a.m_url, a.m_author) == std::tie(b.m_title, b.m_url, b.m_author); + }; } else { is_duplicate = [](const Message& a, const Message& b) { - return a.m_customId == b.m_customId; - }; + return a.m_customId == b.m_customId; + }; } + auto next_idx = idx + 1; // Index of next message to check after removing all duplicates. auto last_idx = idx; // Index of the last kept duplicate. + idx = next_idx; // Remove all duplicate messages, and keep the message with the latest created date. // If the created date is identical for all duplicate messages then keep the last message in the list. while (idx < messages.size()) { auto& last_duplicate = messages[last_idx]; + if (is_duplicate(last_duplicate, messages[idx])) { if (last_duplicate.m_created <= messages[idx].m_created) { // The last seen message was created earlier or at the same date -- keep the current, and remove the last. + qWarningNN << LOGSEC_CORE << "Removing article" << QUOTE_W_SPACE(last_duplicate.m_title) + << "before saving articles to DB, because it is duplicate."; + messages.removeAt(last_idx); if (last_idx + 1 == next_idx) { // The `next_idx` was pointing to the message following the duplicate. With that duplicate removed the // next index needs to be adjusted. next_idx = last_idx; } + last_idx = idx; ++idx; } else { + qWarningNN << LOGSEC_CORE << "Removing article" << QUOTE_W_SPACE(messages[idx].m_title) + << "before saving articles to DB, because it is duplicate."; + messages.removeAt(idx); } } diff --git a/src/librssguard/core/feeddownloader.h b/src/librssguard/core/feeddownloader.h index 7bed58667..d35556cbf 100644 --- a/src/librssguard/core/feeddownloader.h +++ b/src/librssguard/core/feeddownloader.h @@ -59,7 +59,7 @@ class FeedDownloader : public QObject { const QHash& stated_messages, const QHash& tagged_messages); void finalizeUpdate(); - static void removeDuplicateMessages(QList& messages); + void removeDuplicateMessages(QList& messages); bool m_isCacheSynchronizationRunning; bool m_stopCacheSynchronization; diff --git a/src/librssguard/definitions/definitions.h b/src/librssguard/definitions/definitions.h index fcc1c65fd..0b4a22892 100644 --- a/src/librssguard/definitions/definitions.h +++ b/src/librssguard/definitions/definitions.h @@ -103,16 +103,25 @@ #define CLI_VER_SHORT "v" #define CLI_VER_LONG "version" + #define CLI_HELP_SHORT "h" #define CLI_HELP_LONG "help" + #define CLI_LOG_SHORT "l" #define CLI_LOG_LONG "log" + #define CLI_DAT_SHORT "d" #define CLI_DAT_LONG "data" + #define CLI_SIN_SHORT "s" #define CLI_SIN_LONG "no-single-instance" -#define CLI_NDEBUG_SHORT "n" + +#define CLI_NSTDOUTERR_SHORT "n" +#define CLI_NSTDOUTERR_LONG "no-standard-output" + +#define CLI_NDEBUG_SHORT "g" #define CLI_NDEBUG_LONG "no-debug-output" + #define CLI_QUIT_INSTANCE "q" #define CLI_IS_RUNNING "a" diff --git a/src/librssguard/gui/settings/settingsgui.cpp b/src/librssguard/gui/settings/settingsgui.cpp index d5c81fb56..bb04d3d86 100644 --- a/src/librssguard/gui/settings/settingsgui.cpp +++ b/src/librssguard/gui/settings/settingsgui.cpp @@ -35,7 +35,7 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se << tr("Author")); #if !defined(Q_OS_UNIX) || defined(Q_OS_MACOS) - m_ui->m_tabUi->setTabVisible(m_ui->m_tabUi->indexOf(m_ui->m_taskBar), false); + m_ui->m_tabUi->setTabVisible(m_ui->m_tabUi->indexOf(m_ui->m_tabTaskBar), false); #endif m_ui->m_helpCustomSkinColors->setHelpText(tr("You can override some colors defined by your skin here. " diff --git a/src/librssguard/gui/settings/settingsgui.ui b/src/librssguard/gui/settings/settingsgui.ui index 8271a06c7..e63b0b53e 100644 --- a/src/librssguard/gui/settings/settingsgui.ui +++ b/src/librssguard/gui/settings/settingsgui.ui @@ -199,6 +199,20 @@ + + + Task bar + + + + + + Display count of unread messages + + + + + Tabs @@ -410,24 +424,6 @@ - - - Task bar - - - - - 10 - 10 - 321 - 25 - - - - Display count of unread messages - - - diff --git a/src/librssguard/miscellaneous/application.cpp b/src/librssguard/miscellaneous/application.cpp index 5e06db68a..a1610dc4d 100644 --- a/src/librssguard/miscellaneous/application.cpp +++ b/src/librssguard/miscellaneous/application.cpp @@ -25,6 +25,7 @@ #include +#include #include #include #include @@ -795,10 +796,13 @@ void Application::parseCmdArgumentsFromMyInstance() { QSL("user-data-folder")); QCommandLineOption disable_singleinstance({ QSL(CLI_SIN_SHORT), QSL(CLI_SIN_LONG) }, QSL("Allow running of multiple application instances.")); - QCommandLineOption disable_debug({ QSL(CLI_NDEBUG_SHORT), QSL(CLI_NDEBUG_LONG) }, + QCommandLineOption disable_only_debug({ QSL(CLI_NDEBUG_SHORT), QSL(CLI_NDEBUG_LONG) }, + QSL("Disable just \"debug\" outputs.")); + QCommandLineOption disable_debug({ QSL(CLI_NSTDOUTERR_SHORT), QSL(CLI_NSTDOUTERR_LONG) }, QSL("Completely disable stdout/stderr outputs.")); - m_cmdParser.addOptions({ help, version, log_file, custom_data_folder, disable_singleinstance, disable_debug }); + m_cmdParser.addOptions({ help, version, log_file, custom_data_folder, + disable_singleinstance, disable_only_debug, disable_debug }); m_cmdParser.addPositionalArgument(QSL("urls"), QSL("List of URL addresses pointing to individual online feeds which should be added."), QSL("[url-1 ... url-n]")); @@ -818,6 +822,10 @@ void Application::parseCmdArgumentsFromMyInstance() { s_customLogFile.chop(1); } + if (m_cmdParser.isSet(QSL(CLI_NDEBUG_SHORT))) { + QLoggingCategory::setFilterRules(QSL("*.debug=false")); + } + if (!m_cmdParser.value(QSL(CLI_DAT_SHORT)).isEmpty()) { auto data_folder = QDir::toNativeSeparators(m_cmdParser.value(QSL(CLI_DAT_SHORT))); @@ -843,7 +851,7 @@ void Application::parseCmdArgumentsFromMyInstance() { qDebugNN << LOGSEC_CORE << "Explicitly allowing this instance to run."; } - if (m_cmdParser.isSet(QSL(CLI_NDEBUG_SHORT))) { + if (m_cmdParser.isSet(QSL(CLI_NSTDOUTERR_SHORT))) { s_disableDebug = true; qDebugNN << LOGSEC_CORE << "Disabling any stdout/stderr outputs."; } diff --git a/src/librssguard/miscellaneous/feedreader.cpp b/src/librssguard/miscellaneous/feedreader.cpp index cf31d3333..38d76ab71 100644 --- a/src/librssguard/miscellaneous/feedreader.cpp +++ b/src/librssguard/miscellaneous/feedreader.cpp @@ -61,10 +61,10 @@ QList FeedReader::feedServices() { m_feedServices.append(new FeedlyEntryPoint()); m_feedServices.append(new GmailEntryPoint()); m_feedServices.append(new GreaderEntryPoint()); - m_feedServices.append(new NewsBlurEntryPoint()); m_feedServices.append(new OwnCloudServiceEntryPoint()); #if defined(DEBUG) + m_feedServices.append(new NewsBlurEntryPoint()); m_feedServices.append(new RedditEntryPoint()); #endif