From 0aaa359ebd775acb44be7a47e082c85e9c0b7d53 Mon Sep 17 00:00:00 2001 From: Flavio Date: Wed, 2 Feb 2011 15:47:48 +0100 Subject: [PATCH] CLI support --- src/MainWindow.h | 4 +++- src/main.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.h b/src/MainWindow.h index 5034df8..ec872e0 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -23,6 +23,9 @@ public: ~MainWindow(); Phonon::SeekSlider* getSeekSlider() { return seekSlider; } +public slots: + void showMedia(SearchParams *params); + protected: void closeEvent(QCloseEvent *); bool eventFilter(QObject *obj, QEvent *event); @@ -31,7 +34,6 @@ private slots: void fadeInWidget(QWidget *oldWidget, QWidget *newWidget); void goBack(); void showSearch(); - void showMedia(SearchParams *params); void visitSite(); void donate(); void about(); diff --git a/src/main.cpp b/src/main.cpp index 6f0385f..e560d0f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ #include #include "constants.h" #include "MainWindow.h" +#include "searchparams.h" #ifdef APP_MAC // #include "local/mac/mac_startup.h" #endif @@ -84,5 +85,12 @@ int main(int argc, char **argv) { // all string literals are UTF-8 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + if (app.arguments().size() > 1) { + QString query = app.arguments().at(1); + SearchParams *searchParams = new SearchParams(); + searchParams->setKeywords(query); + mainWin.showMedia(searchParams); + } + return app.exec(); } -- 2.39.5