X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Fsrc%2Fgtkmm%2Fdialog_targetparam.cpp;h=4579b8b85e6d0005b6483060045914e1fe04c493;hb=a5a93271c52a9b4b5eebb8f324d7a2c68f8732be;hp=b6231d0eeddd8ab70f07da0dbed2f6398f97482c;hpb=11ed86e5b0107bd81693d7f00c5aadc5bced3412;p=synfig.git diff --git a/synfig-studio/src/gtkmm/dialog_targetparam.cpp b/synfig-studio/src/gtkmm/dialog_targetparam.cpp index b6231d0..4579b8b 100644 --- a/synfig-studio/src/gtkmm/dialog_targetparam.cpp +++ b/synfig-studio/src/gtkmm/dialog_targetparam.cpp @@ -38,13 +38,47 @@ /* === U S I N G =========================================================== */ using namespace std; -//using namespace etl; using namespace studio; /* === M A C R O S ========================================================= */ /* === G L O B A L S ======================================================= */ - +//! Allowed video codecs +/*! \warning This variable is linked to allowed_video_codecs_description, + * if you change this you must change the other acordingly. + * \warning These codecs are linked to the filename extensions for + * mod_ffmpeg. If you change this you must change the others acordingly. + */ +const char* allowed_video_codecs[] = +{ + "flv", "h263p", "huffyuv", "libtheora", "libx264", "libxvid", + "mjpeg", "mpeg1video", "mpeg2video", "mpeg4", "msmpeg4", + "msmpeg4v1", "msmpeg4v2", "wmv1", "wmv2", NULL +}; + +//! Allowed video codecs description. +/*! \warning This variable is linked to allowed_video_codecs, + * if you change this you must change the other acordingly. + */ +const char* allowed_video_codecs_description[] = +{ + _("Flash Video (FLV) / Sorenson Spark / Sorenson H.263."), + _("H.263+ / H.263-1998 / H.263 version 2."), + _("Huffyuv / HuffYUV."), + _("libtheora Theora."), + _("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10."), + _("libxvidcore MPEG-4 part 2."), + _("MJPEG (Motion JPEG)."), + _("raw MPEG-1 video."), + _("raw MPEG-2 video."), + _("MPEG-4 part 2."), + _("MPEG-4 part 2 Microsoft variant version 3."), + _("MPEG-4 part 2 Microsoft variant version 1."), + _("MPEG-4 part 2 Microsoft variant version 2."), + _("Windows Media Video 7."), + _("Windows Media Video 8."), + NULL +}; /* === P R O C E D U R E S ================================================= */ /* === M E T H O D S ======================================================= */ @@ -53,28 +87,21 @@ using namespace studio; Dialog_TargetParam::Dialog_TargetParam(synfig::TargetParam &tparam) { - set_title("TargetParam Dialog"); + set_title(_("TargetParam Dialog")); set_tparam(tparam); // Available Video Codecs Combo Box Text. vcodec = Gtk::manage(new Gtk::ComboBoxText()); Gtk::Label* label(manage(new Gtk::Label(_("Available Video Codecs:")))); label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); get_vbox()->pack_start(*label, true, true, 0); - //vcodec->signal_changed().connect(sigc::mem_fun(*this, &Dialog_TargetParam::on_video_codec_changed)); - vcodec->prepend_text("flv"); - vcodec->prepend_text("h263p"); - vcodec->prepend_text("huffyuv"); - vcodec->prepend_text("libtheora"); - vcodec->prepend_text("libx264"); - vcodec->prepend_text("libxvid"); - vcodec->prepend_text("mjpeg"); - vcodec->prepend_text("mpeg2video"); - vcodec->prepend_text("mpeg4"); - vcodec->prepend_text("msmpeg4"); - vcodec->prepend_text("msmpeg4v1"); - vcodec->prepend_text("msmpeg4v2"); - vcodec->prepend_text("wmv1"); - vcodec->prepend_text("wmv2"); + for (int i = 0; allowed_video_codecs[i] != NULL && + allowed_video_codecs_description[i] != NULL; i++) + vcodec->append_text(allowed_video_codecs_description[i]); + for (int i = 0; allowed_video_codecs[i] != NULL && + allowed_video_codecs_description[i] != NULL; i++) + if(!get_tparam().video_codec.compare(allowed_video_codecs[i])) + vcodec->set_active_text(allowed_video_codecs_description[i]); + get_vbox()->pack_start(*vcodec, true, true, 0); //Bitrate Spin Button @@ -89,16 +116,35 @@ Dialog_TargetParam::Dialog_TargetParam(synfig::TargetParam &tparam) ok_button = manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))); ok_button->show(); - add_action_widget(*ok_button,0); + add_action_widget(*ok_button,Gtk::RESPONSE_OK); ok_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_ok)); + + cancel_button = manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); + cancel_button->show(); + add_action_widget(*cancel_button,Gtk::RESPONSE_CANCEL); + cancel_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_cancel)); + } void Dialog_TargetParam::on_ok() { + std::string codecnamed = vcodec->get_active_text(); + for (int i = 0; allowed_video_codecs[i] != NULL && + allowed_video_codecs_description[i] != NULL; i++) + if(!codecnamed.compare(allowed_video_codecs_description[i])) + tparam_.video_codec=allowed_video_codecs[i]; + tparam_.bitrate=bitrate->get_value(); + hide(); +} + +void +Dialog_TargetParam::on_cancel() +{ hide(); } Dialog_TargetParam::~Dialog_TargetParam() { } +