Make it possible for show and hide multiple pictures at once
This commit is contained in:
		
							parent
							
								
									a86eab43ff
								
							
						
					
					
						commit
						cc5813b273
					
				
					 8 changed files with 87 additions and 43 deletions
				
			
		|  | @ -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; | ||||
|  |  | |||
|  | @ -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(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -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() | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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(); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -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.
										
									
								
							|  | @ -1268,12 +1268,14 @@ Exportieren als:</translation> | |||
|         <translation>Bearbei&ten</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../SnapmaticWidget.cpp" line="201"/> | ||||
|         <source>Enable &In-game</source> | ||||
|         <translation type="vanished">&Im Spiel aktivieren</translation> | ||||
|         <translation>&Im Spiel aktivieren</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../SnapmaticWidget.cpp" line="205"/> | ||||
|         <source>Disable &In-game</source> | ||||
|         <translation type="vanished">&Im Spiel deaktivieren</translation> | ||||
|         <translation>&Im Spiel deaktivieren</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../SnapmaticWidget.cpp" line="207"/> | ||||
|  | @ -1288,16 +1290,6 @@ Exportieren als:</translation> | |||
|         <source>Export as &GTA Snapmatic</source> | ||||
|         <translation type="obsolete">Exportiere als &GTA Snapmatic</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../SnapmaticWidget.cpp" line="201"/> | ||||
|         <source>Show &In-game</source> | ||||
|         <translation>&Im Spiel anzeigen</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../SnapmaticWidget.cpp" line="205"/> | ||||
|         <source>Hide &In-game</source> | ||||
|         <translation>&Im Spiel ausblenden</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../SnapmaticWidget.cpp" line="208"/> | ||||
|         <source>Export as &JPG picture...</source> | ||||
|  | @ -1565,17 +1557,8 @@ Exportieren als:</translation> | |||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../UserInterface.ui" line="330"/> | ||||
|         <source>Show In-gam&e</source> | ||||
|         <translation>Im Spiel anzeig&en</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../UserInterface.ui" line="338"/> | ||||
|         <source>Hid&e In-game</source> | ||||
|         <translation>Im Spiel ausblen&den</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <source>&Enable In-game</source> | ||||
|         <translation type="vanished">Im Spiel aktivier&en</translation> | ||||
|         <translation>Im Spiel aktivier&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>&Disable In-game</source> | ||||
|         <translation type="vanished">Im Spiel &deaktivieren</translation> | ||||
|         <translation>Im Spiel &deaktivieren</translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../UserInterface.ui" line="341"/> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue