2015-07-17 22:06:55 +00:00
|
|
|
/* progress_frame.h
|
2012-01-04 22:13:01 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2012-01-04 22:13:01 +00:00
|
|
|
*/
|
|
|
|
|
2015-07-17 22:06:55 +00:00
|
|
|
#ifndef PROGRESS_FRAME_H
|
|
|
|
#define PROGRESS_FRAME_H
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2012-07-19 21:49:52 +00:00
|
|
|
#include <glib.h>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2015-06-19 23:56:44 +00:00
|
|
|
#include <QFrame>
|
2012-07-19 21:49:52 +00:00
|
|
|
|
2015-06-19 23:56:44 +00:00
|
|
|
namespace Ui {
|
2015-07-17 22:06:55 +00:00
|
|
|
class ProgressFrame;
|
2015-06-19 23:56:44 +00:00
|
|
|
}
|
2012-07-19 21:49:52 +00:00
|
|
|
|
2014-08-13 15:10:44 +00:00
|
|
|
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
|
|
|
#include <QWinTaskbarButton>
|
|
|
|
#include <QWinTaskbarProgress>
|
|
|
|
#endif
|
|
|
|
|
2015-07-17 22:06:55 +00:00
|
|
|
class ProgressFrame;
|
2015-08-24 19:33:49 +00:00
|
|
|
class QDialogButtonBox;
|
2015-09-17 17:32:55 +00:00
|
|
|
class QElapsedTimer;
|
2015-09-11 18:13:23 +00:00
|
|
|
class QGraphicsOpacityEffect;
|
|
|
|
class QPropertyAnimation;
|
2012-07-19 21:49:52 +00:00
|
|
|
|
|
|
|
// Define the structure describing a progress dialog.
|
|
|
|
struct progdlg {
|
2015-07-17 22:06:55 +00:00
|
|
|
ProgressFrame *progress_frame; // This progress frame
|
2015-06-19 23:56:44 +00:00
|
|
|
QWidget *top_level_window; // Progress frame's main window
|
2012-07-19 21:49:52 +00:00
|
|
|
};
|
|
|
|
|
2015-07-17 22:06:55 +00:00
|
|
|
class ProgressFrame : public QFrame
|
2012-01-04 22:13:01 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2012-07-19 22:33:47 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
public:
|
2015-07-17 22:06:55 +00:00
|
|
|
explicit ProgressFrame(QWidget *parent = 0);
|
|
|
|
~ProgressFrame();
|
2015-06-19 23:56:44 +00:00
|
|
|
|
2015-08-24 19:33:49 +00:00
|
|
|
#ifdef QWINTASKBARPROGRESS_H
|
|
|
|
void enableTaskbarUpdates(bool enable = true) { update_taskbar_ = enable; }
|
|
|
|
#endif
|
|
|
|
static void addToButtonBox(QDialogButtonBox *button_box, QObject *main_window);
|
2015-08-28 19:57:57 +00:00
|
|
|
void captureFileClosing();
|
2015-06-19 23:56:44 +00:00
|
|
|
|
|
|
|
public slots:
|
2015-08-24 19:33:49 +00:00
|
|
|
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);
|
2015-06-19 23:56:44 +00:00
|
|
|
void setValue(int value);
|
2015-08-24 19:33:49 +00:00
|
|
|
void hide();
|
2015-06-19 23:56:44 +00:00
|
|
|
|
|
|
|
signals:
|
2015-08-24 19:33:49 +00:00
|
|
|
void showRequested(bool animate, bool terminate_is_stop, gboolean *stop_flag);
|
|
|
|
void valueChanged(int value);
|
|
|
|
void maximumValueChanged(int value);
|
|
|
|
void setHidden();
|
2015-06-19 23:56:44 +00:00
|
|
|
void stopLoading();
|
|
|
|
|
2015-07-17 22:06:55 +00:00
|
|
|
protected:
|
2017-07-17 19:43:30 +00:00
|
|
|
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
2015-07-17 22:06:55 +00:00
|
|
|
void timerEvent(QTimerEvent *event);
|
|
|
|
#endif
|
|
|
|
|
2012-07-19 21:49:52 +00:00
|
|
|
private:
|
2015-07-17 22:06:55 +00:00
|
|
|
Ui::ProgressFrame *ui;
|
2015-06-19 23:56:44 +00:00
|
|
|
|
|
|
|
struct progdlg progress_dialog_;
|
2013-09-03 16:14:38 +00:00
|
|
|
QString message_;
|
|
|
|
QString status_;
|
|
|
|
bool terminate_is_stop_;
|
|
|
|
gboolean *stop_flag_;
|
2017-07-17 19:43:30 +00:00
|
|
|
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
2015-07-17 22:06:55 +00:00
|
|
|
int show_timer_;
|
2015-09-11 18:13:23 +00:00
|
|
|
QGraphicsOpacityEffect *effect_;
|
|
|
|
QPropertyAnimation *animation_;
|
2015-07-17 22:06:55 +00:00
|
|
|
#endif
|
2014-08-13 15:10:44 +00:00
|
|
|
#ifdef QWINTASKBARPROGRESS_H
|
2015-08-24 19:33:49 +00:00
|
|
|
bool update_taskbar_;
|
2014-08-13 15:10:44 +00:00
|
|
|
QWinTaskbarProgress *taskbar_progress_;
|
|
|
|
#endif
|
2015-08-24 19:33:49 +00:00
|
|
|
|
|
|
|
private slots:
|
2015-09-10 21:42:07 +00:00
|
|
|
void on_stopButton_clicked();
|
2015-08-24 19:33:49 +00:00
|
|
|
|
|
|
|
void show(bool animate, bool terminate_is_stop, gboolean *stop_flag);
|
|
|
|
void setMaximumValue(int value);
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
2015-07-17 22:06:55 +00:00
|
|
|
#endif // PROGRESS_FRAME_H
|
2012-09-04 08:18:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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:
|
|
|
|
*/
|