I still need to hoock the toggle on the image button to actually hide
/ show the pictures.
From 3b78fd68d034a21acff44429884f16570b2a2e73 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 10 Jul 2014 12:40:43 -0300
Subject: [PATCH 1/6] Added icon for Pictures based on the KDE iconpack

This is just untill luisa send us correct icons.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 icons/pictures.png | Bin 0 -> 3477 bytes
 subsurface.qrc     |   1 +
 2 files changed, 1 insertion(+)
 create mode 100644 icons/pictures.png

diff --git a/icons/pictures.png b/icons/pictures.png
new file mode 100644
index 0000000000000000000000000000000000000000..35da5a2b7d58322fc139b861c5a6cd5bc0218f83
GIT binary patch
literal 3477
zcmV;G4Qld<P)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00001b5ch_0Itp)
z=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L02IRj02IRk6>v>L00007bV*G`2ign)
z05AqL7>r8*01XvML_t(&-tC!rj9vA0$3MTjylu8Ot39h{Jl^dwjF;Gejbktg*tMHf
z4TvP5gt!P&A~i`9MW|8>t&+4#8zoe#gqlFfLWn6TwGp9UyJZNe!S;-oF^<P$dzj5L
zp6$(>H*dT5clyV@@68PMpwLuRkbI=4ci;Qn<$TZYY~OR?x?Gp*@}U+r>)ZSg=`DZ;
zL;<RxprAC7NR$JGvq1g6iUuZ2N=imzvDl;qn2AJUiHIEeP`Qp$tAHsBFn}6>hZ=TM
zkm?{a(T6N7K}R9hyOh*KA%e!hpw6tJwy1`5#Q@XG_EVOKV-`mVUAAeon{ifunwQpY
zz%>JCtr0B<g6nFu1`$DP|5$s+B7$Hb+Cfm>H6n<>g{SvY{YT$qO>+&OU*quhf4sup
zZ~YxWC2-D~9SbGF%LIci;Z;j<oe?xH=7KV&Cn5+M+p?*wsU&I@lWIOqajQ*4t)Vg%
zr~IRhRP|MI2AA@&OC%cCfaChgYD5e~Km;Ec=)9u2kC|UrfEH-|vwaM__$ZgF|C%R`
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Wg%V&kZtox{cAnAtaMQ
z8HN`t%DXsh3Ew<8$*#>cG&WRW8j5TtLnf0UH9bvFPtVxqTW<MN;3Z%A_Z92vk>f00
z>RWn->UmknBO|_X{k5#C*;uXU$vPbFwJ5O@Oifv&<1xfEkxYt6<w6Y0AQVtoZVD?t
z3_v=aCY#A{uIv1j+jiXkW#Hd|_-`|zv#z0kp5&o(UAv!HMR4={)|f*^Y*X>`6AA8F
z6{V%NpOa=YI-`k{MsZ!2Y&J`x{}RbWf;&G_i*_Bt1tG5o%Vz25I5D_u_aA)igD8K^
zI*=PM`H9DmZo^NdGlfq4dXS451L%(nPqxFPEJtS@FLP-@yDmzEP*p9KquIEslwZGe
zfU4R`rV|O;+S>Z=x%b|0d{E`Dih<b_J4cedtRy}W7k@RsIQM1>5*dww<ZqmJKk>5G
z_N76b$q@$6on*t-?fmSgKkdHf-h2NXc=3ZOe-!{Fvy>D;<wt{aIFH}N<uP7k*5exh
z@oTnc00AO4oH#QiYqxCY_5VI{`U?*}_*G!PU!*>;%yFTql#_Rpxid=fI#BTju39`M
z;>t|1%Vk{U3Jw~bYY$u(?YcOwi{m(48bR({zeGL#>~n{{_r&+U1-t>IewR_Z4SZDo
zpQO9%?D!pb?05p$;B%4R`4y8227}e<bh;Uc=0`NM*01q8YQFzxyQX^Yb9_tp1Kq%=
zM`HhP-jNx;I~l*_`TyH>0UZA$*I!Xym+Nv}KK$}OS$}F12_9V{00000NkvXXu0mjf
DFE*L<

literal 0
HcmV?d00001

diff --git a/subsurface.qrc b/subsurface.qrc
index 1fc6d68..7cd3dfc 100644
--- a/subsurface.qrc
+++ b/subsurface.qrc
@@ -55,6 +55,7 @@
         <file alias="icon_ead">icons/ead.png</file>
         <file alias="icon_HR">icons/icon-HR.png</file>
         <file alias="calendar">icons/calendarbg.png</file>
+	<file alias="pictures">icons/pictures.png</file>
         <file>icons/subsurface/index.theme</file>
         <file>icons/subsurface/32x32/actions/go-down.png</file>
         <file>icons/subsurface/32x32/actions/go-up.png</file>
-- 
2.0.1

From dbcc7db2d3f700940a123563b3ddcd4448642a7b Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 10 Jul 2014 13:01:51 -0300
Subject: [PATCH 2/6] Remove dead code from the GTK Days.

Die, just die.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 pref.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/pref.h b/pref.h
index ebe5ecd..a22206d 100644
--- a/pref.h
+++ b/pref.h
@@ -74,17 +74,10 @@ extern struct preferences prefs, default_prefs;
 
 #define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
 
-extern void subsurface_set_conf(const char *name, const char *value);
-extern void subsurface_set_conf_bool(const char *name, bool value);
-extern void subsurface_set_conf_int(const char *name, int value);
-
 extern const char system_divelist_default_font[];
 extern const int system_divelist_default_font_size;
 extern const char *system_default_filename();
 
-extern void load_preferences(void);
-extern void save_preferences(void);
-
 #ifdef __cplusplus
 }
 #endif
-- 
2.0.1

From 1f2ce3ae42aef7061cd03134d57711103d45d576 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 10 Jul 2014 13:19:07 -0300
Subject: [PATCH 3/6] Forbid the use of empty strings as tags

Some tags were wrong when the user added two commas, so
this patch forbids the use of a comma when we don't have
any tags.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/groupedlineedit.cpp | 2 ++
 qt-ui/tagwidget.cpp       | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/qt-ui/groupedlineedit.cpp b/qt-ui/groupedlineedit.cpp
index 38f75ca..8238cbb 100644
--- a/qt-ui/groupedlineedit.cpp
+++ b/qt-ui/groupedlineedit.cpp
@@ -87,6 +87,8 @@ void GroupedLineEdit::addBlock(int start, int end)
 	block.start = start;
 	block.end = end;
 	block.text = text().mid(start, end - start + 1).trimmed();
+	if (block.text.isEmpty())
+		return;
 	d->blocks.append(block);
 	viewport()->update();
 }
diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index 8201e8e..819b561 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -169,6 +169,14 @@ void TagWidget::keyPressEvent(QKeyEvent *e)
 				popup->hide();
 		}
 		finishedTag = true;
+		break;
+	case Qt::Key_Comma: { /* if this is the last key, and the previous string is empty, ignore the comma. */
+		QString temp = text();
+		if (temp.split(QChar(',')).last().trimmed().isEmpty()){
+			e->ignore();
+			return;
+		}
+	  }
 	}
 	if (e->key() == Qt::Key_Tab && lastFinishedTag) {		    // if we already end in comma, go to next/prev field
 		MainWindow::instance()->information()->nextInputField(e);   // by sending the key event to the MainTab widget
-- 
2.0.1

From 04152149b3e03d26f52c63d416f97a97ea594ba0 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 10 Jul 2014 13:19:58 -0300
Subject: [PATCH 4/6] Correctly fake keyPressEvent for tabs and returns

since we need to filter for incorrect comma usage, we need to
recurse instead of passing the keyEvent to the base class.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/tagwidget.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index 819b561..51e9476 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -182,7 +182,7 @@ void TagWidget::keyPressEvent(QKeyEvent *e)
 		MainWindow::instance()->information()->nextInputField(e);   // by sending the key event to the MainTab widget
 	} else if (e->key() == Qt::Key_Tab || e->key() == Qt::Key_Return) { // otherwise let's pretend this is a comma instead
 		QKeyEvent fakeEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(","));
-		GroupedLineEdit::keyPressEvent(&fakeEvent);
+		keyPressEvent(&fakeEvent);
 	} else {
 		GroupedLineEdit::keyPressEvent(e);
 	}
-- 
2.0.1

From a461294b2d6117721fa4e83742821ecac945d78e Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
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 <[email protected]>
---
 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 <[email protected]>
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 <[email protected]>
---
 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

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to