Remove unneeded class.

This commit is contained in:
Martin Rotter 2021-04-13 08:27:00 +02:00
parent d395f9d36c
commit 0110590fa8
8 changed files with 19 additions and 59 deletions

View file

@ -30,7 +30,7 @@
<url type="donation">https://martinrotter.github.io/donate/</url>
<content_rating type="oars-1.1" />
<releases>
<release version="3.9.0" date="2021-04-12"/>
<release version="3.9.0" date="2021-04-13"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View file

@ -73,7 +73,7 @@
#define TIMEZONE_OFFSET_LIMIT 6
#define CHANGE_EVENT_DELAY 250
#define FLAG_ICON_SUBFOLDER "flags"
#define SEACRH_MESSAGES_ACTION_NAME "search"
#define SEARCH_BOX_ACTION_NAME "search"
#define HIGHLIGHTER_ACTION_NAME "highlighter"
#define SPACER_ACTION_NAME "spacer"
#define SEPARATOR_ACTION_NAME "separator"

View file

@ -11,7 +11,7 @@ class BaseBar {
// Returns all actions which can be added to the toolbar.
virtual QList<QAction*> availableActions() const = 0;
// Returns all changeable actions which are currently included
// Returns all actions which are currently included
// in the toolbar.
virtual QList<QAction*> activatedActions() const = 0;

View file

@ -1,5 +0,0 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#include "gui/messagessearchlineedit.h"
MessagesSearchLineEdit::MessagesSearchLineEdit(QWidget* parent) : BaseLineEdit(parent) {}

View file

@ -1,17 +0,0 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#ifndef MESSAGESEARCHLINEEDIT_H
#define MESSAGESEARCHLINEEDIT_H
#include "gui/baselineedit.h"
class PlainToolButton;
class MessagesSearchLineEdit : public BaseLineEdit {
Q_OBJECT
public:
explicit MessagesSearchLineEdit(QWidget* parent = nullptr);
};
#endif // MESSAGESEARCHLINEEDIT_H

View file

@ -4,7 +4,6 @@
#include "definitions/definitions.h"
#include "gui/baselineedit.h"
#include "gui/messagessearchlineedit.h"
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/settings.h"
@ -59,7 +58,7 @@ QList<QAction*> MessagesToolBar::convertActions(const QStringList& actions) {
act->setSeparator(true);
spec_actions.append(act);
}
else if (action_name == SEACRH_MESSAGES_ACTION_NAME) {
else if (action_name == SEARCH_BOX_ACTION_NAME) {
// Add search box.
spec_actions.append(m_actionSearchMessages);
}
@ -102,7 +101,7 @@ void MessagesToolBar::handleMessageHighlighterChange(QAction* action) {
}
void MessagesToolBar::initializeSearchBox() {
m_txtSearchMessages = new MessagesSearchLineEdit(this);
m_txtSearchMessages = new BaseLineEdit(this);
m_txtSearchMessages->setFixedWidth(FILTER_WIDTH);
m_txtSearchMessages->setPlaceholderText(tr("Search messages"));
@ -110,9 +109,10 @@ void MessagesToolBar::initializeSearchBox() {
m_actionSearchMessages = new QWidgetAction(this);
m_actionSearchMessages->setDefaultWidget(m_txtSearchMessages);
m_actionSearchMessages->setIcon(qApp->icons()->fromTheme(QSL("system-search")));
m_actionSearchMessages->setProperty("type", SEACRH_MESSAGES_ACTION_NAME);
m_actionSearchMessages->setProperty("type", SEARCH_BOX_ACTION_NAME);
m_actionSearchMessages->setProperty("name", tr("Message search box"));
connect(m_txtSearchMessages, &MessagesSearchLineEdit::textChanged, this, &MessagesToolBar::messageSearchPatternChanged);
connect(m_txtSearchMessages, &BaseLineEdit::textChanged, this, &MessagesToolBar::messageSearchPatternChanged);
}
void MessagesToolBar::initializeHighlighter() {

View file

@ -7,12 +7,9 @@
#include "core/messagesmodel.h"
class MessagesSearchLineEdit;
class BaseLineEdit;
class QWidgetAction;
class QToolButton;
class QMenu;
class MessagesToolBar : public BaseToolBar {
@ -21,34 +18,21 @@ class MessagesToolBar : public BaseToolBar {
public:
explicit MessagesToolBar(const QString& title, QWidget* parent = nullptr);
// External access to search line edit.
inline MessagesSearchLineEdit* searchLineEdit();
BaseLineEdit* searchLineEdit();
// Implementation of BaseToolBar interface.
QList<QAction*> availableActions() const;
QList<QAction*> activatedActions() const;
void saveAndSetActions(const QStringList& actions);
// 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, bool initial_load = false);
QList<QAction*> convertActions(const QStringList& actions);
QStringList defaultActions() const;
QStringList savedActions() const;
virtual QList<QAction*> availableActions() const;
virtual QList<QAction*> activatedActions() const;
virtual void saveAndSetActions(const QStringList& actions);
virtual void loadSpecificActions(const QList<QAction*>& actions, bool initial_load = false);
virtual QList<QAction*> convertActions(const QStringList& actions);
virtual QStringList defaultActions() const;
virtual QStringList savedActions() const;
signals:
void messageSearchPatternChanged(const QString& pattern);
// Emitted if message filter is changed.
void messageFilterChanged(MessagesModel::MessageHighlighter filter);
private slots:
// Called when highlighter gets changed.
void handleMessageHighlighterChange(QAction* action);
private:
@ -60,10 +44,10 @@ class MessagesToolBar : public BaseToolBar {
QToolButton* m_btnMessageHighlighter;
QMenu* m_menuMessageHighlighter;
QWidgetAction* m_actionSearchMessages;
MessagesSearchLineEdit* m_txtSearchMessages;
BaseLineEdit* m_txtSearchMessages;
};
inline MessagesSearchLineEdit* MessagesToolBar::searchLineEdit() {
inline BaseLineEdit* MessagesToolBar::searchLineEdit() {
return m_txtSearchMessages;
}

View file

@ -85,7 +85,6 @@ HEADERS += core/feeddownloader.h \
gui/messagebox.h \
gui/messagecountspinbox.h \
gui/messagepreviewer.h \
gui/messagessearchlineedit.h \
gui/messagestoolbar.h \
gui/messagesview.h \
gui/networkproxydetails.h \
@ -264,7 +263,6 @@ SOURCES += core/feeddownloader.cpp \
gui/messagebox.cpp \
gui/messagecountspinbox.cpp \
gui/messagepreviewer.cpp \
gui/messagessearchlineedit.cpp \
gui/messagestoolbar.cpp \
gui/messagesview.cpp \
gui/networkproxydetails.cpp \