Game: save and restore dock sizes
This commit is contained in:
parent
cddb45085c
commit
058b913455
4 changed files with 151 additions and 7 deletions
|
@ -78,6 +78,39 @@ const QByteArray LayoutsSettings::getGamePlayAreaGeometry()
|
||||||
return getValue("layouts/gameplayarea_geometry").toByteArray();
|
return getValue("layouts/gameplayarea_geometry").toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QSize LayoutsSettings::getGameCardInfoSize()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("layouts/gameplayarea_CardInfoSize");
|
||||||
|
return previous == QVariant() ? QSize(250,360) : previous.toSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setGameCardInfoSize(const QSize &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/gameplayarea_CardInfoSize");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QSize LayoutsSettings::getGameMessageLayoutSize()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("layouts/gameplayarea_MessageLayoutSize");
|
||||||
|
return previous == QVariant() ? QSize(250,250) : previous.toSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setGameMessageLayoutSize(const QSize &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/gameplayarea_MessageLayoutSize");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QSize LayoutsSettings::getGamePlayerListSize()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("layouts/gameplayarea_PlayerListSize");
|
||||||
|
return previous == QVariant() ? QSize(250,50) : previous.toSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setGamePlayerListSize(const QSize &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/gameplayarea_PlayerListSize");
|
||||||
|
}
|
||||||
|
|
||||||
void LayoutsSettings::setReplayPlayAreaGeometry(const QByteArray &value)
|
void LayoutsSettings::setReplayPlayAreaGeometry(const QByteArray &value)
|
||||||
{
|
{
|
||||||
setValue(value,"layouts/replayplayarea_geometry");
|
setValue(value,"layouts/replayplayarea_geometry");
|
||||||
|
@ -97,3 +130,47 @@ const QByteArray LayoutsSettings::getReplayPlayAreaGeometry()
|
||||||
{
|
{
|
||||||
return getValue("layouts/replayplayarea_geometry").toByteArray();
|
return getValue("layouts/replayplayarea_geometry").toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QSize LayoutsSettings::getReplayCardInfoSize()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("layouts/replayplayarea_CardInfoSize");
|
||||||
|
return previous == QVariant() ? QSize(250,360) : previous.toSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setReplayCardInfoSize(const QSize &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/replayplayarea_CardInfoSize");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QSize LayoutsSettings::getReplayMessageLayoutSize()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("layouts/replayplayarea_MessageLayoutSize");
|
||||||
|
return previous == QVariant() ? QSize(250,200) : previous.toSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setReplayMessageLayoutSize(const QSize &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/replayplayarea_MessageLayoutSize");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QSize LayoutsSettings::getReplayPlayerListSize()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("layouts/replayplayarea_PlayerListSize");
|
||||||
|
return previous == QVariant() ? QSize(250,50) : previous.toSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setReplayPlayerListSize(const QSize &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/replayplayarea_PlayerListSize");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QSize LayoutsSettings::getReplayReplaySize()
|
||||||
|
{
|
||||||
|
QVariant previous = getValue("layouts/replayplayarea_ReplaySize");
|
||||||
|
return previous == QVariant() ? QSize(900,100) : previous.toSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setReplayReplaySize(const QSize &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/replayplayarea_ReplaySize");
|
||||||
|
}
|
|
@ -15,20 +15,38 @@ public:
|
||||||
void setDeckEditorCardSize(const QSize &value);
|
void setDeckEditorCardSize(const QSize &value);
|
||||||
void setDeckEditorDeckSize(const QSize &value);
|
void setDeckEditorDeckSize(const QSize &value);
|
||||||
void setDeckEditorFilterSize(const QSize &value);
|
void setDeckEditorFilterSize(const QSize &value);
|
||||||
|
|
||||||
void setGamePlayAreaGeometry(const QByteArray &value);
|
void setGamePlayAreaGeometry(const QByteArray &value);
|
||||||
void setGamePlayAreaState(const QByteArray &value);
|
void setGamePlayAreaState(const QByteArray &value);
|
||||||
|
void setGameCardInfoSize(const QSize &value);
|
||||||
|
void setGameMessageLayoutSize(const QSize &value);
|
||||||
|
void setGamePlayerListSize(const QSize &value);
|
||||||
|
|
||||||
void setReplayPlayAreaGeometry(const QByteArray &value);
|
void setReplayPlayAreaGeometry(const QByteArray &value);
|
||||||
void setReplayPlayAreaState(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);
|
||||||
|
|
||||||
const QByteArray getDeckEditorLayoutState();
|
const QByteArray getDeckEditorLayoutState();
|
||||||
const QByteArray getDeckEditorGeometry();
|
const QByteArray getDeckEditorGeometry();
|
||||||
const QSize getDeckEditorCardSize();
|
const QSize getDeckEditorCardSize();
|
||||||
const QSize getDeckEditorDeckSize();
|
const QSize getDeckEditorDeckSize();
|
||||||
const QSize getDeckEditorFilterSize();
|
const QSize getDeckEditorFilterSize();
|
||||||
|
|
||||||
const QByteArray getGamePlayAreaLayoutState();
|
const QByteArray getGamePlayAreaLayoutState();
|
||||||
const QByteArray getGamePlayAreaGeometry();
|
const QByteArray getGamePlayAreaGeometry();
|
||||||
|
const QSize getGameCardInfoSize();
|
||||||
|
const QSize getGameMessageLayoutSize();
|
||||||
|
const QSize getGamePlayerListSize();
|
||||||
|
|
||||||
const QByteArray getReplayPlayAreaLayoutState();
|
const QByteArray getReplayPlayAreaLayoutState();
|
||||||
const QByteArray getReplayPlayAreaGeometry();
|
const QByteArray getReplayPlayAreaGeometry();
|
||||||
|
const QSize getReplayCardInfoSize();
|
||||||
|
const QSize getReplayMessageLayoutSize();
|
||||||
|
const QSize getReplayPlayerListSize();
|
||||||
|
const QSize getReplayReplaySize();
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -362,6 +362,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
messageLog->logReplayStarted(gameInfo.game_id());
|
messageLog->logReplayStarted(gameInfo.game_id());
|
||||||
|
|
||||||
|
this->installEventFilter(this);
|
||||||
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,6 +411,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
|
||||||
for (int i = gameInfo.game_types_size() - 1; i >= 0; i--)
|
for (int i = gameInfo.game_types_size() - 1; i >= 0; i--)
|
||||||
gameTypes.append(roomGameTypes.find(gameInfo.game_types(i)).value());
|
gameTypes.append(roomGameTypes.find(gameInfo.game_types(i)).value());
|
||||||
|
|
||||||
|
this->installEventFilter(this);
|
||||||
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,14 +428,7 @@ void TabGame::emitUserEvent() {
|
||||||
TabGame::~TabGame()
|
TabGame::~TabGame()
|
||||||
{
|
{
|
||||||
if(replay)
|
if(replay)
|
||||||
{
|
|
||||||
settingsCache->layouts().setReplayPlayAreaState(saveState());
|
|
||||||
settingsCache->layouts().setReplayPlayAreaGeometry(saveGeometry());
|
|
||||||
delete replay;
|
delete replay;
|
||||||
} else {
|
|
||||||
settingsCache->layouts().setGamePlayAreaState(saveState());
|
|
||||||
settingsCache->layouts().setGamePlayAreaGeometry(saveGeometry());
|
|
||||||
}
|
|
||||||
|
|
||||||
QMapIterator<int, Player *> i(players);
|
QMapIterator<int, Player *> i(players);
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
|
@ -1335,9 +1330,25 @@ void TabGame::loadLayout()
|
||||||
{
|
{
|
||||||
restoreGeometry(settingsCache->layouts().getReplayPlayAreaGeometry());
|
restoreGeometry(settingsCache->layouts().getReplayPlayAreaGeometry());
|
||||||
restoreState(settingsCache->layouts().getReplayPlayAreaLayoutState());
|
restoreState(settingsCache->layouts().getReplayPlayAreaLayoutState());
|
||||||
|
|
||||||
|
cardInfoDock->setMinimumSize(settingsCache->layouts().getReplayCardInfoSize());
|
||||||
|
cardInfoDock->setMaximumSize(settingsCache->layouts().getReplayCardInfoSize());
|
||||||
|
messageLayoutDock->setMinimumSize(settingsCache->layouts().getReplayMessageLayoutSize());
|
||||||
|
messageLayoutDock->setMaximumSize(settingsCache->layouts().getReplayMessageLayoutSize());
|
||||||
|
playerListDock->setMinimumSize(settingsCache->layouts().getReplayPlayerListSize());
|
||||||
|
playerListDock->setMaximumSize(settingsCache->layouts().getReplayPlayerListSize());
|
||||||
|
replayDock->setMinimumSize(settingsCache->layouts().getReplayReplaySize());
|
||||||
|
replayDock->setMaximumSize(settingsCache->layouts().getReplayReplaySize());
|
||||||
} else {
|
} else {
|
||||||
restoreGeometry(settingsCache->layouts().getGamePlayAreaGeometry());
|
restoreGeometry(settingsCache->layouts().getGamePlayAreaGeometry());
|
||||||
restoreState(settingsCache->layouts().getGamePlayAreaLayoutState());
|
restoreState(settingsCache->layouts().getGamePlayAreaLayoutState());
|
||||||
|
|
||||||
|
cardInfoDock->setMinimumSize(settingsCache->layouts().getGameCardInfoSize());
|
||||||
|
cardInfoDock->setMaximumSize(settingsCache->layouts().getGameCardInfoSize());
|
||||||
|
messageLayoutDock->setMinimumSize(settingsCache->layouts().getGameMessageLayoutSize());
|
||||||
|
messageLayoutDock->setMaximumSize(settingsCache->layouts().getGameMessageLayoutSize());
|
||||||
|
playerListDock->setMinimumSize(settingsCache->layouts().getGamePlayerListSize());
|
||||||
|
playerListDock->setMaximumSize(settingsCache->layouts().getGamePlayerListSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
aCardInfoDockVisible->setChecked(cardInfoDock->isVisible());
|
aCardInfoDockVisible->setChecked(cardInfoDock->isVisible());
|
||||||
|
@ -1358,6 +1369,26 @@ void TabGame::loadLayout()
|
||||||
aReplayDockFloating->setEnabled(aReplayDockVisible->isChecked());
|
aReplayDockFloating->setEnabled(aReplayDockVisible->isChecked());
|
||||||
aReplayDockFloating->setChecked(replayDock->isFloating());
|
aReplayDockFloating->setChecked(replayDock->isFloating());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTimer::singleShot(100, this, SLOT(freeDocksSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabGame::freeDocksSize()
|
||||||
|
{
|
||||||
|
cardInfoDock->setMinimumSize(100, 100);
|
||||||
|
cardInfoDock->setMaximumSize(5000, 5000);
|
||||||
|
|
||||||
|
messageLayoutDock->setMinimumSize(100, 100);
|
||||||
|
messageLayoutDock->setMaximumSize(5000, 5000);
|
||||||
|
|
||||||
|
playerListDock->setMinimumSize(100,100);
|
||||||
|
playerListDock->setMaximumSize(5000,5000);
|
||||||
|
|
||||||
|
if(replayDock)
|
||||||
|
{
|
||||||
|
replayDock->setMinimumSize(100,100);
|
||||||
|
replayDock->setMaximumSize(5000,5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::actResetLayout()
|
void TabGame::actResetLayout()
|
||||||
|
@ -1595,6 +1626,23 @@ bool TabGame::eventFilter(QObject * o, QEvent * e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( o == this && e->type() == QEvent::Hide){
|
||||||
|
if(replay)
|
||||||
|
{
|
||||||
|
settingsCache->layouts().setReplayPlayAreaState(saveState());
|
||||||
|
settingsCache->layouts().setReplayPlayAreaGeometry(saveGeometry());
|
||||||
|
settingsCache->layouts().setReplayCardInfoSize(cardInfoDock->size());
|
||||||
|
settingsCache->layouts().setReplayMessageLayoutSize(messageLayoutDock->size());
|
||||||
|
settingsCache->layouts().setReplayPlayerListSize(playerListDock->size());
|
||||||
|
settingsCache->layouts().setReplayReplaySize(replayDock->size());
|
||||||
|
} else {
|
||||||
|
settingsCache->layouts().setGamePlayAreaState(saveState());
|
||||||
|
settingsCache->layouts().setGamePlayAreaGeometry(saveGeometry());
|
||||||
|
settingsCache->layouts().setGameCardInfoSize(cardInfoDock->size());
|
||||||
|
settingsCache->layouts().setGameMessageLayoutSize(messageLayoutDock->size());
|
||||||
|
settingsCache->layouts().setGamePlayerListSize(playerListDock->size());
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,7 @@ private slots:
|
||||||
void loadLayout();
|
void loadLayout();
|
||||||
void actCompleterChanged();
|
void actCompleterChanged();
|
||||||
void actResetLayout();
|
void actResetLayout();
|
||||||
|
void freeDocksSize();
|
||||||
|
|
||||||
bool eventFilter(QObject *o, QEvent *e);
|
bool eventFilter(QObject *o, QEvent *e);
|
||||||
void dockVisibleTriggered();
|
void dockVisibleTriggered();
|
||||||
|
|
Loading…
Reference in a new issue