[chronojump] videoDeviceNum -> videoDevice
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] videoDeviceNum -> videoDevice
- Date: Wed, 18 Jul 2018 11:32:35 +0000 (UTC)
commit d31b568e33b4915652ae6681887ebbee45abb216
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jul 18 13:29:07 2018 +0200
videoDeviceNum -> videoDevice
src/gui/preferences.cs | 19 +++++++++----------
src/preferences.cs | 2 +-
src/sqlite/preferences.cs | 4 ++--
src/utilMultimedia.cs | 7 ++++---
4 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 5b929f59..473e71f8 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -284,7 +284,7 @@ public class PreferencesWindow
PreferencesWindowBox.radio_sound_systemsounds.Active = true;
PreferencesWindowBox.label_test_sound_result.Text = "";
- PreferencesWindowBox.createComboCamera(UtilMultimedia.GetVideoDevices(),
preferences.videoDeviceNum);
+ PreferencesWindowBox.createComboCamera(UtilMultimedia.GetVideoDevices(),
preferences.videoDevice);
string [] decs = {"1", "2", "3"};
@@ -561,13 +561,13 @@ public class PreferencesWindow
* end of triggers stuff
*/
- private void createComboCamera(List<string> devices, int current) {
+ private void createComboCamera(List<string> devices, string current) {
combo_camera = ComboBox.NewText ();
if(devices.Count == 0) {
//devices = Util.StringToStringArray(Constants.CameraNotFound);
label_no_cameras.Visible = true;
- current = 0;
+ current = "";
return;
}
@@ -575,11 +575,10 @@ public class PreferencesWindow
hbox_combo_camera.PackStart(combo_camera, true, true, 0);
hbox_combo_camera.ShowAll();
- if(current >= devices.Count)
- current = 0;
+ //if(current >= devices.Count)
+ // current = 0;
- //TODO: take care with this as maybe devices are: "video0, video2"
- //combo_camera.Active = UtilGtk.ComboMakeActive(devices, devices[current]);
+ combo_camera.Active = UtilGtk.ComboMakeActive(combo_camera, current);
}
private void on_check_appearance_maximized_toggled (object obj, EventArgs args)
@@ -1430,9 +1429,9 @@ public class PreferencesWindow
preferences.gstreamer = Preferences.GstreamerTypes.SYSTEMSOUNDS;
}
- if( preferences.videoDeviceNum != UtilGtk.ComboGetActivePos(combo_camera) ) {
- SqlitePreferences.Update("videoDevice",
UtilGtk.ComboGetActivePos(combo_camera).ToString(), true);
- preferences.videoDeviceNum = UtilGtk.ComboGetActivePos(combo_camera);
+ if( preferences.videoDevice != UtilGtk.ComboGetActive(combo_camera) ) {
+ SqlitePreferences.Update("videoDevice", UtilGtk.ComboGetActive(combo_camera), true);
+ preferences.videoDevice = UtilGtk.ComboGetActive(combo_camera);
}
diff --git a/src/preferences.cs b/src/preferences.cs
index b59ff6c8..9539a2ff 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -74,7 +74,7 @@ public class Preferences
public double encoderSmoothCon;
public Constants.Encoder1RMMethod encoder1RMMethod;
- public int videoDeviceNum; //AKA videoDevice
+ public string videoDevice;
public string CSVExportDecimalSeparator;
public string language;
public string crashLogLanguage;
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index a9fa1cd0..15d6e8e3 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -170,7 +170,7 @@ class SqlitePreferences : Sqlite
Insert (EncoderRhythmRestClustersSecondsStr,
Util.ConvertToPoint(er.RestClustersSeconds), dbcmdTr);
- Insert ("videoDevice", "0", dbcmdTr); //first
+ Insert ("videoDevice", "", dbcmdTr); //first
Insert ("inertialmomentum", "0.01", dbcmdTr);
Insert ("CSVExportDecimalSeparator", Util.GetDecimalSeparatorFromLocale(),
dbcmdTr);
Insert ("RGraphsTranslate", "True", dbcmdTr);
@@ -368,7 +368,7 @@ class SqlitePreferences : Sqlite
//video... other
else if(reader[0].ToString() == "videoDevice")
- preferences.videoDeviceNum = Convert.ToInt32(reader[1].ToString());
+ preferences.videoDevice = reader[1].ToString();
else if(reader[0].ToString() == "CSVExportDecimalSeparator")
preferences.CSVExportDecimalSeparator = reader[1].ToString();
else if(reader[0].ToString() == "language")
diff --git a/src/utilMultimedia.cs b/src/utilMultimedia.cs
index ac51503b..0b858473 100644
--- a/src/utilMultimedia.cs
+++ b/src/utilMultimedia.cs
@@ -55,7 +55,8 @@ public class UtilMultimedia
//on Linux search for video0, video1, ...
if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX)
{
- var dir = new DirectoryInfo("/dev");
+ string prefix = "/dev/";
+ var dir = new DirectoryInfo(prefix);
foreach(var file in dir.EnumerateFiles("video*"))
/*
* return 0, 1, ...
@@ -63,8 +64,8 @@ public class UtilMultimedia
char.IsNumber(file.Name, 5) ) //and it's a number
list.Add(Convert.ToInt32(file.Name[5])); //0
or 1, or ...
*/
- //return "video0", "video1", ...
- list.Add(file.Name);
+ //return "/dev/video0", "/dev/video1", ...
+ list.Add(prefix + file.Name);
}
return list;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]