-bb2bdf010dd2ea813f9ac7af5023ce39cf14f572
c065accc4b4c6ed268e7fccea77a958473be7785
7ba9dcdbfe8f0d94ad9887843995c152c45dfe9e
e30fd8d
_threads.push_back (new boost::thread (boost::bind (&Encoder::encoder_thread, this, optional<ServerDescription> ())));
}
- ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1));
+ if (!ServerFinder::instance()->disabled ()) {
+ _server_found_connection = ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1));
+ }
}
void
boost::shared_ptr<Writer> _writer;
Waker _waker;
+
+ boost::signals2::scoped_connection _server_found_connection;
};
#endif
{
set_isdcf_date_today ();
- _playlist->Changed.connect (bind (&Film::playlist_changed, this));
- _playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2));
+ _playlist_changed_connection = _playlist->Changed.connect (bind (&Film::playlist_changed, this));
+ _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2));
/* Make state.directory a complete path without ..s (where possible)
(Code swiped from Adam Bowen on stackoverflow)
_playlist->set_sequence_video (_sequence_video);
}
+Film::~Film ()
+{
+ for (list<boost::signals2::connection>::const_iterator i = _job_connections.begin(); i != _job_connections.end(); ++i) {
+ i->disconnect ();
+ }
+}
+
string
Film::video_identifier () const
{
}
shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
- j->Finished.connect (bind (&Film::maybe_add_content, this, boost::weak_ptr<Job> (j), boost::weak_ptr<Content> (c)));
+
+ _job_connections.push_back (
+ j->Finished.connect (bind (&Film::maybe_add_content, this, boost::weak_ptr<Job> (j), boost::weak_ptr<Content> (c)))
+ );
+
JobManager::instance()->add (j);
}
{
public:
Film (boost::filesystem::path, bool log = true);
+ ~Film ();
boost::filesystem::path info_dir () const;
boost::filesystem::path j2c_path (int, Eyes, bool) const;
/** true if our state has changed since we last saved it */
mutable bool _dirty;
+ boost::signals2::scoped_connection _playlist_changed_connection;
+ boost::signals2::scoped_connection _playlist_content_changed_connection;
+ std::list<boost::signals2::connection> _job_connections;
+
friend struct paths_test;
friend struct film_metadata_test;
};
return i != _servers.end ();
}
-void
+boost::signals2::connection
ServerFinder::connect (boost::function<void (ServerDescription)> fn)
{
- if (_disabled) {
- return;
- }
-
boost::mutex::scoped_lock lm (_mutex);
/* Emit the current list of servers */
fn (*i);
}
- ServerFound.connect (fn);
+ return ServerFound.connect (fn);
}
ServerFinder*
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
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
class ServerFinder : public ExceptionStore
{
public:
- void connect (boost::function<void (ServerDescription)>);
+ boost::signals2::connection connect (boost::function<void (ServerDescription)>);
static ServerFinder* instance ();
static void drop ();
_disabled = true;
}
+ bool disabled () const {
+ return _disabled;
+ }
+
private:
ServerFinder ();
~ServerFinder ();
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
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
_gain_calculate_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&AudioPanel::gain_calculate_button_clicked, this));
_processor->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&AudioPanel::processor_changed, this));
- _mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1));
+ _mapping_connection = _mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1));
}
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
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
AudioMappingView* _mapping;
wxStaticText* _description;
AudioDialog* _audio_dialog;
+
+ boost::signals2::scoped_connection _mapping_connection;
};
_issuer->SetValue (std_to_wx (config->dcp_issuer ()));
_issuer->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DefaultsPage::issuer_changed, this));
- config->Changed.connect (boost::bind (&DefaultsPage::config_changed, this));
+ _config_connection = config->Changed.connect (boost::bind (&DefaultsPage::config_changed, this));
return panel;
}
wxChoice* _container;
wxChoice* _dcp_content_type;
wxTextCtrl* _issuer;
+
+ boost::signals2::scoped_connection _config_connection;
};
class EncodingServersPage : public wxPreferencesPage, public Page
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
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
_preset_check->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ContentColourConversionDialog::preset_check_clicked, this));
_preset_choice->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&ContentColourConversionDialog::preset_choice_changed, this));
- _editor->Changed.connect (boost::bind (&ContentColourConversionDialog::check_for_preset, this));
+ _editor_connection = _editor->Changed.connect (boost::bind (&ContentColourConversionDialog::check_for_preset, this));
vector<PresetColourConversion> presets = Config::instance()->colour_conversions ();
for (vector<PresetColourConversion>::const_iterator i = presets.begin(); i != presets.end(); ++i) {
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
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
wxChoice* _preset_choice;
ColourConversionEditor* _editor;
bool _setting;
+
+ boost::signals2::scoped_connection _editor_connection;
};
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
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
shared_ptr<Job> j (new ExamineContentJob (film, content));
- j->Finished.connect (
+ _job_connection = j->Finished.connect (
bind (
&ContentMenu::maybe_found_missing,
this,
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
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
wxMenuItem* _re_examine;
wxMenuItem* _kdm;
wxMenuItem* _remove;
+
+ boost::signals2::scoped_connection _job_connection;
};
#endif
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
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
boost::shared_ptr<Film> film = _film.lock ();
if (film) {
- film->Changed.connect (boost::bind (&HintsDialog::film_changed, this));
- film->ContentChanged.connect (boost::bind (&HintsDialog::film_changed, this));
+ _film_changed_connection = film->Changed.connect (boost::bind (&HintsDialog::film_changed, this));
+ _film_content_changed_connection = film->ContentChanged.connect (boost::bind (&HintsDialog::film_changed, this));
}
film_changed ();
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
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
boost::weak_ptr<Film> _film;
wxRichTextCtrl* _text;
+
+ boost::signals2::scoped_connection _film_changed_connection;
+ boost::signals2::scoped_connection _film_content_changed_connection;
};
table->Insert (n, _details, 1, wxALIGN_CENTER_VERTICAL | wxALL, 6);
++n;
- job->Progress.connect (boost::bind (&JobRecord::progress, this));
- job->Finished.connect (boost::bind (&JobRecord::finished, this));
+ _progress_connection = job->Progress.connect (boost::bind (&JobRecord::progress, this));
+ _finished_connection = job->Finished.connect (boost::bind (&JobRecord::finished, this));
table->Layout ();
panel->FitInside ();
wxButton* _pause;
wxButton* _details;
std::string _last_name;
+
+ boost::signals2::scoped_connection _progress_connection;
+ boost::signals2::scoped_connection _finished_connection;
};
/** Must be called in the GUI thread */
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
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
add (_("Frames already encoded"), true);
_encoded = add (new ThreadedStaticText (this, _("counting..."), boost::bind (&PropertiesDialog::frames_already_encoded, this)));
- _encoded->Finished.connect (boost::bind (&PropertiesDialog::layout, this));
+ _encoded_connection = _encoded->Finished.connect (boost::bind (&PropertiesDialog::layout, this));
_frames->SetLabel (std_to_wx (lexical_cast<string> (_film->length().frames (_film->video_frame_rate ()))));
double const disk = double (_film->required_disk_space()) / 1073741824.0f;
SafeStringStream s;
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
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
wxStaticText* _frames;
wxStaticText* _disk;
ThreadedStaticText* _encoded;
+
+ boost::signals2::scoped_connection _encoded_connection;
};
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
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
s->Layout ();
s->SetSizeHints (this);
- ServerFinder::instance()->connect (boost::bind (&ServersListDialog::server_found, this, _1));
+ _server_finder_connection = ServerFinder::instance()->connect (boost::bind (&ServersListDialog::server_found, this, _1));
}
void
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
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
std::list<ServerDescription> _servers;
wxListCtrl* _list;
+
+ boost::signals2::scoped_connection _server_finder_connection;
};