#include <wx/imaglist.h>
#include <wx/spinctrl.h>
#include <wx/preferences.h>
-#include <boost/foreach.hpp>
using std::exception;
using std::cout;
using std::make_pair;
using std::vector;
using boost::optional;
-using boost::shared_ptr;
-using boost::weak_ptr;
+using std::shared_ptr;
+using std::weak_ptr;
using boost::bind;
-using boost::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
}
overall_sizer->Layout ();
+
+ _config_changed_connection = Config::instance()->Changed.connect(boost::bind(&ContentView::update, _content_view));
}
shared_ptr<Content> selected () const
private:
ContentView* _content_view;
+ boost::signals2::scoped_connection _config_changed_connection;
};
}
int N = 0;
- BOOST_FOREACH (shared_ptr<SignalSPL> i, _playlists) {
+ for (auto i: _playlists) {
if (i == playlist) {
_list->SetItem (N, 0, std_to_wx(i->name()));
}
} catch (...) {}
}
- BOOST_FOREACH (shared_ptr<SignalSPL> i, _playlists) {
+ for (auto i: _playlists) {
add_playlist_to_view (i);
}
}
_playlist = playlist;
_list->DeleteAllItems ();
if (_playlist) {
- BOOST_FOREACH (SPLEntry i, _playlist->get()) {
+ for (auto i: _playlist->get()) {
add (i);
}
_name->SetValue (std_to_wx(_playlist->name()));
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_about, this), wxID_ABOUT);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);
+
+ _config_changed_connection = Config::instance()->Changed.connect(boost::bind(&DOMFrame::config_changed, this));
}
private:
m->Append (help, _("&Help"));
}
+
+ void config_changed ()
+ {
+ try {
+ Config::instance()->write_config();
+ } catch (exception& e) {
+ error_dialog (
+ this,
+ wxString::Format (
+ _("Could not write to config file at %s. Your changes have not been saved."),
+ std_to_wx (Config::instance()->cinemas_file().string()).data()
+ )
+ );
+ }
+ }
+
+
ContentDialog* _content_dialog;
PlaylistList* _playlist_list;
PlaylistContent* _playlist_content;
wxPreferencesEditor* _config_dialog;
+ boost::signals2::scoped_connection _config_changed_connection;
};
/** @class App