From: APTX Date: Sun, 8 Jul 2012 16:44:38 +0000 (+0200) Subject: Add option to manually request data for entries (to update an entry) X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=0c4e030c322f45e6bb1e2e75c92db588ce83b4ba;p=localmylist.git Add option to manually request data for entries (to update an entry) --- diff --git a/management-gui/mainwindow.cpp b/management-gui/mainwindow.cpp index e724d39..05d4ddc 100644 --- a/management-gui/mainwindow.cpp +++ b/management-gui/mainwindow.cpp @@ -265,6 +265,32 @@ void MainWindow::on_myListView_renameFilesRequested(const QModelIndex &index) ui->statusBar->showMessage(tr("Files for %1%2 scheduled for rename").arg(typeLetter).arg(id)); } +void MainWindow::on_myListView_dataRequested(const QModelIndex &index) +{ + MyListModel::NodeType type = myListModel->type(index); + int id = myListModel->id(index); + + PendingRequest r; + + switch (type) + { + case MyListModel::Anime: + r.aid = id; + break; + case MyListModel::Episode: + r.eid = id; + break; + case MyListModel::File: + r.fid = id; + break; + default: + return; + break; + } + + MyList::instance()->database()->addRequest(r); +} + void MainWindow::on_actionStartUDPCLient_triggered() { MyList::instance()->setupUdpClient(); diff --git a/management-gui/mainwindow.h b/management-gui/mainwindow.h index a5576be..488f77f 100644 --- a/management-gui/mainwindow.h +++ b/management-gui/mainwindow.h @@ -46,6 +46,7 @@ private slots: void on_actionClearAnimeTitleData_triggered(); void on_myListView_openFileRequested(const QModelIndex &index); void on_myListView_renameFilesRequested(const QModelIndex &index); + void on_myListView_dataRequested(const QModelIndex &index); void on_actionStartUDPCLient_triggered(); void on_actionRenameFiles_triggered(); void on_actionStartRenameHandler_triggered(); diff --git a/management-gui/mylistview.cpp b/management-gui/mylistview.cpp index 8f1f24e..6f03eb1 100644 --- a/management-gui/mylistview.cpp +++ b/management-gui/mylistview.cpp @@ -29,6 +29,8 @@ MyListView::MyListView(QWidget *parent) : connect(renameFilesAction, SIGNAL(triggered()), this, SLOT(requestFileRename())); renameTestAction = new QAction(tr("Use For Rename Testing"), this); connect(renameTestAction, SIGNAL(triggered()), this, SLOT(renameTest())); + requestDataAction = new QAction(tr("Request Data"), this); + connect(requestDataAction, SIGNAL(triggered()), this, SLOT(requestData())); } LocalMyList::MyListModel *MyListView::myListModel() const @@ -55,13 +57,15 @@ void MyListView::showCustomContextMenu(const QPoint &pos) aniDBLinkAction->setText(tr("Open AniDB Page (%1%2)").arg('a').arg(id)); actions << aniDBLinkAction << openNextAction - << renameFilesAction; + << renameFilesAction + << requestDataAction; break; case MyListModel::Episode: aniDBLinkAction->setText(tr("Open AniDB Page (%1%2)").arg('e').arg(id)); actions << aniDBLinkAction << openAction - << renameFilesAction; + << renameFilesAction + << requestDataAction; break; case MyListModel::File: aniDBLinkAction->setText(tr("Open AniDB Page (%1%2)").arg('f').arg(id)); @@ -69,7 +73,8 @@ void MyListView::showCustomContextMenu(const QPoint &pos) << openAction << markWatchedAction << renameTestAction - << renameFilesAction; + << renameFilesAction + << requestDataAction; case MyListModel::FileLocation: aniDBLinkAction->setText(tr("Open AniDB Page (%1%2)").arg('f').arg(id)); actions << aniDBLinkAction @@ -133,3 +138,8 @@ void MyListView::renameTest() if (id) emit renameTest(id); } + +void MyListView::requestData() +{ + emit dataRequested(customContextMenuIndex); +} diff --git a/management-gui/mylistview.h b/management-gui/mylistview.h index 3737979..a7ffe1e 100644 --- a/management-gui/mylistview.h +++ b/management-gui/mylistview.h @@ -17,6 +17,7 @@ public: signals: void openFileRequested(const QModelIndex &index); void renameFilesRequested(const QModelIndex &index); + void dataRequested(const QModelIndex &index); void renameTest(int fid); private slots: @@ -27,6 +28,7 @@ private slots: void openAnidbPage(); void requestFileRename(); void renameTest(); + void requestData(); private: QModelIndex customContextMenuIndex; @@ -38,6 +40,7 @@ private: QAction *aniDBLinkAction; QAction *renameTestAction; QAction *renameFilesAction; + QAction *requestDataAction; }; #endif // MYLISTVIEW_H