From a4ce91d728940da0099cf5be099f705dc013e7e3 Mon Sep 17 00:00:00 2001 From: APTX Date: Sat, 13 Apr 2013 15:00:09 +0200 Subject: [PATCH] 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. --- play-next/main.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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; -- 2.52.0