summaryrefslogtreecommitdiffstats
path: root/ui/qt/widgets/resolved_addresses_view.h
blob: 23fb707f0f11936da9e78ef0cbf1fb5f2d259d90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/** @file
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef RESOLVED_ADDRESSES_VIEW_H
#define RESOLVED_ADDRESSES_VIEW_H

#include <ui/qt/models/resolved_addresses_models.h>

#include <QTableView>
#include <QMenu>

class ResolvedAddressesView : public QTableView
{
    Q_OBJECT

public:
    typedef enum {
        EXPORT_TEXT,
        EXPORT_CSV,
        EXPORT_JSON
    } eResolvedAddressesExport;

    ResolvedAddressesView(QWidget *parent = nullptr);

    QMenu* createCopyMenu(bool selected = false, QWidget *parent = nullptr);

public slots:
    void saveAs();

protected:
    void contextMenuEvent(QContextMenuEvent *e) override;

private:
    QAction *clip_action_;

    AStringListListModel* dataModel() const;
    void copyToClipboard(eResolvedAddressesExport format, bool selected);

private slots:
    void clipboardAction();
    void toTextStream(QTextStream &stream, eResolvedAddressesExport format, bool selected = false) const;
};

#endif // RESOLVED_ADDRESSES_VIEW_H