MythTV master
gamescan.h
Go to the documentation of this file.
1#ifndef GAMESCAN_H
2#define GAMESCAN_H
3
4// C++
5#include <map>
6#include <set>
7#include <utility>
8
9// Qt
10#include <QMap>
11#include <QObject> // for moc
12#include <QStringList>
13
14// MythTV
15#include <libmythbase/mthread.h>
16
18class GameHandler;
19class RomInfo;
20
22{
23 QString system;
24 QString gametype;
25 QString romfile;
26 QString rompath;
27 QString romname;
28 bool indb { false };
29};
30
31using RomFileInfoList = QList< RomFileInfo >;
32
34{
35 public:
36 explicit GameScannerThread(void);
37 ~GameScannerThread() override = default;
38
39 void run(void) override; // MThread
40
41 void SetHandlers(QList<GameHandler*> handlers) { m_handlers = std::move(handlers); };
42 void SetProgressDialog(MythUIProgressDialog *dialog) { m_dialog = dialog; };
43
44 bool getDataChanged() const { return m_dbDataChanged; };
45
46 private:
47
48 static void removeOrphan(int id);
49
50 void verifyFiles();
51 void updateDB();
52
53 bool buildFileList();
54
55 void SendProgressEvent(uint progress, uint total = 0,
56 QString message = QString());
57
59
60 QList<GameHandler*> m_handlers;
61
63 QList<uint> m_remove;
64 QList<RomInfo*> m_dbgames;
65
67
68 bool m_dbDataChanged {false};
69};
70
71class GameScanner : public QObject
72{
73 Q_OBJECT
74
75 public:
77 ~GameScanner() override;
78
79 void doScan(QList<GameHandler*> handlers);
80 void doScanAll(void);
81
82 signals:
83 void finished(bool);
84
85 public slots:
86 void finishedScan();
87
88 private:
90};
91
92#endif
QList< uint > m_remove
Definition: gamescan.h:63
QList< GameHandler * > m_handlers
Definition: gamescan.h:60
RomFileInfoList m_files
Definition: gamescan.h:62
QList< RomInfo * > m_dbgames
Definition: gamescan.h:64
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: gamescan.cpp:34
void SetProgressDialog(MythUIProgressDialog *dialog)
Definition: gamescan.h:42
~GameScannerThread() override=default
void SendProgressEvent(uint progress, uint total=0, QString message=QString())
Definition: gamescan.cpp:179
bool getDataChanged() const
Definition: gamescan.h:44
void verifyFiles()
Definition: gamescan.cpp:65
MythUIProgressDialog * m_dialog
Definition: gamescan.h:66
void SetHandlers(QList< GameHandler * > handlers)
Definition: gamescan.h:41
bool buildFileList()
Definition: gamescan.cpp:135
static void removeOrphan(int id)
Definition: gamescan.cpp:54
GameScannerThread(void)
Definition: gamescan.cpp:28
bool m_dbDataChanged
Definition: gamescan.h:68
void doScanAll(void)
Definition: gamescan.cpp:232
void finishedScan()
Definition: gamescan.cpp:254
GameScannerThread * m_scanThread
Definition: gamescan.h:89
void doScan(QList< GameHandler * > handlers)
Definition: gamescan.cpp:200
~GameScanner() override
Definition: gamescan.cpp:194
void finished(bool)
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
unsigned int uint
Definition: freesurround.h:24
static QList< GameHandler * > * handlers
Definition: gamehandler.cpp:28
QList< RomFileInfo > RomFileInfoList
Definition: gamescan.h:31
bool progress
bool indb
Definition: gamescan.h:28
QString system
Definition: gamescan.h:23
QString romfile
Definition: gamescan.h:25
QString romname
Definition: gamescan.h:27
QString gametype
Definition: gamescan.h:24
QString rompath
Definition: gamescan.h:26