aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-01-03 13:48:39 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2016-01-11 07:43:36 +0000
commitebdaace0025749dd68a1cef7d0fd83b596861edf (patch)
treea89e4dadb12d879f9391b8959cf2b46d80457ac5 /ui/qt
parent515502fd9b76228d5f82ccfae761b4f9e75e7ceb (diff)
Lua: Added reload_lua_plugins
This makes it possible to trigger reloading Lua plugins from within a Lua plugin. This can be used when having a plugin to update local plugins from a external source. Renamed reload() to reload_packets() to clarify what's reloaded, and added a alias (marked as obsoleted) from reload(). Change-Id: I4e529992af5f651613950329e73718dbda317d2e Reviewed-on: https://code.wireshark.org/review/13024 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/funnel_statistics.cpp21
-rw-r--r--ui/qt/funnel_statistics.h1
-rw-r--r--ui/qt/main_window.cpp2
-rw-r--r--ui/qt/main_window.h1
-rw-r--r--ui/qt/main_window_slots.cpp53
-rw-r--r--ui/qt/wireshark_application.cpp5
-rw-r--r--ui/qt/wireshark_application.h2
7 files changed, 58 insertions, 27 deletions
diff --git a/ui/qt/funnel_statistics.cpp b/ui/qt/funnel_statistics.cpp
index 85e0f2b6a5..18b1b52b4b 100644
--- a/ui/qt/funnel_statistics.cpp
+++ b/ui/qt/funnel_statistics.cpp
@@ -27,6 +27,7 @@
#include "file.h"
#include "epan/funnel.h"
+#include "epan/prefs.h"
#include "ui/progress_dlg.h"
#include "ui/simple_dialog.h"
@@ -55,7 +56,8 @@ static const gchar *funnel_statistics_get_filter(funnel_ops_id_t *ops_id);
static void funnel_statistics_set_filter(funnel_ops_id_t *ops_id, const char* filter_string);
static void funnel_statistics_set_color_filter_slot(guint8 filter_num, const gchar* filter_string);
static gboolean funnel_statistics_open_file(funnel_ops_id_t *ops_id, const char* fname, const char* filter, char**);
-static void funnel_statistics_reload(funnel_ops_id_t *ops_id);
+static void funnel_statistics_reload_packets(funnel_ops_id_t *ops_id);
+static void funnel_statistics_reload_lua_plugins(funnel_ops_id_t *ops_id);
static void funnel_statistics_apply_filter(funnel_ops_id_t *ops_id);
static gboolean browser_open_url(const gchar *url);
static void browser_open_data_file(const gchar *filename);
@@ -135,7 +137,8 @@ FunnelStatistics::FunnelStatistics(QObject *parent, CaptureFile &cf) :
funnel_ops_->set_filter = funnel_statistics_set_filter;
funnel_ops_->set_color_filter_slot = funnel_statistics_set_color_filter_slot;
funnel_ops_->open_file = funnel_statistics_open_file;
- funnel_ops_->reload = funnel_statistics_reload;
+ funnel_ops_->reload_packets = funnel_statistics_reload_packets;
+ funnel_ops_->reload_lua_plugins = funnel_statistics_reload_lua_plugins;
funnel_ops_->apply_filter = funnel_statistics_apply_filter;
funnel_ops_->browser_open_url = browser_open_url;
funnel_ops_->browser_open_data_file = browser_open_data_file;
@@ -171,6 +174,11 @@ void FunnelStatistics::reloadPackets()
capture_file_.reload();
}
+void FunnelStatistics::reloadLuaPlugins()
+{
+ wsApp->reloadLuaPluginsDelayed();
+}
+
void FunnelStatistics::emitApplyDisplayFilter()
{
emit applyDisplayFilter();
@@ -250,13 +258,20 @@ gboolean funnel_statistics_open_file(funnel_ops_id_t *ops_id, const char* fname,
return TRUE;
}
-void funnel_statistics_reload(funnel_ops_id_t *ops_id) {
+void funnel_statistics_reload_packets(funnel_ops_id_t *ops_id) {
FunnelStatistics *funnel_statistics = dynamic_cast<FunnelStatistics *>((FunnelStatistics *)ops_id);
if (!funnel_statistics) return;
funnel_statistics->reloadPackets();
}
+void funnel_statistics_reload_lua_plugins(funnel_ops_id_t *ops_id) {
+ FunnelStatistics *funnel_statistics = dynamic_cast<FunnelStatistics *>((FunnelStatistics *)ops_id);
+ if (!funnel_statistics) return;
+
+ funnel_statistics->reloadLuaPlugins();
+}
+
void funnel_statistics_apply_filter(funnel_ops_id_t *ops_id) {
FunnelStatistics *funnel_statistics = dynamic_cast<FunnelStatistics *>((FunnelStatistics *)ops_id);
if (!funnel_statistics) return;
diff --git a/ui/qt/funnel_statistics.h b/ui/qt/funnel_statistics.h
index d7df4e7e5b..b1a4234ef7 100644
--- a/ui/qt/funnel_statistics.h
+++ b/ui/qt/funnel_statistics.h
@@ -42,6 +42,7 @@ public:
const char *displayFilter();
void emitSetDisplayFilter(const QString filter);
void reloadPackets();
+ void reloadLuaPlugins();
void emitApplyDisplayFilter();
void emitOpenCaptureFile(QString cf_path, QString filter);
static const QString &actionName() { return action_name_; }
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 7cc3ce227b..df2f891828 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -475,6 +475,8 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(checkDisplayFilter()));
connect(wsApp, SIGNAL(fieldsChanged()),
this, SLOT(fieldsChanged()));
+ connect(wsApp, SIGNAL(reloadLuaPlugins()),
+ this, SLOT(reloadLuaPlugins()));
connect(main_ui_->mainStack, SIGNAL(currentChanged(int)),
this, SLOT(mainStackChanged(int)));
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index aacbb46aa3..3291ee33d7 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -288,6 +288,7 @@ private slots:
void redissectPackets();
void checkDisplayFilter();
void fieldsChanged();
+ void reloadLuaPlugins();
void showAccordionFrame(AccordionFrame *show_frame, bool toggle = false);
void showColumnEditor(int column);
void showPreferenceEditor(); // module_t *, pref *
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 64ee853ff0..0e63dd6bb9 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -1462,6 +1462,34 @@ void MainWindow::fieldsChanged()
emit reloadFields();
}
+void MainWindow::reloadLuaPlugins()
+{
+#ifdef HAVE_LUA
+ if (wsApp->isReloadingLua())
+ return;
+
+ wsApp->setReloadingLua(true);
+
+ wslua_reload_plugins(NULL, NULL);
+ funnel_statistics_reload_menus();
+ reloadDynamicMenus();
+ closePacketDialogs();
+
+ // Preferences may have been deleted so close all widgets using prefs
+ proto_tree_->closeContextMenu();
+ main_ui_->preferenceEditorFrame->animatedHide();
+
+ char *gdp_path, *dp_path;
+ wsApp->readConfigurationFiles(&gdp_path, &dp_path, true);
+
+ fieldsChanged();
+ redissectPackets();
+
+ wsApp->setReloadingLua(false);
+ SimpleDialog::displayQueuedMessages();
+#endif
+}
+
void MainWindow::showAccordionFrame(AccordionFrame *show_frame, bool toggle)
{
QList<AccordionFrame *>frame_list = QList<AccordionFrame *>()
@@ -2669,30 +2697,7 @@ void MainWindow::on_actionAnalyzeDecodeAs_triggered()
void MainWindow::on_actionAnalyzeReloadLuaPlugins_triggered()
{
-#ifdef HAVE_LUA
- if (wsApp->isReloadingLua())
- return;
-
- wsApp->setReloadingLua(true);
-
- wslua_reload_plugins(NULL, NULL);
- funnel_statistics_reload_menus();
- reloadDynamicMenus();
- closePacketDialogs();
-
- // Preferences may have been deleted so close all widgets using prefs
- proto_tree_->closeContextMenu();
- main_ui_->preferenceEditorFrame->animatedHide();
-
- char *gdp_path, *dp_path;
- wsApp->readConfigurationFiles(&gdp_path, &dp_path, true);
-
- fieldsChanged();
- redissectPackets();
-
- wsApp->setReloadingLua(false);
- SimpleDialog::displayQueuedMessages();
-#endif
+ reloadLuaPlugins();
}
void MainWindow::openFollowStreamDialog(follow_type_t type) {
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 2ba9cfdcfd..f8532915e0 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -403,6 +403,11 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
emit packetDissectionChanged();
}
+void WiresharkApplication::reloadLuaPluginsDelayed()
+{
+ QTimer::singleShot(0, this, SIGNAL(reloadLuaPlugins()));
+}
+
const QString WiresharkApplication::windowTitleString(QStringList title_parts)
{
QMutableStringListIterator tii(title_parts);
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index 6ed971e227..56447ba387 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -103,6 +103,7 @@ public:
void setMonospaceFont(const char *font_string);
int monospaceTextSize(const char *str);
void setConfigurationProfile(const gchar *profile_name);
+ void reloadLuaPluginsDelayed();
bool isInitialized() { return initialized_; }
void setReloadingLua(bool is_reloading) { is_reloading_lua_ = is_reloading; }
bool isReloadingLua() { return is_reloading_lua_; }
@@ -153,6 +154,7 @@ signals:
void addressResolutionChanged();
void checkDisplayFilter();
void fieldsChanged();
+ void reloadLuaPlugins();
void openStatCommandDialog(const QString &menu_path, const char *arg, void *userdata);
void openTapParameterDialog(const QString cfg_str, const QString arg, void *userdata);