[Qt] Add 'Rescan this romset' feature.

This commit is contained in:
Marcos Medeiros 2014-07-11 01:04:28 +00:00
parent a54d0feae2
commit 539d420bc0
4 changed files with 38 additions and 0 deletions

View File

@ -39,6 +39,13 @@ int RomScanDialog::status(int drvNo)
return m_status[drvNo];
}
void RomScanDialog::setStatus(int drvNo, char stat)
{
if (drvNo < 0 && drvNo >= nBurnDrvCount)
return;
m_status[drvNo] = stat;
}
void RomScanDialog::cancel()
{
close();

View File

@ -32,6 +32,7 @@ public:
explicit RomScanDialog(QWidget *parent = 0);
~RomScanDialog();
int status(int drvNo);
void setStatus(int drvNo, char stat);
public slots:
void cancel();
protected:

View File

@ -44,6 +44,12 @@ SelectDialog::SelectDialog(QWidget *parent) :
m_showUnavailable = true;
m_showClones = true;
m_showCount = 0;
QMenu *contextMenu = new QMenu(ui->tvDrivers);
m_actionScanThis = new QAction("Rescan this romset", contextMenu);
ui->tvDrivers->setContextMenuPolicy(Qt::ActionsContextMenu);
ui->tvDrivers->addAction(m_actionScanThis);
connect(m_actionScanThis, SIGNAL(triggered()), this, SLOT(rescanRomset()));
}
SelectDialog::~SelectDialog()
@ -159,6 +165,28 @@ void SelectDialog::rescanRoms()
}
}
void SelectDialog::rescanRomset()
{
int tmp = nBurnDrvActive;
nBurnDrvActive = m_selectedDriver;
int stat = BzipOpen(1);
switch (stat) {
case 0:
m_romScanner->setStatus(m_selectedDriver, 3);
break;
case 2:
m_romScanner->setStatus(m_selectedDriver, 1);
break;
case 1:
default:
m_romScanner->setStatus(m_selectedDriver, 0);
break;
}
BzipClose();
nBurnDrvActive = tmp;
filterDrivers();
}
void SelectDialog::editRomPaths()
{
m_romPathEditor->exec();

View File

@ -46,6 +46,7 @@ public:
public slots:
void openRomInfo();
void rescanRoms();
void rescanRomset();
void editRomPaths();
void driverChange(QTreeWidgetItem * item, QTreeWidgetItem * prev);
void driverSelect(QTreeWidgetItem * item, int column);
@ -79,6 +80,7 @@ private:
int m_showCount;
QPixmap m_defaultImage;
QAction *m_actionScanThis;
};
#endif // SELECTDIALOG_H