This commit is contained in:
parent
0ce9e1696c
commit
09b0fab87c
|
@ -55,18 +55,19 @@ const char* CommandlineOptions::kHelpText =
|
|||
" --restart-or-previous %19\n"
|
||||
"\n"
|
||||
"%20:\n"
|
||||
" -a, --append %21\n"
|
||||
" -l, --load %22\n"
|
||||
" -k, --play-track <n> %23\n"
|
||||
" -c, --create <name> %21\n"
|
||||
" -a, --append %22\n"
|
||||
" -l, --load %23\n"
|
||||
" -k, --play-track <n> %24\n"
|
||||
"\n"
|
||||
"%24:\n"
|
||||
" -o, --show-osd %25\n"
|
||||
" -y, --toggle-pretty-osd %26\n"
|
||||
" -g, --language <lang> %27\n"
|
||||
" --quiet %28\n"
|
||||
" --verbose %29\n"
|
||||
" --log-levels <levels> %30\n"
|
||||
" --version %31\n";
|
||||
"%25:\n"
|
||||
" -o, --show-osd %26\n"
|
||||
" -y, --toggle-pretty-osd %27\n"
|
||||
" -g, --language <lang> %28\n"
|
||||
" --quiet %29\n"
|
||||
" --verbose %30\n"
|
||||
" --log-levels <levels> %31\n"
|
||||
" --version %32\n";
|
||||
|
||||
const char* CommandlineOptions::kVersionText = "Clementine %1";
|
||||
|
||||
|
@ -123,6 +124,7 @@ bool CommandlineOptions::Parse() {
|
|||
{"seek-to", required_argument, 0, SeekTo},
|
||||
{"seek-by", required_argument, 0, SeekBy},
|
||||
{"restart-or-previous", no_argument, 0, RestartOrPrevious},
|
||||
{"create", required_argument, 0, 'c'},
|
||||
{"append", no_argument, 0, 'a'},
|
||||
{"load", no_argument, 0, 'l'},
|
||||
{"play-track", required_argument, 0, 'k'},
|
||||
|
@ -138,7 +140,7 @@ bool CommandlineOptions::Parse() {
|
|||
// Parse the arguments
|
||||
bool ok = false;
|
||||
forever {
|
||||
int c = getopt_long(argc_, argv_, "hptusqrfv:alk:oyg:", kOptions, nullptr);
|
||||
int c = getopt_long(argc_, argv_, "hptusqrfv:c:alk:oyg:", kOptions, nullptr);
|
||||
|
||||
// End of the options
|
||||
if (c == -1) break;
|
||||
|
@ -167,6 +169,7 @@ bool CommandlineOptions::Parse() {
|
|||
tr("Restart the track, or play the previous track if "
|
||||
"within 8 seconds of start."),
|
||||
tr("Playlist options"),
|
||||
tr("Create a new playlist with files/URLs"),
|
||||
tr("Append files/URLs to the playlist"),
|
||||
tr("Loads files/URLs, replacing current playlist"),
|
||||
tr("Play the <n>th track in the playlist"))
|
||||
|
@ -203,6 +206,10 @@ bool CommandlineOptions::Parse() {
|
|||
case 'f':
|
||||
player_action_ = Player_Next;
|
||||
break;
|
||||
case 'c':
|
||||
url_list_action_ = UrlList_CreateNew;
|
||||
playlist_name_ = QString(optarg);
|
||||
break;
|
||||
case 'a':
|
||||
url_list_action_ = UrlList_Append;
|
||||
break;
|
||||
|
|
|
@ -44,6 +44,7 @@ class CommandlineOptions {
|
|||
UrlList_Append = 0,
|
||||
UrlList_Load = 1,
|
||||
UrlList_None = 2,
|
||||
UrlList_CreateNew = 3,
|
||||
};
|
||||
enum PlayerAction {
|
||||
Player_None = 0,
|
||||
|
@ -74,6 +75,7 @@ class CommandlineOptions {
|
|||
QList<QUrl> urls() const { return urls_; }
|
||||
QString language() const { return language_; }
|
||||
QString log_levels() const { return log_levels_; }
|
||||
QString playlist_name() const { return playlist_name_; }
|
||||
|
||||
QByteArray Serialize() const;
|
||||
void Load(const QByteArray& serialized);
|
||||
|
@ -115,6 +117,7 @@ class CommandlineOptions {
|
|||
bool toggle_pretty_osd_;
|
||||
QString language_;
|
||||
QString log_levels_;
|
||||
QString playlist_name_;
|
||||
|
||||
QList<QUrl> urls_;
|
||||
};
|
||||
|
|
|
@ -2159,6 +2159,10 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions& options) {
|
|||
case CommandlineOptions::UrlList_None:
|
||||
ApplyAddBehaviour(doubleclick_addmode_, data);
|
||||
break;
|
||||
case CommandlineOptions::UrlList_CreateNew:
|
||||
data->name_for_new_playlist_ = options.playlist_name();
|
||||
ApplyAddBehaviour(AddBehaviour_OpenInNew, data);
|
||||
break;
|
||||
}
|
||||
|
||||
AddToPlaylist(data);
|
||||
|
|
Loading…
Reference in New Issue