mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Fallback to loading theme icons from resources
Since not all platforms support theme icons, we need to pack them into resources and fallback to that resource theme. There seems to be a bug in Qt (https://bugreports.qt-project.org/browse/QTBUG-16697), thus default theme name (hicolor) does not work. So we test for 'window-close' theme icon on startup and if not found, set theme name to 'subsurface' Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									c84b40664d
								
							
						
					
					
						commit
						22d56889bb
					
				
					 7 changed files with 17 additions and 3 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								icons/subsurface/32x32/actions/go-down.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								icons/subsurface/32x32/actions/go-down.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 649 B | 
							
								
								
									
										
											BIN
										
									
								
								icons/subsurface/32x32/actions/go-up.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								icons/subsurface/32x32/actions/go-up.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 622 B | 
							
								
								
									
										
											BIN
										
									
								
								icons/subsurface/32x32/actions/window-close.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								icons/subsurface/32x32/actions/window-close.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 338 B | 
							
								
								
									
										7
									
								
								icons/subsurface/index.theme
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								icons/subsurface/index.theme
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | ||||||
|  | [Icon Theme] | ||||||
|  | Name=Subsurface | ||||||
|  | Comment=Subsurface fallback theme | ||||||
|  | Directories=32x32/actions | ||||||
|  | 
 | ||||||
|  | [32x32/actions] | ||||||
|  | Size=32 | ||||||
|  | @ -70,6 +70,9 @@ MainWindow::MainWindow() : QMainWindow(), | ||||||
| 	m_Instance = this; | 	m_Instance = this; | ||||||
| 	ui.setupUi(this); | 	ui.setupUi(this); | ||||||
| 	setWindowIcon(QIcon(":subsurface-icon")); | 	setWindowIcon(QIcon(":subsurface-icon")); | ||||||
|  | 	if (!QIcon::hasThemeIcon("window-close")) { | ||||||
|  | 		QIcon::setThemeName("subsurface"); | ||||||
|  | 	} | ||||||
| 	connect(ui.ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int))); | 	connect(ui.ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int))); | ||||||
| 	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings())); | 	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings())); | ||||||
| 	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(update())); | 	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(update())); | ||||||
|  |  | ||||||
|  | @ -74,7 +74,7 @@ | ||||||
|           <string/> |           <string/> | ||||||
|          </property> |          </property> | ||||||
|          <property name="icon"> |          <property name="icon"> | ||||||
|           <iconset theme="go-previous"> |           <iconset theme="go-up"> | ||||||
|            <normaloff/> |            <normaloff/> | ||||||
|           </iconset> |           </iconset> | ||||||
|          </property> |          </property> | ||||||
|  | @ -98,7 +98,7 @@ | ||||||
|           <string/> |           <string/> | ||||||
|          </property> |          </property> | ||||||
|          <property name="icon"> |          <property name="icon"> | ||||||
|           <iconset theme="go-next"> |           <iconset theme="go-down"> | ||||||
|            <normaloff/> |            <normaloff/> | ||||||
|           </iconset> |           </iconset> | ||||||
|          </property> |          </property> | ||||||
|  |  | ||||||
|  | @ -53,6 +53,10 @@ | ||||||
|         <file alias="icon_ceiling_dc">icons/pc.png</file> |         <file alias="icon_ceiling_dc">icons/pc.png</file> | ||||||
|         <file alias="icon_ead">icons/ead.png</file> |         <file alias="icon_ead">icons/ead.png</file> | ||||||
|         <file alias="icon_HR">icons/icon-HR.png</file> |         <file alias="icon_HR">icons/icon-HR.png</file> | ||||||
| 	<file alias="calendar">icons/calendarbg.png</file> |         <file alias="calendar">icons/calendarbg.png</file> | ||||||
|  |         <file>icons/subsurface/index.theme</file> | ||||||
|  |         <file>icons/subsurface/32x32/actions/go-down.png</file> | ||||||
|  |         <file>icons/subsurface/32x32/actions/go-up.png</file> | ||||||
|  |         <file>icons/subsurface/32x32/actions/window-close.png</file> | ||||||
|     </qresource> |     </qresource> | ||||||
| </RCC> | </RCC> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue