Make it possible for show and hide multiple pictures at once

This commit is contained in:
Rafael 2016-10-27 11:24:26 +02:00
parent a86eab43ff
commit cc5813b273
8 changed files with 87 additions and 43 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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()

View File

@ -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;

View File

@ -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();
}
}

View File

@ -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:

Binary file not shown.

View File

@ -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"/>