[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]; return m_status[drvNo];
} }
void RomScanDialog::setStatus(int drvNo, char stat)
{
if (drvNo < 0 && drvNo >= nBurnDrvCount)
return;
m_status[drvNo] = stat;
}
void RomScanDialog::cancel() void RomScanDialog::cancel()
{ {
close(); close();

View File

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

View File

@ -44,6 +44,12 @@ SelectDialog::SelectDialog(QWidget *parent) :
m_showUnavailable = true; m_showUnavailable = true;
m_showClones = true; m_showClones = true;
m_showCount = 0; 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() 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() void SelectDialog::editRomPaths()
{ {
m_romPathEditor->exec(); m_romPathEditor->exec();

View File

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