comparison view/ViewManager.cpp @ 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 1a49bd0d8375
children 15b8a4bfe855
comparison
equal deleted inserted replaced
291:3801289761a1 292:24fc90078754
18 #include "data/model/Model.h" 18 #include "data/model/Model.h"
19 #include "base/CommandHistory.h" 19 #include "base/CommandHistory.h"
20 #include "View.h" 20 #include "View.h"
21 21
22 #include <QSettings> 22 #include <QSettings>
23 #include <QApplication>
23 24
24 #include <iostream> 25 #include <iostream>
25 26
26 //#define DEBUG_VIEW_MANAGER 1 27 //#define DEBUG_VIEW_MANAGER 1
27 28
36 m_inProgressExclusive(true), 37 m_inProgressExclusive(true),
37 m_toolMode(NavigateMode), 38 m_toolMode(NavigateMode),
38 m_playLoopMode(false), 39 m_playLoopMode(false),
39 m_playSelectionMode(false), 40 m_playSelectionMode(false),
40 m_overlayMode(StandardOverlays), 41 m_overlayMode(StandardOverlays),
41 m_zoomWheelsEnabled(true) 42 m_zoomWheelsEnabled(true),
43 m_lightPalette(QApplication::palette()),
44 m_darkPalette(QApplication::palette())
42 { 45 {
43 QSettings settings; 46 QSettings settings;
44 settings.beginGroup("MainWindow"); 47 settings.beginGroup("MainWindow");
45 m_overlayMode = OverlayMode 48 m_overlayMode = OverlayMode
46 (settings.value("overlay-mode", int(m_overlayMode)).toInt()); 49 (settings.value("overlay-mode", int(m_overlayMode)).toInt());
47 m_zoomWheelsEnabled = 50 m_zoomWheelsEnabled =
48 settings.value("zoom-wheels-enabled", m_zoomWheelsEnabled).toBool(); 51 settings.value("zoom-wheels-enabled", m_zoomWheelsEnabled).toBool();
49 settings.endGroup(); 52 settings.endGroup();
50 /*!!! 53
51 connect(this, 54 if (getGlobalDarkBackground()) {
52 SIGNAL(zoomLevelChanged(void *, unsigned long, bool)), 55 m_lightPalette = QPalette(QColor(240, 240, 240));
53 SLOT(considerZoomChange(void *, unsigned long, bool))); 56 } else {
54 */ 57 m_darkPalette = QPalette(QColor(16, 16, 16));
58 }
55 } 59 }
56 60
57 ViewManager::~ViewManager() 61 ViewManager::~ViewManager()
58 { 62 {
59 } 63 }
457 settings.beginGroup("MainWindow"); 461 settings.beginGroup("MainWindow");
458 settings.setValue("zoom-wheels-enabled", m_zoomWheelsEnabled); 462 settings.setValue("zoom-wheels-enabled", m_zoomWheelsEnabled);
459 settings.endGroup(); 463 settings.endGroup();
460 } 464 }
461 465
466 void
467 ViewManager::setGlobalDarkBackground(bool dark)
468 {
469 // also save the current palette, in case the user has changed it
470 // since construction
471 if (getGlobalDarkBackground()) {
472 m_darkPalette = QApplication::palette();
473 } else {
474 m_lightPalette = QApplication::palette();
475 }
476
477 if (dark) {
478 QApplication::setPalette(m_darkPalette);
479 } else {
480 QApplication::setPalette(m_lightPalette);
481 }
482 }
483
484 bool
485 ViewManager::getGlobalDarkBackground() const
486 {
487 bool dark = false;
488 QColor windowBg = QApplication::palette().color(QPalette::Window);
489 if (windowBg.red() + windowBg.green() + windowBg.blue() < 384) {
490 dark = true;
491 }
492 return dark;
493 }
494