mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Implement different zoom levels for dive photos tab
This implements different zoom levels for the dive photos tab as suggested by Stefan Fuchs <sfuchs@gmx.de> in #898. The zoom level can be changed using a slider or CTRL+mousewheel. Zoom levels range from a third of the standard thumbnail size to thrice the standard thumbnail size. Thumbnails are cached in maximum resolution and scaled down on the fly. Because the profile widget took its pictures from the photo list model, an extra picture copy with a fixed size had to be introduced. The UI is still a bit crude. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									0d01c70f3a
								
							
						
					
					
						commit
						05a1626c7e
					
				
					 8 changed files with 120 additions and 17 deletions
				
			
		|  | @ -29,6 +29,10 @@ TabDivePhotos::TabDivePhotos(QWidget *parent) | |||
| 			QDesktopServices::openUrl(QUrl::fromLocalFile(path)); | ||||
| 		} | ||||
| 	); | ||||
| 	connect(ui->photosView, &DivePictureWidget::zoomLevelChanged, | ||||
| 		this, &TabDivePhotos::changeZoomLevel); | ||||
| 	connect(ui->zoomSlider, &QAbstractSlider::valueChanged, | ||||
| 		DivePictureModel::instance(), &DivePictureModel::setZoomLevel); | ||||
| } | ||||
| 
 | ||||
| TabDivePhotos::~TabDivePhotos() | ||||
|  | @ -98,3 +102,8 @@ void TabDivePhotos::updateData() | |||
| 	divePictureModel->updateDivePictures(); | ||||
| } | ||||
| 
 | ||||
| void TabDivePhotos::changeZoomLevel(int delta) | ||||
| { | ||||
| 	// We count on QSlider doing bound checks
 | ||||
| 	ui->zoomSlider->setValue(ui->zoomSlider->value() + delta); | ||||
| } | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ private slots: | |||
| 	void addPhotosFromURL(); | ||||
| 	void removeAllPhotos(); | ||||
| 	void removeSelectedPhotos(); | ||||
| 	void changeZoomLevel(int delta); | ||||
| 
 | ||||
| private: | ||||
| 	Ui::TabDivePhotos *ui; | ||||
|  |  | |||
|  | @ -21,6 +21,42 @@ | |||
|      </property> | ||||
|     </widget> | ||||
|    </item> | ||||
|    <item> | ||||
|     <layout class="QHBoxLayout" name="zoomLayout"> | ||||
|      <item> | ||||
|       <widget class="QLabel" name="zoomLabel"> | ||||
|        <property name="text"> | ||||
|         <string>Zoom level</string> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="QSlider" name="zoomSlider"> | ||||
|        <property name="minimum"> | ||||
|         <number>-10</number> | ||||
|        </property> | ||||
|        <property name="maximum"> | ||||
|         <number>10</number> | ||||
|        </property> | ||||
|        <property name="singleStep"> | ||||
|         <number>1</number> | ||||
|        </property> | ||||
|        <property name="pageStep"> | ||||
|         <number>1</number> | ||||
|        </property> | ||||
|        <property name="orientation"> | ||||
|         <enum>Qt::Horizontal</enum> | ||||
|        </property> | ||||
|        <property name="tickPosition"> | ||||
|         <enum>QSlider::TicksBelow</enum> | ||||
|        </property> | ||||
|        <property name="tickInterval"> | ||||
|         <number>1</number> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|     </layout> | ||||
|    </item> | ||||
|   </layout> | ||||
|  </widget> | ||||
|  <customwidgets> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue