Mercurial > hg > svgui
changeset 292:24fc90078754
* Add QuickTime file reader class -- totally untested, shouldn't even compile
author | Chris Cannam |
---|---|
date | Mon, 06 Aug 2007 14:37:59 +0000 |
parents | 3801289761a1 |
children | 15b8a4bfe855 |
files | view/View.cpp view/ViewManager.cpp view/ViewManager.h |
diffstat | 3 files changed, 47 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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 <QSettings> +#include <QApplication> #include <iostream> @@ -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; +} +
--- 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 <QObject> #include <QTimer> +#include <QPalette> #include <map> @@ -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