Respect the other layout preference in qtshark: which pane goes in which spot.

svn path=/trunk/; revision=51723
This commit is contained in:
Evan Huus 2013-09-03 16:06:20 +00:00
parent 7cd3ff3a8e
commit 259ebc5269
3 changed files with 31 additions and 3 deletions

View File

@ -168,6 +168,7 @@ MainWindow::MainWindow(QWidget *parent) :
main_ui_->menuHelp->insertAction(update_sep, update_action);
connect(update_action, SIGNAL(triggered()), this, SLOT(on_actionHelpCheckForUpdates_triggered()));
#endif
empty_pane_ = new QWidget(main_ui_->mainStack);
packet_list_ = new PacketList(main_ui_->mainStack);
@ -397,6 +398,21 @@ void MainWindow::closeEvent(QCloseEvent *event) {
}
QWidget* MainWindow::getLayoutWidget(layout_pane_content_e type) {
switch (type) {
case layout_pane_content_none:
return empty_pane_;
case layout_pane_content_plist:
return packet_list_;
case layout_pane_content_pdetails:
return proto_tree_;
case layout_pane_content_pbytes:
return byte_view_tab_;
default:
g_assert_not_reached();
return NULL;
}
}
void MainWindow::mergeCaptureFile()
{

View File

@ -34,6 +34,8 @@
#include "ui/ui_util.h"
#include <epan/prefs.h>
#ifdef HAVE_LIBPCAP
#include "capture_opts.h"
#include "capture_session.h"
@ -105,6 +107,7 @@ private:
FileSetDialog file_set_dialog_;
SummaryDialog summary_dialog_;
ByteViewTab *byte_view_tab_;
QWidget *empty_pane_;
bool capture_stopping_;
bool capture_filter_valid_;
@ -120,6 +123,7 @@ private:
QSocketNotifier *pipe_notifier_;
#endif
QWidget* getLayoutWidget(layout_pane_content_e type);
void mergeCaptureFile();
void importCaptureFile();
void saveCaptureFile(capture_file *cf, bool stay_closed);

View File

@ -262,18 +262,26 @@ void MainWindow::layoutPanes()
g_assert_not_reached();
}
// We reparent all widgets immediately, because if one of them is left
// unused then it would be deleted when we delete oldMaster, which would
// lead to a crash next time we tried to use it.
packet_list_->setParent(main_ui_->mainStack);
proto_tree_->setParent(main_ui_->mainStack);
byte_view_tab_->setParent(main_ui_->mainStack);
empty_pane_->setParent(main_ui_->mainStack);
if (parents[0] == extra_split_) {
master_split_->addWidget(extra_split_);
}
parents[0]->addWidget(packet_list_);
parents[0]->addWidget(getLayoutWidget(prefs.gui_layout_content_1));
if (parents[2] == extra_split_) {
master_split_->addWidget(extra_split_);
}
parents[1]->addWidget(proto_tree_);
parents[2]->addWidget(byte_view_tab_);
parents[1]->addWidget(getLayoutWidget(prefs.gui_layout_content_2));
parents[2]->addWidget(getLayoutWidget(prefs.gui_layout_content_3));
// We must do this near the end to avoid reparenting signals going to
// already-deleted widgets.