Commit 2f6bb850 authored by Mark Westcott's avatar Mark Westcott

Don't crash if trm can't be run (report error nicely)

Alert user if no matches have been found on musicbrainz

svn path=/trunk/kdemultimedia/juk/; revision=225129
parent 0219bcc7
......@@ -62,7 +62,7 @@ void MusicBrainzQuery::start()
connect(process, SIGNAL(processExited(KProcess *)),
SLOT(slotTrmGenerationFinished(KProcess *)));
emit signalStatusMsg( i18n( "Generating TRM signature..." ) );
emit signalStatusMsg( i18n( "Generating TRM signature..." ), 0 );
bool started = process->start(KProcess::NotifyOnExit, KProcess::AllOutput);
if(!started) {
kdDebug(65432) << "trm utility could not be started." << endl;
......@@ -84,7 +84,7 @@ void MusicBrainzQuery::slotQuery()
queryStrings(queryString, resultString, extractString);
emit signalStatusMsg( i18n( "Querying MusicBrainz server..." ) );
emit signalStatusMsg( i18n( "Querying MusicBrainz server..." ), 0 );
// UseUTF8(false);
......@@ -295,7 +295,11 @@ void MusicBrainzQuery::slotTrmGenerationFinished(KProcess *process)
m_arguments << m_trm;
m_query = TrackFromTRM;
kdDebug(65432) << "Generation finished " << m_trm << endl;
slotQuery();
if (m_trm.isEmpty())
emit signalStatusMsg( i18n( "TRM generation failed" ), 2000 );
else
slotQuery();
}
#include "musicbrainzquery.moc"
......
......@@ -103,7 +103,7 @@ public:
void start();
signals:
void signalStatusMsg(const QString &msg);
void signalStatusMsg(const QString &msg, int timeout);
void signalDone(const MusicBrainzQuery::AlbumList & = AlbumList());
void signalDone(const MusicBrainzQuery::TrackList &);
......
......@@ -106,8 +106,8 @@ void PlaylistItem::guessTagInfoFromInternet()
connect(query, SIGNAL(signalDone(const MusicBrainzQuery::TrackList &)),
SLOT(slotTagGuessResults(const MusicBrainzQuery::TrackList &)));
KMainWindow *win = static_cast<KMainWindow *>(kapp->mainWidget());
connect(query, SIGNAL(signalStatusMsg(const QString &)),
win->statusBar(), SLOT(message(const QString &)));
connect(query, SIGNAL(signalStatusMsg(const QString &, int)),
win->statusBar(), SLOT(message(const QString &, int)));
query->start();
#endif //add message box teeling users musicbrainz is not installed or keep it quiet?
}
......@@ -302,8 +302,14 @@ void PlaylistItem::slotTagGuessResults(const MusicBrainzQuery::TrackList &res)
{
#if HAVE_MUSICBRAINZ
//FIXME:GUI to pick one of the results
KMainWindow *win = static_cast<KMainWindow *>(kapp->mainWidget());
if(res.count() == 0)
{
win->statusBar()->message(i18n("No matches found."), 2000);
return;
}
MusicBrainzQuery::Track track = res.first();
if(!track.name.isEmpty())
......@@ -318,7 +324,6 @@ void PlaylistItem::slotTagGuessResults(const MusicBrainzQuery::TrackList &res)
tag()->save();
slotRefresh();
KMainWindow *win = static_cast<KMainWindow *>(kapp->mainWidget());
win->statusBar()->message(i18n("Done."), 2000);
#else
Q_UNUSED(res)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment