mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 10:33:54 -07:00
[LayoutSettings] Refactor how widgetSize settings are managed (#6594)
This commit is contained in:
parent
1eb6027443
commit
ac7ff3a0e9
8 changed files with 92 additions and 211 deletions
|
|
@ -47,59 +47,15 @@ void LayoutsSettings::setDeckEditorGeometry(const QByteArray &value)
|
|||
setValue(value, GEOMETRY_PROP, GROUP_DECK_EDITOR);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getDeckEditorCardDatabaseSize()
|
||||
void LayoutsSettings::setDeckEditorWidgetSize(const QString &widgetName, const QSize &value)
|
||||
{
|
||||
QVariant previous = getValue("cardDatabase", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(500, 500) : previous.toSize();
|
||||
setValue(value, widgetName, GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
}
|
||||
|
||||
void LayoutsSettings::setDeckEditorCardDatabaseSize(const QSize &value)
|
||||
QSize LayoutsSettings::getDeckEditorWidgetSize(const QString &widgetName, const QSize &defaultValue)
|
||||
{
|
||||
setValue(value, "cardDatabase", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getDeckEditorCardSize()
|
||||
{
|
||||
QVariant previous = getValue("card", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 500) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setDeckEditorCardSize(const QSize &value)
|
||||
{
|
||||
setValue(value, "card", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getDeckEditorDeckSize()
|
||||
{
|
||||
QVariant previous = getValue("deck", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setDeckEditorDeckSize(const QSize &value)
|
||||
{
|
||||
setValue(value, "deck", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getDeckEditorPrintingSelectorSize()
|
||||
{
|
||||
QVariant previous = getValue("printingSelector", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(525, 250) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setDeckEditorPrintingSelectorSize(const QSize &value)
|
||||
{
|
||||
setValue(value, "printingSelector", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getDeckEditorFilterSize()
|
||||
{
|
||||
QVariant previous = getValue("filter", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 250) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setDeckEditorFilterSize(const QSize &value)
|
||||
{
|
||||
setValue(value, "filter", GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
QVariant previous = getValue(widgetName, GROUP_DECK_EDITOR, SIZE_PROP);
|
||||
return previous == QVariant() ? defaultValue : previous.toSize();
|
||||
}
|
||||
|
||||
QByteArray LayoutsSettings::getDeckEditorDbHeaderState()
|
||||
|
|
@ -162,37 +118,15 @@ QByteArray LayoutsSettings::getGamePlayAreaGeometry()
|
|||
return getValue(GEOMETRY_PROP, GROUP_GAME_PLAY_AREA).toByteArray();
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getGameCardInfoSize()
|
||||
void LayoutsSettings::setGamePlayAreaWidgetSize(const QString &widgetName, const QSize &value)
|
||||
{
|
||||
QVariant previous = getValue("cardInfo", GROUP_GAME_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
|
||||
setValue(value, widgetName, GROUP_GAME_PLAY_AREA, SIZE_PROP);
|
||||
}
|
||||
|
||||
void LayoutsSettings::setGameCardInfoSize(const QSize &value)
|
||||
QSize LayoutsSettings::getGamePlayAreaWidgetSize(const QString &widgetName, const QSize &defaultValue)
|
||||
{
|
||||
setValue(value, "cardInfo", GROUP_GAME_PLAY_AREA, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getGameMessageLayoutSize()
|
||||
{
|
||||
QVariant previous = getValue("messageLayout", GROUP_GAME_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 250) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setGameMessageLayoutSize(const QSize &value)
|
||||
{
|
||||
setValue(value, "messageLayout", GROUP_GAME_PLAY_AREA, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getGamePlayerListSize()
|
||||
{
|
||||
QVariant previous = getValue("playerList", GROUP_GAME_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 50) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setGamePlayerListSize(const QSize &value)
|
||||
{
|
||||
setValue(value, "playerList", GROUP_GAME_PLAY_AREA, SIZE_PROP);
|
||||
QVariant previous = getValue(widgetName, GROUP_GAME_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? defaultValue : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setReplayPlayAreaGeometry(const QByteArray &value)
|
||||
|
|
@ -215,46 +149,13 @@ QByteArray LayoutsSettings::getReplayPlayAreaGeometry()
|
|||
return getValue(GEOMETRY_PROP, GROUP_REPLAY_PLAY_AREA).toByteArray();
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getReplayCardInfoSize()
|
||||
void LayoutsSettings::setReplayPlayAreaWidgetSize(const QString &widgetName, const QSize &value)
|
||||
{
|
||||
QVariant previous = getValue("cardInfo", GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
|
||||
setValue(value, widgetName, GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
}
|
||||
|
||||
void LayoutsSettings::setReplayCardInfoSize(const QSize &value)
|
||||
QSize LayoutsSettings::getReplayPlayAreaWidgetSize(const QString &widgetName, const QSize &defaultValue)
|
||||
{
|
||||
setValue(value, "cardInfo", GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getReplayMessageLayoutSize()
|
||||
{
|
||||
QVariant previous = getValue("messageLayout", GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 200) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setReplayMessageLayoutSize(const QSize &value)
|
||||
{
|
||||
setValue(value, "messageLayout", GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getReplayPlayerListSize()
|
||||
{
|
||||
QVariant previous = getValue("playerList", GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(250, 50) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setReplayPlayerListSize(const QSize &value)
|
||||
{
|
||||
setValue(value, "playerList", GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
}
|
||||
|
||||
QSize LayoutsSettings::getReplayReplaySize()
|
||||
{
|
||||
QVariant previous = getValue("replay", GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? QSize(900, 100) : previous.toSize();
|
||||
}
|
||||
|
||||
void LayoutsSettings::setReplayReplaySize(const QSize &value)
|
||||
{
|
||||
setValue(value, "replay", GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
}
|
||||
QVariant previous = getValue(widgetName, GROUP_REPLAY_PLAY_AREA, SIZE_PROP);
|
||||
return previous == QVariant() ? defaultValue : previous.toSize();
|
||||
}
|
||||
|
|
@ -21,11 +21,8 @@ public:
|
|||
|
||||
void setDeckEditorLayoutState(const QByteArray &value);
|
||||
void setDeckEditorGeometry(const QByteArray &value);
|
||||
void setDeckEditorCardDatabaseSize(const QSize &value);
|
||||
void setDeckEditorCardSize(const QSize &value);
|
||||
void setDeckEditorDeckSize(const QSize &value);
|
||||
void setDeckEditorPrintingSelectorSize(const QSize &value);
|
||||
void setDeckEditorFilterSize(const QSize &value);
|
||||
void setDeckEditorWidgetSize(const QString &widgetName, const QSize &value);
|
||||
|
||||
void setDeckEditorDbHeaderState(const QByteArray &value);
|
||||
void setSetsDialogHeaderState(const QByteArray &value);
|
||||
void setSetsDialogGeometry(const QByteArray &value);
|
||||
|
|
@ -33,26 +30,18 @@ public:
|
|||
|
||||
void setGamePlayAreaGeometry(const QByteArray &value);
|
||||
void setGamePlayAreaState(const QByteArray &value);
|
||||
void setGameCardInfoSize(const QSize &value);
|
||||
void setGameMessageLayoutSize(const QSize &value);
|
||||
void setGamePlayerListSize(const QSize &value);
|
||||
void setGamePlayAreaWidgetSize(const QString &widgetName, const QSize &value);
|
||||
|
||||
void setReplayPlayAreaGeometry(const QByteArray &value);
|
||||
void setReplayPlayAreaState(const QByteArray &value);
|
||||
void setReplayCardInfoSize(const QSize &value);
|
||||
void setReplayMessageLayoutSize(const QSize &value);
|
||||
void setReplayPlayerListSize(const QSize &value);
|
||||
void setReplayReplaySize(const QSize &value);
|
||||
void setReplayPlayAreaWidgetSize(const QString &widgetName, const QSize &value);
|
||||
|
||||
QByteArray getMainWindowGeometry();
|
||||
|
||||
QByteArray getDeckEditorLayoutState();
|
||||
QByteArray getDeckEditorGeometry();
|
||||
QSize getDeckEditorCardDatabaseSize();
|
||||
QSize getDeckEditorCardSize();
|
||||
QSize getDeckEditorDeckSize();
|
||||
QSize getDeckEditorPrintingSelectorSize();
|
||||
QSize getDeckEditorFilterSize();
|
||||
QSize getDeckEditorWidgetSize(const QString &widgetName, const QSize &defaultValue = {});
|
||||
|
||||
QByteArray getDeckEditorDbHeaderState();
|
||||
QByteArray getSetsDialogHeaderState();
|
||||
QByteArray getSetsDialogGeometry();
|
||||
|
|
@ -60,16 +49,11 @@ public:
|
|||
|
||||
QByteArray getGamePlayAreaLayoutState();
|
||||
QByteArray getGamePlayAreaGeometry();
|
||||
QSize getGameCardInfoSize();
|
||||
QSize getGameMessageLayoutSize();
|
||||
QSize getGamePlayerListSize();
|
||||
QSize getGamePlayAreaWidgetSize(const QString &widgetName, const QSize &defaultValue = {});
|
||||
|
||||
QByteArray getReplayPlayAreaLayoutState();
|
||||
QByteArray getReplayPlayAreaGeometry();
|
||||
QSize getReplayCardInfoSize();
|
||||
QSize getReplayMessageLayoutSize();
|
||||
QSize getReplayPlayerListSize();
|
||||
QSize getReplayReplaySize();
|
||||
QSize getReplayPlayAreaWidgetSize(const QString &widgetName, const QSize &defaultValue = {});
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue