aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-02-28 19:23:20 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2016-02-28 18:25:50 +0000
commit1a716800e37ae482901e9cce36c40005742dd78e (patch)
tree6dc88f72f082fa795646442e086363ff3d2f1b9f
parentf0425e83a16acabfec103f52099a3f20ea7b35c2 (diff)
Qt: Add dialog geometry restore
Add GeometryStateDialog class to handle load and save dialog geometry. The QDialog class name will be used as window name. For shared classes the UAT name or the statistics title or abbr will be used. Change-Id: I5a019598307fb3861518f41e733de834788184d8 Reviewed-on: https://code.wireshark.org/review/14139 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
-rw-r--r--ui/qt/CMakeLists.txt2
-rw-r--r--ui/qt/Makefile.common2
-rw-r--r--ui/qt/bluetooth_att_server_attributes_dialog.cpp2
-rw-r--r--ui/qt/bluetooth_devices_dialog.cpp2
-rw-r--r--ui/qt/bluetooth_hci_summary_dialog.cpp2
-rw-r--r--ui/qt/capture_file_properties_dialog.cpp4
-rw-r--r--ui/qt/capture_interfaces_dialog.cpp3
-rw-r--r--ui/qt/capture_interfaces_dialog.h4
-rw-r--r--ui/qt/coloring_rules_dialog.cpp7
-rw-r--r--ui/qt/coloring_rules_dialog.h4
-rw-r--r--ui/qt/compiled_filter_output.cpp3
-rw-r--r--ui/qt/compiled_filter_output.h5
-rw-r--r--ui/qt/conversation_hash_tables_dialog.cpp6
-rw-r--r--ui/qt/conversation_hash_tables_dialog.h4
-rw-r--r--ui/qt/decode_as_dialog.cpp4
-rw-r--r--ui/qt/decode_as_dialog.h4
-rw-r--r--ui/qt/display_filter_expression_dialog.cpp7
-rw-r--r--ui/qt/display_filter_expression_dialog.h4
-rw-r--r--ui/qt/dissector_tables_dialog.cpp7
-rw-r--r--ui/qt/dissector_tables_dialog.h4
-rw-r--r--ui/qt/enabled_protocols_dialog.cpp3
-rw-r--r--ui/qt/enabled_protocols_dialog.h3
-rw-r--r--ui/qt/expert_info_dialog.cpp3
-rw-r--r--ui/qt/file_set_dialog.cpp3
-rw-r--r--ui/qt/file_set_dialog.h4
-rw-r--r--ui/qt/filter_dialog.cpp6
-rw-r--r--ui/qt/filter_dialog.h4
-rw-r--r--ui/qt/follow_stream_dialog.cpp4
-rw-r--r--ui/qt/geometry_state_dialog.cpp101
-rw-r--r--ui/qt/geometry_state_dialog.h57
-rw-r--r--ui/qt/iax2_analysis_dialog.cpp3
-rw-r--r--ui/qt/io_graph_dialog.cpp2
-rw-r--r--ui/qt/lbm_uimflow_dialog.cpp10
-rw-r--r--ui/qt/lbm_uimflow_dialog.h4
-rw-r--r--ui/qt/lte_mac_statistics_dialog.cpp5
-rw-r--r--ui/qt/lte_rlc_graph_dialog.cpp4
-rw-r--r--ui/qt/lte_rlc_statistics_dialog.cpp4
-rw-r--r--ui/qt/manage_interfaces_dialog.cpp3
-rw-r--r--ui/qt/manage_interfaces_dialog.h4
-rw-r--r--ui/qt/multicast_statistics_dialog.cpp4
-rw-r--r--ui/qt/packet_comment_dialog.cpp3
-rw-r--r--ui/qt/packet_comment_dialog.h4
-rw-r--r--ui/qt/packet_dialog.cpp4
-rw-r--r--ui/qt/preferences_dialog.cpp4
-rw-r--r--ui/qt/preferences_dialog.h4
-rw-r--r--ui/qt/profile_dialog.cpp3
-rw-r--r--ui/qt/profile_dialog.h4
-rw-r--r--ui/qt/protocol_hierarchy_dialog.cpp4
-rw-r--r--ui/qt/resolved_addresses_dialog.cpp6
-rw-r--r--ui/qt/resolved_addresses_dialog.h4
-rw-r--r--ui/qt/response_time_delay_dialog.cpp1
-rw-r--r--ui/qt/rtp_analysis_dialog.cpp3
-rw-r--r--ui/qt/rtp_player_dialog.cpp2
-rw-r--r--ui/qt/rtp_stream_dialog.cpp4
-rw-r--r--ui/qt/sequence_dialog.cpp5
-rw-r--r--ui/qt/service_response_time_dialog.cpp1
-rw-r--r--ui/qt/show_packet_bytes_dialog.cpp4
-rw-r--r--ui/qt/simple_statistics_dialog.cpp1
-rw-r--r--ui/qt/stats_tree_dialog.cpp2
-rw-r--r--ui/qt/supported_protocols_dialog.cpp6
-rw-r--r--ui/qt/supported_protocols_dialog.h4
-rw-r--r--ui/qt/tap_parameter_dialog.cpp3
-rw-r--r--ui/qt/traffic_table_dialog.cpp4
-rw-r--r--ui/qt/uat_dialog.cpp3
-rw-r--r--ui/qt/uat_dialog.h5
-rw-r--r--ui/qt/voip_calls_dialog.cpp5
-rw-r--r--ui/qt/wireshark_dialog.cpp8
-rw-r--r--ui/qt/wireshark_dialog.h8
-rw-r--r--ui/qt/wlan_statistics_dialog.cpp4
69 files changed, 279 insertions, 145 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index ecaf198a68..b3f409421e 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -72,6 +72,7 @@ set(WIRESHARK_QT_HEADERS
funnel_string_dialog.h
funnel_text_dialog.h
funnel_statistics.h
+ geometry_state_dialog.h
gsm_map_summary_dialog.h
iax2_analysis_dialog.h
import_text_dialog.h
@@ -222,6 +223,7 @@ set(WIRESHARK_QT_SRC
font_color_preferences_frame.cpp
funnel_string_dialog.cpp
funnel_text_dialog.cpp
+ geometry_state_dialog.cpp
iax2_analysis_dialog.cpp
import_text_dialog.cpp
interface_tree.cpp
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index aa7212d044..6919eeb1bc 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -196,6 +196,7 @@ MOC_HDRS = \
funnel_string_dialog.h \
funnel_text_dialog.h \
funnel_statistics.h \
+ geometry_state_dialog.h \
gsm_map_summary_dialog.h \
iax2_analysis_dialog.h \
import_text_dialog.h \
@@ -459,6 +460,7 @@ WIRESHARK_QT_SRC = \
font_color_preferences_frame.cpp \
funnel_string_dialog.cpp \
funnel_text_dialog.cpp \
+ geometry_state_dialog.cpp \
iax2_analysis_dialog.cpp \
import_text_dialog.cpp \
interface_tree.cpp \
diff --git a/ui/qt/bluetooth_att_server_attributes_dialog.cpp b/ui/qt/bluetooth_att_server_attributes_dialog.cpp
index ae20f883e5..530efe67d0 100644
--- a/ui/qt/bluetooth_att_server_attributes_dialog.cpp
+++ b/ui/qt/bluetooth_att_server_attributes_dialog.cpp
@@ -65,7 +65,7 @@ BluetoothAttServerAttributesDialog::BluetoothAttServerAttributesDialog(QWidget &
ui(new Ui::BluetoothAttServerAttributesDialog)
{
ui->setupUi(this);
- resize(parent.width() * 4 / 5, parent.height() * 2 / 3);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 2 / 3);
connect(ui->tableTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableContextMenu(const QPoint &)));
connect(ui->interfaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(interfaceCurrentIndexChanged(int)));
diff --git a/ui/qt/bluetooth_devices_dialog.cpp b/ui/qt/bluetooth_devices_dialog.cpp
index 914fbd3d1e..ba6ff1544a 100644
--- a/ui/qt/bluetooth_devices_dialog.cpp
+++ b/ui/qt/bluetooth_devices_dialog.cpp
@@ -80,7 +80,7 @@ BluetoothDevicesDialog::BluetoothDevicesDialog(QWidget &parent, CaptureFile &cf)
ui(new Ui::BluetoothDevicesDialog)
{
ui->setupUi(this);
- resize(parent.width() * 4 / 5, parent.height() * 2 / 3);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 2 / 3);
connect(ui->tableTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableContextMenu(const QPoint &)));
connect(ui->interfaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(interfaceCurrentIndexChanged(int)));
diff --git a/ui/qt/bluetooth_hci_summary_dialog.cpp b/ui/qt/bluetooth_hci_summary_dialog.cpp
index c896ac091a..db479190c4 100644
--- a/ui/qt/bluetooth_hci_summary_dialog.cpp
+++ b/ui/qt/bluetooth_hci_summary_dialog.cpp
@@ -101,7 +101,7 @@ BluetoothHciSummaryDialog::BluetoothHciSummaryDialog(QWidget &parent, CaptureFil
ui(new Ui::BluetoothHciSummaryDialog)
{
ui->setupUi(this);
- resize(parent.width() * 4 / 5, parent.height() * 2 / 3);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 2 / 3);
connect(ui->tableTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableContextMenu(const QPoint &)));
connect(ui->tableTreeWidget, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, SLOT(tableItemExpanded(QTreeWidgetItem *)));
diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp
index a76002cffd..5473a838f4 100644
--- a/ui/qt/capture_file_properties_dialog.cpp
+++ b/ui/qt/capture_file_properties_dialog.cpp
@@ -45,9 +45,7 @@ CaptureFilePropertiesDialog::CaptureFilePropertiesDialog(QWidget &parent, Captur
ui(new Ui::CaptureFilePropertiesDialog)
{
ui->setupUi(this);
-
- // XXX Use recent settings instead
- resize(parent.width() * 2 / 3, parent.height());
+ loadGeometry(parent.width() * 2 / 3, parent.height());
ui->detailsTextEdit->setAcceptRichText(true);
diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp
index 1dd5e32ec5..a711b8957b 100644
--- a/ui/qt/capture_interfaces_dialog.cpp
+++ b/ui/qt/capture_interfaces_dialog.cpp
@@ -113,10 +113,11 @@ public:
};
CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::CaptureInterfacesDialog)
{
ui->setupUi(this);
+ loadGeometry();
setWindowTitle(wsApp->windowTitleString(tr("Capture Interfaces")));
stat_timer_ = NULL;
diff --git a/ui/qt/capture_interfaces_dialog.h b/ui/qt/capture_interfaces_dialog.h
index e990c4bace..0e8e72f264 100644
--- a/ui/qt/capture_interfaces_dialog.h
+++ b/ui/qt/capture_interfaces_dialog.h
@@ -27,7 +27,7 @@
#ifdef HAVE_LIBPCAP
-#include <QDialog>
+#include "geometry_state_dialog.h"
#include <QPushButton>
typedef struct if_stat_cache_s if_stat_cache_t;
@@ -68,7 +68,7 @@ private slots:
void buffer_changed(int value);
};
-class CaptureInterfacesDialog : public QDialog
+class CaptureInterfacesDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp
index 5ba48a91a6..a31ec77191 100644
--- a/ui/qt/coloring_rules_dialog.cpp
+++ b/ui/qt/coloring_rules_dialog.cpp
@@ -71,15 +71,14 @@ enum {
static const QString new_rule_name_ = QObject::tr("New coloring rule");
ColoringRulesDialog::ColoringRulesDialog(QWidget *parent, QString add_filter) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::ColoringRulesDialog),
conversation_colors_(NULL)
{
ui->setupUi(this);
- setWindowTitle(wsApp->windowTitleString(QStringList() << tr("Coloring Rules") << get_profile_name()));
+ if (parent) loadGeometry(parent->width() * 2 / 3, parent->height() * 4 / 5);
- // XXX Use recent settings instead
- resize(parent->width() * 2 / 3, parent->height() * 4 / 5);
+ setWindowTitle(wsApp->windowTitleString(QStringList() << tr("Coloring Rules") << get_profile_name()));
ui->coloringRulesTreeWidget->setDragEnabled(true);
ui->coloringRulesTreeWidget->viewport()->setAcceptDrops(true);
diff --git a/ui/qt/coloring_rules_dialog.h b/ui/qt/coloring_rules_dialog.h
index becdb93727..be753deeb0 100644
--- a/ui/qt/coloring_rules_dialog.h
+++ b/ui/qt/coloring_rules_dialog.h
@@ -22,7 +22,7 @@
#ifndef COLORING_RULES_DIALOG_H
#define COLORING_RULES_DIALOG_H
-#include <QDialog>
+#include "geometry_state_dialog.h"
class QAbstractButton;
class QTreeWidget;
@@ -54,7 +54,7 @@ private slots:
void ruleNameChanged(const QString name);
};
-class ColoringRulesDialog : public QDialog
+class ColoringRulesDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/compiled_filter_output.cpp b/ui/qt/compiled_filter_output.cpp
index 703857ed08..67c5f64daa 100644
--- a/ui/qt/compiled_filter_output.cpp
+++ b/ui/qt/compiled_filter_output.cpp
@@ -35,12 +35,13 @@
#include <QPushButton>
CompiledFilterOutput::CompiledFilterOutput(QWidget *parent, QStringList &intList, QString &compile_filter) :
- QDialog(parent),
+ GeometryStateDialog(parent),
intList_(intList),
compile_filter_(compile_filter),
ui(new Ui::CompiledFilterOutput)
{
ui->setupUi(this);
+ loadGeometry();
setAttribute(Qt::WA_DeleteOnClose, true);
ui->filterList->setCurrentFont(wsApp->monospaceFont());
diff --git a/ui/qt/compiled_filter_output.h b/ui/qt/compiled_filter_output.h
index 44642a88e7..f23e36e223 100644
--- a/ui/qt/compiled_filter_output.h
+++ b/ui/qt/compiled_filter_output.h
@@ -22,8 +22,9 @@
#ifndef COMPILEDFILTEROUTPUT_H
#define COMPILEDFILTEROUTPUT_H
+#include "geometry_state_dialog.h"
+
#include <config.h>
-#include <QDialog>
#include <QList>
#include <QHash>
#include <QListWidgetItem>
@@ -34,7 +35,7 @@ namespace Ui {
class CompiledFilterOutput;
}
-class CompiledFilterOutput : public QDialog
+class CompiledFilterOutput : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/conversation_hash_tables_dialog.cpp b/ui/qt/conversation_hash_tables_dialog.cpp
index 15b90f5bbf..db4c095c70 100644
--- a/ui/qt/conversation_hash_tables_dialog.cpp
+++ b/ui/qt/conversation_hash_tables_dialog.cpp
@@ -33,16 +33,14 @@
#include "wireshark_application.h"
ConversationHashTablesDialog::ConversationHashTablesDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::ConversationHashTablesDialog)
{
ui->setupUi(this);
+ if (parent) loadGeometry(parent->width() * 3 / 4, parent->height() * 3 / 4);
setWindowTitle(wsApp->windowTitleString(tr("Dissector Tables")));
- // XXX Use recent settings instead
- if (parent) resize(parent->width() * 3 / 4, parent->height() * 3 / 4);
-
QString html;
html += "<h3>Conversation Hash Tables</h3>\n";
diff --git a/ui/qt/conversation_hash_tables_dialog.h b/ui/qt/conversation_hash_tables_dialog.h
index 9b0752cad5..a0299c428d 100644
--- a/ui/qt/conversation_hash_tables_dialog.h
+++ b/ui/qt/conversation_hash_tables_dialog.h
@@ -22,13 +22,13 @@
#ifndef CONVERSATION_HASH_TABLES_DIALOG_H
#define CONVERSATION_HASH_TABLES_DIALOG_H
-#include <QDialog>
+#include "geometry_state_dialog.h"
namespace Ui {
class ConversationHashTablesDialog;
}
-class ConversationHashTablesDialog : public QDialog
+class ConversationHashTablesDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/decode_as_dialog.cpp b/ui/qt/decode_as_dialog.cpp
index a50f90d71a..ce59057616 100644
--- a/ui/qt/decode_as_dialog.cpp
+++ b/ui/qt/decode_as_dialog.cpp
@@ -71,7 +71,7 @@ typedef struct _table_item_t {
Q_DECLARE_METATYPE(table_item_t)
DecodeAsDialog::DecodeAsDialog(QWidget *parent, capture_file *cf, bool create_new) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::DecodeAsDialog),
cap_file_(cf),
table_names_combo_box_(NULL),
@@ -79,6 +79,8 @@ DecodeAsDialog::DecodeAsDialog(QWidget *parent, capture_file *cf, bool create_ne
cur_proto_combo_box_(NULL)
{
ui->setupUi(this);
+ loadGeometry();
+
setWindowTitle(wsApp->windowTitleString(tr("Decode As" UTF8_HORIZONTAL_ELLIPSIS)));
ui->deleteToolButton->setEnabled(false);
diff --git a/ui/qt/decode_as_dialog.h b/ui/qt/decode_as_dialog.h
index 7303d5b7d0..9682f7d8c7 100644
--- a/ui/qt/decode_as_dialog.h
+++ b/ui/qt/decode_as_dialog.h
@@ -28,7 +28,7 @@
#include "cfile.h"
-#include <QDialog>
+#include "geometry_state_dialog.h"
#include <QMap>
#include <QAbstractButton>
@@ -39,7 +39,7 @@ namespace Ui {
class DecodeAsDialog;
}
-class DecodeAsDialog : public QDialog
+class DecodeAsDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/display_filter_expression_dialog.cpp b/ui/qt/display_filter_expression_dialog.cpp
index 6de0ba2c28..4464146abd 100644
--- a/ui/qt/display_filter_expression_dialog.cpp
+++ b/ui/qt/display_filter_expression_dialog.cpp
@@ -61,18 +61,17 @@ enum {
Q_DECLARE_METATYPE(header_field_info *)
DisplayFilterExpressionDialog::DisplayFilterExpressionDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::DisplayFilterExpressionDialog),
ftype_(FT_NONE),
field_(NULL)
{
ui->setupUi(this);
+ if (parent) loadGeometry(parent->width() * 2 / 3, parent->height());
+
setWindowTitle(wsApp->windowTitleString(tr("Display Filter Expression")));
setWindowIcon(wsApp->normalIcon());
- // XXX Use recent settings instead
- resize(parent->width() * 2 / 3, parent->height());
-
ui->fieldTreeWidget->setToolTip(ui->fieldLabel->toolTip());
ui->searchLineEdit->setToolTip(ui->searchLabel->toolTip());
ui->relationListWidget->setToolTip(ui->relationLabel->toolTip());
diff --git a/ui/qt/display_filter_expression_dialog.h b/ui/qt/display_filter_expression_dialog.h
index 0be54a02bf..eae5bc7e1e 100644
--- a/ui/qt/display_filter_expression_dialog.h
+++ b/ui/qt/display_filter_expression_dialog.h
@@ -26,7 +26,7 @@
#include <epan/ftypes/ftypes.h>
-#include <QDialog>
+#include "geometry_state_dialog.h"
class QTreeWidgetItem;
struct true_false_string;
@@ -37,7 +37,7 @@ namespace Ui {
class DisplayFilterExpressionDialog;
}
-class DisplayFilterExpressionDialog : public QDialog
+class DisplayFilterExpressionDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/dissector_tables_dialog.cpp b/ui/qt/dissector_tables_dialog.cpp
index 7cd4e07a3c..4c41338ece 100644
--- a/ui/qt/dissector_tables_dialog.cpp
+++ b/ui/qt/dissector_tables_dialog.cpp
@@ -78,14 +78,13 @@ private:
};
DissectorTablesDialog::DissectorTablesDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::DissectorTablesDialog)
{
ui->setupUi(this);
- setWindowTitle(wsApp->windowTitleString(tr("Dissector Tables")));
+ if (parent) loadGeometry(parent->width() * 3 / 4, parent->height() * 3 / 4);
- // XXX Use recent settings instead
- if (parent) resize(parent->width() * 3 / 4, parent->height() * 3 / 4);
+ setWindowTitle(wsApp->windowTitleString(tr("Dissector Tables")));
on_tableTreeWidget_itemSelectionChanged();
diff --git a/ui/qt/dissector_tables_dialog.h b/ui/qt/dissector_tables_dialog.h
index 512fb359df..3d3aadc881 100644
--- a/ui/qt/dissector_tables_dialog.h
+++ b/ui/qt/dissector_tables_dialog.h
@@ -26,7 +26,7 @@
#include <epan/ftypes/ftypes.h>
-#include <QDialog>
+#include "geometry_state_dialog.h"
namespace Ui {
class DissectorTablesDialog;
@@ -34,7 +34,7 @@ class DissectorTablesDialog;
class QTreeWidgetItem;
-class DissectorTablesDialog : public QDialog
+class DissectorTablesDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/enabled_protocols_dialog.cpp b/ui/qt/enabled_protocols_dialog.cpp
index 143611a952..793a5a0e98 100644
--- a/ui/qt/enabled_protocols_dialog.cpp
+++ b/ui/qt/enabled_protocols_dialog.cpp
@@ -123,10 +123,11 @@ private:
};
EnabledProtocolsDialog::EnabledProtocolsDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::EnabledProtocolsDialog)
{
ui->setupUi(this);
+ loadGeometry();
setWindowTitle(wsApp->windowTitleString(tr("Enabled Protocols")));
void *cookie;
diff --git a/ui/qt/enabled_protocols_dialog.h b/ui/qt/enabled_protocols_dialog.h
index 6f84a92b21..6b44bd49e7 100644
--- a/ui/qt/enabled_protocols_dialog.h
+++ b/ui/qt/enabled_protocols_dialog.h
@@ -22,6 +22,7 @@
#ifndef ENABLED_PROTOCOLS_DIALOG_H
#define ENABLED_PROTOCOLS_DIALOG_H
+#include "geometry_state_dialog.h"
#include "wireshark_dialog.h"
namespace Ui {
@@ -32,7 +33,7 @@ struct _protocol;
class QAbstractButton;
-class EnabledProtocolsDialog : public QDialog
+class EnabledProtocolsDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/expert_info_dialog.cpp b/ui/qt/expert_info_dialog.cpp
index 9f0a11e52c..c50850b5d6 100644
--- a/ui/qt/expert_info_dialog.cpp
+++ b/ui/qt/expert_info_dialog.cpp
@@ -143,10 +143,9 @@ ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file) :
// Clicking on an item jumps to its associated packet. Make the dialog
// narrow so that we avoid obscuring the packet list.
- // XXX Use recent settings instead
int dlg_width = parent.width() * 3 / 5;
if (dlg_width < width()) dlg_width = width();
- resize(dlg_width, parent.height());
+ loadGeometry(dlg_width, parent.height());
int one_em = fontMetrics().height();
ui->expertInfoTreeWidget->setColumnWidth(severity_col_, one_em * 25); // Arbitrary
diff --git a/ui/qt/file_set_dialog.cpp b/ui/qt/file_set_dialog.cpp
index 7151437de4..525d446e7d 100644
--- a/ui/qt/file_set_dialog.cpp
+++ b/ui/qt/file_set_dialog.cpp
@@ -53,11 +53,12 @@ fileset_dlg_add_file(fileset_entry *entry, void *window) {
}
FileSetDialog::FileSetDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
fs_ui_(new Ui::FileSetDialog),
close_button_(NULL)
{
fs_ui_->setupUi(this);
+ loadGeometry ();
fs_ui_->fileSetTree->headerItem();
diff --git a/ui/qt/file_set_dialog.h b/ui/qt/file_set_dialog.h
index 7035648d42..7d8ec5f95a 100644
--- a/ui/qt/file_set_dialog.h
+++ b/ui/qt/file_set_dialog.h
@@ -29,7 +29,7 @@
#include "file.h"
#include "fileset.h"
-#include <QDialog>
+#include "geometry_state_dialog.h"
class QTreeWidgetItem;
@@ -37,7 +37,7 @@ namespace Ui {
class FileSetDialog;
}
-class FileSetDialog : public QDialog
+class FileSetDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/filter_dialog.cpp b/ui/qt/filter_dialog.cpp
index 7aff57e19f..0c211d0ce4 100644
--- a/ui/qt/filter_dialog.cpp
+++ b/ui/qt/filter_dialog.cpp
@@ -52,7 +52,7 @@ enum {
};
FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, const QString new_filter) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::FilterDialog),
filter_type_(filter_type),
// syntax_worker_(NULL),
@@ -60,11 +60,9 @@ FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, const QStrin
new_filter_(new_filter)
{
ui->setupUi(this);
+ if (parent) loadGeometry(parent->width() * 2 / 3, parent->height() * 2 / 3);
setWindowIcon(wsApp->normalIcon());
- // XXX Use recent settings instead
- resize(parent->width() * 2 / 3, parent->height() * 2 / 3);
-
ui->filterTreeWidget->setDragEnabled(true);
ui->filterTreeWidget->viewport()->setAcceptDrops(true);
ui->filterTreeWidget->setDropIndicatorShown(true);
diff --git a/ui/qt/filter_dialog.h b/ui/qt/filter_dialog.h
index b7b525c3f0..68440bbae3 100644
--- a/ui/qt/filter_dialog.h
+++ b/ui/qt/filter_dialog.h
@@ -22,7 +22,7 @@
#ifndef FILTER_DIALOG_H
#define FILTER_DIALOG_H
-#include <QDialog>
+#include "geometry_state_dialog.h"
//class CaptureFilterSyntaxWorker;
class FilterTreeDelegate;
@@ -31,7 +31,7 @@ namespace Ui {
class FilterDialog;
}
-class FilterDialog : public QDialog
+class FilterDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index 40a8afeb1b..6aa0162999 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -76,6 +76,7 @@ FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_
use_regex_find_(false)
{
ui->setupUi(this);
+ loadGeometry(parent.width() * 2 / 3, parent.height());
switch(type)
{
@@ -102,9 +103,6 @@ FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_
connect(ui->leFind, SIGNAL(useRegexFind(bool)), this, SLOT(useRegexFind(bool)));
- // XXX Use recent settings instead
- resize(parent.width() * 2 / 3, parent.height());
-
QComboBox *cbcs = ui->cbCharset;
cbcs->blockSignals(true);
cbcs->addItem(tr("ASCII"), SHOW_ASCII);
diff --git a/ui/qt/geometry_state_dialog.cpp b/ui/qt/geometry_state_dialog.cpp
new file mode 100644
index 0000000000..95469ae4a8
--- /dev/null
+++ b/ui/qt/geometry_state_dialog.cpp
@@ -0,0 +1,101 @@
+/* geometry_state_dialog.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 "geometry_state_dialog.h"
+#include "qt_ui_utils.h"
+#include "ui/recent.h"
+#include "ui/ui_util.h"
+
+
+GeometryStateDialog::GeometryStateDialog(QWidget *parent, Qt::WindowFlags f) :
+ QDialog(parent, f)
+{
+
+}
+
+GeometryStateDialog::~GeometryStateDialog()
+{
+ saveGeometry();
+}
+
+void GeometryStateDialog::loadGeometry(int width, int height, const QString &dialog_name)
+{
+ window_geometry_t geom;
+
+ dialog_name_ = dialog_name.isEmpty() ? objectName() : dialog_name;
+ if (!dialog_name_.isEmpty() && window_geom_load(dialog_name_.toUtf8().constData(), &geom)) {
+ QRect recent_geom(geom.x, geom.y, geom.width, geom.height);
+
+ // Check if the dialog is visible on any screen
+ if (rect_on_screen(recent_geom)) {
+ move(recent_geom.topLeft());
+ resize(recent_geom.size());
+ } else {
+ // Not visible, move within a reasonable area and try size only
+ recent_geom.moveTopLeft(QPoint(50, 50));
+ if (rect_on_screen(recent_geom)) {
+ resize(recent_geom.size());
+ } else if (width > 0 && height > 0) {
+ // We're not visible on any screens, use defaults
+ resize(width, height);
+ }
+ }
+ if (geom.maximized) {
+ showFullScreen();
+ }
+ } else if (width > 0 && height > 0) {
+ // No saved geometry found, use defaults
+ resize(width, height);
+ }
+}
+
+void GeometryStateDialog::saveGeometry()
+{
+ if (dialog_name_.isEmpty())
+ return;
+
+ window_geometry_t geom;
+
+ geom.key = NULL;
+ geom.set_pos = TRUE;
+ geom.x = pos().x();
+ geom.y = pos().y();
+ geom.set_size = TRUE;
+ geom.width = size().width();
+ geom.height = size().height();
+ geom.set_maximized = TRUE;
+ geom.maximized = isFullScreen();
+
+ window_geom_save(dialog_name_.toUtf8().constData(), &geom);
+}
+
+/*
+ * 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:
+ */
diff --git a/ui/qt/geometry_state_dialog.h b/ui/qt/geometry_state_dialog.h
new file mode 100644
index 0000000000..24b2de4a93
--- /dev/null
+++ b/ui/qt/geometry_state_dialog.h
@@ -0,0 +1,57 @@
+/* geometry_state_dialog.h
+ *
+ * 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.
+ */
+
+#ifndef GEOMETRY_STATE_DIALOG_H
+#define GEOMETRY_STATE_DIALOG_H
+
+#include <QDialog>
+
+class GeometryStateDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = 0);
+ ~GeometryStateDialog();
+
+protected:
+ void loadGeometry(int width = 0, int height = 0, const QString &dialog_name = QString());
+
+private:
+ void saveGeometry();
+
+ QString dialog_name_;
+};
+
+#endif // GEOMETRY_STATE_DIALOG_H
+
+/*
+ * 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:
+ */
diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp
index 506398b30c..a3f299ae5c 100644
--- a/ui/qt/iax2_analysis_dialog.cpp
+++ b/ui/qt/iax2_analysis_dialog.cpp
@@ -212,10 +212,9 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) :
port_dst_rev_(0)
{
ui->setupUi(this);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 4 / 5);
setWindowSubtitle(tr("IAX2 Stream Analysis"));
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 4 / 5);
ui->progressFrame->hide();
stream_ctx_menu_.addAction(ui->actionGoToPacket);
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index 236d54ef94..7270d49572 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -190,6 +190,8 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf) :
colors_(ColorUtils::graphColors())
{
ui->setupUi(this);
+ loadGeometry();
+
setWindowSubtitle(tr("IO Graphs"));
setAttribute(Qt::WA_DeleteOnClose, true);
QCustomPlot *iop = ui->ioPlot;
diff --git a/ui/qt/lbm_uimflow_dialog.cpp b/ui/qt/lbm_uimflow_dialog.cpp
index b34c57b81e..a4dbbcd6c3 100644
--- a/ui/qt/lbm_uimflow_dialog.cpp
+++ b/ui/qt/lbm_uimflow_dialog.cpp
@@ -209,7 +209,7 @@ static void lbm_uimflow_get_analysis(capture_file * cfile, seq_analysis_info_t *
// - Help button and text
LBMUIMFlowDialog::LBMUIMFlowDialog(QWidget * parent, capture_file * cfile) :
- QDialog(parent),
+ GeometryStateDialog(parent),
m_ui(new Ui::LBMUIMFlowDialog),
m_capture_file(cfile),
m_num_items(0),
@@ -217,6 +217,8 @@ LBMUIMFlowDialog::LBMUIMFlowDialog(QWidget * parent, capture_file * cfile) :
m_node_label_width(20)
{
m_ui->setupUi(this);
+ if (parent) loadGeometry(parent->width(), parent->height() * 4 / 5);
+
QCustomPlot * sp = m_ui->sequencePlot;
m_sequence_diagram = new SequenceDiagram(sp->yAxis, sp->xAxis2, sp->yAxis2);
@@ -263,12 +265,6 @@ LBMUIMFlowDialog::LBMUIMFlowDialog(QWidget * parent, capture_file * cfile) :
QPushButton * save_bt = m_ui->buttonBox->button(QDialogButtonBox::Save);
save_bt->setText(tr("Save As" UTF8_HORIZONTAL_ELLIPSIS));
- // XXX Use recent settings instead
- if (parent)
- {
- resize(parent->width(), parent->height() * 4 / 5);
- }
-
connect(m_ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(hScrollBarChanged(int)));
connect(m_ui->verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vScrollBarChanged(int)));
connect(sp->xAxis2, SIGNAL(rangeChanged(QCPRange)), this, SLOT(xAxisChanged(QCPRange)));
diff --git a/ui/qt/lbm_uimflow_dialog.h b/ui/qt/lbm_uimflow_dialog.h
index c77f126804..75fb30ca29 100644
--- a/ui/qt/lbm_uimflow_dialog.h
+++ b/ui/qt/lbm_uimflow_dialog.h
@@ -34,9 +34,9 @@
#include "ui/tap-sequence-analysis.h"
+#include "geometry_state_dialog.h"
#include "sequence_diagram.h"
-#include <QDialog>
#include <QMenu>
namespace Ui
@@ -44,7 +44,7 @@ namespace Ui
class LBMUIMFlowDialog;
}
-class LBMUIMFlowDialog : public QDialog
+class LBMUIMFlowDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/lte_mac_statistics_dialog.cpp b/ui/qt/lte_mac_statistics_dialog.cpp
index 7fc0ef635d..72abdd9ae3 100644
--- a/ui/qt/lte_mac_statistics_dialog.cpp
+++ b/ui/qt/lte_mac_statistics_dialog.cpp
@@ -469,6 +469,7 @@ LteMacStatisticsDialog::LteMacStatisticsDialog(QWidget &parent, CaptureFile &cf,
commonStatsCurrent_(false)
{
setWindowSubtitle(tr("LTE Mac Statistics"));
+ loadGeometry(parent.width() * 1, parent.height() * 3 / 4, "LTEMacStatisticsDialog");
clearCommonStats();
@@ -507,10 +508,6 @@ LteMacStatisticsDialog::LteMacStatisticsDialog(QWidget &parent, CaptureFile &cf,
showRACHFilterCheckBox_ = new QCheckBox(tr("Include RACH frames in filter"));
filter_controls_grid->addWidget(showRACHFilterCheckBox_);
-
- // XXX Use recent settings instead
- resize(parent.width() * 1, parent.height() * 3 / 4);
-
// Will set whole-UE headings originally.
updateHeaderLabels();
diff --git a/ui/qt/lte_rlc_graph_dialog.cpp b/ui/qt/lte_rlc_graph_dialog.cpp
index cfad7d3b4c..28351d4310 100644
--- a/ui/qt/lte_rlc_graph_dialog.cpp
+++ b/ui/qt/lte_rlc_graph_dialog.cpp
@@ -64,9 +64,7 @@ LteRlcGraphDialog::LteRlcGraphDialog(QWidget &parent, CaptureFile &cf, bool chan
packet_num_(0)
{
ui->setupUi(this);
-
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 3 / 4);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 3 / 4);
QCustomPlot *rp = ui->rlcPlot;
rp->xAxis->setLabel(tr("Time"));
diff --git a/ui/qt/lte_rlc_statistics_dialog.cpp b/ui/qt/lte_rlc_statistics_dialog.cpp
index da746df072..2f5176866a 100644
--- a/ui/qt/lte_rlc_statistics_dialog.cpp
+++ b/ui/qt/lte_rlc_statistics_dialog.cpp
@@ -643,9 +643,7 @@ LteRlcStatisticsDialog::LteRlcStatisticsDialog(QWidget &parent, CaptureFile &cf,
packet_count_(0)
{
setWindowSubtitle(tr("LTE RLC Statistics"));
-
- // XXX Use recent settings instead
- resize((parent.width() * 5) / 5, (parent.height() * 3) / 4);
+ loadGeometry((parent.width() * 5) / 5, (parent.height() * 3) / 4, "LTERLCStatisticsDialog");
// Create a grid for filtering-related widgetsto also appear in layout.
int filter_controls_layout_idx = verticalLayout()->indexOf(filterLayout()->widget());
diff --git a/ui/qt/manage_interfaces_dialog.cpp b/ui/qt/manage_interfaces_dialog.cpp
index 9cdae345d7..b611b9f7cf 100644
--- a/ui/qt/manage_interfaces_dialog.cpp
+++ b/ui/qt/manage_interfaces_dialog.cpp
@@ -84,10 +84,11 @@ enum {
};
ManageInterfacesDialog::ManageInterfacesDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::ManageInterfacesDialog)
{
ui->setupUi(this);
+ loadGeometry();
#ifdef Q_OS_MAC
ui->addPipe->setAttribute(Qt::WA_MacSmallSize, true);
diff --git a/ui/qt/manage_interfaces_dialog.h b/ui/qt/manage_interfaces_dialog.h
index 89ddfcee11..3db0e3d064 100644
--- a/ui/qt/manage_interfaces_dialog.h
+++ b/ui/qt/manage_interfaces_dialog.h
@@ -27,7 +27,7 @@
#include <glib.h>
#include "capture_opts.h"
-#include <QDialog>
+#include "geometry_state_dialog.h"
#include <QStyledItemDelegate>
class QTreeWidget;
@@ -66,7 +66,7 @@ namespace Ui {
class ManageInterfacesDialog;
}
-class ManageInterfacesDialog : public QDialog
+class ManageInterfacesDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/multicast_statistics_dialog.cpp b/ui/qt/multicast_statistics_dialog.cpp
index d36c57c108..eb216f3527 100644
--- a/ui/qt/multicast_statistics_dialog.cpp
+++ b/ui/qt/multicast_statistics_dialog.cpp
@@ -169,9 +169,7 @@ MulticastStatisticsDialog::MulticastStatisticsDialog(QWidget &parent, CaptureFil
TapParameterDialog(parent, cf)
{
setWindowSubtitle(tr("UDP Multicast Streams"));
-
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 3 / 4);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 3 / 4, "MulticastStatisticsDialog");
tapinfo_ = new mcaststream_tapinfo_t();
tapinfo_->user_data = this;
diff --git a/ui/qt/packet_comment_dialog.cpp b/ui/qt/packet_comment_dialog.cpp
index 117a544c3a..85318f9cd3 100644
--- a/ui/qt/packet_comment_dialog.cpp
+++ b/ui/qt/packet_comment_dialog.cpp
@@ -25,10 +25,11 @@
#include "wireshark_application.h"
PacketCommentDialog::PacketCommentDialog(QWidget *parent, QString comment) :
- QDialog(parent),
+ GeometryStateDialog(parent),
pc_ui_(new Ui::PacketCommentDialog)
{
pc_ui_->setupUi(this);
+ loadGeometry();
setWindowTitle(wsApp->windowTitleString(tr("Packet Comment")));
pc_ui_->commentTextEdit->setPlainText(comment);
diff --git a/ui/qt/packet_comment_dialog.h b/ui/qt/packet_comment_dialog.h
index d1b9f35d45..9593b74960 100644
--- a/ui/qt/packet_comment_dialog.h
+++ b/ui/qt/packet_comment_dialog.h
@@ -22,13 +22,13 @@
#ifndef PACKET_COMMENT_DIALOG_H
#define PACKET_COMMENT_DIALOG_H
-#include <QDialog>
+#include "geometry_state_dialog.h"
namespace Ui {
class PacketCommentDialog;
}
-class PacketCommentDialog : public QDialog
+class PacketCommentDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/packet_dialog.cpp b/ui/qt/packet_dialog.cpp
index a562f37f3f..a8e26f217f 100644
--- a/ui/qt/packet_dialog.cpp
+++ b/ui/qt/packet_dialog.cpp
@@ -49,11 +49,9 @@ PacketDialog::PacketDialog(QWidget &parent, CaptureFile &cf, frame_data *fdata)
packet_data_(NULL)
{
ui->setupUi(this);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 4 / 5);
ui->hintLabel->setSmallText();
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 4 / 5);
-
setWindowSubtitle(tr("Packet %1").arg(fdata->num));
phdr_ = cap_file_.capFile()->phdr;
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index 0908901783..58b36c3baa 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -255,7 +255,7 @@ const int capture_item_ = 1;
const int pref_ptr_col_ = 0;
PreferencesDialog::PreferencesDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
pd_ui_(new Ui::PreferencesDialog),
cur_line_edit_(NULL),
cur_combo_box_(NULL)
@@ -266,6 +266,8 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) :
// Some classes depend on pref_ptr_to_pref_ so this MUST be called after
// fill_advanced_prefs.
pd_ui_->setupUi(this);
+ loadGeometry();
+
setWindowTitle(wsApp->windowTitleString(tr("Preferences")));
pd_ui_->advancedTree->invisibleRootItem()->addChildren(tmp_item.takeChildren());
QTreeWidgetItemIterator pref_it(pd_ui_->advancedTree, QTreeWidgetItemIterator::NoChildren);
diff --git a/ui/qt/preferences_dialog.h b/ui/qt/preferences_dialog.h
index 8c0824b228..776ecd4429 100644
--- a/ui/qt/preferences_dialog.h
+++ b/ui/qt/preferences_dialog.h
@@ -30,7 +30,7 @@
#include "wireshark_application.h"
-#include <QDialog>
+#include "geometry_state_dialog.h"
#include <QTreeWidgetItem>
class QComboBox;
@@ -42,7 +42,7 @@ namespace Ui {
class PreferencesDialog;
}
-class PreferencesDialog : public QDialog
+class PreferencesDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index c9cf124ba0..b189a7a4bf 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -45,7 +45,7 @@
Q_DECLARE_METATYPE(GList *)
ProfileDialog::ProfileDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
pd_ui_(new Ui::ProfileDialog),
ok_button_(NULL)
{
@@ -54,6 +54,7 @@ ProfileDialog::ProfileDialog(QWidget *parent) :
const gchar *profile_name = get_profile_name();
pd_ui_->setupUi(this);
+ loadGeometry();
setWindowTitle(wsApp->windowTitleString(tr("Configuration Profiles")));
ok_button_ = pd_ui_->buttonBox->button(QDialogButtonBox::Ok);
diff --git a/ui/qt/profile_dialog.h b/ui/qt/profile_dialog.h
index b6f83341ae..7b3e96cd9d 100644
--- a/ui/qt/profile_dialog.h
+++ b/ui/qt/profile_dialog.h
@@ -22,7 +22,7 @@
#ifndef PROFILE_DIALOG_H
#define PROFILE_DIALOG_H
-#include <QDialog>
+#include "geometry_state_dialog.h"
class QPushButton;
class QTreeWidgetItem;
@@ -31,7 +31,7 @@ namespace Ui {
class ProfileDialog;
}
-class ProfileDialog : public QDialog
+class ProfileDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/protocol_hierarchy_dialog.cpp b/ui/qt/protocol_hierarchy_dialog.cpp
index 3cd14ea6da..bdda94b901 100644
--- a/ui/qt/protocol_hierarchy_dialog.cpp
+++ b/ui/qt/protocol_hierarchy_dialog.cpp
@@ -175,11 +175,9 @@ ProtocolHierarchyDialog::ProtocolHierarchyDialog(QWidget &parent, CaptureFile &c
ui(new Ui::ProtocolHierarchyDialog)
{
ui->setupUi(this);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 4 / 5);
setWindowSubtitle(tr("Protocol Hierarchy Statistics"));
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 4 / 5);
-
ui->hierStatsTreeWidget->setItemDelegateForColumn(pct_packets_col_, &percent_bar_delegate_);
ui->hierStatsTreeWidget->setItemDelegateForColumn(pct_bytes_col_, &percent_bar_delegate_);
ph_stats_t *ph_stats = ph_stats_new(cap_file_.capFile());
diff --git a/ui/qt/resolved_addresses_dialog.cpp b/ui/qt/resolved_addresses_dialog.cpp
index 2318ed4a1a..08719aa36e 100644
--- a/ui/qt/resolved_addresses_dialog.cpp
+++ b/ui/qt/resolved_addresses_dialog.cpp
@@ -172,11 +172,12 @@ const QString no_entries_ = QObject::tr("No entries.");
const QString entry_count_ = QObject::tr("%1 entries.");
ResolvedAddressesDialog::ResolvedAddressesDialog(QWidget *parent, CaptureFile *capture_file) :
- QDialog(NULL),
+ GeometryStateDialog(NULL),
ui(new Ui::ResolvedAddressesDialog),
file_name_(tr("[no file]"))
{
ui->setupUi(this);
+ if (parent) loadGeometry(parent->width() * 2 / 3, parent->height());
setAttribute(Qt::WA_DeleteOnClose, true);
QStringList title_parts = QStringList() << tr("Resolved Addresses");
@@ -187,9 +188,6 @@ ResolvedAddressesDialog::ResolvedAddressesDialog(QWidget *parent, CaptureFile *c
}
setWindowTitle(wsApp->windowTitleString(title_parts));
- // XXX Use recent settings instead
- resize(parent->width() * 2 / 3, parent->height());
-
ui->plainTextEdit->setFont(wsApp->monospaceFont());
ui->plainTextEdit->setReadOnly(true);
ui->plainTextEdit->setWordWrapMode(QTextOption::NoWrap);
diff --git a/ui/qt/resolved_addresses_dialog.h b/ui/qt/resolved_addresses_dialog.h
index d268b28017..80270af23d 100644
--- a/ui/qt/resolved_addresses_dialog.h
+++ b/ui/qt/resolved_addresses_dialog.h
@@ -22,7 +22,7 @@
#ifndef RESOLVED_ADDRESSES_DIALOG_H
#define RESOLVED_ADDRESSES_DIALOG_H
-#include <QDialog>
+#include "geometry_state_dialog.h"
class CaptureFile;
class QTextBlock;
@@ -31,7 +31,7 @@ namespace Ui {
class ResolvedAddressesDialog;
}
-class ResolvedAddressesDialog : public QDialog
+class ResolvedAddressesDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/response_time_delay_dialog.cpp b/ui/qt/response_time_delay_dialog.cpp
index cbbf8bf072..53a5d257d8 100644
--- a/ui/qt/response_time_delay_dialog.cpp
+++ b/ui/qt/response_time_delay_dialog.cpp
@@ -164,6 +164,7 @@ ResponseTimeDelayDialog::ResponseTimeDelayDialog(QWidget &parent, CaptureFile &c
QString subtitle = tr("%1 Response Time Delay Statistics")
.arg(proto_get_protocol_short_name(find_protocol_by_id(get_rtd_proto_id(rtd))));
setWindowSubtitle(subtitle);
+ loadGeometry(0, 0, "ResponseTimeDelayDialog");
QStringList header_names = QStringList()
<< tr("Type") << tr("Messages")
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp
index 6821ce6af7..e2bb354b34 100644
--- a/ui/qt/rtp_analysis_dialog.cpp
+++ b/ui/qt/rtp_analysis_dialog.cpp
@@ -258,10 +258,9 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf, struct _r
num_streams_(0)
{
ui->setupUi(this);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 4 / 5);
setWindowSubtitle(tr("RTP Stream Analysis"));
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 4 / 5);
ui->progressFrame->hide();
player_button_ = RtpPlayerDialog::addPlayerButton(ui->buttonBox);
diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp
index 11ccdb6cbd..3dc9184312 100644
--- a/ui/qt/rtp_player_dialog.cpp
+++ b/ui/qt/rtp_player_dialog.cpp
@@ -109,7 +109,7 @@ RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf) :
{
ui->setupUi(this);
setWindowTitle(wsApp->windowTitleString(tr("RTP Player")));
- resize(parent.size());
+ loadGeometry(parent.width(), parent.height());
#ifdef QT_MULTIMEDIA_LIB
ui->splitter->setStretchFactor(0, 3);
diff --git a/ui/qt/rtp_stream_dialog.cpp b/ui/qt/rtp_stream_dialog.cpp
index 80b8171e74..3d6dc43d75 100644
--- a/ui/qt/rtp_stream_dialog.cpp
+++ b/ui/qt/rtp_stream_dialog.cpp
@@ -221,12 +221,10 @@ RtpStreamDialog::RtpStreamDialog(QWidget &parent, CaptureFile &cf) :
need_redraw_(false)
{
ui->setupUi(this);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 2 / 3);
setWindowSubtitle(tr("RTP Streams"));
ui->streamTreeWidget->installEventFilter(this);
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 2 / 3);
-
ctx_menu_.addAction(ui->actionSelectNone);
ctx_menu_.addAction(ui->actionFindReverse);
ctx_menu_.addAction(ui->actionGoToSetup);
diff --git a/ui/qt/sequence_dialog.cpp b/ui/qt/sequence_dialog.cpp
index 4b323257f6..f2776fca19 100644
--- a/ui/qt/sequence_dialog.cpp
+++ b/ui/qt/sequence_dialog.cpp
@@ -58,6 +58,8 @@ SequenceDialog::SequenceDialog(QWidget &parent, CaptureFile &cf, SequenceInfo *i
node_label_w_(20)
{
ui->setupUi(this);
+ loadGeometry(parent.width(), parent.height() * 4 / 5);
+
QCustomPlot *sp = ui->sequencePlot;
setWindowSubtitle(info_ ? tr("Call Flow") : tr("Flow"));
@@ -120,9 +122,6 @@ SequenceDialog::SequenceDialog(QWidget &parent, CaptureFile &cf, SequenceInfo *i
QPushButton *save_bt = ui->buttonBox->button(QDialogButtonBox::Save);
save_bt->setText(tr("Save As" UTF8_HORIZONTAL_ELLIPSIS));
- // XXX Use recent settings instead
- resize(parent.width(), parent.height() * 4 / 5);
-
ProgressFrame::addToButtonBox(ui->buttonBox, &parent);
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(hScrollBarChanged(int)));
diff --git a/ui/qt/service_response_time_dialog.cpp b/ui/qt/service_response_time_dialog.cpp
index 1c939d9d0b..adffe8c30d 100644
--- a/ui/qt/service_response_time_dialog.cpp
+++ b/ui/qt/service_response_time_dialog.cpp
@@ -180,6 +180,7 @@ ServiceResponseTimeDialog::ServiceResponseTimeDialog(QWidget &parent, CaptureFil
QString subtitle = QString("%1 Service Response Time Statistics")
.arg(proto_get_protocol_short_name(find_protocol_by_id(get_srt_proto_id(srt))));
setWindowSubtitle(subtitle);
+ loadGeometry(0, 0, "ServiceResponseTimeDialog");
// Add number of columns for this stats_tree
QStringList header_labels;
diff --git a/ui/qt/show_packet_bytes_dialog.cpp b/ui/qt/show_packet_bytes_dialog.cpp
index aad4196200..57c463ee2b 100644
--- a/ui/qt/show_packet_bytes_dialog.cpp
+++ b/ui/qt/show_packet_bytes_dialog.cpp
@@ -51,6 +51,7 @@ ShowPacketBytesDialog::ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf) :
use_regex_find_(false)
{
ui->setupUi(this);
+ loadGeometry(parent.width() * 2 / 3, parent.height() * 3 / 4);
QString field_name = QString("%1 (%2)").arg(finfo_->hfinfo->name, finfo_->hfinfo->abbrev);
setWindowSubtitle (field_name);
@@ -64,9 +65,6 @@ ShowPacketBytesDialog::ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf) :
connect(ui->tePacketBytes, SIGNAL(showSelected(int,int)), this, SLOT(showSelected(int,int)));
connect(ui->leFind, SIGNAL(useRegexFind(bool)), this, SLOT(useRegexFind(bool)));
- // XXX Use recent settings instead
- resize(parent.width() * 2 / 3, parent.height());
-
ui->cbDecodeAs->blockSignals(true);
ui->cbDecodeAs->addItem(tr("None"), DecodeAsNone);
ui->cbDecodeAs->addItem(tr("Base64"), DecodeAsBASE64);
diff --git a/ui/qt/simple_statistics_dialog.cpp b/ui/qt/simple_statistics_dialog.cpp
index a950482045..7e460868a5 100644
--- a/ui/qt/simple_statistics_dialog.cpp
+++ b/ui/qt/simple_statistics_dialog.cpp
@@ -159,6 +159,7 @@ SimpleStatisticsDialog::SimpleStatisticsDialog(QWidget &parent, CaptureFile &cf,
stu_(stu)
{
setWindowSubtitle(stu_->title);
+ loadGeometry(0, 0, stu_->title);
QStringList header_labels;
for (int col = 0; col < (int) stu_->nfields; col++) {
diff --git a/ui/qt/stats_tree_dialog.cpp b/ui/qt/stats_tree_dialog.cpp
index 841efde44b..798a15373f 100644
--- a/ui/qt/stats_tree_dialog.cpp
+++ b/ui/qt/stats_tree_dialog.cpp
@@ -67,6 +67,7 @@ StatsTreeDialog::StatsTreeDialog(QWidget &parent, CaptureFile &cf, const char *c
st_(NULL),
st_cfg_(NULL)
{
+ loadGeometry(800, height(), cfg_abbr);
st_cfg_ = stats_tree_get_cfg_by_abbr(cfg_abbr);
memset(&cfg_pr_, 0, sizeof(struct _tree_cfg_pres));
@@ -135,7 +136,6 @@ void StatsTreeDialog::fillTree()
}
statsTreeWidget()->setColumnCount(header_labels.count());
statsTreeWidget()->setHeaderLabels(header_labels);
- resize(st_->num_columns*80+80, height());
statsTreeWidget()->setSortingEnabled(false);
if (!registerTapListener(st_cfg_->tapname,
diff --git a/ui/qt/supported_protocols_dialog.cpp b/ui/qt/supported_protocols_dialog.cpp
index 08ff8b116e..1bd1dc8d60 100644
--- a/ui/qt/supported_protocols_dialog.cpp
+++ b/ui/qt/supported_protocols_dialog.cpp
@@ -47,16 +47,14 @@
enum { name_col_, filter_col_, type_col_, descr_col_ };
SupportedProtocolsDialog::SupportedProtocolsDialog(QWidget *parent) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::SupportedProtocolsDialog),
field_count_(0)
{
ui->setupUi(this);
+ if (parent) loadGeometry(parent->width() * 3 / 4, parent->height());
setWindowTitle(wsApp->windowTitleString(tr("Supported Protocols")));
- // XXX Use recent settings instead
- if (parent) resize(parent->width() * 3 / 4, parent->height());
-
// Some of our names are unreasonably long.
int one_em = fontMetrics().height();
ui->protoTreeWidget->setColumnWidth(name_col_, one_em * 15);
diff --git a/ui/qt/supported_protocols_dialog.h b/ui/qt/supported_protocols_dialog.h
index 1dd8ea2046..a305cf72a0 100644
--- a/ui/qt/supported_protocols_dialog.h
+++ b/ui/qt/supported_protocols_dialog.h
@@ -22,13 +22,13 @@
#ifndef SUPPORTED_PROTOCOLS_DIALOG_H
#define SUPPORTED_PROTOCOLS_DIALOG_H
-#include <QDialog>
+#include "geometry_state_dialog.h"
namespace Ui {
class SupportedProtocolsDialog;
}
-class SupportedProtocolsDialog : public QDialog
+class SupportedProtocolsDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/tap_parameter_dialog.cpp b/ui/qt/tap_parameter_dialog.cpp
index 5eab869e24..5f4b63850c 100644
--- a/ui/qt/tap_parameter_dialog.cpp
+++ b/ui/qt/tap_parameter_dialog.cpp
@@ -80,9 +80,6 @@ TapParameterDialog::TapParameterDialog(QWidget &parent, CaptureFile &cf, int hel
{
ui->setupUi(this);
- // XXX Use recent settings instead
- resize(parent.width() * 2 / 3, parent.height() * 3 / 4);
-
// Only show a hint label if a subclass provides a hint.
ui->hintLabel->hide();
diff --git a/ui/qt/traffic_table_dialog.cpp b/ui/qt/traffic_table_dialog.cpp
index 4790e1ff94..6ab248b32e 100644
--- a/ui/qt/traffic_table_dialog.cpp
+++ b/ui/qt/traffic_table_dialog.cpp
@@ -62,13 +62,11 @@ TrafficTableDialog::TrafficTableDialog(QWidget &parent, CaptureFile &cf, const c
filter_(filter)
{
ui->setupUi(this);
+ loadGeometry(parent.width(), parent.height() * 3 / 4);
ui->enabledTypesPushButton->setText(tr("%1 Types").arg(table_name));
setWindowSubtitle(QString("%1s").arg(table_name));
- // XXX Use recent settings instead
- resize(parent.width(), parent.height() * 3 / 4);
-
QMenu *copy_menu = new QMenu();
QAction *ca;
copy_bt_ = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
diff --git a/ui/qt/uat_dialog.cpp b/ui/qt/uat_dialog.cpp
index 6bb89f763f..c3f39a8c1d 100644
--- a/ui/qt/uat_dialog.cpp
+++ b/ui/qt/uat_dialog.cpp
@@ -45,13 +45,14 @@
#include <QDebug>
UatDialog::UatDialog(QWidget *parent, epan_uat *uat) :
- QDialog(parent),
+ GeometryStateDialog(parent),
ui(new Ui::UatDialog),
uat_(NULL),
cur_line_edit_(NULL),
cur_combo_box_(NULL)
{
ui->setupUi(this);
+ if (uat) loadGeometry(0, 0, uat->name);
ui->deleteToolButton->setEnabled(false);
ui->copyToolButton->setEnabled(false);
diff --git a/ui/qt/uat_dialog.h b/ui/qt/uat_dialog.h
index 5ea441a823..2ab108bf2a 100644
--- a/ui/qt/uat_dialog.h
+++ b/ui/qt/uat_dialog.h
@@ -27,8 +27,7 @@
#include <glib.h>
#include "syntax_line_edit.h"
-
-#include <QDialog>
+#include "geometry_state_dialog.h"
class QComboBox;
class QPushButton;
@@ -40,7 +39,7 @@ namespace Ui {
class UatDialog;
}
-class UatDialog : public QDialog
+class UatDialog : public GeometryStateDialog
{
Q_OBJECT
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp
index 8a57bf99c2..8c5e8c87d2 100644
--- a/ui/qt/voip_calls_dialog.cpp
+++ b/ui/qt/voip_calls_dialog.cpp
@@ -178,6 +178,8 @@ VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flow
parent_(parent)
{
ui->setupUi(this);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 2 / 3);
+
ui->callTreeWidget->sortByColumn(start_time_col_, Qt::AscendingOrder);
setWindowSubtitle(all_flows ? tr("SIP Flows") : tr("VoIP Calls"));
@@ -187,9 +189,6 @@ VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flow
sequence_button_ = ui->buttonBox->addButton(tr("Flow Sequence"), QDialogButtonBox::ApplyRole);
player_button_ = RtpPlayerDialog::addPlayerButton(ui->buttonBox);
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 2 / 3);
-
memset (&tapinfo_, 0, sizeof(tapinfo_));
tapinfo_.tap_packet = tapPacket;
tapinfo_.tap_draw = tapDraw;
diff --git a/ui/qt/wireshark_dialog.cpp b/ui/qt/wireshark_dialog.cpp
index a8a436bd06..ba5cd12bb1 100644
--- a/ui/qt/wireshark_dialog.cpp
+++ b/ui/qt/wireshark_dialog.cpp
@@ -28,19 +28,21 @@
#include <epan/packet.h>
#include <epan/tap.h>
+#include "wireshark_application.h"
#include "wireshark_dialog.h"
+#include "qt_ui_utils.h"
+#include "ui/recent.h"
+#include "ui/ui_util.h"
#include <QMessageBox>
-#include "wireshark_application.h"
// To do:
// - Use a dynamic property + Q_PROPERTY for the subtitle.
-// - Save and load recent geometry.
// - Make our nested event loop more robust. See tryDeleteLater for details.
WiresharkDialog::WiresharkDialog(QWidget &, CaptureFile &capture_file) :
- QDialog(NULL, Qt::Window),
+ GeometryStateDialog(NULL, Qt::Window),
cap_file_(capture_file),
file_closed_(false),
retap_depth_(0),
diff --git a/ui/qt/wireshark_dialog.h b/ui/qt/wireshark_dialog.h
index 8296d72053..4bb816fdc2 100644
--- a/ui/qt/wireshark_dialog.h
+++ b/ui/qt/wireshark_dialog.h
@@ -1,4 +1,4 @@
-/* wireshark_dialog.cpp
+/* wireshark_dialog.h
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
@@ -39,10 +39,9 @@
// TapDialog might make sense as well.
#include "capture_file.h"
+#include "geometry_state_dialog.h"
-#include <QDialog>
-
-class WiresharkDialog : public QDialog
+class WiresharkDialog : public GeometryStateDialog
{
Q_OBJECT
@@ -134,6 +133,7 @@ protected slots:
private:
void setWindowTitleFromSubtitle();
+
void tryDeleteLater();
QString subtitle_;
diff --git a/ui/qt/wlan_statistics_dialog.cpp b/ui/qt/wlan_statistics_dialog.cpp
index 6ebf4b82ec..02cb0f6c37 100644
--- a/ui/qt/wlan_statistics_dialog.cpp
+++ b/ui/qt/wlan_statistics_dialog.cpp
@@ -467,9 +467,7 @@ WlanStatisticsDialog::WlanStatisticsDialog(QWidget &parent, CaptureFile &cf, con
packet_count_(0)
{
setWindowSubtitle(tr("Wireless LAN Statistics"));
-
- // XXX Use recent settings instead
- resize(parent.width() * 4 / 5, parent.height() * 3 / 4);
+ loadGeometry(parent.width() * 4 / 5, parent.height() * 3 / 4, "WlanStatisticsDialog");
QStringList header_labels = QStringList()
<< "" << tr("Channel") << tr("SSID") << tr("Percent Packets") << "" << ""