From 4ee2f0c300670803c5070897f551277d065caa81 Mon Sep 17 00:00:00 2001 From: APTX Date: Tue, 24 Jul 2012 16:26:00 +0200 Subject: [PATCH] managment-gui can now add files from command line args --- management-gui/main.cpp | 10 ++++++++++ management-gui/mainwindow.cpp | 9 +++++++++ management-gui/mainwindow.h | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/management-gui/main.cpp b/management-gui/main.cpp index e5d63ee..344b249 100644 --- a/management-gui/main.cpp +++ b/management-gui/main.cpp @@ -4,7 +4,17 @@ int main(int argc, char *argv[]) { QtSingleApplication a(argc, argv); + + if (a.isRunning()) + { + if (a.arguments().count() < 2) + return 0; + return a.sendMessage(QString("ADD %1").arg(a.arguments()[1])); + } + MainWindow w; + + QObject::connect(&a, SIGNAL(messageReceived(QString)), &w, SLOT(handleMessage(QString))); w.show(); return a.exec(); diff --git a/management-gui/mainwindow.cpp b/management-gui/mainwindow.cpp index 2c14b9f..516827c 100644 --- a/management-gui/mainwindow.cpp +++ b/management-gui/mainwindow.cpp @@ -81,6 +81,15 @@ void MainWindow::dbDisconnected() databaseConnectionStatusIndicator->setText("Disconnected"); } +void MainWindow::handleMessage(const QString &message) +{ + if (!message.startsWith("ADD ")) + return; + QFileInfo file(message.mid(4)); + + LocalMyList::instance()->addFile(file); +} + void MainWindow::handleNotification() { ui->statusBar->showMessage("New Pending Request added!"); diff --git a/management-gui/mainwindow.h b/management-gui/mainwindow.h index fa2476b..712f906 100644 --- a/management-gui/mainwindow.h +++ b/management-gui/mainwindow.h @@ -28,6 +28,8 @@ private slots: void dbConnected(); void dbDisconnected(); + void handleMessage(const QString &message); + void handleNotification(); void taskCountChanged(); @@ -58,12 +60,12 @@ private slots: void on_actionClearAnimeTitleData_triggered(); void on_actionRemoveKnownUnknownFiles_triggered(); + void on_actionRenameScript_triggered(); void on_actionAddRelatedEpisodeInfo_triggered(); void on_refreshButton_clicked(); - void on_myListView_openFileRequested(const QModelIndex &index); void on_myListView_renameFilesRequested(const QModelIndex &index); void on_myListView_dataRequested(const QModelIndex &index); -- 2.52.0