using std::setfill;
using std::min;
using std::make_pair;
+using std::list;
using std::cout;
using boost::shared_ptr;
using boost::lexical_cast;
void
Film::make_kdms (
list<shared_ptr<Screen> >,
- boost::locale::date_time from,
- boost::locale::date_time until,
+ boost::posix_time::ptime from,
+ boost::posix_time::ptime until,
string directory
) const
{
#include <boost/thread.hpp>
#include <boost/signals2.hpp>
#include <boost/enable_shared_from_this.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
extern "C" {
#include <libavcodec/avcodec.h>
}
void make_kdms (
std::list<boost::shared_ptr<Screen> >,
- boost::locale::date_time from,
- boost::locale::date_time until,
+ boost::posix_time::ptime from,
+ boost::posix_time::ptime until,
std::string directory
- );
+ ) const;
enum Property {
NONE,
void jobs_make_kdms (wxCommandEvent &)
{
+ if (!film) {
+ return;
+ }
+
KDMDialog* d = new KDMDialog (this);
if (d->ShowModal () == wxID_OK) {
- _film->make_kdms (
+ film->make_kdms (
d->screens (),
d->from (),
d->until (),
list<pair<wxTreeItemId, shared_ptr<Cinema> > > cinemas = selected_cinemas ();
for (list<pair<wxTreeItemId, shared_ptr<Cinema> > >::iterator i = cinemas.begin(); i != cinemas.end(); ++i) {
- for (list<Screen>::iterator j = i->second->screens.begin(); j != i->second->screens.end(); ++j) {
+ for (list<shared_ptr<Screen> >::iterator j = i->second->screens.begin(); j != i->second->screens.end(); ++j) {
s.push_back (*j);
}
}
}
s.sort ();
- s.uniq ();
+ s.unique ();
return s;
}
-boost::locale::date_time
+boost::posix_time::ptime
KDMDialog::from () const
{
+ return posix_time (_from_date, _from_time);
+}
+boost::posix_time::ptime
+KDMDialog::posix_time (wxDatePickerCtrl* date_picker, wxTimePickerCtrl* time_picker)
+{
+ wxDateTime const date = date_picker->GetValue ();
+ wxDateTime const time = time_picker->GetValue ();
+ return boost::posix_time::ptime (
+ boost::gregorian::date (date.GetYear(), date.GetMonth() + 1, date.GetDay()),
+ boost::posix_time::time_duration (time.GetHour(), time.GetMinute(), time.GetSecond())
+ );
}
-boost::locale::date_time
+boost::posix_time::ptime
KDMDialog::until () const
{
-
+ return posix_time (_until_date, _until_time);
}
string
#include <map>
#include <boost/shared_ptr.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <wx/wx.h>
#include <wx/treectrl.h>
KDMDialog (wxWindow *);
std::list<boost::shared_ptr<Screen> > screens () const;
- boost::local::date_time from () const;
- boost::local::date_time until () const;
+ boost::posix_time::ptime from () const;
+ boost::posix_time::ptime until () const;
std::string directory () const;
private:
std::list<std::pair<wxTreeItemId, boost::shared_ptr<Cinema> > > selected_cinemas () const;
std::list<std::pair<wxTreeItemId, boost::shared_ptr<Screen> > > selected_screens () const;
void setup_sensitivity ();
+
+ static boost::posix_time::ptime posix_time (wxDatePickerCtrl *, wxTimePickerCtrl *);
wxTreeCtrl* _targets;
wxButton* _add_cinema;