#include "wx/wx_ui_signaller.h"
#include "wx/about_dialog.h"
#include "wx/kdm_dialog.h"
+#include "wx/servers_list_dialog.h"
#include "lib/film.h"
#include "lib/config.h"
#include "lib/util.h"
ID_jobs_make_kdms,
ID_jobs_send_dcp_to_tms,
ID_jobs_show_dcp,
+ ID_tools_encoding_servers,
};
void
add_item (jobs_menu, _("&Send DCP to TMS"), ID_jobs_send_dcp_to_tms, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_DCP);
add_item (jobs_menu, _("S&how DCP"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_DCP);
+ wxMenu* tools = new wxMenu;
+ add_item (tools, _("Encoding Servers..."), ID_tools_encoding_servers, 0);
+
wxMenu* help = new wxMenu;
#ifdef __WXOSX__
add_item (help, _("About DCP-o-matic"), wxID_ABOUT, ALWAYS);
m->Append (edit, _("&Edit"));
#endif
m->Append (jobs_menu, _("&Jobs"));
+ m->Append (tools, _("&Tools"));
m->Append (help, _("&Help"));
}
public:
Frame (wxString const & title)
: wxFrame (NULL, -1, title)
+ , _servers_list_dialog (0)
{
wxMenuBar* bar = new wxMenuBar;
setup_menu (bar);
SetMenuBar (bar);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_new, this), ID_file_new);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_open, this), ID_file_open);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_save, this), ID_file_save);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_properties, this), ID_file_properties);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_exit, this), wxID_EXIT);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::edit_preferences, this), wxID_PREFERENCES);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_make_dcp, this), ID_jobs_make_dcp);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_make_kdms, this), ID_jobs_make_kdms);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_send_dcp_to_tms, this), ID_jobs_send_dcp_to_tms);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_show_dcp, this), ID_jobs_show_dcp);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::help_about, this), wxID_ABOUT);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_new, this), ID_file_new);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_open, this), ID_file_open);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_save, this), ID_file_save);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_properties, this), ID_file_properties);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_exit, this), wxID_EXIT);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::edit_preferences, this), wxID_PREFERENCES);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_make_dcp, this), ID_jobs_make_dcp);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_make_kdms, this), ID_jobs_make_kdms);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_send_dcp_to_tms, this), ID_jobs_send_dcp_to_tms);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_show_dcp, this), ID_jobs_show_dcp);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::tools_encoding_servers, this), ID_tools_encoding_servers);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::help_about, this), wxID_ABOUT);
Bind (wxEVT_CLOSE_WINDOW, boost::bind (&Frame::close, this, _1));
#endif
}
+ void tools_encoding_servers ()
+ {
+ if (!_servers_list_dialog) {
+ _servers_list_dialog = new ServersListDialog (this);
+ }
+
+ _servers_list_dialog->Show ();
+ }
+
void help_about ()
{
AboutDialog* d = new AboutDialog (this);
}
ev.Skip ();
- }
+ }
+
+ ServersListDialog* _servers_list_dialog;
};
static const wxCmdLineEntryDesc command_line_description[] = {
--- /dev/null
+/*
+ Copyright (C) 2013 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/lexical_cast.hpp>
+#include "servers_list_dialog.h"
+#include "wx_util.h"
+
+using std::list;
+using std::string;
+using boost::lexical_cast;
+
+ServersListDialog::ServersListDialog (wxWindow* parent)
+ : wxDialog (parent, wxID_ANY, _("Encoding Servers"))
+{
+ wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
+ SetSizer (s);
+
+ _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize (400, 200), wxLC_REPORT | wxLC_SINGLE_SEL);
+
+ {
+ wxListItem ip;
+ ip.SetId (0);
+ ip.SetText (_("Host"));
+ ip.SetWidth (300);
+ _list->InsertColumn (0, ip);
+ }
+
+ {
+ wxListItem ip;
+ ip.SetId (1);
+ ip.SetText (_("Threads"));
+ ip.SetWidth (100);
+ _list->InsertColumn (1, ip);
+ }
+
+ s->Add (_list, 1, wxEXPAND | wxALL, 12);
+
+ wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+ if (buttons) {
+ s->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
+
+ SetSizer (s);
+ s->Layout ();
+ s->SetSizeHints (this);
+
+ _server_finder.ServerFound.connect (boost::bind (&ServersListDialog::server_found, this, _1));
+}
+
+void
+ServersListDialog::server_found (ServerDescription s)
+{
+ list<ServerDescription>::const_iterator i = _servers.begin();
+ while (i != _servers.end() && i->host_name() != s.host_name()) {
+ ++i;
+ }
+
+ if (i != _servers.end ()) {
+ return;
+ }
+
+ wxListItem list_item;
+ int const n = _list->GetItemCount ();
+ list_item.SetId (n);
+ _list->InsertItem (list_item);
+
+ _list->SetItem (n, 0, std_to_wx (s.host_name ()));
+ _list->SetItem (n, 1, std_to_wx (lexical_cast<string> (s.threads ())));
+
+ _servers.push_back (s);
+}
--- /dev/null
+/*
+ Copyright (C) 2013 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/wx.h>
+#include <wx/listctrl.h>
+#include "lib/server_finder.h"
+
+class ServersListDialog : public wxDialog
+{
+public:
+ ServersListDialog (wxWindow *);
+
+private:
+ void server_found (ServerDescription);
+
+ ServerFinder _server_finder;
+ std::list<ServerDescription> _servers;
+ wxListCtrl* _list;
+};