Fixed ones. Show/Hide pictures working. o/

On Thu, Jul 10, 2014 at 8:18 PM, Tomaz Canabrava <tcanabr...@kde.org> wrote:
> you betcha... u_u'
> Well, updated the files here and send the wrong ones. urgh.
>
> On Thu, Jul 10, 2014 at 7:15 PM, Anton Lundin <gla...@acc.umu.se> wrote:
>> On 10 July, 2014 - Tomaz Canabrava wrote:
>>
>>> correct ones: I'm doing the rest of the code now ( to make the
>>> pictures actually appear / disappear on the canvas )
>>>
>>
>> Still very much _in_planner in there, and with the same Date:
>>
>> Emailed the wrong file? =)
>>
>>
>> //Anton
>>
>>> On Thu, Jul 10, 2014 at 6:33 PM, Tomaz Canabrava <tcanabr...@kde.org> wrote:
>>> > my mistake. :)
>>> >
>>> > On Thu, Jul 10, 2014 at 3:04 PM, Anton Lundin <gla...@acc.umu.se> wrote:
>>> >> On 10 July, 2014 - Tomaz Canabrava wrote:
>>> >>
>>> >>> I still need to hoock the toggle on the image button to actually hide
>>> >>> / show the pictures.
>>> >>
>>> >>> From a461294b2d6117721fa4e83742821ecac945d78e Mon Sep 17 00:00:00 2001
>>> >>> From: Tomaz Canabrava <tomaz.canabr...@intel.com>
>>> >>> Date: Thu, 10 Jul 2014 13:50:49 -0300
>>> >>> Subject: [PATCH 5/6] Added the toggle picture button and hoocked it up
>>> >>>
>>> >>> This patch adds the toggle picture button and hoocks
>>> >>> it up with the rest of the code. I'v also changed a call
>>> >>> from ProfileWidget because it caused errors on the ui
>>> >>> generated code, where it would try to call an still-to-be
>>> >>> instantiated object.
>>> >>>
>>> >>> Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
>>> >>> ---
>>> >>>  pref.h                           |  1 +
>>> >>>  qt-ui/mainwindow.cpp             |  7 +++++++
>>> >>>  qt-ui/mainwindow.h               |  2 +-
>>> >>>  qt-ui/mainwindow.ui              | 31 +++++++++++++++++++++++++++----
>>> >>>  qt-ui/profile/profilewidget2.cpp |  1 -
>>> >>>  subsurfacestartup.c              |  3 ++-
>>> >>>  6 files changed, 38 insertions(+), 7 deletions(-)
>>> >>>
>>> >>> diff --git a/pref.h b/pref.h
>>> >>> index a22206d..bfc120c 100644
>>> >>> --- a/pref.h
>>> >>> +++ b/pref.h
>>> >>> @@ -63,6 +63,7 @@ struct preferences {
>>> >>>       char *proxy_pass;
>>> >>>       bool doo2breaks;
>>> >>>       bool drop_stone_mode;
>>> >>> +     bool show_pictures_in_planner;
>>> >>
>>> >> Why name it _in_planner?
>>> >>
>>> >> As far as i understood it got nothing with the planner to do. Maybe call
>>> >> it show_pictures_in_profile?
>>> >>
>>> >> //Anton
>>> >>
>>> >>
>>> >> --
>>> >> Anton Lundin    +46702-161604
>>
>>> From a461294b2d6117721fa4e83742821ecac945d78e Mon Sep 17 00:00:00 2001
>>> From: Tomaz Canabrava <tomaz.canabr...@intel.com>
>>> Date: Thu, 10 Jul 2014 13:50:49 -0300
>>> Subject: [PATCH 5/6] Added the toggle picture button and hoocked it up
>>>
>>> This patch adds the toggle picture button and hoocks
>>> it up with the rest of the code. I'v also changed a call
>>> from ProfileWidget because it caused errors on the ui
>>> generated code, where it would try to call an still-to-be
>>> instantiated object.
>>>
>>> Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
>>> ---
>>>  pref.h                           |  1 +
>>>  qt-ui/mainwindow.cpp             |  7 +++++++
>>>  qt-ui/mainwindow.h               |  2 +-
>>>  qt-ui/mainwindow.ui              | 31 +++++++++++++++++++++++++++----
>>>  qt-ui/profile/profilewidget2.cpp |  1 -
>>>  subsurfacestartup.c              |  3 ++-
>>>  6 files changed, 38 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/pref.h b/pref.h
>>> index a22206d..bfc120c 100644
>>> --- a/pref.h
>>> +++ b/pref.h
>>> @@ -63,6 +63,7 @@ struct preferences {
>>>       char *proxy_pass;
>>>       bool doo2breaks;
>>>       bool drop_stone_mode;
>>> +     bool show_pictures_in_planner;
>>>  };
>>>  enum unit_system_values {
>>>       METRIC,
>>> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
>>> index 6a212ae..bb65ada 100644
>>> --- a/qt-ui/mainwindow.cpp
>>> +++ b/qt-ui/mainwindow.cpp
>>> @@ -93,6 +93,7 @@ MainWindow::MainWindow() : QMainWindow(),
>>>  #endif
>>>
>>>       ui.mainErrorMessage->hide();
>>> +     ui.newProfile->setEmptyState();
>>>       initialUiSetup();
>>>       readSettings();
>>>       ui.ListWidget->reload(DiveTripModel::TREE);
>>> @@ -1334,6 +1335,12 @@ void MainWindow::on_profScaled_clicked(bool 
>>> triggered)
>>>       TOOLBOX_PREF_PROFILE(zoomed_plot);
>>>  }
>>>
>>> +void MainWindow::on_profTogglePicture_clicked(bool triggered)
>>> +{
>>> +     prefs.show_pictures_in_planner = triggered;
>>> +     TOOLBOX_PREF_PROFILE(show_pictures_in_planner);
>>> +}
>>> +
>>>  #undef TOOLBOX_PREF_PROFILE
>>>
>>>  void MainWindow::on_actionExport_triggered()
>>> diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
>>> index 014fbb4..3e7cad6 100644
>>> --- a/qt-ui/mainwindow.h
>>> +++ b/qt-ui/mainwindow.h
>>> @@ -142,7 +142,7 @@ slots:
>>>       void on_profRuler_clicked(bool triggered);
>>>       void on_profSAC_clicked(bool triggered);
>>>       void on_profScaled_clicked(bool triggered);
>>> -
>>> +     void on_profTogglePicture_clicked(bool triggered);
>>>       void on_actionExport_triggered();
>>>
>>>  protected:
>>> diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
>>> index 2360dd8..d8ad99c 100644
>>> --- a/qt-ui/mainwindow.ui
>>> +++ b/qt-ui/mainwindow.ui
>>> @@ -109,7 +109,7 @@
>>>           <property name="spacing">
>>>            <number>0</number>
>>>           </property>
>>> -         <item row="14" column="0">
>>> +         <item row="15" column="0">
>>>            <spacer name="verticalSpacer">
>>>             <property name="orientation">
>>>              <enum>Qt::Vertical</enum>
>>> @@ -466,6 +466,9 @@
>>>             </property>
>>>            </widget>
>>>           </item>
>>> +         <item row="0" column="1" rowspan="16">
>>> +          <widget class="ProfileWidget2" name="newProfile"/>
>>> +         </item>
>>>           <item row="1" column="0">
>>>            <widget class="QToolButton" name="profPn2">
>>>             <property name="toolTip">
>>> @@ -492,8 +495,28 @@
>>>             </property>
>>>            </widget>
>>>           </item>
>>> -         <item row="0" column="1" rowspan="15">
>>> -          <widget class="ProfileWidget2" name="newProfile"/>
>>> +         <item row="14" column="0">
>>> +          <widget class="QToolButton" name="profTogglePicture">
>>> +           <property name="text">
>>> +            <string>...</string>
>>> +           </property>
>>> +           <property name="icon">
>>> +            <iconset resource="../subsurface.qrc">
>>> +             <normaloff>:/pictures</normaloff>:/pictures</iconset>
>>> +           </property>
>>> +           <property name="iconSize">
>>> +            <size>
>>> +             <width>24</width>
>>> +             <height>24</height>
>>> +            </size>
>>> +           </property>
>>> +           <property name="checkable">
>>> +            <bool>true</bool>
>>> +           </property>
>>> +           <property name="autoRaise">
>>> +            <bool>true</bool>
>>> +           </property>
>>> +          </widget>
>>>           </item>
>>>          </layout>
>>>         </widget>
>>> @@ -638,7 +661,7 @@ p, li { white-space: pre-wrap; }
>>>       <x>0</x>
>>>       <y>0</y>
>>>       <width>1682</width>
>>> -     <height>19</height>
>>> +     <height>27</height>
>>>      </rect>
>>>     </property>
>>>     <widget class="QMenu" name="menuFile">
>>> diff --git a/qt-ui/profile/profilewidget2.cpp 
>>> b/qt-ui/profile/profilewidget2.cpp
>>> index ee80d59..fe19c7b 100644
>>> --- a/qt-ui/profile/profilewidget2.cpp
>>> +++ b/qt-ui/profile/profilewidget2.cpp
>>> @@ -100,7 +100,6 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : 
>>> QGraphicsView(parent),
>>>       setupItemOnScene();
>>>       addItemsToScene();
>>>       scene()->installEventFilter(this);
>>> -     setEmptyState();
>>>       connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), 
>>> this, SLOT(settingsChanged()));
>>>
>>>       QAction *action = NULL;
>>> diff --git a/subsurfacestartup.c b/subsurfacestartup.c
>>> index 58291d2..df4c01f 100644
>>> --- a/subsurfacestartup.c
>>> +++ b/subsurfacestartup.c
>>> @@ -41,7 +41,8 @@ struct preferences default_prefs = {
>>>       .bottompo2 = 1400,
>>>       .decopo2 = 1600,
>>>       .doo2breaks = false,
>>> -     .drop_stone_mode = false
>>> +     .drop_stone_mode = false,
>>> +     .show_pictures_in_planner = true
>>>  };
>>>
>>>  int run_survey;
>>> --
>>> 2.0.1
>>>
>>
>>> From c5a60d533f3fad12426215f270222a7ecb3c7f21 Mon Sep 17 00:00:00 2001
>>> From: Tomaz Canabrava <tomaz.canabr...@intel.com>
>>> Date: Thu, 10 Jul 2014 13:53:06 -0300
>>> Subject: [PATCH 6/6] Correctly sets the 'enabled' flag on the picture button
>>>
>>> Forgot to add this one, oops.
>>>
>>> Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
>>> ---
>>>  qt-ui/mainwindow.cpp | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
>>> index bb65ada..8c86901 100644
>>> --- a/qt-ui/mainwindow.cpp
>>> +++ b/qt-ui/mainwindow.cpp
>>> @@ -241,6 +241,7 @@ void MainWindow::setToolButtonsEnabled(bool enabled)
>>>       ui.profRuler->setEnabled(enabled);
>>>       ui.profScaled->setEnabled(enabled);
>>>       ui.profHR->setEnabled(enabled);
>>> +     ui.profTogglePicture->setEnabled(enabled);
>>>  }
>>>
>>>  bool MainWindow::okToClose(QString message)
>>> --
>>> 2.0.1
>>>
>>
>>
>> --
>> Anton Lundin    +46702-161604
From 585e7d4b61452c8538bff4d0dd4229e6ca9abb46 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 10 Jul 2014 13:50:49 -0300
Subject: [PATCH 5/9] Added the toggle picture button and hoocked it up

This patch adds the toggle picture button and hoocks
it up with the rest of the code. I'v also changed a call
from ProfileWidget because it caused errors on the ui
generated code, where it would try to call an still-to-be
instantiated object.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 pref.h                           |  1 +
 qt-ui/mainwindow.cpp             |  7 +++++++
 qt-ui/mainwindow.h               |  2 +-
 qt-ui/mainwindow.ui              | 31 +++++++++++++++++++++++++++----
 qt-ui/profile/profilewidget2.cpp |  1 -
 subsurfacestartup.c              |  3 ++-
 6 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/pref.h b/pref.h
index a22206d..fea5061 100644
--- a/pref.h
+++ b/pref.h
@@ -63,6 +63,7 @@ struct preferences {
 	char *proxy_pass;
 	bool doo2breaks;
 	bool drop_stone_mode;
+	bool show_pictures_in_profile;
 };
 enum unit_system_values {
 	METRIC,
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 6a212ae..8100f20 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -93,6 +93,7 @@ MainWindow::MainWindow() : QMainWindow(),
 #endif
 
 	ui.mainErrorMessage->hide();
+	ui.newProfile->setEmptyState();
 	initialUiSetup();
 	readSettings();
 	ui.ListWidget->reload(DiveTripModel::TREE);
@@ -1334,6 +1335,12 @@ void MainWindow::on_profScaled_clicked(bool triggered)
 	TOOLBOX_PREF_PROFILE(zoomed_plot);
 }
 
+void MainWindow::on_profTogglePicture_clicked(bool triggered)
+{
+	prefs.show_pictures_in_profile = triggered;
+	TOOLBOX_PREF_PROFILE(show_pictures_in_planner);
+}
+
 #undef TOOLBOX_PREF_PROFILE
 
 void MainWindow::on_actionExport_triggered()
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 014fbb4..3e7cad6 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -142,7 +142,7 @@ slots:
 	void on_profRuler_clicked(bool triggered);
 	void on_profSAC_clicked(bool triggered);
 	void on_profScaled_clicked(bool triggered);
-
+	void on_profTogglePicture_clicked(bool triggered);
 	void on_actionExport_triggered();
 
 protected:
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index 2360dd8..d8ad99c 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -109,7 +109,7 @@
          <property name="spacing">
           <number>0</number>
          </property>
-         <item row="14" column="0">
+         <item row="15" column="0">
           <spacer name="verticalSpacer">
            <property name="orientation">
             <enum>Qt::Vertical</enum>
@@ -466,6 +466,9 @@
            </property>
           </widget>
          </item>
+         <item row="0" column="1" rowspan="16">
+          <widget class="ProfileWidget2" name="newProfile"/>
+         </item>
          <item row="1" column="0">
           <widget class="QToolButton" name="profPn2">
            <property name="toolTip">
@@ -492,8 +495,28 @@
            </property>
           </widget>
          </item>
-         <item row="0" column="1" rowspan="15">
-          <widget class="ProfileWidget2" name="newProfile"/>
+         <item row="14" column="0">
+          <widget class="QToolButton" name="profTogglePicture">
+           <property name="text">
+            <string>...</string>
+           </property>
+           <property name="icon">
+            <iconset resource="../subsurface.qrc">
+             <normaloff>:/pictures</normaloff>:/pictures</iconset>
+           </property>
+           <property name="iconSize">
+            <size>
+             <width>24</width>
+             <height>24</height>
+            </size>
+           </property>
+           <property name="checkable">
+            <bool>true</bool>
+           </property>
+           <property name="autoRaise">
+            <bool>true</bool>
+           </property>
+          </widget>
          </item>
         </layout>
        </widget>
@@ -638,7 +661,7 @@ p, li { white-space: pre-wrap; }
      <x>0</x>
      <y>0</y>
      <width>1682</width>
-     <height>19</height>
+     <height>27</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index ee80d59..fe19c7b 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -100,7 +100,6 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
 	setupItemOnScene();
 	addItemsToScene();
 	scene()->installEventFilter(this);
-	setEmptyState();
 	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
 
 	QAction *action = NULL;
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index 58291d2..1af6851 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -41,7 +41,8 @@ struct preferences default_prefs = {
 	.bottompo2 = 1400,
 	.decopo2 = 1600,
 	.doo2breaks = false,
-	.drop_stone_mode = false
+	.drop_stone_mode = false,
+	.show_pictures_in_profile = true
 };
 
 int run_survey;
-- 
2.0.1

From 434011b684f21e1af3309d8e79230fe0849eb707 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 10 Jul 2014 13:53:06 -0300
Subject: [PATCH 6/9] Correctly sets the 'enabled' flag on the picture button

Forgot to add this one, oops.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/mainwindow.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 8100f20..099bf70 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -241,6 +241,7 @@ void MainWindow::setToolButtonsEnabled(bool enabled)
 	ui.profRuler->setEnabled(enabled);
 	ui.profScaled->setEnabled(enabled);
 	ui.profHR->setEnabled(enabled);
+	ui.profTogglePicture->setEnabled(enabled);
 }
 
 bool MainWindow::okToClose(QString message)
-- 
2.0.1

From b7ccd0c6c9feea1948250c3226064ca414604e9b Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 10 Jul 2014 19:48:00 -0300
Subject: [PATCH 7/9] Macro to simplify the creation of toggle buttons on the
 Profile

The new macro hides all 5 lines of code from the old code to just one,
since we already have 15 buttons and more are comming, and *every*
code is just the same, it's a logical change that will make us reduce
now 75 lines of code to just 15, in the future this can be bigger.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/mainwindow.cpp | 107 +++++++++++++--------------------------------------
 1 file changed, 26 insertions(+), 81 deletions(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 099bf70..271bc56 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1251,98 +1251,43 @@ void MainWindow::editCurrentDive()
 	}
 }
 
-#define TOOLBOX_PREF_PROFILE(PREFS)    \
+#define PREF_PROFILE(QT_PREFS) \
 	QSettings s;                   \
 	s.beginGroup("TecDetails");    \
-	s.setValue(#PREFS, triggered); \
+	s.setValue(#QT_PREFS, triggered); \
 	PreferencesDialog::instance()->emitSettingsChanged();
 
-void MainWindow::on_profCalcAllTissues_clicked(bool triggered)
-{
-	prefs.calcalltissues = triggered;
-	TOOLBOX_PREF_PROFILE(calcalltissues);
-}
-void MainWindow::on_profCalcCeiling_clicked(bool triggered)
-{
-	prefs.calcceiling = triggered;
-	TOOLBOX_PREF_PROFILE(calcceiling);
-}
-void MainWindow::on_profDcCeiling_clicked(bool triggered)
-{
-	prefs.dcceiling = triggered;
-	TOOLBOX_PREF_PROFILE(dcceiling);
-}
-void MainWindow::on_profEad_clicked(bool triggered)
-{
-	prefs.ead = triggered;
-	TOOLBOX_PREF_PROFILE(ead);
-}
-void MainWindow::on_profIncrement3m_clicked(bool triggered)
-{
-	prefs.calcceiling3m = triggered;
-	TOOLBOX_PREF_PROFILE(calcceiling3m);
-}
-void MainWindow::on_profMod_clicked(bool triggered)
-{
-	prefs.mod = triggered;
-	TOOLBOX_PREF_PROFILE(mod);
-}
-void MainWindow::on_profNdl_tts_clicked(bool triggered)
-{
-	prefs.calcndltts = triggered;
-	TOOLBOX_PREF_PROFILE(calcndltts);
-}
+#define TOOLBOX_PREF_PROFILE(METHOD, INTERNAL_PREFS, QT_PREFS)    \
+void MainWindow::on_ ## METHOD ##_clicked(bool triggered) \
+{ \
+    prefs. INTERNAL_PREFS = triggered;\
+	PREF_PROFILE(QT_PREFS); \
+}
+
+TOOLBOX_PREF_PROFILE(profCalcAllTissues, calcalltissues, calcalltissues);
+TOOLBOX_PREF_PROFILE(profCalcCeiling, calcceiling, calcceiling);
+TOOLBOX_PREF_PROFILE(profDcCeiling, dcceiling, dcceiling);
+TOOLBOX_PREF_PROFILE(profEad, ead, ead);
+TOOLBOX_PREF_PROFILE(profIncrement3m, calcceiling3m, calcceiling3m);
+TOOLBOX_PREF_PROFILE(profMod, mod, mod);
+TOOLBOX_PREF_PROFILE(profNdl_tts, calcndltts, calcndltts);
+TOOLBOX_PREF_PROFILE(profPhe, pp_graphs.phe, phegraph);
+TOOLBOX_PREF_PROFILE(profPn2, pp_graphs.pn2, pn2graph);
+TOOLBOX_PREF_PROFILE(profPO2, pp_graphs.po2, po2graph);
+TOOLBOX_PREF_PROFILE(profHR, hrgraph, hrgraph);
+TOOLBOX_PREF_PROFILE(profRuler, rulergraph, rulergraph);
+TOOLBOX_PREF_PROFILE(profSAC, show_sac, show_sac);
+TOOLBOX_PREF_PROFILE(profScaled, zoomed_plot, zoomed_plot);
+TOOLBOX_PREF_PROFILE(profTogglePicture, show_pictures_in_profile, show_pictures_in_profile);
 void MainWindow::turnOffNdlTts()
 {
 	const bool triggered = false;
 	prefs.calcndltts = triggered;
-	TOOLBOX_PREF_PROFILE(calcndltts);
-}
-
-void MainWindow::on_profPhe_clicked(bool triggered)
-{
-	prefs.pp_graphs.phe = triggered;
-	TOOLBOX_PREF_PROFILE(phegraph);
-}
-void MainWindow::on_profPn2_clicked(bool triggered)
-{
-	prefs.pp_graphs.pn2 = triggered;
-	TOOLBOX_PREF_PROFILE(pn2graph);
-}
-void MainWindow::on_profPO2_clicked(bool triggered)
-{
-	prefs.pp_graphs.po2 = triggered;
-	TOOLBOX_PREF_PROFILE(po2graph);
-}
-void MainWindow::on_profHR_clicked(bool triggered)
-{
-	prefs.hrgraph = triggered;
-	TOOLBOX_PREF_PROFILE(hrgraph);
-}
-void MainWindow::on_profRuler_clicked(bool triggered)
-{
-	prefs.rulergraph = triggered;
-	TOOLBOX_PREF_PROFILE(rulergraph);
-}
-void MainWindow::on_profSAC_clicked(bool triggered)
-{
-	prefs.show_sac = triggered;
-	TOOLBOX_PREF_PROFILE(show_sac);
-}
-
-void MainWindow::on_profScaled_clicked(bool triggered)
-{
-	prefs.zoomed_plot = triggered;
-	TOOLBOX_PREF_PROFILE(zoomed_plot);
-}
-
-void MainWindow::on_profTogglePicture_clicked(bool triggered)
-{
-	prefs.show_pictures_in_profile = triggered;
-	TOOLBOX_PREF_PROFILE(show_pictures_in_planner);
+	PREF_PROFILE(calcndltts);
 }
 
 #undef TOOLBOX_PREF_PROFILE
+#undef PERF_PROFILE
 
 void MainWindow::on_actionExport_triggered()
 {
-- 
2.0.1

From c5668e360a9eff7fdcf6729b3cd07e7c9e8859f6 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 10 Jul 2014 19:53:58 -0300
Subject: [PATCH 8/9] Fix memory leak on the Export Dialog

The export dialog was being created but never free'd.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/mainwindow.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 271bc56..f0cc6f0 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1291,6 +1291,6 @@ void MainWindow::turnOffNdlTts()
 
 void MainWindow::on_actionExport_triggered()
 {
-	DiveLogExportDialog *diveLogExport = new DiveLogExportDialog(this);
-	diveLogExport->show();
+	DiveLogExportDialog diveLogExport;
+	diveLogExport.exec();
 }
-- 
2.0.1

From ca06f0cbde3802f63c0ac0c3bb40cd0c51424b2e Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 10 Jul 2014 21:15:20 -0300
Subject: [PATCH 9/9] Show/Hide pictures working.

This code hoocks the pictures with the preferences change.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/mainwindow.cpp             | 1 +
 qt-ui/profile/divepixmapitem.cpp | 8 ++++++++
 qt-ui/profile/divepixmapitem.h   | 2 ++
 qt-ui/profile/profilewidget2.cpp | 1 -
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index f0cc6f0..e6e7f60 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1279,6 +1279,7 @@ TOOLBOX_PREF_PROFILE(profRuler, rulergraph, rulergraph);
 TOOLBOX_PREF_PROFILE(profSAC, show_sac, show_sac);
 TOOLBOX_PREF_PROFILE(profScaled, zoomed_plot, zoomed_plot);
 TOOLBOX_PREF_PROFILE(profTogglePicture, show_pictures_in_profile, show_pictures_in_profile);
+
 void MainWindow::turnOffNdlTts()
 {
 	const bool triggered = false;
diff --git a/qt-ui/profile/divepixmapitem.cpp b/qt-ui/profile/divepixmapitem.cpp
index d2f3a69..dd002e5 100644
--- a/qt-ui/profile/divepixmapitem.cpp
+++ b/qt-ui/profile/divepixmapitem.cpp
@@ -1,6 +1,7 @@
 #include "divepixmapitem.h"
 #include "animationfunctions.h"
 #include <divepicturewidget.h>
+#include <preferences.h>
 
 #include <QPen>
 #include <QBrush>
@@ -22,6 +23,13 @@ DivePictureItem::DivePictureItem(int row, QObject *parent): DivePixmapItem(paren
 #endif
 	rowOnModel = row;
 	setScale(0.2);
+	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
+	setVisible(prefs.show_pictures_in_profile);
+}
+
+void DivePictureItem::settingsChanged()
+{
+	setVisible(prefs.show_pictures_in_profile);
 }
 
 void DivePictureItem::setPixmap(const QPixmap &pix)
diff --git a/qt-ui/profile/divepixmapitem.h b/qt-ui/profile/divepixmapitem.h
index 26aeeaf..950b211 100644
--- a/qt-ui/profile/divepixmapitem.h
+++ b/qt-ui/profile/divepixmapitem.h
@@ -20,6 +20,8 @@ class DivePictureItem : public DivePixmapItem {
 public:
 	DivePictureItem(int row, QObject *parent = 0);
 	void setPixmap(const QPixmap& pix);
+public slots:
+	void settingsChanged();
 protected:
 	void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
 	void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index fe19c7b..298fcd0 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -555,7 +555,6 @@ void ProfileWidget2::settingsChanged()
 		isPlotZoomed = prefs.zoomed_plot;
 		needReplot = true;
 	}
-
 	if (needReplot)
 		replot();
 }
-- 
2.0.1

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to