summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/UI
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-04-09 15:13:00 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2019-04-09 12:20:53 +0000
commit8056a23046cd93f557299b263973dac7a9255b29 (patch)
tree0af62324cfbe1949725d77b4ed6afcbfdba83a53 /src/Authoring/Studio/UI
parent76153c4ce6c073fcd89638bcc621c3fac0b51838 (diff)
Fix setting default startup view
It was not possible to set the scene camera as the start up view. This patch fixes that. Change-Id: I4a64c747c148481627403f980273b4f6fa879607 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/UI')
-rw-r--r--src/Authoring/Studio/UI/EditCameraBar.cpp2
-rw-r--r--src/Authoring/Studio/UI/StudioAppPrefsPage.cpp13
-rw-r--r--src/Authoring/Studio/UI/StudioAppPrefsPage.h2
3 files changed, 8 insertions, 9 deletions
diff --git a/src/Authoring/Studio/UI/EditCameraBar.cpp b/src/Authoring/Studio/UI/EditCameraBar.cpp
index 2789eb6f..5675f978 100644
--- a/src/Authoring/Studio/UI/EditCameraBar.cpp
+++ b/src/Authoring/Studio/UI/EditCameraBar.cpp
@@ -71,7 +71,7 @@ void CEditCameraBar::setupCameras()
// set initial view
int viewIndex = CStudioPreferences::GetPreferredStartupView();
// if not set or invalid index, use the scene camera view (last index)
- if (viewIndex == -1 || viewIndex > m_CameraSelector->count() - 1)
+ if (viewIndex == -1 || viewIndex > m_CameraSelector->count() - 3)
viewIndex = m_CameraSelector->count() - 1;
m_CameraSelector->setCurrentIndex(viewIndex);
diff --git a/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp b/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
index 8882a4b0..36d9f247 100644
--- a/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
+++ b/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
@@ -182,7 +182,7 @@ void CStudioAppPrefsPage::loadSettings()
m_ui->autosaveEnabled->setChecked(CStudioPreferences::GetAutoSavePreference());
m_ui->autosaveInterval->setValue(CStudioPreferences::GetAutoSaveDelay());
- onitEditStartViewCombo();
+ initEditStartViewCombo();
enableOptions();
@@ -296,7 +296,7 @@ void CStudioAppPrefsPage::enableOptions()
* Set the initial selection to that saved to the preferences
*/
//==============================================================================
-void CStudioAppPrefsPage::onitEditStartViewCombo()
+void CStudioAppPrefsPage::initEditStartViewCombo()
{
Q3DStudio::IStudioRenderer &theRenderer = g_StudioApp.getRenderer();
QStringList theCameraNames;
@@ -311,12 +311,11 @@ void CStudioAppPrefsPage::onitEditStartViewCombo()
long thePreferredView = CStudioPreferences::GetPreferredStartupView();
long theNumItems = m_ui->m_EditViewStartupView->count();
- if (thePreferredView == -1) // if not set, set to scene camera view
- m_ui->m_EditViewStartupView->setCurrentIndex(theNumItems - 1);
- else if (thePreferredView < theNumItems - 1)
+
+ if (thePreferredView >= 0 && thePreferredView < theNumItems - 2)
m_ui->m_EditViewStartupView->setCurrentIndex(thePreferredView);
- else // possibly from old content where cameras are removed
- m_ui->m_EditViewStartupView->setCurrentIndex(0);
+ else // default to scene camera view
+ m_ui->m_EditViewStartupView->setCurrentIndex(theNumItems - 1);
}
#if 0 // Removed until we have some other Preview configurations than just Viewer
diff --git a/src/Authoring/Studio/UI/StudioAppPrefsPage.h b/src/Authoring/Studio/UI/StudioAppPrefsPage.h
index df9a6863..abea304b 100644
--- a/src/Authoring/Studio/UI/StudioAppPrefsPage.h
+++ b/src/Authoring/Studio/UI/StudioAppPrefsPage.h
@@ -80,7 +80,7 @@ protected:
void enableAutosave(bool enabled);
void setAutosaveInterval(int interval);
void onClearAutosaveFiles();
- void onitEditStartViewCombo();
+ void initEditStartViewCombo();
void checkRestartCondition();
protected: