MythTV  master
gamescan.h
Go to the documentation of this file.
1 #ifndef GAMESCAN_H
2 #define GAMESCAN_H
3 
4 #include <set>
5 #include <map>
6 
7 #include <QObject> // for moc
8 #include <QStringList>
9 #include <QMap>
10 
11 #include "mthread.h"
12 
13 class QStringList;
14 
16 class GameHandler;
17 class RomInfo;
18 
20 {
21  QString system;
22  QString gametype;
23  QString romfile;
24  QString rompath;
25  QString romname;
26  bool indb;
27 };
28 
29 typedef QList< RomFileInfo > RomFileInfoList;
30 
31 class GameScannerThread : public MThread
32 {
33  public:
34  explicit GameScannerThread(void);
35  ~GameScannerThread() = default;
36 
37  void run(void) override; // MThread
38 
39  void SetHandlers(QList<GameHandler*> handlers) { m_handlers = handlers; };
40  void SetProgressDialog(MythUIProgressDialog *dialog) { m_dialog = dialog; };
41 
42  bool getDataChanged() { return m_DBDataChanged; };
43 
44  private:
45 
46  void removeOrphan(const int id);
47 
48  void verifyFiles();
49  void updateDB();
50 
51  bool buildFileList();
52 
53  void SendProgressEvent(uint progress, uint total = 0,
54  QString message = QString());
55 
56  bool m_HasGUI;
57 
58  QList<GameHandler*> m_handlers;
59 
61  QList<uint> m_remove;
62  QList<RomInfo*> m_dbgames;
63 
65 
66  bool m_DBDataChanged {false};
67 };
68 
69 class GameScanner : public QObject
70 {
71  Q_OBJECT
72 
73  public:
74  GameScanner();
75  ~GameScanner();
76 
77  void doScan(QList<GameHandler*> handlers);
78  void doScanAll(void);
79 
80  signals:
81  void finished(bool);
82 
83  public slots:
84  void finishedScan();
85 
86  private:
88 };
89 
90 #endif
bool indb
Definition: gamescan.h:26
void doScan(QList< GameHandler * > handlers)
Definition: gamescan.cpp:200
bool getDataChanged()
Definition: gamescan.h:42
void verifyFiles()
Definition: gamescan.cpp:58
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
unsigned int slots[4]
Definition: element.c:38
void doScanAll(void)
Definition: gamescan.cpp:232
GameScannerThread * m_scanThread
Definition: gamescan.h:87
MythUIProgressDialog * m_dialog
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:29
bool buildFileList()
Definition: gamescan.cpp:131
QList< RomFileInfo > RomFileInfoList
Definition: gamescan.h:29
QList< uint > m_remove
Definition: gamescan.h:61
unsigned int uint
Definition: compat.h:140
void removeOrphan(const int id)
Definition: gamescan.cpp:47
void SetHandlers(QList< GameHandler * > handlers)
Definition: gamescan.h:39
QString romfile
Definition: gamescan.h:23
void finished(bool)
QList< GameHandler * > m_handlers
Definition: gamescan.h:58
QString romname
Definition: gamescan.h:25
QList< RomInfo * > m_dbgames
Definition: gamescan.h:62
void finishedScan()
Definition: gamescan.cpp:254
RomFileInfoList m_files
Definition: gamescan.h:60
~GameScannerThread()=default
bool m_DBDataChanged
Definition: gamescan.h:66
GameScannerThread(void)
Definition: gamescan.cpp:23
void SendProgressEvent(uint progress, uint total=0, QString message=QString())
Definition: gamescan.cpp:178
static QList< GameHandler * > * handlers
Definition: gamehandler.cpp:23
QString rompath
Definition: gamescan.h:24
QString gametype
Definition: gamescan.h:22
void SetProgressDialog(MythUIProgressDialog *dialog)
Definition: gamescan.h:40
QString system
Definition: gamescan.h:21