#include "layouts_settings.h"

const static QString STATE_PROP = "state";
const static QString GEOMETRY_PROP = "geometry";
const static QString SIZE_PROP = "widgetSize";

const static QString GROUP_MAIN_WINDOW = "mainWindow";
const static QString GROUP_DECK_EDITOR = "deckEditor";
const static QString GROUP_VISUAL_DECK_EDITOR = "visualDeckEditor";
const static QString GROUP_DECK_EDITOR_DB = "deckEditorDb";
const static QString GROUP_SETS_DIALOG = "setsDialog";
const static QString GROUP_TOKEN_DIALOG = "tokenDialog";
const static QString GROUP_GAME_PLAY_AREA = "gamePlayArea";
const static QString GROUP_REPLAY_PLAY_AREA = "replayPlayArea";

LayoutsSettings::LayoutsSettings(const QString &settingPath, QObject *parent)
    : SettingsManager(settingPath + "layouts.ini", QString(), QString(), parent)
{
}

void LayoutsSettings::setMainWindowGeometry(const QByteArray &value)
{
    setValue(value, GEOMETRY_PROP, GROUP_MAIN_WINDOW);
}

QByteArray LayoutsSettings::getMainWindowGeometry() const
{
    return getValue(GEOMETRY_PROP, GROUP_MAIN_WINDOW).toByteArray();
}

QByteArray LayoutsSettings::getDeckEditorLayoutState() const
{
    return getValue(STATE_PROP, GROUP_DECK_EDITOR).toByteArray();
}

void LayoutsSettings::setDeckEditorLayoutState(const QByteArray &value)
{
    setValue(value, STATE_PROP, GROUP_DECK_EDITOR);
}

QByteArray LayoutsSettings::getDeckEditorGeometry() const
{
    return getValue(GEOMETRY_PROP, GROUP_DECK_EDITOR).toByteArray();
}

void LayoutsSettings::setDeckEditorGeometry(const QByteArray &value)
{
    setValue(value, GEOMETRY_PROP, GROUP_DECK_EDITOR);
}

QByteArray LayoutsSettings::getVisualDeckEditorLayoutState() const
{
    return getValue(STATE_PROP, GROUP_VISUAL_DECK_EDITOR).toByteArray();
}

void LayoutsSettings::setVisualDeckEditorLayoutState(const QByteArray &value)
{
    setValue(value, STATE_PROP, GROUP_VISUAL_DECK_EDITOR);
}

QByteArray LayoutsSettings::getVisualDeckEditorGeometry() const
{
    return getValue(GEOMETRY_PROP, GROUP_VISUAL_DECK_EDITOR).toByteArray();
}

void LayoutsSettings::setVisualDeckEditorGeometry(const QByteArray &value)
{
    setValue(value, GEOMETRY_PROP, GROUP_VISUAL_DECK_EDITOR);
}

QByteArray LayoutsSettings::getDeckEditorDbHeaderState() const
{
    return getValue(STATE_PROP, GROUP_DECK_EDITOR_DB, "header").toByteArray();
}

void LayoutsSettings::setDeckEditorDbHeaderState(const QByteArray &value)
{
    setValue(value, STATE_PROP, GROUP_DECK_EDITOR_DB, "header");
}

QByteArray LayoutsSettings::getSetsDialogHeaderState() const
{
    return getValue(STATE_PROP, GROUP_SETS_DIALOG, "header").toByteArray();
}

void LayoutsSettings::setSetsDialogHeaderState(const QByteArray &value)
{
    setValue(value, STATE_PROP, GROUP_SETS_DIALOG, "header");
}

void LayoutsSettings::setSetsDialogGeometry(const QByteArray &value)
{
    setValue(value, GEOMETRY_PROP, GROUP_SETS_DIALOG);
}

QByteArray LayoutsSettings::getSetsDialogGeometry() const
{
    return getValue(GEOMETRY_PROP, GROUP_SETS_DIALOG).toByteArray();
}

void LayoutsSettings::setTokenDialogGeometry(const QByteArray &value)
{
    setValue(value, GEOMETRY_PROP, GROUP_TOKEN_DIALOG);
}

QByteArray LayoutsSettings::getTokenDialogGeometry() const
{
    return getValue(GEOMETRY_PROP, GROUP_TOKEN_DIALOG).toByteArray();
}

void LayoutsSettings::setGamePlayAreaGeometry(const QByteArray &value)
{
    setValue(value, GEOMETRY_PROP, GROUP_GAME_PLAY_AREA);
}

void LayoutsSettings::setGamePlayAreaState(const QByteArray &value)
{
    setValue(value, STATE_PROP, GROUP_GAME_PLAY_AREA);
}

QByteArray LayoutsSettings::getGamePlayAreaLayoutState() const
{
    return getValue(STATE_PROP, GROUP_GAME_PLAY_AREA).toByteArray();
}

QByteArray LayoutsSettings::getGamePlayAreaGeometry() const
{
    return getValue(GEOMETRY_PROP, GROUP_GAME_PLAY_AREA).toByteArray();
}

void LayoutsSettings::setReplayPlayAreaGeometry(const QByteArray &value)
{
    setValue(value, GEOMETRY_PROP, GROUP_REPLAY_PLAY_AREA);
}

void LayoutsSettings::setReplayPlayAreaState(const QByteArray &value)
{
    setValue(value, STATE_PROP, GROUP_REPLAY_PLAY_AREA);
}

QByteArray LayoutsSettings::getReplayPlayAreaLayoutState() const
{
    return getValue(STATE_PROP, GROUP_REPLAY_PLAY_AREA).toByteArray();
}

QByteArray LayoutsSettings::getReplayPlayAreaGeometry() const
{
    return getValue(GEOMETRY_PROP, GROUP_REPLAY_PLAY_AREA).toByteArray();
}
