Show Soundcloud credentials and upload options only when required

A slightly hacky patch to make the Soundcloud username & password and the
upload options only become visible when at least one export format is
chosen for upload to Soundcloud.

I think that changing ExportDialog::soundcloud_selector to a
boost::shared_ptr is the right thing to do, but I must confess to having
only a hazy understanding of what boost::scoped_ptr was doing in the first
place.

Also it feels a bit wrong to be passing a pointer to ExportDialog's
SoundcloudExportSelector around, but I can't (for the moment, at least)
think of any better way to affect its visibility from inside
ExportFileNotebook.
This commit is contained in:
Colin Fletcher 2014-05-31 14:47:11 +01:00
parent 5abf3624f4
commit 60349bcee6
4 changed files with 16 additions and 2 deletions

View File

@ -134,6 +134,8 @@ ExportDialog::init ()
cancel_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::close_dialog));
export_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::do_export));
file_notebook->soundcloud_export_selector = soundcloud_selector;
/* Done! */
show_all_children ();

View File

@ -81,7 +81,8 @@ class ExportDialog : public ArdourDialog, public PBD::ScopedConnectionList
boost::scoped_ptr<ExportTimespanSelector> timespan_selector;
boost::scoped_ptr<ExportChannelSelector> channel_selector;
boost::scoped_ptr<ExportFileNotebook> file_notebook;
boost::scoped_ptr<SoundcloudExportSelector> soundcloud_selector;
boost::shared_ptr<SoundcloudExportSelector> soundcloud_selector;
Gtk::VBox warning_widget;
Gtk::VBox progress_widget;

View File

@ -94,15 +94,23 @@ void
ExportFileNotebook::update_soundcloud_upload ()
{
int i;
bool show_credentials_entry = false;
ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats ();
ExportProfileManager::FormatStateList::const_iterator format_it;
for (i = 0, format_it = formats.begin(); format_it != formats.end(); ++i, ++format_it) {
FilePage * page;
if ((page = dynamic_cast<FilePage *> (get_nth_page (i)))) {
(*format_it)->format->set_soundcloud_upload (page->get_soundcloud_upload ());
bool this_soundcloud_upload = page->get_soundcloud_upload ();
(*format_it)->format->set_soundcloud_upload (this_soundcloud_upload);
if (this_soundcloud_upload) {
show_credentials_entry = true;
}
}
}
soundcloud_export_selector->set_visible (show_credentials_entry);
}
void

View File

@ -29,6 +29,7 @@
#include "export_format_selector.h"
#include "export_filename_selector.h"
#include "soundcloud_export_selector.h"
class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr
{
@ -40,6 +41,8 @@ class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr
void sync_with_manager ();
void update_example_filenames();
boost::shared_ptr<SoundcloudExportSelector> soundcloud_export_selector;
sigc::signal<void> CriticalSelectionChanged;
private: