[Summary]: Loading session progress dialog

[Feature Reviewed] <Mykhaylo Kosharnyy>
This commit is contained in:
YPozdnyakov 2014-12-18 17:55:42 +02:00
parent 028a8731cd
commit d1a61bc32a
10 changed files with 266 additions and 4 deletions

View file

@ -2971,6 +2971,14 @@ ARDOUR_UI::close_session()
int
ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, std::string mix_template)
{
ProgressDialog::instance()->set_top_label ("Loading session: "+path);
ProgressDialog::instance()->update_info (0.0, NULL, NULL, "Loading audio...");
ProgressDialog::instance()->show ();
/* Make sure the progress dialog is drawn */
while (Glib::MainContext::get_default()->iteration (false)) {
/* do nothing */
}
Session *new_session;
int unload_status;
int retval = -1;
@ -2988,10 +2996,10 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
session_loaded = false;
loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME));
ProgressDialog::instance()->set_progress (0.1);
try {
new_session = new Session (*AudioEngine::instance(), path, snap_name, 0, mix_template);
ProgressDialog::instance()->update_info (0.4, NULL, NULL, "Loading elements...");
}
/* this one is special */
@ -3072,6 +3080,8 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
retval = 0;
out:
ProgressDialog::instance()->set_progress (1);
ProgressDialog::instance()->hide ();
return retval;
}

View file

@ -89,6 +89,7 @@
#include "global_port_matrix.h"
#include "keyeditor.h"
#include "location_ui.h"
#include "progress_dialog.h"
#include "rc_option_editor.h"
#include "route_params_ui.h"
#include "session_option_editor.h"

View file

@ -1375,20 +1375,32 @@ Editor::set_session (Session *t)
return;
}
ProgressDialog::instance()->set_progress (0.4);
_playlist_selector->set_session (_session);
nudge_clock->set_session (_session);
_summary->set_session (_session);
ProgressDialog::instance()->set_progress (0.45);
_group_tabs->set_session (_session);
_route_groups->set_session (_session);
ProgressDialog::instance()->set_progress (0.5);
_regions->set_session (_session);
ProgressDialog::instance()->set_progress (0.55);
_snapshots->set_session (_session);
ProgressDialog::instance()->set_progress (0.6);
_routes->set_session (_session);
ProgressDialog::instance()->set_progress (0.65);
_locations->set_session (_session);
ProgressDialog::instance()->set_progress (0.7);
_compact_meter_bridge.set_session (_session);
ProgressDialog::instance()->set_progress (0.75);
_mixer_bridge_view.set_max_name_size(mixer_bridge_strip_max_name_size);
ProgressDialog::instance()->set_progress (0.8);
_mixer_bridge_view.set_session (_session);
ProgressDialog::instance()->set_progress (0.85);
_meter_bridge_view.set_max_name_size(meter_bridge_strip_max_name_size);
ProgressDialog::instance()->set_progress (0.9);
_meter_bridge_view.set_session (_session);
ProgressDialog::instance()->set_progress (0.95);
if (rhythm_ferret) {
rhythm_ferret->set_session (_session);

View file

@ -269,6 +269,8 @@
43279460194F0062003C9FEA /* tracks_preferences.xml in Resources */ = {isa = PBXBuildFile; fileRef = 43279430194F0062003C9FEA /* tracks_preferences.xml */; };
4327947F194F009E003C9FEA /* tracks.menus.in in Resources */ = {isa = PBXBuildFile; fileRef = 43279475194F009E003C9FEA /* tracks.menus.in */; };
43B351ED194F04E00038C140 /* step_editing.bindings in Resources */ = {isa = PBXBuildFile; fileRef = 43B351C0194F04E00038C140 /* step_editing.bindings */; };
5BC67E591A408FCE00F29ABA /* progress_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 5BC67E581A408FCE00F29ABA /* progress_dialog.xml */; };
5BC67E5F1A4090BD00F29ABA /* progress_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5BC67E5E1A4090BD00F29ABA /* progress_dialog.cc */; };
95176F7A1A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */; };
95176F7E1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95176F7D1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml */; };
95176F871A092A2900E32046 /* yes_no_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95176F851A092A2900E32046 /* yes_no_dialog.xml */; };
@ -1124,6 +1126,9 @@
43B351EE194F12FB0038C140 /* waves_audiobackend.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = waves_audiobackend.xcodeproj; path = ../../libs/backends/wavesaudio/macosx/waves_audiobackend.xcodeproj; sourceTree = "<group>"; };
43B351F4194F130C0038C140 /* libardour.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libardour.xcodeproj; path = ../../libs/ardour/macosx/libardour.xcodeproj; sourceTree = "<group>"; };
43B351FA194F131D0038C140 /* pbd.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = pbd.xcodeproj; path = ../../libs/pbd/macosx/pbd.xcodeproj; sourceTree = "<group>"; };
5BC67E581A408FCE00F29ABA /* progress_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = progress_dialog.xml; sourceTree = "<group>"; };
5BC67E5D1A4090AA00F29ABA /* progress_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = progress_dialog.h; path = ../progress_dialog.h; sourceTree = "<group>"; };
5BC67E5E1A4090BD00F29ABA /* progress_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = progress_dialog.cc; path = ../progress_dialog.cc; sourceTree = "<group>"; };
95176F781A08E6D800E32046 /* file_sample_rate_mismatch_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = file_sample_rate_mismatch_dialog.h; path = ../file_sample_rate_mismatch_dialog.h; sourceTree = "<group>"; };
95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = file_sample_rate_mismatch_dialog.cc; path = ../file_sample_rate_mismatch_dialog.cc; sourceTree = "<group>"; };
95176F7D1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = file_sample_rate_mismatch_dialog.xml; sourceTree = "<group>"; };
@ -1235,6 +1240,7 @@
43279040194EFF38003C9FEA /* source */ = {
isa = PBXGroup;
children = (
5BC67E5E1A4090BD00F29ABA /* progress_dialog.cc */,
957EF44A1A30BFB300F1500E /* waves_message_dialog.cc */,
95176F8E1A092A5B00E32046 /* yes_no_dialog.cc */,
95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */,
@ -1837,6 +1843,7 @@
43279429194F0062003C9FEA /* ui */ = {
isa = PBXGroup;
children = (
5BC67E581A408FCE00F29ABA /* progress_dialog.xml */,
95F9DFD81A35F3310007E953 /* waves_clean_up_dialog.xml */,
95F9DFD91A35F3310007E953 /* waves_connect_to_backend_error_dialog.xml */,
95F9DFDA1A35F3310007E953 /* waves_excessive_split_dialog.xml */,
@ -1892,6 +1899,7 @@
43279480194F00CB003C9FEA /* headers */ = {
isa = PBXGroup;
children = (
5BC67E5D1A4090AA00F29ABA /* progress_dialog.h */,
957EF44F1A30BFBF00F1500E /* waves_message_dialog.h */,
95176F8C1A092A4700E32046 /* yes_no_dialog.h */,
95176F781A08E6D800E32046 /* file_sample_rate_mismatch_dialog.h */,
@ -2575,6 +2583,7 @@
952E0B3C1A0A1D7000F375D0 /* buildlog.txt in Resources */,
95F9DFD71A35A8BD0007E953 /* waves_message_dialog.xml in Resources */,
CEB9D794197516BE00B21780 /* inspector_gain_meter.xml in Resources */,
5BC67E591A408FCE00F29ABA /* progress_dialog.xml in Resources */,
CEB9D795197516BE00B21780 /* master_ui_gain_meter.xml in Resources */,
CEB9D796197516BE00B21780 /* master_ui.xml in Resources */,
CEB9D797197516BE00B21780 /* meter_strip.xml in Resources */,
@ -2617,6 +2626,7 @@
CE294C7619CAD54500D12768 /* mixer_bridge_view.cc in Sources */,
CE294C7719CAD54500D12768 /* open_file_dialog_nix.cc in Sources */,
CE294C7819CAD54500D12768 /* open_file_dialog_windows.cc in Sources */,
5BC67E5F1A4090BD00F29ABA /* progress_dialog.cc in Sources */,
CE294C7919CAD54500D12768 /* ruler_dialog.cc in Sources */,
CE294C7A19CAD54500D12768 /* soundcloud_export_selector.cc in Sources */,
CE294C7B19CAD54500D12768 /* waves_dropdown.cc in Sources */,

View file

@ -0,0 +1,99 @@
/*
Copyright (C) 2014 Waves Audio Ltd.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtkmm/label.h>
#include <gtkmm/progressbar.h>
#include "progress_dialog.h"
#include "i18n.h"
using namespace Gtk;
//ProgressDialog *ProgressDialog::theProgressDialog = 0;
ProgressDialog::ProgressDialog (const std::string& title,
const std::string& top_message,
const std::string& progress_message,
const std::string& bottom_message)
: WavesDialog ( _("progress_dialog.xml"), true, false )
, _top_label ( get_label ("top_label") )
, _bottom_label ( get_label ("bottom_label") )
, _progress_bar (get_progressbar ("progress_bar"))
{
init (title, top_message, progress_message, bottom_message);
}
ProgressDialog*
ProgressDialog::instance ()
{
static ProgressDialog theProgressDialog;
return &theProgressDialog;
}
void
ProgressDialog::init (const std::string& title,
const std::string& top_message,
const std::string& progress_message,
const std::string& bottom_message)
{
set_modal (true);
set_resizable (false);
set_position (Gtk::WIN_POS_CENTER_ALWAYS);
set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL);
set_title (title);
set_top_label (top_message);
set_progress_label (progress_message);
set_bottom_label (bottom_message);
}
void
ProgressDialog::set_top_label (std::string message)
{
_top_label.set_text (message);
}
void
ProgressDialog::set_progress_label (std::string message)
{
_progress_bar.set_text (message);
}
void
ProgressDialog::set_bottom_label (std::string message)
{
_bottom_label.set_text (message);
}
void
ProgressDialog::update_info (double new_progress, const char* top_message, const char* progress_message, const char* bottom_message)
{
update_progress_gui (new_progress);
if (top_message)
set_top_label (top_message);
if (progress_message)
set_progress_label (progress_message);
if (bottom_message)
set_bottom_label (bottom_message);
}
void
ProgressDialog::update_progress_gui (float p)
{
_progress_bar.set_fraction (p);
}

View file

@ -0,0 +1,57 @@
/*
Copyright (C) 2014 Waves Audio Ltd.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __progress_dialog_h__
#define __progress_dialog_h__
#include "waves_dialog.h"
#include "progress_reporter.h"
namespace Gtk {
class Label;
class ProgressBar;
}
class ProgressDialog : public WavesDialog, public ProgressReporter
{
public:
static ProgressDialog *instance ();
void set_top_label (std::string message);
void set_progress_label (std::string message);
void set_bottom_label (std::string message);
void update_info (double new_progress, const char* top_message, const char* progress_message, const char* bottom_message);
private:
ProgressDialog (const std::string& title="",
const std::string& top_message="",
const std::string& progress_message="",
const std::string& bottom_message="");
~ProgressDialog () {}
void update_progress_gui (float);
void init (const std::string& title,
const std::string& top_message,
const std::string& progress_message,
const std::string& bottom_message);
Gtk::Label& _top_label;
Gtk::Label& _bottom_label;
Gtk::ProgressBar& _progress_bar;
};
#endif /* __progress_dialog_h__ */

View file

@ -225,8 +225,6 @@ Splash::message (const string& msg)
str += Glib::Markup::escape_text (msg);
str += "</b>";
show ();
layout->set_markup (str);
Glib::RefPtr<Gdk::Window> win = darea.get_window();

View file

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<Dialog title=""
resizeable="False"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
fgnormal="#6D6E72"
borderwidth="5 5 5 5"
bordercolor="#000000">
<style name="generic_control"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
fgnormal="#6D6E72"
/>
<EventBox bgnormal="#EDECE8">
<VBox width="320">
<Label id="top_label"
style="generic_control"
vertalignment="center"
text="---"
height="28"/>
<VBox height="4"/>
<HBox width="320">
<VBox width="13"/>
<Layout width="294"
height="18">
<ProgressBar id="progress_bar"
winfont ="Arial 11"
macfont ="Helvetica 11"
fgnormal="#ffffff"
fgactive="#ffffff"
fghovered="#ffffff"
text="from xml"
bgnormal="#6B6B6B"
bgselected="#20B2AA"
width="294"
height="18"
x="0"
y="0"
visible="true"/>
<VBox x="0"
y="0"
width="294"
height="18">
</VBox>
</Layout>
</HBox>
<VBox height="9"/>
<Label id="bottom_label"
style="generic_control"
winfont ="Arial 10"
macfont ="Helvetica 10"
vertalignment="center"
text="info-2"
height="10"/>
<VBox height="11"/>
<HBox width="320">
<VBox width="120"/>
</HBox>
<VBox height="7"/>
</VBox>
</EventBox>
</Dialog>

View file

@ -672,6 +672,12 @@ WavesUI::set_attributes (Gtk::Widget& widget, const XMLNode& definition, const X
widget.unset_bg(Gtk::STATE_ACTIVE);
widget.modify_bg(Gtk::STATE_ACTIVE, Gdk::Color(property));
}
property = xml_property (definition, "bgselected", styles, "");
if (!property.empty ()) {
widget.unset_bg(Gtk::STATE_SELECTED);
widget.modify_bg(Gtk::STATE_SELECTED, Gdk::Color(property));
}
property = xml_property (definition, "bghover", styles, "");
if (!property.empty ()) {

View file

@ -202,6 +202,7 @@ gtk2_ardour_sources = [
'port_matrix_row_labels.cc',
'processor_box.cc',
'patch_change_dialog.cc',
'progress_dialog.cc',
'progress_reporter.cc',
'prompter.cc',
'public_editor.cc',