comparison main/MainWindow.cpp @ 466:33d0632255b5 integration_library

Merge with the Kiosk branch
author mathieub <mathieu.barthet@eecs.qmul.ac.uk>
date Mon, 25 Jul 2011 21:04:31 +0100
parents b3b9cc8f5466 af0a2d9ece0c
children a373a9cdbe13
comparison
equal deleted inserted replaced
465:b3b9cc8f5466 466:33d0632255b5
155 m_ffwdSimilarAction(0), 155 m_ffwdSimilarAction(0),
156 m_ffwdEndAction(0), 156 m_ffwdEndAction(0),
157 m_playAction(0), 157 m_playAction(0),
158 m_playSelectionAction(0), 158 m_playSelectionAction(0),
159 m_playLoopAction(0), 159 m_playLoopAction(0),
160 m_alAction(0),
160 m_playControlsSpacer(0), 161 m_playControlsSpacer(0),
161 m_playControlsWidth(0), 162 m_playControlsWidth(0),
162 m_preferencesDialog(0), 163 m_preferencesDialog(0),
163 m_layerTreeDialog(0), 164 m_layerTreeDialog(0),
164 m_activityLog(new ActivityLog()), 165 m_activityLog(new ActivityLog()),
165 m_keyReference(new KeyReference()), 166 m_keyReference(new KeyReference()),
166 m_templateWatcher(0) 167 m_templateWatcher(0),
168 m_fileMenu(0),
169 m_editMenu(0),
170 m_viewMenu(0),
171 m_helpMenu(0),
172 m_importAnnotationLayerAction(0),
173 m_exportAnnotationLayerAction(0),
174 m_showNoOverlaysAction(0),
175 m_showMinimalOverlaysAction(0),
176 m_showStandardOverlaysAction(0),
177 m_showAllOverlaysAction(0),
178 m_showAllTimeRulersAction(0),
179 m_showZoomWheelsAction(0),
180 m_showPropertyBoxesAction(0),
181 m_showStatusBarAction(0),
182 m_fileToolBar(0),
183 m_playbackToolBar(0),
184 m_viewToolBar(0),
185 m_playModeToolBar(0),
186 m_editToolBar(0),
187 m_toolsToolBar(0)
167 { 188 {
168 Profiler profiler("MainWindow::MainWindow"); 189 Profiler profiler("MainWindow::MainWindow");
169 190
170 setWindowTitle(tr("Sonic Visualiser (Kiosk edition)")); 191 setWindowTitle(tr("Sonic Visualiser (Kiosk edition)"));
171 192
193 214
194 QGridLayout *layout = new QGridLayout; 215 QGridLayout *layout = new QGridLayout;
195 216
196 m_descriptionLabel = new QLabel; //!!! hang on, this is declared in base class -- should be declared and initialised by same class 217 m_descriptionLabel = new QLabel; //!!! hang on, this is declared in base class -- should be declared and initialised by same class
197 218
198 QScrollArea *scroll = new QScrollArea(frame); 219 m_scroll = new QScrollArea(frame);
199 scroll->setWidgetResizable(true); 220 m_scroll->setWidgetResizable(true);
200 scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 221 m_scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
201 scroll->setFrameShape(QFrame::NoFrame); 222 m_scroll->setFrameShape(QFrame::NoFrame);
202 223 m_scroll->setWidget(m_paneStack);
203 scroll->setWidget(m_paneStack);
204 224
205 m_overview = new Overview(frame); 225 m_overview = new Overview(frame);
206 m_overview->setViewManager(m_viewManager); 226 m_overview->setViewManager(m_viewManager);
207 m_overview->setFixedHeight(40); 227 m_overview->setFixedHeight(40);
208 #ifndef _WIN32 228 #ifndef _WIN32
255 settings.endGroup(); 275 settings.endGroup();
256 276
257 m_playControlsSpacer = new QFrame; 277 m_playControlsSpacer = new QFrame;
258 278
259 layout->setSpacing(4); 279 layout->setSpacing(4);
260 layout->addWidget(scroll, 0, 0, 1, 5); 280 layout->addWidget(m_scroll, 0, 0, 1, 5);
261 layout->addWidget(m_overview, 1, 1); 281 layout->addWidget(m_overview, 1, 1);
262 layout->addWidget(m_playControlsSpacer, 1, 2); 282 layout->addWidget(m_playControlsSpacer, 1, 2);
263 layout->addWidget(m_playSpeed, 1, 3); 283 layout->addWidget(m_playSpeed, 1, 3);
264 layout->addWidget(m_fader, 1, 4); 284 layout->addWidget(m_fader, 1, 4);
265 285
374 void 394 void
375 MainWindow::setupFileMenu() 395 MainWindow::setupFileMenu()
376 { 396 {
377 if (m_mainMenusCreated) return; 397 if (m_mainMenusCreated) return;
378 398
379 QMenu *menu = menuBar()->addMenu(tr("&File")); 399 m_fileMenu = menuBar()->addMenu(tr("&File"));
380 menu->setTearOffEnabled(true); 400 m_fileMenu->setTearOffEnabled(true);
381 QToolBar *toolbar = addToolBar(tr("File Toolbar")); 401 m_fileToolBar = addToolBar(tr("File Toolbar"));
382 402
383 m_keyReference->setCategory(tr("File and Session Management")); 403 m_keyReference->setCategory(tr("File and Session Management"));
384 404
385 IconLoader il; 405 IconLoader il;
386 406
389 QAction *action = new QAction(icon, tr("&New Session"), this); 409 QAction *action = new QAction(icon, tr("&New Session"), this);
390 action->setShortcut(tr("Ctrl+N")); 410 action->setShortcut(tr("Ctrl+N"));
391 action->setStatusTip(tr("Abandon the current Sonic Visualiser session and start a new one")); 411 action->setStatusTip(tr("Abandon the current Sonic Visualiser session and start a new one"));
392 connect(action, SIGNAL(triggered()), this, SLOT(newSession())); 412 connect(action, SIGNAL(triggered()), this, SLOT(newSession()));
393 m_keyReference->registerShortcut(action); 413 m_keyReference->registerShortcut(action);
394 menu->addAction(action); 414 m_fileMenu->addAction(action);
395 toolbar->addAction(action); 415 m_fileToolBar->addAction(action);
396 /* 416 /*
397 icon = il.load("fileopensession"); 417 icon = il.load("fileopensession");
398 action = new QAction(icon, tr("&Open Session..."), this); 418 action = new QAction(icon, tr("&Open Session..."), this);
399 action->setShortcut(tr("Ctrl+O")); 419 action->setShortcut(tr("Ctrl+O"));
400 action->setStatusTip(tr("Open a previously saved Sonic Visualiser session file")); 420 action->setStatusTip(tr("Open a previously saved Sonic Visualiser session file"));
401 connect(action, SIGNAL(triggered()), this, SLOT(openSession())); 421 connect(action, SIGNAL(triggered()), this, SLOT(openSession()));
402 m_keyReference->registerShortcut(action); 422 m_keyReference->registerShortcut(action);
403 menu->addAction(action); 423 m_fileMenu->addAction(action);
404 */ 424 */
405 icon = il.load("fileopen"); 425 icon = il.load("fileopen");
406 icon.addPixmap(il.loadPixmap("fileopen-22")); 426 icon.addPixmap(il.loadPixmap("fileopen-22"));
407 action = new QAction(icon, tr("&Open..."), this); 427 action = new QAction(icon, tr("&Open..."), this);
408 action->setShortcut(tr("Ctrl+O")); 428 action->setShortcut(tr("Ctrl+O"));
409 action->setStatusTip(tr("Open a session file, audio file, or layer")); 429 action->setStatusTip(tr("Open a session file, audio file, or layer"));
410 connect(action, SIGNAL(triggered()), this, SLOT(openSomething())); 430 connect(action, SIGNAL(triggered()), this, SLOT(openSomething()));
411 toolbar->addAction(action); 431 m_fileToolBar->addAction(action);
412 menu->addAction(action); 432 m_fileMenu->addAction(action);
413 433
414 // We want this one to go on the toolbar now, if we add it at all, 434 // We want this one to go on the toolbar now, if we add it at all,
415 // but on the menu later 435 // but on the menu later
416 QAction *iaction = new QAction(tr("&Import More Audio..."), this); 436 QAction *iaction = new QAction(tr("&Import More Audio..."), this);
417 iaction->setShortcut(tr("Ctrl+I")); 437 iaction->setShortcut(tr("Ctrl+I"));
423 action = new QAction(tr("Open Lo&cation..."), this); 443 action = new QAction(tr("Open Lo&cation..."), this);
424 action->setShortcut(tr("Ctrl+Shift+O")); 444 action->setShortcut(tr("Ctrl+Shift+O"));
425 action->setStatusTip(tr("Open or import a file from a remote URL")); 445 action->setStatusTip(tr("Open or import a file from a remote URL"));
426 connect(action, SIGNAL(triggered()), this, SLOT(openLocation())); 446 connect(action, SIGNAL(triggered()), this, SLOT(openLocation()));
427 m_keyReference->registerShortcut(action); 447 m_keyReference->registerShortcut(action);
428 menu->addAction(action); 448 m_fileMenu->addAction(action);
429 449
430 m_recentFilesMenu = menu->addMenu(tr("Open &Recent")); 450 m_recentFilesMenu = menu->addMenu(tr("Open &Recent"));
431 m_recentFilesMenu->setTearOffEnabled(true); 451 m_recentFilesMenu->setTearOffEnabled(true);
432 setupRecentFilesMenu(); 452 setupRecentFilesMenu();
433 connect(&m_recentFiles, SIGNAL(recentChanged()), 453 connect(&m_recentFiles, SIGNAL(recentChanged()),
434 this, SLOT(setupRecentFilesMenu())); 454 this, SLOT(setupRecentFilesMenu()));
435 455
436 menu->addSeparator(); 456 m_fileMenu->addSeparator();
437 457
438 icon = il.load("filesave"); 458 icon = il.load("filesave");
439 icon.addPixmap(il.loadPixmap("filesave-22")); 459 icon.addPixmap(il.loadPixmap("filesave-22"));
440 action = new QAction(icon, tr("&Save Session"), this); 460 action = new QAction(icon, tr("&Save Session"), this);
441 action->setShortcut(tr("Ctrl+S")); 461 action->setShortcut(tr("Ctrl+S"));
442 action->setStatusTip(tr("Save the current session into a Sonic Visualiser session file")); 462 action->setStatusTip(tr("Save the current session into a Sonic Visualiser session file"));
443 connect(action, SIGNAL(triggered()), this, SLOT(saveSession())); 463 connect(action, SIGNAL(triggered()), this, SLOT(saveSession()));
444 connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool))); 464 connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool)));
445 m_keyReference->registerShortcut(action); 465 m_keyReference->registerShortcut(action);
446 menu->addAction(action); 466 m_fileMenu->addAction(action);
447 toolbar->addAction(action); 467 m_fileToolBar->addAction(action);
448 468
449 icon = il.load("filesaveas"); 469 icon = il.load("filesaveas");
450 icon.addPixmap(il.loadPixmap("filesaveas-22")); 470 icon.addPixmap(il.loadPixmap("filesaveas-22"));
451 action = new QAction(icon, tr("Save Session &As..."), this); 471 action = new QAction(icon, tr("Save Session &As..."), this);
452 action->setShortcut(tr("Ctrl+Shift+S")); 472 action->setShortcut(tr("Ctrl+Shift+S"));
453 action->setStatusTip(tr("Save the current session into a new Sonic Visualiser session file")); 473 action->setStatusTip(tr("Save the current session into a new Sonic Visualiser session file"));
454 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs())); 474 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs()));
455 menu->addAction(action); 475 m_fileMenu->addAction(action);
456 toolbar->addAction(action); 476 m_fileToolBar->addAction(action);
457 477
458 menu->addSeparator(); 478 m_fileMenu->addSeparator();
459 479
460 /* 480 /*
461 icon = il.load("fileopenaudio"); 481 icon = il.load("fileopenaudio");
462 action = new QAction(icon, tr("&Import Audio File..."), this); 482 action = new QAction(icon, tr("&Import Audio File..."), this);
463 action->setShortcut(tr("Ctrl+I")); 483 action->setShortcut(tr("Ctrl+I"));
464 action->setStatusTip(tr("Import an existing audio file")); 484 action->setStatusTip(tr("Import an existing audio file"));
465 connect(action, SIGNAL(triggered()), this, SLOT(importAudio())); 485 connect(action, SIGNAL(triggered()), this, SLOT(importAudio()));
466 m_keyReference->registerShortcut(action); 486 m_keyReference->registerShortcut(action);
467 menu->addAction(action); 487 m_fileMenu->addAction(action);
468 */ 488 */
469 489
470 // the Import action we made earlier 490 // the Import action we made earlier
471 menu->addAction(iaction); 491 m_fileMenu->addAction(iaction);
472 492
473 /* //removes the Export Audio File functionnality from the File menu 493 /* //removes the Export Audio File functionnality from the File menu
474 action = new QAction(tr("&Export Audio File..."), this); 494 action = new QAction(tr("&Export Audio File..."), this);
475 action->setStatusTip(tr("Export selection as an audio file")); 495 action->setStatusTip(tr("Export selection as an audio file"));
476 connect(action, SIGNAL(triggered()), this, SLOT(exportAudio())); 496 connect(action, SIGNAL(triggered()), this, SLOT(exportAudio()));
477 connect(this, SIGNAL(canExportAudio(bool)), action, SLOT(setEnabled(bool))); 497 connect(this, SIGNAL(canExportAudio(bool)), action, SLOT(setEnabled(bool)));
478 menu->addAction(action); 498 m_fileMenu->addAction(action);
479 499
480 menu->addSeparator(); 500 m_fileMenu->addSeparator();
481 */ 501 */
482 502
483 action = new QAction(tr("Import Annotation &Layer..."), this); 503 m_importAnnotationLayerAction = new QAction(tr("Import Annotation &Layer..."), this);
484 action->setShortcut(tr("Ctrl+L")); 504 m_importAnnotationLayerAction->setShortcut(tr("Ctrl+L"));
485 action->setStatusTip(tr("Import layer data from an existing file")); 505 m_importAnnotationLayerAction->setStatusTip(tr("Import layer data from an existing file"));
486 connect(action, SIGNAL(triggered()), this, SLOT(importLayer())); 506 connect(m_importAnnotationLayerAction, SIGNAL(triggered()), this, SLOT(importLayer()));
487 connect(this, SIGNAL(canImportLayer(bool)), action, SLOT(setEnabled(bool))); 507 connect(this, SIGNAL(canImportLayer(bool)), action, SLOT(setEnabled(bool)));
488 m_keyReference->registerShortcut(action); 508 m_keyReference->registerShortcut(m_importAnnotationLayerAction);
489 menu->addAction(action); 509 m_fileMenu->addAction(m_importAnnotationLayerAction);
490 510
491 action = new QAction(tr("Export Annotation Layer..."), this); 511 m_exportAnnotationLayerAction = new QAction(tr("Export Annotation Layer..."), this);
492 action->setStatusTip(tr("Export layer data to a file")); 512 m_exportAnnotationLayerAction->setStatusTip(tr("Export layer data to a file"));
493 connect(action, SIGNAL(triggered()), this, SLOT(exportLayer())); 513 connect(m_exportAnnotationLayerAction, SIGNAL(triggered()), this, SLOT(exportLayer()));
494 connect(this, SIGNAL(canExportLayer(bool)), action, SLOT(setEnabled(bool))); 514 connect(this, SIGNAL(canExportLayer(bool)), action, SLOT(setEnabled(bool)));
495 menu->addAction(action); 515 m_fileMenu->addAction(m_exportAnnotationLayerAction);
496 516
497 menu->addSeparator(); 517 m_fileMenu->addSeparator();
498 518
499 action = new QAction(tr("Export Image File..."), this); 519 action = new QAction(tr("Export Image File..."), this);
500 action->setStatusTip(tr("Export a single pane to an image file")); 520 action->setStatusTip(tr("Export a single pane to an image file"));
501 connect(action, SIGNAL(triggered()), this, SLOT(exportImage())); 521 connect(action, SIGNAL(triggered()), this, SLOT(exportImage()));
502 connect(this, SIGNAL(canExportImage(bool)), action, SLOT(setEnabled(bool))); 522 connect(this, SIGNAL(canExportImage(bool)), action, SLOT(setEnabled(bool)));
503 menu->addAction(action); 523 m_fileMenu->addAction(action);
504 524
505 menu->addSeparator(); 525 m_fileMenu->addSeparator();
506 526
507 QString templatesMenuLabel = tr("Apply Session Template"); 527 QString templatesMenuLabel = tr("Apply Session Template");
508 m_templatesMenu = menu->addMenu(templatesMenuLabel); 528 m_templatesMenu = m_fileMenu->addMenu(templatesMenuLabel);
509 m_templatesMenu->setTearOffEnabled(true); 529 m_templatesMenu->setTearOffEnabled(true);
510 // We need to have a main model for this option to be useful: 530 // We need to have a main model for this option to be useful:
511 // canExportAudio captures that 531 // canExportAudio captures that
512 connect(this, SIGNAL(canExportAudio(bool)), m_templatesMenu, SLOT(setEnabled(bool))); 532 connect(this, SIGNAL(canExportAudio(bool)), m_templatesMenu, SLOT(setEnabled(bool)));
513 533
516 action = new QAction(tr("Export Session as Template..."), this); 536 action = new QAction(tr("Export Session as Template..."), this);
517 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAsTemplate())); 537 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAsTemplate()));
518 // We need to have something in the session for this to be useful: 538 // We need to have something in the session for this to be useful:
519 // canDeleteCurrentLayer captures that 539 // canDeleteCurrentLayer captures that
520 connect(this, SIGNAL(canExportAudio(bool)), action, SLOT(setEnabled(bool))); 540 connect(this, SIGNAL(canExportAudio(bool)), action, SLOT(setEnabled(bool)));
521 menu->addAction(action); 541 m_fileMenu->addAction(action);
522 542
523 m_manageTemplatesAction = new QAction(tr("Manage Exported Templates"), this); 543 m_manageTemplatesAction = new QAction(tr("Manage Exported Templates"), this);
524 connect(m_manageTemplatesAction, SIGNAL(triggered()), this, SLOT(manageSavedTemplates())); 544 connect(m_manageTemplatesAction, SIGNAL(triggered()), this, SLOT(manageSavedTemplates()));
525 menu->addAction(m_manageTemplatesAction); 545 m_fileMenu->addAction(m_manageTemplatesAction);
526 546
527 setupTemplatesMenu(); 547 setupTemplatesMenu();
528 548
529 action = new QAction(tr("&Preferences..."), this); 549 action = new QAction(tr("&Preferences..."), this);
530 action->setStatusTip(tr("Adjust the application preferences")); 550 action->setStatusTip(tr("Adjust the application preferences"));
531 connect(action, SIGNAL(triggered()), this, SLOT(preferences())); 551 connect(action, SIGNAL(triggered()), this, SLOT(preferences()));
532 menu->addAction(action); 552 m_fileMenu->addAction(action);
533 553
534 menu->addSeparator(); 554 m_fileMenu->addSeparator();
535 action = new QAction(il.load("exit"), 555 action = new QAction(il.load("exit"),
536 tr("&Quit"), this); 556 tr("&Quit"), this);
537 action->setShortcut(tr("Ctrl+Q")); 557 action->setShortcut(tr("Ctrl+Q"));
538 action->setStatusTip(tr("Exit Sonic Visualiser")); 558 action->setStatusTip(tr("Exit Sonic Visualiser"));
539 connect(action, SIGNAL(triggered()), this, SLOT(close())); 559 connect(action, SIGNAL(triggered()), this, SLOT(close()));
540 m_keyReference->registerShortcut(action); 560 m_keyReference->registerShortcut(action);
541 menu->addAction(action); 561 m_fileMenu->addAction(action);
542 } 562 }
543 563
544 void 564 void
545 MainWindow::setupEditMenu() 565 MainWindow::setupEditMenu()
546 { 566 {
547 if (m_mainMenusCreated) return; 567 if (m_mainMenusCreated) return;
548 568
549 QMenu *menu = menuBar()->addMenu(tr("&Edit")); 569 m_editMenu = menuBar()->addMenu(tr("&Edit"));
550 menu->setTearOffEnabled(true); 570 m_editMenu->setTearOffEnabled(true);
551 CommandHistory::getInstance()->registerMenu(menu); 571 CommandHistory::getInstance()->registerMenu(m_editMenu);
552 572
553 m_keyReference->setCategory(tr("Editing")); 573 m_keyReference->setCategory(tr("Editing"));
554 574
555 menu->addSeparator(); 575 m_editMenu->addSeparator();
556 576
557 IconLoader il; 577 IconLoader il;
558 578
559 QAction *action = new QAction(il.load("editcut"), 579 QAction *action = new QAction(il.load("editcut"),
560 tr("Cu&t"), this); 580 tr("Cu&t"), this);
561 action->setShortcut(tr("Ctrl+X")); 581 action->setShortcut(tr("Ctrl+X"));
562 action->setStatusTip(tr("Cut the selection from the current layer to the clipboard")); 582 action->setStatusTip(tr("Cut the selection from the current layer to the clipboard"));
563 connect(action, SIGNAL(triggered()), this, SLOT(cut())); 583 connect(action, SIGNAL(triggered()), this, SLOT(cut()));
564 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool))); 584 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool)));
565 m_keyReference->registerShortcut(action); 585 m_keyReference->registerShortcut(action);
566 menu->addAction(action); 586 m_editMenu->addAction(action);
567 m_rightButtonMenu->addAction(action); 587 m_rightButtonMenu->addAction(action);
568 588
569 action = new QAction(il.load("editcopy"), 589 action = new QAction(il.load("editcopy"),
570 tr("&Copy"), this); 590 tr("&Copy"), this);
571 action->setShortcut(tr("Ctrl+C")); 591 action->setShortcut(tr("Ctrl+C"));
572 action->setStatusTip(tr("Copy the selection from the current layer to the clipboard")); 592 action->setStatusTip(tr("Copy the selection from the current layer to the clipboard"));
573 connect(action, SIGNAL(triggered()), this, SLOT(copy())); 593 connect(action, SIGNAL(triggered()), this, SLOT(copy()));
574 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool))); 594 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool)));
575 m_keyReference->registerShortcut(action); 595 m_keyReference->registerShortcut(action);
576 menu->addAction(action); 596 m_editMenu->addAction(action);
577 m_rightButtonMenu->addAction(action); 597 m_rightButtonMenu->addAction(action);
578 598
579 action = new QAction(il.load("editpaste"), 599 action = new QAction(il.load("editpaste"),
580 tr("&Paste"), this); 600 tr("&Paste"), this);
581 action->setShortcut(tr("Ctrl+V")); 601 action->setShortcut(tr("Ctrl+V"));
582 action->setStatusTip(tr("Paste from the clipboard to the current layer")); 602 action->setStatusTip(tr("Paste from the clipboard to the current layer"));
583 connect(action, SIGNAL(triggered()), this, SLOT(paste())); 603 connect(action, SIGNAL(triggered()), this, SLOT(paste()));
584 connect(this, SIGNAL(canPaste(bool)), action, SLOT(setEnabled(bool))); 604 connect(this, SIGNAL(canPaste(bool)), action, SLOT(setEnabled(bool)));
585 m_keyReference->registerShortcut(action); 605 m_keyReference->registerShortcut(action);
586 menu->addAction(action); 606 m_editMenu->addAction(action);
587 m_rightButtonMenu->addAction(action); 607 m_rightButtonMenu->addAction(action);
588 608
589 action = new QAction(tr("Paste at Playback Position"), this); 609 action = new QAction(tr("Paste at Playback Position"), this);
590 action->setShortcut(tr("Ctrl+Shift+V")); 610 action->setShortcut(tr("Ctrl+Shift+V"));
591 action->setStatusTip(tr("Paste from the clipboard to the current layer, placing the first item at the playback position")); 611 action->setStatusTip(tr("Paste from the clipboard to the current layer, placing the first item at the playback position"));
592 connect(action, SIGNAL(triggered()), this, SLOT(pasteAtPlaybackPosition())); 612 connect(action, SIGNAL(triggered()), this, SLOT(pasteAtPlaybackPosition()));
593 connect(this, SIGNAL(canPaste(bool)), action, SLOT(setEnabled(bool))); 613 connect(this, SIGNAL(canPaste(bool)), action, SLOT(setEnabled(bool)));
594 m_keyReference->registerShortcut(action); 614 m_keyReference->registerShortcut(action);
595 menu->addAction(action); 615 m_editMenu->addAction(action);
596 m_rightButtonMenu->addAction(action); 616 m_rightButtonMenu->addAction(action);
597 617
598 m_deleteSelectedAction = new QAction(tr("&Delete Selected Items"), this); 618 m_deleteSelectedAction = new QAction(tr("&Delete Selected Items"), this);
599 m_deleteSelectedAction->setShortcut(tr("Del")); 619 m_deleteSelectedAction->setShortcut(tr("Del"));
600 m_deleteSelectedAction->setStatusTip(tr("Delete items in current selection from the current layer")); 620 m_deleteSelectedAction->setStatusTip(tr("Delete items in current selection from the current layer"));
601 connect(m_deleteSelectedAction, SIGNAL(triggered()), this, SLOT(deleteSelected())); 621 connect(m_deleteSelectedAction, SIGNAL(triggered()), this, SLOT(deleteSelected()));
602 connect(this, SIGNAL(canDeleteSelection(bool)), m_deleteSelectedAction, SLOT(setEnabled(bool))); 622 connect(this, SIGNAL(canDeleteSelection(bool)), m_deleteSelectedAction, SLOT(setEnabled(bool)));
603 m_keyReference->registerShortcut(m_deleteSelectedAction); 623 m_keyReference->registerShortcut(m_deleteSelectedAction);
604 menu->addAction(m_deleteSelectedAction); 624 m_editMenu->addAction(m_deleteSelectedAction);
605 m_rightButtonMenu->addAction(m_deleteSelectedAction); 625 m_rightButtonMenu->addAction(m_deleteSelectedAction);
606 626
607 menu->addSeparator(); 627 m_editMenu->addSeparator();
608 m_rightButtonMenu->addSeparator(); 628 m_rightButtonMenu->addSeparator();
609 629
610 m_keyReference->setCategory(tr("Selection")); 630 m_keyReference->setCategory(tr("Selection"));
611 631
612 action = new QAction(tr("Select &All"), this); 632 action = new QAction(tr("Select &All"), this);
613 action->setShortcut(tr("Ctrl+A")); 633 action->setShortcut(tr("Ctrl+A"));
614 action->setStatusTip(tr("Select the whole duration of the current session")); 634 action->setStatusTip(tr("Select the whole duration of the current session"));
615 connect(action, SIGNAL(triggered()), this, SLOT(selectAll())); 635 connect(action, SIGNAL(triggered()), this, SLOT(selectAll()));
616 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool))); 636 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool)));
617 m_keyReference->registerShortcut(action); 637 m_keyReference->registerShortcut(action);
618 menu->addAction(action); 638 m_editMenu->addAction(action);
619 m_rightButtonMenu->addAction(action); 639 m_rightButtonMenu->addAction(action);
620 640
621 action = new QAction(tr("Select &Visible Range"), this); 641 action = new QAction(tr("Select &Visible Range"), this);
622 action->setShortcut(tr("Ctrl+Shift+A")); 642 action->setShortcut(tr("Ctrl+Shift+A"));
623 action->setStatusTip(tr("Select the time range corresponding to the current window width")); 643 action->setStatusTip(tr("Select the time range corresponding to the current window width"));
624 connect(action, SIGNAL(triggered()), this, SLOT(selectVisible())); 644 connect(action, SIGNAL(triggered()), this, SLOT(selectVisible()));
625 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool))); 645 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool)));
626 m_keyReference->registerShortcut(action); 646 m_keyReference->registerShortcut(action);
627 menu->addAction(action); 647 m_editMenu->addAction(action);
628 648
629 action = new QAction(tr("Select to &Start"), this); 649 action = new QAction(tr("Select to &Start"), this);
630 action->setShortcut(tr("Shift+Left")); 650 action->setShortcut(tr("Shift+Left"));
631 action->setStatusTip(tr("Select from the start of the session to the current playback position")); 651 action->setStatusTip(tr("Select from the start of the session to the current playback position"));
632 connect(action, SIGNAL(triggered()), this, SLOT(selectToStart())); 652 connect(action, SIGNAL(triggered()), this, SLOT(selectToStart()));
633 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool))); 653 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool)));
634 m_keyReference->registerShortcut(action); 654 m_keyReference->registerShortcut(action);
635 menu->addAction(action); 655 m_editMenu->addAction(action);
636 656
637 action = new QAction(tr("Select to &End"), this); 657 action = new QAction(tr("Select to &End"), this);
638 action->setShortcut(tr("Shift+Right")); 658 action->setShortcut(tr("Shift+Right"));
639 action->setStatusTip(tr("Select from the current playback position to the end of the session")); 659 action->setStatusTip(tr("Select from the current playback position to the end of the session"));
640 connect(action, SIGNAL(triggered()), this, SLOT(selectToEnd())); 660 connect(action, SIGNAL(triggered()), this, SLOT(selectToEnd()));
641 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool))); 661 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool)));
642 m_keyReference->registerShortcut(action); 662 m_keyReference->registerShortcut(action);
643 menu->addAction(action); 663 m_editMenu->addAction(action);
644 664
645 action = new QAction(tr("C&lear Selection"), this); 665 action = new QAction(tr("C&lear Selection"), this);
646 action->setShortcut(tr("Esc")); 666 action->setShortcut(tr("Esc"));
647 action->setStatusTip(tr("Clear the selection")); 667 action->setStatusTip(tr("Clear the selection"));
648 connect(action, SIGNAL(triggered()), this, SLOT(clearSelection())); 668 connect(action, SIGNAL(triggered()), this, SLOT(clearSelection()));
649 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); 669 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
650 m_keyReference->registerShortcut(action); 670 m_keyReference->registerShortcut(action);
651 menu->addAction(action); 671 m_editMenu->addAction(action);
652 m_rightButtonMenu->addAction(action); 672 m_rightButtonMenu->addAction(action);
653 673
654 menu->addSeparator(); 674 m_editMenu->addSeparator();
655 675
656 m_keyReference->setCategory(tr("Tapping Time Instants")); 676 m_keyReference->setCategory(tr("Tapping Time Instants"));
657 677
658 action = new QAction(tr("&Insert Instant at Playback Position"), this); 678 action = new QAction(tr("&Insert Instant at Playback Position"), this);
659 action->setShortcut(tr("Enter")); 679 action->setShortcut(tr("Enter"));
660 action->setStatusTip(tr("Insert a new time instant at the current playback position, in a new layer if necessary")); 680 action->setStatusTip(tr("Insert a new time instant at the current playback position, in a new layer if necessary"));
661 connect(action, SIGNAL(triggered()), this, SLOT(insertInstant())); 681 connect(action, SIGNAL(triggered()), this, SLOT(insertInstant()));
662 connect(this, SIGNAL(canInsertInstant(bool)), action, SLOT(setEnabled(bool))); 682 connect(this, SIGNAL(canInsertInstant(bool)), action, SLOT(setEnabled(bool)));
663 m_keyReference->registerShortcut(action); 683 m_keyReference->registerShortcut(action);
664 menu->addAction(action); 684 m_editMenu->addAction(action);
665 685
666 // Laptop shortcut (no keypad Enter key) 686 // Laptop shortcut (no keypad Enter key)
667 QString shortcut(tr(";")); 687 QString shortcut(tr(";"));
668 connect(new QShortcut(shortcut, this), SIGNAL(activated()), 688 connect(new QShortcut(shortcut, this), SIGNAL(activated()),
669 this, SLOT(insertInstant())); 689 this, SLOT(insertInstant()));
673 action->setShortcut(tr("Shift+Enter")); 693 action->setShortcut(tr("Shift+Enter"));
674 action->setStatusTip(tr("Insert new time instants at the start and end of the current selected regions, in a new layer if necessary")); 694 action->setStatusTip(tr("Insert new time instants at the start and end of the current selected regions, in a new layer if necessary"));
675 connect(action, SIGNAL(triggered()), this, SLOT(insertInstantsAtBoundaries())); 695 connect(action, SIGNAL(triggered()), this, SLOT(insertInstantsAtBoundaries()));
676 connect(this, SIGNAL(canInsertInstantsAtBoundaries(bool)), action, SLOT(setEnabled(bool))); 696 connect(this, SIGNAL(canInsertInstantsAtBoundaries(bool)), action, SLOT(setEnabled(bool)));
677 m_keyReference->registerShortcut(action); 697 m_keyReference->registerShortcut(action);
678 menu->addAction(action); 698 m_editMenu->addAction(action);
679 699
680 action = new QAction(tr("Insert Item at Selection"), this); 700 action = new QAction(tr("Insert Item at Selection"), this);
681 action->setShortcut(tr("Ctrl+Shift+Enter")); 701 action->setShortcut(tr("Ctrl+Shift+Enter"));
682 action->setStatusTip(tr("Insert a new note or region item corresponding to the current selection")); 702 action->setStatusTip(tr("Insert a new note or region item corresponding to the current selection"));
683 connect(action, SIGNAL(triggered()), this, SLOT(insertItemAtSelection())); 703 connect(action, SIGNAL(triggered()), this, SLOT(insertItemAtSelection()));
684 connect(this, SIGNAL(canInsertItemAtSelection(bool)), action, SLOT(setEnabled(bool))); 704 connect(this, SIGNAL(canInsertItemAtSelection(bool)), action, SLOT(setEnabled(bool)));
685 m_keyReference->registerShortcut(action); 705 m_keyReference->registerShortcut(action);
686 menu->addAction(action); 706 m_editMenu->addAction(action);
687 707
688 menu->addSeparator(); 708 m_editMenu->addSeparator();
689 709
690 QMenu *numberingMenu = menu->addMenu(tr("Number New Instants with")); 710 QMenu *numberingMenu = m_editMenu->addMenu(tr("Number New Instants with"));
691 numberingMenu->setTearOffEnabled(true); 711 numberingMenu->setTearOffEnabled(true);
692 QActionGroup *numberingGroup = new QActionGroup(this); 712 QActionGroup *numberingGroup = new QActionGroup(this);
693 713
694 Labeller::TypeNameMap types = m_labeller->getTypeNames(); 714 Labeller::TypeNameMap types = m_labeller->getTypeNames();
695 for (Labeller::TypeNameMap::iterator i = types.begin(); i != types.end(); ++i) { 715 for (Labeller::TypeNameMap::iterator i = types.begin(); i != types.end(); ++i) {
729 } 749 }
730 750
731 action = new QAction(tr("Set Numbering Counters..."), this); 751 action = new QAction(tr("Set Numbering Counters..."), this);
732 action->setStatusTip(tr("Set the counters used for counter-based labelling")); 752 action->setStatusTip(tr("Set the counters used for counter-based labelling"));
733 connect(action, SIGNAL(triggered()), this, SLOT(resetInstantsCounters())); 753 connect(action, SIGNAL(triggered()), this, SLOT(resetInstantsCounters()));
734 menu->addAction(action); 754 m_editMenu->addAction(action);
735 755
736 action = new QAction(tr("Renumber Selected Instants"), this); 756 action = new QAction(tr("Renumber Selected Instants"), this);
737 action->setStatusTip(tr("Renumber the selected instants using the current labelling scheme")); 757 action->setStatusTip(tr("Renumber the selected instants using the current labelling scheme"));
738 connect(action, SIGNAL(triggered()), this, SLOT(renumberInstants())); 758 connect(action, SIGNAL(triggered()), this, SLOT(renumberInstants()));
739 connect(this, SIGNAL(canRenumberInstants(bool)), action, SLOT(setEnabled(bool))); 759 connect(this, SIGNAL(canRenumberInstants(bool)), action, SLOT(setEnabled(bool)));
740 // m_keyReference->registerShortcut(action); 760 // m_keyReference->registerShortcut(action);
741 menu->addAction(action); 761 m_editMenu->addAction(action);
742 } 762 }
743 763
744 void 764 void
745 MainWindow::setupViewMenu() 765 MainWindow::setupViewMenu()
746 { 766 {
748 768
749 IconLoader il; 769 IconLoader il;
750 770
751 QAction *action = 0; 771 QAction *action = 0;
752 772
773 m_viewMenu = menuBar()->addMenu(tr("&View"));
774 m_viewMenu->setTearOffEnabled(true);
775
776 m_viewToolBar = addToolBar(tr("View Toolbar"));
777
778 m_keyReference->setCategory(tr("Display Features"));
779
780 QIcon icon = il.load("toggle16");
781 icon.addPixmap(il.loadPixmap("toggle22"));
782 action = new QAction(icon,tr("Minimal Mode"), this);
783 action->setShortcut(tr("C"));
784 action->setStatusTip(tr("Switch between minimal and full view modes"));
785 connect(action, SIGNAL(triggered()), this, SLOT(toggleViewMode()));
786 action->setCheckable(true);
787
788 QSettings settings;
789 settings.beginGroup("Preferences");
790 bool mini = settings.value("start-in-mini-mode",true).toBool();
791 action->setChecked(mini);
792 settings.endGroup();
793
794 m_keyReference->registerShortcut(action);
795 m_viewMenu->addAction(action);
796 m_viewToolBar->addAction(action);
797
798 m_viewMenu->addSeparator();
799
753 m_keyReference->setCategory(tr("Panning and Navigation")); 800 m_keyReference->setCategory(tr("Panning and Navigation"));
754 801
755 QMenu *menu = menuBar()->addMenu(tr("&View"));
756 menu->setTearOffEnabled(true);
757 action = new QAction(tr("Scroll &Left"), this); 802 action = new QAction(tr("Scroll &Left"), this);
758 action->setShortcut(tr("Left")); 803 action->setShortcut(tr("Left"));
759 action->setStatusTip(tr("Scroll the current pane to the left")); 804 action->setStatusTip(tr("Scroll the current pane to the left"));
760 connect(action, SIGNAL(triggered()), this, SLOT(scrollLeft())); 805 connect(action, SIGNAL(triggered()), this, SLOT(scrollLeft()));
761 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); 806 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
762 m_keyReference->registerShortcut(action); 807 m_keyReference->registerShortcut(action);
763 menu->addAction(action); 808 m_viewMenu->addAction(action);
764 809
765 action = new QAction(tr("Scroll &Right"), this); 810 action = new QAction(tr("Scroll &Right"), this);
766 action->setShortcut(tr("Right")); 811 action->setShortcut(tr("Right"));
767 action->setStatusTip(tr("Scroll the current pane to the right")); 812 action->setStatusTip(tr("Scroll the current pane to the right"));
768 connect(action, SIGNAL(triggered()), this, SLOT(scrollRight())); 813 connect(action, SIGNAL(triggered()), this, SLOT(scrollRight()));
769 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); 814 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
770 m_keyReference->registerShortcut(action); 815 m_keyReference->registerShortcut(action);
771 menu->addAction(action); 816 m_viewMenu->addAction(action);
772 817
773 action = new QAction(tr("&Jump Left"), this); 818 action = new QAction(tr("&Jump Left"), this);
774 action->setShortcut(tr("Ctrl+Left")); 819 action->setShortcut(tr("Ctrl+Left"));
775 action->setStatusTip(tr("Scroll the current pane a big step to the left")); 820 action->setStatusTip(tr("Scroll the current pane a big step to the left"));
776 connect(action, SIGNAL(triggered()), this, SLOT(jumpLeft())); 821 connect(action, SIGNAL(triggered()), this, SLOT(jumpLeft()));
777 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); 822 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
778 m_keyReference->registerShortcut(action); 823 m_keyReference->registerShortcut(action);
779 menu->addAction(action); 824 m_viewMenu->addAction(action);
780 825
781 action = new QAction(tr("J&ump Right"), this); 826 action = new QAction(tr("J&ump Right"), this);
782 action->setShortcut(tr("Ctrl+Right")); 827 action->setShortcut(tr("Ctrl+Right"));
783 action->setStatusTip(tr("Scroll the current pane a big step to the right")); 828 action->setStatusTip(tr("Scroll the current pane a big step to the right"));
784 connect(action, SIGNAL(triggered()), this, SLOT(jumpRight())); 829 connect(action, SIGNAL(triggered()), this, SLOT(jumpRight()));
785 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); 830 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
786 m_keyReference->registerShortcut(action); 831 m_keyReference->registerShortcut(action);
787 menu->addAction(action); 832 m_viewMenu->addAction(action);
788 833
789 action = new QAction(tr("Peek Left"), this); 834 action = new QAction(tr("Peek Left"), this);
790 action->setShortcut(tr("Alt+Left")); 835 action->setShortcut(tr("Alt+Left"));
791 action->setStatusTip(tr("Scroll the current pane to the left without moving the playback cursor or other panes")); 836 action->setStatusTip(tr("Scroll the current pane to the left without moving the playback cursor or other panes"));
792 connect(action, SIGNAL(triggered()), this, SLOT(peekLeft())); 837 connect(action, SIGNAL(triggered()), this, SLOT(peekLeft()));
793 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); 838 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
794 m_keyReference->registerShortcut(action); 839 m_keyReference->registerShortcut(action);
795 menu->addAction(action); 840 m_viewMenu->addAction(action);
796 841
797 action = new QAction(tr("Peek Right"), this); 842 action = new QAction(tr("Peek Right"), this);
798 action->setShortcut(tr("Alt+Right")); 843 action->setShortcut(tr("Alt+Right"));
799 action->setStatusTip(tr("Scroll the current pane to the right without moving the playback cursor or other panes")); 844 action->setStatusTip(tr("Scroll the current pane to the right without moving the playback cursor or other panes"));
800 connect(action, SIGNAL(triggered()), this, SLOT(peekRight())); 845 connect(action, SIGNAL(triggered()), this, SLOT(peekRight()));
801 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); 846 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
802 m_keyReference->registerShortcut(action); 847 m_keyReference->registerShortcut(action);
803 menu->addAction(action); 848 m_viewMenu->addAction(action);
804 849
805 menu->addSeparator(); 850 m_viewMenu->addSeparator();
806 851
807 m_keyReference->setCategory(tr("Zoom")); 852 m_keyReference->setCategory(tr("Zoom"));
808 853
809 action = new QAction(il.load("zoom-in"), 854 action = new QAction(il.load("zoom-in"),
810 tr("Zoom &In"), this); 855 tr("Zoom &In"), this);
811 action->setShortcut(tr("Up")); 856 action->setShortcut(tr("Up"));
812 action->setStatusTip(tr("Increase the zoom level")); 857 action->setStatusTip(tr("Increase the zoom level"));
813 connect(action, SIGNAL(triggered()), this, SLOT(zoomIn())); 858 connect(action, SIGNAL(triggered()), this, SLOT(zoomIn()));
814 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); 859 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
815 m_keyReference->registerShortcut(action); 860 m_keyReference->registerShortcut(action);
816 menu->addAction(action); 861 m_viewMenu->addAction(action);
817 862
818 action = new QAction(il.load("zoom-out"), 863 action = new QAction(il.load("zoom-out"),
819 tr("Zoom &Out"), this); 864 tr("Zoom &Out"), this);
820 action->setShortcut(tr("Down")); 865 action->setShortcut(tr("Down"));
821 action->setStatusTip(tr("Decrease the zoom level")); 866 action->setStatusTip(tr("Decrease the zoom level"));
822 connect(action, SIGNAL(triggered()), this, SLOT(zoomOut())); 867 connect(action, SIGNAL(triggered()), this, SLOT(zoomOut()));
823 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); 868 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
824 m_keyReference->registerShortcut(action); 869 m_keyReference->registerShortcut(action);
825 menu->addAction(action); 870 m_viewMenu->addAction(action);
826 871
827 action = new QAction(tr("Restore &Default Zoom"), this); 872 action = new QAction(tr("Restore &Default Zoom"), this);
828 action->setStatusTip(tr("Restore the zoom level to the default")); 873 action->setStatusTip(tr("Restore the zoom level to the default"));
829 connect(action, SIGNAL(triggered()), this, SLOT(zoomDefault())); 874 connect(action, SIGNAL(triggered()), this, SLOT(zoomDefault()));
830 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); 875 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
831 menu->addAction(action); 876 m_viewMenu->addAction(action);
832 877
833 action = new QAction(il.load("zoom-fit"), 878 action = new QAction(il.load("zoom-fit"),
834 tr("Zoom to &Fit"), this); 879 tr("Zoom to &Fit"), this);
835 action->setShortcut(tr("F")); 880 action->setShortcut(tr("F"));
836 action->setStatusTip(tr("Zoom to show the whole file")); 881 action->setStatusTip(tr("Zoom to show the whole file"));
837 connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit())); 882 connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit()));
838 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); 883 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
839 m_keyReference->registerShortcut(action); 884 m_keyReference->registerShortcut(action);
840 menu->addAction(action); 885 m_viewMenu->addAction(action);
841 886
842 menu->addSeparator(); 887 m_viewMenu->addSeparator();
843 888
844 m_keyReference->setCategory(tr("Display Features")); 889 m_keyReference->setCategory(tr("Display Features"));
845 890
846 QActionGroup *overlayGroup = new QActionGroup(this); 891 QActionGroup *overlayGroup = new QActionGroup(this);
847 892
848 action = new QAction(tr("Show &No Overlays"), this); 893 m_showNoOverlaysAction = new QAction(tr("Show &No Overlays"), this);
849 action->setShortcut(tr("0")); 894 m_showNoOverlaysAction->setShortcut(tr("0"));
850 action->setStatusTip(tr("Hide centre indicator, frame times, layer names and scale")); 895 m_showNoOverlaysAction->setStatusTip(tr("Hide centre indicator, frame times, layer names and scale"));
851 connect(action, SIGNAL(triggered()), this, SLOT(showNoOverlays())); 896 connect(m_showNoOverlaysAction, SIGNAL(triggered()), this, SLOT(showNoOverlays()));
852 action->setCheckable(true); 897 m_showNoOverlaysAction->setCheckable(true);
853 action->setChecked(false); 898 m_showNoOverlaysAction->setChecked(false);
854 overlayGroup->addAction(action); 899 overlayGroup->addAction(m_showNoOverlaysAction);
855 m_keyReference->registerShortcut(action); 900 m_keyReference->registerShortcut(m_showNoOverlaysAction);
856 menu->addAction(action); 901 m_viewMenu->addAction(m_showNoOverlaysAction);
857 902
858 action = new QAction(tr("Show &Minimal Overlays"), this); 903 m_showMinimalOverlaysAction = new QAction(tr("Show &Minimal Overlays"), this);
859 action->setShortcut(tr("9")); 904 m_showMinimalOverlaysAction->setShortcut(tr("9"));
860 action->setStatusTip(tr("Show centre indicator only")); 905 m_showMinimalOverlaysAction->setStatusTip(tr("Show centre indicator only"));
861 connect(action, SIGNAL(triggered()), this, SLOT(showMinimalOverlays())); 906 connect(m_showMinimalOverlaysAction, SIGNAL(triggered()), this, SLOT(showMinimalOverlays()));
862 action->setCheckable(true); 907 m_showMinimalOverlaysAction->setCheckable(true);
863 action->setChecked(false); 908 m_showMinimalOverlaysAction->setChecked(false);
864 overlayGroup->addAction(action); 909 overlayGroup->addAction(m_showMinimalOverlaysAction);
865 m_keyReference->registerShortcut(action); 910 m_keyReference->registerShortcut(m_showMinimalOverlaysAction);
866 menu->addAction(action); 911 m_viewMenu->addAction(m_showMinimalOverlaysAction);
867 912
868 action = new QAction(tr("Show &Standard Overlays"), this); 913 m_showStandardOverlaysAction = new QAction(tr("Show &Standard Overlays"), this);
869 action->setShortcut(tr("8")); 914 m_showStandardOverlaysAction->setShortcut(tr("8"));
870 action->setStatusTip(tr("Show centre indicator, frame times and scale")); 915 m_showStandardOverlaysAction->setStatusTip(tr("Show centre indicator, frame times and scale"));
871 connect(action, SIGNAL(triggered()), this, SLOT(showStandardOverlays())); 916 connect(m_showStandardOverlaysAction, SIGNAL(triggered()), this, SLOT(showStandardOverlays()));
872 action->setCheckable(true); 917 m_showStandardOverlaysAction->setCheckable(true);
873 action->setChecked(true); 918 m_showStandardOverlaysAction->setChecked(true);
874 overlayGroup->addAction(action); 919 overlayGroup->addAction(m_showStandardOverlaysAction);
875 m_keyReference->registerShortcut(action); 920 m_keyReference->registerShortcut(m_showStandardOverlaysAction);
876 menu->addAction(action); 921 m_viewMenu->addAction(m_showStandardOverlaysAction);
877 922
878 action = new QAction(tr("Show &All Overlays"), this); 923 m_showAllOverlaysAction = new QAction(tr("Show &All Overlays"), this);
879 action->setShortcut(tr("7")); 924 m_showAllOverlaysAction->setShortcut(tr("7"));
880 action->setStatusTip(tr("Show all texts and scale")); 925 m_showAllOverlaysAction->setStatusTip(tr("Show all texts and scale"));
881 connect(action, SIGNAL(triggered()), this, SLOT(showAllOverlays())); 926 connect(m_showAllOverlaysAction, SIGNAL(triggered()), this, SLOT(showAllOverlays()));
882 action->setCheckable(true); 927 m_showAllOverlaysAction->setCheckable(true);
883 action->setChecked(false); 928 m_showAllOverlaysAction->setChecked(false);
884 overlayGroup->addAction(action); 929 overlayGroup->addAction(m_showAllOverlaysAction);
885 m_keyReference->registerShortcut(action); 930 m_keyReference->registerShortcut(m_showAllOverlaysAction);
886 menu->addAction(action); 931 m_viewMenu->addAction(m_showAllOverlaysAction);
887 932
888 menu->addSeparator(); 933 m_viewMenu->addSeparator();
889 934
890 action = new QAction(tr("Show All Time Rulers"), this); 935 m_showAllTimeRulersAction = new QAction(tr("Show All Time Rulers"), this);
891 action->setShortcut(tr("#")); 936 m_showAllTimeRulersAction->setShortcut(tr("#"));
892 action->setStatusTip(tr("Show or hide all time rulers")); 937 m_showAllTimeRulersAction->setStatusTip(tr("Show or hide all time rulers"));
893 connect(action, SIGNAL(triggered()), this, SLOT(toggleTimeRulers())); 938 connect(m_showAllTimeRulersAction, SIGNAL(triggered()), this, SLOT(toggleTimeRulers()));
894 m_keyReference->registerShortcut(action); 939 m_keyReference->registerShortcut(m_showAllTimeRulersAction);
895 menu->addAction(action); 940 m_viewMenu->addAction(m_showAllTimeRulersAction);
896 941
897 menu->addSeparator(); 942 m_viewMenu->addSeparator();
898 943
899 action = new QAction(tr("Show &Zoom Wheels"), this); 944 m_showZoomWheelsAction = new QAction(tr("Show &Zoom Wheels"), this);
900 action->setShortcut(tr("Z")); 945 m_showZoomWheelsAction->setShortcut(tr("Z"));
901 action->setStatusTip(tr("Show thumbwheels for zooming horizontally and vertically")); 946 m_showZoomWheelsAction->setStatusTip(tr("Show thumbwheels for zooming horizontally and vertically"));
902 connect(action, SIGNAL(triggered()), this, SLOT(toggleZoomWheels())); 947 connect(m_showZoomWheelsAction, SIGNAL(triggered()), this, SLOT(toggleZoomWheels()));
903 action->setCheckable(true); 948 m_showZoomWheelsAction->setCheckable(true);
904 action->setChecked(m_viewManager->getZoomWheelsEnabled()); 949 m_showZoomWheelsAction->setChecked(m_viewManager->getZoomWheelsEnabled());
905 m_keyReference->registerShortcut(action); 950 m_keyReference->registerShortcut(m_showZoomWheelsAction);
906 menu->addAction(action); 951 m_viewMenu->addAction(m_showZoomWheelsAction);
907 952
908 action = new QAction(tr("Show Property Bo&xes"), this); 953 m_showPropertyBoxesAction = new QAction(tr("Show Property Bo&xes"), this);
909 action->setShortcut(tr("X")); 954 m_showPropertyBoxesAction->setShortcut(tr("X"));
910 action->setStatusTip(tr("Show the layer property boxes at the side of the main window")); 955 m_showPropertyBoxesAction->setStatusTip(tr("Show the layer property boxes at the side of the main window"));
911 connect(action, SIGNAL(triggered()), this, SLOT(togglePropertyBoxes())); 956 connect(m_showPropertyBoxesAction, SIGNAL(triggered()), this, SLOT(togglePropertyBoxes()));
912 action->setCheckable(true); 957 m_showPropertyBoxesAction->setCheckable(true);
913 action->setChecked(true); 958 m_showPropertyBoxesAction->setChecked(true);
914 m_keyReference->registerShortcut(action); 959 m_keyReference->registerShortcut(m_showPropertyBoxesAction);
915 menu->addAction(action); 960 m_viewMenu->addAction(m_showPropertyBoxesAction);
916 961
917 action = new QAction(tr("Show Status &Bar"), this); 962 m_showStatusBarAction = new QAction(tr("Show Status &Bar"), this);
918 action->setStatusTip(tr("Show context help information in the status bar at the bottom of the window")); 963 m_showStatusBarAction->setStatusTip(tr("Show context help information in the status bar at the bottom of the window"));
919 connect(action, SIGNAL(triggered()), this, SLOT(toggleStatusBar())); 964 connect(m_showStatusBarAction, SIGNAL(triggered()), this, SLOT(toggleStatusBar()));
920 action->setCheckable(true); 965 m_showStatusBarAction->setCheckable(true);
921 action->setChecked(true); 966 m_showStatusBarAction->setChecked(true);
922 menu->addAction(action); 967 m_viewMenu->addAction(m_showStatusBarAction);
923 968
924 QSettings settings; 969 //QSettings settings;
925 settings.beginGroup("MainWindow"); 970 settings.beginGroup("MainWindow");
926 bool sb = settings.value("showstatusbar", true).toBool(); 971 bool sb = settings.value("showstatusbar", true).toBool();
927 if (!sb) { 972 if (!sb) {
928 action->setChecked(false); 973 action->setChecked(false);
929 statusBar()->hide(); 974 statusBar()->hide();
930 } 975 }
931 settings.endGroup(); 976 settings.endGroup();
932 977
933 menu->addSeparator(); 978 m_viewMenu->addSeparator();
934 979
935 action = new QAction(tr("Show La&yer Summary"), this); 980 action = new QAction(tr("Show La&yer Summary"), this);
936 action->setShortcut(tr("Y")); 981 action->setShortcut(tr("Y"));
937 action->setStatusTip(tr("Open a window displaying the hierarchy of panes and layers in this session")); 982 action->setStatusTip(tr("Open a window displaying the hierarchy of panes and layers in this session"));
938 connect(action, SIGNAL(triggered()), this, SLOT(showLayerTree())); 983 connect(action, SIGNAL(triggered()), this, SLOT(showLayerTree()));
939 m_keyReference->registerShortcut(action); 984 m_keyReference->registerShortcut(action);
940 menu->addAction(action); 985 m_viewMenu->addAction(action);
941 986
942 action = new QAction(tr("Show Acti&vity Log"), this); 987 action = new QAction(tr("Show Acti&vity Log"), this);
943 action->setStatusTip(tr("Open a window listing interactions and other events")); 988 action->setStatusTip(tr("Open a window listing interactions and other events"));
944 connect(action, SIGNAL(triggered()), this, SLOT(showActivityLog())); 989 connect(action, SIGNAL(triggered()), this, SLOT(showActivityLog()));
945 menu->addAction(action); 990 m_viewMenu->addAction(action);
946 } 991 }
947 992
948 void 993 void
949 MainWindow::setupPaneAndLayerMenus() 994 MainWindow::setupPaneAndLayerMenus()
950 { 995 {
1597 } 1642 }
1598 1643
1599 void 1644 void
1600 MainWindow::setupHelpMenu() 1645 MainWindow::setupHelpMenu()
1601 { 1646 {
1602 QMenu *menu = menuBar()->addMenu(tr("&Help")); 1647 m_helpMenu = menuBar()->addMenu(tr("&Help"));
1603 menu->setTearOffEnabled(true); 1648 m_helpMenu->setTearOffEnabled(true);
1604 1649
1605 m_keyReference->setCategory(tr("Help")); 1650 m_keyReference->setCategory(tr("Help"));
1606 1651
1607 IconLoader il; 1652 IconLoader il;
1608 1653
1610 tr("&Help Reference"), this); 1655 tr("&Help Reference"), this);
1611 action->setShortcut(tr("F1")); 1656 action->setShortcut(tr("F1"));
1612 action->setStatusTip(tr("Open the Sonic Visualiser reference manual")); 1657 action->setStatusTip(tr("Open the Sonic Visualiser reference manual"));
1613 connect(action, SIGNAL(triggered()), this, SLOT(help())); 1658 connect(action, SIGNAL(triggered()), this, SLOT(help()));
1614 m_keyReference->registerShortcut(action); 1659 m_keyReference->registerShortcut(action);
1615 menu->addAction(action); 1660 m_helpMenu->addAction(action);
1616 1661
1617 action = new QAction(tr("&Key and Mouse Reference"), this); 1662 action = new QAction(tr("&Key and Mouse Reference"), this);
1618 action->setShortcut(tr("F2")); 1663 action->setShortcut(tr("F2"));
1619 action->setStatusTip(tr("Open a window showing the keystrokes you can use in Sonic Visualiser")); 1664 action->setStatusTip(tr("Open a window showing the keystrokes you can use in Sonic Visualiser"));
1620 connect(action, SIGNAL(triggered()), this, SLOT(keyReference())); 1665 connect(action, SIGNAL(triggered()), this, SLOT(keyReference()));
1621 m_keyReference->registerShortcut(action); 1666 m_keyReference->registerShortcut(action);
1622 menu->addAction(action); 1667 m_helpMenu->addAction(action);
1623 1668
1624 action = new QAction(tr("Sonic Visualiser on the &Web"), this); 1669 action = new QAction(tr("Sonic Visualiser on the &Web"), this);
1625 action->setStatusTip(tr("Open the Sonic Visualiser website")); 1670 action->setStatusTip(tr("Open the Sonic Visualiser website"));
1626 connect(action, SIGNAL(triggered()), this, SLOT(website())); 1671 connect(action, SIGNAL(triggered()), this, SLOT(website()));
1627 menu->addAction(action); 1672 m_helpMenu->addAction(action);
1628 1673
1629 action = new QAction(tr("&About Sonic Visualiser"), this); 1674 action = new QAction(tr("&About Sonic Visualiser"), this);
1630 action->setStatusTip(tr("Show information about Sonic Visualiser")); 1675 action->setStatusTip(tr("Show information about Sonic Visualiser"));
1631 connect(action, SIGNAL(triggered()), this, SLOT(about())); 1676 connect(action, SIGNAL(triggered()), this, SLOT(about()));
1632 menu->addAction(action); 1677 m_helpMenu->addAction(action);
1633 } 1678 }
1634 1679
1635 void 1680 void
1636 MainWindow::setupRecentFilesMenu() 1681 MainWindow::setupRecentFilesMenu()
1637 { 1682 {
1818 QMenu *menu = m_playbackMenu = menuBar()->addMenu(tr("Play&back")); 1863 QMenu *menu = m_playbackMenu = menuBar()->addMenu(tr("Play&back"));
1819 menu->setTearOffEnabled(true); 1864 menu->setTearOffEnabled(true);
1820 m_rightButtonMenu->addSeparator(); 1865 m_rightButtonMenu->addSeparator();
1821 m_rightButtonPlaybackMenu = m_rightButtonMenu->addMenu(tr("Playback")); 1866 m_rightButtonPlaybackMenu = m_rightButtonMenu->addMenu(tr("Playback"));
1822 1867
1823 QToolBar *toolbar = addToolBar(tr("Playback Toolbar")); 1868 m_playbackToolBar = addToolBar(tr("Playback Toolbar"));
1824 1869 m_rwdStartAction = m_playbackToolBar->addAction(il.load("rewind-start"),
1825 m_rwdStartAction = toolbar->addAction(il.load("rewind-start"), 1870 tr("Rewind to Start"));
1826 tr("Rewind to Start"));
1827 m_rwdStartAction->setShortcut(tr("Home")); 1871 m_rwdStartAction->setShortcut(tr("Home"));
1828 m_rwdStartAction->setStatusTip(tr("Rewind to the start")); 1872 m_rwdStartAction->setStatusTip(tr("Rewind to the start"));
1829 connect(m_rwdStartAction, SIGNAL(triggered()), this, SLOT(rewindStart())); 1873 connect(m_rwdStartAction, SIGNAL(triggered()), this, SLOT(rewindStart()));
1830 connect(this, SIGNAL(canPlay(bool)), m_rwdStartAction, SLOT(setEnabled(bool))); 1874 connect(this, SIGNAL(canPlay(bool)), m_rwdStartAction, SLOT(setEnabled(bool)));
1831 1875
1832 m_rwdAction = toolbar->addAction(il.load("rewind"), tr("Rewind")); 1876 m_rwdAction = m_playbackToolBar->addAction(il.load("rewind"), tr("Rewind"));
1833 m_rwdAction->setShortcut(tr("PgUp")); 1877 m_rwdAction->setShortcut(tr("PgUp"));
1834 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant or time ruler notch")); 1878 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant or time ruler notch"));
1835 connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind())); 1879 connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind()));
1836 connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool))); 1880 connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool)));
1837 1881
1839 m_rwdSimilarAction->setShortcut(tr("Shift+PgUp")); 1883 m_rwdSimilarAction->setShortcut(tr("Shift+PgUp"));
1840 m_rwdSimilarAction->setStatusTip(tr("Rewind to the previous similarly valued time instant")); 1884 m_rwdSimilarAction->setStatusTip(tr("Rewind to the previous similarly valued time instant"));
1841 connect(m_rwdSimilarAction, SIGNAL(triggered()), this, SLOT(rewindSimilar())); 1885 connect(m_rwdSimilarAction, SIGNAL(triggered()), this, SLOT(rewindSimilar()));
1842 connect(this, SIGNAL(canRewind(bool)), m_rwdSimilarAction, SLOT(setEnabled(bool))); 1886 connect(this, SIGNAL(canRewind(bool)), m_rwdSimilarAction, SLOT(setEnabled(bool)));
1843 1887
1844 m_playAction = toolbar->addAction(il.load("playpause"), 1888 m_playAction = m_playbackToolBar->addAction(il.load("playpause"),
1845 tr("Play / Pause")); 1889 tr("Play / Pause"));
1846 m_playAction->setCheckable(true); 1890 m_playAction->setCheckable(true);
1847 m_playAction->setShortcut(tr("Space")); 1891 m_playAction->setShortcut(tr("Space"));
1848 m_playAction->setStatusTip(tr("Start or stop playback from the current position")); 1892 m_playAction->setStatusTip(tr("Start or stop playback from the current position"));
1849 connect(m_playAction, SIGNAL(triggered()), this, SLOT(play())); 1893 connect(m_playAction, SIGNAL(triggered()), this, SLOT(play()));
1851 m_playAction, SLOT(setChecked(bool))); 1895 m_playAction, SLOT(setChecked(bool)));
1852 connect(m_playSource, SIGNAL(playStatusChanged(bool)), 1896 connect(m_playSource, SIGNAL(playStatusChanged(bool)),
1853 this, SLOT(playStatusChanged(bool))); 1897 this, SLOT(playStatusChanged(bool)));
1854 connect(this, SIGNAL(canPlay(bool)), m_playAction, SLOT(setEnabled(bool))); 1898 connect(this, SIGNAL(canPlay(bool)), m_playAction, SLOT(setEnabled(bool)));
1855 1899
1856 m_ffwdAction = toolbar->addAction(il.load("ffwd"), 1900 m_ffwdAction = m_playbackToolBar->addAction(il.load("ffwd"),
1857 tr("Fast Forward")); 1901 tr("Fast Forward"));
1858 m_ffwdAction->setShortcut(tr("PgDown")); 1902 m_ffwdAction->setShortcut(tr("PgDown"));
1859 m_ffwdAction->setStatusTip(tr("Fast-forward to the next time instant or time ruler notch")); 1903 m_ffwdAction->setStatusTip(tr("Fast-forward to the next time instant or time ruler notch"));
1860 connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd())); 1904 connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd()));
1861 connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool))); 1905 connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool)));
1864 m_ffwdSimilarAction->setShortcut(tr("Shift+PgDown")); 1908 m_ffwdSimilarAction->setShortcut(tr("Shift+PgDown"));
1865 m_ffwdSimilarAction->setStatusTip(tr("Fast-forward to the next similarly valued time instant")); 1909 m_ffwdSimilarAction->setStatusTip(tr("Fast-forward to the next similarly valued time instant"));
1866 connect(m_ffwdSimilarAction, SIGNAL(triggered()), this, SLOT(ffwdSimilar())); 1910 connect(m_ffwdSimilarAction, SIGNAL(triggered()), this, SLOT(ffwdSimilar()));
1867 connect(this, SIGNAL(canFfwd(bool)), m_ffwdSimilarAction, SLOT(setEnabled(bool))); 1911 connect(this, SIGNAL(canFfwd(bool)), m_ffwdSimilarAction, SLOT(setEnabled(bool)));
1868 1912
1869 m_ffwdEndAction = toolbar->addAction(il.load("ffwd-end"), 1913 m_ffwdEndAction = m_playbackToolBar->addAction(il.load("ffwd-end"),
1870 tr("Fast Forward to End")); 1914 tr("Fast Forward to End"));
1871 m_ffwdEndAction->setShortcut(tr("End")); 1915 m_ffwdEndAction->setShortcut(tr("End"));
1872 m_ffwdEndAction->setStatusTip(tr("Fast-forward to the end")); 1916 m_ffwdEndAction->setStatusTip(tr("Fast-forward to the end"));
1873 connect(m_ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd())); 1917 connect(m_ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd()));
1874 connect(this, SIGNAL(canPlay(bool)), m_ffwdEndAction, SLOT(setEnabled(bool))); 1918 connect(this, SIGNAL(canPlay(bool)), m_ffwdEndAction, SLOT(setEnabled(bool)));
1875 1919
1876 toolbar = addToolBar(tr("Play Mode Toolbar")); 1920 m_playModeToolBar = addToolBar(tr("Play Mode Toolbar"));
1877 1921
1878 m_playSelectionAction = toolbar->addAction(il.load("playselection"), 1922 m_playSelectionAction = m_playModeToolBar->addAction(il.load("playselection"),
1879 tr("Constrain Playback to Selection")); 1923 tr("Constrain Playback to Selection"));
1880 m_playSelectionAction->setCheckable(true); 1924 m_playSelectionAction->setCheckable(true);
1881 m_playSelectionAction->setChecked(m_viewManager->getPlaySelectionMode()); 1925 m_playSelectionAction->setChecked(m_viewManager->getPlaySelectionMode());
1882 m_playSelectionAction->setShortcut(tr("s")); 1926 m_playSelectionAction->setShortcut(tr("s"));
1883 m_playSelectionAction->setStatusTip(tr("Constrain playback to the selected regions")); 1927 m_playSelectionAction->setStatusTip(tr("Constrain playback to the selected regions"));
1884 connect(m_viewManager, SIGNAL(playSelectionModeChanged(bool)), 1928 connect(m_viewManager, SIGNAL(playSelectionModeChanged(bool)),
1885 m_playSelectionAction, SLOT(setChecked(bool))); 1929 m_playSelectionAction, SLOT(setChecked(bool)));
1886 connect(m_playSelectionAction, SIGNAL(triggered()), this, SLOT(playSelectionToggled())); 1930 connect(m_playSelectionAction, SIGNAL(triggered()), this, SLOT(playSelectionToggled()));
1887 connect(this, SIGNAL(canPlaySelection(bool)), m_playSelectionAction, SLOT(setEnabled(bool))); 1931 connect(this, SIGNAL(canPlaySelection(bool)), m_playSelectionAction, SLOT(setEnabled(bool)));
1888 1932
1889 m_playLoopAction = toolbar->addAction(il.load("playloop"), 1933 m_playLoopAction = m_playModeToolBar->addAction(il.load("playloop"),
1890 tr("Loop Playback")); 1934 tr("Loop Playback"));
1891 m_playLoopAction->setCheckable(true); 1935 m_playLoopAction->setCheckable(true);
1892 m_playLoopAction->setChecked(m_viewManager->getPlayLoopMode()); 1936 m_playLoopAction->setChecked(m_viewManager->getPlayLoopMode());
1893 m_playLoopAction->setShortcut(tr("l")); 1937 m_playLoopAction->setShortcut(tr("l"));
1894 m_playLoopAction->setStatusTip(tr("Loop playback")); 1938 m_playLoopAction->setStatusTip(tr("Loop playback"));
1895 connect(m_viewManager, SIGNAL(playLoopModeChanged(bool)), 1939 connect(m_viewManager, SIGNAL(playLoopModeChanged(bool)),
1896 m_playLoopAction, SLOT(setChecked(bool))); 1940 m_playLoopAction, SLOT(setChecked(bool)));
1897 connect(m_playLoopAction, SIGNAL(triggered()), this, SLOT(playLoopToggled())); 1941 connect(m_playLoopAction, SIGNAL(triggered()), this, SLOT(playLoopToggled()));
1898 connect(this, SIGNAL(canPlay(bool)), m_playLoopAction, SLOT(setEnabled(bool))); 1942 connect(this, SIGNAL(canPlay(bool)), m_playLoopAction, SLOT(setEnabled(bool)));
1899 1943
1900 m_soloAction = toolbar->addAction(il.load("solo"), 1944 m_soloAction = m_playModeToolBar->addAction(il.load("solo"),
1901 tr("Solo Current Pane")); 1945 tr("Solo Current Pane"));
1902 m_soloAction->setCheckable(true); 1946 m_soloAction->setCheckable(true);
1903 m_soloAction->setChecked(m_viewManager->getPlaySoloMode()); 1947 m_soloAction->setChecked(m_viewManager->getPlaySoloMode());
1904 m_prevSolo = m_viewManager->getPlaySoloMode(); 1948 m_prevSolo = m_viewManager->getPlaySoloMode();
1905 m_soloAction->setShortcut(tr("o")); 1949 m_soloAction->setShortcut(tr("o"));
1907 connect(m_viewManager, SIGNAL(playSoloModeChanged(bool)), 1951 connect(m_viewManager, SIGNAL(playSoloModeChanged(bool)),
1908 m_soloAction, SLOT(setChecked(bool))); 1952 m_soloAction, SLOT(setChecked(bool)));
1909 connect(m_soloAction, SIGNAL(triggered()), this, SLOT(playSoloToggled())); 1953 connect(m_soloAction, SIGNAL(triggered()), this, SLOT(playSoloToggled()));
1910 connect(this, SIGNAL(canChangeSolo(bool)), m_soloAction, SLOT(setEnabled(bool))); 1954 connect(this, SIGNAL(canChangeSolo(bool)), m_soloAction, SLOT(setEnabled(bool)));
1911 1955
1912 QAction *alAction = 0; 1956 //QAction *alAction = 0;
1913 if (Document::canAlign()) { 1957 if (Document::canAlign()) {
1914 alAction = toolbar->addAction(il.load("align"), 1958 m_alAction = m_playModeToolBar->addAction(il.load("align"),
1915 tr("Align File Timelines")); 1959 tr("Align File Timelines"));
1916 alAction->setCheckable(true); 1960 m_alAction->setCheckable(true);
1917 alAction->setChecked(m_viewManager->getAlignMode()); 1961 m_alAction->setChecked(m_viewManager->getAlignMode());
1918 alAction->setStatusTip(tr("Treat multiple audio files as versions of the same work, and align their timelines")); 1962 m_alAction->setStatusTip(tr("Treat multiple audio files as versions of the same work, and align their timelines"));
1919 connect(m_viewManager, SIGNAL(alignModeChanged(bool)), 1963 connect(m_viewManager, SIGNAL(alignModeChanged(bool)),
1920 alAction, SLOT(setChecked(bool))); 1964 m_alAction, SLOT(setChecked(bool)));
1921 connect(alAction, SIGNAL(triggered()), this, SLOT(alignToggled())); 1965 connect(m_alAction, SIGNAL(triggered()), this, SLOT(alignToggled()));
1922 connect(this, SIGNAL(canAlign(bool)), alAction, SLOT(setEnabled(bool))); 1966 connect(this, SIGNAL(canAlign(bool)), m_alAction, SLOT(setEnabled(bool)));
1923 } 1967 }
1924 1968
1925 m_keyReference->registerShortcut(m_playAction); 1969 m_keyReference->registerShortcut(m_playAction);
1926 m_keyReference->registerShortcut(m_playSelectionAction); 1970 m_keyReference->registerShortcut(m_playSelectionAction);
1927 m_keyReference->registerShortcut(m_playLoopAction); 1971 m_keyReference->registerShortcut(m_playLoopAction);
1928 m_keyReference->registerShortcut(m_soloAction); 1972 m_keyReference->registerShortcut(m_soloAction);
1929 if (alAction) m_keyReference->registerShortcut(alAction); 1973 if (m_alAction) m_keyReference->registerShortcut(m_alAction);
1930 m_keyReference->registerShortcut(m_rwdAction); 1974 m_keyReference->registerShortcut(m_rwdAction);
1931 m_keyReference->registerShortcut(m_ffwdAction); 1975 m_keyReference->registerShortcut(m_ffwdAction);
1932 m_keyReference->registerShortcut(m_rwdSimilarAction); 1976 m_keyReference->registerShortcut(m_rwdSimilarAction);
1933 m_keyReference->registerShortcut(m_ffwdSimilarAction); 1977 m_keyReference->registerShortcut(m_ffwdSimilarAction);
1934 m_keyReference->registerShortcut(m_rwdStartAction); 1978 m_keyReference->registerShortcut(m_rwdStartAction);
1936 1980
1937 menu->addAction(m_playAction); 1981 menu->addAction(m_playAction);
1938 menu->addAction(m_playSelectionAction); 1982 menu->addAction(m_playSelectionAction);
1939 menu->addAction(m_playLoopAction); 1983 menu->addAction(m_playLoopAction);
1940 menu->addAction(m_soloAction); 1984 menu->addAction(m_soloAction);
1941 if (alAction) menu->addAction(alAction); 1985 if (m_alAction) menu->addAction(m_alAction);
1942 menu->addSeparator(); 1986 menu->addSeparator();
1943 menu->addAction(m_rwdAction); 1987 menu->addAction(m_rwdAction);
1944 menu->addAction(m_ffwdAction); 1988 menu->addAction(m_ffwdAction);
1945 menu->addSeparator(); 1989 menu->addSeparator();
1946 menu->addAction(m_rwdSimilarAction); 1990 menu->addAction(m_rwdSimilarAction);
1952 1996
1953 m_rightButtonPlaybackMenu->addAction(m_playAction); 1997 m_rightButtonPlaybackMenu->addAction(m_playAction);
1954 m_rightButtonPlaybackMenu->addAction(m_playSelectionAction); 1998 m_rightButtonPlaybackMenu->addAction(m_playSelectionAction);
1955 m_rightButtonPlaybackMenu->addAction(m_playLoopAction); 1999 m_rightButtonPlaybackMenu->addAction(m_playLoopAction);
1956 m_rightButtonPlaybackMenu->addAction(m_soloAction); 2000 m_rightButtonPlaybackMenu->addAction(m_soloAction);
1957 if (alAction) m_rightButtonPlaybackMenu->addAction(alAction); 2001 if (m_alAction) m_rightButtonPlaybackMenu->addAction(m_alAction);
1958 m_rightButtonPlaybackMenu->addSeparator(); 2002 m_rightButtonPlaybackMenu->addSeparator();
1959 m_rightButtonPlaybackMenu->addAction(m_rwdAction); 2003 m_rightButtonPlaybackMenu->addAction(m_rwdAction);
1960 m_rightButtonPlaybackMenu->addAction(m_ffwdAction); 2004 m_rightButtonPlaybackMenu->addAction(m_ffwdAction);
1961 m_rightButtonPlaybackMenu->addSeparator(); 2005 m_rightButtonPlaybackMenu->addSeparator();
1962 m_rightButtonPlaybackMenu->addAction(m_rwdStartAction); 2006 m_rightButtonPlaybackMenu->addAction(m_rwdStartAction);
1987 2031
1988 m_rightButtonPlaybackMenu->addAction(fastAction); 2032 m_rightButtonPlaybackMenu->addAction(fastAction);
1989 m_rightButtonPlaybackMenu->addAction(slowAction); 2033 m_rightButtonPlaybackMenu->addAction(slowAction);
1990 m_rightButtonPlaybackMenu->addAction(normalAction); 2034 m_rightButtonPlaybackMenu->addAction(normalAction);
1991 2035
1992 toolbar = addToolBar(tr("Edit Toolbar")); 2036 m_editToolBar = addToolBar(tr("Edit Toolbar"));
1993 CommandHistory::getInstance()->registerToolbar(toolbar); 2037 CommandHistory::getInstance()->registerToolbar(m_editToolBar);
1994 2038
1995 m_keyReference->setCategory(tr("Tool Selection")); 2039 m_keyReference->setCategory(tr("Tool Selection"));
1996 2040
1997 toolbar = addToolBar(tr("Tools Toolbar")); 2041 m_toolsToolBar = addToolBar(tr("Tools Toolbar"));
1998 QActionGroup *group = new QActionGroup(this); 2042 QActionGroup *group = new QActionGroup(this);
1999 2043
2000 QAction *action = toolbar->addAction(il.load("navigate"), 2044 QAction *action = m_toolsToolBar->addAction(il.load("navigate"),
2001 tr("Navigate")); 2045 tr("Navigate"));
2002 action->setCheckable(true); 2046 action->setCheckable(true);
2003 action->setChecked(true); 2047 action->setChecked(true);
2004 action->setShortcut(tr("1")); 2048 action->setShortcut(tr("1"));
2005 action->setStatusTip(tr("Navigate")); 2049 action->setStatusTip(tr("Navigate"));
2006 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected())); 2050 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected()));
2007 group->addAction(action); 2051 group->addAction(action);
2008 m_keyReference->registerShortcut(action); 2052 m_keyReference->registerShortcut(action);
2009 m_toolActions[ViewManager::NavigateMode] = action; 2053 m_toolActions[ViewManager::NavigateMode] = action;
2010 2054
2011 action = toolbar->addAction(il.load("select"), 2055 action = m_toolsToolBar->addAction(il.load("select"),
2012 tr("Select")); 2056 tr("Select"));
2013 action->setCheckable(true); 2057 action->setCheckable(true);
2014 action->setShortcut(tr("2")); 2058 action->setShortcut(tr("2"));
2015 action->setStatusTip(tr("Select ranges")); 2059 action->setStatusTip(tr("Select ranges"));
2016 connect(action, SIGNAL(triggered()), this, SLOT(toolSelectSelected())); 2060 connect(action, SIGNAL(triggered()), this, SLOT(toolSelectSelected()));
2017 group->addAction(action); 2061 group->addAction(action);
2018 m_keyReference->registerShortcut(action); 2062 m_keyReference->registerShortcut(action);
2019 m_toolActions[ViewManager::SelectMode] = action; 2063 m_toolActions[ViewManager::SelectMode] = action;
2020 2064
2021 action = toolbar->addAction(il.load("move"), 2065 action = m_toolsToolBar->addAction(il.load("move"),
2022 tr("Edit")); 2066 tr("Edit"));
2023 action->setCheckable(true); 2067 action->setCheckable(true);
2024 action->setShortcut(tr("3")); 2068 action->setShortcut(tr("3"));
2025 action->setStatusTip(tr("Edit items in layer")); 2069 action->setStatusTip(tr("Edit items in layer"));
2026 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected())); 2070 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected()));
2027 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); 2071 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
2028 group->addAction(action); 2072 group->addAction(action);
2029 m_keyReference->registerShortcut(action); 2073 m_keyReference->registerShortcut(action);
2030 m_toolActions[ViewManager::EditMode] = action; 2074 m_toolActions[ViewManager::EditMode] = action;
2031 2075
2032 action = toolbar->addAction(il.load("draw"), 2076 action = m_toolsToolBar->addAction(il.load("draw"),
2033 tr("Draw")); 2077 tr("Draw"));
2034 action->setCheckable(true); 2078 action->setCheckable(true);
2035 action->setShortcut(tr("4")); 2079 action->setShortcut(tr("4"));
2036 action->setStatusTip(tr("Draw new items in layer")); 2080 action->setStatusTip(tr("Draw new items in layer"));
2037 connect(action, SIGNAL(triggered()), this, SLOT(toolDrawSelected())); 2081 connect(action, SIGNAL(triggered()), this, SLOT(toolDrawSelected()));
2038 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); 2082 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
2039 group->addAction(action); 2083 group->addAction(action);
2040 m_keyReference->registerShortcut(action); 2084 m_keyReference->registerShortcut(action);
2041 m_toolActions[ViewManager::DrawMode] = action; 2085 m_toolActions[ViewManager::DrawMode] = action;
2042 2086
2043 action = toolbar->addAction(il.load("erase"), 2087 action = m_toolsToolBar->addAction(il.load("erase"),
2044 tr("Erase")); 2088 tr("Erase"));
2045 action->setCheckable(true); 2089 action->setCheckable(true);
2046 action->setShortcut(tr("5")); 2090 action->setShortcut(tr("5"));
2047 action->setStatusTip(tr("Erase items from layer")); 2091 action->setStatusTip(tr("Erase items from layer"));
2048 connect(action, SIGNAL(triggered()), this, SLOT(toolEraseSelected())); 2092 connect(action, SIGNAL(triggered()), this, SLOT(toolEraseSelected()));
2049 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); 2093 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
2050 group->addAction(action); 2094 group->addAction(action);
2051 m_keyReference->registerShortcut(action); 2095 m_keyReference->registerShortcut(action);
2052 m_toolActions[ViewManager::EraseMode] = action; 2096 m_toolActions[ViewManager::EraseMode] = action;
2053 2097
2054 action = toolbar->addAction(il.load("measure"), tr("Measure")); 2098 action = m_toolsToolBar->addAction(il.load("measure"), tr("Measure"));
2055 action->setCheckable(true); 2099 action->setCheckable(true);
2056 action->setShortcut(tr("6")); 2100 action->setShortcut(tr("6"));
2057 action->setStatusTip(tr("Make measurements in layer")); 2101 action->setStatusTip(tr("Make measurements in layer"));
2058 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected())); 2102 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected()));
2059 connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool))); 2103 connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool)));
2981 // SVDEBUG << "Ignoring close event" << endl; 3025 // SVDEBUG << "Ignoring close event" << endl;
2982 e->ignore(); 3026 e->ignore();
2983 return; 3027 return;
2984 } 3028 }
2985 3029
2986 QSettings settings; 3030 // Don't save size and position if in minimal mode (in case we
2987 settings.beginGroup("MainWindow"); 3031 //start up in full mode)
2988 settings.setValue("size", size()); 3032 bool minimal = m_viewManager->getMinimalModeEnabled();
2989 settings.setValue("position", pos()); 3033 if (!minimal) {
2990 settings.endGroup(); 3034 QSettings settings;
3035 settings.beginGroup("MainWindow");
3036 settings.setValue("size", size());
3037 settings.setValue("position", pos());
3038 settings.endGroup();
3039 }
2991 3040
2992 delete m_keyReference; 3041 delete m_keyReference;
2993 m_keyReference = 0; 3042 m_keyReference = 0;
2994 3043
2995 if (m_preferencesDialog && 3044 if (m_preferencesDialog &&
4291 settings.setValue(tag, false); 4340 settings.setValue(tag, false);
4292 } 4341 }
4293 settings.endGroup(); 4342 settings.endGroup();
4294 } 4343 }
4295 4344
4296 4345 void
4346 MainWindow::toggleViewMode()
4347 {
4348 QSettings settings;
4349 settings.beginGroup("MainWindow");
4350
4351 bool wasMinimal = m_viewManager->getMinimalModeEnabled();
4352
4353 //std::cerr << "minimal mode enabled was: " << wasMinimal << std::endl;
4354
4355 bool show;
4356
4357 int maxHeight = QWIDGETSIZE_MAX;
4358
4359 if (wasMinimal) {
4360
4361 show = true;
4362 m_viewManager->setMinimalModeEnabled(false);
4363 m_scroll->show();
4364
4365 // Restore the hidden menus. We need to make sure they go back
4366 // in the right places, so first remove the ones that need to
4367 // be to the right of them and then add those back in as well
4368 // at the appropriate point
4369 menuBar()->removeAction(m_helpMenu->menuAction());
4370 menuBar()->removeAction(m_playbackMenu->menuAction());
4371 menuBar()->removeAction(m_viewMenu->menuAction());
4372 menuBar()->addMenu(m_editMenu);
4373 menuBar()->addMenu(m_viewMenu);
4374 menuBar()->addMenu(m_paneMenu);
4375 menuBar()->addMenu(m_layerMenu);
4376 menuBar()->addMenu(m_transformsMenu);
4377 menuBar()->addMenu(m_playbackMenu);
4378 menuBar()->addMenu(m_helpMenu);
4379
4380 } else {
4381
4382 settings.setValue("size", size());
4383
4384 maxHeight = height() - m_scroll->height();
4385
4386 show = false;
4387 m_viewManager->setMinimalModeEnabled(true);
4388 m_scroll->hide();
4389
4390 menuBar()->removeAction(m_transformsMenu->menuAction());
4391 menuBar()->removeAction(m_layerMenu->menuAction());
4392 menuBar()->removeAction(m_paneMenu->menuAction());
4393 menuBar()->removeAction(m_editMenu->menuAction());
4394 }
4395
4396 QGridLayout *layout = qobject_cast<QGridLayout *>
4397 (centralWidget()->layout());
4398 if (layout) {
4399 layout->setColumnMinimumWidth(0, wasMinimal ? 14 : 0);
4400 }
4401
4402 //cerr << "Call to MainWindow::toggleViewMode"<< endl;
4403
4404 m_playModeToolBar->setVisible(show);
4405 m_editToolBar->setVisible(show);
4406 m_toolsToolBar->setVisible(show);
4407
4408 //add/remove actions from the File menu
4409 m_importAnnotationLayerAction->setVisible(show);
4410 m_exportAnnotationLayerAction->setVisible(show);
4411 //add/remove actions from the View menu
4412 m_showNoOverlaysAction->setVisible(show);
4413 m_showMinimalOverlaysAction->setVisible(show);
4414 m_showStandardOverlaysAction->setVisible(show);
4415 m_showAllOverlaysAction->setVisible(show);
4416 m_showAllTimeRulersAction->setVisible(show);
4417 m_showZoomWheelsAction->setVisible(show);
4418 m_showPropertyBoxesAction->setVisible(show);
4419 m_showStatusBarAction->setVisible(show);
4420 //add/remove actions from the Playback menu
4421 m_playSelectionAction->setVisible(show);
4422 m_playLoopAction->setVisible(show);
4423 m_soloAction->setVisible(show);
4424 if (m_alAction) m_alAction->setVisible(show);
4425
4426 m_playControlsSpacer->setVisible(show);
4427
4428 setMaximumHeight(maxHeight);
4429
4430 if (wasMinimal) {
4431 resizeConstrained(settings.value("size").toSize());
4432 } else {
4433 QApplication::processEvents();
4434 adjustSize();
4435 }
4436
4437 settings.endGroup();
4438
4439 //TO-DOS:
4440 //- The Constrain Playback to Selection option is still effective when the minimal mode is activated whereas
4441 //the functionality to modify the selection has been removed from this mode. Playback mode should switch to
4442 //normal when the minimal mode is activated and then be set up again to what it was when the full mode is
4443 //activated again.
4444 //- after adding the minimal mode at startup option in Preferences/Appearance, the minimal mode window size
4445 //is not optimized as before
4446
4447 //done:
4448 //- when switching back to full mode, the pane is not shown entirely, should restore the previous size
4449 //- the size of the overview (namely its width) should be increased when the minimal mode is activated
4450 //- the menus which have no effects in the minimal mode should be removed (or their actions disabled)
4451 //even if this doesn't lead cause the application to crash (the actual changes are made in the hidden pane(s))
4452 //- the menu actions which have no effects in the minimal mode should be removed or disabled
4453 //- add Minimal mode at startup in the Preferences/Appearance
4454 }
4455