aboutsummaryrefslogtreecommitdiff
path: root/src/ui/mainwindow.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-09-27 18:21:27 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-09-27 18:21:27 +0000
commitf196608bb14331834dfd9ccc71d5f5b884119d67 (patch)
treefba530b5495e5c46957aa0e0de393741dc11ada7 /src/ui/mainwindow.cpp
parent700719bd5419530363ec8fd36485fe997bad06d4 (diff)
downloadqmmp-f196608bb14331834dfd9ccc71d5f5b884119d67.tar.gz
qmmp-f196608bb14331834dfd9ccc71d5f5b884119d67.tar.bz2
qmmp-f196608bb14331834dfd9ccc71d5f5b884119d67.zip
added '--no-start' command line option
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1917 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui/mainwindow.cpp')
-rw-r--r--src/ui/mainwindow.cpp43
1 files changed, 13 insertions, 30 deletions
diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp
index 27ac8217e..5b5af9b2f 100644
--- a/src/ui/mainwindow.cpp
+++ b/src/ui/mainwindow.cpp
@@ -547,8 +547,13 @@ void MainWindow::savePlaylist()
qWarning("Error: There is no registered playlist parsers");
}
-void MainWindow::setFileList(const QStringList & l)
+void MainWindow::setFileList(const QStringList &l, bool clear)
{
+ if(!clear)
+ {
+ m_pl_manager->currentPlayList()->addFileList(l);
+ return;
+ }
if (m_core->state() == Qmmp::Playing || m_core->state() == Qmmp::Paused)
{
stop();
@@ -578,24 +583,15 @@ QString MainWindow::processCommandArgs(const QStringList &slist, const QString&
if(slist.isEmpty())
return QString();
QStringList paths;
- foreach(QString arg, slist)
+ foreach(QString arg, slist) //detect file/directory paths
{
if(arg.startsWith("-"))
break;
- else
- paths.append(arg);
+ paths.append(arg);
}
if(!paths.isEmpty())
{
- QStringList full_path_list;
- foreach(QString s, paths)
- {
- if ((s.startsWith("/")) || (s.contains("://"))) //is it absolute path or url?
- full_path_list << s;
- else
- full_path_list << cwd + "/" + s;
- }
- setFileList(full_path_list);
+ m_option_manager->executeCommand(QString(), paths, cwd, this); //add paths only
return QString();
}
QHash<QString, QStringList> commands = m_option_manager->splitArgs(slist);
@@ -603,25 +599,12 @@ QString MainWindow::processCommandArgs(const QStringList &slist, const QString&
return QString();
foreach(QString key, commands.keys())
{
- if(key == "--enqueue" || key == "-e")
- {
- QStringList args = commands.value(key);
- if(args.isEmpty())
- return false;
- QStringList full_path_list;
- foreach(QString s, args)
- {
- if ((s.startsWith("/")) || (s.contains("://"))) //is it absolute path or url?
- full_path_list << s;
- else
- full_path_list << cwd + "/" + s;
- }
- m_pl_manager->currentPlayList()->addFileList(full_path_list);
- }
- else if (CommandLineManager::hasOption(key))
+ if(key == "--no-start")
+ continue;
+ if (CommandLineManager::hasOption(key))
return CommandLineManager::executeCommand(key, commands.value(key));
else if (m_option_manager->identify(key))
- m_option_manager->executeCommand(key, commands.value(key), this);
+ m_option_manager->executeCommand(key, commands.value(key), cwd, this);
else
return QString();
}