37 LOG(VB_GENERAL, LOG_INFO, QString(
"Beginning Game Scan."));
47 LOG(VB_GENERAL, LOG_INFO, QString(
"Finished Game Scan."));
58 info->DeleteFromDatabase();
70 GameScanner::tr(
"Verifying game files..."));
75 QString romfile =
info->Romname();
76 QString gametype =
info->GameType();
77 if (!romfile.isEmpty())
83 if ((*p2).romfile == romfile &&
84 (*p2).gametype == gametype)
110 GameScanner::tr(
"Updating game database..."));
117 file.romname,
"",
"",
false,
file.rompath,
118 "",
"", 0,
file.gametype, 0,
"",
"",
"",
143 GameScanner::tr(
"Searching for games..."));
145 for (
auto * handler : std::as_const(
m_handlers))
147 QDir dir(handler->SystemRomPath());
148 QStringList extensions = handler->ValidExtensions();
150 for (
const auto & ext : std::as_const(extensions))
152 filters.append(QString(
"*.%1").arg(ext));
155 dir.setNameFilters(filters);
156 dir.setFilter(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);
158 QStringList files = dir.entryList();
159 for (
const auto &
file : std::as_const(files))
162 info.system = handler->SystemName();
163 info.gametype = handler->GameType();
165 info.rompath = handler->SystemRomPath();
166 info.romname = QFileInfo(
file).baseName();
185 QApplication::postEvent(
m_dialog, pue);
209 popupStack,
"gamescanprogressdialog");
211 if (progressDlg->Create())
213 popupStack->
AddScreen(progressDlg,
false);
222 progressDlg =
nullptr;
233 QList<GameHandler*> hlist;
236 query.
prepare(
"SELECT DISTINCT playername FROM gameplayers "
237 "WHERE playername <> '';");
244 QString name = query.
value(0).toString();
static GameHandler * GetHandlerByName(const QString &systemname)
QList< GameHandler * > m_handlers
QList< RomInfo * > m_dbgames
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
void SetProgressDialog(MythUIProgressDialog *dialog)
void SendProgressEvent(uint progress, uint total=0, QString message=QString())
bool getDataChanged() const
MythUIProgressDialog * m_dialog
void SetHandlers(QList< GameHandler * > handlers)
static void removeOrphan(int id)
GameScannerThread * m_scanThread
void doScan(QList< GameHandler * > handlers)
QSqlQuery wrapper that fetches a DB connection from the connection pool.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
This is a wrapper around QThread that does several additional things.
bool isRunning(void) const
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
QThread * qthread(void)
Returns the thread, this will always return the same pointer no matter how often you restart the thre...
static void DBError(const QString &where, const MSqlQuery &query)
MythScreenStack * GetStack(const QString &Stackname)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythUIProgressDialog(QString message, MythScreenStack *parent, const char *name)
void SaveToDatabase() const
static QList< RomInfo * > GetAllRomInfo()
static RomInfo * GetRomInfoById(int id)
static QList< GameHandler * > * handlers
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)