[chronojump] ports dectection, video optional, fixed cancelling personsRecFromOther
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] ports dectection, video optional, fixed cancelling personsRecFromOther
- Date: Fri, 15 Apr 2011 12:18:19 +0000 (UTC)
commit 1f8c1b653446d691c8bee5b5cafa3f36ce3142ea
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Apr 15 14:03:27 2011 +0200
ports dectection, video optional, fixed cancelling personsRecFromOther
glade/chronojump.glade | 110 +++++++++++++++++++++++++++++++++++++++++++-
src/gui/chronojump.cs | 23 +++++++---
src/gui/chronopic.cs | 6 +++
src/gui/helpPorts.cs | 1 +
src/gui/person.cs | 40 ++++++++++-------
src/gui/preferences.cs | 33 ++++++++++++-
src/sqlite/main.cs | 17 +++++++-
src/sqlite/preferences.cs | 1 +
8 files changed, 202 insertions(+), 29 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 05f2ae4..e89ffb9 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -2288,6 +2288,80 @@ show elevation as:</property>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_video">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="relief">none</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">False</property>
+ <signal name="clicked" handler="on_checkbutton_video_clicked"/>
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image_video_yes">
+ <property name="width_request">24</property>
+ <property name="height_request">24</property>
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-record</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkImage" id="image_video_no">
+ <property name="width_request">24</property>
+ <property name="height_request">24</property>
+ <property name="visible">True</property>
+ <property name="stock">gtk-no</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label_video">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -5490,7 +5564,7 @@ suitable for agility tests)</property>
</widget>
</child>
<child>
- <widget class="GtkLabel" id="label515">
+ <widget class="GtkLabel" id="label_detection">
<property name="visible">True</property>
<property name="label" translatable="yes"><b>Detection</b></property>
<property name="use_markup">True</property>
@@ -13693,6 +13767,7 @@ by you</property>
<property name="label" translatable="yes">Current person</property>
<property name="use_markup">True</property>
<property name="ellipsize">end</property>
+ <property name="max_width_chars">25</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -13914,7 +13989,7 @@ by you</property>
<widget class="GtkViewport" id="viewport_mode">
<property name="visible">True</property>
<property name="resize_mode">queue</property>
- <property name="hadjustment">0 0 744 74.400000000000006 669.60000000000002 744</property>
+ <property name="hadjustment">0 0 1 0.10000000000000001 0.90000000000000002 1</property>
<property name="shadow_type">out</property>
<child>
<widget class="GtkHButtonBox" id="hbutton_radio_modes">
@@ -17845,6 +17920,7 @@ Second Chronopic to platforms.</property>
<property name="width_request">225</property>
<property name="height_request">72</property>
<property name="visible">True</property>
+ <property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
<widget class="GtkTable" id="table3">
@@ -23363,6 +23439,34 @@ Evaluator can use real name or nickname.</property>
</packing>
</child>
<child>
+ <widget class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <widget class="GtkTextView" id="textview_ports_found">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="cursor_visible">False</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Chronopic is on one of this ports</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="layout_style">spread</property>
@@ -23398,7 +23502,7 @@ Evaluator can use real name or nickname.</property>
</child>
</widget>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
</widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 1f7c893..2ea8623 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -232,6 +232,7 @@ public partial class ChronoJumpWindow
Random rand;
bool volumeOn;
+ bool videoOn;
//persons
private TreeStore treeview_persons_store;
@@ -776,7 +777,11 @@ public partial class ChronoJumpWindow
volumeOn = true;
else
volumeOn = false;
- //changeVolumeButton(volumeOn);
+
+ if ( SqlitePreferences.Select("videoOn") == "True" )
+ videoOn = true;
+ else
+ videoOn = false;
//change language works on windows. On Linux let's change the locale
//if(Util.IsWindows())
@@ -2247,7 +2252,7 @@ public partial class ChronoJumpWindow
private void on_recuperate_person_clicked (object o, EventArgs args) {
Log.WriteLine("recuperate person");
- personRecuperateWin = PersonRecuperateWindow.Show(app1, currentSession, prefsDigitsNumber);
+ personRecuperateWin = PersonRecuperateWindow.Show(app1, currentSession, prefsDigitsNumber, videoOn);
personRecuperateWin.FakeButtonDone.Clicked += new EventHandler(on_recuperate_person_accepted);
}
@@ -2270,7 +2275,7 @@ public partial class ChronoJumpWindow
private void on_recuperate_persons_from_session_clicked (object o, EventArgs args) {
Log.WriteLine("recuperate persons from other session");
- personsRecuperateFromOtherSessionWin = PersonsRecuperateFromOtherSessionWindow.Show(app1, currentSession);
+ personsRecuperateFromOtherSessionWin = PersonsRecuperateFromOtherSessionWindow.Show(app1, currentSession, videoOn);
personsRecuperateFromOtherSessionWin.FakeButtonDone.Clicked += new EventHandler(on_recuperate_persons_from_session_accepted);
}
@@ -2294,7 +2299,7 @@ public partial class ChronoJumpWindow
private void on_person_add_single_activate (object o, EventArgs args) {
personAddModifyWin = PersonAddModifyWindow.Show(app1,
currentSession, new Person(-1),
- prefsDigitsNumber, false); //don't comes from recuperate window
+ prefsDigitsNumber, false, videoOn); //don't comes from recuperate window
//-1 means we are adding a new person
//if we were modifying it will be it's uniqueID
@@ -2374,7 +2379,7 @@ public partial class ChronoJumpWindow
Log.WriteLine("modify person");
//personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson.UniqueID, prefsDigitsNumber);
personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson,
- prefsDigitsNumber, false); //don't comes from recuperate window
+ prefsDigitsNumber, false, videoOn); //don't comes from recuperate window
personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_current_person_accepted);
}
@@ -2481,7 +2486,7 @@ public partial class ChronoJumpWindow
askDeletion, weightPercentPreferred, heightPreferred, metersSecondsPreferred,
//System.Threading.Thread.CurrentThread.CurrentUICulture.ToString(),
SqlitePreferences.Select("language"),
- allowFinishRjAfterTime, volumeOn);
+ allowFinishRjAfterTime, volumeOn, videoOn);
myWin.Button_accept.Clicked += new EventHandler(on_preferences_accepted);
}
@@ -2576,6 +2581,12 @@ public partial class ChronoJumpWindow
volumeOn = true;
else
volumeOn = false;
+
+ if ( SqlitePreferences.Select("videoOn") == "True" )
+ videoOn = true;
+ else
+ videoOn = false;
+
if(repetitiveConditionsWin != null)
repetitiveConditionsWin.VolumeOn = volumeOn;
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index bef3250..c60ec43 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -76,6 +76,7 @@ public class ChronopicWindow
[Widget] Gtk.Button button_connect_cp4;
[Widget] Gtk.Image chronopic_image;
+ [Widget] Gtk.TextView textview_ports_found;
//chronopic connection thread
Thread thread;
@@ -176,6 +177,7 @@ public class ChronopicWindow
ChronopicWindowBox.volumeOn = volumeOn;
ChronopicWindowBox.checkChronopicDisconnected();
ChronopicWindowBox.createCombos();
+ ChronopicWindowBox.findPorts();
ChronopicWindowBox.chronopic_window.Show();
return ChronopicWindowBox;
@@ -371,6 +373,10 @@ public class ChronopicWindow
else if (o == combo_linux4 || o == combo_windows4)
button_connect_cp4.Sensitive = portOk;
}
+
+ private void findPorts() {
+ textview_ports_found.Buffer = UtilGtk.TextViewPrint(Util.StringArrayToString(SerialPort.GetPortNames(),"\n"));
+ }
private void chronopicAtStart(object o, EventArgs args) {
//make active menuitem chronopic, and this
diff --git a/src/gui/helpPorts.cs b/src/gui/helpPorts.cs
index 7e87101..394cf1f 100644
--- a/src/gui/helpPorts.cs
+++ b/src/gui/helpPorts.cs
@@ -31,6 +31,7 @@ public class HelpPorts
[Widget] Gtk.TextView textview_info;
[Widget] Gtk.TextView textview_detected;
[Widget] Gtk.Label label_info;
+ [Widget] Gtk.Label label_detection;
[Widget] Gtk.Label label_detected;
[Widget] Gtk.Label label_manual;
[Widget] Gtk.Button button_check_port;
diff --git a/src/gui/person.cs b/src/gui/person.cs
index b63a9f2..98ed7a0 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -61,6 +61,7 @@ public class PersonRecuperateWindow {
protected int columnId = 0;
protected int firstColumn = 0;
protected int pDN;
+ protected bool videoOn;
public Gtk.Button fakeButtonDone;
@@ -97,12 +98,13 @@ public class PersonRecuperateWindow {
treeview_person_recuperate.Selection.Changed += onSelectionEntry;
}
- static public PersonRecuperateWindow Show (Gtk.Window parent, Session currentSession, int pDN)
+ static public PersonRecuperateWindow Show (Gtk.Window parent, Session currentSession, int pDN, bool videoOn)
{
if (PersonRecuperateWindowBox == null) {
PersonRecuperateWindowBox = new PersonRecuperateWindow (parent, currentSession);
}
PersonRecuperateWindowBox.pDN = pDN;
+ PersonRecuperateWindowBox.videoOn = videoOn;
PersonRecuperateWindowBox.person_recuperate.Show ();
@@ -250,7 +252,7 @@ public class PersonRecuperateWindow {
Person person = SqlitePerson.Select(Convert.ToInt32(selected));
personAddModifyWin = PersonAddModifyWindow.Show(
- parent, currentSession, person, pDN, true); //comes from recuperate window
+ parent, currentSession, person, pDN, true, videoOn); //comes from recuperate window
personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_current_person_accepted);
}
}
@@ -364,13 +366,14 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
treeview_person_recuperate.Selection.Changed += onSelectionEntry;
}
- static public new PersonsRecuperateFromOtherSessionWindow Show (Gtk.Window parent, Session currentSession)
+ static public new PersonsRecuperateFromOtherSessionWindow Show (Gtk.Window parent, Session currentSession, bool videoOn)
{
if (PersonsRecuperateFromOtherSessionWindowBox == null) {
PersonsRecuperateFromOtherSessionWindowBox =
new PersonsRecuperateFromOtherSessionWindow (parent, currentSession);
}
PersonsRecuperateFromOtherSessionWindowBox.person_recuperate.Show ();
+ PersonsRecuperateFromOtherSessionWindowBox.videoOn = videoOn;
return PersonsRecuperateFromOtherSessionWindowBox;
}
@@ -571,7 +574,7 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
Person person = SqlitePerson.Select(
Convert.ToInt32(treeview_person_recuperate.Model.GetValue(iter, 1)) );
personAddModifyWin = PersonAddModifyWindow.Show(
- parent, currentSession, person, pDN, true); //comes from recuperate window
+ parent, currentSession, person, pDN, true, videoOn); //comes from recuperate window
PersonAddModifyWindow.MakeVisible();
personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_current_person_accepted);
personAddModifyWin.FakeButtonCancel.Clicked += new EventHandler(on_edit_current_person_cancelled);
@@ -602,16 +605,17 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
Convert.ToInt32(myStringFull[0]) //select from this session (on combo_sessions)
);
- if(inserted == 1)
- statusbar1.Push( 1, Catalog.GetString("Loaded") + " " + currentPerson.Name );
- else //more inserted
- statusbar1.Push( 1, string.Format(Catalog.GetPluralString(
- "Successfully added one person.",
- "Successfully added {0} persons.",
- inserted),
- inserted));
-
- fakeButtonDone.Click();
+ if(inserted >= 1) {
+ if(inserted == 1)
+ statusbar1.Push( 1, Catalog.GetString("Loaded") + " " + currentPerson.Name );
+ else
+ statusbar1.Push( 1, string.Format(Catalog.GetPluralString(
+ "Successfully added one person.",
+ "Successfully added {0} persons.",
+ inserted),
+ inserted));
+ fakeButtonDone.Click();
+ }
}
//check if there are rows checked for having sensitive or not in recuperate button
@@ -638,9 +642,10 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
{
currentRow ++;
- Log.WriteLine("To sleep in order AddMoidfyWin gets closed, in order to open again");
+ Log.WriteLine("To sleep in order AddModifyWin gets closed, in order to open again");
System.Threading.Thread.Sleep (100);
Log.WriteLine("done");
+ inserted --;
processRow();
}
}
@@ -853,6 +858,7 @@ public class PersonAddModifyWindow
[Widget] Gtk.Button button_zoom;
[Widget] Gtk.Image image_photo_mini;
[Widget] Gtk.Image image_zoom;
+ [Widget] Gtk.Button button_take_photo;
[Widget] Gtk.Button button_accept;
[Widget] Gtk.Button button_cancel;
@@ -1089,7 +1095,7 @@ public class PersonAddModifyWindow
}
static public PersonAddModifyWindow Show (Gtk.Window parent,
- Session mySession, Person currentPerson, int pDN, bool comesFromRecuperateWin)
+ Session mySession, Person currentPerson, int pDN, bool comesFromRecuperateWin, bool videoOn)
{
if (comesFromRecuperateWin)
PersonAddModifyWindowBox = null;
@@ -1101,6 +1107,8 @@ public class PersonAddModifyWindow
PersonAddModifyWindowBox.pDN = pDN;
PersonAddModifyWindowBox.comesFromRecuperateWin = comesFromRecuperateWin;
+ PersonAddModifyWindowBox.button_take_photo.Sensitive = videoOn;
+
//No more hide cancel button.
//Better to show it and allow to not recuperate if user changes his mind
//if(comesFromRecuperateWin)
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 5426ccb..013d327 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -60,8 +60,12 @@ public class PreferencesWindow {
[Widget] Gtk.TextView textview_power;
[Widget] Gtk.CheckButton checkbutton_volume;
+ [Widget] Gtk.CheckButton checkbutton_video;
[Widget] Gtk.Image image_volume;
[Widget] Gtk.Label label_volume;
+ [Widget] Gtk.Image image_video_yes;
+ [Widget] Gtk.Image image_video_no;
+ [Widget] Gtk.Label label_video;
// [Widget] Gtk.Box hbox_language_row;
// [Widget] Gtk.Box hbox_combo_language;
@@ -96,7 +100,7 @@ public class PreferencesWindow {
static public PreferencesWindow Show (int digitsNumber, bool showHeight, bool showPower,
bool showInitialSpeed, bool showAngle, bool showQIndex, bool showDjIndex,
bool askDeletion, bool weightStatsPercent, bool heightPreferred, bool metersSecondsPreferred,
- string language, bool allowFinishRjAfterTime, bool volumeOn)
+ string language, bool allowFinishRjAfterTime, bool volumeOn, bool videoOn)
{
if (PreferencesWindowBox == null) {
PreferencesWindowBox = new PreferencesWindow ();
@@ -182,6 +186,10 @@ public class PreferencesWindow {
UtilGtk.ColorsCheck(PreferencesWindowBox.checkbutton_volume);
PreferencesWindowBox.checkbutton_volume.Active = volumeOn;
PreferencesWindowBox.on_checkbutton_volume_clicked(new object(), new EventArgs());
+
+ UtilGtk.ColorsCheck(PreferencesWindowBox.checkbutton_video);
+ PreferencesWindowBox.checkbutton_video.Active = videoOn;
+ PreferencesWindowBox.on_checkbutton_video_clicked(new object(), new EventArgs());
PreferencesWindowBox.preferences.Show ();
return PreferencesWindowBox;
@@ -201,17 +209,36 @@ public class PreferencesWindow {
private void on_checkbutton_volume_clicked(object o, EventArgs args) {
if(checkbutton_volume.Active) {
-Log.Write("A");
SqlitePreferences.Update("volumeOn", "True", false);
label_volume.Text = Catalog.GetString("Sound activated.");
} else {
-Log.Write("B");
SqlitePreferences.Update("volumeOn", "False", false);
label_volume.Text = Catalog.GetString("No Sound.");
}
changeVolumeButton(checkbutton_volume.Active);
}
+ private void changeVideoButton(bool myVideo) {
+ image_video_yes.Visible = myVideo;
+ image_video_no.Visible = ! myVideo;
+
+ if(myVideo)
+ label_video.Text = Catalog.GetString("Enabled test video recording and person's snapshots.");
+ else
+ label_video.Text = Catalog.GetString("Disabled video and snapshots.");
+ }
+
+ private void on_checkbutton_video_clicked(object o, EventArgs args) {
+ if(checkbutton_video.Active) {
+ SqlitePreferences.Update("videoOn", "True", false);
+ label_video.Text = Catalog.GetString("Enabled test video recording and person's snapshots.");
+ } else {
+ SqlitePreferences.Update("videoOn", "False", false);
+ label_video.Text = Catalog.GetString("Disabled video and snapshots.");
+ }
+ changeVideoButton(checkbutton_video.Active);
+ }
+
private void createComboLanguage(string myLanguageCode) {
/*
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 10a9d12..588a626 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -72,7 +72,7 @@ class Sqlite
* Important, change this if there's any update to database
* Important2: if database version get numbers higher than 1, check if the comparisons with currentVersion works ok
*/
- static string lastChronojumpDatabaseVersion = "0.81";
+ static string lastChronojumpDatabaseVersion = "0.82";
public Sqlite() {
}
@@ -1105,6 +1105,20 @@ class Sqlite
dbcon.Close();
currentVersion = "0.81";
}
+ if(currentVersion == "0.81") {
+ dbcon.Open();
+ conversionRateTotal = 2;
+
+ conversionRate = 1;
+ SqlitePreferences.Insert ("videoOn", "True");
+ conversionRate = 2;
+ Log.WriteLine("Converted DB to 0.82 Added videoOn");
+
+ SqlitePreferences.Update ("databaseVersion", "0.82", true);
+
+ dbcon.Close();
+ currentVersion = "0.82";
+ }
}
//if changes are made here, remember to change also in CreateTables()
@@ -1237,6 +1251,7 @@ class Sqlite
SqliteCountry.initialize();
//changes [from - to - desc]
+ //0.81 - 0.82 Converted DB to 0.82 Added videoOn
//0.80 - 0.81 Converted DB to 0.81 Added tempRunInterval initial speed
//0.79 - 0.80 Converted DB to 0.80 Added run and runInterval initial speed (if not done in 0.56 conversion)
//0.78 - 0.79 Converted DB to 0.79 (Added multimediaStorage structure id)
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 7d2a175..4f0d853 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -59,6 +59,7 @@ class SqlitePreferences : Sqlite
Insert ("language", "es-ES");
Insert ("allowFinishRjAfterTime", "True");
Insert ("volumeOn", "True");
+ Insert ("videoOn", "True");
Insert ("evaluatorServerID", "-1");
Insert ("versionAvailable", "");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]