1 /* uat_frame.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_FRAME_H
11 #define UAT_FRAME_H
12 
13 #include <QFrame>
14 
15 #include <ui/qt/geometry_state_dialog.h>
16 #include <ui/qt/models/uat_model.h>
17 #include <ui/qt/models/uat_delegate.h>
18 
19 namespace Ui {
20 class UatFrame;
21 }
22 
23 class UatFrame : public QFrame
24 {
25     Q_OBJECT
26 
27 public:
28     explicit UatFrame(QWidget *parent = NULL);
29     ~UatFrame();
30 
31     void setUat(struct epan_uat *uat);
32 
33     void acceptChanges();
34     void rejectChanges();
35 
36 protected:
37     void showEvent(QShowEvent *);
38 
39 private:
40     Ui::UatFrame *ui;
41 
42     UatModel *uat_model_;
43     UatDelegate *uat_delegate_;
44     struct epan_uat *uat_;
45 
46     void checkForErrorHint(const QModelIndex &current, const QModelIndex &previous);
47     bool trySetErrorHintFromField(const QModelIndex &index);
48     void addRecord(bool copy_from_current = false);
49     void applyChanges();
50     void resizeColumns();
51 
52 private slots:
53     void copyFromProfile(QString filename);
54     void modelDataChanged(const QModelIndex &topLeft);
55     void modelRowsRemoved();
56     void modelRowsReset();
57     void on_uatTreeView_currentItemChanged(const QModelIndex &current, const QModelIndex &previous);
58     void on_newToolButton_clicked();
59     void on_deleteToolButton_clicked();
60     void on_copyToolButton_clicked();
61     void on_moveUpToolButton_clicked();
62     void on_moveDownToolButton_clicked();
63     void on_clearToolButton_clicked();
64 };
65 
66 #endif // UAT_FRAME_H
67