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