1 /* wireshark_application.h
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef WIRESHARK_APPLICATION_H
23 #define WIRESHARK_APPLICATION_H
31 #include "ui/help_url.h"
33 #include <QApplication>
38 #include <QTranslator>
43 class QSocketNotifier;
47 // - Add from open file
48 // - Check current list
49 // - Signal updated item
51 typedef struct _recent_item_status {
58 class WiresharkApplication : public QApplication
62 explicit WiresharkApplication(int &argc, char **argv);
65 CaptureFilterListChanged,
67 DisplayFilterListChanged,
69 FilterExpressionsChanged,
70 LocalInterfacesChanged,
71 NameResolutionChanged,
72 PacketDissectionChanged,
74 RecentCapturesChanged,
83 void registerUpdate(register_action_e action, const char *message);
84 void emitAppSignal(AppSignal signal);
85 // Emitting app signals (PacketDissectionChanged in particular) from
86 // dialogs on OS X can be problematic. Dialogs should call queueAppSignal
88 void queueAppSignal(AppSignal signal) { app_signals_ << signal; }
89 // Flush queued app signals. Should be called from the main window after
90 // each dialog that calls queueAppSignal closes.
91 void flushAppSignals();
92 void emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata);
93 void emitTapParameterSignal(const QString cfg_abbr, const QString arg, void *userdata);
94 void addDynamicMenuGroupItem(int group, QAction *sg_action);
95 void appendDynamicMenuGroupItem(int group, QAction *sg_action);
96 void removeDynamicMenuGroupItem(int group, QAction *sg_action);
97 QList<QAction *> dynamicMenuGroupItems(int group);
98 QList<QAction *> addedMenuGroupItems(int group);
99 QList<QAction *> removedMenuGroupItems(int group);
100 void clearAddedMenuGroupItems();
101 void clearRemovedMenuGroupItems();
104 void refreshLocalInterfaces();
105 struct _e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path, bool reset);
106 QList<recent_item_status *> recentItems() const;
107 void addRecentItem(const QString filename, qint64 size, bool accessible);
108 void removeRecentItem(const QString &filename);
110 void setLastOpenDir(const char *dir_name);
111 void setLastOpenDir(QString *dir_str);
112 void helpTopicAction(topic_action_e action);
113 const QFont monospaceFont() const { return mono_font_; }
114 void setMonospaceFont(const char *font_string);
115 int monospaceTextSize(const char *str);
116 void setConfigurationProfile(const gchar *profile_name);
117 void reloadLuaPluginsDelayed();
118 bool isInitialized() { return initialized_; }
119 void setReloadingLua(bool is_reloading) { is_reloading_lua_ = is_reloading; }
120 bool isReloadingLua() { return is_reloading_lua_; }
121 const QIcon &normalIcon() const { return normal_icon_; }
122 const QIcon &captureIcon() const { return capture_icon_; }
123 const QString &windowTitleSeparator() const { return window_title_separator_; }
124 const QString windowTitleString(QStringList title_parts);
125 const QString windowTitleString(QString title_part) { return windowTitleString(QStringList() << title_part); }
126 void applyCustomColorsFromRecent();
128 QTranslator translator;
129 QTranslator translatorQt;
130 void loadLanguage(const QString language);
132 void doTriggerMenuItem(MainMenuItem menuItem);
136 bool is_reloading_lua_;
138 QTimer recent_timer_;
139 QTimer addr_resolv_timer_;
140 QTimer tap_update_timer_;
141 QList<QString> pending_open_files_;
142 QSocketNotifier *if_notifier_;
145 static QString window_title_separator_;
146 QList<AppSignal> app_signals_;
147 int active_captures_;
148 void storeCustomColorsInRecent();
151 bool event(QEvent *event);
154 void appInitialized();
155 void localInterfaceListChanged();
156 void openCaptureFile(QString cf_path, QString display_filter, unsigned int type);
157 void openCaptureOptions();
158 void recentPreferencesRead();
159 void updateRecentCaptureStatus(const QString &filename, qint64 size, bool accessible);
160 void splashUpdate(register_action_e action, const char *message);
161 void profileChanging();
162 void profileNameChanged(const gchar *profile_name);
164 void columnsChanged(); // XXX This recreates the packet list. We might want to rename it accordingly.
165 void captureFilterListChanged();
166 void displayFilterListChanged();
167 void filterExpressionsChanged();
168 void packetDissectionChanged();
169 void preferencesChanged();
170 void addressResolutionChanged();
171 void checkDisplayFilter();
172 void fieldsChanged();
173 void reloadLuaPlugins();
175 void openStatCommandDialog(const QString &menu_path, const char *arg, void *userdata);
176 void openTapParameterDialog(const QString cfg_str, const QString arg, void *userdata);
179 void clearRecentCaptures();
180 void captureFileReadStarted();
181 void captureStarted() { active_captures_++; }
182 void captureFinished() { active_captures_--; }
187 void ifChangeEventsAvailable();
188 void itemStatusFinished(const QString filename = "", qint64 size = 0, bool accessible = false);
189 void refreshRecentCaptures(void);
190 void refreshAddressResolution(void);
193 extern WiresharkApplication *wsApp;
195 /** Global compile time version string */
196 extern void get_wireshark_qt_compiled_info(GString *str);
197 extern void get_gui_compiled_info(GString *str);
198 /** Global runtime version string */
199 extern void get_wireshark_runtime_info(GString *str);
200 #endif // WIRESHARK_APPLICATION_H
208 * indent-tabs-mode: nil
211 * ex: set shiftwidth=4 tabstop=8 expandtab:
212 * :indentSize=4:tabSize=8:noTabs=true: