]> Some of my projects - localmylist.git/commitdiff
managment-gui can now add files from command line args
authorAPTX <marek321@gmail.com>
Tue, 24 Jul 2012 14:26:00 +0000 (16:26 +0200)
committerAPTX <marek321@gmail.com>
Tue, 24 Jul 2012 14:26:00 +0000 (16:26 +0200)
management-gui/main.cpp
management-gui/mainwindow.cpp
management-gui/mainwindow.h

index e5d63ee96a6a8464917f32a93d57e0263ac65fdb..344b2498aae8f1a9494ea59b82a665c9ba87d3ad 100644 (file)
@@ -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();
index 2c14b9f673cf126500f762b2234413a20e4c9b69..516827c9efca31d311bcf7c20dcf6b9f7dd0f8cd 100644 (file)
@@ -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!");
index fa2476bfacba98e2939d69da5e6a3da48ddcfe4c..712f90641bac2d45d66654d17a16b215d874b8a8 100644 (file)
@@ -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);