Add an AccordionFrame class which can animate showing and hiding (except
when we detect a remote connection). Use it for the "go to" and search frames. Properly detect remote connections in the splash overlay. svn path=/trunk/; revision=46591
This commit is contained in:
parent
ed87fa9e3b
commit
7cf5334332
|
@ -24,6 +24,7 @@
|
||||||
# All .h files which inherit from QObject aka which use the Q_OBJECT macro
|
# All .h files which inherit from QObject aka which use the Q_OBJECT macro
|
||||||
# need to go here.
|
# need to go here.
|
||||||
set(QTSHARK_H_SRC
|
set(QTSHARK_H_SRC
|
||||||
|
accordion_frame.h
|
||||||
byte_view_tab.h
|
byte_view_tab.h
|
||||||
byte_view_text.h
|
byte_view_text.h
|
||||||
capture_file_dialog.h
|
capture_file_dialog.h
|
||||||
|
@ -53,6 +54,7 @@ set(QTSHARK_H_SRC
|
||||||
recent_file_status.h
|
recent_file_status.h
|
||||||
simple_dialog_qt.h
|
simple_dialog_qt.h
|
||||||
search_frame.h
|
search_frame.h
|
||||||
|
sparkline_delegate.h
|
||||||
splash_overlay.h
|
splash_overlay.h
|
||||||
syntax_line_edit.h
|
syntax_line_edit.h
|
||||||
wireshark_application.h
|
wireshark_application.h
|
||||||
|
@ -63,6 +65,7 @@ set(QTSHARK_H_SRC
|
||||||
)
|
)
|
||||||
|
|
||||||
set(QTSHARK_CPP_SRC
|
set(QTSHARK_CPP_SRC
|
||||||
|
accordion_frame.cpp
|
||||||
byte_view_tab.cpp
|
byte_view_tab.cpp
|
||||||
byte_view_text.cpp
|
byte_view_text.cpp
|
||||||
capture_file_dialog.cpp
|
capture_file_dialog.cpp
|
||||||
|
|
|
@ -75,6 +75,7 @@ GENERATOR_FILES =
|
||||||
# Headers that have to be run through moc.
|
# Headers that have to be run through moc.
|
||||||
#
|
#
|
||||||
MOC_HDRS = \
|
MOC_HDRS = \
|
||||||
|
accordion_frame.h \
|
||||||
byte_view_tab.h \
|
byte_view_tab.h \
|
||||||
byte_view_text.h \
|
byte_view_text.h \
|
||||||
capture_file_dialog.h \
|
capture_file_dialog.h \
|
||||||
|
@ -152,6 +153,7 @@ QM_FILES = \
|
||||||
QRC_SRC = $(QRC_FILES:.qrc=.rcc.cpp)
|
QRC_SRC = $(QRC_FILES:.qrc=.rcc.cpp)
|
||||||
|
|
||||||
WIRESHARK_QT_SRC = \
|
WIRESHARK_QT_SRC = \
|
||||||
|
accordion_frame.cpp \
|
||||||
byte_view_tab.cpp \
|
byte_view_tab.cpp \
|
||||||
byte_view_text.cpp \
|
byte_view_text.cpp \
|
||||||
capture_file_dialog.cpp \
|
capture_file_dialog.cpp \
|
||||||
|
|
|
@ -217,7 +217,8 @@ HEADERS += $$HEADERS_WS_C \
|
||||||
export_object_dialog.h \
|
export_object_dialog.h \
|
||||||
print_dialog.h \
|
print_dialog.h \
|
||||||
splash_overlay.h \
|
splash_overlay.h \
|
||||||
search_frame.h
|
search_frame.h \
|
||||||
|
accordion_frame.h
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
OBJECTS_WS_C = $$SOURCES_WS_C
|
OBJECTS_WS_C = $$SOURCES_WS_C
|
||||||
|
@ -394,6 +395,7 @@ HEADERS += \
|
||||||
wireshark_application.h
|
wireshark_application.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
accordion_frame.cpp \
|
||||||
byte_view_tab.cpp \
|
byte_view_tab.cpp \
|
||||||
byte_view_text.cpp \
|
byte_view_text.cpp \
|
||||||
capture_file_dialog.cpp \
|
capture_file_dialog.cpp \
|
||||||
|
@ -425,9 +427,9 @@ SOURCES += \
|
||||||
proto_tree.cpp \
|
proto_tree.cpp \
|
||||||
qt_ui_utils.cpp \
|
qt_ui_utils.cpp \
|
||||||
recent_file_status.cpp \
|
recent_file_status.cpp \
|
||||||
|
search_frame.cpp \
|
||||||
simple_dialog_qt.cpp \
|
simple_dialog_qt.cpp \
|
||||||
sparkline_delegate.cpp \
|
sparkline_delegate.cpp \
|
||||||
splash_overlay.cpp \
|
splash_overlay.cpp \
|
||||||
syntax_line_edit.cpp \
|
syntax_line_edit.cpp \
|
||||||
wireshark_application.cpp \
|
wireshark_application.cpp
|
||||||
search_frame.cpp
|
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/* accordion_frame.cpp
|
||||||
|
*
|
||||||
|
* $Id: splash_overlay.cpp 45941 2012-11-05 22:43:15Z gerald $
|
||||||
|
*
|
||||||
|
* 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 "config.h"
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "accordion_frame.h"
|
||||||
|
|
||||||
|
#include "ui/util.h"
|
||||||
|
|
||||||
|
const int duration_ = 150;
|
||||||
|
|
||||||
|
AccordionFrame::AccordionFrame(QWidget *parent) :
|
||||||
|
QFrame(parent)
|
||||||
|
{
|
||||||
|
QString subframe_style(
|
||||||
|
".QFrame {"
|
||||||
|
" background: palette(window);"
|
||||||
|
" padding-top: 0.1em;"
|
||||||
|
" padding-bottom: 0.1em;"
|
||||||
|
" border-bottom: 1px solid palette(shadow);"
|
||||||
|
"}"
|
||||||
|
"QLineEdit#goToLineEdit {"
|
||||||
|
" max-width: 5em;"
|
||||||
|
"}"
|
||||||
|
);
|
||||||
|
setStyleSheet(subframe_style);
|
||||||
|
frame_height_ = height();
|
||||||
|
animation_ = new QPropertyAnimation(this, "maximumHeight");
|
||||||
|
animation_->setDuration(duration_);
|
||||||
|
animation_->setEasingCurve(QEasingCurve::InOutQuad);
|
||||||
|
connect(animation_, SIGNAL(finished()), this, SLOT(animationFinished()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccordionFrame::animatedShow()
|
||||||
|
{
|
||||||
|
if (strlen (get_conn_cfilter()) < 1) {
|
||||||
|
animation_->setStartValue(0);
|
||||||
|
animation_->setEndValue(frame_height_);
|
||||||
|
animation_->start();
|
||||||
|
}
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccordionFrame::animatedHide()
|
||||||
|
{
|
||||||
|
if (strlen (get_conn_cfilter()) < 1) {
|
||||||
|
animation_->setStartValue(frame_height_);
|
||||||
|
animation_->setEndValue(0);
|
||||||
|
animation_->start();
|
||||||
|
} else {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccordionFrame::animationFinished()
|
||||||
|
{
|
||||||
|
if (animation_->currentValue().toInt() < 1) {
|
||||||
|
hide();
|
||||||
|
setMaximumHeight(frame_height_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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:
|
||||||
|
*/
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* accordion_frame.cpp
|
||||||
|
*
|
||||||
|
* $Id: splash_overlay.cpp 45941 2012-11-05 22:43:15Z gerald $
|
||||||
|
*
|
||||||
|
* 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 ACCORDION_FRAME_H
|
||||||
|
#define ACCORDION_FRAME_H
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
|
|
||||||
|
class AccordionFrame : public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit AccordionFrame(QWidget *parent = 0);
|
||||||
|
void animatedShow();
|
||||||
|
void animatedHide();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
int frame_height_;
|
||||||
|
QPropertyAnimation *animation_;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void animationFinished();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ACCORDION_FRAME_H
|
|
@ -115,24 +115,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
// This property is obsolete in Qt5 so this issue may be fixed in that version.
|
// This property is obsolete in Qt5 so this issue may be fixed in that version.
|
||||||
main_ui_->displayFilterToolBar->addWidget(df_combo_box_);
|
main_ui_->displayFilterToolBar->addWidget(df_combo_box_);
|
||||||
|
|
||||||
QString subframe_style(
|
|
||||||
".QFrame {"
|
|
||||||
" background: palette(window);"
|
|
||||||
" padding-top: 0.1em;"
|
|
||||||
" padding-bottom: 0.1em;"
|
|
||||||
" border-bottom: 1px solid palette(shadow);"
|
|
||||||
"}"
|
|
||||||
"QLineEdit#goToLineEdit {"
|
|
||||||
" max-width: 5em;"
|
|
||||||
"}"
|
|
||||||
);
|
|
||||||
main_ui_->goToFrame->hide();
|
main_ui_->goToFrame->hide();
|
||||||
// XXX For some reason the cursor is drawn funny with an input mask set
|
// XXX For some reason the cursor is drawn funny with an input mask set
|
||||||
// https://bugreports.qt-project.org/browse/QTBUG-7174
|
// https://bugreports.qt-project.org/browse/QTBUG-7174
|
||||||
main_ui_->goToFrame->setStyleSheet(subframe_style);
|
|
||||||
|
|
||||||
main_ui_->searchFrame->hide();
|
main_ui_->searchFrame->hide();
|
||||||
main_ui_->searchFrame->setStyleSheet(subframe_style);
|
|
||||||
connect(main_ui_->searchFrame, SIGNAL(pushFilterSyntaxStatus(QString&)),
|
connect(main_ui_->searchFrame, SIGNAL(pushFilterSyntaxStatus(QString&)),
|
||||||
main_ui_->statusBar, SLOT(pushTemporaryStatus(QString&)));
|
main_ui_->statusBar, SLOT(pushTemporaryStatus(QString&)));
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QFrame" name="goToFrame">
|
<widget class="AccordionFrame" name="goToFrame">
|
||||||
<layout class="QHBoxLayout" name="goToHB">
|
<layout class="QHBoxLayout" name="goToHB">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
@ -1133,6 +1133,12 @@
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>search_frame.h</header>
|
<header>search_frame.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>AccordionFrame</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>accordion_frame.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../image/toolbar.qrc"/>
|
<include location="../../image/toolbar.qrc"/>
|
||||||
|
|
|
@ -321,7 +321,7 @@ void MainWindow::captureFileClosing(const capture_file *cf) {
|
||||||
|
|
||||||
// Reset expert info indicator
|
// Reset expert info indicator
|
||||||
main_ui_->statusBar->hideExpert();
|
main_ui_->statusBar->hideExpert();
|
||||||
main_ui_->searchFrame->hide();
|
main_ui_->searchFrame->animatedHide();
|
||||||
// gtk_widget_show(expert_info_none);
|
// gtk_widget_show(expert_info_none);
|
||||||
emit setCaptureFile(NULL);
|
emit setCaptureFile(NULL);
|
||||||
}
|
}
|
||||||
|
@ -1179,11 +1179,11 @@ void MainWindow::on_actionEditFindPacket_triggered()
|
||||||
}
|
}
|
||||||
previous_focus_ = wsApp->focusWidget();
|
previous_focus_ = wsApp->focusWidget();
|
||||||
connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
|
connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
|
||||||
main_ui_->goToFrame->hide();
|
main_ui_->goToFrame->animatedHide();
|
||||||
if (main_ui_->searchFrame->isVisible()) {
|
if (main_ui_->searchFrame->isVisible()) {
|
||||||
main_ui_->searchFrame->hide();
|
main_ui_->searchFrame->animatedHide();
|
||||||
} else {
|
} else {
|
||||||
main_ui_->searchFrame->show();
|
main_ui_->searchFrame->animatedShow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1489,11 +1489,11 @@ void MainWindow::on_actionGoGoToPacket_triggered() {
|
||||||
previous_focus_ = wsApp->focusWidget();
|
previous_focus_ = wsApp->focusWidget();
|
||||||
connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
|
connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
|
||||||
|
|
||||||
main_ui_->searchFrame->hide();
|
main_ui_->searchFrame->animatedHide();
|
||||||
if (main_ui_->goToFrame->isVisible()) {
|
if (main_ui_->goToFrame->isVisible()) {
|
||||||
main_ui_->goToFrame->hide();
|
main_ui_->goToFrame->animatedHide();
|
||||||
} else {
|
} else {
|
||||||
main_ui_->goToFrame->show();
|
main_ui_->goToFrame->animatedShow();
|
||||||
}
|
}
|
||||||
main_ui_->goToLineEdit->setFocus();
|
main_ui_->goToLineEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
@ -1504,7 +1504,7 @@ void MainWindow::resetPreviousFocus() {
|
||||||
|
|
||||||
void MainWindow::on_goToCancel_clicked()
|
void MainWindow::on_goToCancel_clicked()
|
||||||
{
|
{
|
||||||
main_ui_->goToFrame->hide();
|
main_ui_->goToFrame->animatedHide();
|
||||||
if (previous_focus_) {
|
if (previous_focus_) {
|
||||||
disconnect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
|
disconnect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
|
||||||
previous_focus_->setFocus();
|
previous_focus_->setFocus();
|
||||||
|
|
|
@ -44,7 +44,7 @@ const int narrow_chars = 1;
|
||||||
const int wide_chars = 2;
|
const int wide_chars = 2;
|
||||||
|
|
||||||
SearchFrame::SearchFrame(QWidget *parent) :
|
SearchFrame::SearchFrame(QWidget *parent) :
|
||||||
QFrame(parent),
|
AccordionFrame(parent),
|
||||||
sf_ui_(new Ui::SearchFrame),
|
sf_ui_(new Ui::SearchFrame),
|
||||||
cap_file_(NULL)
|
cap_file_(NULL)
|
||||||
{
|
{
|
||||||
|
@ -64,10 +64,11 @@ SearchFrame::~SearchFrame()
|
||||||
delete sf_ui_;
|
delete sf_ui_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchFrame::show()
|
void SearchFrame::animatedShow()
|
||||||
{
|
{
|
||||||
sf_ui_->searchLineEdit->setFocus();
|
sf_ui_->searchLineEdit->setFocus();
|
||||||
QFrame::show();
|
|
||||||
|
AccordionFrame::animatedShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchFrame::findNext()
|
void SearchFrame::findNext()
|
||||||
|
@ -76,7 +77,7 @@ void SearchFrame::findNext()
|
||||||
|
|
||||||
cap_file_->dir = SD_FORWARD;
|
cap_file_->dir = SD_FORWARD;
|
||||||
if (isHidden()) {
|
if (isHidden()) {
|
||||||
show();
|
animatedShow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
on_findButton_clicked();
|
on_findButton_clicked();
|
||||||
|
@ -88,7 +89,7 @@ void SearchFrame::findPrevious()
|
||||||
|
|
||||||
cap_file_->dir = SD_BACKWARD;
|
cap_file_->dir = SD_BACKWARD;
|
||||||
if (isHidden()) {
|
if (isHidden()) {
|
||||||
show();
|
animatedShow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
on_findButton_clicked();
|
on_findButton_clicked();
|
||||||
|
@ -98,14 +99,14 @@ void SearchFrame::setCaptureFile(capture_file *cf)
|
||||||
{
|
{
|
||||||
cap_file_ = cf;
|
cap_file_ = cf;
|
||||||
if (!cf && isVisible()) {
|
if (!cf && isVisible()) {
|
||||||
hide();
|
animatedHide();
|
||||||
}
|
}
|
||||||
enableWidgets();
|
enableWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchFrame::findFrameWithFilter(QString &filter)
|
void SearchFrame::findFrameWithFilter(QString &filter)
|
||||||
{
|
{
|
||||||
show();
|
animatedShow();
|
||||||
sf_ui_->searchLineEdit->setText(filter);
|
sf_ui_->searchLineEdit->setText(filter);
|
||||||
sf_ui_->searchTypeComboBox->setCurrentIndex(0);
|
sf_ui_->searchTypeComboBox->setCurrentIndex(0);
|
||||||
enableWidgets();
|
enableWidgets();
|
||||||
|
@ -356,7 +357,7 @@ void SearchFrame::on_findButton_clicked()
|
||||||
|
|
||||||
void SearchFrame::on_cancelButton_clicked()
|
void SearchFrame::on_cancelButton_clicked()
|
||||||
{
|
{
|
||||||
hide();
|
animatedHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <QFrame>
|
#include "accordion_frame.h"
|
||||||
|
|
||||||
#include "cfile.h"
|
#include "cfile.h"
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ namespace Ui {
|
||||||
class SearchFrame;
|
class SearchFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SearchFrame : public QFrame
|
class SearchFrame : public AccordionFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SearchFrame(QWidget *parent = 0);
|
explicit SearchFrame(QWidget *parent = 0);
|
||||||
~SearchFrame();
|
~SearchFrame();
|
||||||
void show();
|
void animatedShow();
|
||||||
void findNext();
|
void findNext();
|
||||||
void findPrevious();
|
void findPrevious();
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ SplashOverlay::SplashOverlay(QWidget *parent) :
|
||||||
));
|
));
|
||||||
|
|
||||||
// Check for a remote connection
|
// Check for a remote connection
|
||||||
if (get_conn_cfilter() != NULL)
|
if (strlen (get_conn_cfilter()) > 0)
|
||||||
info_update_freq_ = 1000;
|
info_update_freq_ = 1000;
|
||||||
|
|
||||||
connect(wsApp, SIGNAL(splashUpdate(register_action_e,const char*)),
|
connect(wsApp, SIGNAL(splashUpdate(register_action_e,const char*)),
|
||||||
|
|
Loading…
Reference in New Issue