Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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