mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Redesigning deck editor to work with docks
Moved setting files & Added code for a future portable build
This commit is contained in:
parent
ba90d84a13
commit
e9e75961f4
11 changed files with 485 additions and 123 deletions
|
|
@ -1,5 +1,26 @@
|
|||
#include "settingscache.h"
|
||||
#include <QSettings>
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QStandardPaths>
|
||||
#else
|
||||
#include <QDesktopServices>
|
||||
#endif
|
||||
|
||||
QString SettingsCache::getLayoutsSettingsPath()
|
||||
{
|
||||
QString file = "";
|
||||
|
||||
#ifndef PORTABLE_BUILD
|
||||
#if QT_VERSION >= 0x050000
|
||||
file = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#else
|
||||
file = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
#endif
|
||||
file.append("/settings/layouts/");
|
||||
#endif
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
SettingsCache::SettingsCache()
|
||||
{
|
||||
|
|
@ -97,6 +118,16 @@ SettingsCache::SettingsCache()
|
|||
spectatorsCanSeeEverything = settings->value("game/spectatorscanseeeverything", false).toBool();
|
||||
clientID = settings->value("personal/clientid", "notset").toString();
|
||||
|
||||
QString file = getLayoutsSettingsPath();
|
||||
file.append("deckLayout.ini");
|
||||
|
||||
QSettings layout_settings(file , QSettings::IniFormat);
|
||||
deckEditorLayoutState = layout_settings.value("layouts/deckEditor_state").toByteArray();
|
||||
deckEditorGeometry = layout_settings.value("layouts/deckEditor_geometry").toByteArray();
|
||||
|
||||
deckEditorCardSize = layout_settings.value("layouts/deckEditor_CardSize", QSize(250,500)).toSize();
|
||||
deckEditorFilterSize = layout_settings.value("layouts/deckEditor_FilterSize", QSize(250,250)).toSize();
|
||||
deckEditorDeckSize = layout_settings.value("layouts/deckEditor_DeckSize", QSize(250,360)).toSize();
|
||||
}
|
||||
|
||||
void SettingsCache::setCardInfoViewMode(const int _viewMode) {
|
||||
|
|
@ -462,6 +493,56 @@ QStringList SettingsCache::getCountries() const
|
|||
return countries;
|
||||
}
|
||||
|
||||
void SettingsCache::setDeckEditorLayoutState(const QByteArray &value)
|
||||
{
|
||||
deckEditorLayoutState = value;
|
||||
|
||||
QString file = getLayoutsSettingsPath();
|
||||
file.append("deckLayout.ini");
|
||||
QSettings layout_settings(file , QSettings::IniFormat);
|
||||
layout_settings.setValue("layouts/deckEditor_state",value);
|
||||
}
|
||||
|
||||
void SettingsCache::setDeckEditorGeometry(const QByteArray &value)
|
||||
{
|
||||
deckEditorGeometry = value;
|
||||
|
||||
QString file = getLayoutsSettingsPath();
|
||||
file.append("deckLayout.ini");
|
||||
QSettings layout_settings(file , QSettings::IniFormat);
|
||||
layout_settings.setValue("layouts/deckEditor_geometry",value);
|
||||
}
|
||||
|
||||
void SettingsCache::setDeckEditorCardSize(const QSize &value)
|
||||
{
|
||||
deckEditorCardSize = value;
|
||||
|
||||
QString file = getLayoutsSettingsPath();
|
||||
file.append("deckLayout.ini");
|
||||
QSettings layout_settings(file , QSettings::IniFormat);
|
||||
layout_settings.setValue("layouts/deckEditor_CardSize",value);
|
||||
}
|
||||
|
||||
void SettingsCache::setDeckEditorDeckSize(const QSize &value)
|
||||
{
|
||||
deckEditorDeckSize = value;
|
||||
|
||||
QString file = getLayoutsSettingsPath();
|
||||
file.append("deckLayout.ini");
|
||||
QSettings layout_settings(file , QSettings::IniFormat);
|
||||
layout_settings.setValue("layouts/deckEditor_DeckSize",value);
|
||||
}
|
||||
|
||||
void SettingsCache::setDeckEditorFilterSize(const QSize &value)
|
||||
{
|
||||
deckEditorFilterSize = value;
|
||||
|
||||
QString file = getLayoutsSettingsPath();
|
||||
file.append("deckLayout.ini");
|
||||
QSettings layout_settings(file , QSettings::IniFormat);
|
||||
layout_settings.setValue("layouts/deckEditor_FilterSize",value);
|
||||
}
|
||||
|
||||
void SettingsCache::setGameDescription(const QString _gameDescription)
|
||||
{
|
||||
gameDescription = _gameDescription;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue