forked from osmocom/wireshark
Add general a busy progress indicator.
Rename CaptureFileProgressFrame to ProgressFrame. It's not limited to capture files. Add "busy" routines there and in MainStatusBar. Show a busy indicator while sorting columns. Use toByteArray().constData instead of .data. I'm not sure if it matters in our case but it's more correct. Change-Id: Ibe35fee9b9dd3fabb5ff8ddcc21f6bf59dec4af6 Reviewed-on: https://code.wireshark.org/review/9720 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
eb1ccbdccd
commit
63edb9904f
|
@ -32,7 +32,6 @@ set(WIRESHARK_QT_HEADERS
|
|||
byte_view_text.h
|
||||
capture_file.h
|
||||
capture_file_dialog.h
|
||||
capture_file_progress_frame.h
|
||||
capture_file_properties_dialog.h
|
||||
capture_filter_combo.h
|
||||
capture_filter_edit.h
|
||||
|
@ -93,6 +92,7 @@ set(WIRESHARK_QT_HEADERS
|
|||
preferences_dialog.h
|
||||
print_dialog.h
|
||||
profile_dialog.h
|
||||
progress_frame.h
|
||||
proto_tree.h
|
||||
protocol_hierarchy_dialog.h
|
||||
protocol_preferences_menu.h
|
||||
|
@ -163,7 +163,6 @@ set(WIRESHARK_QT_SRC
|
|||
byte_view_text.cpp
|
||||
capture_file.cpp
|
||||
capture_file_dialog.cpp
|
||||
capture_file_progress_frame.cpp
|
||||
capture_file_properties_dialog.cpp
|
||||
capture_filter_combo.cpp
|
||||
capture_filter_edit.cpp
|
||||
|
@ -221,6 +220,7 @@ set(WIRESHARK_QT_SRC
|
|||
preferences_dialog.cpp
|
||||
print_dialog.cpp
|
||||
profile_dialog.cpp
|
||||
progress_frame.cpp
|
||||
proto_tree.cpp
|
||||
protocol_hierarchy_dialog.cpp
|
||||
protocol_preferences_menu.cpp
|
||||
|
@ -294,7 +294,6 @@ set(WIRESHARK_QT_UI
|
|||
bluetooth_att_server_attributes_dialog.ui
|
||||
bluetooth_devices_dialog.ui
|
||||
bluetooth_hci_summary_dialog.ui
|
||||
capture_file_progress_frame.ui
|
||||
capture_file_properties_dialog.ui
|
||||
capture_interfaces_dialog.ui
|
||||
capture_preferences_frame.ui
|
||||
|
@ -334,6 +333,7 @@ set(WIRESHARK_QT_UI
|
|||
preferences_dialog.ui
|
||||
print_dialog.ui
|
||||
profile_dialog.ui
|
||||
progress_frame.ui
|
||||
protocol_hierarchy_dialog.ui
|
||||
resolved_addresses_dialog.ui
|
||||
rtp_analysis_dialog.ui
|
||||
|
|
|
@ -136,8 +136,6 @@ bluetooth_devices_dialog.$(OBJEXT): ui_bluetooth_devices_dialog.h
|
|||
|
||||
bluetooth_hci_summary_dialog.$(OBJEXT): ui_bluetooth_hci_summary_dialog.h
|
||||
|
||||
capture_file_progress_frame.$(OBJEXT): ui_capture_file_progress_frame.h
|
||||
|
||||
capture_file_properties_dialog.$(OBJEXT): ui_capture_file_properties_dialog.h
|
||||
|
||||
capture_interfaces_dialog.$(OBJEXT): ui_capture_interfaces_dialog.h
|
||||
|
@ -218,6 +216,8 @@ preferences_dialog.$(OBJEXT): ui_preferences_dialog.h
|
|||
|
||||
print_dialog.$(OBJEXT): ui_print_dialog.h
|
||||
|
||||
progress_frame.$(OBJEXT): ui_progress_frame.h
|
||||
|
||||
rtp_analysis_dialog.$(OBJEXT): ui_rtp_analysis_dialog.h
|
||||
|
||||
rtp_stream_dialog.$(OBJEXT): ui_rtp_stream_dialog.h
|
||||
|
|
|
@ -33,7 +33,6 @@ NODIST_GENERATED_HEADER_FILES = \
|
|||
ui_bluetooth_att_server_attributes_dialog.h \
|
||||
ui_bluetooth_devices_dialog.h \
|
||||
ui_bluetooth_hci_summary_dialog.h \
|
||||
ui_capture_file_progress_frame.h \
|
||||
ui_capture_file_properties_dialog.h \
|
||||
ui_capture_interfaces_dialog.h \
|
||||
ui_capture_preferences_frame.h \
|
||||
|
@ -75,6 +74,7 @@ NODIST_GENERATED_HEADER_FILES = \
|
|||
ui_preferences_dialog.h \
|
||||
ui_print_dialog.h \
|
||||
ui_profile_dialog.h \
|
||||
ui_progress_frame.h \
|
||||
ui_protocol_hierarchy_dialog.h \
|
||||
ui_remote_capture_dialog.h \
|
||||
ui_remote_settings_dialog.h \
|
||||
|
@ -141,7 +141,6 @@ MOC_HDRS = \
|
|||
byte_view_text.h \
|
||||
capture_file.h \
|
||||
capture_file_dialog.h \
|
||||
capture_file_progress_frame.h \
|
||||
capture_file_properties_dialog.h \
|
||||
capture_filter_combo.h \
|
||||
capture_filter_edit.h \
|
||||
|
@ -204,6 +203,7 @@ MOC_HDRS = \
|
|||
preferences_dialog.h \
|
||||
print_dialog.h \
|
||||
profile_dialog.h \
|
||||
progress_frame.h \
|
||||
proto_tree.h \
|
||||
protocol_hierarchy_dialog.h \
|
||||
protocol_preferences_menu.h \
|
||||
|
@ -251,7 +251,6 @@ UI_FILES = \
|
|||
bluetooth_att_server_attributes_dialog.ui \
|
||||
bluetooth_devices_dialog.ui \
|
||||
bluetooth_hci_summary_dialog.ui \
|
||||
capture_file_progress_frame.ui \
|
||||
capture_file_properties_dialog.ui \
|
||||
capture_interfaces_dialog.ui \
|
||||
capture_preferences_frame.ui \
|
||||
|
@ -292,6 +291,7 @@ UI_FILES = \
|
|||
preferences_dialog.ui \
|
||||
print_dialog.ui \
|
||||
profile_dialog.ui \
|
||||
progress_frame.ui \
|
||||
protocol_hierarchy_dialog.ui \
|
||||
remote_capture_dialog.ui \
|
||||
remote_settings_dialog.ui \
|
||||
|
@ -374,7 +374,6 @@ WIRESHARK_QT_SRC = \
|
|||
byte_view_text.cpp \
|
||||
capture_file.cpp \
|
||||
capture_file_dialog.cpp \
|
||||
capture_file_progress_frame.cpp \
|
||||
capture_file_properties_dialog.cpp \
|
||||
capture_filter_combo.cpp \
|
||||
capture_filter_edit.cpp \
|
||||
|
@ -439,6 +438,7 @@ WIRESHARK_QT_SRC = \
|
|||
preferences_dialog.cpp \
|
||||
print_dialog.cpp \
|
||||
profile_dialog.cpp \
|
||||
progress_frame.cpp \
|
||||
proto_tree.cpp \
|
||||
protocol_hierarchy_dialog.cpp \
|
||||
protocol_preferences_menu.cpp \
|
||||
|
|
|
@ -209,7 +209,6 @@ FORMS += \
|
|||
bluetooth_att_server_attributes_dialog.ui \
|
||||
bluetooth_devices_dialog.ui \
|
||||
bluetooth_hci_summary_dialog.ui \
|
||||
capture_file_progress_frame.ui \
|
||||
capture_file_properties_dialog.ui \
|
||||
capture_interfaces_dialog.ui \
|
||||
capture_preferences_frame.ui \
|
||||
|
@ -250,6 +249,7 @@ FORMS += \
|
|||
preferences_dialog.ui \
|
||||
print_dialog.ui \
|
||||
profile_dialog.ui \
|
||||
progress_frame.ui \
|
||||
protocol_hierarchy_dialog.ui \
|
||||
remote_capture_dialog.ui \
|
||||
remote_settings_dialog.ui \
|
||||
|
@ -280,7 +280,6 @@ HEADERS += $$HEADERS_WS_C \
|
|||
bluetooth_att_server_attributes_dialog.h \
|
||||
bluetooth_devices_dialog.h \
|
||||
bluetooth_hci_summary_dialog.h \
|
||||
capture_file_progress_frame.h \
|
||||
capture_file_properties_dialog.h \
|
||||
capture_interfaces_dialog.h \
|
||||
capture_preferences_frame.h \
|
||||
|
@ -324,6 +323,7 @@ HEADERS += $$HEADERS_WS_C \
|
|||
preferences_dialog.h \
|
||||
print_dialog.h \
|
||||
profile_dialog.h \
|
||||
progress_frame.h \
|
||||
protocol_hierarchy_dialog.h \
|
||||
protocol_preferences_menu.h \
|
||||
remote_capture_dialog.h \
|
||||
|
@ -643,7 +643,6 @@ SOURCES += \
|
|||
byte_view_text.cpp \
|
||||
capture_file.cpp \
|
||||
capture_file_dialog.cpp \
|
||||
capture_file_progress_frame.cpp \
|
||||
capture_file_properties_dialog.cpp \
|
||||
capture_filter_combo.cpp \
|
||||
capture_filter_edit.cpp \
|
||||
|
@ -708,6 +707,7 @@ SOURCES += \
|
|||
preferences_dialog.cpp \
|
||||
print_dialog.cpp \
|
||||
profile_dialog.cpp \
|
||||
progress_frame.cpp \
|
||||
proto_tree.cpp \
|
||||
protocol_hierarchy_dialog.cpp \
|
||||
protocol_preferences_menu.cpp \
|
||||
|
|
|
@ -52,6 +52,7 @@ enum StatusContext {
|
|||
STATUS_CTX_FIELD,
|
||||
STATUS_CTX_BYTE,
|
||||
STATUS_CTX_FILTER,
|
||||
STATUS_CTX_BUSY,
|
||||
STATUS_CTX_TEMPORARY
|
||||
};
|
||||
|
||||
|
@ -265,7 +266,7 @@ void MainStatusBar::pushFileStatus(const QString &message, const QString &messag
|
|||
|
||||
void MainStatusBar::popFileStatus() {
|
||||
info_status_.popText(STATUS_CTX_FILE);
|
||||
info_status_.setToolTip("");
|
||||
info_status_.setToolTip(QString());
|
||||
}
|
||||
|
||||
void MainStatusBar::pushFieldStatus(const QString &message) {
|
||||
|
@ -332,6 +333,20 @@ void MainStatusBar::pushProfileName()
|
|||
}
|
||||
}
|
||||
|
||||
void MainStatusBar::pushBusyStatus(const QString &message, const QString &messagetip)
|
||||
{
|
||||
info_status_.pushText(message, STATUS_CTX_BUSY);
|
||||
info_status_.setToolTip(messagetip);
|
||||
progress_frame_.showBusy(true, false, NULL);
|
||||
}
|
||||
|
||||
void MainStatusBar::popBusyStatus()
|
||||
{
|
||||
info_status_.popText(STATUS_CTX_BUSY);
|
||||
info_status_.setToolTip(QString());
|
||||
progress_frame_.hide();
|
||||
}
|
||||
|
||||
void MainStatusBar::popProfileStatus() {
|
||||
profile_status_.popText(STATUS_CTX_MAIN);
|
||||
}
|
||||
|
@ -434,7 +449,7 @@ void MainStatusBar::toggleBackground(bool enabled)
|
|||
.arg(ws_css_warn_text, 6, 16, QChar('0'))
|
||||
.arg(ws_css_warn_background, 6, 16, QChar('0')));
|
||||
} else {
|
||||
setStyleSheet("");
|
||||
setStyleSheet(QString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
#include "capchild/capture_session.h"
|
||||
|
||||
#include "capture_file_progress_frame.h"
|
||||
#include "label_stack.h"
|
||||
#include "progress_frame.h"
|
||||
#include "wireshark_application.h"
|
||||
|
||||
#include <QLabel>
|
||||
|
@ -52,7 +52,7 @@ private:
|
|||
QLabel expert_status_;
|
||||
QLabel comment_label_;
|
||||
LabelStack info_status_;
|
||||
CaptureFileProgressFrame progress_frame_;
|
||||
ProgressFrame progress_frame_;
|
||||
LabelStack packet_status_;
|
||||
LabelStack profile_status_;
|
||||
capture_file *cap_file_;
|
||||
|
@ -79,6 +79,8 @@ public slots:
|
|||
void pushFilterStatus(const QString &message);
|
||||
void popFilterStatus();
|
||||
void pushProfileName();
|
||||
void pushBusyStatus(const QString &message, const QString &messagetip = QString());
|
||||
void popBusyStatus();
|
||||
void updateCaptureStatistics(capture_session * cap_session);
|
||||
void updateCaptureFixedStatistics(capture_session * cap_session);
|
||||
|
||||
|
|
|
@ -483,6 +483,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
this, SLOT(openPacketDialog()));
|
||||
connect(packet_list_, SIGNAL(packetListScrolled(bool)),
|
||||
main_ui_->actionGoAutoScroll, SLOT(setChecked(bool)));
|
||||
connect(packet_list_->packetListModel(), SIGNAL(pushBusyStatus(QString)),
|
||||
main_ui_->statusBar, SLOT(pushBusyStatus(QString)));
|
||||
connect(packet_list_->packetListModel(), SIGNAL(popBusyStatus()),
|
||||
main_ui_->statusBar, SLOT(popBusyStatus()));
|
||||
|
||||
connect(proto_tree_, SIGNAL(protoItemSelected(const QString&)),
|
||||
main_ui_->statusBar, SLOT(pushFieldStatus(const QString&)));
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <QColor>
|
||||
#include <QFontMetrics>
|
||||
#include <QModelIndex>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
PacketListModel::PacketListModel(QObject *parent, capture_file *cf) :
|
||||
QAbstractItemModel(parent),
|
||||
|
@ -247,11 +248,12 @@ int PacketListModel::text_sort_column_;
|
|||
Qt::SortOrder PacketListModel::sort_order_;
|
||||
capture_file *PacketListModel::sort_cap_file_;
|
||||
|
||||
QElapsedTimer busy_timer_;
|
||||
const int busy_timeout_ = 65; // ms, approximately 15 fps
|
||||
void PacketListModel::sort(int column, Qt::SortOrder order)
|
||||
{
|
||||
if (!cap_file_ || visible_rows_.count() < 1) {
|
||||
return;
|
||||
}
|
||||
if (!cap_file_ || visible_rows_.count() < 1) return;
|
||||
if (column < 0) return;
|
||||
|
||||
sort_column_ = column;
|
||||
text_sort_column_ = PacketListRecord::textColumn(column);
|
||||
|
@ -259,10 +261,19 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
|
|||
sort_cap_file_ = cap_file_;
|
||||
|
||||
beginResetModel();
|
||||
qSort(visible_rows_.begin(), visible_rows_.end(), recordLessThan);
|
||||
QString col_title = get_column_title(column);
|
||||
if (!col_title.isEmpty()) {
|
||||
QString busy_msg = tr("Sorting \"%1\"").arg(col_title);
|
||||
emit pushBusyStatus(busy_msg);
|
||||
busy_timer_.start();
|
||||
}
|
||||
std::sort(visible_rows_.begin(), visible_rows_.end(), recordLessThan);
|
||||
for (int i = 0; i < visible_rows_.count(); i++) {
|
||||
number_to_row_[visible_rows_[i]->frameData()->num] = i;
|
||||
}
|
||||
if (!col_title.isEmpty()) {
|
||||
emit popBusyStatus();
|
||||
}
|
||||
endResetModel();
|
||||
|
||||
if (cap_file_->current_frame) {
|
||||
|
@ -278,6 +289,10 @@ bool PacketListModel::recordLessThan(PacketListRecord *r1, PacketListRecord *r2)
|
|||
// _packet_list_compare_records, and packet_list_compare_custom from
|
||||
// gtk/packet_list_store.c into one function
|
||||
|
||||
if (busy_timer_.elapsed() > busy_timeout_) {
|
||||
busy_timer_.restart();
|
||||
wsApp->processEvents();
|
||||
}
|
||||
if (sort_column_ < 0) {
|
||||
// No column.
|
||||
cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), COL_NUMBER);
|
||||
|
@ -285,7 +300,7 @@ bool PacketListModel::recordLessThan(PacketListRecord *r1, PacketListRecord *r2)
|
|||
// Column comes directly from frame data
|
||||
cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), sort_cap_file_->cinfo.columns[sort_column_].col_fmt);
|
||||
} else {
|
||||
if (r1->columnString(sort_cap_file_, sort_column_).toByteArray().data() == r2->columnString(sort_cap_file_, sort_column_).toByteArray().data()) {
|
||||
if (r1->columnString(sort_cap_file_, sort_column_).toByteArray().constData() == r2->columnString(sort_cap_file_, sort_column_).toByteArray().constData()) {
|
||||
cmp_val = 0;
|
||||
} else if (sort_cap_file_->cinfo.columns[sort_column_].col_fmt == COL_CUSTOM) {
|
||||
header_field_info *hfi;
|
||||
|
@ -316,10 +331,10 @@ bool PacketListModel::recordLessThan(PacketListRecord *r1, PacketListRecord *r2)
|
|||
cmp_val = 1;
|
||||
}
|
||||
} else {
|
||||
cmp_val = strcmp(r1->columnString(sort_cap_file_, sort_column_).toByteArray().data(), r2->columnString(sort_cap_file_, sort_column_).toByteArray().data());
|
||||
cmp_val = strcmp(r1->columnString(sort_cap_file_, sort_column_).toByteArray().constData(), r2->columnString(sort_cap_file_, sort_column_).toByteArray().constData());
|
||||
}
|
||||
} else {
|
||||
cmp_val = strcmp(r1->columnString(sort_cap_file_, sort_column_).toByteArray().data(), r2->columnString(sort_cap_file_, sort_column_).toByteArray().data());
|
||||
cmp_val = strcmp(r1->columnString(sort_cap_file_, sort_column_).toByteArray().constData(), r2->columnString(sort_cap_file_, sort_column_).toByteArray().constData());
|
||||
}
|
||||
|
||||
if (cmp_val == 0) {
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
signals:
|
||||
void goToPacket(int);
|
||||
void itemHeightChanged(const QModelIndex &ih_index) const;
|
||||
void pushBusyStatus(const QString &status);
|
||||
void popBusyStatus();
|
||||
|
||||
public slots:
|
||||
void setMonospaceFont(const QFont &mono_font, int row_height);
|
||||
|
|
|
@ -171,7 +171,6 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_color)
|
|||
ws_buffer_free(&buf);
|
||||
}
|
||||
|
||||
#include <QDebug>
|
||||
//#define MINIMIZE_STRING_COPYING 1
|
||||
void PacketListRecord::cacheColumnStrings(column_info *cinfo)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* capture_file_progress_frame.cpp
|
||||
/* progress_frame.cpp
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
|
@ -21,8 +21,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "capture_file_progress_frame.h"
|
||||
#include <ui_capture_file_progress_frame.h>
|
||||
#include "progress_frame.h"
|
||||
#include <ui_progress_frame.h>
|
||||
|
||||
#include "ui/progress_dlg.h"
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
|
||||
progdlg_t *create_progress_dlg(const gpointer top_level_window, const gchar *, const gchar *,
|
||||
gboolean terminate_is_stop, gboolean *stop_flag) {
|
||||
CaptureFileProgressFrame *cfpf;
|
||||
ProgressFrame *pf;
|
||||
QWidget *main_window;
|
||||
|
||||
if (!top_level_window) {
|
||||
|
@ -53,12 +53,12 @@ progdlg_t *create_progress_dlg(const gpointer top_level_window, const gchar *, c
|
|||
return NULL;
|
||||
}
|
||||
|
||||
cfpf = main_window->findChild<CaptureFileProgressFrame *>();
|
||||
pf = main_window->findChild<ProgressFrame *>();
|
||||
|
||||
if (!cfpf) {
|
||||
if (!pf) {
|
||||
return NULL;
|
||||
}
|
||||
return cfpf->show(true, terminate_is_stop, stop_flag, 0);
|
||||
return pf->showProgress(true, terminate_is_stop, stop_flag, 0);
|
||||
}
|
||||
|
||||
progdlg_t *
|
||||
|
@ -96,11 +96,14 @@ destroy_progress_dlg(progdlg_t *dlg)
|
|||
dlg->progress_frame->hide();
|
||||
}
|
||||
|
||||
CaptureFileProgressFrame::CaptureFileProgressFrame(QWidget *parent) :
|
||||
ProgressFrame::ProgressFrame(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CaptureFileProgressFrame)
|
||||
ui(new Ui::ProgressFrame)
|
||||
, terminate_is_stop_(false)
|
||||
, stop_flag_(NULL)
|
||||
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
, show_timer_(-1)
|
||||
#endif
|
||||
#ifdef QWINTASKBARPROGRESS_H
|
||||
, taskbar_progress_(NULL)
|
||||
#endif
|
||||
|
@ -143,20 +146,36 @@ CaptureFileProgressFrame::CaptureFileProgressFrame(QWidget *parent) :
|
|||
hide();
|
||||
}
|
||||
|
||||
CaptureFileProgressFrame::~CaptureFileProgressFrame()
|
||||
ProgressFrame::~ProgressFrame()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
struct progdlg *CaptureFileProgressFrame::show(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value)
|
||||
struct progdlg *ProgressFrame::showProgress(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value)
|
||||
{
|
||||
terminate_is_stop_ = terminate_is_stop;
|
||||
stop_flag_ = stop_flag;
|
||||
|
||||
ui->progressBar->setMaximum(100);
|
||||
ui->progressBar->setValue(value);
|
||||
return show(animate, terminate_is_stop, stop_flag);
|
||||
}
|
||||
|
||||
progdlg *ProgressFrame::showBusy(bool animate, bool terminate_is_stop, gboolean *stop_flag)
|
||||
{
|
||||
ui->progressBar->setMaximum(0);
|
||||
return show(animate, terminate_is_stop, stop_flag);
|
||||
}
|
||||
|
||||
void ProgressFrame::setValue(int value)
|
||||
{
|
||||
ui->progressBar->setValue(value);
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
if (animate) {
|
||||
void ProgressFrame::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (event->timerId() == show_timer_) {
|
||||
killTimer(show_timer_);
|
||||
show_timer_ = -1;
|
||||
|
||||
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
|
||||
this->setGraphicsEffect(effect);
|
||||
|
||||
|
@ -167,9 +186,50 @@ struct progdlg *CaptureFileProgressFrame::show(bool animate, bool terminate_is_s
|
|||
animation->setEndValue(1.0);
|
||||
animation->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
animation->start();
|
||||
|
||||
QFrame::show();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ProgressFrame::hide()
|
||||
{
|
||||
show_timer_ = -1;
|
||||
QFrame::hide();
|
||||
#ifdef QWINTASKBARPROGRESS_H
|
||||
if (taskbar_progress_) {
|
||||
taskbar_progress_->reset();
|
||||
taskbar_progress_->hide();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ProgressFrame::on_pushButton_clicked()
|
||||
{
|
||||
emit stopLoading();
|
||||
}
|
||||
|
||||
const int show_delay_ = 500; // ms
|
||||
progdlg *ProgressFrame::show(bool animate, bool terminate_is_stop, gboolean *stop_flag)
|
||||
{
|
||||
terminate_is_stop_ = terminate_is_stop;
|
||||
stop_flag_ = stop_flag;
|
||||
|
||||
if (stop_flag) {
|
||||
ui->pushButton->show();
|
||||
} else {
|
||||
ui->pushButton->hide();
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
if (animate) {
|
||||
show_timer_ = startTimer(show_delay_);
|
||||
} else {
|
||||
QFrame::show();
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(animate);
|
||||
QFrame::show();
|
||||
#endif
|
||||
|
||||
#ifdef QWINTASKBARPROGRESS_H
|
||||
|
@ -189,31 +249,9 @@ struct progdlg *CaptureFileProgressFrame::show(bool animate, bool terminate_is_s
|
|||
taskbar_progress_->resume();
|
||||
#endif
|
||||
|
||||
QFrame::show();
|
||||
return &progress_dialog_;
|
||||
}
|
||||
|
||||
void CaptureFileProgressFrame::setValue(int value)
|
||||
{
|
||||
ui->progressBar->setValue(value);
|
||||
}
|
||||
|
||||
#ifdef QWINTASKBARPROGRESS_H
|
||||
void CaptureFileProgressFrame::hide()
|
||||
{
|
||||
if (taskbar_progress_) {
|
||||
taskbar_progress_->reset();
|
||||
taskbar_progress_->hide();
|
||||
}
|
||||
QFrame::hide();
|
||||
}
|
||||
#endif
|
||||
|
||||
void CaptureFileProgressFrame::on_pushButton_clicked()
|
||||
{
|
||||
emit stopLoading();
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
*
|
|
@ -1,4 +1,4 @@
|
|||
/* capture_file_progress_frame.h
|
||||
/* progress_frame.h
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
|
@ -19,15 +19,15 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef CAPTURE_FILE_PROGRESS_FRAME_H
|
||||
#define CAPTURE_FILE_PROGRESS_FRAME_H
|
||||
#ifndef PROGRESS_FRAME_H
|
||||
#define PROGRESS_FRAME_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui {
|
||||
class CaptureFileProgressFrame;
|
||||
class ProgressFrame;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
||||
|
@ -35,26 +35,25 @@ class CaptureFileProgressFrame;
|
|||
#include <QWinTaskbarProgress>
|
||||
#endif
|
||||
|
||||
class CaptureFileProgressFrame;
|
||||
class ProgressFrame;
|
||||
|
||||
// Define the structure describing a progress dialog.
|
||||
struct progdlg {
|
||||
CaptureFileProgressFrame *progress_frame; // This progress frame
|
||||
ProgressFrame *progress_frame; // This progress frame
|
||||
QWidget *top_level_window; // Progress frame's main window
|
||||
};
|
||||
|
||||
class CaptureFileProgressFrame : public QFrame
|
||||
class ProgressFrame : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CaptureFileProgressFrame(QWidget *parent = 0);
|
||||
~CaptureFileProgressFrame();
|
||||
explicit ProgressFrame(QWidget *parent = 0);
|
||||
~ProgressFrame();
|
||||
|
||||
struct progdlg *show(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value);
|
||||
#ifdef QWINTASKBARPROGRESS_H
|
||||
struct progdlg *showProgress(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value);
|
||||
struct progdlg *showBusy(bool animate, bool terminate_is_stop, gboolean *stop_flag);
|
||||
void hide();
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void setValue(int value);
|
||||
|
@ -62,23 +61,32 @@ public slots:
|
|||
signals:
|
||||
void stopLoading();
|
||||
|
||||
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::CaptureFileProgressFrame *ui;
|
||||
Ui::ProgressFrame *ui;
|
||||
|
||||
struct progdlg progress_dialog_;
|
||||
QString message_;
|
||||
QString status_;
|
||||
bool terminate_is_stop_;
|
||||
gboolean *stop_flag_;
|
||||
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
int show_timer_;
|
||||
#endif
|
||||
#ifdef QWINTASKBARPROGRESS_H
|
||||
QWinTaskbarProgress *taskbar_progress_;
|
||||
#endif
|
||||
struct progdlg *show(bool animate, bool terminate_is_stop, gboolean *stop_flag);
|
||||
};
|
||||
|
||||
#endif // CAPTURE_FILE_PROGRESS_FRAME_H
|
||||
#endif // PROGRESS_FRAME_H
|
||||
|
||||
/*
|
||||
* Editor modelines
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CaptureFileProgressFrame</class>
|
||||
<widget class="QFrame" name="CaptureFileProgressFrame">
|
||||
<class>ProgressFrame</class>
|
||||
<widget class="QFrame" name="ProgressFrame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
|
@ -711,7 +711,7 @@
|
|||
<context>
|
||||
<name>CaptureFileProgressFrame</name>
|
||||
<message>
|
||||
<location filename="capture_file_progress_frame.ui" line="14"/>
|
||||
<location filename="progress_frame.ui" line="14"/>
|
||||
<source>Frame</source>
|
||||
<translation type="unfinished">Frame</translation>
|
||||
</message>
|
||||
|
|
|
@ -711,7 +711,7 @@
|
|||
<context>
|
||||
<name>CaptureFileProgressFrame</name>
|
||||
<message>
|
||||
<location filename="capture_file_progress_frame.ui" line="14"/>
|
||||
<location filename="progress_frame.ui" line="14"/>
|
||||
<source>Frame</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -711,7 +711,7 @@
|
|||
<context>
|
||||
<name>CaptureFileProgressFrame</name>
|
||||
<message>
|
||||
<location filename="capture_file_progress_frame.ui" line="14"/>
|
||||
<location filename="progress_frame.ui" line="14"/>
|
||||
<source>Frame</source>
|
||||
<translation type="unfinished">Trame</translation>
|
||||
</message>
|
||||
|
|
|
@ -711,7 +711,7 @@
|
|||
<context>
|
||||
<name>CaptureFileProgressFrame</name>
|
||||
<message>
|
||||
<location filename="capture_file_progress_frame.ui" line="14"/>
|
||||
<location filename="progress_frame.ui" line="14"/>
|
||||
<source>Frame</source>
|
||||
<translation>Frame</translation>
|
||||
</message>
|
||||
|
|
|
@ -711,7 +711,7 @@
|
|||
<context>
|
||||
<name>CaptureFileProgressFrame</name>
|
||||
<message>
|
||||
<location filename="capture_file_progress_frame.ui" line="14"/>
|
||||
<location filename="progress_frame.ui" line="14"/>
|
||||
<source>Frame</source>
|
||||
<translation type="unfinished">フレーム</translation>
|
||||
</message>
|
||||
|
|
|
@ -711,7 +711,7 @@
|
|||
<context>
|
||||
<name>CaptureFileProgressFrame</name>
|
||||
<message>
|
||||
<location filename="capture_file_progress_frame.ui" line="14"/>
|
||||
<location filename="progress_frame.ui" line="14"/>
|
||||
<source>Frame</source>
|
||||
<translation>Ramka</translation>
|
||||
</message>
|
||||
|
|
|
@ -711,7 +711,7 @@
|
|||
<context>
|
||||
<name>CaptureFileProgressFrame</name>
|
||||
<message>
|
||||
<location filename="capture_file_progress_frame.ui" line="14"/>
|
||||
<location filename="progress_frame.ui" line="14"/>
|
||||
<source>Frame</source>
|
||||
<translation>帧</translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in New Issue