diff options
author | Roland Knall <rknall@gmail.com> | 2016-10-02 16:47:04 +0200 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-10-02 18:18:34 +0000 |
commit | 53523a739c41abfdc3f61ba460f8a6d021c02832 (patch) | |
tree | 5157f15fa76902f02bbc2b5b6994583dd0f86a72 /ui/qt/interface_tree_model.cpp | |
parent | fea4d585edc407b7177e3b0481bf59f57942cf18 (diff) |
Interface List: Fix build for no PCAP builds
This is a fix for building without libpcap. Also, changing _U_
to Q_UNUSED for the tree_model
Change-Id: I38a992731a3d3c4062ffab3cca0049cf08050794
Reviewed-on: https://code.wireshark.org/review/18019
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/interface_tree_model.cpp')
-rw-r--r-- | ui/qt/interface_tree_model.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/ui/qt/interface_tree_model.cpp b/ui/qt/interface_tree_model.cpp index 518340e448..94e94113d8 100644 --- a/ui/qt/interface_tree_model.cpp +++ b/ui/qt/interface_tree_model.cpp @@ -71,19 +71,29 @@ InterfaceTreeModel::~InterfaceTreeModel(void) #endif // HAVE_LIBPCAP } -int InterfaceTreeModel::rowCount(const QModelIndex & parent _U_) const +int InterfaceTreeModel::rowCount(const QModelIndex & parent) const { + Q_UNUSED(parent); + +#ifdef HAVE_LIBPCAP return (global_capture_opts.all_ifaces ? global_capture_opts.all_ifaces->len : 0); +#else + /* Currently no interfaces available for libpcap-less builds */ + return 0; +#endif } -int InterfaceTreeModel::columnCount(const QModelIndex & parent _U_) const +int InterfaceTreeModel::columnCount(const QModelIndex & parent) const { + Q_UNUSED(parent); + /* IFTREE_COL_MAX is not being displayed, it is the definition for the maximum numbers of columns */ return ((int) IFTREE_COL_MAX); } QVariant InterfaceTreeModel::data(const QModelIndex &index, int role) const { +#ifdef HAVE_LIBPCAP bool interfacesLoaded = true; if ( ! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len == 0 ) interfacesLoaded = false; @@ -143,6 +153,9 @@ QVariant InterfaceTreeModel::data(const QModelIndex &index, int role) const { return toolTipForInterface(row); } +#endif + Q_UNUSED(index); + Q_UNUSED(role); return QVariant(); } @@ -168,6 +181,7 @@ void InterfaceTreeModel::interfaceListChanged() */ QVariant InterfaceTreeModel::toolTipForInterface(int idx) const { +#ifdef HAVE_LIBPCAP if ( ! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx) return QVariant(); @@ -207,6 +221,11 @@ QVariant InterfaceTreeModel::toolTipForInterface(int idx) const tt_str += "</p>"; return tt_str; +#else + Q_UNUSED(idx); + + return QVariant(); +#endif } #ifdef HAVE_LIBPCAP @@ -222,8 +241,8 @@ void InterfaceTreeModel::stopStatistic() void InterfaceTreeModel::updateStatistic(unsigned int idx) { +#ifdef HAVE_LIBPCAP guint diff; - if ( ! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx ) return; @@ -232,7 +251,6 @@ void InterfaceTreeModel::updateStatistic(unsigned int idx) if ( device.if_info.type == IF_PIPE ) return; -#ifdef HAVE_LIBPCAP if ( !stat_cache_ ) { // Start gathering statistics using dumpcap @@ -241,7 +259,6 @@ void InterfaceTreeModel::updateStatistic(unsigned int idx) } if ( !stat_cache_ ) return; -#endif struct pcap_stat stats; @@ -264,14 +281,22 @@ void InterfaceTreeModel::updateStatistic(unsigned int idx) points[device.name]->append(diff); emit dataChanged(index(idx, IFTREE_COL_STATS), index(idx, IFTREE_COL_STATS)); +#else + Q_UNUSED(idx); +#endif } void InterfaceTreeModel::getPoints(int idx, PointList *pts) { +#ifdef HAVE_LIBPCAP if ( ! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx ) return; interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, idx); if ( points.contains(device.name) ) pts->append(*points[device.name]); +#else + Q_UNUSED(idx); + Q_UNUSED(pts); +#endif } |