Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ignorelistsettingspage.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2015 by the Quassel Project *
3  * devel@quassel-irc.org *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) version 3. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef IGNORELISTSETTINGSPAGE_H
22 #define IGNORELISTSETTINGSPAGE_H
23 
24 #include <QStyledItemDelegate>
25 #include <QButtonGroup>
26 
27 #include "settingspage.h"
28 #include "ui_ignorelistsettingspage.h"
29 #include "ui_ignorelisteditdlg.h"
30 #include "ignorelistmodel.h"
32 
33 class QEvent;
34 class QPainter;
35 class QAbstractItemModel;
36 
37 // the delegate is used to draw the checkbox in column 0
38 class IgnoreListDelegate : public QStyledItemDelegate
39 {
40  Q_OBJECT
41 
42 public:
43  IgnoreListDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {}
44  void paint(QPainter *painter, const QStyleOptionViewItem &option,
45  const QModelIndex &index) const;
46  bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
47  const QModelIndex &index);
48 };
49 
50 
51 class IgnoreListEditDlg : public QDialog
52 {
53  Q_OBJECT
54 
55 public:
56  IgnoreListEditDlg(const IgnoreListManager::IgnoreListItem &item, QWidget *parent = 0, bool enabled = false);
58  void enableOkButton(bool state);
59 
60 private slots:
61  void widgetHasChanged();
63 
64 private:
68  Ui::IgnoreListEditDlg ui;
69  QButtonGroup _typeButtonGroup;
70  QButtonGroup _strictnessButtonGroup;
71  QButtonGroup _scopeButtonGroup;
72 };
73 
74 
76 {
77  Q_OBJECT
78 
79 public:
80  IgnoreListSettingsPage(QWidget *parent = 0);
82  virtual inline bool hasDefaults() const { return false; }
83  virtual inline bool needsCoreConnection() const { return true; }
84  void editIgnoreRule(const QString &ignoreRule);
85 
86 public slots:
87  void save();
88  void load();
89  void defaults();
90  void newIgnoreRule(QString rule = QString());
91 
92 private slots:
93  void enableDialog(bool);
96  void selectionChanged(const QItemSelection &selection, const QItemSelection &);
97 
98 private:
100  Ui::IgnoreListSettingsPage ui;
102 };
103 
104 
105 #endif //IGNORELISTSETTINGSPAGE_H