X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Futils_videotl.cc;h=b62ac9433c93813e30dfcc2831090ee93ba02191;hb=f5c717e893a7def1cee70238cc7b9f55e1ff0b0e;hp=2e250b2cee29321b140419e6f815afa2c9a2e216;hpb=25a6296f865620d5013cd634e693f7179e7edc84;p=ardour.git diff --git a/gtk2_ardour/utils_videotl.cc b/gtk2_ardour/utils_videotl.cc index 2e250b2cee..b62ac9433c 100644 --- a/gtk2_ardour/utils_videotl.cc +++ b/gtk2_ardour/utils_videotl.cc @@ -28,7 +28,15 @@ #include "ardour/session_directory.h" #include "video_image_frame.h" #include "utils_videotl.h" +#include "utils.h" +#ifdef WAF_BUILD +#include "gtk2ardour-version.h" +#endif + +#ifndef ARDOUR_CURL_TIMEOUT +#define ARDOUR_CURL_TIMEOUT (60) +#endif #include "i18n.h" using namespace Gtk; @@ -38,7 +46,7 @@ using namespace ARDOUR; using namespace VideoUtils; bool -VideoUtils::confirm_video_outfn (std::string outfn, std::string docroot) +VideoUtils::confirm_video_outfn (Gtk::Window& parent, std::string outfn, std::string docroot) { /* replace docroot's '/' to G_DIR_SEPARATOR for the comparison */ size_t look_here = 0; @@ -60,13 +68,13 @@ VideoUtils::confirm_video_outfn (std::string outfn, std::string docroot) } if (Glib::file_test(outfn, Glib::FILE_TEST_EXISTS)) { - ArdourDialog confirm (_("Confirm Overwrite"), true); - Label m (_("A file with the same name already exists. Do you want to overwrite it?")); - confirm.get_vbox()->pack_start (m, true, true); - confirm.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - confirm.add_button (_("Overwrite"), Gtk::RESPONSE_ACCEPT); - confirm.show_all (); - if (confirm.run() == RESPONSE_CANCEL) { return false; } + bool overwrite = ARDOUR_UI_UTILS::overwrite_file_dialog (parent, + _("Confirm Overwrite"), + _("A file with the same name already exists. Do you want to overwrite it?")); + + if (!overwrite) { + return false; + } } std::string dir = Glib::path_get_dirname (outfn); @@ -98,7 +106,11 @@ VideoUtils::video_get_docroot (ARDOUR::RCConfiguration* config) if (config->get_video_advanced_setup()) { return config->get_video_server_docroot(); } +#ifndef PLATFORM_WINDOWS return X_("/"); +#else + return X_("C:\\"); +#endif } std::string @@ -107,7 +119,7 @@ VideoUtils::video_get_server_url (ARDOUR::RCConfiguration* config) if (config->get_video_advanced_setup()) { return config->get_video_server_url(); } - return X_("http://localhost:1554"); + return X_("http://127.0.0.1:1554"); } @@ -143,7 +155,7 @@ VideoUtils::get_file_extension (const std::string infile) std::string VideoUtils::video_dest_file (const std::string dir, const std::string infile) { - return dir + "a3_" + strip_file_extension(Glib::path_get_basename(infile)) + ".avi"; + return Glib::build_filename(dir, strip_file_extension(Glib::path_get_basename(infile)) + ".avi"); } std::string @@ -151,6 +163,13 @@ VideoUtils::video_map_path (std::string server_docroot, std::string filepath) { std::string rv = filepath; + /* strip docroot */ + if (server_docroot.length() > 0) { + if (rv.compare(0, server_docroot.length(), server_docroot) == 0 ) { + rv = rv.substr(server_docroot.length()); + } + } + /* replace all G_DIR_SEPARATOR with '/' */ size_t look_here = 0; size_t found_here; @@ -159,13 +178,6 @@ VideoUtils::video_map_path (std::string server_docroot, std::string filepath) look_here = found_here + 1; } - /* strip docroot */ - if (server_docroot.length() > 0) { - if (rv.compare(0, server_docroot.length(), server_docroot) == 0 ) { - rv = rv.substr(server_docroot.length()); - } - } - CURL *curl; char *ue; curl = curl_easy_init(); @@ -337,7 +349,7 @@ extern "C" { curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); - curl_easy_setopt(curl, CURLOPT_USERAGENT, ARDOUR_USER_AGENT); + curl_easy_setopt(curl, CURLOPT_USERAGENT, PROGRAM_NAME VERSIONSTRING); curl_easy_setopt(curl, CURLOPT_TIMEOUT, ARDOUR_CURL_TIMEOUT); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); #ifdef CURLERRORDEBUG