From cc5813b27316ff53e257e00c0a35d62102e02ff6 Mon Sep 17 00:00:00 2001
From: Rafael <Syping@users.noreply.github.com>
Date: Thu, 27 Oct 2016 11:24:26 +0200
Subject: [PATCH] Make it possible for show and hide multiple pictures at once

---
 ProfileInterface.cpp |  38 ++++++++++++++++++++++++++++++++++++++
 ProfileInterface.h   |   2 ++
 SnapmaticWidget.cpp  |  34 ++++++++++++++++++----------------
 SnapmaticWidget.h    |   8 ++++----
 UserInterface.cpp    |  16 ++++++++++++++++
 UserInterface.h      |   2 ++
 res/gta5sync_de.qm   | Bin 25069 -> 25095 bytes
 res/gta5sync_de.ts   |  30 +++++++-----------------------
 8 files changed, 87 insertions(+), 43 deletions(-)

diff --git a/ProfileInterface.cpp b/ProfileInterface.cpp
index 6dfc291..cbc7cff 100755
--- a/ProfileInterface.cpp
+++ b/ProfileInterface.cpp
@@ -833,6 +833,44 @@ void ProfileInterface::settingsApplied(int _contentMode, QString language)
     }
 }
 
+void ProfileInterface::enableSelected()
+{
+    int fails = 0;
+    foreach (ProfileWidget *widget, widgets.keys())
+    {
+        if (widget->isSelected())
+        {
+            if (widget->getWidgetType() == "SnapmaticWidget")
+            {
+                SnapmaticWidget *snapmaticWidget = (SnapmaticWidget*)widget;
+                if (!snapmaticWidget->makePictureVisible())
+                {
+                    fails++;
+                }
+            }
+        }
+    }
+}
+
+void ProfileInterface::disableSelected()
+{
+    int fails = 0;
+    foreach (ProfileWidget *widget, widgets.keys())
+    {
+        if (widget->isSelected())
+        {
+            if (widget->getWidgetType() == "SnapmaticWidget")
+            {
+                SnapmaticWidget *snapmaticWidget = (SnapmaticWidget*)widget;
+                if (!snapmaticWidget->makePictureHidden())
+                {
+                    fails++;
+                }
+            }
+        }
+    }
+}
+
 int ProfileInterface::selectedWidgets()
 {
     return selectedWidgts;
diff --git a/ProfileInterface.h b/ProfileInterface.h
index 9d9a9d1..692d888 100755
--- a/ProfileInterface.h
+++ b/ProfileInterface.h
@@ -47,6 +47,8 @@ public:
     void setProfileFolder(QString folder, QString profile);
     void settingsApplied(int contentMode, QString language);
     void setupProfileInterface();
+    void disableSelected();
+    void enableSelected();
     int selectedWidgets();
     ~ProfileInterface();
 
diff --git a/SnapmaticWidget.cpp b/SnapmaticWidget.cpp
index 4dfcbb4..8539b8f 100755
--- a/SnapmaticWidget.cpp
+++ b/SnapmaticWidget.cpp
@@ -266,36 +266,38 @@ void SnapmaticWidget::adjustTextColor()
     }
 }
 
-void SnapmaticWidget::makePictureHidden()
-{
-    QString newPicPath = QString(picPath + ".hidden");
-    picPath = newPicPath;
-}
-
-void SnapmaticWidget::makePictureVisible()
-{
-    QString newPicPath = QString(picPath).remove(picPath.length() - 7, 7);
-    picPath = newPicPath;
-}
-
-void SnapmaticWidget::makePictureHiddenSlot()
+bool SnapmaticWidget::makePictureHidden()
 {
     SnapmaticPicture *picture = (SnapmaticPicture*)smpic;
     if (picture->setPictureHidden())
     {
-        makePictureHidden();
+        picPath = picture->getPictureFileName();
         adjustTextColor();
+        return true;
     }
+    return false;
 }
 
-void SnapmaticWidget::makePictureVisibleSlot()
+bool SnapmaticWidget::makePictureVisible()
 {
     SnapmaticPicture *picture = (SnapmaticPicture*)smpic;
     if (picture->setPictureVisible())
     {
-        makePictureVisible();
+        picPath = picture->getPictureFileName();
         adjustTextColor();
+        return true;
     }
+    return false;
+}
+
+void SnapmaticWidget::makePictureHiddenSlot()
+{
+    makePictureHidden();
+}
+
+void SnapmaticWidget::makePictureVisibleSlot()
+{
+    makePictureVisible();
 }
 
 bool SnapmaticWidget::isSelected()
diff --git a/SnapmaticWidget.h b/SnapmaticWidget.h
index 00baf49..a890bef 100755
--- a/SnapmaticWidget.h
+++ b/SnapmaticWidget.h
@@ -44,6 +44,8 @@ public:
     void setSnapmaticPicture(SnapmaticPicture *picture);
     void setSelectionMode(bool selectionMode);
     void setSelected(bool isSelected);
+    bool makePictureVisible();
+    bool makePictureHidden();
     SnapmaticPicture *getPicture();
     QString getPicturePath();
     QString getWidgetType();
@@ -61,10 +63,10 @@ private slots:
     void pictureSelected();
     void selectAllWidgets();
     void deselectAllWidgets();
-    void makePictureHiddenSlot();
-    void makePictureVisibleSlot();
     void dialogNextPictureRequested();
     void dialogPreviousPictureRequested();
+    void makePictureVisibleSlot();
+    void makePictureHiddenSlot();
 
 protected:
     bool eventFilter(QObject *obj, QEvent *ev);
@@ -72,8 +74,6 @@ protected:
     void mouseReleaseEvent(QMouseEvent *ev);
     void mousePressEvent(QMouseEvent *ev);
     void contextMenuEvent(QContextMenuEvent *ev);
-    void makePictureVisible();
-    void makePictureHidden();
 
 private:
     ProfileDatabase *profileDB;
diff --git a/UserInterface.cpp b/UserInterface.cpp
index 92d3c80..682afb7 100755
--- a/UserInterface.cpp
+++ b/UserInterface.cpp
@@ -453,3 +453,19 @@ void UserInterface::on_actionSelect_GTA_Folder_triggered()
         on_cmdReload_clicked();
     }
 }
+
+void UserInterface::on_action_Enable_In_game_triggered()
+{
+    if (profileOpen)
+    {
+        profileUI->enableSelected();
+    }
+}
+
+void UserInterface::on_action_Disable_In_game_triggered()
+{
+    if (profileOpen)
+    {
+        profileUI->disableSelected();
+    }
+}
diff --git a/UserInterface.h b/UserInterface.h
index b2dd941..9f9a74a 100755
--- a/UserInterface.h
+++ b/UserInterface.h
@@ -58,6 +58,8 @@ private slots:
     void on_action_Import_triggered();
     void on_actionOpen_File_triggered();
     void on_actionSelect_GTA_Folder_triggered();
+    void on_action_Enable_In_game_triggered();
+    void on_action_Disable_In_game_triggered();
     void settingsApplied(int contentMode, QString language);
 
 private:
diff --git a/res/gta5sync_de.qm b/res/gta5sync_de.qm
index 30a83820c56fa13c1624392109bdff41c88d1107..bc887eeecb74043e6008db8ffef5981bac006ee0 100755
GIT binary patch
delta 807
zcmZY7Ye-XJ7zgnGIcH~cTi$KUE^gjtPR*K_lvyUJsq;GLG&NW_LsIFY5(NekDN$Z{
z5}|~U97Iw?!%t=)<%d3~foMeu5enTzqDB`eduRrN9}d6szUO`UKhMKidLnc@6?&>g
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lsH3y^z}<==V!>^HWa{lVU3XV@wES~GatAXZ@Qti(3ZF;NrK&(L)-
z!W^i``%eL};YvVP8xS0<L{}dH7G3g~QApEb@cc%l`>Gr8C*9HkKfdI13YW^`TF%!2
ze$Uj?gQo#|mfF$lWCiuclU0EAl-k#40etSOuWTHgkK(1I3;?zna!bL2gT|#e^CrFa
zJ(O=8q_-Tb1iaRI^bOFbwl#5h?PQg;kc>zAj^3?+qf!4L=_s&1M*nHF11NmMb^=AA
zbW&cu*w*cxu;VP3J@vM|O#_k>yd9tTv;_?`E}PYd@A$MuW%OHi2rkM~v=Dov;Y7-7
zAaTTF>ad~dPar2dYG}p;CzwL#6r&~HaJQPP3MLIh`#72cv*Byc7@)>`G}QRWXOg*X
zGL0)1^3!R;BC_fl#Pl(8>!QS>U-UUC+GSK@)9Fg~2D+6J<#O7?MVicBsMcXGwqrNd
zmM)NeH&<1V$sS6SduL@BG^C*#Cgh+7Rj9;no|nUkLp-m-PX0Q*_<5n@;hVE-&jB*q
zLtL48^F(qx*12*DY&!bs2r&O^F<Z}jR?J<;Ej2plFu5+2E|C(${?k&MyLh&#Da{$Z
Qv%FfXq}pvp>M7sy7yfVSN&o-=

diff --git a/res/gta5sync_de.ts b/res/gta5sync_de.ts
index db76498..f25ea97 100755
--- a/res/gta5sync_de.ts
+++ b/res/gta5sync_de.ts
@@ -1268,12 +1268,14 @@ Exportieren als:</translation>
         <translation>Bearbei&amp;ten</translation>
     </message>
     <message>
+        <location filename="../SnapmaticWidget.cpp" line="201"/>
         <source>Enable &amp;In-game</source>
-        <translation type="vanished">&amp;Im Spiel aktivieren</translation>
+        <translation>&amp;Im Spiel aktivieren</translation>
     </message>
     <message>
+        <location filename="../SnapmaticWidget.cpp" line="205"/>
         <source>Disable &amp;In-game</source>
-        <translation type="vanished">&amp;Im Spiel deaktivieren</translation>
+        <translation>&amp;Im Spiel deaktivieren</translation>
     </message>
     <message>
         <location filename="../SnapmaticWidget.cpp" line="207"/>
@@ -1288,16 +1290,6 @@ Exportieren als:</translation>
         <source>Export as &amp;GTA Snapmatic</source>
         <translation type="obsolete">Exportiere als &amp;GTA Snapmatic</translation>
     </message>
-    <message>
-        <location filename="../SnapmaticWidget.cpp" line="201"/>
-        <source>Show &amp;In-game</source>
-        <translation>&amp;Im Spiel anzeigen</translation>
-    </message>
-    <message>
-        <location filename="../SnapmaticWidget.cpp" line="205"/>
-        <source>Hide &amp;In-game</source>
-        <translation>&amp;Im Spiel ausblenden</translation>
-    </message>
     <message>
         <location filename="../SnapmaticWidget.cpp" line="208"/>
         <source>Export as &amp;JPG picture...</source>
@@ -1565,17 +1557,8 @@ Exportieren als:</translation>
     </message>
     <message>
         <location filename="../UserInterface.ui" line="330"/>
-        <source>Show In-gam&amp;e</source>
-        <translation>Im Spiel anzeig&amp;en</translation>
-    </message>
-    <message>
-        <location filename="../UserInterface.ui" line="338"/>
-        <source>Hid&amp;e In-game</source>
-        <translation>Im Spiel ausblen&amp;den</translation>
-    </message>
-    <message>
         <source>&amp;Enable In-game</source>
-        <translation type="vanished">Im Spiel aktivier&amp;en</translation>
+        <translation>Im Spiel aktivier&amp;en</translation>
     </message>
     <message>
         <location filename="../UserInterface.ui" line="333"/>
@@ -1583,8 +1566,9 @@ Exportieren als:</translation>
         <translation>Umschalt+E</translation>
     </message>
     <message>
+        <location filename="../UserInterface.ui" line="338"/>
         <source>&amp;Disable In-game</source>
-        <translation type="vanished">Im Spiel &amp;deaktivieren</translation>
+        <translation>Im Spiel &amp;deaktivieren</translation>
     </message>
     <message>
         <location filename="../UserInterface.ui" line="341"/>