1 /* welcome_page.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 WELCOME_PAGE_H
11 #define WELCOME_PAGE_H
12 
13 #include <QFrame>
14 
15 class QListWidget;
16 class QListWidgetItem;
17 class QMenu;
18 
19 #include <ui/qt/widgets/splash_overlay.h>
20 #include "interface_frame.h"
21 
22 namespace Ui {
23     class WelcomePage;
24 }
25 
26 class WelcomePage : public QFrame
27 {
28     Q_OBJECT
29 public:
30     explicit WelcomePage(QWidget *parent = 0);
31     virtual ~WelcomePage();
32     InterfaceFrame *getInterfaceFrame();
33     const QString captureFilter();
34     void setCaptureFilter(const QString capture_filter);
35 
36 public slots:
37     void interfaceSelected();
38 
39 protected:
40     virtual bool event(QEvent *event);
41     virtual void resizeEvent(QResizeEvent *event);
42     virtual void changeEvent(QEvent* event);
43 
44 protected slots:
45     void on_recentLabel_clicked();
46     void on_captureLabel_clicked();
47     void on_helpLabel_clicked();
48 
49 private:
50     void updateStyleSheets();
51 
52     Ui::WelcomePage *welcome_ui_;
53     QString flavor_;
54     QString show_in_str_;
55 
56     SplashOverlay *splash_overlay_;
57     // QListWidget doesn't activate items when the return or enter keys are pressed on macOS.
58     // We may want to subclass it at some point.
59     QListWidget *recent_files_;
60 
61 signals:
62     void startCapture();
63     void recentFileActivated(QString cfile);
64     void captureFilterSyntaxChanged(bool valid);
65     void showExtcapOptions(QString &device_name);
66     void interfacesChanged();
67 
68 public slots:
69     void setCaptureFilterText(const QString capture_filter);
70 
71 private slots:
72     void appInitialized();
73     void interfaceListChanged();
74     void setReleaseLabel();
75     void captureFilterTextEdited(const QString capture_filter);
76     void updateRecentCaptures();
77     void openRecentItem(QListWidgetItem *item);
78     void showRecentContextMenu(QPoint pos);
79     void showRecentFolder();
80     void copyRecentPath();
81     void removeRecentPath();
82 
83     void on_interfaceFrame_showExtcapOptions(QString device_name);
84     void on_interfaceFrame_startCapture();
85 };
86 
87 #endif // WELCOME_PAGE_H
88