qt: add missing initializers (CID 1325722)
[metze/wireshark/wip.git] / ui / qt / coloring_rules_dialog.h
1 /* coloring_rules_dialog.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef COLORING_RULES_DIALOG_H
23 #define COLORING_RULES_DIALOG_H
24
25 #include <QDialog>
26
27 class QAbstractButton;
28 class QTreeWidget;
29
30 struct _color_filter;
31 struct _GSList; // This is a completely and totally safe forward declaration, right?
32
33 namespace Ui {
34 class ColoringRulesDialog;
35 }
36
37 #include <QStyledItemDelegate>
38
39 class ColoringRulesTreeDelegate : public QStyledItemDelegate
40 {
41     Q_OBJECT
42
43 public:
44     ColoringRulesTreeDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
45     ~ColoringRulesTreeDelegate() {}
46
47     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
48     void setTree(QTreeWidget* tree) { tree_ = tree; }
49
50 private:
51     QTreeWidget* tree_;
52
53 private slots:
54     void ruleNameChanged(const QString name);
55     void ruleFilterChanged(const QString filter);
56 };
57
58 class ColoringRulesDialog : public QDialog
59 {
60     Q_OBJECT
61
62 public:
63     explicit ColoringRulesDialog(QWidget *parent = 0, QString add_filter = QString());
64     ~ColoringRulesDialog();
65
66     void addColor(struct _color_filter *colorf);
67
68 protected:
69     void showEvent(QShowEvent *);
70
71 private slots:
72     void updateWidgets();
73     struct _GSList *createColorFilterList();
74     void on_coloringRulesTreeWidget_itemSelectionChanged();
75     void on_fGPushButton_clicked();
76     void on_bGPushButton_clicked();
77     void on_newToolButton_clicked();
78     void on_deleteToolButton_clicked();
79     void on_copyToolButton_clicked();
80     void on_buttonBox_clicked(QAbstractButton *button);
81     void on_buttonBox_accepted();
82     void on_buttonBox_helpRequested();
83
84 private:
85     Ui::ColoringRulesDialog *ui;
86     QPushButton *import_button_;
87     QPushButton *export_button_;
88     ColoringRulesTreeDelegate coloring_rules_tree_delegate_;
89     struct _GSList *conversation_colors_;
90
91     void addColoringRule(bool disabled, QString name, QString filter, QColor foreground, QColor background, bool start_editing = false);
92     void changeColor(bool foreground = true);
93 };
94
95 #endif // COLORING_RULES_DIALOG_H
96
97 /*
98  * Editor modelines
99  *
100  * Local Variables:
101  * c-basic-offset: 4
102  * tab-width: 8
103  * indent-tabs-mode: nil
104  * End:
105  *
106  * ex: set shiftwidth=4 tabstop=8 expandtab:
107  * :indentSize=4:tabSize=8:noTabs=true:
108  */