[longomatch] Factorize encoding properties
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Factorize encoding properties
- Date: Tue, 25 Jun 2013 12:45:39 +0000 (UTC)
commit e6cd107520fdeff98dcb5494b6b518bece35d582
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Jun 25 14:38:47 2013 +0200
Factorize encoding properties
.../Gui/Component/ProjectDetailsWidget.cs | 41 ++--------------
.../Gui/Dialog/VideoEditionProperties.cs | 46 ++----------------
LongoMatch.GUI/Gui/Helpers/Misc.cs | 49 ++++++++++++++++++++
3 files changed, 60 insertions(+), 76 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
b/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
index a3201a2..8c19ebf 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
@@ -31,6 +31,7 @@ using LongoMatch.Store.Templates;
using LongoMatch.Video.Utils;
using Mono.Unix;
using LongoMatch.Gui.Helpers;
+using Misc = LongoMatch.Gui.Helpers.Misc;
namespace LongoMatch.Gui.Component
{
@@ -253,11 +254,11 @@ namespace LongoMatch.Gui.Component
encSettings.EncodingQuality = (EncodingQuality) qualList.GetValue(iter, 1);
/* Get size info */
- qualitycombobox.GetActiveIter(out iter);
+ imagecombobox.GetActiveIter(out iter);
encSettings.VideoStandard = (VideoStandard) videoStandardList.GetValue(iter,
1);
/* Get encoding profile info */
- videoformatcombobox.GetActiveIter(out iter);
+ encodingcombobox.GetActiveIter(out iter);
encSettings.EncodingProfile = (EncodingProfile) encProfileList.GetValue(iter,
1);
/* FIXME: Configure with the UI */
@@ -423,39 +424,9 @@ namespace LongoMatch.Gui.Component
}
private void FillFormats() {
- int index = 0, active = 0;
- videoStandardList = new ListStore(typeof(string), typeof (VideoStandard));
- foreach (VideoStandard std in VideoStandards.Capture) {
- videoStandardList.AppendValues (std.Name, std);
- if (Config.CaptureVideoStandard == std)
- active = index;
- index ++;
- }
- qualitycombobox.Model = videoStandardList;
- qualitycombobox.Active = active;
-
- index = active = 0;
- encProfileList = new ListStore(typeof(string), typeof (EncodingProfile));
- foreach (EncodingProfile prof in EncodingProfiles.Capture) {
- encProfileList.AppendValues(prof.Name, prof);
- if (Config.CaptureEncodingProfile == prof)
- active = index;
- index ++;
-
- }
- videoformatcombobox.Model = encProfileList;
- videoformatcombobox.Active = active;
-
- index = active = 0;
- qualList = new ListStore(typeof(string), typeof (EncodingQuality));
- foreach (EncodingQuality qual in EncodingQualities.All) {
- qualList.AppendValues(qual.Name, qual);
- if (Config.CaptureEncodingQuality == qual)
- active = index;
- index ++;
- }
- qualitycombobox.Model = qualList;
- qualitycombobox.Active = active;
+ videoStandardList = Misc.FillImageFormat (imagecombobox, Config.CaptureVideoStandard);
+ encProfileList = Misc.FillEncodingFormat (encodingcombobox,
Config.CaptureEncodingProfile);
+ qualList = Misc.FillQuality (qualitycombobox, Config.CaptureEncodingQuality);
}
private void StartEditor(TemplateEditorDialog editor) {
diff --git a/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
b/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
index 5fe090b..3bee21b 100644
--- a/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
+++ b/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
@@ -24,6 +24,8 @@ using Mono.Unix;
using LongoMatch.Video.Editor;
using LongoMatch.Video.Common;
using LongoMatch.Common;
+using LongoMatch.Gui.Helpers;
+using Misc = LongoMatch.Gui.Helpers.Misc;
namespace LongoMatch.Gui.Dialog
{
@@ -40,9 +42,9 @@ namespace LongoMatch.Gui.Dialog
{
this.Build();
encSettings = new EncodingSettings();
- FillVideoStandards();
- FillEncodingProfiles();
- FillQualities();
+ stdStore = Misc.FillImageFormat (sizecombobox, Config.RenderVideoStandard);
+ encStore = Misc.FillEncodingFormat (formatcombobox, Config.RenderEncodingProfile);
+ qualStore = Misc.FillQuality (qualitycombobox, Config.RenderEncodingQuality);
}
#endregion
@@ -88,44 +90,6 @@ namespace LongoMatch.Gui.Dialog
#endregion
- private void FillVideoStandards() {
- int index = 0, active = 0;
- stdStore = new ListStore(typeof(string), typeof (VideoStandard));
- foreach (VideoStandard std in VideoStandards.Rendering) {
- stdStore.AppendValues (std.Name, std);
- if (std == Config.RenderVideoStandard)
- active = index;
- index ++;
- }
- sizecombobox.Model = stdStore;
- sizecombobox.Active = active;
- }
-
- private void FillEncodingProfiles() {
- int index = 0, active = 0;
- encStore = new ListStore(typeof(string), typeof (EncodingProfile));
- foreach (EncodingProfile prof in EncodingProfiles.Render) {
- encStore.AppendValues(prof.Name, prof);
- if (prof == Config.RenderEncodingProfile)
- active = index;
- index++;
- }
- formatcombobox.Model = encStore;
- formatcombobox.Active = active;
- }
-
- private void FillQualities() {
- int index = 0, active = 0;
- qualStore = new ListStore(typeof(string), typeof (EncodingQuality));
- foreach (EncodingQuality qual in EncodingQualities.All) {
- qualStore.AppendValues(qual.Name, qual);
- if (qual == Config.RenderEncodingQuality)
- active = index;
- index++;
- }
- qualitycombobox.Model = qualStore;
- qualitycombobox.Active = active;
- }
protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
{
diff --git a/LongoMatch.GUI/Gui/Helpers/Misc.cs b/LongoMatch.GUI/Gui/Helpers/Misc.cs
index 983b715..5c1e9b3 100644
--- a/LongoMatch.GUI/Gui/Helpers/Misc.cs
+++ b/LongoMatch.GUI/Gui/Helpers/Misc.cs
@@ -92,6 +92,55 @@ namespace LongoMatch.Gui.Helpers
ColorHelper.ShortToByte(color.Green),
ColorHelper.ShortToByte(color.Blue));
}
+
+ public static ListStore FillImageFormat (ComboBox formatBox, VideoStandard def) {
+ ListStore formatStore;
+ int index = 0, active = 0;
+
+ formatStore = new ListStore(typeof(string), typeof (VideoStandard));
+ foreach (VideoStandard std in VideoStandards.Rendering) {
+ formatStore.AppendValues (std.Name, std);
+ if (std.Equals(def))
+ active = index;
+ index ++;
+ }
+ formatBox.Model = formatStore;
+ formatBox.Active = active;
+ return formatStore;
+ }
+
+ public static ListStore FillEncodingFormat (ComboBox encodingBox, EncodingProfile def) {
+ ListStore encodingStore;
+ int index = 0, active = 0;
+
+ encodingStore = new ListStore(typeof(string), typeof (EncodingProfile));
+ foreach (EncodingProfile prof in EncodingProfiles.Render) {
+ encodingStore.AppendValues(prof.Name, prof);
+ if (prof.Equals(def))
+ active = index;
+ index++;
+ }
+ encodingBox.Model = encodingStore;
+ encodingBox.Active = active;
+ return encodingStore;
+ }
+
+ public static ListStore FillQuality (ComboBox qualityBox, EncodingQuality def) {
+ ListStore qualityStore;
+ int index = 0, active = 0;
+
+ qualityStore = new ListStore(typeof(string), typeof (EncodingQuality));
+ foreach (EncodingQuality qual in EncodingQualities.All) {
+ qualityStore.AppendValues(qual.Name, qual);
+ if (qual.Equals(def)) {
+ active = index;
+ }
+ index++;
+ }
+ qualityBox.Model = qualityStore;
+ qualityBox.Active = active;
+ return qualityStore;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]