mirror of https://github.com/aseprite/aseprite.git
				
				
				
			Avoid refreshing the list of backup sessions when an item is doing some work/task
This commit is contained in:
		
							parent
							
								
									07f64b7682
								
							
						
					
					
						commit
						8e193b592a
					
				|  | @ -258,6 +258,9 @@ DataRecoveryView::~DataRecoveryView() | |||
| 
 | ||||
| void DataRecoveryView::refreshListNotification() | ||||
| { | ||||
|   if (someItemIsBusy()) | ||||
|     return; | ||||
| 
 | ||||
|   fillList(); | ||||
|   layout(); | ||||
| } | ||||
|  | @ -340,6 +343,19 @@ void DataRecoveryView::disableRefresh() | |||
|   m_waitToEnableRefreshTimer.start(); | ||||
| } | ||||
| 
 | ||||
| bool DataRecoveryView::someItemIsBusy() | ||||
| { | ||||
|   // Just in case check that we are not already running some task (so
 | ||||
|   // we cannot refresh the list)
 | ||||
|   for (auto widget : m_listBox.children()) { | ||||
|     if (auto item = dynamic_cast<Item*>(widget)) { | ||||
|       if (item->isTaskRunning()) | ||||
|         return true; | ||||
|     } | ||||
|   } | ||||
|   return false; | ||||
| } | ||||
| 
 | ||||
| std::string DataRecoveryView::getTabText() | ||||
| { | ||||
|   return Strings::recover_files_title(); | ||||
|  | @ -450,6 +466,9 @@ void DataRecoveryView::onDelete() | |||
| 
 | ||||
| void DataRecoveryView::onRefresh() | ||||
| { | ||||
|   if (someItemIsBusy()) | ||||
|     return; | ||||
| 
 | ||||
|   m_dataRecovery->launchSearch(); | ||||
| 
 | ||||
|   fillList(); | ||||
|  | @ -484,12 +503,8 @@ void DataRecoveryView::onChangeSelection() | |||
| 
 | ||||
| void DataRecoveryView::onCheckIfWeCanEnableRefreshButton() | ||||
| { | ||||
|   for (auto widget : m_listBox.children()) { | ||||
|     if (auto item = dynamic_cast<Item*>(widget)) { | ||||
|       if (item->isTaskRunning()) | ||||
|         return; | ||||
|     } | ||||
|   } | ||||
|   if (someItemIsBusy()) | ||||
|     return; | ||||
| 
 | ||||
|   m_refreshButton.setEnabled(true); | ||||
|   m_waitToEnableRefreshTimer.stop(); | ||||
|  |  | |||
|  | @ -53,6 +53,7 @@ namespace app { | |||
|     void fillList(); | ||||
|     void fillListWith(const bool crashes); | ||||
|     void disableRefresh(); | ||||
|     bool someItemIsBusy(); | ||||
| 
 | ||||
|     void onOpen(); | ||||
|     void onOpenRaw(crash::RawImagesAs as); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue