[nemiver/profiler] Preferences dialog added for the profiling perspective



commit f8e67b0d59a6e05c158d58dfa758a711efa834b8
Author: Fabien Parent <parent f gmail com>
Date:   Sun Jul 8 18:35:06 2012 +0200

    Preferences dialog added for the profiling perspective

 data/schemas/gconf/Makefile.am                     |    5 +-
 data/schemas/gconf/nemiver-profperspective.schemas |   77 ++++
 data/schemas/gsettings/org.nemiver.gschema.xml     |   36 ++
 src/confmgr/nmv-conf-keys.h                        |    7 +
 src/confmgr/nmv-gconf-keys-defs.cc                 |   14 +
 src/confmgr/nmv-gsettings-keys-defs.cc             |    8 +
 src/persp/profperspective/Makefile.am              |    4 +-
 src/persp/profperspective/menus/menus.xml          |    6 +
 src/persp/profperspective/nmv-prof-perspective.cc  |   35 ++-
 .../profperspective/nmv-prof-preferences-dialog.cc |  298 ++++++++++++
 .../profperspective/nmv-prof-preferences-dialog.h  |   51 ++
 src/persp/profperspective/ui/Makefile.am           |    2 +-
 src/persp/profperspective/ui/preferencesdialog.ui  |  287 ++++++++++++
 src/persp/profperspective/ui/recorddialog.ui       |  481 --------------------
 14 files changed, 821 insertions(+), 490 deletions(-)
---
diff --git a/data/schemas/gconf/Makefile.am b/data/schemas/gconf/Makefile.am
index d4c2d8d..7b79081 100644
--- a/data/schemas/gconf/Makefile.am
+++ b/data/schemas/gconf/Makefile.am
@@ -1,4 +1,7 @@
-files=nemiver-dbgperspective.schemas nemiver-workbench.schemas
+files=nemiver-dbgperspective.schemas \
+nemiver-workbench.schemas \
+nemiver-profperspective.schemas
+
 schemasdir = $(GCONF_SCHEMA_FILE_DIR)
 schemas_DATA = $(files)
 
diff --git a/data/schemas/gconf/nemiver-profperspective.schemas b/data/schemas/gconf/nemiver-profperspective.schemas
new file mode 100644
index 0000000..066909c
--- /dev/null
+++ b/data/schemas/gconf/nemiver-profperspective.schemas
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<gconfschemafile>
+  <schemalist>
+    <schema>
+      <key>/schemas/apps/nemiver/profperspective/do-callgraph-recording</key>
+      <applyto>/apps/nemiver/dbgperspective/do-callgraph-recording</applyto>
+      <owner>nemiver</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Whether to record the callgraph while profiling</short>
+        <long>Whether to record the callgraph while profiling</long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/nemiver/profperspective/collect-without-buffering</key>
+      <applyto>/apps/nemiver/dbgperspective/collect-without-buffering</applyto>
+      <owner>nemiver</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Whether to collect data without buffering while profiling</short>
+        <long>Whether to collect data without buffering while profiling</long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/nemiver/profperspective/collect-raw-sample-records</key>
+      <applyto>/apps/nemiver/dbgperspective/collect-raw-sample-records</applyto>
+      <owner>nemiver</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Whether to collect raw sample records while profiling</short>
+        <long>Whether to collect raw sample records from all opened counters while profiling</long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/nemiver/profperspective/system-wide-collection</key>
+      <applyto>/apps/nemiver/dbgperspective/system-wide-collection</applyto>
+      <owner>nemiver</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Whether to do a system wide data collection while profiling</short>
+        <long>Whether to do a system wide data collection from all CPUs while profiling</long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/nemiver/profperspective/sample-addresses</key>
+      <applyto>/apps/nemiver/dbgperspective/sample-addresses</applyto>
+      <owner>nemiver</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Whether to sample addresses while profiling</short>
+        <long>Whether to sample addresses while profiling</long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/nemiver/profperspective/sample-timestamps</key>
+      <applyto>/apps/nemiver/dbgperspective/sample-timestamps</applyto>
+      <owner>nemiver</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Whether to sample timestamps while profiling</short>
+        <long>Whether to sample timestamps while profiling</long>
+      </locale>
+    </schema>
+  </schemalist>
+</gconfschemafile>
+
diff --git a/data/schemas/gsettings/org.nemiver.gschema.xml b/data/schemas/gsettings/org.nemiver.gschema.xml
index ff2bdcd..722534a 100644
--- a/data/schemas/gsettings/org.nemiver.gschema.xml
+++ b/data/schemas/gsettings/org.nemiver.gschema.xml
@@ -203,5 +203,41 @@
       <summary>window minimum height</summary>
       <description>The workbench main window minium height.</description>
     </key>
+
+    <key name="do-callgraph-recording" type="b">
+      <default>true</default>
+      <summary>Whether to record the callgraph while profiling</summary>
+      <description>Whether to record the callgraph while profiling</description>
+    </key>
+
+    <key name="collect-without-buffering" type="b">
+      <default>false</default>
+      <summary>Whether to collect data without buffering while profiling</summary>
+      <description>Whether to collect data without buffering while profiling</description>
+    </key>
+
+    <key name="collect-raw-sample-records" type="b">
+      <default>false</default>
+      <summary>Whether to collect raw sample records while profiling</summary>
+      <description>Whether to collect raw sample records from all opened counters while profiling</description>
+    </key>
+
+    <key name="system-wide-collection" type="b">
+      <default>false</default>
+      <summary>Whether to do a system wide data collection while profiling</summary>
+      <description>Whether to do a system wide data collection from all CPUs while profiling</description>
+    </key>
+
+    <key name="sample-addresses" type="b">
+      <default>false</default>
+      <summary>Whether to sample addresses while profiling</summary>
+      <description>Whether to sample addresses while profiling</description>
+    </key>
+
+    <key name="sample-timestamps" type="b">
+      <default>false</default>
+      <summary>Whether to sample timestamps while profiling</summary>
+      <description>Whether to sample timestamps while profiling</description>
+    </key>
   </schema>
 </schemalist>
diff --git a/src/confmgr/nmv-conf-keys.h b/src/confmgr/nmv-conf-keys.h
index 0d01639..85beac0 100644
--- a/src/confmgr/nmv-conf-keys.h
+++ b/src/confmgr/nmv-conf-keys.h
@@ -64,6 +64,13 @@ extern const char* CONF_KEY_CONTEXT_PANE_LOCATION;
 extern const char* CONF_KEY_NEMIVER_CALLSTACK_EXPANSION_CHUNK;
 extern const char* CONF_KEY_DBG_PERSPECTIVE_LAYOUT;
 
+extern const char* CONF_KEY_DO_CALLGRAPH_RECORDING;
+extern const char* CONF_KEY_COLLECT_WITHOUT_BUFFERING;
+extern const char* CONF_KEY_COLLECT_RAW_SAMPLE_RECORDS;
+extern const char* CONF_KEY_SYSTEM_WIDE_COLLECTION;
+extern const char* CONF_KEY_SAMPLE_ADDRESSES;
+extern const char* CONF_KEY_SAMPLE_TIMESTAMPS;
+
 extern const char* CONF_KEY_NEMIVER_WINDOW_WIDTH;
 extern const char* CONF_KEY_NEMIVER_WINDOW_HEIGHT;
 extern const char* CONF_KEY_NEMIVER_WINDOW_POSITION_X;
diff --git a/src/confmgr/nmv-gconf-keys-defs.cc b/src/confmgr/nmv-gconf-keys-defs.cc
index 950526c..db65d9d 100644
--- a/src/confmgr/nmv-gconf-keys-defs.cc
+++ b/src/confmgr/nmv-gconf-keys-defs.cc
@@ -92,6 +92,20 @@ const char* CONF_KEY_NEMIVER_CALLSTACK_EXPANSION_CHUNK =
 const char* CONF_KEY_DBG_PERSPECTIVE_LAYOUT =
                 "/apps/nemiver/dbgperspective/layout";
 
+/* profperspective */
+const char* CONF_KEY_DO_CALLGRAPH_RECORDING =
+                "/apps/nemiver/profperspective/do-callgraph-recording";
+const char* CONF_KEY_COLLECT_WITHOUT_BUFFERING =
+                "/apps/nemiver/profperspective/collect-without-buffering";
+const char* CONF_KEY_COLLECT_RAW_SAMPLE_RECORDS =
+                "/apps/nemiver/profperspective/collect-raw-sample-records";
+const char* CONF_KEY_SYSTEM_WIDE_COLLECTION =
+                "/apps/nemiver/profperspective/system-wide-collection";
+const char* CONF_KEY_SAMPLE_ADDRESSES =
+                "/apps/nemiver/profperspective/sample-addresses";
+const char* CONF_KEY_SAMPLE_TIMESTAMPS =
+                "/apps/nemiver/profperspective/sample-timestamps";
+
 /* Workbench */
 const char* CONF_KEY_NEMIVER_WINDOW_WIDTH =
                 "/apps/nemiver/workbench/window-width";
diff --git a/src/confmgr/nmv-gsettings-keys-defs.cc b/src/confmgr/nmv-gsettings-keys-defs.cc
index 1bc7ec2..a599b66 100644
--- a/src/confmgr/nmv-gsettings-keys-defs.cc
+++ b/src/confmgr/nmv-gsettings-keys-defs.cc
@@ -70,6 +70,14 @@ const char* CONF_KEY_NEMIVER_CALLSTACK_EXPANSION_CHUNK =
                 "callstack-expansion-chunk";
 const char* CONF_KEY_DBG_PERSPECTIVE_LAYOUT = "dbg-perspective-layout";
 
+/* profperspective */
+const char* CONF_KEY_DO_CALLGRAPH_RECORDING = "do-callgraph-recording";
+const char* CONF_KEY_COLLECT_WITHOUT_BUFFERING = "collect-without-buffering";
+const char* CONF_KEY_COLLECT_RAW_SAMPLE_RECORDS = "collect-raw-sample-records";
+const char* CONF_KEY_SYSTEM_WIDE_COLLECTION = "system-wide-collection";
+const char* CONF_KEY_SAMPLE_ADDRESSES = "sample-addresses";
+const char* CONF_KEY_SAMPLE_TIMESTAMPS = "sample-timestamps";
+
 /* Workbench */
 const char* CONF_KEY_NEMIVER_WINDOW_WIDTH = "window-width";
 const char* CONF_KEY_NEMIVER_WINDOW_HEIGHT = "window-height";
diff --git a/src/persp/profperspective/Makefile.am b/src/persp/profperspective/Makefile.am
index f88bea5..68a57ce 100644
--- a/src/persp/profperspective/Makefile.am
+++ b/src/persp/profperspective/Makefile.am
@@ -21,7 +21,9 @@ $(h)/nmv-prof-perspective.h \
 $(h)/nmv-call-list.cc \
 $(h)/nmv-call-list.h \
 $(h)/nmv-load-report-dialog.cc \
-$(h)/nmv-load-report-dialog.h
+$(h)/nmv-load-report-dialog.h \
+$(h)/nmv-prof-preferences-dialog.cc \
+$(h)/nmv-prof-preferences-dialog.h
 
 libprofperspectiveplugin_la_SOURCES=$(sources)
 libprofperspectiveplugin_la_LDFLAGS= -module -avoid-version -Wl,--as-needed
diff --git a/src/persp/profperspective/menus/menus.xml b/src/persp/profperspective/menus/menus.xml
index a5977fe..b6d046b 100644
--- a/src/persp/profperspective/menus/menus.xml
+++ b/src/persp/profperspective/menus/menus.xml
@@ -11,6 +11,12 @@
                       name="AttachToProcessItem"/>
         </placeholder>
     </menu>
+    <menu action="EditMenuAction" name="EditMenu">
+        <placeholder name="EditMenuAdditions">
+            <menuitem action="ProfilerPreferencesAction"
+                      name="ProfilerPreferencesItem"/>
+        </placeholder>
+    </menu>
   </menubar>
  </ui>
 
diff --git a/src/persp/profperspective/nmv-prof-perspective.cc b/src/persp/profperspective/nmv-prof-perspective.cc
index db104f9..81cd389 100644
--- a/src/persp/profperspective/nmv-prof-perspective.cc
+++ b/src/persp/profperspective/nmv-prof-perspective.cc
@@ -23,6 +23,7 @@
  *See COPYRIGHT file copyright information.
  */
 
+#include "nmv-prof-preferences-dialog.h"
 #include "nmv-prof-perspective.h"
 #include "nmv-ui-utils.h"
 #include "nmv-load-report-dialog.h"
@@ -121,6 +122,7 @@ public:
     void attach_to_process (unsigned a_pid);
     IProcMgr* process_manager ();
 
+    void on_preferences_action ();
     void on_attach_to_process_action ();
     void on_stop_recording_action ();
     void on_run_executable_action ();
@@ -491,6 +493,16 @@ ProfPerspective::init_actions ()
             ui_utils::ActionEntry::DEFAULT,
             "",
             false
+        },
+        {
+            "ProfilerPreferencesAction",
+            Gtk::Stock::PREFERENCES,
+            _("Pr_eferences"),
+            _("Profiler's preferences"),
+            sigc::mem_fun (*this, &ProfPerspective::on_preferences_action),
+            ui_utils::ActionEntry::DEFAULT,
+            "",
+            false
         }
     };
 
@@ -651,31 +663,42 @@ ProfPerspective::on_attach_to_process_action ()
 void
 ProfPerspective::on_stop_recording_action ()
 {
-    NEMIVER_TRY
+    NEMIVER_TRY;
 
     stop_recording ();
 
-    NEMIVER_CATCH
+    NEMIVER_CATCH;
 }
 
 void
 ProfPerspective::on_load_report_file_action ()
 {
-    NEMIVER_TRY
+    NEMIVER_TRY;
 
     load_report_file ();
 
-    NEMIVER_CATCH
+    NEMIVER_CATCH;
+}
+
+void
+ProfPerspective::on_preferences_action ()
+{
+    NEMIVER_TRY;
+
+    ProfPreferencesDialog dialog (*this, plugin_path ());
+    dialog.run ();
+
+    NEMIVER_CATCH;
 }
 
 void
 ProfPerspective::on_run_executable_action ()
 {
-    NEMIVER_TRY
+    NEMIVER_TRY;
 
     run_executable ();
 
-    NEMIVER_CATCH
+    NEMIVER_CATCH;
 }
 
 Gtk::Widget*
diff --git a/src/persp/profperspective/nmv-prof-preferences-dialog.cc b/src/persp/profperspective/nmv-prof-preferences-dialog.cc
new file mode 100644
index 0000000..cad9201
--- /dev/null
+++ b/src/persp/profperspective/nmv-prof-preferences-dialog.cc
@@ -0,0 +1,298 @@
+//Author: Fabien Parent
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+#include "nmv-prof-preferences-dialog.h"
+#include "nmv-ui-utils.h"
+#include "nmv-i-conf-mgr.h"
+#include "nmv-i-perspective.h"
+#include "nmv-conf-keys.h"
+#include "common/nmv-env.h"
+#include <gtkmm/checkbutton.h>
+
+NEMIVER_BEGIN_NAMESPACE(nemiver)
+
+class ProfPreferencesDialog::Priv {
+    Priv ();
+
+    IPerspective &perspective;
+    Glib::RefPtr<Gtk::Builder> gtkbuilder;
+    Gtk::CheckButton *callgraph_checkbutton;
+    Gtk::CheckButton *no_buffering_checkbutton;
+    Gtk::CheckButton *raw_sample_checkbutton;
+    Gtk::CheckButton *system_wide_collection_checkbutton;
+    Gtk::CheckButton *sample_addresses_checkbutton;
+    Gtk::CheckButton *sample_timestamps_checkbutton;
+
+public:
+
+    Priv (const Glib::RefPtr<Gtk::Builder> &a_gtkbuilder,
+          IPerspective &a_perspective) :
+        perspective (a_perspective),
+        gtkbuilder (a_gtkbuilder),
+        callgraph_checkbutton (0),
+        no_buffering_checkbutton (0),
+        raw_sample_checkbutton (0),
+        system_wide_collection_checkbutton (0),
+        sample_addresses_checkbutton (0),
+        sample_timestamps_checkbutton (0)
+    {
+        init ();
+    }
+
+    void
+    on_callgraph_toggled_signal ()
+    {
+        update_callgraph_key ();
+    }
+
+    void
+    on_no_buffering_toggled_signal ()
+    {
+        update_no_buffering_key ();
+    }
+
+    void
+    on_raw_sample_toggled_signal ()
+    {
+        update_raw_sample_key ();
+    }
+
+    void
+    on_system_wide_collection_toggled_signal ()
+    {
+        update_system_wide_collection_key ();
+    }
+
+    void
+    on_sample_addresses_toggled_signal ()
+    {
+        update_sample_addresses_key ();
+    }
+
+    void
+    on_sample_timestamps_toggled_signal ()
+    {
+        update_sample_timestamps_key ();
+    }
+
+    void
+    init ()
+    {
+        init_recording_tab ();
+    }
+
+    void
+    init_recording_tab ()
+    {
+        callgraph_checkbutton =
+            ui_utils::get_widget_from_gtkbuilder<Gtk::CheckButton>
+                (gtkbuilder, "callgraphcheckbutton");
+        THROW_IF_FAIL (callgraph_checkbutton);
+        callgraph_checkbutton->signal_toggled ().connect (sigc::mem_fun
+            (*this, &ProfPreferencesDialog::Priv::on_callgraph_toggled_signal));
+
+        no_buffering_checkbutton =
+            ui_utils::get_widget_from_gtkbuilder<Gtk::CheckButton>
+                (gtkbuilder, "nobufferingcheckbutton");
+        THROW_IF_FAIL (no_buffering_checkbutton);
+        no_buffering_checkbutton->signal_toggled ().connect (sigc::mem_fun
+            (*this,
+             &ProfPreferencesDialog::Priv::on_no_buffering_toggled_signal));
+
+        raw_sample_checkbutton =
+            ui_utils::get_widget_from_gtkbuilder<Gtk::CheckButton>
+                (gtkbuilder, "rawsamplecheckbutton");
+        THROW_IF_FAIL (raw_sample_checkbutton);
+        raw_sample_checkbutton->signal_toggled ().connect (sigc::mem_fun
+            (*this,
+             &ProfPreferencesDialog::Priv::on_raw_sample_toggled_signal));
+
+        system_wide_collection_checkbutton =
+            ui_utils::get_widget_from_gtkbuilder<Gtk::CheckButton>
+                (gtkbuilder, "systemcollctioncheckbutton");
+        THROW_IF_FAIL (system_wide_collection_checkbutton);
+        system_wide_collection_checkbutton->signal_toggled ().connect
+            (sigc::mem_fun (*this, &ProfPreferencesDialog::Priv
+                                ::on_system_wide_collection_toggled_signal));
+
+        sample_timestamps_checkbutton =
+            ui_utils::get_widget_from_gtkbuilder<Gtk::CheckButton>
+                (gtkbuilder, "timestampsamplecheckbutton");
+        THROW_IF_FAIL (sample_timestamps_checkbutton);
+        sample_timestamps_checkbutton->signal_toggled ().connect (sigc::mem_fun
+            (*this, &ProfPreferencesDialog::Priv
+                        ::on_sample_timestamps_toggled_signal));
+
+        sample_addresses_checkbutton =
+            ui_utils::get_widget_from_gtkbuilder<Gtk::CheckButton>
+                (gtkbuilder, "addresssamplecheckbutton");
+        THROW_IF_FAIL (sample_addresses_checkbutton);
+        sample_addresses_checkbutton->signal_toggled ().connect (sigc::mem_fun
+            (*this,
+             &ProfPreferencesDialog::Priv::on_sample_addresses_toggled_signal));
+    }
+
+    IConfMgr&
+    conf_manager () const
+    {
+        IConfMgrSafePtr conf_mgr =
+            perspective.get_workbench ().get_configuration_manager ();
+        THROW_IF_FAIL (conf_mgr);
+        return *conf_mgr;
+    }
+
+    void
+    update_callgraph_key ()
+    {
+        THROW_IF_FAIL (callgraph_checkbutton);
+        bool is_on = callgraph_checkbutton->get_active ();
+        conf_manager ().set_key_value (CONF_KEY_DO_CALLGRAPH_RECORDING, is_on);
+    }
+
+    void
+    update_no_buffering_key ()
+    {
+        THROW_IF_FAIL (no_buffering_checkbutton);
+        bool is_on = no_buffering_checkbutton->get_active ();
+        conf_manager ().set_key_value
+            (CONF_KEY_COLLECT_WITHOUT_BUFFERING, is_on);
+    }
+
+    void
+    update_raw_sample_key ()
+    {
+        THROW_IF_FAIL (raw_sample_checkbutton);
+        bool is_on = raw_sample_checkbutton->get_active ();
+        conf_manager ().set_key_value
+            (CONF_KEY_COLLECT_RAW_SAMPLE_RECORDS, is_on);
+    }
+
+    void
+    update_system_wide_collection_key ()
+    {
+        THROW_IF_FAIL (system_wide_collection_checkbutton);
+        bool is_on = system_wide_collection_checkbutton->get_active ();
+        conf_manager ().set_key_value (CONF_KEY_SYSTEM_WIDE_COLLECTION, is_on);
+    }
+
+    void
+    update_sample_addresses_key ()
+    {
+        THROW_IF_FAIL (sample_addresses_checkbutton);
+        bool is_on = sample_addresses_checkbutton->get_active ();
+        conf_manager ().set_key_value (CONF_KEY_SAMPLE_ADDRESSES, is_on);
+    }
+
+    void
+    update_sample_timestamps_key ()
+    {
+        THROW_IF_FAIL (sample_timestamps_checkbutton);
+        bool is_on = sample_timestamps_checkbutton->get_active ();
+        conf_manager ().set_key_value (CONF_KEY_SAMPLE_TIMESTAMPS, is_on);
+    }
+
+    void
+    update_widget_from_recorder_keys ()
+    {
+        THROW_IF_FAIL (callgraph_checkbutton);
+        THROW_IF_FAIL (no_buffering_checkbutton);
+        THROW_IF_FAIL (raw_sample_checkbutton);
+        THROW_IF_FAIL (system_wide_collection_checkbutton);
+        THROW_IF_FAIL (sample_addresses_checkbutton);
+        THROW_IF_FAIL (sample_timestamps_checkbutton);
+
+        bool do_callgraph_recording = true;
+        if (!conf_manager ().get_key_value (CONF_KEY_DO_CALLGRAPH_RECORDING,
+                                            do_callgraph_recording)) {
+            LOG_ERROR ("failed to get gconf key "
+                       << CONF_KEY_DO_CALLGRAPH_RECORDING);
+        }
+        callgraph_checkbutton->set_active (do_callgraph_recording);
+
+        bool do_collect_without_buffering = false;
+        if (!conf_manager ().get_key_value (CONF_KEY_COLLECT_WITHOUT_BUFFERING,
+                                            do_collect_without_buffering)) {
+            LOG_ERROR ("failed to get gconf key "
+                       << CONF_KEY_COLLECT_WITHOUT_BUFFERING);
+        }
+        no_buffering_checkbutton->set_active (do_collect_without_buffering);
+
+        bool do_collect_raw_sample_records = false;
+        if (!conf_manager ().get_key_value (CONF_KEY_COLLECT_RAW_SAMPLE_RECORDS,
+                                            do_collect_raw_sample_records)) {
+            LOG_ERROR ("failed to get gconf key "
+                       << CONF_KEY_COLLECT_RAW_SAMPLE_RECORDS);
+        }
+        raw_sample_checkbutton->set_active (do_collect_raw_sample_records);
+
+        bool do_system_wide_collection = false;
+        if (!conf_manager ().get_key_value (CONF_KEY_SYSTEM_WIDE_COLLECTION,
+                                            do_system_wide_collection)) {
+            LOG_ERROR ("failed to get gconf key "
+                       << CONF_KEY_SYSTEM_WIDE_COLLECTION);
+        }
+        system_wide_collection_checkbutton->set_active
+            (do_system_wide_collection);
+
+        bool do_sample_addresses = false;
+        if (!conf_manager ().get_key_value (CONF_KEY_SAMPLE_ADDRESSES,
+                                            do_sample_addresses)) {
+            LOG_ERROR ("failed to get gconf key "
+                       << CONF_KEY_SAMPLE_ADDRESSES);
+        }
+        sample_addresses_checkbutton->set_active (do_sample_addresses);
+
+        bool do_sample_timestamps = false;
+        if (!conf_manager ().get_key_value (CONF_KEY_SAMPLE_TIMESTAMPS,
+                                            do_sample_timestamps)) {
+            LOG_ERROR ("failed to get gconf key "
+                       << CONF_KEY_SAMPLE_TIMESTAMPS);
+        }
+        sample_timestamps_checkbutton->set_active (do_sample_timestamps);
+    }
+
+    void
+    update_widget_from_conf ()
+    {
+        update_widget_from_recorder_keys ();
+    }
+};//end ProfPreferencesDialog
+
+ProfPreferencesDialog::ProfPreferencesDialog (IPerspective &a_perspective,
+                                              const UString &a_root_path) :
+    Dialog (a_root_path,
+            "preferencesdialog.ui",
+            "preferencesdialog")
+{
+    m_priv.reset (new Priv (gtkbuilder (), a_perspective));
+    m_priv->update_widget_from_conf ();
+}
+
+ProfPreferencesDialog::~ProfPreferencesDialog ()
+{
+    LOG_D ("delete", "destructor-domain");
+    THROW_IF_FAIL (m_priv);
+}
+
+NEMIVER_END_NAMESPACE (nemiver)
diff --git a/src/persp/profperspective/nmv-prof-preferences-dialog.h b/src/persp/profperspective/nmv-prof-preferences-dialog.h
new file mode 100644
index 0000000..d7a3717
--- /dev/null
+++ b/src/persp/profperspective/nmv-prof-preferences-dialog.h
@@ -0,0 +1,51 @@
+//Author: Fabien Parent
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+#ifndef __NMV_PROF_PREFERENCES_DIALOG_H__
+#define __NMV_PROF_PREFERENCES_DIALOG_H__
+
+#include "common/nmv-ustring.h"
+#include "nmv-dialog.h"
+
+using nemiver::common::UString;
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+class IPerspective;
+class ProfPreferencesDialog : public Dialog {
+
+    class Priv;
+    SafePtr<Priv> m_priv;
+
+    ProfPreferencesDialog ();
+
+public:
+    ProfPreferencesDialog (IPerspective &a_perspective,
+                           const UString &a_root_path);
+    virtual ~ProfPreferencesDialog ();
+};//end class ProfPreferencesDialog
+
+NEMIVER_END_NAMESPACE (nemiver)
+
+#endif //__NMV_PROF_PREFERENCES_DIALOG
diff --git a/src/persp/profperspective/ui/Makefile.am b/src/persp/profperspective/ui/Makefile.am
index 0904120..02a3fbd 100644
--- a/src/persp/profperspective/ui/Makefile.am
+++ b/src/persp/profperspective/ui/Makefile.am
@@ -1,6 +1,6 @@
 PLUGIN_NAME=profperspective
 uifiles = loadreportdialog.ui \
-recorddialog.ui
+preferencesdialog.ui
 
 uidir = @NEMIVER_PLUGINS_DIR@/$(PLUGIN_NAME)/ui
 ui_DATA = $(uifiles)
diff --git a/src/persp/profperspective/ui/preferencesdialog.ui b/src/persp/profperspective/ui/preferencesdialog.ui
new file mode 100644
index 0000000..0bae537
--- /dev/null
+++ b/src/persp/profperspective/ui/preferencesdialog.ui
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="preferencesdialog">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Preferences</property>
+    <property name="default_width">400</property>
+    <property name="default_height">300</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="okbutton1">
+                <property name="label">gtk-close</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkNotebook" id="rootnotebook">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="border_width">6</property>
+            <child>
+              <object class="GtkVBox" id="vbox3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">6</property>
+                <property name="spacing">12</property>
+                <child>
+                  <object class="GtkFrame" id="frame3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox4">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkCheckButton" id="nobufferingcheckbutton">
+                                <property name="label" translatable="yes">Collect data without buffering</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="rawsamplecheckbutton">
+                                <property name="label" translatable="yes">Collect raw sample records from all opened counters</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="systemcollctioncheckbutton">
+                                <property name="label" translatable="yes">System-wide collection from all CPUs</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Data Collection</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame5">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkBox" id="box1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkCheckButton" id="addresssamplecheckbutton">
+                                <property name="label" translatable="yes">Sample addresses</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="timestampsamplecheckbutton">
+                                <property name="label" translatable="yes">Sample timestamps</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Sampling</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkCheckButton" id="callgraphcheckbutton">
+                            <property name="label" translatable="yes">Do call-graph (stack chain/backtrace) recording</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="xalign">0</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Call-graph</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Recording</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-7">okbutton1</action-widget>
+    </action-widgets>
+  </object>
+</interface>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]