Mercurial > hg > tony
comparison src/MainWindow.cpp @ 405:7d97da3c744e
Replace mute toggles as well
author | Chris Cannam |
---|---|
date | Tue, 24 Mar 2015 15:48:25 +0000 |
parents | 51a51a174fe7 |
children | 762ea5130a2c |
comparison
equal
deleted
inserted
replaced
404:51a51a174fe7 | 405:7d97da3c744e |
---|---|
240 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | 240 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); |
241 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 241 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
242 | 242 |
243 m_audioLPW = new LevelPanWidget(frame); | 243 m_audioLPW = new LevelPanWidget(frame); |
244 m_audioLPW->setObjectName(tr("Audio Track Level and Pan")); | 244 m_audioLPW->setObjectName(tr("Audio Track Level and Pan")); |
245 m_audioLPW->setPan(-1); | |
246 connect(m_audioLPW, SIGNAL(levelChanged(float)), this, SLOT(audioGainChanged(float))); | 245 connect(m_audioLPW, SIGNAL(levelChanged(float)), this, SLOT(audioGainChanged(float))); |
247 connect(m_audioLPW, SIGNAL(panChanged(float)), this, SLOT(audioPanChanged(float))); | 246 connect(m_audioLPW, SIGNAL(panChanged(float)), this, SLOT(audioPanChanged(float))); |
248 | 247 |
249 if (m_withSonification) { | 248 if (m_withSonification) { |
250 | 249 |
251 m_pitchLPW = new LevelPanWidget(frame); | 250 m_pitchLPW = new LevelPanWidget(frame); |
252 m_pitchLPW->setObjectName(tr("Pitch Track Level and Pan")); | 251 m_pitchLPW->setObjectName(tr("Pitch Track Level and Pan")); |
253 m_pitchLPW->setPan(1); | |
254 connect(m_pitchLPW, SIGNAL(levelChanged(float)), this, SLOT(pitchGainChanged(float))); | 252 connect(m_pitchLPW, SIGNAL(levelChanged(float)), this, SLOT(pitchGainChanged(float))); |
255 connect(m_pitchLPW, SIGNAL(panChanged(float)), this, SLOT(pitchPanChanged(float))); | 253 connect(m_pitchLPW, SIGNAL(panChanged(float)), this, SLOT(pitchPanChanged(float))); |
256 | 254 |
257 m_notesLPW = new LevelPanWidget(frame); | 255 m_notesLPW = new LevelPanWidget(frame); |
258 m_notesLPW->setObjectName(tr("Note Track Level and Pan")); | 256 m_notesLPW->setObjectName(tr("Note Track Level and Pan")); |
259 m_notesLPW->setPan(1); | |
260 connect(m_notesLPW, SIGNAL(levelChanged(float)), this, SLOT(notesGainChanged(float))); | 257 connect(m_notesLPW, SIGNAL(levelChanged(float)), this, SLOT(notesGainChanged(float))); |
261 connect(m_notesLPW, SIGNAL(panChanged(float)), this, SLOT(notesPanChanged(float))); | 258 connect(m_notesLPW, SIGNAL(panChanged(float)), this, SLOT(notesPanChanged(float))); |
262 } | 259 } |
263 | 260 |
264 layout->setSpacing(4); | 261 layout->setSpacing(4); |
1075 m_showAudio = toolbar->addAction(il.load("waveform"), tr("Show Audio")); | 1072 m_showAudio = toolbar->addAction(il.load("waveform"), tr("Show Audio")); |
1076 m_showAudio->setCheckable(true); | 1073 m_showAudio->setCheckable(true); |
1077 connect(m_showAudio, SIGNAL(triggered()), this, SLOT(showAudioToggled())); | 1074 connect(m_showAudio, SIGNAL(triggered()), this, SLOT(showAudioToggled())); |
1078 connect(this, SIGNAL(canPlay(bool)), m_showAudio, SLOT(setEnabled(bool))); | 1075 connect(this, SIGNAL(canPlay(bool)), m_showAudio, SLOT(setEnabled(bool))); |
1079 | 1076 |
1080 m_playAudio = toolbar->addAction(il.load("speaker"), tr("Play Audio")); | 1077 int lpwSize = m_viewManager->scalePixelSize(30); |
1081 m_playAudio->setCheckable(true); | 1078 |
1082 connect(m_playAudio, SIGNAL(triggered()), this, SLOT(playAudioToggled())); | 1079 m_audioLPW->setFixedWidth(lpwSize); |
1083 connect(this, SIGNAL(canPlayWaveform(bool)), m_playAudio, SLOT(setEnabled(bool))); | 1080 m_audioLPW->setFixedHeight(lpwSize); |
1084 | |
1085 m_audioLPW->setFixedWidth(60); | |
1086 m_audioLPW->setFixedHeight(60); | |
1087 toolbar->addWidget(m_audioLPW); | 1081 toolbar->addWidget(m_audioLPW); |
1088 | 1082 |
1089 // Pitch (f0) | 1083 // Pitch (f0) |
1090 QLabel *spacer = new QLabel; // blank | 1084 QLabel *spacer = new QLabel; // blank |
1091 spacer->setFixedWidth(40); | 1085 spacer->setFixedWidth(40); |
1094 m_showPitch = toolbar->addAction(il.load("values"), tr("Show Pitch Track")); | 1088 m_showPitch = toolbar->addAction(il.load("values"), tr("Show Pitch Track")); |
1095 m_showPitch->setCheckable(true); | 1089 m_showPitch->setCheckable(true); |
1096 connect(m_showPitch, SIGNAL(triggered()), this, SLOT(showPitchToggled())); | 1090 connect(m_showPitch, SIGNAL(triggered()), this, SLOT(showPitchToggled())); |
1097 connect(this, SIGNAL(canPlay(bool)), m_showPitch, SLOT(setEnabled(bool))); | 1091 connect(this, SIGNAL(canPlay(bool)), m_showPitch, SLOT(setEnabled(bool))); |
1098 | 1092 |
1099 if (!m_withSonification) { | 1093 if (m_withSonification) { |
1100 m_playPitch = new QAction(tr("Play Pitch Track"), this); | 1094 m_pitchLPW->setFixedWidth(lpwSize); |
1101 } else { | 1095 m_pitchLPW->setFixedHeight(lpwSize); |
1102 m_playPitch = toolbar->addAction(il.load("speaker"), tr("Play Pitch Track")); | |
1103 m_pitchLPW->setFixedWidth(60); | |
1104 m_pitchLPW->setFixedHeight(60); | |
1105 toolbar->addWidget(m_pitchLPW); | 1096 toolbar->addWidget(m_pitchLPW); |
1106 } | 1097 } |
1107 | |
1108 m_playPitch->setCheckable(true); | |
1109 connect(m_playPitch, SIGNAL(triggered()), this, SLOT(playPitchToggled())); | |
1110 connect(this, SIGNAL(canPlayPitch(bool)), m_playPitch, SLOT(setEnabled(bool))); | |
1111 | 1098 |
1112 // Notes | 1099 // Notes |
1113 spacer = new QLabel; | 1100 spacer = new QLabel; |
1114 spacer->setFixedWidth(40); | 1101 spacer->setFixedWidth(40); |
1115 toolbar->addWidget(spacer); | 1102 toolbar->addWidget(spacer); |
1117 m_showNotes = toolbar->addAction(il.load("notes"), tr("Show Notes")); | 1104 m_showNotes = toolbar->addAction(il.load("notes"), tr("Show Notes")); |
1118 m_showNotes->setCheckable(true); | 1105 m_showNotes->setCheckable(true); |
1119 connect(m_showNotes, SIGNAL(triggered()), this, SLOT(showNotesToggled())); | 1106 connect(m_showNotes, SIGNAL(triggered()), this, SLOT(showNotesToggled())); |
1120 connect(this, SIGNAL(canPlay(bool)), m_showNotes, SLOT(setEnabled(bool))); | 1107 connect(this, SIGNAL(canPlay(bool)), m_showNotes, SLOT(setEnabled(bool))); |
1121 | 1108 |
1122 if (!m_withSonification) | 1109 if (m_withSonification) { |
1123 { | 1110 m_notesLPW->setFixedWidth(lpwSize); |
1124 m_playNotes = new QAction(tr("Play Notes"), this); | 1111 m_notesLPW->setFixedHeight(lpwSize); |
1125 } else { | |
1126 m_playNotes = toolbar->addAction(il.load("speaker"), tr("Play Notes")); | |
1127 m_notesLPW->setFixedWidth(60); | |
1128 m_notesLPW->setFixedHeight(60); | |
1129 toolbar->addWidget(m_notesLPW); | 1112 toolbar->addWidget(m_notesLPW); |
1130 } | 1113 } |
1131 m_playNotes->setCheckable(true); | |
1132 connect(m_playNotes, SIGNAL(triggered()), this, SLOT(playNotesToggled())); | |
1133 connect(this, SIGNAL(canPlayNotes(bool)), m_playNotes, SLOT(setEnabled(bool))); | |
1134 | 1114 |
1135 // Spectrogram | 1115 // Spectrogram |
1136 spacer = new QLabel; | 1116 spacer = new QLabel; |
1137 spacer->setFixedWidth(40); | 1117 spacer->setFixedWidth(40); |
1138 toolbar->addWidget(spacer); | 1118 toolbar->addWidget(spacer); |
1147 connect(m_showSpect, SIGNAL(triggered()), this, SLOT(showSpectToggled())); | 1127 connect(m_showSpect, SIGNAL(triggered()), this, SLOT(showSpectToggled())); |
1148 connect(this, SIGNAL(canPlay(bool)), m_showSpect, SLOT(setEnabled(bool))); | 1128 connect(this, SIGNAL(canPlay(bool)), m_showSpect, SLOT(setEnabled(bool))); |
1149 | 1129 |
1150 Pane::registerShortcuts(*m_keyReference); | 1130 Pane::registerShortcuts(*m_keyReference); |
1151 | 1131 |
1132 updateLayerStatuses(); | |
1152 } | 1133 } |
1153 | 1134 |
1154 | 1135 |
1155 void | 1136 void |
1156 MainWindow::moveOneNoteRight() | 1137 MainWindow::moveOneNoteRight() |
1350 void | 1331 void |
1351 MainWindow::showAudioToggled() | 1332 MainWindow::showAudioToggled() |
1352 { | 1333 { |
1353 m_analyser->toggleVisible(Analyser::Audio); | 1334 m_analyser->toggleVisible(Analyser::Audio); |
1354 | 1335 |
1355 QSettings settings; | 1336 bool playOn = (m_analyser->isVisible(Analyser::Audio)); |
1356 settings.beginGroup("MainWindow"); | |
1357 | |
1358 bool playOn = false; | |
1359 if (m_analyser->isVisible(Analyser::Audio)) { | |
1360 // just switched layer on; check whether playback was also on previously | |
1361 playOn = settings.value("playaudiowas", true).toBool(); | |
1362 } else { | |
1363 settings.setValue("playaudiowas", m_playAudio->isChecked()); | |
1364 } | |
1365 m_analyser->setAudible(Analyser::Audio, playOn); | 1337 m_analyser->setAudible(Analyser::Audio, playOn); |
1366 m_playAudio->setChecked(playOn); | 1338 m_audioLPW->setEnabled(playOn); |
1367 | |
1368 settings.endGroup(); | |
1369 | 1339 |
1370 updateMenuStates(); | 1340 updateMenuStates(); |
1371 } | 1341 } |
1372 | 1342 |
1373 void | 1343 void |
1374 MainWindow::showPitchToggled() | 1344 MainWindow::showPitchToggled() |
1375 { | 1345 { |
1376 m_analyser->toggleVisible(Analyser::PitchTrack); | 1346 m_analyser->toggleVisible(Analyser::PitchTrack); |
1377 | 1347 |
1378 QSettings settings; | 1348 bool playOn = (m_analyser->isVisible(Analyser::PitchTrack)); |
1379 settings.beginGroup("MainWindow"); | |
1380 | |
1381 bool playOn = false; | |
1382 if (m_analyser->isVisible(Analyser::PitchTrack)) { | |
1383 // just switched layer on; check whether playback was also on previously | |
1384 playOn = settings.value("playpitchwas", true).toBool(); | |
1385 } else { | |
1386 settings.setValue("playpitchwas", m_playPitch->isChecked()); | |
1387 } | |
1388 m_analyser->setAudible(Analyser::PitchTrack, playOn && m_withSonification); | 1349 m_analyser->setAudible(Analyser::PitchTrack, playOn && m_withSonification); |
1389 m_playPitch->setChecked(playOn); | 1350 m_pitchLPW->setEnabled(playOn); |
1390 | |
1391 settings.endGroup(); | |
1392 | 1351 |
1393 updateMenuStates(); | 1352 updateMenuStates(); |
1394 } | 1353 } |
1395 | 1354 |
1396 void | 1355 void |
1402 void | 1361 void |
1403 MainWindow::showNotesToggled() | 1362 MainWindow::showNotesToggled() |
1404 { | 1363 { |
1405 m_analyser->toggleVisible(Analyser::Notes); | 1364 m_analyser->toggleVisible(Analyser::Notes); |
1406 | 1365 |
1407 QSettings settings; | 1366 bool playOn = (m_analyser->isVisible(Analyser::Notes)); |
1408 settings.beginGroup("MainWindow"); | |
1409 | |
1410 bool playOn = false; | |
1411 if (m_analyser->isVisible(Analyser::Notes)) { | |
1412 // just switched layer on; check whether playback was also on previously | |
1413 playOn = settings.value("playnoteswas", true).toBool(); | |
1414 } else { | |
1415 settings.setValue("playnoteswas", m_playNotes->isChecked()); | |
1416 } | |
1417 m_analyser->setAudible(Analyser::Notes, playOn && m_withSonification); | 1367 m_analyser->setAudible(Analyser::Notes, playOn && m_withSonification); |
1418 m_playNotes->setChecked(playOn); | 1368 m_notesLPW->setEnabled(playOn); |
1419 | |
1420 settings.endGroup(); | |
1421 | 1369 |
1422 updateMenuStates(); | 1370 updateMenuStates(); |
1423 } | 1371 } |
1424 | 1372 |
1425 void | 1373 void |
1442 | 1390 |
1443 void | 1391 void |
1444 MainWindow::updateLayerStatuses() | 1392 MainWindow::updateLayerStatuses() |
1445 { | 1393 { |
1446 m_showAudio->setChecked(m_analyser->isVisible(Analyser::Audio)); | 1394 m_showAudio->setChecked(m_analyser->isVisible(Analyser::Audio)); |
1395 m_audioLPW->setEnabled(m_analyser->isVisible(Analyser::Audio)); | |
1396 m_audioLPW->setLevel(m_analyser->getGain(Analyser::Audio)); | |
1397 m_audioLPW->setPan(m_analyser->getPan(Analyser::Audio)); | |
1398 | |
1399 m_showPitch->setChecked(m_analyser->isVisible(Analyser::PitchTrack)); | |
1400 m_pitchLPW->setEnabled(m_analyser->isVisible(Analyser::PitchTrack)); | |
1401 m_pitchLPW->setLevel(m_analyser->getGain(Analyser::PitchTrack)); | |
1402 m_pitchLPW->setPan(m_analyser->getPan(Analyser::PitchTrack)); | |
1403 | |
1404 m_showNotes->setChecked(m_analyser->isVisible(Analyser::Notes)); | |
1405 m_notesLPW->setEnabled(m_analyser->isVisible(Analyser::Notes)); | |
1406 m_notesLPW->setLevel(m_analyser->getGain(Analyser::Notes)); | |
1407 m_notesLPW->setPan(m_analyser->getPan(Analyser::Notes)); | |
1408 | |
1447 m_showSpect->setChecked(m_analyser->isVisible(Analyser::Spectrogram)); | 1409 m_showSpect->setChecked(m_analyser->isVisible(Analyser::Spectrogram)); |
1448 m_showPitch->setChecked(m_analyser->isVisible(Analyser::PitchTrack)); | |
1449 m_showNotes->setChecked(m_analyser->isVisible(Analyser::Notes)); | |
1450 m_playAudio->setChecked(m_analyser->isAudible(Analyser::Audio)); | |
1451 m_playPitch->setChecked(m_analyser->isAudible(Analyser::PitchTrack)); | |
1452 m_playNotes->setChecked(m_analyser->isAudible(Analyser::Notes)); | |
1453 } | 1410 } |
1454 | 1411 |
1455 void | 1412 void |
1456 MainWindow::editDisplayExtents() | 1413 MainWindow::editDisplayExtents() |
1457 { | 1414 { |