diff options
author | Gerald Combs <gerald@wireshark.org> | 2014-04-29 11:10:27 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-07-21 23:19:09 +0000 |
commit | 59ef97dd652131a6df0edd26cc8709461587a224 (patch) | |
tree | c3428c9388757895136b7ea43d168b1966feb68e /ui/qt/filter_action.cpp | |
parent | d81a34cc24598778d3f8073cf85027a777cbbc10 (diff) | |
download | wireshark-59ef97dd652131a6df0edd26cc8709461587a224.tar.gz |
[WIP] Add a conversation dialog.
Items are sorted by value.
Move common conversation code to ui/conversation_hash.[ch]. Add a
conversation_type_e enum along with convenience functions for fetching
titles, tap names, etc.
We have a single main dialog instead of a main dialog + individual
protocol dialogs. It de-clutters the statistics menu and results in
simpler code. Conversation type tabs can be added and removed within the
dialog itself. The tab list is sticky and saved with the current profile
when the dialog closes. Data can be copied as CSV or YAML.
Add a FilterAction class and a corresponding filterAction slot to
MainWindow. Use it for the Conversations context menu.
Add an addressResolutionChanged signal and related plumbing.
Get rid of the iterator members in the conversation item struct. Update
the GTK+ code accordingly.
Excercise for the reader:
- Update TShark to use the common hash code.
Ping-Bug: 9231
Ping-Bug: 8703
Ping-Bug: 6727
Change-Id: I8728d771fc5b1a85937bed9d898e53c3ecc3a544
Reviewed-on: https://code.wireshark.org/review/2987
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/qt/filter_action.cpp')
-rw-r--r-- | ui/qt/filter_action.cpp | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/ui/qt/filter_action.cpp b/ui/qt/filter_action.cpp new file mode 100644 index 0000000000..e91642eba6 --- /dev/null +++ b/ui/qt/filter_action.cpp @@ -0,0 +1,172 @@ +/* filter_action.cpp + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "filter_action.h" + +FilterAction::FilterAction(QObject *parent, Action action, ActionType type, ActionDirection direction) : + QAction(parent), + action_(action), + type_(type), + direction_(direction) +{ + setText(actionDirectionName(direction)); +} + + +const QList<FilterAction::Action> FilterAction::actions() { + static const QList<Action> actions_ = QList<Action>() + << ActionApply + << ActionPrepare + << ActionFind + << ActionColorize + << ActionWebLookup + << ActionCopy; + return actions_; +} + +const QString FilterAction::actionName(Action action) { + switch (action) { + case ActionApply: + return QObject::tr("Apply as Filter"); + break; + case ActionPrepare: + return QObject::tr("Prepare a Filter"); + break; + case ActionFind: + return QObject::tr("Find"); + break; + case ActionColorize: + return QObject::tr("Colorize"); + break; + case ActionWebLookup: + return QObject::tr("Look Up"); + break; + case ActionCopy: + return QObject::tr("Copy"); + break; + default: + return QObject::tr("UNKNOWN"); + break; + } +} + + +const QList<FilterAction::ActionType> FilterAction::actionTypes() +{ + static const QList<ActionType> action_types_ = QList<ActionType>() + << ActionTypePlain + << ActionTypeNot + << ActionTypeAnd + << ActionTypeOr + << ActionTypeAndNot + << ActionTypeOrNot; + return action_types_; +} + +const QString FilterAction::actionTypeName(ActionType type) { + switch (type) { + case ActionTypePlain: + return QObject::tr("Selected"); + break; + case ActionTypeNot: + return QObject::tr("Not Selected"); + break; + case ActionTypeAnd: + return QObject::tr(UTF8_HORIZONTAL_ELLIPSIS " and Selected"); + break; + case ActionTypeOr: + return QObject::tr(UTF8_HORIZONTAL_ELLIPSIS " or Selected"); + break; + case ActionTypeAndNot: + return QObject::tr(UTF8_HORIZONTAL_ELLIPSIS " and not Selected"); + break; + case ActionTypeOrNot: + return QObject::tr(UTF8_HORIZONTAL_ELLIPSIS " or not Selected"); + break; + default: + return QObject::tr("UNKNOWN"); + break; + } +} + + +const QList<FilterAction::ActionDirection> FilterAction::actionDirections() +{ + static const QList<FilterAction::ActionDirection> action_directions_ = QList<ActionDirection>() + << ActionDirectionAToFromB + << ActionDirectionAToB + << ActionDirectionAFromB + << ActionDirectionAToFromAny + << ActionDirectionAToAny + << ActionDirectionAFromAny + << ActionDirectionAnyToFromB + << ActionDirectionAnyToB + << ActionDirectionAnyFromB; + return action_directions_; +} + +const QString FilterAction::actionDirectionName(ActionDirection direction) { + switch (direction) { + case ActionDirectionAToFromB: + return QObject::tr("A " UTF8_LEFT_RIGHT_ARROW " B"); + break; + case ActionDirectionAToB: + return QObject::tr("A " UTF8_RIGHTWARDS_ARROW " B"); + break; + case ActionDirectionAFromB: + return QObject::tr("B " UTF8_RIGHTWARDS_ARROW " A"); + break; + case ActionDirectionAToFromAny: + return QObject::tr("A " UTF8_LEFT_RIGHT_ARROW " Any"); + break; + case ActionDirectionAToAny: + return QObject::tr("A " UTF8_RIGHTWARDS_ARROW " Any"); + break; + case ActionDirectionAFromAny: + return QObject::tr("Any " UTF8_RIGHTWARDS_ARROW " A"); + break; + case ActionDirectionAnyToFromB: + return QObject::tr("Any " UTF8_LEFT_RIGHT_ARROW " B"); + break; + case ActionDirectionAnyToB: + return QObject::tr("Any " UTF8_RIGHTWARDS_ARROW " B"); + break; + case ActionDirectionAnyFromB: + return QObject::tr("B " UTF8_RIGHTWARDS_ARROW " Any"); + break; + default: + return QObject::tr("UNKNOWN"); + break; + } +} + +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ |