]> Some of my projects - localmylist.git/commitdiff
Make play-next use a local setting for the player it opens.
authorAPTX <marek321@gmail.com>
Sat, 13 Apr 2013 13:00:09 +0000 (15:00 +0200)
committerAPTX <marek321@gmail.com>
Sat, 13 Apr 2013 13:00:09 +0000 (15:00 +0200)
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

index 22a1930ce4195e607e853cbdc06f03d0287747c8..99efcd7dee37c00c1654991e2ce096fcf4736a53 100644 (file)
@@ -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;