rpcsx/rpcs3/rpcs3qt/persistent_settings.cpp
Megamouse 5f247cbedc Qt: Backup current gui config before applying another one
Also fixes some strange issues caused by the pointer
2020-03-08 00:06:48 +01:00

30 lines
962 B
C++

#include "persistent_settings.h"
persistent_settings::persistent_settings(QObject* parent) : settings(parent)
{
// Don't use the .ini file ending for now, as it will be confused for a regular gui_settings file.
m_settings.reset(new QSettings(ComputeSettingsDir() + gui::persistent::persistent_file_name + ".dat", QSettings::Format::IniFormat, parent));
}
void persistent_settings::SetPlaytime(const QString& serial, const qint64& elapsed)
{
m_playtime[serial] = std::max<qint64>(0, elapsed);
SetValue(gui::persistent::playtime, serial, m_playtime[serial]);
}
qint64 persistent_settings::GetPlaytime(const QString& serial)
{
return std::max<qint64>(0, m_playtime[serial]);
}
void persistent_settings::SetLastPlayed(const QString& serial, const QString& date)
{
m_last_played[serial] = date;
SetValue(gui::persistent::last_played, serial, date);
}
QString persistent_settings::GetLastPlayed(const QString& serial)
{
return m_last_played[serial];
}