1 /* uat_dialog.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef UAT_DIALOG_H
11 #define UAT_DIALOG_H
12 
13 #include <config.h>
14 
15 #include <glib.h>
16 
17 #include "geometry_state_dialog.h"
18 #include <ui/qt/models/uat_model.h>
19 #include <ui/qt/models/uat_delegate.h>
20 
21 class QComboBox;
22 class QPushButton;
23 
24 struct epan_uat;
25 
26 namespace Ui {
27 class UatDialog;
28 }
29 
30 class UatDialog : public GeometryStateDialog
31 {
32     Q_OBJECT
33 
34 public:
35     explicit UatDialog(QWidget *parent = 0, struct epan_uat *uat = NULL);
36     ~UatDialog();
37 
38     void setUat(struct epan_uat *uat = NULL);
39 
40 private slots:
41     void copyFromProfile(QString filename);
42     void modelDataChanged(const QModelIndex &topLeft);
43     void modelRowsRemoved();
44     void modelRowsReset();
45     void on_uatTreeView_currentItemChanged(const QModelIndex &current, const QModelIndex &previous);
46     void acceptChanges();
47     void rejectChanges();
48     void on_newToolButton_clicked();
49     void on_deleteToolButton_clicked();
50     void on_copyToolButton_clicked();
51     void on_moveUpToolButton_clicked();
52     void on_moveDownToolButton_clicked();
53     void on_clearToolButton_clicked();
54     void on_buttonBox_helpRequested();
55 
56 private:
57     Ui::UatDialog *ui;
58     UatModel *uat_model_;
59     UatDelegate *uat_delegate_;
60     QPushButton *ok_button_;
61     QPushButton *help_button_;
62     struct epan_uat *uat_;
63 
64     void checkForErrorHint(const QModelIndex &current, const QModelIndex &previous);
65     bool trySetErrorHintFromField(const QModelIndex &index);
66     void applyChanges();
67     void addRecord(bool copy_from_current = false);
68     void resizeColumns();
69 };
70 
71 #endif // UAT_DIALOG_H
72