forked from detain/skyscraper
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathabstractfrontend.h
More file actions
106 lines (95 loc) · 3.9 KB
/
abstractfrontend.h
File metadata and controls
106 lines (95 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/***************************************************************************
* abstractfrontend.h
*
* Wed Jun 18 12:00:00 CEST 2017
* Copyright 2017 Lars Muldjord
* muldjordlars@gmail.com
****************************************************************************/
/*
* This file is part of skyscraper.
*
* skyscraper is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* skyscraper is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with skyscraper; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#ifndef ABSTRACTFRONTEND_H
#define ABSTRACTFRONTEND_H
#include "gameentry.h"
#include "queue.h"
#include "settings.h"
#include <QFileInfo>
#include <QMimeDatabase>
#include <QObject>
#include <QSharedPointer>
struct MediaProps {
GameEntry::Types type;
QByteArray *data;
QString *file;
bool skip;
QString ext;
MediaProps(GameEntry::Types type, QByteArray &data, QString &file,
bool skip)
: type(type), data(&data), file(&file), skip(skip), ext(""){};
};
class AbstractFrontend : public QObject {
Q_OBJECT
public:
AbstractFrontend();
virtual ~AbstractFrontend();
virtual void setConfig(Settings *config);
virtual void checkReqs(){};
virtual void assembleList(QString &, QList<GameEntry> &){};
virtual void skipExisting(QList<GameEntry> &, QSharedPointer<Queue>){};
virtual bool canSkip() { return false; };
virtual bool loadOldGameList(const QString &) { return false; };
virtual void preserveFromOld(GameEntry &){};
virtual const QString getPlatformOutputName() { return config->platform; };
virtual QString getGameListFileName() { return QString(); };
virtual QString getInputFolder() { return QString(); };
virtual QString getGameListFolder() { return QString(); };
virtual QString getMediaFolder() { return QString(); };
virtual QString getCoversFolder() { return QString(); };
virtual QString getScreenshotsFolder() { return QString(); };
virtual QString getWheelsFolder() { return QString(); };
virtual QString getMarqueesFolder() { return QString(); };
virtual QString getTexturesFolder() { return QString(); };
virtual QString getVideosFolder() { return QString(); };
virtual QString getManualsFolder() { return QString(); };
virtual QString getFanartsFolder() { return QString(); };
virtual QString getBackcoversFolder() { return QString(); };
virtual void sortEntries(QList<GameEntry> &gameEntries);
bool copyMedia(GameEntry::Types &, const QString &, const QString &,
GameEntry &);
signals:
void die(const int &, const QString &, const QString &);
protected:
virtual QString getTargetFileName(GameEntry::Types t,
const QString &baseName) {
(void)t;
return baseName;
};
virtual GameEntry::Types supportedMedia() {
return GameEntry::Types(GameEntry::NONE);
};
virtual bool gamelistHasMediaPaths() { return true; };
Settings *config;
QList<GameEntry> oldEntries;
QMimeDatabase mimeDb;
private:
QString getTargetFilePath(GameEntry::Types t, const QString &baseName,
const QString &subPath, const QString &cacheFn,
QString ext = "");
bool doCopy(GameEntry::Types t, const QString &src, QString &tgt,
const QByteArray &data, bool skipExisting);
};
#endif // ABSTRACTFRONTEND_H