comparison view/ViewManager.cpp @ 502:73a58a4dfebd

* Add vestigial Activity Log
author Chris Cannam
date Tue, 24 Feb 2009 14:01:42 +0000
parents 80e279e4f9fe
children 133b378d8efe
comparison
equal deleted inserted replaced
501:08e1ccfe289c 502:73a58a4dfebd
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #include "ViewManager.h" 16 #include "ViewManager.h"
17 #include "base/AudioPlaySource.h" 17 #include "base/AudioPlaySource.h"
18 #include "base/RealTime.h"
18 #include "data/model/Model.h" 19 #include "data/model/Model.h"
19 #include "widgets/CommandHistory.h" 20 #include "widgets/CommandHistory.h"
20 #include "View.h" 21 #include "View.h"
21 22
22 #include <QSettings> 23 #include <QSettings>
322 323
323 QString 324 QString
324 ViewManager::SetSelectionCommand::getName() const 325 ViewManager::SetSelectionCommand::getName() const
325 { 326 {
326 if (m_newSelection.getSelections().empty()) return tr("Clear Selection"); 327 if (m_newSelection.getSelections().empty()) return tr("Clear Selection");
327 else return tr("Select"); 328 if (m_newSelection.getSelections().size() > 1) return tr("Select Multiple Regions");
329 else return tr("Select Region");
328 } 330 }
329 331
330 Selection 332 Selection
331 ViewManager::getContainingSelection(size_t frame, bool defaultToFollowing) const 333 ViewManager::getContainingSelection(size_t frame, bool defaultToFollowing) const
332 { 334 {
337 ViewManager::setToolMode(ToolMode mode) 339 ViewManager::setToolMode(ToolMode mode)
338 { 340 {
339 m_toolMode = mode; 341 m_toolMode = mode;
340 342
341 emit toolModeChanged(); 343 emit toolModeChanged();
344
345 switch (mode) {
346 case NavigateMode: emit activity(tr("Enter Navigate mode")); break;
347 case SelectMode: emit activity(tr("Enter Select mode")); break;
348 case EditMode: emit activity(tr("Enter Edit mode")); break;
349 case DrawMode: emit activity(tr("Enter Draw mode")); break;
350 case EraseMode: emit activity(tr("Enter Erase mode")); break;
351 case MeasureMode: emit activity(tr("Enter Measure mode")); break;
352 };
342 } 353 }
343 354
344 void 355 void
345 ViewManager::setPlayLoopMode(bool mode) 356 ViewManager::setPlayLoopMode(bool mode)
346 { 357 {
348 359
349 m_playLoopMode = mode; 360 m_playLoopMode = mode;
350 361
351 emit playLoopModeChanged(); 362 emit playLoopModeChanged();
352 emit playLoopModeChanged(mode); 363 emit playLoopModeChanged(mode);
364
365 if (mode) emit activity(tr("Switch on Loop mode"));
366 else emit activity(tr("Switch off Loop mode"));
353 } 367 }
354 } 368 }
355 369
356 void 370 void
357 ViewManager::setPlaySelectionMode(bool mode) 371 ViewManager::setPlaySelectionMode(bool mode)
360 374
361 m_playSelectionMode = mode; 375 m_playSelectionMode = mode;
362 376
363 emit playSelectionModeChanged(); 377 emit playSelectionModeChanged();
364 emit playSelectionModeChanged(mode); 378 emit playSelectionModeChanged(mode);
379
380 if (mode) emit activity(tr("Switch on Play Selection mode"));
381 else emit activity(tr("Switch off Play Selection mode"));
365 } 382 }
366 } 383 }
367 384
368 void 385 void
369 ViewManager::setPlaySoloMode(bool mode) 386 ViewManager::setPlaySoloMode(bool mode)
372 389
373 m_playSoloMode = mode; 390 m_playSoloMode = mode;
374 391
375 emit playSoloModeChanged(); 392 emit playSoloModeChanged();
376 emit playSoloModeChanged(mode); 393 emit playSoloModeChanged(mode);
394
395 if (mode) emit activity(tr("Switch on Play Solo mode"));
396 else emit activity(tr("Switch off Play Solo mode"));
377 } 397 }
378 } 398 }
379 399
380 void 400 void
381 ViewManager::setAlignMode(bool mode) 401 ViewManager::setAlignMode(bool mode)
384 404
385 m_alignMode = mode; 405 m_alignMode = mode;
386 406
387 emit alignModeChanged(); 407 emit alignModeChanged();
388 emit alignModeChanged(mode); 408 emit alignModeChanged(mode);
409
410 if (mode) emit activity(tr("Switch on Alignment mode"));
411 else emit activity(tr("Switch off Alignment mode"));
389 } 412 }
390 } 413 }
391 414
392 size_t 415 size_t
393 ViewManager::getPlaybackSampleRate() const 416 ViewManager::getPlaybackSampleRate() const
483 emit globalCentreFrameChanged(f); 506 emit globalCentreFrameChanged(f);
484 } else { 507 } else {
485 if (v) emit viewCentreFrameChanged(v, f); 508 if (v) emit viewCentreFrameChanged(v, f);
486 } 509 }
487 510
511 emit activity(tr("Scroll view to %1")
512 .arg(RealTime::frame2RealTime
513 (f, m_mainModelSampleRate).toText().c_str()));
514
488 if (mode == PlaybackIgnore) { 515 if (mode == PlaybackIgnore) {
489 return; 516 return;
490 } 517 }
491 518
492 seek(f); 519 seek(f);
537 #ifdef DEBUG_VIEW_MANAGER 564 #ifdef DEBUG_VIEW_MANAGER
538 std::cout << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << std::endl; 565 std::cout << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << std::endl;
539 #endif 566 #endif
540 567
541 emit viewZoomLevelChanged(v, z, locked); 568 emit viewZoomLevelChanged(v, z, locked);
569 emit activity(tr("Zoom to %n sample(s) per pixel", "", z));
542 } 570 }
543 571
544 void 572 void
545 ViewManager::setOverlayMode(OverlayMode mode) 573 ViewManager::setOverlayMode(OverlayMode mode)
546 { 574 {
547 if (m_overlayMode != mode) { 575 if (m_overlayMode != mode) {
548 m_overlayMode = mode; 576 m_overlayMode = mode;
549 emit overlayModeChanged(); 577 emit overlayModeChanged();
578 emit activity(tr("Change overlay level"));
550 } 579 }
551 580
552 QSettings settings; 581 QSettings settings;
553 settings.beginGroup("MainWindow"); 582 settings.beginGroup("MainWindow");
554 settings.setValue("overlay-mode", int(m_overlayMode)); 583 settings.setValue("overlay-mode", int(m_overlayMode));
559 ViewManager::setZoomWheelsEnabled(bool enabled) 588 ViewManager::setZoomWheelsEnabled(bool enabled)
560 { 589 {
561 if (m_zoomWheelsEnabled != enabled) { 590 if (m_zoomWheelsEnabled != enabled) {
562 m_zoomWheelsEnabled = enabled; 591 m_zoomWheelsEnabled = enabled;
563 emit zoomWheelsEnabledChanged(); 592 emit zoomWheelsEnabledChanged();
593 if (enabled) emit activity("Show zoom wheels");
594 else emit activity("Hide zoom wheels");
564 } 595 }
565 596
566 QSettings settings; 597 QSettings settings;
567 settings.beginGroup("MainWindow"); 598 settings.beginGroup("MainWindow");
568 settings.setValue("zoom-wheels-enabled", m_zoomWheelsEnabled); 599 settings.setValue("zoom-wheels-enabled", m_zoomWheelsEnabled);