From: APTX Date: Sat, 13 Apr 2013 13:00:09 +0000 (+0200) Subject: Make play-next use a local setting for the player it opens. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=a4ce91d728940da0099cf5be099f705dc013e7e3;p=localmylist.git Make play-next use a local setting for the player it opens. Gui applications can ask the DE to provide an application to open a file of a given type. Cli applications need an alternative as they don't link to the DE. --- diff --git a/play-next/main.cpp b/play-next/main.cpp index 22a1930..99efcd7 100644 --- a/play-next/main.cpp +++ b/play-next/main.cpp @@ -41,10 +41,27 @@ int main(int argc, char *argv[]) return 1; } + QSettings &settings = *MyList::instance()->defaultLocalQSettings(); + settings.beginGroup("cli"); + QString player = settings.value("player", QString()).toString(); + settings.endGroup(); + + if (player.isEmpty()) + { + cout << "Player is not set!\n\n"; + cout << "Set [cli] player in " << settings.fileName() << endl; + + settings.beginGroup("cli"); + settings.setValue("player", ""); + settings.endGroup(); + return 1; + } + cout << "ANIME " << data.animeTitle << endl; cout << "EPISODE " << data.epno << " - " << data.episodeTitle << endl; cout << "Starting player..." << endl; - QProcess::startDetached("D:/_C/aniplayer/build/aniplayer", QStringList() << data.path); + + QProcess::startDetached(player, QStringList() << data.path); return 0;