# HG changeset patch # User Chris Cannam # Date 1186411079 0 # Node ID 24fc900787546761bcfd08b3800c8aecfe13ba3d # Parent 3801289761a19af73be4e27fd840b3ce70082a53 * Add QuickTime file reader class -- totally untested, shouldn't even compile diff -r 3801289761a1 -r 24fc90078754 view/View.cpp --- a/view/View.cpp Mon Jul 16 14:06:03 2007 +0000 +++ b/view/View.cpp Mon Aug 06 14:37:59 2007 +0000 @@ -436,11 +436,7 @@ View::hasLightBackground() const { bool darkPalette = false; - - QColor windowBg = palette().color(QPalette::Window); - if (windowBg.red() + windowBg.green() + windowBg.blue() < 384) { - darkPalette = true; - } + if (m_manager) darkPalette = m_manager->getGlobalDarkBackground(); Layer::ColourSignificance maxSignificance = Layer::ColourAbsent; bool mostSignificantHasDarkBackground = false; diff -r 3801289761a1 -r 24fc90078754 view/ViewManager.cpp --- a/view/ViewManager.cpp Mon Jul 16 14:06:03 2007 +0000 +++ b/view/ViewManager.cpp Mon Aug 06 14:37:59 2007 +0000 @@ -20,6 +20,7 @@ #include "View.h" #include +#include #include @@ -38,7 +39,9 @@ m_playLoopMode(false), m_playSelectionMode(false), m_overlayMode(StandardOverlays), - m_zoomWheelsEnabled(true) + m_zoomWheelsEnabled(true), + m_lightPalette(QApplication::palette()), + m_darkPalette(QApplication::palette()) { QSettings settings; settings.beginGroup("MainWindow"); @@ -47,11 +50,12 @@ m_zoomWheelsEnabled = settings.value("zoom-wheels-enabled", m_zoomWheelsEnabled).toBool(); settings.endGroup(); -/*!!! - connect(this, - SIGNAL(zoomLevelChanged(void *, unsigned long, bool)), - SLOT(considerZoomChange(void *, unsigned long, bool))); -*/ + + if (getGlobalDarkBackground()) { + m_lightPalette = QPalette(QColor(240, 240, 240)); + } else { + m_darkPalette = QPalette(QColor(16, 16, 16)); + } } ViewManager::~ViewManager() @@ -459,3 +463,32 @@ settings.endGroup(); } +void +ViewManager::setGlobalDarkBackground(bool dark) +{ + // also save the current palette, in case the user has changed it + // since construction + if (getGlobalDarkBackground()) { + m_darkPalette = QApplication::palette(); + } else { + m_lightPalette = QApplication::palette(); + } + + if (dark) { + QApplication::setPalette(m_darkPalette); + } else { + QApplication::setPalette(m_lightPalette); + } +} + +bool +ViewManager::getGlobalDarkBackground() const +{ + bool dark = false; + QColor windowBg = QApplication::palette().color(QPalette::Window); + if (windowBg.red() + windowBg.green() + windowBg.blue() < 384) { + dark = true; + } + return dark; +} + diff -r 3801289761a1 -r 24fc90078754 view/ViewManager.h --- a/view/ViewManager.h Mon Jul 16 14:06:03 2007 +0000 +++ b/view/ViewManager.h Mon Aug 06 14:37:59 2007 +0000 @@ -18,6 +18,7 @@ #include #include +#include #include @@ -162,6 +163,9 @@ void setZoomWheelsEnabled(bool enable); bool getZoomWheelsEnabled() const { return m_zoomWheelsEnabled; } + void setGlobalDarkBackground(bool dark); + bool getGlobalDarkBackground() const; + signals: /** Emitted when user causes the global centre frame to change. */ void globalCentreFrameChanged(unsigned long frame); @@ -252,6 +256,9 @@ OverlayMode m_overlayMode; bool m_zoomWheelsEnabled; + + QPalette m_lightPalette; + QPalette m_darkPalette; }; #endif