comparison view/ViewManager.cpp @ 706:97ea68f62c1f imaf_enc

Merge from default branch
author Chris Cannam
date Thu, 05 Dec 2013 09:47:02 +0000
parents d8fc9659a206
children ad12e428785b
comparison
equal deleted inserted replaced
678:26c5f7fd4807 706:97ea68f62c1f
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
451 } 451 }
452 452
453 void 453 void
454 ViewManager::playStatusChanged(bool /* playing */) 454 ViewManager::playStatusChanged(bool /* playing */)
455 { 455 {
456 #ifdef DEBUG_VIEW_MANAGER
457 cerr << "ViewManager::playStatusChanged" << endl;
458 #endif
456 checkPlayStatus(); 459 checkPlayStatus();
457 } 460 }
458 461
459 void 462 void
460 ViewManager::checkPlayStatus() 463 ViewManager::checkPlayStatus()
471 } 474 }
472 475
473 m_playbackFrame = m_playSource->getCurrentPlayingFrame(); 476 m_playbackFrame = m_playSource->getCurrentPlayingFrame();
474 477
475 #ifdef DEBUG_VIEW_MANAGER 478 #ifdef DEBUG_VIEW_MANAGER
476 std::cerr << "ViewManager::checkPlayStatus: Playing, frame " << m_playbackFrame << ", levels " << m_lastLeft << "," << m_lastRight << std::endl; 479 cerr << "ViewManager::checkPlayStatus: Playing, frame " << m_playbackFrame << ", levels " << m_lastLeft << "," << m_lastRight << endl;
477 #endif 480 #endif
478 481
479 emit playbackFrameChanged(m_playbackFrame); 482 emit playbackFrameChanged(m_playbackFrame);
480 483
481 QTimer::singleShot(20, this, SLOT(checkPlayStatus())); 484 QTimer::singleShot(20, this, SLOT(checkPlayStatus()));
482 485
483 } else { 486 } else {
484 487
485 QTimer::singleShot(100, this, SLOT(checkPlayStatus()));
486
487 if (m_lastLeft != 0.0 || m_lastRight != 0.0) { 488 if (m_lastLeft != 0.0 || m_lastRight != 0.0) {
488 emit outputLevelsChanged(0.0, 0.0); 489 emit outputLevelsChanged(0.0, 0.0);
489 m_lastLeft = 0.0; 490 m_lastLeft = 0.0;
490 m_lastRight = 0.0; 491 m_lastRight = 0.0;
491 } 492 }
492 493
493 #ifdef DEBUG_VIEW_MANAGER 494 #ifdef DEBUG_VIEW_MANAGER
494 // std::cerr << "ViewManager::checkPlayStatus: Not playing" << std::endl; 495 cerr << "ViewManager::checkPlayStatus: Not playing" << endl;
495 #endif 496 #endif
496 } 497 }
497 } 498 }
498 499
499 bool 500 bool
507 PlaybackFollowMode mode) 508 PlaybackFollowMode mode)
508 { 509 {
509 View *v = dynamic_cast<View *>(sender()); 510 View *v = dynamic_cast<View *>(sender());
510 511
511 #ifdef DEBUG_VIEW_MANAGER 512 #ifdef DEBUG_VIEW_MANAGER
512 std::cerr << "ViewManager::viewCentreFrameChanged(" << f << ", " << locked << ", " << mode << "), view is " << v << std::endl; 513 cerr << "ViewManager::viewCentreFrameChanged(" << f << ", " << locked << ", " << mode << "), view is " << v << endl;
513 #endif 514 #endif
514 515
515 if (locked) { 516 if (locked) {
516 m_globalCentreFrame = f; 517 m_globalCentreFrame = f;
517 emit globalCentreFrameChanged(f); 518 emit globalCentreFrameChanged(f);
536 537
537 void 538 void
538 ViewManager::seek(unsigned long f) 539 ViewManager::seek(unsigned long f)
539 { 540 {
540 #ifdef DEBUG_VIEW_MANAGER 541 #ifdef DEBUG_VIEW_MANAGER
541 std::cerr << "ViewManager::seek(" << f << ")" << std::endl; 542 cerr << "ViewManager::seek(" << f << ")" << endl;
542 #endif 543 #endif
543 544
544 if (m_playSource && m_playSource->isPlaying()) { 545 if (m_playSource && m_playSource->isPlaying()) {
545 unsigned long playFrame = m_playSource->getCurrentPlayingFrame(); 546 unsigned long playFrame = m_playSource->getCurrentPlayingFrame();
546 unsigned long diff = std::max(f, playFrame) - std::min(f, playFrame); 547 unsigned long diff = std::max(f, playFrame) - std::min(f, playFrame);
547 if (diff > 20000) { 548 if (diff > 20000) {
548 m_playbackFrame = f; 549 m_playbackFrame = f;
549 m_playSource->play(f); 550 m_playSource->play(f);
550 #ifdef DEBUG_VIEW_MANAGER 551 #ifdef DEBUG_VIEW_MANAGER
551 std::cerr << "ViewManager::considerSeek: reseeking from " << playFrame << " to " << f << std::endl; 552 cerr << "ViewManager::considerSeek: reseeking from " << playFrame << " to " << f << endl;
552 #endif 553 #endif
553 emit playbackFrameChanged(f); 554 emit playbackFrameChanged(f);
554 } 555 }
555 } else { 556 } else {
556 if (m_playbackFrame != f) { 557 if (m_playbackFrame != f) {
575 if (locked) { 576 if (locked) {
576 m_globalZoom = z; 577 m_globalZoom = z;
577 } 578 }
578 579
579 #ifdef DEBUG_VIEW_MANAGER 580 #ifdef DEBUG_VIEW_MANAGER
580 std::cerr << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << std::endl; 581 cerr << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << endl;
581 #endif 582 #endif
582 583
583 emit viewZoomLevelChanged(v, z, locked); 584 emit viewZoomLevelChanged(v, z, locked);
584 585
585 if (!dynamic_cast<Overview *>(v)) { 586 if (!dynamic_cast<Overview *>(v)) {