Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 126:d615d0220828
* Add audio device selection to preferences
* Add (not yet functional) insert, delete, edit buttons to data edit window
* Add proper set methods for time fields in data edit window (using general
sparse model base class)
author | Chris Cannam |
---|---|
date | Fri, 13 Jun 2008 21:09:43 +0000 |
parents | e4635503a6d2 |
children | 7ee6da3f2b3c |
comparison
equal
deleted
inserted
replaced
125:e4635503a6d2 | 126:d615d0220828 |
---|---|
1335 void | 1335 void |
1336 MainWindowBase::createPlayTarget() | 1336 MainWindowBase::createPlayTarget() |
1337 { | 1337 { |
1338 if (m_playTarget) return; | 1338 if (m_playTarget) return; |
1339 | 1339 |
1340 m_playTarget = AudioTargetFactory::createCallbackTarget(m_playSource); | 1340 QSettings settings; |
1341 settings.beginGroup("Preferences"); | |
1342 QString targetName = settings.value("audio-target", "").toString(); | |
1343 settings.endGroup(); | |
1344 | |
1345 AudioTargetFactory *factory = AudioTargetFactory::getInstance(); | |
1346 | |
1347 factory->setDefaultCallbackTarget(targetName); | |
1348 m_playTarget = factory->createCallbackTarget(m_playSource); | |
1349 | |
1341 if (!m_playTarget) { | 1350 if (!m_playTarget) { |
1342 emit hideSplash(); | 1351 emit hideSplash(); |
1343 QMessageBox::warning | 1352 |
1353 if (factory->isAutoCallbackTarget(targetName)) { | |
1344 (this, tr("Couldn't open audio device"), | 1354 (this, tr("Couldn't open audio device"), |
1345 tr("<b>No audio available</b><p>Could not open an audio device for playback.<p>Audio playback will not be available during this session."), | 1355 tr("<b>No audio available</b><p>Could not open an audio device for playback.<p>Automatic audio device detection failed. Audio playback will not be available during this session.</p>"), |
1346 QMessageBox::Ok); | 1356 QMessageBox::Ok); |
1357 } else { | |
1358 QMessageBox::warning | |
1359 (this, tr("Couldn't open audio device"), | |
1360 tr("<b>No audio available</b><p>Failed to open your preferred audio device (\"%1\").<p>Audio playback will not be available during this session.</p>") | |
1361 .arg(factory->getCallbackTargetDescription(targetName)), | |
1362 QMessageBox::Ok); | |
1363 } | |
1347 } | 1364 } |
1348 } | 1365 } |
1349 | 1366 |
1350 WaveFileModel * | 1367 WaveFileModel * |
1351 MainWindowBase::getMainModel() | 1368 MainWindowBase::getMainModel() |
1943 std::cerr << "NOTE: Not a tabular model" << std::endl; | 1960 std::cerr << "NOTE: Not a tabular model" << std::endl; |
1944 return; | 1961 return; |
1945 } | 1962 } |
1946 | 1963 |
1947 if (m_layerDataDialogMap.find(layer) != m_layerDataDialogMap.end()) { | 1964 if (m_layerDataDialogMap.find(layer) != m_layerDataDialogMap.end()) { |
1948 m_layerDataDialogMap[layer]->show(); | 1965 if (!m_layerDataDialogMap[layer].isNull()) { |
1949 m_layerDataDialogMap[layer]->raise(); | 1966 m_layerDataDialogMap[layer]->show(); |
1950 return; | 1967 m_layerDataDialogMap[layer]->raise(); |
1968 return; | |
1969 } | |
1951 } | 1970 } |
1952 | 1971 |
1953 QString title = layer->getLayerPresentationName(); | 1972 QString title = layer->getLayerPresentationName(); |
1954 | 1973 |
1955 ModelDataTableDialog *dialog = new ModelDataTableDialog(tabular, title, this); | 1974 ModelDataTableDialog *dialog = new ModelDataTableDialog(tabular, title, this); |
1975 dialog->setAttribute(Qt::WA_DeleteOnClose); // see below | |
1956 | 1976 |
1957 connect(m_viewManager, | 1977 connect(m_viewManager, |
1958 SIGNAL(globalCentreFrameChanged(unsigned long)), | 1978 SIGNAL(globalCentreFrameChanged(unsigned long)), |
1959 dialog, | 1979 dialog, |
1960 SLOT(scrollToFrameRequested(unsigned long))); | 1980 SLOT(scrollToFrameRequested(unsigned long))); |