#include <gamedemo.h>
Public Member Functions | |
DemoStore () | |
DemoStore (QDir root) | |
bool | ensureStorageExists (QWidget *parent) |
bool | importDemo (const GameDemo &demo) |
QStringList | listManagedDemos () |
GameDemo | loadManagedGameDemo (const QString &name) |
QString | mkDemoFullPath (DemoRecord::Control control, const EnginePlugin &plugin, const bool isMultiplayer) |
bool | removeManagedDemo (const QString &name) |
const QDir & | root () const |
void | saveDemoMetaData (const QString &demoName, const EnginePlugin &plugin, const QString &iwad, const QList< PWad > &pwads, const bool isMultiplayer, const QString &gameVersion=QString()) |
Static Public Member Functions | |
static QStringList | demoFileFilters () |
static GameDemo | loadGameDemo (const QString &path) |
static QString | metafile (const QString &path) |
Managed demo storage, organizes the demos and decorates them with metadata.
Definition at line 154 of file gamedemo.h.
DemoStore::DemoStore | ( | ) |
Create a DemoStore pointing to the program's default managed demo storage.
Definition at line 289 of file gamedemo.cpp.
DemoStore::DemoStore | ( | QDir | root | ) |
Create a DemoStore where demos are stored in the passed-in directory.
Definition at line 294 of file gamedemo.cpp.
|
static |
Demo filename filters in format applicable for QFileDialog.
Definition at line 299 of file gamedemo.cpp.
bool DemoStore::ensureStorageExists | ( | QWidget * | parent | ) |
Create the managed store for the DemoStore.
This method shows UI error pop-ups if something fails that informs the user about what was the cause of the failure. That's why it accepts a QWidget
to use as a parent for the QMessageBox
.
true
if it was created, false
if creation failed. Definition at line 307 of file gamedemo.cpp.
bool DemoStore::importDemo | ( | const GameDemo & | demo | ) |
Import demo described by GameDemo to the managed demos store.
GameDemo::filepath must point to a valid demo file and it's also expected that the other attributes of GameDemo will be filled with proper info about the demo.
The demo file is copied to Doomseeker's store and the metadata is saved next to it. Such imported demo then becomes indistinguishable from a normally recorded demo.
If it happens that a demo with the exactly same filename already exists in the store, then the existing demo is REMOVED.
Definition at line 369 of file gamedemo.cpp.
QStringList DemoStore::listManagedDemos | ( | ) |
List all the demo files managed by Doomseeker.
The returned elements should be treated as names that exist and are unique within the DemoStore. If the managed demos need to be removed or otherwise manipulated, they should be referred to by the names returned here.
Definition at line 355 of file gamedemo.cpp.
|
static |
Populate GameDemo struct with the demo metadata at path.
Try to parse some of the metadata from the filename first. Then, look for the .ini file with the same name and try to read more metadata from that. If these fail, the returned GameDemo may be partially populated only.
If GameDemo::port in the returned struct is empty, the path may not be pointing to a demo file at all, or it's a demo but lacks the Doomseeker metadata. The GameDemo::filepath is guaranteed to be populated at least (it's set to the path param).
The demo doesn't need to be in the managed demo storage (hence the method is static
).
path | Direct path to either the demo file or its metadata file. |
Definition at line 587 of file gamedemo.cpp.
GameDemo DemoStore::loadManagedGameDemo | ( | const QString & | name | ) |
Load the GameDemo metadata for a managed demo by its name.
Managed demos can be listed with listManagedDemos(). If demo is not found, an empty GameDemo struct is returned – the GameDemo::filepath attribute will also be empty.
name | Name of the demo as returned by listManagedDemos(). |
Definition at line 598 of file gamedemo.cpp.
|
static |
Given the path to a demo, return the path to the metadata file.
Either path may not exist.
Definition at line 393 of file gamedemo.cpp.
QString DemoStore::mkDemoFullPath | ( | DemoRecord::Control | control, |
const EnginePlugin & | plugin, | ||
const bool | isMultiplayer | ||
) |
Create a demo name, with optional full path, basing on the passed-in parameters.
control | Decides if the demo is to be stored in DemoStore and affects if DemoStore's root path is prepended to the returned filename. This happens when control is DemoRecord::Control::Managed. |
plugin | The game with which this demo is recorded. |
isMultiplayer | Is the game running in the multiplayer mode (true ), or singleplayer (false ). |
Definition at line 398 of file gamedemo.cpp.
bool DemoStore::removeManagedDemo | ( | const QString & | name | ) |
Remove the managed demo by its name.
It also removes the metadata file if it exists.
name | Name of the demo as returned by listManagedDemos(). |
true
if the demo was removed successfully (or if it didn't exist in the first place). false
if removal failed. Definition at line 435 of file gamedemo.cpp.
const QDir & DemoStore::root | ( | ) | const |
The dir where demos are saved.
Definition at line 451 of file gamedemo.cpp.
void DemoStore::saveDemoMetaData | ( | const QString & | demoName, |
const EnginePlugin & | plugin, | ||
const QString & | iwad, | ||
const QList< PWad > & | pwads, | ||
const bool | isMultiplayer, | ||
const QString & | gameVersion = QString() |
||
) |
Save the demo's metadata in the store basing on the passed-in parameters.
demoName | Name of the demo, previously generated with mkDemoFullPath(). |
plugin | The game with which this demo is recorded. |
iwad | The IWAD used in the demo recording. |
pwads | List of PWADs and other mod files used in the demo recording, provided in the game-load order. |
isMultiplayer | Is the game running in the multiplayer mode (true ), or singleplayer (false ). |
gameVersion | The version of the game that was used to record the demo. |
Definition at line 456 of file gamedemo.cpp.