comparison main/MainWindow.cpp @ 384:be237d380f5f macness

importITunesAudio() now sets the SV playback position too
author Dan Stowell <dan.stowell@eecs.qmul.ac.uk>
date Mon, 18 Oct 2010 15:23:21 +0100
parents abb9c3dedec2
children
comparison
equal deleted inserted replaced
383:abb9c3dedec2 384:be237d380f5f
2161 2161
2162 #ifdef Q_WS_MAC 2162 #ifdef Q_WS_MAC
2163 void 2163 void
2164 MainWindow::importITunesAudio() 2164 MainWindow::importITunesAudio()
2165 { 2165 {
2166 m_iTunes->resetPlayerState();
2166 QStringList nowPlaying = m_iTunes->getNowPlaying(); 2167 QStringList nowPlaying = m_iTunes->getNowPlaying();
2167 QString path = nowPlaying.at(0); 2168 QString path = nowPlaying.at(0);
2168 QString genre = (nowPlaying.size() > 1) ? nowPlaying.at(1) : ""; 2169 QString genre = (nowPlaying.size() > 1) ? nowPlaying.at(1) : "";
2169 std::cerr << "MainWindow::importITunesAudio(): genre is " << genre.toStdString() << std::endl; 2170 std::cerr << "MainWindow::importITunesAudio(): genre is " << genre.toStdString() << std::endl;
2170 2171
2173 emit hideSplash(); 2174 emit hideSplash();
2174 QMessageBox::critical(this, tr("Failed to open file"), 2175 QMessageBox::critical(this, tr("Failed to open file"),
2175 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path)); 2176 tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path));
2176 }else{ 2177 }else{
2177 m_iTunes->updatePlayerState(); 2178 m_iTunes->updatePlayerState();
2179 RealTime playerPos = RealTime::fromSeconds(m_iTunes->playerPos());
2180 unsigned long positionFrames = RealTime::realTime2Frame(playerPos, getMainModel()->getSampleRate());
2181 m_viewManager->setGlobalCentreFrame(positionFrames);
2182 m_viewManager->setPlaybackFrame(positionFrames);
2178 } 2183 }
2179 } 2184 }
2180 } 2185 }
2181 #endif 2186 #endif
2182 2187