comparison view/ViewManager.cpp @ 642:2c35737cd3f8

Debug -- overview centre frame relocation is not currently working with qt5
author Chris Cannam
date Wed, 15 May 2013 22:15:49 +0100
parents 5b72899d692b
children 77fa3fdbfc7e
comparison
equal deleted inserted replaced
641:28973ecd4a55 642:2c35737cd3f8
24 #include <QSettings> 24 #include <QSettings>
25 #include <QApplication> 25 #include <QApplication>
26 26
27 #include <iostream> 27 #include <iostream>
28 28
29 //#define DEBUG_VIEW_MANAGER 1 29 #define DEBUG_VIEW_MANAGER 1
30 30
31 ViewManager::ViewManager() : 31 ViewManager::ViewManager() :
32 m_playSource(0), 32 m_playSource(0),
33 m_globalCentreFrame(0), 33 m_globalCentreFrame(0),
34 m_globalZoom(1024), 34 m_globalZoom(1024),
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::cout << "ViewManager::getGlobalCentreFrame: returning " << m_globalCentreFrame << std::endl; 132 std::cerr << "ViewManager::getGlobalCentreFrame: returning " << m_globalCentreFrame << std::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::cout << "ViewManager::setGlobalCentreFrame to " << f << std::endl; 141 std::cerr << "ViewManager::setGlobalCentreFrame to " << f << std::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::cout << "ViewManager::getGlobalZoom: returning " << m_globalZoom << std::endl; 151 std::cerr << "ViewManager::getGlobalZoom: returning " << m_globalZoom << std::endl;
152 #endif 152 #endif
153 return m_globalZoom; 153 return m_globalZoom;
154 } 154 }
155 155
156 unsigned long 156 unsigned long
471 } 471 }
472 472
473 m_playbackFrame = m_playSource->getCurrentPlayingFrame(); 473 m_playbackFrame = m_playSource->getCurrentPlayingFrame();
474 474
475 #ifdef DEBUG_VIEW_MANAGER 475 #ifdef DEBUG_VIEW_MANAGER
476 std::cout << "ViewManager::checkPlayStatus: Playing, frame " << m_playbackFrame << ", levels " << m_lastLeft << "," << m_lastRight << std::endl; 476 std::cerr << "ViewManager::checkPlayStatus: Playing, frame " << m_playbackFrame << ", levels " << m_lastLeft << "," << m_lastRight << std::endl;
477 #endif 477 #endif
478 478
479 emit playbackFrameChanged(m_playbackFrame); 479 emit playbackFrameChanged(m_playbackFrame);
480 480
481 QTimer::singleShot(20, this, SLOT(checkPlayStatus())); 481 QTimer::singleShot(20, this, SLOT(checkPlayStatus()));
489 m_lastLeft = 0.0; 489 m_lastLeft = 0.0;
490 m_lastRight = 0.0; 490 m_lastRight = 0.0;
491 } 491 }
492 492
493 #ifdef DEBUG_VIEW_MANAGER 493 #ifdef DEBUG_VIEW_MANAGER
494 // std::cout << "ViewManager::checkPlayStatus: Not playing" << std::endl; 494 // std::cerr << "ViewManager::checkPlayStatus: Not playing" << std::endl;
495 #endif 495 #endif
496 } 496 }
497 } 497 }
498 498
499 bool 499 bool
507 PlaybackFollowMode mode) 507 PlaybackFollowMode mode)
508 { 508 {
509 View *v = dynamic_cast<View *>(sender()); 509 View *v = dynamic_cast<View *>(sender());
510 510
511 #ifdef DEBUG_VIEW_MANAGER 511 #ifdef DEBUG_VIEW_MANAGER
512 SVDEBUG << "ViewManager::viewCentreFrameChanged(" << f << ", " << locked << ", " << mode << "), view is " << v << endl; 512 std::cerr << "ViewManager::viewCentreFrameChanged(" << f << ", " << locked << ", " << mode << "), view is " << v << std::endl;
513 #endif 513 #endif
514 514
515 if (locked) { 515 if (locked) {
516 m_globalCentreFrame = f; 516 m_globalCentreFrame = f;
517 emit globalCentreFrameChanged(f); 517 emit globalCentreFrameChanged(f);
536 536
537 void 537 void
538 ViewManager::seek(unsigned long f) 538 ViewManager::seek(unsigned long f)
539 { 539 {
540 #ifdef DEBUG_VIEW_MANAGER 540 #ifdef DEBUG_VIEW_MANAGER
541 std::cout << "ViewManager::seek(" << f << ")" << std::endl; 541 std::cerr << "ViewManager::seek(" << f << ")" << std::endl;
542 #endif 542 #endif
543 543
544 if (m_playSource && m_playSource->isPlaying()) { 544 if (m_playSource && m_playSource->isPlaying()) {
545 unsigned long playFrame = m_playSource->getCurrentPlayingFrame(); 545 unsigned long playFrame = m_playSource->getCurrentPlayingFrame();
546 unsigned long diff = std::max(f, playFrame) - std::min(f, playFrame); 546 unsigned long diff = std::max(f, playFrame) - std::min(f, playFrame);
547 if (diff > 20000) { 547 if (diff > 20000) {
548 m_playbackFrame = f; 548 m_playbackFrame = f;
549 m_playSource->play(f); 549 m_playSource->play(f);
550 #ifdef DEBUG_VIEW_MANAGER 550 #ifdef DEBUG_VIEW_MANAGER
551 std::cout << "ViewManager::considerSeek: reseeking from " << playFrame << " to " << f << std::endl; 551 std::cerr << "ViewManager::considerSeek: reseeking from " << playFrame << " to " << f << std::endl;
552 #endif 552 #endif
553 emit playbackFrameChanged(f); 553 emit playbackFrameChanged(f);
554 } 554 }
555 } else { 555 } else {
556 if (m_playbackFrame != f) { 556 if (m_playbackFrame != f) {
575 if (locked) { 575 if (locked) {
576 m_globalZoom = z; 576 m_globalZoom = z;
577 } 577 }
578 578
579 #ifdef DEBUG_VIEW_MANAGER 579 #ifdef DEBUG_VIEW_MANAGER
580 std::cout << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << std::endl; 580 std::cerr << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << std::endl;
581 #endif 581 #endif
582 582
583 emit viewZoomLevelChanged(v, z, locked); 583 emit viewZoomLevelChanged(v, z, locked);
584 584
585 if (!dynamic_cast<Overview *>(v)) { 585 if (!dynamic_cast<Overview *>(v)) {