forked from osmocom/wireshark
Qt: Update our dynamic menu groups.
Add log-specific statistics groups, and use them to limit the dynamic menu items in Wireshark and Logwolf.
This commit is contained in:
parent
8746eea297
commit
ca04f4c8cb
|
@ -10183,7 +10183,7 @@ proto_register_dhcp(void)
|
|||
};
|
||||
|
||||
static stat_tap_table_ui dhcp_stat_table = {
|
||||
REGISTER_STAT_GROUP_UNSORTED,
|
||||
REGISTER_PACKET_STAT_GROUP_UNSORTED,
|
||||
"DHCP (BOOTP) Statistics",
|
||||
"dhcp",
|
||||
"dhcp,stat",
|
||||
|
|
|
@ -804,7 +804,7 @@ proto_register_npm(void)
|
|||
};
|
||||
|
||||
static stat_tap_table_ui npm_stat_table = {
|
||||
REGISTER_STAT_GROUP_UNSORTED,
|
||||
REGISTER_PACKET_STAT_GROUP_UNSORTED,
|
||||
"NetPerfMeter Statistics",
|
||||
"npm",
|
||||
"npm,stat",
|
||||
|
|
|
@ -4337,7 +4337,7 @@ proto_register_rpc(void)
|
|||
};
|
||||
|
||||
static stat_tap_table_ui rpc_prog_stat_table = {
|
||||
REGISTER_STAT_GROUP_UNSORTED,
|
||||
REGISTER_PACKET_STAT_GROUP_UNSORTED,
|
||||
"ONC-RPC Programs",
|
||||
"rpc",
|
||||
"rpc,programs",
|
||||
|
|
|
@ -41,23 +41,26 @@ extern "C" {
|
|||
* If you do, legacy scripts will break. (which is why the perl script regex isn't better)
|
||||
*/
|
||||
|
||||
/** The group this stat should be registered in. */
|
||||
typedef enum {
|
||||
REGISTER_ANALYZE_GROUP_UNSORTED, /* unsorted analyze stuff */
|
||||
REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER, /* conversation filters. Unused? */
|
||||
REGISTER_STAT_GROUP_UNSORTED, /* unsorted statistic function */
|
||||
REGISTER_STAT_GROUP_GENERIC, /* generic statistic function, not specific to a protocol */
|
||||
REGISTER_STAT_GROUP_CONVERSATION_LIST, /* member of the conversation list */
|
||||
REGISTER_STAT_GROUP_ENDPOINT_LIST, /* member of the endpoint list */
|
||||
REGISTER_STAT_GROUP_RESPONSE_TIME, /* member of the service response time list */
|
||||
REGISTER_STAT_GROUP_RSERPOOL, /* member of the RSerPool list */
|
||||
REGISTER_STAT_GROUP_TELEPHONY, /* telephony specific */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_ANSI, /* name says it all */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_GSM, /* GSM (and UMTS?) */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_LTE, /* name says it all */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_MTP3, /* name says it all */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_SCTP, /* name says it all */
|
||||
REGISTER_TOOLS_GROUP_UNSORTED /* unsorted tools */
|
||||
/*! Statistics groups. Used for UI menu layout. */
|
||||
/* This is parsed by make-init-lua.pl, so we can't do anything fancy here. */
|
||||
typedef enum register_stat_group_e {
|
||||
REGISTER_PACKET_ANALYZE_GROUP_UNSORTED, /*!< Unsorted packet analysis */
|
||||
REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER, /*!< Conversation filters. Unused? */
|
||||
REGISTER_PACKET_STAT_GROUP_UNSORTED, /*!< Unsorted packet statistics */
|
||||
REGISTER_STAT_GROUP_GENERIC, /*!< Generic statistics, not specific to a protocol */
|
||||
REGISTER_STAT_GROUP_CONVERSATION_LIST, /*!< Member of the conversation list */
|
||||
REGISTER_STAT_GROUP_ENDPOINT_LIST, /*!< Member of the endpoint list */
|
||||
REGISTER_STAT_GROUP_RESPONSE_TIME, /*!< Member of the service response time list */
|
||||
REGISTER_STAT_GROUP_RSERPOOL, /*!< Member of the RSerPool list */
|
||||
REGISTER_STAT_GROUP_TELEPHONY, /*!< Telephony specific */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_ANSI, /*!< Name says it all */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_GSM, /*!< GSM (and UMTS?) */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_LTE, /*!< Name says it all */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_MTP3, /*!< Name says it all */
|
||||
REGISTER_STAT_GROUP_TELEPHONY_SCTP, /*!< Name says it all */
|
||||
REGISTER_TOOLS_GROUP_UNSORTED, /*!< Unsorted tools */
|
||||
REGISTER_LOG_ANALYZE_GROUP_UNSORTED, /*!< Unsorted log analysis */
|
||||
REGISTER_LOG_STAT_GROUP_UNSORTED, /*!< Unsorted log statistics */
|
||||
} register_stat_group_t;
|
||||
|
||||
/** Format types for "Save As..." */
|
||||
|
|
|
@ -293,7 +293,7 @@ stats_tree_register_with_group(const char *tapname, const char *abbr, const char
|
|||
g_hash_table_insert(registry,cfg->abbr,cfg);
|
||||
}
|
||||
|
||||
/* register a new stats_tree with default group REGISTER_STAT_GROUP_UNSORTED */
|
||||
/* register a new stats_tree with default group REGISTER_PACKET_STAT_GROUP_UNSORTED */
|
||||
extern void
|
||||
stats_tree_register(const char *tapname, const char *abbr, const char *name,
|
||||
guint flags,
|
||||
|
@ -303,10 +303,10 @@ stats_tree_register(const char *tapname, const char *abbr, const char *name,
|
|||
stats_tree_register_with_group(tapname, abbr, name,
|
||||
flags,
|
||||
packet, init,
|
||||
cleanup, REGISTER_STAT_GROUP_UNSORTED);
|
||||
cleanup, REGISTER_PACKET_STAT_GROUP_UNSORTED);
|
||||
}
|
||||
|
||||
/* register a new stat_tree with default group REGISTER_STAT_GROUP_UNSORTED from a plugin */
|
||||
/* register a new stat_tree with default group REGISTER_PACKET_STAT_GROUP_UNSORTED from a plugin */
|
||||
extern void
|
||||
stats_tree_register_plugin(const char *tapname, const char *abbr, const char *name,
|
||||
guint flags,
|
||||
|
|
|
@ -220,12 +220,13 @@ $menu_groups .= "-- menu groups for register_menu\n";
|
|||
my $menu_i = 0;
|
||||
|
||||
open STAT_GROUPS, "< $WSROOT/epan/stat_groups.h" or die "cannot open '$WSROOT/epan/stat_groups.h': $!";
|
||||
my $foundit = 0;
|
||||
my $in_stat_group_enum = 0;
|
||||
while(<STAT_GROUPS>) {
|
||||
# need to skip matching words in comments, and get to the enum
|
||||
if (/^typedef enum \{/) { $foundit = 1; }
|
||||
if (/^typedef enum register_stat_group_e \{/) { $in_stat_group_enum = 1; }
|
||||
if (/^\} register_stat_group_t\;/) { $in_stat_group_enum = 0; }
|
||||
# the problem here is we need to pick carefully, so we don't break existing scripts
|
||||
if ($foundit && /REGISTER_([A-Z]+)_GROUP_(CONVERSATION|RESPONSE|ENDPOINT|[A-Z0-9_]+)/) {
|
||||
if ($in_stat_group_enum && /REGISTER_([A-Z0-9_]+)_GROUP_([A-Z0-9_]+),? /) {
|
||||
$menu_groups .= "MENU_$1_$2 = $menu_i\n";
|
||||
$menu_groups =~ s/_NONE//;
|
||||
$menu_i++;
|
||||
|
@ -233,6 +234,15 @@ while(<STAT_GROUPS>) {
|
|||
}
|
||||
close STAT_GROUPS;
|
||||
|
||||
$menu_groups .= <<'FIN';
|
||||
-- Old / deprecated menu groups. These shoudn't be used in new code.
|
||||
MENU_ANALYZE_UNSORTED = MENU_PACKET_ANALYZE_UNSORTED
|
||||
MENU_ANALYZE_CONVERSATION = MENU_ANALYZE_CONVERSATION_FILTER
|
||||
MENU_STAT_CONVERSATION = MENU_STAT_CONVERSATION_LIST
|
||||
MENU_STAT_ENDPOINT = MENU_STAT_ENDPOINT_LIST
|
||||
MENU_STAT_RESPONSE = MENU_STAT_RESPONSE_TIME
|
||||
MENU_STAT_UNSORTED = MENU_PACKET_STAT_UNSORTED
|
||||
FIN
|
||||
|
||||
$bases_table .= "}\n";
|
||||
$encodings .= "\n";
|
||||
|
|
|
@ -520,7 +520,7 @@ WSLUA_FUNCTION wslua_register_stat_cmd_arg(lua_State* L) {
|
|||
sc->func_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
lua_remove(L,1);
|
||||
|
||||
ui_info.group = REGISTER_STAT_GROUP_UNSORTED; /* XXX - need group for CLI-only? */
|
||||
ui_info.group = REGISTER_PACKET_STAT_GROUP_UNSORTED; /* XXX - need an argument? */
|
||||
ui_info.title = NULL;
|
||||
ui_info.cli_string = arg;
|
||||
ui_info.tap_init_cb = statcmd_init;
|
||||
|
|
|
@ -393,18 +393,23 @@
|
|||
["__typeof"] = "Listener"
|
||||
}
|
||||
},
|
||||
["MENU_ANALYZE_CONVERSATION"] = 1,
|
||||
["MENU_ANALYZE_UNSORTED"] = 0,
|
||||
["MENU_STAT_CONVERSATION"] = 4,
|
||||
["MENU_STAT_ENDPOINT"] = 5,
|
||||
["MENU_STAT_GENERIC"] = 3,
|
||||
["MENU_STAT_RESPONSE"] = 6,
|
||||
["MENU_STAT_TELEPHONY"] = 7,
|
||||
["MENU_STAT_TELEPHONY_GSM"] = 8,
|
||||
["MENU_STAT_TELEPHONY_LTE"] = 9,
|
||||
["MENU_STAT_TELEPHONY_SCTP"] = 10,
|
||||
["MENU_PACKET_ANALYZE_UNSORTED"] = 0,
|
||||
["MENU_ANALYZE_CONVERSATION_FILTER"] = 1,
|
||||
["MENU_STAT_UNSORTED"] = 2,
|
||||
["MENU_TOOLS_UNSORTED"] = 11,
|
||||
["MENU_STAT_GENERIC"] = 3,
|
||||
["MENU_STAT_CONVERSATION_LIST"] = 4,
|
||||
["MENU_STAT_ENDPOINT_LIST"] = 5,
|
||||
["MENU_STAT_RESPONSE_TIME"] = 6,
|
||||
["MENU_STAT_RSERPOOL"] = 7,
|
||||
["MENU_STAT_TELEPHONY"] = 8,
|
||||
["MENU_STAT_TELEPHONY_ANSI"] = 9,
|
||||
["MENU_STAT_TELEPHONY_GSM"] = 10,
|
||||
["MENU_STAT_TELEPHONY_LTE"] = 11,
|
||||
["MENU_STAT_TELEPHONY_MTP3"] = 12,
|
||||
["MENU_STAT_TELEPHONY_SCTP"] = 13,
|
||||
["MENU_TOOLS_UNSORTED"] = 14,
|
||||
["MENU_LOG_ANALYZE_UNSORTED"] = 15,
|
||||
["MENU_LOG_STAT_UNSORTED"] = 16,
|
||||
["NSTime"] = '<filtered>',
|
||||
["PI_ASSUMPTION"] = 218103808,
|
||||
["PI_CHAT"] = 2097152,
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define MAINWINDOW_H
|
||||
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/stat_groups.h>
|
||||
|
||||
#include "filter_action.h"
|
||||
|
||||
|
@ -52,6 +53,7 @@ protected:
|
|||
void showWelcome();
|
||||
void showCapture();
|
||||
|
||||
QList<register_stat_group_t> menu_groups_;
|
||||
QWidget* getLayoutWidget(layout_pane_content_e type);
|
||||
|
||||
QStackedWidget *main_stack_;
|
||||
|
|
|
@ -372,6 +372,23 @@ WiresharkMainWindow::WiresharkMainWindow(QWidget *parent) :
|
|||
main_ui_->menuView->removeAction(main_ui_->actionViewWirelessToolbar);
|
||||
#endif
|
||||
|
||||
menu_groups_ = QList<register_stat_group_t>()
|
||||
<< REGISTER_PACKET_ANALYZE_GROUP_UNSORTED
|
||||
<< REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER
|
||||
<< REGISTER_PACKET_STAT_GROUP_UNSORTED
|
||||
<< REGISTER_STAT_GROUP_GENERIC
|
||||
<< REGISTER_STAT_GROUP_CONVERSATION_LIST
|
||||
<< REGISTER_STAT_GROUP_ENDPOINT_LIST
|
||||
<< REGISTER_STAT_GROUP_RESPONSE_TIME
|
||||
<< REGISTER_STAT_GROUP_RSERPOOL
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_ANSI
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_GSM
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_LTE
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_MTP3
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_SCTP
|
||||
<< REGISTER_TOOLS_GROUP_UNSORTED;
|
||||
|
||||
setWindowIcon(mainApp->normalIcon());
|
||||
setTitlebarForCaptureFile();
|
||||
setMenusForCaptureFile();
|
||||
|
@ -2662,29 +2679,12 @@ void WiresharkMainWindow::setForCaptureInProgress(bool capture_in_progress, bool
|
|||
}
|
||||
}
|
||||
|
||||
static QList<register_stat_group_t> menu_groups = QList<register_stat_group_t>()
|
||||
<< REGISTER_ANALYZE_GROUP_UNSORTED
|
||||
<< REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER
|
||||
<< REGISTER_STAT_GROUP_UNSORTED
|
||||
<< REGISTER_STAT_GROUP_GENERIC
|
||||
<< REGISTER_STAT_GROUP_CONVERSATION_LIST
|
||||
<< REGISTER_STAT_GROUP_ENDPOINT_LIST
|
||||
<< REGISTER_STAT_GROUP_RESPONSE_TIME
|
||||
<< REGISTER_STAT_GROUP_RSERPOOL
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_ANSI
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_GSM
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_LTE
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_MTP3
|
||||
<< REGISTER_STAT_GROUP_TELEPHONY_SCTP
|
||||
<< REGISTER_TOOLS_GROUP_UNSORTED;
|
||||
|
||||
void WiresharkMainWindow::addMenuActions(QList<QAction *> &actions, int menu_group)
|
||||
{
|
||||
foreach(QAction *action, actions) {
|
||||
switch (menu_group) {
|
||||
case REGISTER_ANALYZE_GROUP_UNSORTED:
|
||||
case REGISTER_STAT_GROUP_UNSORTED:
|
||||
case REGISTER_PACKET_ANALYZE_GROUP_UNSORTED:
|
||||
case REGISTER_PACKET_STAT_GROUP_UNSORTED:
|
||||
main_ui_->menuStatistics->insertAction(
|
||||
main_ui_->actionStatistics_REGISTER_STAT_GROUP_UNSORTED,
|
||||
action);
|
||||
|
@ -2733,8 +2733,8 @@ void WiresharkMainWindow::addMenuActions(QList<QAction *> &actions, int menu_gro
|
|||
break;
|
||||
}
|
||||
default:
|
||||
// qDebug() << "FIX: Add" << action->text() << "to the menu";
|
||||
break;
|
||||
// Skip log items.
|
||||
return;
|
||||
}
|
||||
|
||||
// Connect each action type to its corresponding slot. We to
|
||||
|
@ -2751,8 +2751,8 @@ void WiresharkMainWindow::removeMenuActions(QList<QAction *> &actions, int menu_
|
|||
{
|
||||
foreach(QAction *action, actions) {
|
||||
switch (menu_group) {
|
||||
case REGISTER_ANALYZE_GROUP_UNSORTED:
|
||||
case REGISTER_STAT_GROUP_UNSORTED:
|
||||
case REGISTER_PACKET_ANALYZE_GROUP_UNSORTED:
|
||||
case REGISTER_PACKET_STAT_GROUP_UNSORTED:
|
||||
main_ui_->menuStatistics->removeAction(action);
|
||||
break;
|
||||
case REGISTER_STAT_GROUP_RESPONSE_TIME:
|
||||
|
@ -2808,7 +2808,7 @@ void WiresharkMainWindow::addDynamicMenus()
|
|||
mainApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY, main_ui_->actionTelephonySipFlows);
|
||||
|
||||
// Fill in each menu
|
||||
foreach(register_stat_group_t menu_group, menu_groups) {
|
||||
foreach(register_stat_group_t menu_group, menu_groups_) {
|
||||
QList<QAction *>actions = mainApp->dynamicMenuGroupItems(menu_group);
|
||||
addMenuActions(actions, menu_group);
|
||||
}
|
||||
|
@ -2832,7 +2832,7 @@ void WiresharkMainWindow::addDynamicMenus()
|
|||
|
||||
void WiresharkMainWindow::reloadDynamicMenus()
|
||||
{
|
||||
foreach(register_stat_group_t menu_group, menu_groups) {
|
||||
foreach(register_stat_group_t menu_group, menu_groups_) {
|
||||
QList<QAction *>actions = mainApp->removedMenuGroupItems(menu_group);
|
||||
removeMenuActions(actions, menu_group);
|
||||
|
||||
|
|
|
@ -1689,13 +1689,15 @@ void WiresharkMainWindow::initViewColorizeMenu()
|
|||
|
||||
void WiresharkMainWindow::addStatsPluginsToMenu() {
|
||||
GList *cfg_list = stats_tree_get_cfg_list();
|
||||
GList *iter = g_list_first(cfg_list);
|
||||
QAction *stats_tree_action;
|
||||
QMenu *parent_menu;
|
||||
bool first_item = true;
|
||||
|
||||
while (iter) {
|
||||
for (GList *iter = g_list_first(cfg_list); iter; iter = gxx_list_next(iter)) {
|
||||
stats_tree_cfg *cfg = gxx_list_data(stats_tree_cfg *, iter);
|
||||
if (!menu_groups_.contains(cfg->stat_group)) {
|
||||
continue;
|
||||
}
|
||||
if (cfg->plugin) {
|
||||
if (first_item) {
|
||||
main_ui_->menuStatistics->addSeparator();
|
||||
|
@ -1722,7 +1724,6 @@ void WiresharkMainWindow::addStatsPluginsToMenu() {
|
|||
parent_menu->addAction(stats_tree_action);
|
||||
connect(stats_tree_action, SIGNAL(triggered()), this, SLOT(actionStatisticsPlugin_triggered()));
|
||||
}
|
||||
iter = gxx_list_next(iter);
|
||||
}
|
||||
g_list_free(cfg_list);
|
||||
}
|
||||
|
|
|
@ -363,6 +363,10 @@ LogwolfMainWindow::LogwolfMainWindow(QWidget *parent) :
|
|||
update_action_ = new QAction(tr("Check for Updates…"), main_ui_->menuHelp);
|
||||
#endif
|
||||
|
||||
menu_groups_ = QList<register_stat_group_t>()
|
||||
<< REGISTER_LOG_ANALYZE_GROUP_UNSORTED
|
||||
<< REGISTER_LOG_STAT_GROUP_UNSORTED;
|
||||
|
||||
setWindowIcon(mainApp->normalIcon());
|
||||
setTitlebarForCaptureFile();
|
||||
setMenusForCaptureFile();
|
||||
|
@ -2633,58 +2637,41 @@ void LogwolfMainWindow::setForCaptureInProgress(bool capture_in_progress, bool h
|
|||
}
|
||||
}
|
||||
|
||||
static QList<register_stat_group_t> menu_groups = QList<register_stat_group_t>()
|
||||
<< REGISTER_ANALYZE_GROUP_UNSORTED
|
||||
<< REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER
|
||||
<< REGISTER_STAT_GROUP_UNSORTED
|
||||
<< REGISTER_STAT_GROUP_GENERIC
|
||||
<< REGISTER_STAT_GROUP_CONVERSATION_LIST
|
||||
<< REGISTER_STAT_GROUP_ENDPOINT_LIST
|
||||
// << REGISTER_STAT_GROUP_RESPONSE_TIME
|
||||
// << REGISTER_STAT_GROUP_RSERPOOL
|
||||
<< REGISTER_TOOLS_GROUP_UNSORTED;
|
||||
|
||||
void LogwolfMainWindow::addMenuActions(QList<QAction *> &actions, int menu_group)
|
||||
{
|
||||
foreach(QAction *action, actions) {
|
||||
switch (menu_group) {
|
||||
case REGISTER_ANALYZE_GROUP_UNSORTED:
|
||||
case REGISTER_STAT_GROUP_UNSORTED:
|
||||
case REGISTER_LOG_ANALYZE_GROUP_UNSORTED:
|
||||
case REGISTER_LOG_STAT_GROUP_UNSORTED:
|
||||
main_ui_->menuStatistics->insertAction(
|
||||
main_ui_->actionStatistics_REGISTER_STAT_GROUP_UNSORTED,
|
||||
action);
|
||||
break;
|
||||
// case REGISTER_STAT_GROUP_RESPONSE_TIME:
|
||||
// main_ui_->menuServiceResponseTime->addAction(action);
|
||||
// case REGISTER_TOOLS_GROUP_UNSORTED:
|
||||
// {
|
||||
// // Allow the creation of submenus. Mimics the behavor of
|
||||
// // ui/gtk/main_menubar.c:add_menu_item_to_main_menubar
|
||||
// // and GtkUIManager.
|
||||
// //
|
||||
// // For now we limit the insanity to the "Tools" menu.
|
||||
// QStringList menu_path = action->text().split('/');
|
||||
// QMenu *cur_menu = main_ui_->menuTools;
|
||||
// while (menu_path.length() > 1) {
|
||||
// QString menu_title = menu_path.takeFirst();
|
||||
// QMenu *submenu = cur_menu->findChild<QMenu *>(menu_title.toLower(), Qt::FindDirectChildrenOnly);
|
||||
// if (!submenu) {
|
||||
// submenu = cur_menu->addMenu(menu_title);
|
||||
// submenu->setObjectName(menu_title.toLower());
|
||||
// }
|
||||
// cur_menu = submenu;
|
||||
// }
|
||||
// action->setText(menu_path.last());
|
||||
// cur_menu->addAction(action);
|
||||
// break;
|
||||
// case REGISTER_STAT_GROUP_RSERPOOL:
|
||||
// main_ui_->menuRSerPool->addAction(action);
|
||||
// break;
|
||||
case REGISTER_TOOLS_GROUP_UNSORTED:
|
||||
{
|
||||
// Allow the creation of submenus. Mimics the behavor of
|
||||
// ui/gtk/main_menubar.c:add_menu_item_to_main_menubar
|
||||
// and GtkUIManager.
|
||||
//
|
||||
// For now we limit the insanity to the "Tools" menu.
|
||||
QStringList menu_path = action->text().split('/');
|
||||
QMenu *cur_menu = main_ui_->menuTools;
|
||||
while (menu_path.length() > 1) {
|
||||
QString menu_title = menu_path.takeFirst();
|
||||
QMenu *submenu = cur_menu->findChild<QMenu *>(menu_title.toLower(), Qt::FindDirectChildrenOnly);
|
||||
if (!submenu) {
|
||||
submenu = cur_menu->addMenu(menu_title);
|
||||
submenu->setObjectName(menu_title.toLower());
|
||||
}
|
||||
cur_menu = submenu;
|
||||
}
|
||||
action->setText(menu_path.last());
|
||||
cur_menu->addAction(action);
|
||||
break;
|
||||
}
|
||||
// }
|
||||
default:
|
||||
// qDebug() << "FIX: Add" << action->text() << "to the menu";
|
||||
break;
|
||||
// Skip packet items.
|
||||
return;
|
||||
}
|
||||
|
||||
// Connect each action type to its corresponding slot. We to
|
||||
|
@ -2697,34 +2684,29 @@ void LogwolfMainWindow::addMenuActions(QList<QAction *> &actions, int menu_group
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogwolfMainWindow::removeMenuActions(QList<QAction *> &actions, int menu_group)
|
||||
{
|
||||
foreach(QAction *action, actions) {
|
||||
switch (menu_group) {
|
||||
case REGISTER_ANALYZE_GROUP_UNSORTED:
|
||||
case REGISTER_STAT_GROUP_UNSORTED:
|
||||
case REGISTER_LOG_ANALYZE_GROUP_UNSORTED:
|
||||
case REGISTER_LOG_STAT_GROUP_UNSORTED:
|
||||
main_ui_->menuStatistics->removeAction(action);
|
||||
break;
|
||||
// case REGISTER_STAT_GROUP_RESPONSE_TIME:
|
||||
// main_ui_->menuServiceResponseTime->removeAction(action);
|
||||
// case REGISTER_TOOLS_GROUP_UNSORTED:
|
||||
// {
|
||||
// // Allow removal of submenus.
|
||||
// // For now we limit the insanity to the "Tools" menu.
|
||||
// QStringList menu_path = action->text().split('/');
|
||||
// QMenu *cur_menu = main_ui_->menuTools;
|
||||
// while (menu_path.length() > 1) {
|
||||
// QString menu_title = menu_path.takeFirst();
|
||||
// QMenu *submenu = cur_menu->findChild<QMenu *>(menu_title.toLower(), Qt::FindDirectChildrenOnly);
|
||||
// cur_menu = submenu;
|
||||
// }
|
||||
// cur_menu->removeAction(action);
|
||||
// break;
|
||||
// case REGISTER_STAT_GROUP_RSERPOOL:
|
||||
// main_ui_->menuRSerPool->removeAction(action);
|
||||
// break;
|
||||
case REGISTER_TOOLS_GROUP_UNSORTED:
|
||||
{
|
||||
// Allow removal of submenus.
|
||||
// For now we limit the insanity to the "Tools" menu.
|
||||
QStringList menu_path = action->text().split('/');
|
||||
QMenu *cur_menu = main_ui_->menuTools;
|
||||
while (menu_path.length() > 1) {
|
||||
QString menu_title = menu_path.takeFirst();
|
||||
QMenu *submenu = cur_menu->findChild<QMenu *>(menu_title.toLower(), Qt::FindDirectChildrenOnly);
|
||||
cur_menu = submenu;
|
||||
}
|
||||
cur_menu->removeAction(action);
|
||||
break;
|
||||
}
|
||||
// }
|
||||
default:
|
||||
// qDebug() << "FIX: Remove" << action->text() << "from the menu";
|
||||
break;
|
||||
|
@ -2735,7 +2717,7 @@ void LogwolfMainWindow::removeMenuActions(QList<QAction *> &actions, int menu_gr
|
|||
void LogwolfMainWindow::addDynamicMenus()
|
||||
{
|
||||
// Fill in each menu
|
||||
foreach(register_stat_group_t menu_group, menu_groups) {
|
||||
foreach(register_stat_group_t menu_group, menu_groups_) {
|
||||
QList<QAction *>actions = mainApp->dynamicMenuGroupItems(menu_group);
|
||||
addMenuActions(actions, menu_group);
|
||||
}
|
||||
|
@ -2743,7 +2725,7 @@ void LogwolfMainWindow::addDynamicMenus()
|
|||
|
||||
void LogwolfMainWindow::reloadDynamicMenus()
|
||||
{
|
||||
foreach(register_stat_group_t menu_group, menu_groups) {
|
||||
foreach(register_stat_group_t menu_group, menu_groups_) {
|
||||
QList<QAction *>actions = mainApp->removedMenuGroupItems(menu_group);
|
||||
removeMenuActions(actions, menu_group);
|
||||
|
||||
|
|
|
@ -1592,13 +1592,15 @@ void LogwolfMainWindow::initViewColorizeMenu()
|
|||
|
||||
void LogwolfMainWindow::addStatsPluginsToMenu() {
|
||||
GList *cfg_list = stats_tree_get_cfg_list();
|
||||
GList *iter = g_list_first(cfg_list);
|
||||
QAction *stats_tree_action;
|
||||
QMenu *parent_menu;
|
||||
bool first_item = true;
|
||||
|
||||
while (iter) {
|
||||
for (GList *iter = g_list_first(cfg_list); iter; iter = gxx_list_next(iter)) {
|
||||
stats_tree_cfg *cfg = gxx_list_data(stats_tree_cfg *, iter);
|
||||
if (!menu_groups_.contains(cfg->stat_group)) {
|
||||
continue;
|
||||
}
|
||||
if (cfg->plugin) {
|
||||
if (first_item) {
|
||||
main_ui_->menuStatistics->addSeparator();
|
||||
|
@ -1625,7 +1627,6 @@ void LogwolfMainWindow::addStatsPluginsToMenu() {
|
|||
parent_menu->addAction(stats_tree_action);
|
||||
connect(stats_tree_action, SIGNAL(triggered()), this, SLOT(actionStatisticsPlugin_triggered()));
|
||||
}
|
||||
iter = gxx_list_next(iter);
|
||||
}
|
||||
g_list_free(cfg_list);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue