Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef WITH_VIDEOTIMELINE
-
#include <cstdio>
#include <cmath>
#include "ardour/template_utils.h"
#include "ardour/session.h"
+#ifdef interface
+#undef interface
+#endif
+
#include "video_server_dialog.h"
-#include "i18n.h"
+#include "utils_videotl.h"
+#include "video_tool_paths.h"
+#include "pbd/i18n.h"
+
+#ifdef PLATFORM_WINDOWS
+#include <windows.h>
+#endif
using namespace Gtk;
using namespace std;
using namespace PBD;
using namespace ARDOUR;
+using namespace VideoUtils;
VideoServerDialog::VideoServerDialog (Session* s)
: ArdourDialog (_("Launch Video Server"))
set_session (s);
set_name ("VideoServerDialog");
- set_position (Gtk::WIN_POS_MOUSE);
set_modal (true);
set_skip_taskbar_hint (true);
set_resizable (false);
HBox* docroot_hbox = manage (new HBox);
path_entry.set_width_chars(38);
- path_browse_button.set_name ("PaddedButton");
path_entry.set_text("/usr/bin/harvid");
docroot_entry.set_width_chars(38);
docroot_entry.set_text(Config->get_video_server_docroot());
- docroot_browse_button.set_name ("PaddedButton");
- listenaddr_combo.set_name ("PaddedButton");
#ifndef __APPLE__
/* Note: on OSX icsd is not able to bind to IPv4 localhost */
listenaddr_combo.append_text("127.0.0.1");
listenaddr_combo.append_text("0.0.0.0");
listenaddr_combo.set_active(0);
- std::string icsd_file_path;
- if (find_file_in_search_path (PBD::SearchPath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) {
- path_entry.set_text(icsd_file_path);
- }
- else if (find_file_in_search_path (PBD::SearchPath(Glib::getenv("PATH")), X_("icsd"), icsd_file_path)) {
- path_entry.set_text(icsd_file_path);
- }
- else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) {
- path_entry.set_text(X_("C:\\Program Files\\harvid\\harvid.exe"));
+ std::string harvid_exe;
+ if (ArdourVideoToolPaths::harvid_exe(harvid_exe)) {
+ path_entry.set_text(harvid_exe);
+ } else {
+ PBD::warning <<
+ string_compose(
+ _("The external video server 'harvid' can not be found.\n"
+ "The tool is included with the %1 releases from ardour.org, "
+ "alternatively you can download it from http://x42.github.com/harvid/ "
+ "or acquire it from your distribution.\n"
+ "\n"
+ "see also http://manual.ardour.org/video-timeline/setup/"
+ ), PROGRAM_NAME)
+ << endmsg;
}
- else {
- PBD::warning << _("The external video server 'harvid' can not be found, see https://github.com/x42/harvid") << endmsg;
- }
-
if (docroot_entry.get_text().empty()) {
std::string docroot = Glib::path_get_dirname(_session->session_directory().root_path());
t->attach (*l, 0, 1, 2, 3, FILL);
t->attach (cachesize_spinner, 1, 2, 2, 3);
- l = manage (new Label (_("Ardour relies on an external Video Server for the videotimeline. The server configured in Edit -> Prefereces -> Video is not reachable. Do you want ardour to launch 'harvid' on this machine?"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
+ l = manage (new Label (string_compose(
+ _("%1 relies on an external video server for the videotimeline.\nThe server configured in Edit -> Preferences -> Video is not reachable.\nDo you want %1 to launch 'harvid' on this machine?"), PROGRAM_NAME)
+ , Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
+ l->set_max_width_chars(80);
l->set_line_wrap();
- vbox->pack_start (*l, false, true, 4);
+ vbox->pack_start (*l, true, true, 4);
vbox->pack_start (*path_hbox, false, false);
- vbox->pack_start (*docroot_hbox, false, false);
+ if (Config->get_video_advanced_setup()){
+ vbox->pack_start (*docroot_hbox, false, false);
+ } else {
+#ifndef PLATFORM_WINDOWS
+ docroot_entry.set_text(X_("/"));
+#else
+ docroot_entry.set_text(X_("C:\\"));
+#endif
+ listenport_spinner.set_sensitive(false);
+ }
vbox->pack_start (*options_box, false, true);
get_vbox()->set_spacing (4);
get_vbox()->pack_start (*vbox, false, false);
get_vbox()->pack_start (showagain_checkbox, false, false);
- showagain_checkbox.set_active(false);
+ showagain_checkbox.set_active(!Config->get_show_video_server_dialog());
path_browse_button.signal_clicked().connect (sigc::mem_fun (*this, &VideoServerDialog::open_path_dialog));
docroot_browse_button.signal_clicked().connect (sigc::mem_fun (*this, &VideoServerDialog::open_docroot_dialog));
if (result == Gtk::RESPONSE_OK) {
std::string dirname = dialog.get_filename();
+ if (dirname.empty() || dirname.at(dirname.length()-1) != G_DIR_SEPARATOR) {
+ dirname += "/";
+ }
+
if (dirname.length()) {
docroot_entry.set_text (dirname);
}
}
}
-#endif /* WITH_VIDEOTIMELINE */
+std::string
+VideoServerDialog::get_docroot () {
+ return docroot_entry.get_text();
+}