using std::cout;
+using std::list;
using std::make_pair;
using std::make_shared;
using std::map;
if (dialog->ShowModal() == wxID_OK) {
auto cinema = make_shared<Cinema>(dialog->name(), dialog->emails(), dialog->notes(), dialog->utc_offset_hour(), dialog->utc_offset_minute());
- auto cinemas = Config::instance()->cinemas();
- cinemas.sort(
- [this](shared_ptr<Cinema> a, shared_ptr<Cinema> b) { return _collator.compare(a->name, b->name) < 0; }
- );
+ auto cinemas = sorted_cinemas();
try {
_ignore_cinemas_changed = true;
}
-void
-ScreensPanel::add_cinemas ()
+list<shared_ptr<Cinema>>
+ScreensPanel::sorted_cinemas() const
{
auto cinemas = Config::instance()->cinemas();
+
cinemas.sort(
[this](shared_ptr<Cinema> a, shared_ptr<Cinema> b) { return _collator.compare(a->name, b->name) < 0; }
);
- for (auto cinema: cinemas) {
+ return cinemas;
+}
+
+
+void
+ScreensPanel::add_cinemas ()
+{
+ for (auto cinema: sorted_cinemas()) {
add_cinema (cinema, wxTLI_LAST);
}
}
void config_changed(Config::Property);
void convert_to_lower(std::string& s);
bool matches_search(std::shared_ptr<const Cinema> cinema, std::string lower_case_search);
+ std::list<std::shared_ptr<Cinema>> sorted_cinemas() const;
std::shared_ptr<Cinema> item_to_cinema (wxTreeListItem item) const;
std::shared_ptr<dcpomatic::Screen> item_to_screen (wxTreeListItem item) const;