Also remove some accidental fallthroughs, and fix the Qt4 build.
Closes GH-303.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CLIENT_H_
-#define CLIENT_H_
+#pragma once
#include <QList>
#include <QPointer>
-#include <highlightrulemanager.h>
#include "bufferinfo.h"
#include "coreaccount.h"
#include "coreconnection.h"
+#include "highlightrulemanager.h"
#include "quassel.h"
#include "types.h"
friend class CoreConnection;
};
-
-
-#endif
***************************************************************************/
#include "highlightrulemanager.h"
+
#include "util.h"
-#include <QtCore>
#include <QDebug>
-#include <QStringList>
INIT_SYNCABLE_OBJECT(HighlightRuleManager)
HighlightRuleManager &HighlightRuleManager::operator=(const HighlightRuleManager &other)
}
-bool HighlightRuleManager::_match(const QString &msgContents, const QString &msgSender, Message::Type msgType, Message::Flags msgFlags, const QString &bufferName, const QString ¤tNick, const QStringList identityNicks)
+bool HighlightRuleManager::match(const QString &msgContents,
+ const QString &msgSender,
+ Message::Type msgType,
+ Message::Flags msgFlags,
+ const QString &bufferName,
+ const QString ¤tNick,
+ const QStringList identityNicks)
{
if (!((msgType & (Message::Plain | Message::Notice | Message::Action)) && !(msgFlags & Message::Self))) {
return false;
bool HighlightRuleManager::match(const Message &msg, const QString ¤tNick, const QStringList &identityNicks)
{
- return _match(msg.contents(), msg.sender(), msg.type(), msg.flags(), msg.bufferInfo().bufferName(), currentNick, identityNicks);
+ return match(msg.contents(), msg.sender(), msg.type(), msg.flags(), msg.bufferInfo().bufferName(), currentNick, identityNicks);
}
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef HIGHLIGHTRULELISTMANAGER_H
-#define HIGHLIGHTRULELISTMANAGER_H
+#pragma once
-#include <QString>
-#include <QRegExp>
#include <utility>
+#include <QRegExp>
+#include <QString>
+#include <QStringList>
+#include <QVariantList>
+#include <QVariantMap>
+
#include "message.h"
#include "syncableobject.h"
inline const HighlightRuleList &highlightRuleList() const { return _highlightRuleList; }
inline HighlightNickType highlightNick() { return _highlightNick; }
- inline bool nicksCaseSensitive() { return _nicksCaseSensitive; }
+ inline bool nicksCaseSensitive() { return _nicksCaseSensitive; }
//! Check if a message matches the HighlightRule
/** This method checks if a message matches the users highlight rules.
protected:
void setHighlightRuleList(const QList<HighlightRule> &HighlightRuleList) { _highlightRuleList = HighlightRuleList; }
- bool _match(const QString &msgContents, const QString &msgSender, Message::Type msgType, Message::Flags msgFlags, const QString &bufferName, const QString ¤tNick, const QStringList identityNicks);
+ bool match(const QString &msgContents,
+ const QString &msgSender,
+ Message::Type msgType,
+ Message::Flags msgFlags,
+ const QString &bufferName,
+ const QString ¤tNick,
+ const QStringList identityNicks);
signals:
void ruleAdded(QString name, bool isRegEx, bool isCaseSensitive, bool isEnabled, bool isInverse, QString sender, QString chanName);
HighlightNickType _highlightNick = HighlightNickType::CurrentNick;
bool _nicksCaseSensitive = false;
};
-
-
-#endif // HIGHLIGHTRULELISTMANAGER_H
bool CoreHighlightRuleManager::match(const RawMessage &msg, const QString ¤tNick, const QStringList &identityNicks)
{
- return _match(msg.text, msg.sender, msg.type, msg.flags, msg.target, currentNick, identityNicks);
+ return match(msg.text, msg.sender, msg.type, msg.flags, msg.target, currentNick, identityNicks);
}
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef COREHIGHLIGHTRULEMANAHER_H
-#define COREHIGHLIGHTRULEMANAHER_H
+#pragma once
#include "highlightrulemanager.h"
class CoreHighlightRuleManager : public HighlightRuleManager
{
+ Q_OBJECT
SYNCABLE_OBJECT
- Q_OBJECT
+
+ using HighlightRuleManager::match;
public:
explicit CoreHighlightRuleManager(CoreSession *parent);
inline virtual const QMetaObject *syncMetaObject() const { return &HighlightRuleManager::staticMetaObject; }
bool match(const RawMessage &msg, const QString ¤tNick, const QStringList &identityNicks);
+
public slots:
virtual inline void requestToggleHighlightRule(const QString &highlightRule) { toggleHighlightRule(highlightRule); }
virtual inline void requestRemoveHighlightRule(const QString &highlightRule) { removeHighlightRule(highlightRule); }
private slots:
void save() const;
};
-
-
-#endif //COREHIGHLIGHTRULEMANAHER_H
#include "corecoreinfo.h"
#include "corealiasmanager.h"
+#include "corehighlightrulemanager.h"
#include "coreignorelistmanager.h"
#include "peer.h"
#include "protocol.h"
#include "message.h"
#include "storage.h"
-#include "corehighlightrulemanager.h"
class CoreBacklogManager;
class CoreBufferSyncer;
#include <QTableView>
#include <QToolBar>
#include <QInputDialog>
-#include <settingspages/corehighlightsettingspage.h>
#ifdef HAVE_KDE4
# include <KHelpMenu>
#include "settingspages/connectionsettingspage.h"
#include "settingspages/coreaccountsettingspage.h"
#include "settingspages/coreconnectionsettingspage.h"
+#include <settingspages/corehighlightsettingspage.h>
#include "settingspages/dccsettingspage.h"
#include "settingspages/highlightsettingspage.h"
#include "settingspages/identitiessettingspage.h"
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#include <QHeaderView>
#include <QTableWidget>
-#include <QtWidgets/QHeaderView>
+#include "client.h"
#include "corehighlightsettingspage.h"
#include "qtui.h"
-#include "client.h"
CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent)
: SettingsPage(tr("Interface"), tr("Core-Side Highlights"), parent)
connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected()));
}
+
void CoreHighlightSettingsPage::setupRuleTable(QTableWidget *table) const
{
table->verticalHeader()->hide();
switch (item->column()) {
case CoreHighlightSettingsPage::EnableColumn:
highlightRule.isEnabled = (item->checkState() == Qt::Checked);
+ break;
case CoreHighlightSettingsPage::NameColumn:
if (item->text() == "")
item->setText(tr("this shouldn't be empty"));
switch (item->column()) {
case CoreHighlightSettingsPage::EnableColumn:
ignoredRule.isEnabled = (item->checkState() == Qt::Checked);
+ break;
case CoreHighlightSettingsPage::NameColumn:
if (item->text() == "")
item->setText(tr("this shouldn't be empty"));
rule.sender, rule.chanName);
}
- auto highlightNickType = ui.highlightNicksComboBox->currentData().value<int>();
+ auto highlightNickType = ui.highlightNicksComboBox->itemData(ui.highlightNicksComboBox->currentIndex()).value<int>();
clonedManager.setHighlightNick(HighlightRuleManager::HighlightNickType(highlightNickType));
clonedManager.setNicksCaseSensitive(ui.nicksCaseSensitive->isChecked());
void CoreHighlightSettingsPage::widgetHasChanged()
{
setChangedState(true);
-}
\ No newline at end of file
+}
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef _COREHIGHLIGHTSETTINGSPAGE_H_
-#define _COREHIGHLIGHTSETTINGSPAGE_H_
+#pragma once
#include <QVariantList>
#include <QTableWidgetItem>
-#include <highlightrulemanager.h>
+#include "highlightrulemanager.h"
#include "settingspage.h"
+
#include "ui_corehighlightsettingspage.h"
class CoreHighlightSettingsPage : public SettingsPage
private:
Ui::CoreHighlightSettingsPage ui;
+
HighlightRuleManager::HighlightRuleList highlightList;
HighlightRuleManager::HighlightRuleList ignoredList;
+
enum column {
EnableColumn = 0,
NameColumn = 1,
bool _initialized;
};
-
-
-#endif