2011-09-28 21:47:40 +02:00
|
|
|
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2011-09-28 21:47:40 +02:00
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2011-09-28 21:47:40 +02:00
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2009-07-29 07:43:02 +02:00
|
|
|
|
|
|
|
/// @file dialog_progress.h
|
|
|
|
/// @see dialog_progress.cpp
|
|
|
|
/// @ingroup utility
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2013-09-27 00:54:59 +02:00
|
|
|
#include <chrono>
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/dialog.h>
|
2011-09-28 21:47:40 +02:00
|
|
|
#include <wx/timer.h>
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-09-28 21:47:40 +02:00
|
|
|
#include <libaegisub/background_runner.h>
|
|
|
|
|
|
|
|
class DialogProgressSink;
|
|
|
|
class wxButton;
|
|
|
|
class wxGauge;
|
|
|
|
class wxStaticText;
|
|
|
|
class wxTextCtrl;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @class DialogProgress
|
2011-09-28 21:47:40 +02:00
|
|
|
/// @brief Progress-bar dialog box for displaying during long operations
|
|
|
|
class DialogProgress : public wxDialog, public agi::BackgroundRunner {
|
2013-01-04 16:01:50 +01:00
|
|
|
friend class DialogProgressSink;
|
2011-09-28 21:47:40 +02:00
|
|
|
DialogProgressSink *ps;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:47:40 +02:00
|
|
|
wxStaticText *title;
|
2006-01-16 22:02:54 +01:00
|
|
|
wxStaticText *text;
|
2011-09-28 21:47:40 +02:00
|
|
|
wxGauge *gauge;
|
|
|
|
wxButton *cancel_button;
|
|
|
|
wxTextCtrl *log_output;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-09-28 21:47:40 +02:00
|
|
|
wxTimer pulse_timer;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2012-02-16 22:22:04 +01:00
|
|
|
wxString pending_log;
|
2013-12-12 01:29:48 +01:00
|
|
|
int progress_anim_start_value = 0;
|
|
|
|
int progress_current = 0;
|
|
|
|
int progress_target = 0;
|
2013-09-27 00:54:59 +02:00
|
|
|
std::chrono::steady_clock::time_point progress_anim_start_time;
|
2013-12-12 01:29:48 +01:00
|
|
|
int progress_anim_duration = 0;
|
2012-02-16 22:22:04 +01:00
|
|
|
|
2011-09-28 21:47:40 +02:00
|
|
|
void OnShow(wxShowEvent&);
|
|
|
|
void OnCancel(wxCommandEvent &);
|
2012-02-16 22:22:04 +01:00
|
|
|
void OnIdle(wxIdleEvent&);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2013-09-27 00:54:59 +02:00
|
|
|
void SetProgress(int target);
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
public:
|
2011-09-28 21:47:40 +02:00
|
|
|
/// Constructor
|
|
|
|
/// @param parent Parent window of the dialog
|
|
|
|
/// @param title Initial title of the dialog
|
|
|
|
/// @param message Initial message of the dialog
|
|
|
|
DialogProgress(wxWindow *parent, wxString const& title="", wxString const& message="");
|
|
|
|
|
|
|
|
/// BackgroundWorker implementation
|
2013-11-21 18:13:36 +01:00
|
|
|
void Run(std::function<void(agi::ProgressSink *)> task, int priority=-1) override;
|
2006-01-16 22:02:54 +01:00
|
|
|
};
|