comparison view/ViewManager.cpp @ 684:917039d333bb tonioni

Merge from default branch
author Chris Cannam
date Tue, 26 Nov 2013 14:38:48 +0000
parents 1a0fdad4af4d 1a0dfcbffaf1
children ad12e428785b
comparison
equal deleted inserted replaced
680:ced5f158eda7 684:917039d333bb
68 settings.value("show-centre-line", m_showCentreLine).toBool(); 68 settings.value("show-centre-line", m_showCentreLine).toBool();
69 settings.endGroup(); 69 settings.endGroup();
70 70
71 if (getGlobalDarkBackground()) { 71 if (getGlobalDarkBackground()) {
72 /* 72 /*
73 std::cerr << "dark palette:" << std::endl; 73 cerr << "dark palette:" << endl;
74 std::cerr << "window = " << QApplication::palette().color(QPalette::Window).name() << std::endl; 74 cerr << "window = " << QApplication::palette().color(QPalette::Window).name() << endl;
75 std::cerr << "windowtext = " << QApplication::palette().color(QPalette::WindowText).name() << std::endl; 75 cerr << "windowtext = " << QApplication::palette().color(QPalette::WindowText).name() << endl;
76 std::cerr << "base = " << QApplication::palette().color(QPalette::Base).name() << std::endl; 76 cerr << "base = " << QApplication::palette().color(QPalette::Base).name() << endl;
77 std::cerr << "alternatebase = " << QApplication::palette().color(QPalette::AlternateBase).name() << std::endl; 77 cerr << "alternatebase = " << QApplication::palette().color(QPalette::AlternateBase).name() << endl;
78 std::cerr << "text = " << QApplication::palette().color(QPalette::Text).name() << std::endl; 78 cerr << "text = " << QApplication::palette().color(QPalette::Text).name() << endl;
79 std::cerr << "button = " << QApplication::palette().color(QPalette::Button).name() << std::endl; 79 cerr << "button = " << QApplication::palette().color(QPalette::Button).name() << endl;
80 std::cerr << "buttontext = " << QApplication::palette().color(QPalette::ButtonText).name() << std::endl; 80 cerr << "buttontext = " << QApplication::palette().color(QPalette::ButtonText).name() << endl;
81 std::cerr << "brighttext = " << QApplication::palette().color(QPalette::BrightText).name() << std::endl; 81 cerr << "brighttext = " << QApplication::palette().color(QPalette::BrightText).name() << endl;
82 std::cerr << "light = " << QApplication::palette().color(QPalette::Light).name() << std::endl; 82 cerr << "light = " << QApplication::palette().color(QPalette::Light).name() << endl;
83 std::cerr << "dark = " << QApplication::palette().color(QPalette::Dark).name() << std::endl; 83 cerr << "dark = " << QApplication::palette().color(QPalette::Dark).name() << endl;
84 std::cerr << "mid = " << QApplication::palette().color(QPalette::Mid).name() << std::endl; 84 cerr << "mid = " << QApplication::palette().color(QPalette::Mid).name() << endl;
85 */ 85 */
86 m_lightPalette = QPalette(QColor("#000000"), // WindowText 86 m_lightPalette = QPalette(QColor("#000000"), // WindowText
87 QColor("#dddfe4"), // Button 87 QColor("#dddfe4"), // Button
88 QColor("#ffffff"), // Light 88 QColor("#ffffff"), // Light
89 QColor("#555555"), // Dark 89 QColor("#555555"), // Dark
94 QColor("#efefef")); // Window 94 QColor("#efefef")); // Window
95 95
96 96
97 } else { 97 } else {
98 /* 98 /*
99 std::cerr << "light palette:" << std::endl; 99 cerr << "light palette:" << endl;
100 std::cerr << "window = " << QApplication::palette().color(QPalette::Window).name() << std::endl; 100 cerr << "window = " << QApplication::palette().color(QPalette::Window).name() << endl;
101 std::cerr << "windowtext = " << QApplication::palette().color(QPalette::WindowText).name() << std::endl; 101 cerr << "windowtext = " << QApplication::palette().color(QPalette::WindowText).name() << endl;
102 std::cerr << "base = " << QApplication::palette().color(QPalette::Base).name() << std::endl; 102 cerr << "base = " << QApplication::palette().color(QPalette::Base).name() << endl;
103 std::cerr << "alternatebase = " << QApplication::palette().color(QPalette::AlternateBase).name() << std::endl; 103 cerr << "alternatebase = " << QApplication::palette().color(QPalette::AlternateBase).name() << endl;
104 std::cerr << "text = " << QApplication::palette().color(QPalette::Text).name() << std::endl; 104 cerr << "text = " << QApplication::palette().color(QPalette::Text).name() << endl;
105 std::cerr << "button = " << QApplication::palette().color(QPalette::Button).name() << std::endl; 105 cerr << "button = " << QApplication::palette().color(QPalette::Button).name() << endl;
106 std::cerr << "buttontext = " << QApplication::palette().color(QPalette::ButtonText).name() << std::endl; 106 cerr << "buttontext = " << QApplication::palette().color(QPalette::ButtonText).name() << endl;
107 std::cerr << "brighttext = " << QApplication::palette().color(QPalette::BrightText).name() << std::endl; 107 cerr << "brighttext = " << QApplication::palette().color(QPalette::BrightText).name() << endl;
108 std::cerr << "light = " << QApplication::palette().color(QPalette::Light).name() << std::endl; 108 cerr << "light = " << QApplication::palette().color(QPalette::Light).name() << endl;
109 std::cerr << "dark = " << QApplication::palette().color(QPalette::Dark).name() << std::endl; 109 cerr << "dark = " << QApplication::palette().color(QPalette::Dark).name() << endl;
110 std::cerr << "mid = " << QApplication::palette().color(QPalette::Mid).name() << std::endl; 110 cerr << "mid = " << QApplication::palette().color(QPalette::Mid).name() << endl;
111 */ 111 */
112 m_darkPalette = QPalette(QColor("#ffffff"), // WindowText 112 m_darkPalette = QPalette(QColor("#ffffff"), // WindowText
113 QColor("#3e3e3e"), // Button 113 QColor("#3e3e3e"), // Button
114 QColor("#808080"), // Light 114 QColor("#808080"), // Light
115 QColor("#1e1e1e"), // Dark 115 QColor("#1e1e1e"), // Dark
127 127
128 unsigned long 128 unsigned long
129 ViewManager::getGlobalCentreFrame() const 129 ViewManager::getGlobalCentreFrame() const
130 { 130 {
131 #ifdef DEBUG_VIEW_MANAGER 131 #ifdef DEBUG_VIEW_MANAGER
132 std::cerr << "ViewManager::getGlobalCentreFrame: returning " << m_globalCentreFrame << std::endl; 132 cerr << "ViewManager::getGlobalCentreFrame: returning " << m_globalCentreFrame << endl;
133 #endif 133 #endif
134 return m_globalCentreFrame; 134 return m_globalCentreFrame;
135 } 135 }
136 136
137 void 137 void
138 ViewManager::setGlobalCentreFrame(unsigned long f) 138 ViewManager::setGlobalCentreFrame(unsigned long f)
139 { 139 {
140 #ifdef DEBUG_VIEW_MANAGER 140 #ifdef DEBUG_VIEW_MANAGER
141 std::cerr << "ViewManager::setGlobalCentreFrame to " << f << std::endl; 141 cerr << "ViewManager::setGlobalCentreFrame to " << f << endl;
142 #endif 142 #endif
143 m_globalCentreFrame = f; 143 m_globalCentreFrame = f;
144 emit globalCentreFrameChanged(f); 144 emit globalCentreFrameChanged(f);
145 } 145 }
146 146
147 unsigned long 147 unsigned long
148 ViewManager::getGlobalZoom() const 148 ViewManager::getGlobalZoom() const
149 { 149 {
150 #ifdef DEBUG_VIEW_MANAGER 150 #ifdef DEBUG_VIEW_MANAGER
151 std::cerr << "ViewManager::getGlobalZoom: returning " << m_globalZoom << std::endl; 151 cerr << "ViewManager::getGlobalZoom: returning " << m_globalZoom << endl;
152 #endif 152 #endif
153 return m_globalZoom; 153 return m_globalZoom;
154 } 154 }
155 155
156 unsigned long 156 unsigned long
472 } 472 }
473 473
474 m_playbackFrame = m_playSource->getCurrentPlayingFrame(); 474 m_playbackFrame = m_playSource->getCurrentPlayingFrame();
475 475
476 #ifdef DEBUG_VIEW_MANAGER 476 #ifdef DEBUG_VIEW_MANAGER
477 std::cerr << "ViewManager::checkPlayStatus: Playing, frame " << m_playbackFrame << ", levels " << m_lastLeft << "," << m_lastRight << std::endl; 477 cerr << "ViewManager::checkPlayStatus: Playing, frame " << m_playbackFrame << ", levels " << m_lastLeft << "," << m_lastRight << endl;
478 #endif 478 #endif
479 479
480 emit playbackFrameChanged(m_playbackFrame); 480 emit playbackFrameChanged(m_playbackFrame);
481 481
482 QTimer::singleShot(20, this, SLOT(checkPlayStatus())); 482 QTimer::singleShot(20, this, SLOT(checkPlayStatus()));
490 m_lastLeft = 0.0; 490 m_lastLeft = 0.0;
491 m_lastRight = 0.0; 491 m_lastRight = 0.0;
492 } 492 }
493 493
494 #ifdef DEBUG_VIEW_MANAGER 494 #ifdef DEBUG_VIEW_MANAGER
495 // std::cerr << "ViewManager::checkPlayStatus: Not playing" << std::endl; 495 // cerr << "ViewManager::checkPlayStatus: Not playing" << endl;
496 #endif 496 #endif
497 } 497 }
498 } 498 }
499 499
500 bool 500 bool
508 PlaybackFollowMode mode) 508 PlaybackFollowMode mode)
509 { 509 {
510 View *v = dynamic_cast<View *>(sender()); 510 View *v = dynamic_cast<View *>(sender());
511 511
512 #ifdef DEBUG_VIEW_MANAGER 512 #ifdef DEBUG_VIEW_MANAGER
513 std::cerr << "ViewManager::viewCentreFrameChanged(" << f << ", " << locked << ", " << mode << "), view is " << v << std::endl; 513 cerr << "ViewManager::viewCentreFrameChanged(" << f << ", " << locked << ", " << mode << "), view is " << v << endl;
514 #endif 514 #endif
515 515
516 if (locked) { 516 if (locked) {
517 m_globalCentreFrame = f; 517 m_globalCentreFrame = f;
518 emit globalCentreFrameChanged(f); 518 emit globalCentreFrameChanged(f);
537 537
538 void 538 void
539 ViewManager::seek(unsigned long f) 539 ViewManager::seek(unsigned long f)
540 { 540 {
541 #ifdef DEBUG_VIEW_MANAGER 541 #ifdef DEBUG_VIEW_MANAGER
542 std::cerr << "ViewManager::seek(" << f << ")" << std::endl; 542 cerr << "ViewManager::seek(" << f << ")" << endl;
543 #endif 543 #endif
544 544
545 if (m_playSource && m_playSource->isPlaying()) { 545 if (m_playSource && m_playSource->isPlaying()) {
546 unsigned long playFrame = m_playSource->getCurrentPlayingFrame(); 546 unsigned long playFrame = m_playSource->getCurrentPlayingFrame();
547 unsigned long diff = std::max(f, playFrame) - std::min(f, playFrame); 547 unsigned long diff = std::max(f, playFrame) - std::min(f, playFrame);
548 if (diff > 20000) { 548 if (diff > 20000) {
549 m_playbackFrame = f; 549 m_playbackFrame = f;
550 m_playSource->play(f); 550 m_playSource->play(f);
551 #ifdef DEBUG_VIEW_MANAGER 551 #ifdef DEBUG_VIEW_MANAGER
552 std::cerr << "ViewManager::considerSeek: reseeking from " << playFrame << " to " << f << std::endl; 552 cerr << "ViewManager::considerSeek: reseeking from " << playFrame << " to " << f << endl;
553 #endif 553 #endif
554 emit playbackFrameChanged(f); 554 emit playbackFrameChanged(f);
555 } 555 }
556 } else { 556 } else {
557 if (m_playbackFrame != f) { 557 if (m_playbackFrame != f) {
576 if (locked) { 576 if (locked) {
577 m_globalZoom = z; 577 m_globalZoom = z;
578 } 578 }
579 579
580 #ifdef DEBUG_VIEW_MANAGER 580 #ifdef DEBUG_VIEW_MANAGER
581 std::cerr << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << std::endl; 581 cerr << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << endl;
582 #endif 582 #endif
583 583
584 emit viewZoomLevelChanged(v, z, locked); 584 emit viewZoomLevelChanged(v, z, locked);
585 585
586 if (!dynamic_cast<Overview *>(v)) { 586 if (!dynamic_cast<Overview *>(v)) {