X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=gtk%2Fsrc%2Fqueuehandler.c;h=fbe7cce981b168e88f2d56863b88c8405908dbe5;hb=5e5b2b38317ee28f64baa0443b541d8f9c40d4e8;hp=6d56af7a341fe5b66f39c77f6d7c3be479f511e9;hpb=1d001545d16698ef31a2b40879d272b5bd23a22c;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 6d56af7a..fbe7cce9 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -23,7 +23,7 @@ #include "presets.h" #include "ghb-dvd.h" -void +G_MODULE_EXPORT void queue_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud) { GtkTreeModel *store; @@ -70,10 +70,12 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) gchar *dest, *preset, *vol_name, *basename; const gchar *vcodec, *container; gchar *fps, *vcodec_abbr; - gint title, start_chapter, end_chapter, width, height, vqvalue; + gint title, start_chapter, end_chapter, width, height; gint source_width, source_height; - gboolean pass2, anamorphic, round_dim, keep_aspect, vqtype, turbo; + gboolean pass2, keep_aspect, vqtype, turbo; + gint pic_par; gboolean tweaks; + gchar *escape; g_debug("update_queue_list ()"); if (settings == NULL) return; @@ -81,21 +83,24 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview)); tweaks = ghb_settings_get_boolean(settings, "allow_tweaks"); - title = ghb_settings_combo_int(settings, "title"); + title = ghb_settings_get_int(settings, "titlenum"); start_chapter = ghb_settings_get_int(settings, "start_chapter"); end_chapter = ghb_settings_get_int(settings, "end_chapter"); - pass2 = ghb_settings_get_boolean(settings, "two_pass"); + pass2 = ghb_settings_get_boolean(settings, "VideoTwoPass"); vol_name = ghb_settings_get_string(settings, "volume_label"); dest = ghb_settings_get_string(settings, "destination"); basename = g_path_get_basename(dest); + escape = g_markup_escape_text(basename, -1); info = g_strdup_printf ( "%s " "(Title %d, Chapters %d through %d, %d Video %s)" " --> %s", - vol_name, title+1, start_chapter, end_chapter, - pass2 ? 2:1, pass2 ? "Passes":"Pass", basename + vol_name, title, start_chapter, end_chapter, + pass2 ? 2:1, pass2 ? "Passes":"Pass", escape ); + g_free(basename); + g_free(escape); if (piter) iter = *piter; @@ -130,16 +135,16 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) gint mux; const GValue *path; - container = ghb_settings_combo_option(settings, "container"); - mux = ghb_settings_combo_int(settings, "container"); + container = ghb_settings_combo_option(settings, "FileFormat"); + mux = ghb_settings_combo_int(settings, "FileFormat"); preset_modified = ghb_settings_get_boolean(settings, "preset_modified"); path = ghb_settings_get_value(settings, "preset"); preset = ghb_preset_path_string(path); - markers = ghb_settings_get_boolean(settings, "chapter_markers"); + markers = ghb_settings_get_boolean(settings, "ChapterMarkers"); if (preset_modified) g_string_append_printf(str, - "Customized Preset Based On: %s\n", + "Modified Preset Based On: %s\n", preset); else g_string_append_printf(str, @@ -161,9 +166,9 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) { gboolean ipod, http, large; - ipod = ghb_settings_get_boolean(settings, "ipod_file"); - http = ghb_settings_get_boolean(settings, "http_optimize_mp4"); - large = ghb_settings_get_boolean(settings, "large_mp4"); + ipod = ghb_settings_get_boolean(settings, "Mp4iPodCompatible"); + http = ghb_settings_get_boolean(settings, "Mp4HttpOptimize"); + large = ghb_settings_get_boolean(settings, "Mp4LargeFile"); if (http || ipod || large) { g_string_append_printf(str, "MP4 Options:"); @@ -176,28 +181,19 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) g_string_append_printf(str, "\n"); } } + escape = g_markup_escape_text(dest, -1); g_string_append_printf(str, - "Destination: %s\n", dest); + "Destination: %s\n", escape); width = ghb_settings_get_int(settings, "scale_width"); height = ghb_settings_get_int(settings, "scale_height"); - anamorphic = ghb_settings_get_boolean(settings, "anamorphic"); - round_dim = ghb_settings_get_boolean(settings, "round_dimensions"); - keep_aspect = ghb_settings_get_boolean(settings, "keep_aspect"); + pic_par = ghb_settings_combo_int(settings, "PicturePAR"); + keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio"); gchar *aspect_desc; - if (anamorphic) + switch (pic_par) { - if (round_dim) - { - aspect_desc = "(Anamorphic)"; - } - else - { - aspect_desc = "(Strict Anamorphic)"; - } - } - else + case 0: { if (keep_aspect) { @@ -207,41 +203,66 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) { aspect_desc = "(Aspect Lost)"; } + } break; + + case 1: + { + aspect_desc = "(Strict Anamorphic)"; + } break; + + case 2: + { + aspect_desc = "(Loose Anamorphic)"; + } break; + + case 3: + { + aspect_desc = "(Custom Anamorphic)"; + } break; + + default: + { + aspect_desc = "(Unknown)"; + } break; } vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant"); - vqvalue = 0; gchar *vq_desc = "Error"; gchar *vq_units = ""; + gchar *vqstr; + gdouble vqvalue; if (!vqtype) { vqtype = ghb_settings_get_boolean(settings, "vquality_type_target"); if (!vqtype) { // Has to be bitrate - vqvalue = ghb_settings_get_int(settings, "video_bitrate"); + vqvalue = ghb_settings_get_int(settings, "VideoAvgBitrate"); vq_desc = "Bitrate:"; vq_units = "kbps"; } else { // Target file size - vqvalue = ghb_settings_get_int(settings, "video_target_size"); + vqvalue = ghb_settings_get_int(settings, "VideoTargetSize"); vq_desc = "Target Size:"; vq_units = "MB"; } + vqstr = g_strdup_printf("%d", (gint)vqvalue); } else { // Constant quality - vqvalue = ghb_settings_get_int(settings, "video_quality"); + vqvalue = ghb_settings_get_double(settings, "VideoQualitySlider"); vq_desc = "Constant Quality:"; + vqstr = g_strdup_printf("%d", (gint)vqvalue); + vq_units = "(crf)"; } - fps = ghb_settings_get_string(settings, "framerate"); + fps = ghb_settings_get_string(settings, "VideoFramerate"); if (strcmp("source", fps) == 0) { g_free(fps); - if (ghb_settings_get_boolean(settings, "detelecine")) + if (ghb_settings_combo_int(settings, "PictureDetelecine")) fps = g_strdup("Same As Source (vfr detelecine)"); else fps = g_strdup("Same As Source (variable)"); @@ -253,57 +274,90 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) g_free(fps); fps = tmp; } - vcodec = ghb_settings_combo_option(settings, "video_codec"); - vcodec_abbr = ghb_settings_get_string(settings, "video_codec"); + vcodec = ghb_settings_combo_option(settings, "VideoEncoder"); + vcodec_abbr = ghb_settings_get_string(settings, "VideoEncoder"); source_width = ghb_settings_get_int(settings, "source_width"); source_height = ghb_settings_get_int(settings, "source_height"); g_string_append_printf(str, "Picture: Source: %d x %d, Output %d x %d %s\n", source_width, source_height, width, height, aspect_desc); - gboolean decomb; + gint decomb, detel; gboolean filters = FALSE; - decomb = ghb_settings_get_boolean(settings, "decomb"); + decomb = ghb_settings_combo_int(settings, "PictureDecomb"); g_string_append_printf(str, "Filters:"); - if (ghb_settings_get_boolean(settings, "detelecine")) + detel = ghb_settings_combo_int(settings, "PictureDetelecine"); + if (detel) { g_string_append_printf(str, " - Detelecine"); + if (detel == 1) + { + gchar *cust; + cust = ghb_settings_get_string(settings, "PictureDetelecineCustom"); + g_string_append_printf(str, ": %s", cust); + g_free(cust); + } filters = TRUE; } if (decomb) { g_string_append_printf(str, " - Decomb"); + if (decomb == 1) + { + gchar *cust; + cust = ghb_settings_get_string(settings, "PictureDecombCustom"); + g_string_append_printf(str, ": %s", cust); + g_free(cust); + } filters = TRUE; } else { - gint deint = ghb_settings_combo_int(settings, - tweaks ? "tweak_deinterlace":"deinterlace"); + gint deint = ghb_settings_combo_int(settings, "PictureDeinterlace"); if (deint) { - const gchar *opt = ghb_settings_combo_option(settings, - tweaks ? "tweak_deinterlace":"deinterlace"); - g_string_append_printf(str, " - Deinterlace: %s", opt); + if (deint == 1) + { + gchar *cust = ghb_settings_get_string(settings, + "PictureDeinterlaceCustom"); + g_string_append_printf(str, " - Deinterlace: %s", cust); + g_free(cust); + } + else + { + const gchar *opt = ghb_settings_combo_option(settings, + "PictureDeinterlace"); + g_string_append_printf(str, " - Deinterlace: %s", opt); + } filters = TRUE; } } - gint denoise = ghb_settings_combo_int(settings, - tweaks ? "tweak_denoise":"denoise"); + gint denoise = ghb_settings_combo_int(settings, "PictureDenoise"); if (denoise) { - const gchar *opt = ghb_settings_combo_option(settings, - tweaks ? "tweak_denoise":"denoise"); - g_string_append_printf(str, " - Denoise: %s", opt); + if (denoise == 1) + { + gchar *cust = ghb_settings_get_string(settings, + "PictureDenoiseCustom"); + g_string_append_printf(str, " - Denoise: %s", cust); + g_free(cust); + } + else + { + const gchar *opt = ghb_settings_combo_option(settings, + "PictureDenoise"); + g_string_append_printf(str, " - Denoise: %s", opt); + } filters = TRUE; } - gint deblock = ghb_settings_get_int(settings, "deblock"); + gint deblock = ghb_settings_get_int(settings, "PictureDeblock"); if (deblock >= 5) { g_string_append_printf(str, " - Deblock (%d)", deblock); filters = TRUE; } - if (ghb_settings_get_boolean(settings, "grayscale")) + if (ghb_settings_get_boolean(settings, "VideoGrayScale")) { g_string_append_printf(str, " - Grayscale"); filters = TRUE; @@ -313,10 +367,10 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) g_string_append_printf(str, "\n"); g_string_append_printf(str, - "Video: %s, Framerate: %s, %s %d%s\n", - vcodec, fps, vq_desc, vqvalue, vq_units); + "Video: %s, Framerate: %s, %s %s%s\n", + vcodec, fps, vq_desc, vqstr, vq_units); - turbo = ghb_settings_get_boolean(settings, "turbo"); + turbo = ghb_settings_get_boolean(settings, "VideoTurboTwoPass"); if (turbo) { g_string_append_printf(str, "Turbo: On\n"); @@ -342,25 +396,89 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) asettings = ghb_array_get_nth(audio_list, ii); - acodec = ghb_settings_combo_option(asettings, "audio_codec"); - bitrate = ghb_settings_get_string(asettings, "audio_bitrate"); - samplerate = ghb_settings_get_string(asettings, "audio_rate"); + acodec = ghb_settings_combo_option(asettings, "AudioEncoder"); + bitrate = ghb_settings_get_string(asettings, "AudioBitrate"); + samplerate = ghb_settings_get_string(asettings, "AudioSamplerate"); if (strcmp("source", samplerate) == 0) { g_free(samplerate); samplerate = g_strdup("Same As Source"); } - track = ghb_settings_get_string(asettings, "audio_track_long"); - mix = ghb_settings_combo_option(asettings, "audio_mix"); + track = ghb_settings_get_string(asettings, "AudioTrackDescription"); + mix = ghb_settings_combo_option(asettings, "AudioMixdown"); + if (count == 1) + g_string_append_printf(str, "Audio:"); + else if (ii == 0) + g_string_append_printf(str, "Audio:\n"); + if (count != 1) + g_string_append_printf(str, "\t"); + g_string_append_printf(str, - "Audio: %s, Encoder: %s, Mixdown: %s, SampleRate: %s, Bitrate: %s", + " %s, Encoder: %s, Mixdown: %s, SampleRate: %s, Bitrate: %s\n", track, acodec, mix, samplerate, bitrate); - if (ii < count-1) - g_string_append_printf(str, "\n"); g_free(track); g_free(bitrate); g_free(samplerate); } + + // Add the audios + const GValue *sub_list; + + sub_list = ghb_settings_get_value(settings, "subtitle_list"); + count = ghb_array_len(sub_list); + for (ii = 0; ii < count; ii++) + { + GValue *settings; + gchar *track; + gboolean force, burn, def; + gint source; + + settings = ghb_array_get_nth(sub_list, ii); + track = ghb_settings_get_string(settings, "SubtitleTrackDescription"); + source = ghb_settings_get_int(settings, "SubtitleSource"); + force = ghb_settings_get_boolean(settings, "SubtitleForced"); + burn = ghb_settings_get_boolean(settings, "SubtitleBurned"); + def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack"); + if (count == 1) + g_string_append_printf(str, "Subtitle:"); + else if (ii == 0) + g_string_append_printf(str, "Subtitles:\n"); + if (count != 1) + g_string_append_printf(str, "\t"); + + if (source != SRTSUB) + { + g_string_append_printf(str, + " %s%s%s%s", + track, + force ? " (Force)":"", + burn ? " (Burn)":"", + def ? " (Default)":"" + ); + } + else + { + gint offset; + gchar *filename, *basename, *code; + + offset = ghb_settings_get_int(settings, "SrtOffset"); + filename = ghb_settings_get_string(settings, "SrtFile"); + basename = g_path_get_basename(filename); + code = ghb_settings_get_string(settings, "SrtCodeset"); + g_string_append_printf(str, + " %s (%s), %s, Offset (ms) %d%s", + track, code, basename, offset, + def ? " (Default)":"" + ); + g_free(filename); + g_free(basename); + g_free(code); + } + if (ii < count-1) + g_string_append_printf(str, "\n"); + g_free(track); + } + info = g_string_free(str, FALSE); gtk_tree_store_append(store, &citer, &iter); gtk_tree_store_set(store, &citer, 1, info, -1); @@ -372,25 +490,6 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) g_free(preset); } -static gint64 -estimate_file_size(signal_user_data_t *ud) -{ - ghb_title_info_t tinfo; - gint duration; - gint bitrate; - gint64 size; - gint titleindex; - - titleindex = ghb_settings_combo_int(ud->settings, "title"); - if (titleindex < 0) return 0; - - if (!ghb_get_title_info(&tinfo, titleindex)) return 0; - duration = ((tinfo.hours*60)+tinfo.minutes)*60+tinfo.seconds; - bitrate = ghb_guess_bitrate(ud->settings); - size = (gint64)duration * (gint64)bitrate/8; - return size; -} - void audio_list_refresh(signal_user_data_t *ud) { @@ -399,7 +498,7 @@ audio_list_refresh(signal_user_data_t *ud) GtkListStore *store; gboolean done; gint row = 0; - GValue *audio_list; + const GValue *audio_list; g_debug("ghb_audio_list_refresh ()"); treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); @@ -418,19 +517,22 @@ audio_list_refresh(signal_user_data_t *ud) return; asettings = ghb_array_get_nth(audio_list, row); - track = ghb_settings_combo_option(asettings, "audio_track"); - codec = ghb_settings_combo_option(asettings, "audio_codec"); - br = ghb_settings_combo_option(asettings, "audio_bitrate"); - sr = ghb_settings_combo_option(asettings, "audio_rate"); - mix = ghb_settings_combo_option(asettings, "audio_mix"); - drc = ghb_settings_get_string(asettings, "audio_drc"); - - s_track = ghb_settings_get_string(asettings, "audio_track"); - s_codec = ghb_settings_get_string(asettings, "audio_codec"); - s_br = ghb_settings_get_string(asettings, "audio_bitrate"); - s_sr = ghb_settings_get_string(asettings, "audio_rate"); - s_mix = ghb_settings_get_string(asettings, "audio_mix"); - s_drc = ghb_settings_get_double(asettings, "audio_drc"); + track = ghb_settings_combo_option(asettings, "AudioTrack"); + codec = ghb_settings_combo_option(asettings, "AudioEncoder"); + br = ghb_settings_combo_option(asettings, "AudioBitrate"); + sr = ghb_settings_combo_option(asettings, "AudioSamplerate"); + mix = ghb_settings_combo_option(asettings, "AudioMixdown"); + + s_track = ghb_settings_get_string(asettings, "AudioTrack"); + s_codec = ghb_settings_get_string(asettings, "AudioEncoder"); + s_br = ghb_settings_get_string(asettings, "AudioBitrate"); + s_sr = ghb_settings_get_string(asettings, "AudioSamplerate"); + s_mix = ghb_settings_get_string(asettings, "AudioMixdown"); + s_drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider"); + if (s_drc < 1.0) + drc = g_strdup("Off"); + else + drc = g_strdup_printf("%.1f", s_drc); gtk_list_store_set(GTK_LIST_STORE(store), &iter, // These are displayed in list @@ -439,8 +541,8 @@ audio_list_refresh(signal_user_data_t *ud) 2, br, 3, sr, 4, mix, - // These are used to set combo values when an item is selected 5, drc, + // These are used to set combo values when an item is selected 6, s_track, 7, s_codec, 8, s_br, @@ -512,6 +614,8 @@ validate_settings(signal_user_data_t *ud) g_free(destdir); return FALSE; } +#if !defined(_WIN32) + // This doesn't work properly on windows if (g_access(destdir, R_OK|W_OK) != 0) { message = g_strdup_printf( @@ -524,6 +628,7 @@ validate_settings(signal_user_data_t *ud) g_free(destdir); return FALSE; } +#endif GFile *gfile; GFileInfo *info; guint64 size; @@ -539,7 +644,7 @@ validate_settings(signal_user_data_t *ud) size = g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE); - gint64 fsize = estimate_file_size(ud); + gint64 fsize = (guint64)10 * 1024 * 1024 * 1024; if (size < fsize) { message = g_strdup_printf( @@ -564,7 +669,7 @@ validate_settings(signal_user_data_t *ud) { message = g_strdup_printf( "Destination: %s\n\n" - "File already exhists.\n" + "File already exists.\n" "Do you want to overwrite?", dest); if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Overwrite")) @@ -587,13 +692,13 @@ validate_settings(signal_user_data_t *ud) { return FALSE; } - // Validate video settings - if (!ghb_validate_video(ud)) + // Validate audio settings + if (!ghb_validate_subtitles(ud)) { return FALSE; } - // Validate container settings - if (!ghb_validate_container(ud)) + // Validate video settings + if (!ghb_validate_video(ud)) { return FALSE; } @@ -619,6 +724,7 @@ queue_add(signal_user_data_t *ud) { return FALSE; } + if (ud->queue == NULL) ud->queue = ghb_array_value_new(32); // Make a copy of current settings to be used for the new job @@ -631,18 +737,19 @@ queue_add(signal_user_data_t *ud) ghb_array_append(ud->queue, settings); add_to_queue_list(ud, settings, NULL); ghb_save_queue(ud->queue); + ghb_update_pending(ud); return TRUE; } -void +G_MODULE_EXPORT void queue_add_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) { g_debug("queue_add_clicked_cb ()"); queue_add(ud); } -void +G_MODULE_EXPORT void queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) { GtkTreeView *treeview; @@ -695,6 +802,7 @@ queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) { gtk_tree_path_free (treepath); } + ghb_update_pending(ud); } static gint @@ -722,7 +830,7 @@ find_last_finished(GValue *queue) // handler from expanding rows if you hover over them while // dragging. // Also controls where valid drop locations are -gboolean +G_MODULE_EXPORT gboolean queue_drag_motion_cb( GtkTreeView *tv, GdkDragContext *ctx, @@ -739,6 +847,11 @@ queue_drag_motion_cb( GtkTreeView *srctv; GtkTreeModel *model; GtkTreeSelection *select; + GtkWidget *widget; + + widget = gtk_drag_get_source_widget(ctx); + if (widget == NULL || widget != GTK_WIDGET(tv)) + return TRUE; // This bit checks to see if the source is allowed to be // moved. Only pending and canceled items may be moved. @@ -800,7 +913,7 @@ queue_drag_motion_cb( return TRUE; } -void +G_MODULE_EXPORT void queue_drag_cb( GtkTreeView *dstwidget, GdkDragContext *dc, @@ -904,37 +1017,159 @@ queue_drag_cb( } void -ghb_queue_buttons_grey(signal_user_data_t *ud, gboolean working) +ghb_queue_buttons_grey(signal_user_data_t *ud) { GtkWidget *widget; GtkAction *action; gint queue_count; gint titleindex; - gboolean title_ok; + gint queue_state, scan_state; + gboolean show_start, show_stop, paused; queue_count = ghb_array_len(ud->queue); titleindex = ghb_settings_combo_int(ud->settings, "title"); - title_ok = (titleindex >= 0); + + queue_state = ghb_get_queue_state(); + scan_state = ghb_get_scan_state(); + + show_stop = queue_state & + (GHB_STATE_WORKING | GHB_STATE_SCANNING | GHB_STATE_MUXING); + show_start = !(scan_state & GHB_STATE_SCANNING) && + (titleindex >= 0 || queue_count > 0); + + + paused = queue_state & GHB_STATE_PAUSED; widget = GHB_WIDGET (ud->builder, "queue_start1"); - gtk_widget_set_sensitive (widget, !working && (title_ok || queue_count)); + if (show_stop) + { + gtk_widget_set_sensitive (widget, TRUE); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding"); + } + else + { + gtk_widget_set_sensitive (widget, show_start); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-play"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding"); + } widget = GHB_WIDGET (ud->builder, "queue_start2"); - gtk_widget_set_sensitive (widget, !working && (title_ok || queue_count)); - action = GHB_ACTION (ud->builder, "queue_start_menu"); - gtk_action_set_sensitive (action, !working && (title_ok || queue_count)); + if (show_stop) + { + gtk_widget_set_sensitive (widget, TRUE); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding"); + } + else + { + gtk_widget_set_sensitive (widget, show_start); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-play"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding"); + } widget = GHB_WIDGET (ud->builder, "queue_pause1"); - gtk_widget_set_sensitive (widget, working); + if (paused) + { + gtk_widget_set_sensitive (widget, show_stop); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-play"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding"); + } + else + { + gtk_widget_set_sensitive (widget, show_stop); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding"); + } widget = GHB_WIDGET (ud->builder, "queue_pause2"); - gtk_widget_set_sensitive (widget, working); + if (paused) + { + gtk_widget_set_sensitive (widget, show_stop); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-play"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding"); + } + else + { + gtk_widget_set_sensitive (widget, show_stop); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding"); + } + + action = GHB_ACTION (ud->builder, "queue_start_menu"); + if (show_stop) + { + gtk_action_set_sensitive (action, TRUE); +#if GTK_CHECK_VERSION(2, 16, 0) + gtk_action_set_icon_name(action, "hb-stop"); + gtk_action_set_label(action, "S_top Queue"); + gtk_action_set_tooltip(action, "Stop Encoding"); +#else + g_object_set_property(G_OBJECT(action), "icon-name", + ghb_string_value("hb-stop")); + g_object_set_property(G_OBJECT(action), "label", + ghb_string_value("S_top Queue")); + g_object_set_property(G_OBJECT(action), "tooltip", + ghb_string_value("Stop Encoding")); +#endif + } + else + { + gtk_action_set_sensitive (action, show_start); +#if GTK_CHECK_VERSION(2, 16, 0) + gtk_action_set_icon_name(action, "hb-play"); + gtk_action_set_label(action, "_Start Queue"); + gtk_action_set_tooltip(action, "Start Encoding"); +#else + g_object_set_property(G_OBJECT(action), "icon-name", + ghb_string_value("hb-play")); + g_object_set_property(G_OBJECT(action), "label", + ghb_string_value("_Start Queue")); + g_object_set_property(G_OBJECT(action), "tooltip", + ghb_string_value("Start Encoding")); +#endif + } action = GHB_ACTION (ud->builder, "queue_pause_menu"); - gtk_action_set_sensitive (action, working); - widget = GHB_WIDGET (ud->builder, "queue_stop"); - gtk_widget_set_sensitive (widget, working); - action = GHB_ACTION (ud->builder, "queue_stop_menu"); - gtk_action_set_sensitive (action, working); + if (paused) + { + gtk_action_set_sensitive (action, show_start); +#if GTK_CHECK_VERSION(2, 16, 0) + gtk_action_set_icon_name(action, "hb-play"); + gtk_action_set_label(action, "_Resume Queue"); + gtk_action_set_tooltip(action, "Resume Encoding"); +#else + g_object_set_property(G_OBJECT(action), "icon-name", + ghb_string_value("hb-play")); + g_object_set_property(G_OBJECT(action), "label", + ghb_string_value("_Resume Queue")); + g_object_set_property(G_OBJECT(action), "tooltip", + ghb_string_value("Resume Encoding")); +#endif + } + else + { + gtk_action_set_sensitive (action, show_stop); +#if GTK_CHECK_VERSION(2, 16, 0) + gtk_action_set_icon_name(action, "hb-pause"); + gtk_action_set_label(action, "_Pause Queue"); + gtk_action_set_tooltip(action, "Pause Encoding"); +#else + g_object_set_property(G_OBJECT(action), "icon-name", + ghb_string_value("hb-pause")); + g_object_set_property(G_OBJECT(action), "label", + ghb_string_value("_Pause Queue")); + g_object_set_property(G_OBJECT(action), "tooltip", + ghb_string_value("Pause Encoding")); +#endif + } } -void +G_MODULE_EXPORT void queue_list_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, GtkCellRenderer *cell) { GtkTreeViewColumn *column; @@ -949,7 +1184,7 @@ queue_list_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, GtkCel g_object_set(cell, "wrap-width", width-70, NULL); } -void +G_MODULE_EXPORT void queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { GValue *js; @@ -958,6 +1193,14 @@ queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) gint status; gint state; + state = ghb_get_queue_state(); + if (state & (GHB_STATE_WORKING | GHB_STATE_SCANNING | GHB_STATE_MUXING)) + { + ud->cancel_encode = TRUE; + ghb_cancel_encode(NULL); + return; + } + count = ghb_array_len(ud->queue); for (ii = 0; ii < count; ii++) { @@ -977,7 +1220,6 @@ queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) if (!queue_add(ud)) return; } - state = ghb_get_queue_state(); if (state == GHB_STATE_IDLE) { // Add the first pending queue item and start @@ -985,14 +1227,7 @@ queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) } } -void -queue_stop_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) -{ - ud->cancel_encode = TRUE; - ghb_cancel_encode(NULL); -} - -void +G_MODULE_EXPORT void queue_pause_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { ghb_pause_queue(); @@ -1009,6 +1244,7 @@ ghb_reload_queue(signal_user_data_t *ud) gchar *message; g_debug("ghb_reload_queue"); + queue = ghb_load_queue(); // Look for unfinished entries count = ghb_array_len(queue); @@ -1055,7 +1291,7 @@ ghb_reload_queue(signal_user_data_t *ud) ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING); add_to_queue_list(ud, settings, NULL); } - ghb_queue_buttons_grey(ud, FALSE); + ghb_queue_buttons_grey(ud); } else { @@ -1067,7 +1303,7 @@ ghb_reload_queue(signal_user_data_t *ud) return FALSE; } -gboolean +G_MODULE_EXPORT gboolean queue_key_press_cb( GtkWidget *widget, GdkEventKey *event, @@ -1130,7 +1366,7 @@ queue_key_press_cb( GValue *ghb_queue_edit_settings = NULL; -void +G_MODULE_EXPORT void queue_edit_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { GtkTreeView *treeview; @@ -1171,7 +1407,7 @@ queue_edit_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) } gchar *source; source = ghb_settings_get_string(ghb_queue_edit_settings, "source"); - ghb_do_scan(ud, source, FALSE); + ghb_do_scan(ud, source, 0, FALSE); g_free(source); } }