diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
commit | e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch) | |
tree | 68cb5ef9081156392f1dd62a00c6ccc1451b93df /ui/qt/profile_dialog.h | |
parent | Initial commit. (diff) | |
download | wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip |
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/qt/profile_dialog.h')
-rw-r--r-- | ui/qt/profile_dialog.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/ui/qt/profile_dialog.h b/ui/qt/profile_dialog.h new file mode 100644 index 00000000..d42594f0 --- /dev/null +++ b/ui/qt/profile_dialog.h @@ -0,0 +1,94 @@ +/** @file + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef PROFILE_DIALOG_H +#define PROFILE_DIALOG_H + +#include "config.h" + +#include <ui/qt/geometry_state_dialog.h> +#include <ui/qt/models/profile_model.h> +#include <ui/qt/widgets/profile_tree_view.h> + +#include <QPushButton> +#include <QTreeWidgetItem> + +namespace Ui { +class ProfileDialog; +} + +class ProfileDialog : public GeometryStateDialog +{ + Q_OBJECT + +public: + enum ProfileAction { + ShowProfiles, NewProfile, ImportZipProfile, ImportDirProfile, + ExportSingleProfile, ExportAllProfiles, EditCurrentProfile, DeleteCurrentProfile + }; + + explicit ProfileDialog(QWidget *parent = Q_NULLPTR); + ~ProfileDialog(); + int execAction(ProfileAction profile_action); + + /** + * @brief Select the profile with the given name. + * + * If the profile name is empty, the currently selected profile will be choosen instead. + * If the choosen profile is invalid, the first row will be choosen. + * + * @param profile the name of the profile to be selected + */ + void selectProfile(QString profile = QString()); + +protected: + virtual void keyPressEvent(QKeyEvent *event); + +private: + Ui::ProfileDialog *pd_ui_; + QPushButton *ok_button_; + QPushButton *import_button_; +#ifdef HAVE_MINIZIP + QPushButton *export_button_; + QAction *export_selected_entry_; +#endif + ProfileModel *model_; + ProfileSortModel *sort_model_; + + void updateWidgets(); + void resetTreeView(); + + void finishImport(QFileInfo fi, int count, int skipped, QStringList import); + +private slots: + void currentItemChanged(const QModelIndex & c = QModelIndex(), const QModelIndex & p = QModelIndex()); +#ifdef HAVE_MINIZIP + void exportProfiles(bool exportAllPersonalProfiles = false); + void importFromZip(); +#endif + void importFromDirectory(); + + void on_newToolButton_clicked(); + void on_deleteToolButton_clicked(); + void on_copyToolButton_clicked(); + void on_buttonBox_accepted(); + void on_buttonBox_rejected(); + void on_buttonBox_helpRequested(); + void dataChanged(const QModelIndex &); + + void filterChanged(const QString &); + + void selectionChanged(); + QModelIndexList selectedProfiles(); + + // QWidget interface + +}; + +#endif // PROFILE_DIALOG_H |