コード例 #1
0
void BackupsWidget::on_pushButtonRemovePSP_clicked()
{
    QList<QListWidgetItem *> selectedItems = m_uiBackupsWidget.listWidgetPSP->selectedItems();
    if (selectedItems.size() > 0)
    {
        if (askDelete())
        {
            QList<int> indexes;
            //The indexes on the widgetlist is the same as in the model list
            for (int i = 0; i < selectedItems.size(); i++)
            {
                indexes.append(m_uiBackupsWidget.listWidgetPSP->row(selectedItems.at(i)));
            }
            m_backups->delPSPSavegames(indexes);
        }
    }
}
コード例 #2
0
ファイル: videoswidget.cpp プロジェクト: brafales/qpspmanager
void VideosWidget::on_pushButtonRemoveComputer_clicked()
{
    QList<QListWidgetItem *> selectedItems = m_uiVideosWidget.tableWidgetComputer->selectedItems();
    if (selectedItems.size() > 0)
    {
        if (askDelete())
        {
            QList<int> indexes;
            //The indexes on the widgetlist is the same as in the model list
            for (int i = 0; i < selectedItems.size(); i++)
            {
                indexes.append(m_uiVideosWidget.tableWidgetComputer->row(selectedItems.at(i)));
            }
            m_videos->delComputer(indexes);
        }
    }
}
コード例 #3
0
ファイル: saveswidget.cpp プロジェクト: georgemoralis/pspudb
void savesWidget::showCollectionContextMenu(const QPoint & pnt)//test code
{
	/*if(hack2==1)
	{
		hack2=0;
		return;
	}
	else
	{
		hack2++;
	}*/
	QPoint globalPos = ui.savesTable->mapToGlobal(pnt);
	
/*	QModelIndex index=ui.collectionList->indexAt(pnt);//get model index

	int cacheid =index.sibling(index.row(), 8).data(Qt::DisplayRole).toUInt();
	QString path;
	QSqlQuery query2(dbcollect);
	query2.prepare("SELECT path FROM cache WHERE id =?");
	query2.addBindValue(cacheid);
	query2.exec();
	if(query2.first())
	{
       path=query2.value(0).toString();
	}*/
	QMenu contextmenu;
	//
    QItemSelectionModel *select= NULL;
	select = ui.savesTable->selectionModel();
	QModelIndexList list=select->selectedRows();
	if(list.size()==0)
		return;
	if(list.size()==1)
	{
		QMenu* m2=contextmenu.addMenu("Copy File to");
		if(ui.sourceselectCombo->currentIndex()==1)
		{
			m2->addAction("Local Folder");
			m2->addAction("JPCSP");
			m2->addAction("PCSP");
			m2->addAction("PSPE4ALL");
		}
		if(ui.sourceselectCombo->currentIndex()==2)
		{
			m2->addAction("PSP Device");
			m2->addAction("JPCSP");
			m2->addAction("PCSP");
			m2->addAction("PSPE4ALL");
		}
		if(ui.sourceselectCombo->currentIndex()==3)
		{
			m2->addAction("PSP Device");
			m2->addAction("Local Folder");
			m2->addAction("PCSP");
			m2->addAction("PSPE4ALL");
		}
		if(ui.sourceselectCombo->currentIndex()==4)
		{
			m2->addAction("PSP Device");
			m2->addAction("Local Folder");
			m2->addAction("JPCSP");
			m2->addAction("PSPE4ALL");
		}
		if(ui.sourceselectCombo->currentIndex()==5)
		{
			m2->addAction("PSP Device");
			m2->addAction("Local Folder");
			m2->addAction("JPCSP");
			m2->addAction("PCSP");
		}
		contextmenu.addAction("Delete File");
	}
	else
	{
		QMenu* m2=contextmenu.addMenu("Copy Files to");
		if(ui.sourceselectCombo->currentIndex()==1)
		{
			m2->addAction("Local Folder");
			m2->addAction("JPCSP");
			m2->addAction("PCSP");
			m2->addAction("PSPE4ALL");
		}
		if(ui.sourceselectCombo->currentIndex()==2)
		{
			m2->addAction("PSP Device");
			m2->addAction("JPCSP");
			m2->addAction("PCSP");
			m2->addAction("PSPE4ALL");
		}
		if(ui.sourceselectCombo->currentIndex()==3)
		{
			m2->addAction("PSP Device");
			m2->addAction("Local Folder");
			m2->addAction("PCSP");
			m2->addAction("PSPE4ALL");
		}
		if(ui.sourceselectCombo->currentIndex()==4)
		{
			m2->addAction("PSP Device");
			m2->addAction("Local Folder");
			m2->addAction("JPCSP");
			m2->addAction("PSPE4ALL");
		}
		if(ui.sourceselectCombo->currentIndex()==5)
		{
			m2->addAction("PSP Device");
			m2->addAction("Local Folder");
			m2->addAction("JPCSP");
			m2->addAction("PCSP");
		}
		contextmenu.addAction("Delete Files");
	}

	//contextmenu.addAction("Compress to cso");
	/*if(path.endsWith("iso",Qt::CaseInsensitive))
	{
		contextmenu.addAction("Compress to cso");
	}
	else if(path.endsWith("cso",Qt::CaseInsensitive))
	{
		contextmenu.addAction("Convert to iso");
	}*/
	QAction* selectedItem = contextmenu.exec(globalPos);
	if(selectedItem==NULL) return;
	if(selectedItem->text()=="Delete File")
	{
		if (askDelete(1))
        {
			QList<QString> paths;
			QString cacheid =list[0].sibling(list[0].row(), 5).data(Qt::DisplayRole).toString();
			paths.append(cacheid);
			deleteSaves(paths);
		}
	}
	if(selectedItem->text()=="Delete Files")
	{
		if (askDelete(2))
        {
			QList<QString> paths;
			for(int i=0; i<list.size(); i++)
			{
			  QString cacheid =list[i].sibling(list[i].row(), 5).data(Qt::DisplayRole).toString();
			  paths.append(cacheid);
			}
			deleteSaves(paths);
		}
	}
	if(selectedItem->text()=="PCSP")
	{
			QList<QString> paths;
			for(int i=0; i<list.size(); i++)
			{
			  QString cacheid =list[i].sibling(list[i].row(), 5).data(Qt::DisplayRole).toString();
			  paths.append(cacheid);
			}
			copySaves(paths,"PCSP");
	}
	if(selectedItem->text()=="JPCSP")
	{
			QList<QString> paths;
			for(int i=0; i<list.size(); i++)
			{
			  QString cacheid =list[i].sibling(list[i].row(), 5).data(Qt::DisplayRole).toString();
			  paths.append(cacheid);
			}
			copySaves(paths,"JPCSP");
	}
	if(selectedItem->text()=="PSPE4ALL")
	{
			QList<QString> paths;
			for(int i=0; i<list.size(); i++)
			{
			  QString cacheid =list[i].sibling(list[i].row(), 5).data(Qt::DisplayRole).toString();
			  paths.append(cacheid);
			}
			copySaves(paths,"PSPE4ALL");
	}
	if(selectedItem->text()=="Local Folder")
	{
			QList<QString> paths;
			for(int i=0; i<list.size(); i++)
			{
			  QString cacheid =list[i].sibling(list[i].row(), 5).data(Qt::DisplayRole).toString();
			  paths.append(cacheid);
			}
			copySaves(paths,"Local Folder");
	}
	if(selectedItem->text()=="PSP Device")
	{
			QList<QString> paths;
			for(int i=0; i<list.size(); i++)
			{
			  QString cacheid =list[i].sibling(list[i].row(), 5).data(Qt::DisplayRole).toString();
			  paths.append(cacheid);
			}
			copySaves(paths,"PSP Device");
	}

	

}