Eliminate some compiler/runtime warnings.

This commit is contained in:
Martin Rotter 2020-05-26 09:05:59 +02:00
parent 67be4f0ebc
commit d3dae650db
11 changed files with 41 additions and 16 deletions

View file

@ -21,7 +21,7 @@ BaseToolBar::~BaseToolBar() {
}
void BaseBar::loadSavedActions() {
loadSpecificActions(getSpecificActions(savedActions()));
loadSpecificActions(getSpecificActions(savedActions()), true);
}
QAction* BaseBar::findMatchingAction(const QString& action, const QList<QAction*>& actions) const {

View file

@ -26,7 +26,7 @@ class BaseBar {
// Loads the toolbar state from settings.
virtual void loadSavedActions();
virtual QList<QAction*> getSpecificActions(const QStringList& actions) = 0;
virtual void loadSpecificActions(const QList<QAction*>& actions) = 0;
virtual void loadSpecificActions(const QList<QAction*>& actions, bool initial_load = false) = 0;
protected:
QAction* findMatchingAction(const QString& action, const QList<QAction*>& actions) const;

View file

@ -299,7 +299,6 @@ void FormMain::updateRecycleBinMenu() {
root_menu->setIcon(activated_root->icon());
root_menu->setToolTip(activated_root->description());
RecycleBin* bin = activated_root->recycleBin();
QList<QAction*> context_menu;
if (bin == nullptr) {
@ -751,6 +750,7 @@ void FormMain::createConnections() {
void FormMain::backupDatabaseSettings() {
QScopedPointer<FormBackupDatabaseSettings> form(new FormBackupDatabaseSettings(this));
form->exec();
}
@ -796,6 +796,7 @@ void FormMain::showAddAccountDialog() {
QScopedPointer<FormAddAccount> form_update(new FormAddAccount(qApp->feedReader()->feedServices(),
qApp->feedReader()->feedsModel(),
this));
form_update->exec();
}

View file

@ -222,8 +222,6 @@ void FeedMessageViewer::initialize() {
m_toolBarMessages->setFloatable(false);
m_toolBarMessages->setMovable(false);
m_toolBarMessages->setAllowedAreas(Qt::TopToolBarArea);
m_toolBarFeeds->loadSavedActions();
m_toolBarMessages->loadSavedActions();
m_messagesBrowser->clear();
// Now refresh visual setup.

View file

@ -66,7 +66,9 @@ QList<QAction*> FeedsToolBar::getSpecificActions(const QStringList& actions) {
return spec_actions;
}
void FeedsToolBar::loadSpecificActions(const QList<QAction*>& actions) {
void FeedsToolBar::loadSpecificActions(const QList<QAction*>& actions, bool initial_load) {
Q_UNUSED(initial_load)
clear();
for (QAction* act : actions) {

View file

@ -16,7 +16,7 @@ class FeedsToolBar : public BaseToolBar {
void saveChangeableActions(const QStringList& actions);
QList<QAction*> getSpecificActions(const QStringList& actions);
void loadSpecificActions(const QList<QAction*>& actions);
void loadSpecificActions(const QList<QAction*>& actions, bool initial_load = false);
QStringList defaultActions() const;
QStringList savedActions() const;

View file

@ -20,6 +20,7 @@ MessagesToolBar::MessagesToolBar(const QString& title, QWidget* parent)
QList<QAction*> MessagesToolBar::availableActions() const {
QList<QAction*> available_actions = qApp->userActions();
available_actions.append(m_actionSearchMessages);
available_actions.append(m_actionMessageHighlighter);
return available_actions;
@ -84,7 +85,9 @@ QList<QAction*> MessagesToolBar::getSpecificActions(const QStringList& actions)
return spec_actions;
}
void MessagesToolBar::loadSpecificActions(const QList<QAction*>& actions) {
void MessagesToolBar::loadSpecificActions(const QList<QAction*>& actions, bool initial_load) {
Q_UNUSED(initial_load)
clear();
foreach (QAction* act, actions) {

View file

@ -8,8 +8,11 @@
#include "core/messagesmodel.h"
class MessagesSearchLineEdit;
class QWidgetAction;
class QToolButton;
class QMenu;
class MessagesToolBar : public BaseToolBar {
@ -30,7 +33,7 @@ class MessagesToolBar : public BaseToolBar {
// Loads actions as specified by external actions list.
// NOTE: This is used primarily for reloading actions
// when they are changed from settings.
void loadSpecificActions(const QList<QAction*>& actions);
void loadSpecificActions(const QList<QAction*>& actions, bool initial_load = false);
QList<QAction*> getSpecificActions(const QStringList& actions);

View file

@ -83,7 +83,6 @@ QStringList StatusBar::savedActions() const {
QList<QAction*> StatusBar::getSpecificActions(const QStringList& actions) {
bool progress_visible = this->actions().contains(m_barProgressFeedsAction) && m_lblProgressFeeds->isVisible() &&
m_barProgressFeeds->isVisible();
QList<QAction*> available_actions = availableActions();
QList<QAction*> spec_actions;
@ -162,7 +161,7 @@ QList<QAction*> StatusBar::getSpecificActions(const QStringList& actions) {
return spec_actions;
}
void StatusBar::loadSpecificActions(const QList<QAction*>& actions) {
void StatusBar::loadSpecificActions(const QList<QAction*>& actions, bool initial_load) {
foreach (QAction* act, this->actions()) {
QWidget* widget = act->property("widget").isValid() ? static_cast<QWidget*>(act->property("widget").value<void*>()) : nullptr;
@ -171,10 +170,13 @@ void StatusBar::loadSpecificActions(const QList<QAction*>& actions) {
}
}
if (!initial_load) {
removeWidget(m_barProgressDownload);
removeWidget(m_barProgressFeeds);
removeWidget(m_lblProgressDownload);
removeWidget(m_lblProgressFeeds);
}
clear();
foreach (QAction* act, actions) {

View file

@ -8,8 +8,11 @@
#include "gui/basetoolbar.h"
class QProgressBar;
class PlainToolButton;
class QLabel;
class Mutex;
class StatusBar : public QStatusBar, public BaseBar {
@ -25,7 +28,7 @@ class StatusBar : public QStatusBar, public BaseBar {
QStringList defaultActions() const;
QStringList savedActions() const;
QList<QAction*> getSpecificActions(const QStringList& actions);
void loadSpecificActions(const QList<QAction*>& actions);
void loadSpecificActions(const QList<QAction*>& actions, bool initial_load = false);
public slots:
void showProgressFeeds(int progress, const QString& label);

View file

@ -36,6 +36,7 @@
#include <QWebEngineProfile>
#include <QWebEngineScript>
#include <QWebEngineScriptCollection>
#include <QWebEngineUrlScheme>
#endif
Application::Application(const QString& id, int& argc, char** argv)
@ -68,10 +69,22 @@ Application::Application(const QString& id, int& argc, char** argv)
connect(this, &Application::saveStateRequest, this, &Application::onSaveState);
#if defined(USE_WEBENGINE)
QWebEngineUrlScheme url_scheme(APP_LOW_NAME);
url_scheme.setDefaultPort(QWebEngineUrlScheme::SpecialPort::PortUnspecified);
url_scheme.setSyntax(QWebEngineUrlScheme::Syntax::Host);
url_scheme.setFlags(QWebEngineUrlScheme::Flag::LocalScheme |
QWebEngineUrlScheme::Flag::LocalAccessAllowed |
QWebEngineUrlScheme::Flag::ServiceWorkersAllowed |
QWebEngineUrlScheme::Flag::ContentSecurityPolicyIgnored);
QWebEngineUrlScheme::registerScheme(url_scheme);
connect(QWebEngineProfile::defaultProfile(), &QWebEngineProfile::downloadRequested, this, &Application::downloadRequested);
QWebEngineProfile::defaultProfile()->setRequestInterceptor(m_urlInterceptor);
m_urlInterceptor->loadSettings();
QWebEngineProfile::defaultProfile()->installUrlSchemeHandler(QByteArray(APP_LOW_NAME),
new RssGuardSchemeHandler(QWebEngineProfile::defaultProfile()));
#endif