Fix the white-rectangle-at-startup artifact with the help of GammaRay[1].
Make extra_split_ a member variable again. Make it and master_split_ full-on values. Set various parent/child relationships at startup so that each widget is associated with a layout (which appears to be the actual fix). Make the throttled startup delay huge so that it's easier to browse using GammaRay. [1] https://github.com/KDAB/GammaRay svn path=/trunk/; revision=52386
This commit is contained in:
parent
07a5c7442f
commit
c37cd6b66f
|
@ -80,7 +80,6 @@ void pipe_input_set_handler(gint source, gpointer user_data, int *child_process,
|
|||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
main_ui_(new Ui::MainWindow),
|
||||
master_split_(NULL),
|
||||
df_combo_box_(new DisplayFilterCombo()),
|
||||
cap_file_(NULL),
|
||||
previous_focus_(NULL),
|
||||
|
@ -172,15 +171,20 @@ 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);
|
||||
master_split_.setObjectName(tr("splitterMaster"));
|
||||
extra_split_.setObjectName(tr("splitterExtra"));
|
||||
empty_pane_.setObjectName(tr("emptyPane"));
|
||||
|
||||
packet_list_ = new PacketList(main_ui_->mainStack);
|
||||
empty_pane_.setParent(&master_split_);
|
||||
|
||||
proto_tree_ = new ProtoTree(main_ui_->mainStack);
|
||||
packet_list_ = new PacketList(&master_split_);
|
||||
packet_list_->setParent(&master_split_);
|
||||
|
||||
proto_tree_ = new ProtoTree(&master_split_);
|
||||
proto_tree_->setHeaderHidden(true);
|
||||
proto_tree_->installEventFilter(this);
|
||||
|
||||
byte_view_tab_ = new ByteViewTab(main_ui_->mainStack);
|
||||
byte_view_tab_ = new ByteViewTab(&master_split_);
|
||||
byte_view_tab_->setTabPosition(QTabWidget::South);
|
||||
byte_view_tab_->setDocumentMode(true);
|
||||
|
||||
|
@ -188,8 +192,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
packet_list_->setByteViewTab(byte_view_tab_);
|
||||
packet_list_->installEventFilter(this);
|
||||
|
||||
main_ui_->mainStack->addWidget(&master_split_);
|
||||
|
||||
main_welcome_ = main_ui_->welcomePage;
|
||||
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
connect(wsApp, SIGNAL(captureCapturePrepared(capture_session *)),
|
||||
this, SLOT(captureCapturePrepared(capture_session *)));
|
||||
|
@ -409,7 +416,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
QWidget* MainWindow::getLayoutWidget(layout_pane_content_e type) {
|
||||
switch (type) {
|
||||
case layout_pane_content_none:
|
||||
return empty_pane_;
|
||||
return &empty_pane_;
|
||||
case layout_pane_content_plist:
|
||||
return packet_list_;
|
||||
case layout_pane_content_pdetails:
|
||||
|
|
|
@ -99,17 +99,20 @@ private:
|
|||
|
||||
Ui::MainWindow *main_ui_;
|
||||
QMenu *open_recent_menu_;
|
||||
QSplitter *master_split_;
|
||||
QSplitter master_split_;
|
||||
QSplitter extra_split_;
|
||||
MainWelcome *main_welcome_;
|
||||
DisplayFilterCombo *df_combo_box_;
|
||||
capture_file *cap_file_;
|
||||
// XXX - packet_list_, proto_tree_, and byte_view_tab_ should
|
||||
// probably be full-on values instead of pointers.
|
||||
PacketList *packet_list_;
|
||||
ProtoTree *proto_tree_;
|
||||
QWidget *previous_focus_;
|
||||
FileSetDialog file_set_dialog_;
|
||||
SummaryDialog summary_dialog_;
|
||||
ByteViewTab *byte_view_tab_;
|
||||
QWidget *empty_pane_;
|
||||
QWidget empty_pane_;
|
||||
FollowStreamDialog follow_stream_dialog_;
|
||||
|
||||
bool capture_stopping_;
|
||||
|
|
|
@ -216,97 +216,78 @@ void MainWindow::filterPackets(QString& new_filter, bool force)
|
|||
void MainWindow::layoutPanes()
|
||||
{
|
||||
QSplitter *parents[3];
|
||||
QWidget *oldMaster = master_split_;
|
||||
QWidget *current = main_ui_->mainStack->currentWidget();
|
||||
|
||||
master_split_ = new QSplitter(main_ui_->mainStack);
|
||||
master_split_->setObjectName(QString::fromUtf8("splitterMaster"));
|
||||
|
||||
QSplitter *extra_split = new QSplitter(master_split_);
|
||||
extra_split->setObjectName(QString::fromUtf8("splitterExtra"));
|
||||
// Reparent all widgets and add them back in the proper order below.
|
||||
// This hides each widget as well.
|
||||
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);
|
||||
extra_split_.setParent(main_ui_->mainStack);
|
||||
|
||||
switch(prefs.gui_layout_type) {
|
||||
case(layout_type_5):
|
||||
master_split_->setOrientation(Qt::Vertical);
|
||||
parents[0] = master_split_;
|
||||
parents[1] = master_split_;
|
||||
parents[2] = master_split_;
|
||||
master_split_.setOrientation(Qt::Vertical);
|
||||
parents[0] = &master_split_;
|
||||
parents[1] = &master_split_;
|
||||
parents[2] = &master_split_;
|
||||
break;
|
||||
case(layout_type_2):
|
||||
master_split_->setOrientation(Qt::Vertical);
|
||||
extra_split->setOrientation(Qt::Horizontal);
|
||||
parents[0] = master_split_;
|
||||
parents[1] = extra_split;
|
||||
parents[2] = extra_split;
|
||||
master_split_.setOrientation(Qt::Vertical);
|
||||
extra_split_.setOrientation(Qt::Horizontal);
|
||||
parents[0] = &master_split_;
|
||||
parents[1] = &extra_split_;
|
||||
parents[2] = &extra_split_;
|
||||
break;
|
||||
case(layout_type_1):
|
||||
master_split_->setOrientation(Qt::Vertical);
|
||||
extra_split->setOrientation(Qt::Horizontal);
|
||||
parents[0] = extra_split;
|
||||
parents[1] = extra_split;
|
||||
parents[2] = master_split_;
|
||||
master_split_.setOrientation(Qt::Vertical);
|
||||
extra_split_.setOrientation(Qt::Horizontal);
|
||||
parents[0] = &extra_split_;
|
||||
parents[1] = &extra_split_;
|
||||
parents[2] = &master_split_;
|
||||
break;
|
||||
case(layout_type_4):
|
||||
master_split_->setOrientation(Qt::Horizontal);
|
||||
extra_split->setOrientation(Qt::Vertical);
|
||||
parents[0] = master_split_;
|
||||
parents[1] = extra_split;
|
||||
parents[2] = extra_split;
|
||||
master_split_.setOrientation(Qt::Horizontal);
|
||||
extra_split_.setOrientation(Qt::Vertical);
|
||||
parents[0] = &master_split_;
|
||||
parents[1] = &extra_split_;
|
||||
parents[2] = &extra_split_;
|
||||
break;
|
||||
case(layout_type_3):
|
||||
master_split_->setOrientation(Qt::Horizontal);
|
||||
extra_split->setOrientation(Qt::Vertical);
|
||||
parents[0] = extra_split;
|
||||
parents[1] = extra_split;
|
||||
parents[2] = master_split_;
|
||||
master_split_.setOrientation(Qt::Horizontal);
|
||||
extra_split_.setOrientation(Qt::Vertical);
|
||||
parents[0] = &extra_split_;
|
||||
parents[1] = &extra_split_;
|
||||
parents[2] = &master_split_;
|
||||
break;
|
||||
case(layout_type_6):
|
||||
master_split_->setOrientation(Qt::Horizontal);
|
||||
parents[0] = master_split_;
|
||||
parents[1] = master_split_;
|
||||
parents[2] = master_split_;
|
||||
master_split_.setOrientation(Qt::Horizontal);
|
||||
parents[0] = &master_split_;
|
||||
parents[1] = &master_split_;
|
||||
parents[2] = &master_split_;
|
||||
break;
|
||||
default:
|
||||
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);
|
||||
if (parents[0] == &extra_split_) {
|
||||
master_split_.addWidget(&extra_split_);
|
||||
}
|
||||
|
||||
parents[0]->addWidget(getLayoutWidget(prefs.gui_layout_content_1));
|
||||
|
||||
if (parents[2] == extra_split) {
|
||||
master_split_->addWidget(extra_split);
|
||||
if (parents[2] == &extra_split_) {
|
||||
master_split_.addWidget(&extra_split_);
|
||||
}
|
||||
|
||||
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.
|
||||
if (oldMaster != NULL) {
|
||||
main_ui_->mainStack->removeWidget(oldMaster);
|
||||
delete oldMaster;
|
||||
for (int i = 0; i < master_split_.count(); i++) {
|
||||
master_split_.widget(i)->show();
|
||||
}
|
||||
|
||||
if (extra_split->count() < 1) {
|
||||
delete extra_split;
|
||||
extra_split = NULL;
|
||||
}
|
||||
|
||||
main_ui_->mainStack->addWidget(master_split_);
|
||||
|
||||
if (current == oldMaster) {
|
||||
main_ui_->mainStack->setCurrentWidget(master_split_);
|
||||
for (int i = 0; i < extra_split_.count(); i++) {
|
||||
extra_split_.widget(i)->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,7 +310,7 @@ void MainWindow::captureCapturePrepared(capture_session *cap_session) {
|
|||
|
||||
// /* Don't set up main window for a capture file. */
|
||||
// main_set_for_capture_file(FALSE);
|
||||
main_ui_->mainStack->setCurrentWidget(master_split_);
|
||||
main_ui_->mainStack->setCurrentWidget(&master_split_);
|
||||
cap_file_ = (capture_file *) cap_session->cf;
|
||||
}
|
||||
void MainWindow::captureCaptureUpdateStarted(capture_session *cap_session) {
|
||||
|
@ -411,7 +392,7 @@ void MainWindow::captureFileReadStarted(const capture_file *cf) {
|
|||
main_ui_->statusBar->popFileStatus();
|
||||
QString msg = QString(tr("Loading: %1")).arg(get_basename(cf->filename));
|
||||
main_ui_->statusBar->pushFileStatus(msg);
|
||||
main_ui_->mainStack->setCurrentWidget(master_split_);
|
||||
main_ui_->mainStack->setCurrentWidget(&master_split_);
|
||||
WiresharkApplication::processEvents();
|
||||
}
|
||||
|
||||
|
@ -1958,7 +1939,7 @@ void MainWindow::on_actionStartCapture_triggered()
|
|||
// return; /* error in options dialog */
|
||||
// }
|
||||
|
||||
main_ui_->mainStack->setCurrentWidget(master_split_);
|
||||
main_ui_->mainStack->setCurrentWidget(&master_split_);
|
||||
|
||||
if (global_capture_opts.num_selected == 0) {
|
||||
QString err_msg = tr("No Interface Selected");
|
||||
|
|
|
@ -88,9 +88,11 @@ SplashOverlay::SplashOverlay(QWidget *parent) :
|
|||
"}"
|
||||
));
|
||||
|
||||
#ifndef THROTTLE_STARTUP
|
||||
// Check for a remote connection
|
||||
if (strlen (get_conn_cfilter()) > 0)
|
||||
info_update_freq_ = 1000;
|
||||
#endif
|
||||
|
||||
connect(wsApp, SIGNAL(splashUpdate(register_action_e,const char*)),
|
||||
this, SLOT(splashUpdate(register_action_e,const char*)));
|
||||
|
@ -119,7 +121,7 @@ void SplashOverlay::splashUpdate(register_action_e action, const char *message)
|
|||
QString action_msg = UTF8_HORIZONTAL_ELLIPSIS;
|
||||
|
||||
#ifdef THROTTLE_STARTUP
|
||||
ThrottleThread::msleep(2);
|
||||
ThrottleThread::msleep(100);
|
||||
#endif
|
||||
|
||||
register_cur_++;
|
||||
|
|
Loading…
Reference in New Issue