Add a UAT dialog. Make UAT preferences uat_t * instead of void *.
[metze/wireshark/wip.git] / ui / qt / uat_dialog.h
1 /* uat_dialog.h
2  *
3  * $Id$
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 #ifndef UAT_DIALOG_H
25 #define UAT_DIALOG_H
26
27 #include "config.h"
28
29 #include <glib.h>
30
31 #include "epan/uat-int.h"
32
33 #include "syntax_line_edit.h"
34
35 #include <QComboBox>
36 #include <QDialog>
37 #include <QLineEdit>
38 #include <QPushButton>
39 #include <QTreeWidgetItem>
40
41 namespace Ui {
42 class UatDialog;
43 }
44
45 class UatDialog : public QDialog
46 {
47     Q_OBJECT
48     
49 public:
50     explicit UatDialog(QWidget *parent = 0, uat_t *uat = NULL);
51     ~UatDialog();
52
53     void setUat(uat_t *uat = NULL);
54     
55 protected:
56     void keyPressEvent(QKeyEvent *evt);
57
58 private slots:
59     void on_uatTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
60     void on_uatTreeWidget_itemActivated(QTreeWidgetItem *item, int column);
61     void on_uatTreeWidget_itemSelectionChanged();
62     void lineEditPrefDestroyed();
63     void enumPrefDestroyed();
64     void enumPrefCurrentIndexChanged(int index);
65     void stringPrefTextChanged(const QString & text);
66     void stringPrefEditingFinished();
67     void on_newToolButton_clicked();
68     void on_deleteToolButton_clicked();
69     void on_copyToolButton_clicked();
70     void on_buttonBox_accepted();
71     void on_buttonBox_rejected();
72     void on_buttonBox_helpRequested();
73
74 private:
75     Ui::UatDialog *ui;
76     QPushButton *ok_button_;
77     QPushButton *help_button_;
78     uat_t *uat_;
79     int cur_column_;
80     SyntaxLineEdit *cur_line_edit_;
81     QString saved_string_pref_;
82     QComboBox *cur_combo_box_;
83     int saved_combo_idx_;
84
85     QString fieldString(guint row, guint column);
86     void updateItem(QTreeWidgetItem &item);
87     void updateItems();
88     void activateLastItem();
89     void applyChanges();
90     void addRecord(bool copy_from_current = false);
91 };
92
93 #endif // UAT_DIALOG_H