diff options
-rw-r--r-- | docbook/release-notes.asciidoc | 6 | ||||
-rw-r--r-- | ui/qt/conversation_dialog.cpp | 3 | ||||
-rw-r--r-- | ui/qt/endpoint_dialog.cpp | 3 | ||||
-rw-r--r-- | ui/qt/follow_stream_dialog.cpp | 3 | ||||
-rw-r--r-- | ui/qt/io_graph_dialog.cpp | 3 | ||||
-rw-r--r-- | ui/qt/main_status_bar.cpp | 4 | ||||
-rw-r--r-- | ui/qt/main_window.h | 1 | ||||
-rw-r--r-- | ui/qt/progress_frame.cpp | 71 | ||||
-rw-r--r-- | ui/qt/progress_frame.h | 26 | ||||
-rw-r--r-- | ui/qt/tap_parameter_dialog.cpp | 3 | ||||
-rw-r--r-- | ui/qt/tap_parameter_dialog.h | 6 | ||||
-rw-r--r-- | ui/qt/tcp_stream_dialog.cpp | 5 | ||||
-rw-r--r-- | ui/qt/traffic_table_dialog.cpp | 6 | ||||
-rw-r--r-- | ui/qt/traffic_table_dialog.h | 1 |
14 files changed, 121 insertions, 20 deletions
diff --git a/docbook/release-notes.asciidoc b/docbook/release-notes.asciidoc index 5406746b77..12bbd67a4e 100644 --- a/docbook/release-notes.asciidoc +++ b/docbook/release-notes.asciidoc @@ -22,6 +22,12 @@ used for troubleshooting, analysis, development and education. === New and Updated Features The following features are new (or have been significantly updated) +since version 1.99.8: + +* Qt port: +** Most dialogs now have a cancellable progress bar. + +The following features are new (or have been significantly updated) since version 1.99.7: * Qt port: diff --git a/ui/qt/conversation_dialog.cpp b/ui/qt/conversation_dialog.cpp index f26759edf5..89576c144a 100644 --- a/ui/qt/conversation_dialog.cpp +++ b/ui/qt/conversation_dialog.cpp @@ -30,7 +30,6 @@ #include "wsutil/str_util.h" #include "qt_ui_utils.h" - #include "wireshark_application.h" #include <QCheckBox> @@ -70,6 +69,8 @@ ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf, int cli graph_bt_->setToolTip(tr("Graph a TCP conversation.")); connect(graph_bt_, SIGNAL(clicked()), this, SLOT(graphTcp())); + addProgressFrame(&parent); + QList<int> conv_protos; for (GList *conv_tab = recent.conversation_tabs; conv_tab; conv_tab = conv_tab->next) { int proto_id = proto_get_id_by_short_name((const char *)conv_tab->data); diff --git a/ui/qt/endpoint_dialog.cpp b/ui/qt/endpoint_dialog.cpp index d00341b827..ec477579a3 100644 --- a/ui/qt/endpoint_dialog.cpp +++ b/ui/qt/endpoint_dialog.cpp @@ -33,7 +33,6 @@ #include "wsutil/str_util.h" #include "qt_ui_utils.h" - #include "wireshark_application.h" #include <QCheckBox> @@ -55,6 +54,8 @@ EndpointDialog::EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_i connect(trafficTableTabWidget(), SIGNAL(currentChanged(int)), this, SLOT(tabChanged())); #endif + addProgressFrame(&parent); + QList<int> endp_protos; for (GList *endp_tab = recent.endpoint_tabs; endp_tab; endp_tab = endp_tab->next) { int proto_id = proto_get_id_by_short_name((const char *)endp_tab->data); diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp index 4059526288..39655f2203 100644 --- a/ui/qt/follow_stream_dialog.cpp +++ b/ui/qt/follow_stream_dialog.cpp @@ -49,6 +49,7 @@ #include "ui/follow.h" +#include "progress_frame.h" #include "qt_ui_utils.h" #include <QKeyEvent> @@ -104,6 +105,8 @@ FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_ b_save_ = ui->buttonBox->addButton(tr("Save as" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ActionRole); connect(b_save_, SIGNAL(clicked()), this, SLOT(saveAs())); + ProgressFrame::addToButtonBox(ui->buttonBox, &parent); + connect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(helpButton())); connect(ui->teStreamContent, SIGNAL(mouseMovedToTextCursorPosition(int)), this, SLOT(fillHintLabel(int))); diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp index ad1251b28d..7a457faec1 100644 --- a/ui/qt/io_graph_dialog.cpp +++ b/ui/qt/io_graph_dialog.cpp @@ -34,6 +34,7 @@ #include "color_utils.h" #include "qcustomplot.h" +#include "progress_frame.h" #include "stock_icon.h" #include "syntax_line_edit.h" #include "wireshark_application.h" @@ -291,6 +292,8 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf) : gtw->setColumnWidth(yfield_col_, one_em * 6); gtw->setColumnWidth(sma_period_col_, one_em * 6); + ProgressFrame::addToButtonBox(ui->buttonBox, &parent); + connect(wsApp, SIGNAL(focusChanged(QWidget*,QWidget*)), this, SLOT(focusChanged(QWidget*,QWidget*))); connect(iop, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(graphClicked(QMouseEvent*))); connect(iop, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoved(QMouseEvent*))); diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp index 1e944b6d7b..1a43712805 100644 --- a/ui/qt/main_status_bar.cpp +++ b/ui/qt/main_status_bar.cpp @@ -175,6 +175,10 @@ MainStatusBar::MainStatusBar(QWidget *parent) : profile_menu_.setTitle(tr("Switch to")); ctx_menu_.addMenu(&profile_menu_); +#ifdef QWINTASKBARPROGRESS_H + progress_frame_.enableTaskbarUpdates(true); +#endif + connect(wsApp, SIGNAL(appInitialized()), splitter, SLOT(show())); connect(wsApp, SIGNAL(appInitialized()), this, SLOT(pushProfileName())); connect(&info_status_, SIGNAL(toggleTemporaryFlash(bool)), diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 4c94910951..980dc9434d 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -196,7 +196,6 @@ private: void removeMenuActions(QList<QAction *> &actions, int menu_group); signals: - void showProgress(struct progdlg **dlg_p, bool animate, const QString message, bool terminate_is_stop, bool *stop_flag, float pct); void setCaptureFile(capture_file *cf); void setDissectedCaptureFile(capture_file *cf); void displayFilterSuccess(bool success); diff --git a/ui/qt/progress_frame.cpp b/ui/qt/progress_frame.cpp index adf879df3a..fd24ff3313 100644 --- a/ui/qt/progress_frame.cpp +++ b/ui/qt/progress_frame.cpp @@ -26,7 +26,9 @@ #include "ui/progress_dlg.h" +#include <QDialogButtonBox> #include <QGraphicsOpacityEffect> +#include <QBoxLayout> #include <QPropertyAnimation> #include "stock_icon.h" @@ -105,6 +107,7 @@ ProgressFrame::ProgressFrame(QWidget *parent) : , show_timer_(-1) #endif #ifdef QWINTASKBARPROGRESS_H + , update_taskbar_(false) , taskbar_progress_(NULL) #endif { @@ -116,7 +119,7 @@ ProgressFrame::ProgressFrame(QWidget *parent) : ui->progressBar->setStyleSheet(QString( "QProgressBar {" " max-width: 20em;" - " min-height: 0.8em;" + " min-height: 0.5em;" " max-height: 1em;" " border-bottom: 0px;" " border-top: 0px;" @@ -143,6 +146,8 @@ ProgressFrame::ProgressFrame(QWidget *parent) : "QPushButton:pressed {" " image: url(:/dfilter/dfilter_erase_selected.png) center;" "}")); + connect(this, SIGNAL(showRequested(bool,bool,gboolean*)), + this, SLOT(show(bool,bool,gboolean*))); hide(); } @@ -153,20 +158,63 @@ ProgressFrame::~ProgressFrame() struct progdlg *ProgressFrame::showProgress(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value) { - ui->progressBar->setMaximum(100); + setMaximumValue(100); ui->progressBar->setValue(value); - return show(animate, terminate_is_stop, stop_flag); + emit showRequested(animate, terminate_is_stop, stop_flag); + return &progress_dialog_; } progdlg *ProgressFrame::showBusy(bool animate, bool terminate_is_stop, gboolean *stop_flag) { - ui->progressBar->setMaximum(0); - return show(animate, terminate_is_stop, stop_flag); + setMaximumValue(0); + emit showRequested(animate, terminate_is_stop, stop_flag); + return &progress_dialog_; +} + +void ProgressFrame::addToButtonBox(QDialogButtonBox *button_box, QObject *main_window) +{ + // We have a ProgressFrame in the main status bar which is controlled + // from the capture file and other parts of the application via + // create_progress_dlg and delayed_create_progress_dlg. + // Create a new ProgressFrame and pair it with the main instance. + ProgressFrame *main_progress_frame = main_window->findChild<ProgressFrame *>(); + if (!button_box || !main_progress_frame) return; + + QBoxLayout *layout = qobject_cast<QBoxLayout *>(button_box->layout()); + if (!layout) return; + + ProgressFrame *progress_frame = new ProgressFrame(button_box); + + // Insert ourselves after the first spacer we find, otherwise the + // far right of the button box. + int idx = layout->count(); + for (int i = 0; i < layout->count(); i++) { + if (layout->itemAt(i)->spacerItem()) { + idx = i + 1; + break; + } + } + layout->insertWidget(idx, progress_frame); + + int one_em = progress_frame->fontMetrics().height(); + progress_frame->setMaximumWidth(one_em * 8); + connect(main_progress_frame, SIGNAL(showRequested(bool,bool,gboolean*)), + progress_frame, SLOT(show(bool,bool,gboolean*))); + connect(main_progress_frame, SIGNAL(maximumValueChanged(int)), + progress_frame, SLOT(setMaximumValue(int))); + connect(main_progress_frame, SIGNAL(valueChanged(int)), + progress_frame, SLOT(setValue(int))); + connect(main_progress_frame, SIGNAL(setHidden()), + progress_frame, SLOT(hide())); + + connect(progress_frame, SIGNAL(stopLoading()), + main_progress_frame, SIGNAL(stopLoading())); } void ProgressFrame::setValue(int value) { ui->progressBar->setValue(value); + emit valueChanged(value); } #if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0) @@ -197,6 +245,7 @@ void ProgressFrame::hide() #if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0) show_timer_ = -1; #endif + emit setHidden(); QFrame::hide(); #ifdef QWINTASKBARPROGRESS_H if (taskbar_progress_) { @@ -212,7 +261,7 @@ void ProgressFrame::on_pushButton_clicked() } const int show_delay_ = 500; // ms -progdlg *ProgressFrame::show(bool animate, bool terminate_is_stop, gboolean *stop_flag) +void ProgressFrame::show(bool animate, bool terminate_is_stop, gboolean *stop_flag) { terminate_is_stop_ = terminate_is_stop; stop_flag_ = stop_flag; @@ -237,7 +286,7 @@ progdlg *ProgressFrame::show(bool animate, bool terminate_is_stop, gboolean *sto #ifdef QWINTASKBARPROGRESS_H // windowHandle() is picky about returning a non-NULL value so we check it // each time. - if (!taskbar_progress_ && window()->windowHandle()) { + if (update_taskbar_ && !taskbar_progress_ && window()->windowHandle()) { QWinTaskbarButton *taskbar_button = new QWinTaskbarButton(this); if (taskbar_button) { taskbar_button->setWindow(window()->windowHandle()); @@ -247,11 +296,15 @@ progdlg *ProgressFrame::show(bool animate, bool terminate_is_stop, gboolean *sto } if (taskbar_progress_) { taskbar_progress_->show(); + taskbar_progress_->resume(); } - taskbar_progress_->resume(); #endif +} - return &progress_dialog_; +void ProgressFrame::setMaximumValue(int value) +{ + ui->progressBar->setMaximum(value); + emit maximumValueChanged(value); } /* diff --git a/ui/qt/progress_frame.h b/ui/qt/progress_frame.h index 3eec2d7c01..f8315e5b0f 100644 --- a/ui/qt/progress_frame.h +++ b/ui/qt/progress_frame.h @@ -36,6 +36,7 @@ class ProgressFrame; #endif class ProgressFrame; +class QDialogButtonBox; // Define the structure describing a progress dialog. struct progdlg { @@ -51,14 +52,22 @@ public: explicit ProgressFrame(QWidget *parent = 0); ~ProgressFrame(); - struct progdlg *showProgress(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value = 0); - struct progdlg *showBusy(bool animate, bool terminate_is_stop, gboolean *stop_flag); - void hide(); +#ifdef QWINTASKBARPROGRESS_H + void enableTaskbarUpdates(bool enable = true) { update_taskbar_ = enable; } +#endif + static void addToButtonBox(QDialogButtonBox *button_box, QObject *main_window); public slots: + struct progdlg *showProgress(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value = 0); + struct progdlg *showBusy(bool animate, bool terminate_is_stop, gboolean *stop_flag); void setValue(int value); + void hide(); signals: + void showRequested(bool animate, bool terminate_is_stop, gboolean *stop_flag); + void valueChanged(int value); + void maximumValueChanged(int value); + void setHidden(); void stopLoading(); #if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0) @@ -66,9 +75,6 @@ protected: void timerEvent(QTimerEvent *event); #endif -private slots: - void on_pushButton_clicked(); - private: Ui::ProgressFrame *ui; @@ -81,9 +87,15 @@ private: int show_timer_; #endif #ifdef QWINTASKBARPROGRESS_H + bool update_taskbar_; QWinTaskbarProgress *taskbar_progress_; #endif - struct progdlg *show(bool animate, bool terminate_is_stop, gboolean *stop_flag); + +private slots: + void on_pushButton_clicked(); + + void show(bool animate, bool terminate_is_stop, gboolean *stop_flag); + void setMaximumValue(int value); }; #endif // PROGRESS_FRAME_H diff --git a/ui/qt/tap_parameter_dialog.cpp b/ui/qt/tap_parameter_dialog.cpp index cabd594041..ba7e4001e6 100644 --- a/ui/qt/tap_parameter_dialog.cpp +++ b/ui/qt/tap_parameter_dialog.cpp @@ -45,6 +45,7 @@ #include "wsutil/file_util.h" +#include "progress_frame.h" #include "wireshark_application.h" #include <QClipboard> @@ -98,6 +99,8 @@ TapParameterDialog::TapParameterDialog(QWidget &parent, CaptureFile &cf, int hel connect(ui->displayFilterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateWidgets())); + ProgressFrame::addToButtonBox(ui->buttonBox, &parent); + if (help_topic_ < 1) { ui->buttonBox->button(QDialogButtonBox::Help)->hide(); } diff --git a/ui/qt/tap_parameter_dialog.h b/ui/qt/tap_parameter_dialog.h index d91a44f379..d79a30d75c 100644 --- a/ui/qt/tap_parameter_dialog.h +++ b/ui/qt/tap_parameter_dialog.h @@ -22,6 +22,12 @@ #ifndef TAP_PARAMETER_DIALOG_H #define TAP_PARAMETER_DIALOG_H +/* + * @file Base class for statistics and analysis dialogs. + * Provides convenience classes for command-line tap parameters ("-z ...") + * and general tapping. + */ + #include "config.h" #include <glib.h> diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp index 5719efe256..a76a122ec2 100644 --- a/ui/qt/tcp_stream_dialog.cpp +++ b/ui/qt/tcp_stream_dialog.cpp @@ -30,6 +30,7 @@ #include "tango_colors.h" #include "qt_ui_utils.h" +#include "progress_frame.h" #include "wireshark_application.h" #include <QCursor> @@ -80,7 +81,7 @@ const QString sequence_number_label_ = QObject::tr("Sequence Number (B)"); const QString time_s_label_ = QObject::tr("Time (s)"); const QString window_size_label_ = QObject::tr("Window Size (B)"); -TCPStreamDialog::TCPStreamDialog(QWidget *, capture_file *cf, tcp_graph_type graph_type) : +TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_type graph_type) : QDialog(NULL, Qt::Window), ui(new Ui::TCPStreamDialog), cap_file_(cf), @@ -210,6 +211,8 @@ TCPStreamDialog::TCPStreamDialog(QWidget *, capture_file *cf, tcp_graph_type gra QPushButton *save_bt = ui->buttonBox->button(QDialogButtonBox::Save); save_bt->setText(tr("Save As" UTF8_HORIZONTAL_ELLIPSIS)); + ProgressFrame::addToButtonBox(ui->buttonBox, parent); + connect(sp, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(graphClicked(QMouseEvent*))); connect(sp, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoved(QMouseEvent*))); connect(sp, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(mouseReleased(QMouseEvent*))); diff --git a/ui/qt/traffic_table_dialog.cpp b/ui/qt/traffic_table_dialog.cpp index bc4af92086..dd75b0c429 100644 --- a/ui/qt/traffic_table_dialog.cpp +++ b/ui/qt/traffic_table_dialog.cpp @@ -30,6 +30,7 @@ #include "ui/recent.h" //#include "ui/tap-tcp-stream.h" +#include "progress_frame.h" #include "wireshark_application.h" #include <QCheckBox> @@ -119,6 +120,11 @@ void TrafficTableDialog::fillTypeMenu(QList<int> &enabled_protos) } } +void TrafficTableDialog::addProgressFrame(QObject *parent) +{ + ProgressFrame::addToButtonBox(ui->buttonBox, parent); +} + QDialogButtonBox *TrafficTableDialog::buttonBox() const { return ui->buttonBox; diff --git a/ui/qt/traffic_table_dialog.h b/ui/qt/traffic_table_dialog.h index a17b38b294..6d918557c6 100644 --- a/ui/qt/traffic_table_dialog.h +++ b/ui/qt/traffic_table_dialog.h @@ -130,6 +130,7 @@ protected: void fillTypeMenu(QList<int> &enabled_protos); // Adds a conversation tree. Returns true if the tree was freshly created, false if it was cached. virtual bool addTrafficTable(register_ct_t*) { return false; } + void addProgressFrame(QObject *parent); // UI getters QDialogButtonBox *buttonBox() const; |