comparison src/MainWindow.cpp @ 442:12f2c987e2b5

Wait for initial analysis to complete before loading (as well as saving)
author Chris Cannam
date Tue, 31 Mar 2015 15:09:58 +0100
parents 14aa33dc2a54
children 7665cc683dd1
comparison
equal deleted inserted replaced
441:692852208b6c 442:12f2c987e2b5
1159 connect(this, SIGNAL(canPlayWaveform(bool)), m_playAudio, SLOT(setEnabled(bool))); 1159 connect(this, SIGNAL(canPlayWaveform(bool)), m_playAudio, SLOT(setEnabled(bool)));
1160 1160
1161 int lpwSize, bigLpwSize; 1161 int lpwSize, bigLpwSize;
1162 #ifdef Q_OS_MAC 1162 #ifdef Q_OS_MAC
1163 lpwSize = m_viewManager->scalePixelSize(32); // Mac toolbars are fatter 1163 lpwSize = m_viewManager->scalePixelSize(32); // Mac toolbars are fatter
1164 bigLpwSize = lpwSize * 2.2; 1164 bigLpwSize = int(lpwSize * 2.2);
1165 #else 1165 #else
1166 lpwSize = m_viewManager->scalePixelSize(26); 1166 lpwSize = m_viewManager->scalePixelSize(26);
1167 bigLpwSize = lpwSize * 2.8; 1167 bigLpwSize = int(lpwSize * 2.8);
1168 #endif 1168 #endif
1169 1169
1170 m_audioLPW->setImageSize(lpwSize); 1170 m_audioLPW->setImageSize(lpwSize);
1171 m_audioLPW->setBigImageSize(bigLpwSize); 1171 m_audioLPW->setBigImageSize(bigLpwSize);
1172 toolbar->addWidget(m_audioLPW); 1172 toolbar->addWidget(m_audioLPW);
1949 return true; 1949 return true;
1950 } 1950 }
1951 1951
1952 QMessageBox mb(QMessageBox::Information, 1952 QMessageBox mb(QMessageBox::Information,
1953 tr("Waiting for analysis"), 1953 tr("Waiting for analysis"),
1954 tr("Waiting for initial analysis to complete before saving..."), 1954 tr("Waiting for initial analysis to finish before loading or saving..."),
1955 QMessageBox::Cancel, 1955 QMessageBox::Cancel,
1956 this); 1956 this);
1957 1957
1958 connect(m_analyser, SIGNAL(initialAnalysisCompleted()), 1958 connect(m_analyser, SIGNAL(initialAnalysisCompleted()),
1959 &mb, SLOT(accept())); 1959 &mb, SLOT(accept()));
2128 MainWindow::importPitchLayer(FileSource source) 2128 MainWindow::importPitchLayer(FileSource source)
2129 { 2129 {
2130 if (!source.isAvailable()) return FileOpenFailed; 2130 if (!source.isAvailable()) return FileOpenFailed;
2131 source.waitForData(); 2131 source.waitForData();
2132 2132
2133 if (!waitForInitialAnalysis()) return FileOpenCancelled;
2134
2133 QString path = source.getLocalFilename(); 2135 QString path = source.getLocalFilename();
2134 2136
2135 RDFImporter::RDFDocumentType rdfType = 2137 RDFImporter::RDFDocumentType rdfType =
2136 RDFImporter::identifyDocumentType(QUrl::fromLocalFile(path).toString()); 2138 RDFImporter::identifyDocumentType(QUrl::fromLocalFile(path).toString());
2137 2139
2212 2214
2213 QString path = getSaveFileName(type); 2215 QString path = getSaveFileName(type);
2214 2216
2215 if (path == "") return; 2217 if (path == "") return;
2216 2218
2219 if (!waitForInitialAnalysis()) return;
2220
2217 if (QFileInfo(path).suffix() == "") path += ".svl"; 2221 if (QFileInfo(path).suffix() == "") path += ".svl";
2218 2222
2219 QString suffix = QFileInfo(path).suffix().toLower(); 2223 QString suffix = QFileInfo(path).suffix().toLower();
2220 2224
2221 QString error; 2225 QString error;