Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 734:de7969894402 background-mode
Fix initial dark background flag when OS theme indicates something different to the facts on the ground
author | Chris Cannam |
---|---|
date | Mon, 20 Jan 2020 17:20:09 +0000 |
parents | a39538eaed9d |
children | 4b58b8f44be7 |
comparison
equal
deleted
inserted
replaced
733:a39538eaed9d | 734:de7969894402 |
---|---|
210 settings.endGroup(); | 210 settings.endGroup(); |
211 | 211 |
212 SVDEBUG << "MainWindowBase: View font size is " << viewFontSize << endl; | 212 SVDEBUG << "MainWindowBase: View font size is " << viewFontSize << endl; |
213 | 213 |
214 #ifndef Q_OS_MAC | 214 #ifndef Q_OS_MAC |
215 | |
215 Preferences::BackgroundMode mode = | 216 Preferences::BackgroundMode mode = |
216 Preferences::getInstance()->getBackgroundMode(); | 217 Preferences::getInstance()->getBackgroundMode(); |
217 if (mode == Preferences::BackgroundFromTheme && OSThemeIsDark()) { | 218 |
218 mode = Preferences::DarkBackground; | |
219 } | |
220 m_initialDarkBackground = m_viewManager->getGlobalDarkBackground(); | 219 m_initialDarkBackground = m_viewManager->getGlobalDarkBackground(); |
221 if (mode != Preferences::BackgroundFromTheme) { | 220 |
221 if (OSReportsDarkThemeActive()) { | |
222 // NB !(OSReportsDarkThemeActive()) doesn't necessarily mean | |
223 // the theme is light - the function also cunningly returns | |
224 // false if it has no way to tell | |
225 m_initialDarkBackground = true; | |
226 } | |
227 | |
228 if (mode == Preferences::BackgroundFromTheme) { | |
229 m_viewManager->setGlobalDarkBackground | |
230 (m_initialDarkBackground); | |
231 } else { | |
222 m_viewManager->setGlobalDarkBackground | 232 m_viewManager->setGlobalDarkBackground |
223 (mode == Preferences::DarkBackground); | 233 (mode == Preferences::DarkBackground); |
224 } | 234 } |
235 | |
225 #endif | 236 #endif |
226 | 237 |
227 m_paneStack = new PaneStack(nullptr, m_viewManager, paneStackOptions); | 238 m_paneStack = new PaneStack(nullptr, m_viewManager, paneStackOptions); |
228 connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)), | 239 connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)), |
229 this, SLOT(currentPaneChanged(Pane *))); | 240 this, SLOT(currentPaneChanged(Pane *))); |