A few KDM dialog fixes.
[dcpomatic.git] / src / wx / kdm_dialog.cc
index 5410f6cec003f7fcedf35c7a817ec927f3952b5d..295287f42a13f323478655f8ac33034a76b25000 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 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
@@ -83,15 +83,20 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
 
        wxFlexGridSizer* table = new wxFlexGridSizer (3, 2, 6);
        add_label_to_sizer (table, this, _("From"), true);
-       _from_date = new wxDatePickerCtrl (this, wxID_ANY);
+       wxDateTime from;
+       from.SetToCurrent ();
+       _from_date = new wxDatePickerCtrl (this, wxID_ANY, from);
        table->Add (_from_date, 1, wxEXPAND);
-       _from_time = new wxTimePickerCtrl (this, wxID_ANY);
+       _from_time = new wxTimePickerCtrl (this, wxID_ANY, from);
        table->Add (_from_time, 1, wxEXPAND);
-       
+
        add_label_to_sizer (table, this, _("Until"), true);
-       _until_date = new wxDatePickerCtrl (this, wxID_ANY);
+       wxDateTime to = from;
+       /* 1 week from now */
+       to.Add (wxDateSpan (0, 0, 1, 0));
+       _until_date = new wxDatePickerCtrl (this, wxID_ANY, to);
        table->Add (_until_date, 1, wxEXPAND);
-       _until_time = new wxTimePickerCtrl (this, wxID_ANY);
+       _until_time = new wxTimePickerCtrl (this, wxID_ANY, to);
        table->Add (_until_time, 1, wxEXPAND);
 
        vertical->Add (table, 0, wxEXPAND | wxALL, 6);
@@ -117,7 +122,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
                }
        }
        
-       table = new wxFlexGridSizer (3, 2, 6);
+       table = new wxFlexGridSizer (2, 2, 6);
 
        _write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
        table->Add (_write_to, 1, wxEXPAND);
@@ -125,13 +130,12 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
 #ifdef DCPOMATIC_USE_OWN_DIR_PICKER
        _folder = new DirPickerCtrl (this); 
 #else  
-       _folder = new wxDirPickerCtrl (this, wxID_ANY);
+       _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
 #endif
 
        _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir());
        
        table->Add (_folder, 1, wxEXPAND);
-       table->AddSpacer (0);
 
        _email = new wxRadioButton (this, wxID_ANY, _("Send by email"));
        table->Add (_email, 1, wxEXPAND);
@@ -144,6 +148,8 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
                vertical->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
 
+       _write_to->SetValue (true);
+
        _targets->Bind       (wxEVT_COMMAND_TREE_SEL_CHANGED, boost::bind (&KDMDialog::setup_sensitivity, this));
 
        _add_cinema->Bind    (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KDMDialog::add_cinema_clicked, this));
@@ -257,8 +263,6 @@ KDMDialog::add_cinema_clicked ()
        Config::instance()->add_cinema (c);
        add_cinema (c);
 
-       Config::instance()->write ();
-       
        d->Destroy ();
 }
 
@@ -278,7 +282,7 @@ KDMDialog::edit_cinema_clicked ()
        c.second->email = d->email ();
        _targets->SetItemText (c.first, std_to_wx (d->name()));
 
-       Config::instance()->write ();
+       Config::instance()->changed ();
 
        d->Destroy ();  
 }
@@ -294,8 +298,6 @@ KDMDialog::remove_cinema_clicked ()
 
        Config::instance()->remove_cinema (c.second);
        _targets->Delete (c.first);
-
-       Config::instance()->write ();   
 }
 
 void
@@ -316,7 +318,7 @@ KDMDialog::add_screen_clicked ()
        c->add_screen (s);
        add_screen (c, s);
 
-       Config::instance()->write ();
+       Config::instance()->changed ();
 
        d->Destroy ();
 }
@@ -337,7 +339,7 @@ KDMDialog::edit_screen_clicked ()
        s.second->certificate = d->certificate ();
        _targets->SetItemText (s.first, std_to_wx (d->name()));
 
-       Config::instance()->write ();
+       Config::instance()->changed ();
 
        d->Destroy ();
 }
@@ -364,7 +366,7 @@ KDMDialog::remove_screen_clicked ()
        i->second->remove_screen (s.second);
        _targets->Delete (s.first);
 
-       Config::instance()->write ();
+       Config::instance()->changed ();
 }
 
 list<shared_ptr<Screen> >