comparison main/MainWindow.cpp @ 375:62e9f62752e1 macness_autotpl

only do genre stuff etc if itunes returns a file
author Dan Stowell <dan.stowell@eecs.qmul.ac.uk>
date Fri, 15 Oct 2010 15:12:24 +0100
parents 11f804c7582a
children
comparison
equal deleted inserted replaced
374:11f804c7582a 375:62e9f62752e1
2216 void 2216 void
2217 MainWindow::importITunesAudio() 2217 MainWindow::importITunesAudio()
2218 { 2218 {
2219 QStringList nowPlaying = iTunesNowPlaying(); 2219 QStringList nowPlaying = iTunesNowPlaying();
2220 QString path = nowPlaying.at(0); 2220 QString path = nowPlaying.at(0);
2221 QString genre = (nowPlaying.size() > 1) ? nowPlaying.at(1) : "";
2222 std::cerr << "MainWindow::importITunesAudio(): genre is " << genre.toStdString() << std::endl;
2223 QString tplName = templateNameFromGenre(genre);
2224 2221
2225 if (path != "") { 2222 if (path != "") {
2226 if (openAudio(path, ReplaceMainModel, tplName) == FileOpenFailed) { 2223 QString genre = (nowPlaying.size() > 1) ? nowPlaying.at(1) : "";
2227 emit hideSplash(); 2224 std::cerr << "MainWindow::importITunesAudio(): genre is " << genre.toStdString() << std::endl;
2228 QMessageBox::critical(this, tr("Failed to open file"), 2225 QString tplName = templateNameFromGenre(genre);
2229 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); 2226 if (openAudio(path, ReplaceMainModel, tplName) == FileOpenFailed) {
2230 } 2227 emit hideSplash();
2228 QMessageBox::critical(this, tr("Failed to open file"),
2229 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path));
2230 }
2231 } 2231 }
2232 } 2232 }
2233 #endif 2233 #endif
2234 2234
2235 void 2235 void