[chronojump] SQL tests and debug mode into preferences
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] SQL tests and debug mode into preferences
- Date: Fri, 4 Mar 2016 12:33:52 +0000 (UTC)
commit b82f1b3b6477f7f77d10ae5df61062eb4753b5f5
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Mar 4 13:31:26 2016 +0100
SQL tests and debug mode into preferences
glade/chronojump.glade | 293 ++++++++++++++++++++++++++++++++----------------
src/gui/chronojump.cs | 49 +--------
src/gui/preferences.cs | 78 +++++++++++++-
src/util.cs | 2 +-
src/utilAll.cs | 10 ++
5 files changed, 286 insertions(+), 146 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 6b50f2d..2a9b9ca 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -462,53 +462,6 @@
<signal name="activate" handler="on_menuitem_presentation_activate" swapped="no"/>
</widget>
</child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separator4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menuitem_SQL_stress_test_safe_short">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">SQL stress test SAFE short</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_menuitem_SQL_stress_test_safe_short_activate"
swapped="no"/>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menuitem_SQL_stress_test_safe_long">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">SQL stress test SAFE long</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_menuitem_SQL_stress_test_safe_long_activate"
swapped="no"/>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menuitem_SQL_stress_test_not_safe_short">
- <property name="can_focus">False</property>
- <property name="label">SQL stress test NOT SAFE short</property>
- <signal name="activate"
handler="on_menuitem_SQL_stress_test_not_safe_short_activate" swapped="no"/>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menuitem_SQL_stress_test_not_safe_long">
- <property name="can_focus">False</property>
- <property name="label">SQL stress test NOT SAFE long</property>
- <signal name="activate" handler="on_menuitem_SQL_stress_test_not_safe_long_activate"
swapped="no"/>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menuitem_debug_mode">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Enter debug mode (developers)</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_menuitem_debug_mode_activate" swapped="no"/>
- </widget>
- </child>
</widget>
</child>
</widget>
@@ -44074,7 +44027,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
</child>
</widget>
<widget class="GtkWindow" id="preferences_win">
- <property name="height_request">450</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">10</property>
@@ -44100,7 +44052,7 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">16</property>
- <property name="spacing">20</property>
+ <property name="spacing">25</property>
<child>
<widget class="GtkFrame" id="frame3">
<property name="visible">True</property>
@@ -44271,21 +44223,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
</packing>
</child>
<child>
- <widget class="GtkButton" id="button_logs_folder_open">
- <property name="label" translatable="yes">Open logs folder</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="on_button_logs_folder_open_clicked"
swapped="no"/>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
<widget class="GtkButton" id="button_import_configuration">
<property name="label" translatable="yes">Import configuration</property>
<property name="visible">True</property>
@@ -44297,7 +44234,7 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
@@ -46332,7 +46269,7 @@ It starts before and arrives there with some speed.</property>
<widget class="GtkHBox" id="hbox14">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">20</property>
+ <property name="spacing">10</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
@@ -46394,50 +46331,62 @@ It starts before and arrives there with some speed.</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">8</property>
- <property name="spacing">20</property>
+ <property name="spacing">30</property>
<child>
- <widget class="GtkCheckButton" id="checkbutton_ask_deletion">
- <property name="label" translatable="yes">Ask for confirm test deletion</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip" translatable="yes">Ask user if really wants to delete a
test</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox87">
+ <widget class="GtkVBox" id="vbox19">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">20</property>
<child>
- <widget class="GtkLabel" id="label38">
+ <widget class="GtkCheckButton" id="checkbutton_ask_deletion">
+ <property name="label" translatable="yes">Ask for confirm test deletion</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Decimal number</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Ask user if really wants to delete a
test</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="combo_decimals">
+ <widget class="GtkHBox" id="hbox87">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="items">1
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label38">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Decimal number</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="combo_decimals">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="items">1
2
3</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -46449,11 +46398,161 @@ It starts before and arrives there with some speed.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <placeholder/>
+ <widget class="GtkFrame" id="frame8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <widget class="GtkVBox" id="vbox20">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">8</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">16</property>
+ <child>
+ <widget class="GtkButton" id="button_logs_folder_open">
+ <property name="label" translatable="yes">Open logs folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="on_button_logs_folder_open_clicked"
swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_tmp_folder_open">
+ <property name="label" translatable="yes">Open temp folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="on_button_tmp_folder_open_clicked"
swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button3">
+ <property name="label" translatable="yes">Enter debug mode</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_debug_mode_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">16</property>
+ <property name="layout_style">spread</property>
+ <child>
+ <widget class="GtkButton" id="button1">
+ <property name="label" translatable="yes">SQL short test</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_SQL_stress_test_safe_short_clicked"
swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button2">
+ <property name="label" translatable="yes">SQL long test</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_SQL_stress_test_safe_long_clicked"
swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </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_advanced_feedback">
+ <property name="height_request">30</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label54">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Developer options</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 3b6028a..8c688c6 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -33,8 +33,6 @@ using LongoMatch.Video.Capturer;
using LongoMatch.Video.Common;
using LongoMatch.Video.Utils;
-using System.Diagnostics; //StopWatch
-
public partial class ChronoJumpWindow
{
[Widget] Gtk.Window app1;
@@ -2907,6 +2905,7 @@ public partial class ChronoJumpWindow
preferencesWin = PreferencesWindow.Show(preferences);
preferencesWin.FakeButtonImported.Clicked += new
EventHandler(on_preferences_import_configuration);
+ preferencesWin.FakeButtonDebugModeStart.Clicked += new
EventHandler(on_preferences_debug_mode_start);
preferencesWin.Button_accept.Clicked += new EventHandler(on_preferences_accepted);
}
@@ -6233,54 +6232,12 @@ LogB.Debug("X");
*/
}
- // ---- start SQL stress tests ---->
-
- private void on_menuitem_SQL_stress_test_safe_short_activate (object o, EventArgs args) {
- LogB.Information("start safe short stress test ---->");
- sql_stress_test(1000);
- }
- private void on_menuitem_SQL_stress_test_safe_long_activate (object o, EventArgs args) {
- LogB.Information("start safe long stress test ---->");
- sql_stress_test(4000);
- }
- private void on_menuitem_SQL_stress_test_not_safe_short_activate (object o, EventArgs args) {
- LogB.Information("start not safe short stress test ---->");
- Sqlite.SafeClose = false;
- sql_stress_test(1000);
- Sqlite.SafeClose = true;
- }
- private void on_menuitem_SQL_stress_test_not_safe_long_activate (object o, EventArgs args) {
- LogB.Information("start not safe long stress test ---->");
- Sqlite.SafeClose = false;
- sql_stress_test(4000);
- Sqlite.SafeClose = true;
- }
- private void sql_stress_test (int times) {
- Stopwatch sw = new Stopwatch();
-
- sw.Start();
-
- //trying if new way of Sqlite.Close disposing dbcmd fixes problems when multiple open / close
connection
- for(int i=0 ; i < times; i++) {
- LogB.Debug (" i=" + i.ToString());
- LogB.Debug(SqlitePreferences.Select("databaseVersion"));
- }
- sw.Stop();
-
- string message = "SQL test successfull!" + "\n\n" +
- "Done " + times + " times." + "\n\n" +
- "Elapsed " + sw.ElapsedMilliseconds + " milliseconds.";
- LogB.Information(message);
- new DialogMessage(Constants.MessageTypes.INFO, message);
- }
-
- // <---- end SQL stress tests ----
- private void on_menuitem_debug_mode_activate (object o, EventArgs args) {
+ private void on_preferences_debug_mode_start (object o, EventArgs args) {
encoderRProcCapture.Debug = true;
encoderRProcAnalyze.Debug = true;
- new DialogMessage(Constants.MessageTypes.INFO, "Activated debug mode while Chronojump is
running.");
+ preferencesWin.DebugActivated();
}
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 64f3ec6..ba2d6ac 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -31,6 +31,9 @@ using Mono.Unix;
using System.Threading;
using System.Globalization; //CultureInfo stuff
+using System.Diagnostics; //Stopwatch
+
+
/*
using ICSharpCode.SharpZipLib.Tar;
using ICSharpCode.SharpZipLib.GZip;
@@ -42,7 +45,7 @@ public class PreferencesWindow {
[Widget] Gtk.Window preferences_win;
- //database tab
+ //main tab
[Widget] Gtk.Button button_data_folder_open;
[Widget] Gtk.CheckButton check_backup_multimedia_and_encoder;
@@ -111,16 +114,18 @@ public class PreferencesWindow {
[Widget] Gtk.RadioButton radio_graphs_no_translate;
[Widget] Gtk.Box hbox_need_restart;
- //other tab
+ //advanced tab
[Widget] Gtk.ComboBox combo_decimals;
[Widget] Gtk.CheckButton checkbutton_ask_deletion;
[Widget] Gtk.RadioButton radio_export_latin;
[Widget] Gtk.RadioButton radio_export_non_latin;
+ [Widget] Gtk.Label label_advanced_feedback;
[Widget] Gtk.Button button_accept;
[Widget] Gtk.Button button_cancel;
public Gtk.Button FakeButtonImported;
+ public Gtk.Button FakeButtonDebugModeStart;
static PreferencesWindow PreferencesWindowBox;
@@ -146,6 +151,7 @@ public class PreferencesWindow {
databaseTempURL = Util.GetDatabaseTempDir() + System.IO.Path.DirectorySeparatorChar +
"chronojump.db";
FakeButtonImported = new Gtk.Button();
+ FakeButtonDebugModeStart = new Gtk.Button();
}
static public PreferencesWindow Show (Preferences preferences)
@@ -480,6 +486,22 @@ public class PreferencesWindow {
Constants.DirectoryCannotOpen + "\n\n" + dir);
}
}
+
+ void on_button_tmp_folder_open_clicked (object o, EventArgs args)
+ {
+ string dir = UtilAll.GetTempDir(); //potser cal una arrobar abans (a windows)
+ System.IO.FileInfo fInfo = new System.IO.FileInfo(dir);
+
+ try {
+ if(fInfo.Exists)
+ System.Diagnostics.Process.Start(dir);
+ } catch {
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ Constants.DirectoryCannotOpen + "\n\n" + dir);
+ }
+
+ LogB.Warning(dir);
+ }
@@ -698,7 +720,59 @@ public class PreferencesWindow {
}
}
*/
+
+
+ // ---- start SQL stress tests ---->
+ private void on_SQL_stress_test_safe_short_clicked (object o, EventArgs args) {
+ LogB.Information("start safe short stress test ---->");
+ sql_stress_test(1000);
+ }
+ private void on_SQL_stress_test_safe_long_clicked (object o, EventArgs args) {
+ LogB.Information("start safe long stress test ---->");
+ sql_stress_test(4000);
+ }
+ private void on_SQL_stress_test_not_safe_short_clicked (object o, EventArgs args) {
+ LogB.Information("start not safe short stress test ---->");
+ Sqlite.SafeClose = false;
+ sql_stress_test(1000);
+ Sqlite.SafeClose = true;
+ }
+ private void on_SQL_stress_test_not_safe_long_clicked (object o, EventArgs args) {
+ LogB.Information("start not safe long stress test ---->");
+ Sqlite.SafeClose = false;
+ sql_stress_test(4000);
+ Sqlite.SafeClose = true;
+ }
+ private void sql_stress_test (int times) {
+ Stopwatch sw = new Stopwatch();
+
+ sw.Start();
+
+ //trying if new way of Sqlite.Close disposing dbcmd fixes problems when multiple open / close
connection
+ for(int i=0 ; i < times; i++) {
+ LogB.Debug (" i=" + i.ToString());
+ LogB.Debug(SqlitePreferences.Select("databaseVersion"));
+ }
+ sw.Stop();
+
+ string message = "Success!" +
+ " Done " + times + " times." +
+ " Elapsed " + sw.ElapsedMilliseconds + " ms";
+ LogB.Information(message);
+
+ label_advanced_feedback.Text = message;
+ }
+
+ // <---- end SQL stress tests ----
+
+ private void on_debug_mode_clicked (object o, EventArgs args) {
+ //will be managed from gui/chronojump.cs
+ FakeButtonDebugModeStart.Click();
+ }
+ public void DebugActivated() {
+ label_advanced_feedback.Text = "Debug mode on while Chronojump is running.";
+ }
private bool PulseGTK ()
{
diff --git a/src/util.cs b/src/util.cs
index 1f87d63..fb026e2 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -813,7 +813,7 @@ public class Util
public static string GetDatabaseTempDir() {
return Path.Combine(Path.GetTempPath(), "Chronojump");
}
-
+
/********** end of database paths ************/
/*
diff --git a/src/utilAll.cs b/src/utilAll.cs
index 722531b..d7b307d 100644
--- a/src/utilAll.cs
+++ b/src/utilAll.cs
@@ -158,5 +158,15 @@ public class UtilAll
public static string GetLogFileOld() {
return Path.Combine(GetLogsDir() + Path.DirectorySeparatorChar + Constants.FileNameLogOld);
}
+
+ public static string GetTempDir() {
+ string path = Path.GetTempPath();
+
+ path = path.TrimEnd(Path.DirectorySeparatorChar);
+ //on Linux folder cannot be opened either with '/' at the end, or without it
+
+ return path;
+ }
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]