comparison main/MainWindow.cpp @ 168:aca2c23f0f09

* Add icon loader that automatically inverts icons where appropriate for (slightly) better display on a dark background
author Chris Cannam
date Fri, 13 Jul 2007 13:19:15 +0000
parents 4d762fe10919
children ca825d1a4a6b
comparison
equal deleted inserted replaced
167:567df8af372c 168:aca2c23f0f09
35 #include "widgets/Fader.h" 35 #include "widgets/Fader.h"
36 #include "view/Overview.h" 36 #include "view/Overview.h"
37 #include "widgets/PropertyBox.h" 37 #include "widgets/PropertyBox.h"
38 #include "widgets/PropertyStack.h" 38 #include "widgets/PropertyStack.h"
39 #include "widgets/AudioDial.h" 39 #include "widgets/AudioDial.h"
40 #include "widgets/IconLoader.h"
40 #include "widgets/LayerTree.h" 41 #include "widgets/LayerTree.h"
41 #include "widgets/ListInputDialog.h" 42 #include "widgets/ListInputDialog.h"
42 #include "widgets/SubdividingMenu.h" 43 #include "widgets/SubdividingMenu.h"
43 #include "widgets/NotifyingPushButton.h" 44 #include "widgets/NotifyingPushButton.h"
44 #include "widgets/KeyReference.h" 45 #include "widgets/KeyReference.h"
180 QScrollArea *scroll = new QScrollArea(frame); 181 QScrollArea *scroll = new QScrollArea(frame);
181 scroll->setWidgetResizable(true); 182 scroll->setWidgetResizable(true);
182 scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 183 scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
183 scroll->setFrameShape(QFrame::NoFrame); 184 scroll->setFrameShape(QFrame::NoFrame);
184 185
185 // QFrame *subframe = new QFrame;
186 // scroll->setWidget(subframe);
187
188 // QGridLayout *sublayout = new QGridLayout;
189 // subframe->setLayout(sublayout);
190
191 // m_paneStack = new PaneStack(subframe, m_viewManager);
192 m_paneStack = new PaneStack(scroll, m_viewManager); 186 m_paneStack = new PaneStack(scroll, m_viewManager);
193 connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)), 187 connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)),
194 this, SLOT(currentPaneChanged(Pane *))); 188 this, SLOT(currentPaneChanged(Pane *)));
195 connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)), 189 connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)),
196 this, SLOT(currentLayerChanged(Pane *, Layer *))); 190 this, SLOT(currentLayerChanged(Pane *, Layer *)));
199 connect(m_paneStack, SIGNAL(propertyStacksResized()), 193 connect(m_paneStack, SIGNAL(propertyStacksResized()),
200 this, SLOT(propertyStacksResized())); 194 this, SLOT(propertyStacksResized()));
201 connect(m_paneStack, SIGNAL(contextHelpChanged(const QString &)), 195 connect(m_paneStack, SIGNAL(contextHelpChanged(const QString &)),
202 this, SLOT(contextHelpChanged(const QString &))); 196 this, SLOT(contextHelpChanged(const QString &)));
203 197
204 // sublayout->addWidget(m_paneStack, 0, 0);
205 scroll->setWidget(m_paneStack); 198 scroll->setWidget(m_paneStack);
206 199
207 m_overview = new Overview(frame); 200 m_overview = new Overview(frame);
208 m_overview->setViewManager(m_viewManager); 201 m_overview->setViewManager(m_viewManager);
209 m_overview->setFixedHeight(40); 202 m_overview->setFixedHeight(40);
216 connect(m_overview, SIGNAL(contextHelpChanged(const QString &)), 209 connect(m_overview, SIGNAL(contextHelpChanged(const QString &)),
217 this, SLOT(contextHelpChanged(const QString &))); 210 this, SLOT(contextHelpChanged(const QString &)));
218 211
219 m_panLayer = new WaveformLayer; 212 m_panLayer = new WaveformLayer;
220 m_panLayer->setChannelMode(WaveformLayer::MergeChannels); 213 m_panLayer->setChannelMode(WaveformLayer::MergeChannels);
221 // m_panLayer->setScale(WaveformLayer::MeterScale);
222 // m_panLayer->setAutoNormalize(true);
223 m_panLayer->setBaseColour(Qt::darkGreen); 214 m_panLayer->setBaseColour(Qt::darkGreen);
224 m_panLayer->setAggressiveCacheing(true); 215 m_panLayer->setAggressiveCacheing(true);
225 m_overview->addLayer(m_panLayer); 216 m_overview->addLayer(m_panLayer);
226 217
227 m_playSource = new AudioCallbackPlaySource(m_viewManager); 218 m_playSource = new AudioCallbackPlaySource(m_viewManager);
250 connect(m_playSpeed, SIGNAL(valueChanged(int)), 241 connect(m_playSpeed, SIGNAL(valueChanged(int)),
251 this, SLOT(playSpeedChanged(int))); 242 this, SLOT(playSpeedChanged(int)));
252 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); 243 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
253 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); 244 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
254 245
246 IconLoader il;
247
255 m_playSharpen = new NotifyingPushButton(frame); 248 m_playSharpen = new NotifyingPushButton(frame);
256 m_playSharpen->setToolTip(tr("Sharpen percussive transients")); 249 m_playSharpen->setToolTip(tr("Sharpen percussive transients"));
257 m_playSharpen->setFixedSize(20, 20); 250 m_playSharpen->setFixedSize(20, 20);
258 // m_playSharpen->setFlat(true);
259 m_playSharpen->setEnabled(false); 251 m_playSharpen->setEnabled(false);
260 m_playSharpen->setCheckable(true); 252 m_playSharpen->setCheckable(true);
261 m_playSharpen->setChecked(false); 253 m_playSharpen->setChecked(false);
262 m_playSharpen->setIcon(QIcon(":icons/sharpen.png")); 254 m_playSharpen->setIcon(il.load("sharpen"));
263 connect(m_playSharpen, SIGNAL(clicked()), this, SLOT(playSharpenToggled())); 255 connect(m_playSharpen, SIGNAL(clicked()), this, SLOT(playSharpenToggled()));
264 connect(m_playSharpen, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); 256 connect(m_playSharpen, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
265 connect(m_playSharpen, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); 257 connect(m_playSharpen, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
266 258
267 m_playMono = new NotifyingPushButton(frame); 259 m_playMono = new NotifyingPushButton(frame);
268 m_playMono->setToolTip(tr("Run time stretcher in mono only")); 260 m_playMono->setToolTip(tr("Run time stretcher in mono only"));
269 m_playMono->setFixedSize(20, 20); 261 m_playMono->setFixedSize(20, 20);
270 // m_playMono->setFlat(true);
271 m_playMono->setEnabled(false); 262 m_playMono->setEnabled(false);
272 m_playMono->setCheckable(true); 263 m_playMono->setCheckable(true);
273 m_playMono->setChecked(false); 264 m_playMono->setChecked(false);
274 m_playMono->setIcon(QIcon(":icons/mono.png")); 265 m_playMono->setIcon(il.load("mono"));
275 connect(m_playMono, SIGNAL(clicked()), this, SLOT(playMonoToggled())); 266 connect(m_playMono, SIGNAL(clicked()), this, SLOT(playMonoToggled()));
276 connect(m_playMono, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); 267 connect(m_playMono, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
277 connect(m_playMono, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); 268 connect(m_playMono, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
278 269
279 QSettings settings; 270 QSettings settings;
462 menu->setTearOffEnabled(true); 453 menu->setTearOffEnabled(true);
463 QToolBar *toolbar = addToolBar(tr("File Toolbar")); 454 QToolBar *toolbar = addToolBar(tr("File Toolbar"));
464 455
465 m_keyReference->setCategory(tr("File and Session Management")); 456 m_keyReference->setCategory(tr("File and Session Management"));
466 457
467 QIcon icon(":icons/filenew.png"); 458 IconLoader il;
468 icon.addFile(":icons/filenew-22.png"); 459
460 QIcon icon = il.load("filenew");
461 icon.addPixmap(il.loadPixmap("filenew-22"));
469 QAction *action = new QAction(icon, tr("&New Session"), this); 462 QAction *action = new QAction(icon, tr("&New Session"), this);
470 action->setShortcut(tr("Ctrl+N")); 463 action->setShortcut(tr("Ctrl+N"));
471 action->setStatusTip(tr("Abandon the current Sonic Visualiser session and start a new one")); 464 action->setStatusTip(tr("Abandon the current Sonic Visualiser session and start a new one"));
472 connect(action, SIGNAL(triggered()), this, SLOT(newSession())); 465 connect(action, SIGNAL(triggered()), this, SLOT(newSession()));
473 m_keyReference->registerShortcut(action); 466 m_keyReference->registerShortcut(action);
474 menu->addAction(action); 467 menu->addAction(action);
475 toolbar->addAction(action); 468 toolbar->addAction(action);
476 469
477 icon = QIcon(":icons/fileopensession.png"); 470 icon = il.load("fileopensession");
478 action = new QAction(icon, tr("&Open Session..."), this); 471 action = new QAction(icon, tr("&Open Session..."), this);
479 action->setShortcut(tr("Ctrl+O")); 472 action->setShortcut(tr("Ctrl+O"));
480 action->setStatusTip(tr("Open a previously saved Sonic Visualiser session file")); 473 action->setStatusTip(tr("Open a previously saved Sonic Visualiser session file"));
481 connect(action, SIGNAL(triggered()), this, SLOT(openSession())); 474 connect(action, SIGNAL(triggered()), this, SLOT(openSession()));
482 m_keyReference->registerShortcut(action); 475 m_keyReference->registerShortcut(action);
483 menu->addAction(action); 476 menu->addAction(action);
484 477
485 icon = QIcon(":icons/fileopen.png"); 478 icon = il.load("fileopen");
486 icon.addFile(":icons/fileopen-22.png"); 479 icon.addPixmap(il.loadPixmap("fileopen-22"));
487 480
488 action = new QAction(icon, tr("&Open..."), this); 481 action = new QAction(icon, tr("&Open..."), this);
489 action->setStatusTip(tr("Open a session file, audio file, or layer")); 482 action->setStatusTip(tr("Open a session file, audio file, or layer"));
490 connect(action, SIGNAL(triggered()), this, SLOT(openSomething())); 483 connect(action, SIGNAL(triggered()), this, SLOT(openSomething()));
491 toolbar->addAction(action); 484 toolbar->addAction(action);
492 485
493 icon = QIcon(":icons/filesave.png"); 486 icon = il.load("filesave");
494 icon.addFile(":icons/filesave-22.png"); 487 icon.addPixmap(il.loadPixmap("filesave-22"));
495 action = new QAction(icon, tr("&Save Session"), this); 488 action = new QAction(icon, tr("&Save Session"), this);
496 action->setShortcut(tr("Ctrl+S")); 489 action->setShortcut(tr("Ctrl+S"));
497 action->setStatusTip(tr("Save the current session into a Sonic Visualiser session file")); 490 action->setStatusTip(tr("Save the current session into a Sonic Visualiser session file"));
498 connect(action, SIGNAL(triggered()), this, SLOT(saveSession())); 491 connect(action, SIGNAL(triggered()), this, SLOT(saveSession()));
499 connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool))); 492 connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool)));
500 m_keyReference->registerShortcut(action); 493 m_keyReference->registerShortcut(action);
501 menu->addAction(action); 494 menu->addAction(action);
502 toolbar->addAction(action); 495 toolbar->addAction(action);
503 496
504 icon = QIcon(":icons/filesaveas.png"); 497 icon = il.load("filesaveas");
505 icon.addFile(":icons/filesaveas-22.png"); 498 icon.addPixmap(il.loadPixmap("filesaveas-22"));
506 action = new QAction(icon, tr("Save Session &As..."), this); 499 action = new QAction(icon, tr("Save Session &As..."), this);
507 action->setStatusTip(tr("Save the current session into a new Sonic Visualiser session file")); 500 action->setStatusTip(tr("Save the current session into a new Sonic Visualiser session file"));
508 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs())); 501 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs()));
509 menu->addAction(action); 502 menu->addAction(action);
510 toolbar->addAction(action); 503 toolbar->addAction(action);
511 504
512 menu->addSeparator(); 505 menu->addSeparator();
513 506
514 icon = QIcon(":icons/fileopenaudio.png"); 507 icon = il.load("fileopenaudio");
515 action = new QAction(icon, tr("&Import Audio File..."), this); 508 action = new QAction(icon, tr("&Import Audio File..."), this);
516 action->setShortcut(tr("Ctrl+I")); 509 action->setShortcut(tr("Ctrl+I"));
517 action->setStatusTip(tr("Import an existing audio file")); 510 action->setStatusTip(tr("Import an existing audio file"));
518 connect(action, SIGNAL(triggered()), this, SLOT(importAudio())); 511 connect(action, SIGNAL(triggered()), this, SLOT(importAudio()));
519 m_keyReference->registerShortcut(action); 512 m_keyReference->registerShortcut(action);
579 action->setStatusTip(tr("Adjust the application preferences")); 572 action->setStatusTip(tr("Adjust the application preferences"));
580 connect(action, SIGNAL(triggered()), this, SLOT(preferences())); 573 connect(action, SIGNAL(triggered()), this, SLOT(preferences()));
581 menu->addAction(action); 574 menu->addAction(action);
582 575
583 menu->addSeparator(); 576 menu->addSeparator();
584 action = new QAction(QIcon(":/icons/exit.png"), 577 action = new QAction(il.load("exit"),
585 tr("&Quit"), this); 578 tr("&Quit"), this);
586 action->setShortcut(tr("Ctrl+Q")); 579 action->setShortcut(tr("Ctrl+Q"));
587 action->setStatusTip(tr("Exit Sonic Visualiser")); 580 action->setStatusTip(tr("Exit Sonic Visualiser"));
588 connect(action, SIGNAL(triggered()), this, SLOT(close())); 581 connect(action, SIGNAL(triggered()), this, SLOT(close()));
589 m_keyReference->registerShortcut(action); 582 m_keyReference->registerShortcut(action);
601 594
602 m_keyReference->setCategory(tr("Editing")); 595 m_keyReference->setCategory(tr("Editing"));
603 596
604 menu->addSeparator(); 597 menu->addSeparator();
605 598
606 QAction *action = new QAction(QIcon(":/icons/editcut.png"), 599 IconLoader il;
600
601 QAction *action = new QAction(il.load("editcut"),
607 tr("Cu&t"), this); 602 tr("Cu&t"), this);
608 action->setShortcut(tr("Ctrl+X")); 603 action->setShortcut(tr("Ctrl+X"));
609 action->setStatusTip(tr("Cut the selection from the current layer to the clipboard")); 604 action->setStatusTip(tr("Cut the selection from the current layer to the clipboard"));
610 connect(action, SIGNAL(triggered()), this, SLOT(cut())); 605 connect(action, SIGNAL(triggered()), this, SLOT(cut()));
611 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool))); 606 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool)));
612 m_keyReference->registerShortcut(action); 607 m_keyReference->registerShortcut(action);
613 menu->addAction(action); 608 menu->addAction(action);
614 m_rightButtonMenu->addAction(action); 609 m_rightButtonMenu->addAction(action);
615 610
616 action = new QAction(QIcon(":/icons/editcopy.png"), 611 action = new QAction(il.load("editcopy"),
617 tr("&Copy"), this); 612 tr("&Copy"), this);
618 action->setShortcut(tr("Ctrl+C")); 613 action->setShortcut(tr("Ctrl+C"));
619 action->setStatusTip(tr("Copy the selection from the current layer to the clipboard")); 614 action->setStatusTip(tr("Copy the selection from the current layer to the clipboard"));
620 connect(action, SIGNAL(triggered()), this, SLOT(copy())); 615 connect(action, SIGNAL(triggered()), this, SLOT(copy()));
621 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool))); 616 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool)));
622 m_keyReference->registerShortcut(action); 617 m_keyReference->registerShortcut(action);
623 menu->addAction(action); 618 menu->addAction(action);
624 m_rightButtonMenu->addAction(action); 619 m_rightButtonMenu->addAction(action);
625 620
626 action = new QAction(QIcon(":/icons/editpaste.png"), 621 action = new QAction(il.load("editpaste"),
627 tr("&Paste"), this); 622 tr("&Paste"), this);
628 action->setShortcut(tr("Ctrl+V")); 623 action->setShortcut(tr("Ctrl+V"));
629 action->setStatusTip(tr("Paste from the clipboard to the current layer")); 624 action->setStatusTip(tr("Paste from the clipboard to the current layer"));
630 connect(action, SIGNAL(triggered()), this, SLOT(paste())); 625 connect(action, SIGNAL(triggered()), this, SLOT(paste()));
631 connect(this, SIGNAL(canPaste(bool)), action, SLOT(setEnabled(bool))); 626 connect(this, SIGNAL(canPaste(bool)), action, SLOT(setEnabled(bool)));
718 713
719 void 714 void
720 MainWindow::setupViewMenu() 715 MainWindow::setupViewMenu()
721 { 716 {
722 if (m_mainMenusCreated) return; 717 if (m_mainMenusCreated) return;
718
719 IconLoader il;
723 720
724 QAction *action = 0; 721 QAction *action = 0;
725 722
726 m_keyReference->setCategory(tr("Panning and Navigation")); 723 m_keyReference->setCategory(tr("Panning and Navigation"));
727 724
761 758
762 menu->addSeparator(); 759 menu->addSeparator();
763 760
764 m_keyReference->setCategory(tr("Zoom")); 761 m_keyReference->setCategory(tr("Zoom"));
765 762
766 action = new QAction(QIcon(":/icons/zoom-in.png"), 763 action = new QAction(il.load("zoom-in"),
767 tr("Zoom &In"), this); 764 tr("Zoom &In"), this);
768 action->setShortcut(tr("Up")); 765 action->setShortcut(tr("Up"));
769 action->setStatusTip(tr("Increase the zoom level")); 766 action->setStatusTip(tr("Increase the zoom level"));
770 connect(action, SIGNAL(triggered()), this, SLOT(zoomIn())); 767 connect(action, SIGNAL(triggered()), this, SLOT(zoomIn()));
771 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); 768 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
772 m_keyReference->registerShortcut(action); 769 m_keyReference->registerShortcut(action);
773 menu->addAction(action); 770 menu->addAction(action);
774 771
775 action = new QAction(QIcon(":/icons/zoom-out.png"), 772 action = new QAction(il.load("zoom-out"),
776 tr("Zoom &Out"), this); 773 tr("Zoom &Out"), this);
777 action->setShortcut(tr("Down")); 774 action->setShortcut(tr("Down"));
778 action->setStatusTip(tr("Decrease the zoom level")); 775 action->setStatusTip(tr("Decrease the zoom level"));
779 connect(action, SIGNAL(triggered()), this, SLOT(zoomOut())); 776 connect(action, SIGNAL(triggered()), this, SLOT(zoomOut()));
780 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); 777 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
785 action->setStatusTip(tr("Restore the zoom level to the default")); 782 action->setStatusTip(tr("Restore the zoom level to the default"));
786 connect(action, SIGNAL(triggered()), this, SLOT(zoomDefault())); 783 connect(action, SIGNAL(triggered()), this, SLOT(zoomDefault()));
787 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); 784 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
788 menu->addAction(action); 785 menu->addAction(action);
789 786
790 action = new QAction(QIcon(":/icons/zoom-fit.png"), 787 action = new QAction(il.load("zoom-fit"),
791 tr("Zoom to &Fit"), this); 788 tr("Zoom to &Fit"), this);
792 action->setShortcut(tr("F")); 789 action->setShortcut(tr("F"));
793 action->setStatusTip(tr("Zoom to show the whole file")); 790 action->setStatusTip(tr("Zoom to show the whole file"));
794 connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit())); 791 connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit()));
795 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); 792 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
907 m_layerMenu->setTearOffEnabled(true); 904 m_layerMenu->setTearOffEnabled(true);
908 } 905 }
909 906
910 QMenu *menu = m_paneMenu; 907 QMenu *menu = m_paneMenu;
911 908
909 IconLoader il;
910
912 m_keyReference->setCategory(tr("Managing Panes and Layers")); 911 m_keyReference->setCategory(tr("Managing Panes and Layers"));
913 912
914 QAction *action = new QAction(QIcon(":/icons/pane.png"), tr("Add &New Pane"), this); 913 QAction *action = new QAction(il.load("pane"), tr("Add &New Pane"), this);
915 action->setShortcut(tr("N")); 914 action->setShortcut(tr("N"));
916 action->setStatusTip(tr("Add a new pane containing only a time ruler")); 915 action->setStatusTip(tr("Add a new pane containing only a time ruler"));
917 connect(action, SIGNAL(triggered()), this, SLOT(addPane())); 916 connect(action, SIGNAL(triggered()), this, SLOT(addPane()));
918 connect(this, SIGNAL(canAddPane(bool)), action, SLOT(setEnabled(bool))); 917 connect(this, SIGNAL(canAddPane(bool)), action, SLOT(setEnabled(bool)));
919 m_paneActions[action] = PaneConfiguration(LayerFactory::TimeRuler); 918 m_paneActions[action] = PaneConfiguration(LayerFactory::TimeRuler);
935 QIcon icon; 934 QIcon icon;
936 QString mainText, tipText, channelText; 935 QString mainText, tipText, channelText;
937 LayerFactory::LayerType type = *i; 936 LayerFactory::LayerType type = *i;
938 QString name = LayerFactory::getInstance()->getLayerPresentationName(type); 937 QString name = LayerFactory::getInstance()->getLayerPresentationName(type);
939 938
940 icon = QIcon(QString(":/icons/%1.png") 939 icon = il.load(LayerFactory::getInstance()->getLayerIconName(type));
941 .arg(LayerFactory::getInstance()->getLayerIconName(type)));
942 940
943 mainText = tr("Add New %1 Layer").arg(name); 941 mainText = tr("Add New %1 Layer").arg(name);
944 tipText = tr("Add a new empty layer of type %1").arg(name); 942 tipText = tr("Add a new empty layer of type %1").arg(name);
945 943
946 action = new QAction(icon, mainText, this); 944 action = new QAction(icon, mainText, this);
992 bool mono = true; 990 bool mono = true;
993 991
994 switch (type) { 992 switch (type) {
995 993
996 case LayerFactory::Waveform: 994 case LayerFactory::Waveform:
997 icon = QIcon(":/icons/waveform.png"); 995 icon = il.load("waveform");
998 mainText = tr("Add &Waveform"); 996 mainText = tr("Add &Waveform");
999 if (menuType == 0) { 997 if (menuType == 0) {
1000 shortcutText = tr("W"); 998 shortcutText = tr("W");
1001 tipText = tr("Add a new pane showing a waveform view"); 999 tipText = tr("Add a new pane showing a waveform view");
1002 } else { 1000 } else {
1004 } 1002 }
1005 mono = false; 1003 mono = false;
1006 break; 1004 break;
1007 1005
1008 case LayerFactory::Spectrogram: 1006 case LayerFactory::Spectrogram:
1009 icon = QIcon(":/icons/spectrogram.png"); 1007 icon = il.load("spectrogram");
1010 mainText = tr("Add Spectro&gram"); 1008 mainText = tr("Add Spectro&gram");
1011 if (menuType == 0) { 1009 if (menuType == 0) {
1012 shortcutText = tr("G"); 1010 shortcutText = tr("G");
1013 tipText = tr("Add a new pane showing a spectrogram"); 1011 tipText = tr("Add a new pane showing a spectrogram");
1014 } else { 1012 } else {
1015 tipText = tr("Add a new layer showing a spectrogram"); 1013 tipText = tr("Add a new layer showing a spectrogram");
1016 } 1014 }
1017 break; 1015 break;
1018 1016
1019 case LayerFactory::MelodicRangeSpectrogram: 1017 case LayerFactory::MelodicRangeSpectrogram:
1020 icon = QIcon(":/icons/spectrogram.png"); 1018 icon = il.load("spectrogram");
1021 mainText = tr("Add &Melodic Range Spectrogram"); 1019 mainText = tr("Add &Melodic Range Spectrogram");
1022 if (menuType == 0) { 1020 if (menuType == 0) {
1023 shortcutText = tr("M"); 1021 shortcutText = tr("M");
1024 tipText = tr("Add a new pane showing a spectrogram set up for an overview of note pitches"); 1022 tipText = tr("Add a new pane showing a spectrogram set up for an overview of note pitches");
1025 } else { 1023 } else {
1026 tipText = tr("Add a new layer showing a spectrogram set up for an overview of note pitches"); 1024 tipText = tr("Add a new layer showing a spectrogram set up for an overview of note pitches");
1027 } 1025 }
1028 break; 1026 break;
1029 1027
1030 case LayerFactory::PeakFrequencySpectrogram: 1028 case LayerFactory::PeakFrequencySpectrogram:
1031 icon = QIcon(":/icons/spectrogram.png"); 1029 icon = il.load("spectrogram");
1032 mainText = tr("Add Pea&k Frequency Spectrogram"); 1030 mainText = tr("Add Pea&k Frequency Spectrogram");
1033 if (menuType == 0) { 1031 if (menuType == 0) {
1034 shortcutText = tr("K"); 1032 shortcutText = tr("K");
1035 tipText = tr("Add a new pane showing a spectrogram set up for tracking frequencies"); 1033 tipText = tr("Add a new pane showing a spectrogram set up for tracking frequencies");
1036 } else { 1034 } else {
1037 tipText = tr("Add a new layer showing a spectrogram set up for tracking frequencies"); 1035 tipText = tr("Add a new layer showing a spectrogram set up for tracking frequencies");
1038 } 1036 }
1039 break; 1037 break;
1040 1038
1041 case LayerFactory::Spectrum: 1039 case LayerFactory::Spectrum:
1042 icon = QIcon(":/icons/spectrum.png"); 1040 icon = il.load("spectrum");
1043 mainText = tr("Add Spectr&um"); 1041 mainText = tr("Add Spectr&um");
1044 if (menuType == 0) { 1042 if (menuType == 0) {
1045 shortcutText = tr("U"); 1043 shortcutText = tr("U");
1046 tipText = tr("Add a new pane showing a frequency spectrum"); 1044 tipText = tr("Add a new pane showing a frequency spectrum");
1047 } else { 1045 } else {
1176 1174
1177 menu = m_paneMenu; 1175 menu = m_paneMenu;
1178 1176
1179 menu->addSeparator(); 1177 menu->addSeparator();
1180 1178
1181 action = new QAction(QIcon(":/icons/editdelete.png"), tr("&Delete Pane"), this); 1179 action = new QAction(il.load("editdelete"), tr("&Delete Pane"), this);
1182 action->setShortcut(tr("Ctrl+Shift+D")); 1180 action->setShortcut(tr("Ctrl+Shift+D"));
1183 action->setStatusTip(tr("Delete the currently active pane")); 1181 action->setStatusTip(tr("Delete the currently active pane"));
1184 connect(action, SIGNAL(triggered()), this, SLOT(deleteCurrentPane())); 1182 connect(action, SIGNAL(triggered()), this, SLOT(deleteCurrentPane()));
1185 connect(this, SIGNAL(canDeleteCurrentPane(bool)), action, SLOT(setEnabled(bool))); 1183 connect(this, SIGNAL(canDeleteCurrentPane(bool)), action, SLOT(setEnabled(bool)));
1186 m_keyReference->registerShortcut(action); 1184 m_keyReference->registerShortcut(action);
1187 menu->addAction(action); 1185 menu->addAction(action);
1188 1186
1189 menu = m_layerMenu; 1187 menu = m_layerMenu;
1190 1188
1191 action = new QAction(QIcon(":/icons/timeruler.png"), tr("Add &Time Ruler"), this); 1189 action = new QAction(il.load("timeruler"), tr("Add &Time Ruler"), this);
1192 action->setStatusTip(tr("Add a new layer showing a time ruler")); 1190 action->setStatusTip(tr("Add a new layer showing a time ruler"));
1193 connect(action, SIGNAL(triggered()), this, SLOT(addLayer())); 1191 connect(action, SIGNAL(triggered()), this, SLOT(addLayer()));
1194 connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool))); 1192 connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool)));
1195 m_layerActions[action] = LayerFactory::TimeRuler; 1193 m_layerActions[action] = LayerFactory::TimeRuler;
1196 menu->addAction(action); 1194 menu->addAction(action);
1216 connect(raction, SIGNAL(triggered()), this, SLOT(renameCurrentLayer())); 1214 connect(raction, SIGNAL(triggered()), this, SLOT(renameCurrentLayer()));
1217 connect(this, SIGNAL(canRenameLayer(bool)), raction, SLOT(setEnabled(bool))); 1215 connect(this, SIGNAL(canRenameLayer(bool)), raction, SLOT(setEnabled(bool)));
1218 menu->addAction(raction); 1216 menu->addAction(raction);
1219 m_rightButtonLayerMenu->addAction(raction); 1217 m_rightButtonLayerMenu->addAction(raction);
1220 1218
1221 action = new QAction(QIcon(":/icons/editdelete.png"), tr("&Delete Layer"), this); 1219 action = new QAction(il.load("editdelete"), tr("&Delete Layer"), this);
1222 action->setShortcut(tr("Ctrl+D")); 1220 action->setShortcut(tr("Ctrl+D"));
1223 action->setStatusTip(tr("Delete the currently active layer")); 1221 action->setStatusTip(tr("Delete the currently active layer"));
1224 connect(action, SIGNAL(triggered()), this, SLOT(deleteCurrentLayer())); 1222 connect(action, SIGNAL(triggered()), this, SLOT(deleteCurrentLayer()));
1225 connect(this, SIGNAL(canDeleteCurrentLayer(bool)), action, SLOT(setEnabled(bool))); 1223 connect(this, SIGNAL(canDeleteCurrentLayer(bool)), action, SLOT(setEnabled(bool)));
1226 m_keyReference->registerShortcut(action); 1224 m_keyReference->registerShortcut(action);
1439 QMenu *menu = menuBar()->addMenu(tr("&Help")); 1437 QMenu *menu = menuBar()->addMenu(tr("&Help"));
1440 menu->setTearOffEnabled(true); 1438 menu->setTearOffEnabled(true);
1441 1439
1442 m_keyReference->setCategory(tr("Help")); 1440 m_keyReference->setCategory(tr("Help"));
1443 1441
1444 QAction *action = new QAction(QIcon(":icons/help.png"), 1442 IconLoader il;
1443
1444 QAction *action = new QAction(il.load("help"),
1445 tr("&Help Reference"), this); 1445 tr("&Help Reference"), this);
1446 action->setShortcut(tr("F1")); 1446 action->setShortcut(tr("F1"));
1447 action->setStatusTip(tr("Open the Sonic Visualiser reference manual")); 1447 action->setStatusTip(tr("Open the Sonic Visualiser reference manual"));
1448 connect(action, SIGNAL(triggered()), this, SLOT(help())); 1448 connect(action, SIGNAL(triggered()), this, SLOT(help()));
1449 m_keyReference->registerShortcut(action); 1449 m_keyReference->registerShortcut(action);
1522 m_existingLayerActions.clear(); 1522 m_existingLayerActions.clear();
1523 1523
1524 m_sliceMenu->clear(); 1524 m_sliceMenu->clear();
1525 m_sliceActions.clear(); 1525 m_sliceActions.clear();
1526 1526
1527 IconLoader il;
1528
1527 vector<Layer *> orderedLayers; 1529 vector<Layer *> orderedLayers;
1528 set<Layer *> observedLayers; 1530 set<Layer *> observedLayers;
1529 set<Layer *> sliceableLayers; 1531 set<Layer *> sliceableLayers;
1530 1532
1531 LayerFactory *factory = LayerFactory::getInstance(); 1533 LayerFactory *factory = LayerFactory::getInstance();
1564 1566
1565 QString name = layer->getLayerPresentationName(); 1567 QString name = layer->getLayerPresentationName();
1566 int n = ++observedNames[name]; 1568 int n = ++observedNames[name];
1567 if (n > 1) name = QString("%1 <%2>").arg(name).arg(n); 1569 if (n > 1) name = QString("%1 <%2>").arg(name).arg(n);
1568 1570
1569 QIcon icon = QIcon(QString(":/icons/%1.png") 1571 QIcon icon = il.load(factory->getLayerIconName
1570 .arg(factory->getLayerIconName 1572 (factory->getLayerType(layer)));
1571 (factory->getLayerType(layer))));
1572 1573
1573 QAction *action = new QAction(icon, name, this); 1574 QAction *action = new QAction(icon, name, this);
1574 connect(action, SIGNAL(triggered()), this, SLOT(addLayer())); 1575 connect(action, SIGNAL(triggered()), this, SLOT(addLayer()));
1575 connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool))); 1576 connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool)));
1576 m_existingLayerActions[action] = layer; 1577 m_existingLayerActions[action] = layer;
1592 void 1593 void
1593 MainWindow::setupToolbars() 1594 MainWindow::setupToolbars()
1594 { 1595 {
1595 m_keyReference->setCategory(tr("Playback and Transport Controls")); 1596 m_keyReference->setCategory(tr("Playback and Transport Controls"));
1596 1597
1598 IconLoader il;
1599
1597 QMenu *menu = m_playbackMenu = menuBar()->addMenu(tr("Play&back")); 1600 QMenu *menu = m_playbackMenu = menuBar()->addMenu(tr("Play&back"));
1598 menu->setTearOffEnabled(true); 1601 menu->setTearOffEnabled(true);
1599 m_rightButtonMenu->addSeparator(); 1602 m_rightButtonMenu->addSeparator();
1600 m_rightButtonPlaybackMenu = m_rightButtonMenu->addMenu(tr("Playback")); 1603 m_rightButtonPlaybackMenu = m_rightButtonMenu->addMenu(tr("Playback"));
1601 1604
1602 QToolBar *toolbar = addToolBar(tr("Playback Toolbar")); 1605 QToolBar *toolbar = addToolBar(tr("Playback Toolbar"));
1603 1606
1604 QAction *rwdStartAction = toolbar->addAction(QIcon(":/icons/rewind-start.png"), 1607 QAction *rwdStartAction = toolbar->addAction(il.load("rewind-start"),
1605 tr("Rewind to Start")); 1608 tr("Rewind to Start"));
1606 rwdStartAction->setShortcut(tr("Home")); 1609 rwdStartAction->setShortcut(tr("Home"));
1607 rwdStartAction->setStatusTip(tr("Rewind to the start")); 1610 rwdStartAction->setStatusTip(tr("Rewind to the start"));
1608 connect(rwdStartAction, SIGNAL(triggered()), this, SLOT(rewindStart())); 1611 connect(rwdStartAction, SIGNAL(triggered()), this, SLOT(rewindStart()));
1609 connect(this, SIGNAL(canPlay(bool)), rwdStartAction, SLOT(setEnabled(bool))); 1612 connect(this, SIGNAL(canPlay(bool)), rwdStartAction, SLOT(setEnabled(bool)));
1610 1613
1611 QAction *m_rwdAction = toolbar->addAction(QIcon(":/icons/rewind.png"), 1614 QAction *m_rwdAction = toolbar->addAction(il.load("rewind"),
1612 tr("Rewind")); 1615 tr("Rewind"));
1613 m_rwdAction->setShortcut(tr("PgUp")); 1616 m_rwdAction->setShortcut(tr("PgUp"));
1614 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant or time ruler notch")); 1617 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant or time ruler notch"));
1615 connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind())); 1618 connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind()));
1616 connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool))); 1619 connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool)));
1617 1620
1618 QAction *playAction = toolbar->addAction(QIcon(":/icons/playpause.png"), 1621 QAction *playAction = toolbar->addAction(il.load("playpause"),
1619 tr("Play / Pause")); 1622 tr("Play / Pause"));
1620 playAction->setCheckable(true); 1623 playAction->setCheckable(true);
1621 playAction->setShortcut(tr("Space")); 1624 playAction->setShortcut(tr("Space"));
1622 playAction->setStatusTip(tr("Start or stop playback from the current position")); 1625 playAction->setStatusTip(tr("Start or stop playback from the current position"));
1623 connect(playAction, SIGNAL(triggered()), this, SLOT(play())); 1626 connect(playAction, SIGNAL(triggered()), this, SLOT(play()));
1624 connect(m_playSource, SIGNAL(playStatusChanged(bool)), 1627 connect(m_playSource, SIGNAL(playStatusChanged(bool)),
1625 playAction, SLOT(setChecked(bool))); 1628 playAction, SLOT(setChecked(bool)));
1626 connect(this, SIGNAL(canPlay(bool)), playAction, SLOT(setEnabled(bool))); 1629 connect(this, SIGNAL(canPlay(bool)), playAction, SLOT(setEnabled(bool)));
1627 1630
1628 m_ffwdAction = toolbar->addAction(QIcon(":/icons/ffwd.png"), 1631 m_ffwdAction = toolbar->addAction(il.load("ffwd"),
1629 tr("Fast Forward")); 1632 tr("Fast Forward"));
1630 m_ffwdAction->setShortcut(tr("PgDown")); 1633 m_ffwdAction->setShortcut(tr("PgDown"));
1631 m_ffwdAction->setStatusTip(tr("Fast-forward to the next time instant or time ruler notch")); 1634 m_ffwdAction->setStatusTip(tr("Fast-forward to the next time instant or time ruler notch"));
1632 connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd())); 1635 connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd()));
1633 connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool))); 1636 connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool)));
1634 1637
1635 QAction *ffwdEndAction = toolbar->addAction(QIcon(":/icons/ffwd-end.png"), 1638 QAction *ffwdEndAction = toolbar->addAction(il.load("ffwd-end"),
1636 tr("Fast Forward to End")); 1639 tr("Fast Forward to End"));
1637 ffwdEndAction->setShortcut(tr("End")); 1640 ffwdEndAction->setShortcut(tr("End"));
1638 ffwdEndAction->setStatusTip(tr("Fast-forward to the end")); 1641 ffwdEndAction->setStatusTip(tr("Fast-forward to the end"));
1639 connect(ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd())); 1642 connect(ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd()));
1640 connect(this, SIGNAL(canPlay(bool)), ffwdEndAction, SLOT(setEnabled(bool))); 1643 connect(this, SIGNAL(canPlay(bool)), ffwdEndAction, SLOT(setEnabled(bool)));
1641 1644
1642 toolbar = addToolBar(tr("Play Mode Toolbar")); 1645 toolbar = addToolBar(tr("Play Mode Toolbar"));
1643 1646
1644 QAction *psAction = toolbar->addAction(QIcon(":/icons/playselection.png"), 1647 QAction *psAction = toolbar->addAction(il.load("playselection"),
1645 tr("Constrain Playback to Selection")); 1648 tr("Constrain Playback to Selection"));
1646 psAction->setCheckable(true); 1649 psAction->setCheckable(true);
1647 psAction->setChecked(m_viewManager->getPlaySelectionMode()); 1650 psAction->setChecked(m_viewManager->getPlaySelectionMode());
1648 psAction->setShortcut(tr("s")); 1651 psAction->setShortcut(tr("s"));
1649 psAction->setStatusTip(tr("Constrain playback to the selected regions")); 1652 psAction->setStatusTip(tr("Constrain playback to the selected regions"));
1650 connect(m_viewManager, SIGNAL(playSelectionModeChanged(bool)), 1653 connect(m_viewManager, SIGNAL(playSelectionModeChanged(bool)),
1651 psAction, SLOT(setChecked(bool))); 1654 psAction, SLOT(setChecked(bool)));
1652 connect(psAction, SIGNAL(triggered()), this, SLOT(playSelectionToggled())); 1655 connect(psAction, SIGNAL(triggered()), this, SLOT(playSelectionToggled()));
1653 connect(this, SIGNAL(canPlaySelection(bool)), psAction, SLOT(setEnabled(bool))); 1656 connect(this, SIGNAL(canPlaySelection(bool)), psAction, SLOT(setEnabled(bool)));
1654 1657
1655 QAction *plAction = toolbar->addAction(QIcon(":/icons/playloop.png"), 1658 QAction *plAction = toolbar->addAction(il.load("playloop"),
1656 tr("Loop Playback")); 1659 tr("Loop Playback"));
1657 plAction->setCheckable(true); 1660 plAction->setCheckable(true);
1658 plAction->setChecked(m_viewManager->getPlayLoopMode()); 1661 plAction->setChecked(m_viewManager->getPlayLoopMode());
1659 plAction->setShortcut(tr("l")); 1662 plAction->setShortcut(tr("l"));
1660 plAction->setStatusTip(tr("Loop playback")); 1663 plAction->setStatusTip(tr("Loop playback"));
1725 m_keyReference->setCategory(tr("Tool Selection")); 1728 m_keyReference->setCategory(tr("Tool Selection"));
1726 1729
1727 toolbar = addToolBar(tr("Tools Toolbar")); 1730 toolbar = addToolBar(tr("Tools Toolbar"));
1728 QActionGroup *group = new QActionGroup(this); 1731 QActionGroup *group = new QActionGroup(this);
1729 1732
1730 QAction *action = toolbar->addAction(QIcon(":/icons/navigate.png"), 1733 QAction *action = toolbar->addAction(il.load("navigate"),
1731 tr("Navigate")); 1734 tr("Navigate"));
1732 action->setCheckable(true); 1735 action->setCheckable(true);
1733 action->setChecked(true); 1736 action->setChecked(true);
1734 action->setShortcut(tr("1")); 1737 action->setShortcut(tr("1"));
1735 action->setStatusTip(tr("Navigate")); 1738 action->setStatusTip(tr("Navigate"));
1736 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected())); 1739 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected()));
1737 group->addAction(action); 1740 group->addAction(action);
1738 m_keyReference->registerShortcut(action); 1741 m_keyReference->registerShortcut(action);
1739 m_toolActions[ViewManager::NavigateMode] = action; 1742 m_toolActions[ViewManager::NavigateMode] = action;
1740 1743
1741 action = toolbar->addAction(QIcon(":/icons/select.png"), 1744 action = toolbar->addAction(il.load("select"),
1742 tr("Select")); 1745 tr("Select"));
1743 action->setCheckable(true); 1746 action->setCheckable(true);
1744 action->setShortcut(tr("2")); 1747 action->setShortcut(tr("2"));
1745 action->setStatusTip(tr("Select ranges")); 1748 action->setStatusTip(tr("Select ranges"));
1746 connect(action, SIGNAL(triggered()), this, SLOT(toolSelectSelected())); 1749 connect(action, SIGNAL(triggered()), this, SLOT(toolSelectSelected()));
1747 group->addAction(action); 1750 group->addAction(action);
1748 m_keyReference->registerShortcut(action); 1751 m_keyReference->registerShortcut(action);
1749 m_toolActions[ViewManager::SelectMode] = action; 1752 m_toolActions[ViewManager::SelectMode] = action;
1750 1753
1751 action = toolbar->addAction(QIcon(":/icons/move.png"), 1754 action = toolbar->addAction(il.load("move"),
1752 tr("Edit")); 1755 tr("Edit"));
1753 action->setCheckable(true); 1756 action->setCheckable(true);
1754 action->setShortcut(tr("3")); 1757 action->setShortcut(tr("3"));
1755 action->setStatusTip(tr("Edit items in layer")); 1758 action->setStatusTip(tr("Edit items in layer"));
1756 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected())); 1759 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected()));
1757 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); 1760 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
1758 group->addAction(action); 1761 group->addAction(action);
1759 m_keyReference->registerShortcut(action); 1762 m_keyReference->registerShortcut(action);
1760 m_toolActions[ViewManager::EditMode] = action; 1763 m_toolActions[ViewManager::EditMode] = action;
1761 1764
1762 action = toolbar->addAction(QIcon(":/icons/draw.png"), 1765 action = toolbar->addAction(il.load("draw"),
1763 tr("Draw")); 1766 tr("Draw"));
1764 action->setCheckable(true); 1767 action->setCheckable(true);
1765 action->setShortcut(tr("4")); 1768 action->setShortcut(tr("4"));
1766 action->setStatusTip(tr("Draw new items in layer")); 1769 action->setStatusTip(tr("Draw new items in layer"));
1767 connect(action, SIGNAL(triggered()), this, SLOT(toolDrawSelected())); 1770 connect(action, SIGNAL(triggered()), this, SLOT(toolDrawSelected()));
1768 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); 1771 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
1769 group->addAction(action); 1772 group->addAction(action);
1770 m_keyReference->registerShortcut(action); 1773 m_keyReference->registerShortcut(action);
1771 m_toolActions[ViewManager::DrawMode] = action; 1774 m_toolActions[ViewManager::DrawMode] = action;
1772 1775
1773 action = toolbar->addAction(QIcon(":/icons/measure.png"), 1776 action = toolbar->addAction(il.load("measure"),
1774 tr("Measure")); 1777 tr("Measure"));
1775 action->setCheckable(true); 1778 action->setCheckable(true);
1776 action->setShortcut(tr("5")); 1779 action->setShortcut(tr("5"));
1777 action->setStatusTip(tr("Make measurements in layer")); 1780 action->setStatusTip(tr("Make measurements in layer"));
1778 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected())); 1781 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected()));
1779 group->addAction(action); 1782 group->addAction(action);
1780 m_keyReference->registerShortcut(action); 1783 m_keyReference->registerShortcut(action);
1781 m_toolActions[ViewManager::MeasureMode] = action; 1784 m_toolActions[ViewManager::MeasureMode] = action;
1782 1785
1783 // action = toolbar->addAction(QIcon(":/icons/text.png"), 1786 // action = toolbar->addAction(il.load("text"),
1784 // tr("Text")); 1787 // tr("Text"));
1785 // action->setCheckable(true); 1788 // action->setCheckable(true);
1786 // action->setShortcut(tr("5")); 1789 // action->setShortcut(tr("5"));
1787 // connect(action, SIGNAL(triggered()), this, SLOT(toolTextSelected())); 1790 // connect(action, SIGNAL(triggered()), this, SLOT(toolTextSelected()));
1788 // group->addAction(action); 1791 // group->addAction(action);