Fixed detection and control behaviour for some functions used by Preview API

This commit is contained in:
Palakis 2017-04-19 11:50:49 +02:00
parent 8c4bd91c78
commit ff8eda3682

View File

@ -261,7 +261,7 @@ bool Utils::IsPreviewModeActive()
bool buttonToggledOn = GetPreviewModeButtonControl()->isChecked(); bool buttonToggledOn = GetPreviewModeButtonControl()->isChecked();
// Clue 2 : Preview layout has more than one item // Clue 2 : Preview layout has more than one item
int previewChildCount = GetPreviewLayout()->children().count(); int previewChildCount = GetPreviewLayout()->count();
blog(LOG_INFO, "preview layout children count : %d", previewChildCount); blog(LOG_INFO, "preview layout children count : %d", previewChildCount);
return buttonToggledOn || (previewChildCount >= 2); return buttonToggledOn || (previewChildCount >= 2);
@ -269,17 +269,19 @@ bool Utils::IsPreviewModeActive()
void Utils::EnablePreviewMode() void Utils::EnablePreviewMode()
{ {
GetPreviewModeButtonControl()->setChecked(true); if (!IsPreviewModeActive())
GetPreviewModeButtonControl()->click();
} }
void Utils::DisablePreviewMode() void Utils::DisablePreviewMode()
{ {
GetPreviewModeButtonControl()->setChecked(false); if (IsPreviewModeActive())
GetPreviewModeButtonControl()->click();
} }
void Utils::TogglePreviewMode() void Utils::TogglePreviewMode()
{ {
GetPreviewModeButtonControl()->toggle(); GetPreviewModeButtonControl()->click();
} }
const char* Utils::GetPreviewSceneName() const char* Utils::GetPreviewSceneName()