comparison main/MainWindow.cpp @ 1448:11484141d969 3.0-integration

Add overview colour preference
author Chris Cannam
date Fri, 16 Dec 2016 19:26:21 +0000
parents 387bc365aac1
children e4f223fc9099
comparison
equal deleted inserted replaced
1447:68abc2ea47aa 1448:11484141d969
227 m_panLayer = new WaveformLayer; 227 m_panLayer = new WaveformLayer;
228 m_panLayer->setChannelMode(WaveformLayer::MergeChannels); 228 m_panLayer->setChannelMode(WaveformLayer::MergeChannels);
229 m_panLayer->setAggressiveCacheing(true); 229 m_panLayer->setAggressiveCacheing(true);
230 m_overview->addLayer(m_panLayer); 230 m_overview->addLayer(m_panLayer);
231 231
232 if (m_viewManager->getGlobalDarkBackground()) { 232 coloursChanged(); // sets pan layer colour from preferences
233 m_panLayer->setBaseColour
234 (ColourDatabase::getInstance()->getColourIndex(tr("Bright Green")));
235 } else {
236 m_panLayer->setBaseColour
237 (ColourDatabase::getInstance()->getColourIndex(tr("Green")));
238 }
239 233
240 m_playSpeed = new AudioDial(frame); 234 m_playSpeed = new AudioDial(frame);
241 m_playSpeed->setMinimum(0); 235 m_playSpeed->setMinimum(0);
242 m_playSpeed->setMaximum(120); 236 m_playSpeed->setMaximum(120);
243 m_playSpeed->setValue(60); 237 m_playSpeed->setValue(60);
3500 void 3494 void
3501 MainWindow::preferenceChanged(PropertyContainer::PropertyName name) 3495 MainWindow::preferenceChanged(PropertyContainer::PropertyName name)
3502 { 3496 {
3503 MainWindowBase::preferenceChanged(name); 3497 MainWindowBase::preferenceChanged(name);
3504 3498
3505 if (name == "Background Mode" && m_viewManager) { 3499 if (name == "Background Mode") {
3506 if (m_viewManager->getGlobalDarkBackground()) { 3500 coloursChanged();
3507 m_panLayer->setBaseColour
3508 (ColourDatabase::getInstance()->getColourIndex(tr("Bright Green")));
3509 } else {
3510 m_panLayer->setBaseColour
3511 (ColourDatabase::getInstance()->getColourIndex(tr("Green")));
3512 }
3513 } 3501 }
3502 }
3503
3504 void
3505 MainWindow::coloursChanged()
3506 {
3507 QSettings settings;
3508 settings.beginGroup("Preferences");
3509 QString defaultColourName(tr("Green"));
3510 if (m_viewManager && m_viewManager->getGlobalDarkBackground()) {
3511 defaultColourName = tr("Bright Green");
3512 }
3513 ColourDatabase *cdb = ColourDatabase::getInstance();
3514 QColor colour =
3515 ((settings.value("overview-colour", cdb->getColour(defaultColourName)))
3516 .value<QColor>());
3517 settings.endGroup();
3518
3519 int index = cdb->getColourIndex(colour);
3520 if (index >= 0) {
3521 m_panLayer->setBaseColour(index);
3522 }
3514 } 3523 }
3515 3524
3516 void 3525 void
3517 MainWindow::propertyStacksResized(int width) 3526 MainWindow::propertyStacksResized(int width)
3518 { 3527 {
4608 4617
4609 m_preferencesDialog = new PreferencesDialog(this); 4618 m_preferencesDialog = new PreferencesDialog(this);
4610 4619
4611 connect(m_preferencesDialog, SIGNAL(audioDeviceChanged()), 4620 connect(m_preferencesDialog, SIGNAL(audioDeviceChanged()),
4612 this, SLOT(recreateAudioIO())); 4621 this, SLOT(recreateAudioIO()));
4622 connect(m_preferencesDialog, SIGNAL(coloursChanged()),
4623 this, SLOT(coloursChanged()));
4613 4624
4614 // DeleteOnClose is safe here, because m_preferencesDialog is a 4625 // DeleteOnClose is safe here, because m_preferencesDialog is a
4615 // QPointer that will be zeroed when the dialog is deleted. We 4626 // QPointer that will be zeroed when the dialog is deleted. We
4616 // use it in preference to leaving the dialog lying around because 4627 // use it in preference to leaving the dialog lying around because
4617 // if you Cancel the dialog, it resets the preferences state 4628 // if you Cancel the dialog, it resets the preferences state