diff options
author | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-10-24 08:28:39 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-10-24 11:36:56 +0000 |
commit | 08c22606cc91a4e9f5f49dc68a9d940b04c5052c (patch) | |
tree | be793610dcf83ff3fe6ba764417e02cb41766383 | |
parent | 5fc6c62bef6fc2c3aa35e893fbf05b21ceff3a07 (diff) |
Add use ktx checkbox to presentation settings
Also did some cleanup for studio project settings and studio
preferences.
Runtime modifications for this task are done in another commit.
Task-number: QT3DS-2505
Change-Id: Iffc075b74a25f53a06699ae1c61c458211066cd2
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
13 files changed, 170 insertions, 287 deletions
diff --git a/src/Authoring/Client/Code/Core/Core/Core.cpp b/src/Authoring/Client/Code/Core/Core/Core.cpp index 59ead19e..10374d4d 100644 --- a/src/Authoring/Client/Code/Core/Core/Core.cpp +++ b/src/Authoring/Client/Code/Core/Core/Core.cpp @@ -434,7 +434,7 @@ void CCore::OnNewPresentation() */ void CCore::OnClosingPresentation() { - m_StudioProjectSettings->Reset(); + m_StudioProjectSettings->reset(); m_CmdStack->Clear(); } diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp index bf2c1724..9df4cd5a 100644 --- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp +++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp @@ -1723,7 +1723,7 @@ public: SetInstancePropertyValue(instance, layer.m_Width, float(presSize.width()), true); } else { long curWidth = m_Doc.GetCore()->GetStudioProjectSettings() - ->GetPresentationSize().x; + ->getPresentationSize().width(); Option<SValue> leftVal = GetInstancePropertyValue(instance, layer.m_Left); Option<SValue> leftUnitsVal = GetInstancePropertyValue(instance, layer.m_LeftUnits); float left = qt3dsdm::get<float>(leftVal.getValue()); @@ -1739,7 +1739,7 @@ public: SetInstancePropertyValue(instance, layer.m_Height, float(presSize.height()), true); } else { long curHeight = m_Doc.GetCore()->GetStudioProjectSettings() - ->GetPresentationSize().y; + ->getPresentationSize().height(); Option<SValue> topVal = GetInstancePropertyValue(instance, layer.m_Top); Option<SValue> topUnitsVal = GetInstancePropertyValue(instance, layer.m_TopUnits); float top = qt3dsdm::get<float>(topVal.getValue()); diff --git a/src/Authoring/Client/Code/Core/Doc/StudioProjectSettings.cpp b/src/Authoring/Client/Code/Core/Doc/StudioProjectSettings.cpp index 39b4e0d3..61044c90 100644 --- a/src/Authoring/Client/Code/Core/Doc/StudioProjectSettings.cpp +++ b/src/Authoring/Client/Code/Core/Doc/StudioProjectSettings.cpp @@ -40,17 +40,13 @@ #include "CColor.h" #include "Qt3DSColor.h" -///////////////////////////////////////////////////////////////////////////// -// CStudioProjectSettings property page - -//============================================================================== /** * Constructor: Initializes the object. */ -CStudioProjectSettings::CStudioProjectSettings(CCore *inCore /*=NULL*/) - : m_Core(inCore) +CStudioProjectSettings::CStudioProjectSettings(CCore *inCore) + : m_core(inCore) { - this->Reset(); + this->reset(); } //============================================================================== @@ -69,24 +65,15 @@ CStudioProjectSettings::~CStudioProjectSettings() * @param None */ //============================================================================== -void CStudioProjectSettings::Reset() +void CStudioProjectSettings::reset() { // Reset the internal variables - - m_Author.clear(); - m_Company.clear(); - - m_PresentationSize = CStudioPreferences::GetDefaultClientSize(); - - // fsaa - m_FSAAMode = FSAA_OFF; - - m_MaintainAspect = false; - - // do not embed fonts by default - m_EmbedFonts = false; - - m_RotatePresentation = false; + m_author.clear(); + m_company.clear(); + m_presentationSize = CStudioPreferences::GetDefaultClientSize(); + m_maintainAspect = false; + m_rotatePresentation = false; + m_preferCompressedTextures = false; } //============================================================================== @@ -96,11 +83,11 @@ void CStudioProjectSettings::Reset() * @param inAuthor Author name */ //============================================================================== -void CStudioProjectSettings::SetAuthor(const QString &inAuthor) +void CStudioProjectSettings::setAuthor(const QString &inAuthor) { - if (m_Author != inAuthor) { - m_Author = inAuthor; - m_Core->GetDoc()->SetModifiedFlag(); + if (m_author != inAuthor) { + m_author = inAuthor; + m_core->GetDoc()->SetModifiedFlag(); } } @@ -111,11 +98,11 @@ void CStudioProjectSettings::SetAuthor(const QString &inAuthor) * @param inCompany Company name */ //============================================================================== -void CStudioProjectSettings::SetCompany(const QString &inCompany) +void CStudioProjectSettings::setCompany(const QString &inCompany) { - if (m_Company != inCompany) { - m_Company = inCompany; - m_Core->GetDoc()->SetModifiedFlag(); + if (m_company != inCompany) { + m_company = inCompany; + m_core->GetDoc()->SetModifiedFlag(); } } @@ -126,84 +113,38 @@ void CStudioProjectSettings::SetCompany(const QString &inCompany) * @param inSize the size that the presentation should be. */ //============================================================================= -void CStudioProjectSettings::SetPresentationSize(CPt inSize) +void CStudioProjectSettings::setPresentationSize(const QSize &inSize) { - if (m_PresentationSize != inSize) { - m_Core->GetDoc()->SetModifiedFlag(); - m_PresentationSize = inSize; + if (m_presentationSize != inSize) { + m_core->GetDoc()->SetModifiedFlag(); + m_presentationSize = inSize; } } //============================================================================= /** - * Restore all parameters to what they would be if they were fresh from the installation. - * Slightly different from a Reset, this will nuke the registry settings for the custom preview - * options and - * reset the preview app. - */ -void CStudioProjectSettings::RestoreDefaults() -{ - Reset(); -} - -//============================================================================= -/** - * @return true if we are maintaining the aspect ratio for the scene - */ -bool CStudioProjectSettings::GetMaintainAspect() -{ - return m_MaintainAspect; -} - -//============================================================================= -/** * @param inFlag true if we want to maintain the aspect ratio when changing sizes */ -void CStudioProjectSettings::SetMaintainAspect(bool inFlag) +void CStudioProjectSettings::setMaintainAspect(bool inFlag) { - if (m_MaintainAspect != inFlag) { - m_MaintainAspect = inFlag; - m_Core->GetDoc()->SetModifiedFlag(); + if (m_maintainAspect != inFlag) { + m_maintainAspect = inFlag; + m_core->GetDoc()->SetModifiedFlag(); } } -//============================================================================= -/** - * @param inEngine the rendering engine we want to use - */ -void CStudioProjectSettings::SetFSAAMode(long inFSAAMode) -{ - m_FSAAMode = inFSAAMode; - m_Core->GetDoc()->SetModifiedFlag(); -} - -//============================================================================= -/** - * @return the flag on whether to embed fonts in am file - */ -bool CStudioProjectSettings::GetEmbedFonts() +void CStudioProjectSettings::setRotatePresentation(bool inFlag) { - return m_EmbedFonts; -} - -bool CStudioProjectSettings::GetRotatePresentation() -{ - return m_RotatePresentation; -} - -void CStudioProjectSettings::SetRotatePresentation(bool inFlag) -{ - m_RotatePresentation = inFlag; + if (m_rotatePresentation != inFlag) { + m_rotatePresentation = inFlag; + m_core->GetDoc()->SetModifiedFlag(); + } } -//============================================================================= -/** - * @param inFlag the flag on whether to embed fonts in am file - */ -void CStudioProjectSettings::SetEmbedFonts(bool inFlag) +void CStudioProjectSettings::setPreferCompressedTextures(bool inFlag) { - if (m_EmbedFonts != inFlag) { - m_EmbedFonts = inFlag; - m_Core->GetDoc()->SetModifiedFlag(); + if (m_preferCompressedTextures != inFlag) { + m_preferCompressedTextures = inFlag; + m_core->GetDoc()->SetModifiedFlag(); } } diff --git a/src/Authoring/Client/Code/Core/Doc/StudioProjectSettings.h b/src/Authoring/Client/Code/Core/Doc/StudioProjectSettings.h index 71f85d64..4fe476a9 100644 --- a/src/Authoring/Client/Code/Core/Doc/StudioProjectSettings.h +++ b/src/Authoring/Client/Code/Core/Doc/StudioProjectSettings.h @@ -32,63 +32,46 @@ #pragma once -//============================================================================== -// Includes -//============================================================================== +#include <QtCore/qstring.h> +#include <QtCore/qsize.h> -#include "Pt.h" -#include "CColor.h" - -//============================================================================== -// Forwards -//============================================================================== class CCore; class CStudioProjectSettings { - - // Construction public: - CStudioProjectSettings(CCore *inCore = NULL); + CStudioProjectSettings(CCore *inCore = nullptr); ~CStudioProjectSettings(); - QString GetAuthor() { return m_Author; } - void SetAuthor(const QString &inAuthor); - - QString GetCompany() { return m_Company; } - void SetCompany(const QString &inCompany); + QString getAuthor() const { return m_author; } + void setAuthor(const QString &inAuthor); - CPt GetPresentationSize() { return m_PresentationSize; } - void SetPresentationSize(CPt inSize); + QString getCompany() const { return m_company; } + void setCompany(const QString &inCompany); - long GetFSAAMode() const { return m_FSAAMode; } - void SetFSAAMode(long inFSAAMode); + QSize getPresentationSize() const { return m_presentationSize; } + void setPresentationSize(const QSize &inSize); - bool GetMaintainAspect(); - void SetMaintainAspect(bool inFlag); + bool getMaintainAspect() const { return m_maintainAspect; } + void setMaintainAspect(bool inFlag); - bool GetEmbedFonts(); - void SetEmbedFonts(bool inFlag); + bool getRotatePresentation() const { return m_rotatePresentation; } + void setRotatePresentation(bool inFlag); - bool GetRotatePresentation(); - void SetRotatePresentation(bool inFlag); + bool getPreferCompressedTextures() const { return m_preferCompressedTextures; } + void setPreferCompressedTextures(bool inFlag); - void Reset(); - void RestoreDefaults(); + void reset(); - // Implementation protected: - QString m_Author; - QString m_Company; - - // TODO : remove m_EmbedFonts, m_FSAAMode - CPt m_PresentationSize; - long m_FSAAMode; ///< Fullscreen anti-aliasing mode - bool m_MaintainAspect; - bool m_RotatePresentation; - CCore *m_Core; - - bool m_EmbedFonts; ///< Whether to embed fonts in am files + QString m_author; + QString m_company; + + QSize m_presentationSize; + bool m_maintainAspect; + bool m_rotatePresentation; + bool m_preferCompressedTextures; + CCore *m_core; }; #endif // INCLUDED_STUDIO_PROJECT_SETTINGS_H diff --git a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp index acf8f26d..2b609ecf 100644 --- a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp +++ b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp @@ -601,13 +601,13 @@ void CStudioPreferences::SetDontShowGLVersionDialog(bool inValue) m_preferences->SetValue(QStringLiteral("DontShowGLVersionDialog"), inValue); } -CPt CStudioPreferences::GetDefaultClientSize() +QSize CStudioPreferences::GetDefaultClientSize() { - CPt theSize; - theSize.x = m_preferences->GetLongValue(QStringLiteral("DefaultClientWidth"), - DEFAULT_CLIENT_WIDTH); - theSize.y = m_preferences->GetLongValue(QStringLiteral("DefaultClientHeight"), - DEFAULT_CLIENT_HEIGHT); + QSize theSize; + theSize.setWidth(m_preferences->GetLongValue(QStringLiteral("DefaultClientWidth"), + DEFAULT_CLIENT_WIDTH)); + theSize.setHeight(m_preferences->GetLongValue(QStringLiteral("DefaultClientHeight"), + DEFAULT_CLIENT_HEIGHT)); return theSize; } diff --git a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h index c565b7e4..8f086a86 100644 --- a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h +++ b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h @@ -114,7 +114,7 @@ public: static long GetBigTimeAdvanceAmount(); static void SetBigTimeAdvanceAmount(long inTime); - static CPt GetDefaultClientSize(); + static QSize GetDefaultClientSize(); static void SetDefaultClientSize(int width, int height); static int getNumRecentItems(); diff --git a/src/Authoring/Common/Code/Serialize/ProjectSettingsSerializer.h b/src/Authoring/Common/Code/Serialize/ProjectSettingsSerializer.h index 26a8220b..dcba2267 100644 --- a/src/Authoring/Common/Code/Serialize/ProjectSettingsSerializer.h +++ b/src/Authoring/Common/Code/Serialize/ProjectSettingsSerializer.h @@ -43,6 +43,7 @@ #include "Qt3DSDMWStrOpsImpl.h" #include <QtWidgets/qcolordialog.h> +#include <QtCore/qsize.h> namespace qt3dsdm { } @@ -99,25 +100,27 @@ public: using namespace std; CStudioProjectSettings *theProjectSettings = GetProjectSettings(); Q3DStudio::CString author = - Q3DStudio::CString::fromQString(theProjectSettings->GetAuthor()); + Q3DStudio::CString::fromQString(theProjectSettings->getAuthor()); TCharPtr theAuthor = author; ar.Att(L"author", theAuthor); Q3DStudio::CString company = - Q3DStudio::CString::fromQString(theProjectSettings->GetCompany()); + Q3DStudio::CString::fromQString(theProjectSettings->getCompany()); TCharPtr theCompany = company; ar.Att(L"company", theCompany); - CPt theSize = theProjectSettings->GetPresentationSize(); - ar.Att(L"presentationWidth", static_cast<qt3ds::QT3DSI32>(theSize.x)); - ar.Att(L"presentationHeight", static_cast<qt3ds::QT3DSI32>(theSize.y)); + QSize theSize = theProjectSettings->getPresentationSize(); + ar.Att(L"presentationWidth", static_cast<qt3ds::QT3DSI32>(theSize.width())); + ar.Att(L"presentationHeight", static_cast<qt3ds::QT3DSI32>(theSize.height())); - if (theProjectSettings->GetRotatePresentation()) { + if (theProjectSettings->getRotatePresentation()) ar.Att("presentationRotation", "90"); - } - bool theMaintainAspect = theProjectSettings->GetMaintainAspect(); + bool theMaintainAspect = theProjectSettings->getMaintainAspect(); ar.Att("maintainAspect", theMaintainAspect); + bool thePreferKtx = theProjectSettings->getPreferCompressedTextures(); + ar.Att("preferKtx", thePreferKtx); + if (QColorDialog::customCount() > 0) { CustomColorSerializer ccs; ar.Serialize(L"CustomColors", ccs); @@ -128,31 +131,35 @@ public: using namespace qt3dsdm; using namespace std; CStudioProjectSettings *theProjectSettings = GetProjectSettings(); - theProjectSettings->Reset(); + theProjectSettings->reset(); TCharStr theAuthor; ar.Att(L"author", theAuthor); Q3DStudio::CString theAuthorStr(theAuthor.wide_str()); - theProjectSettings->SetAuthor(theAuthorStr.toQString()); + theProjectSettings->setAuthor(theAuthorStr.toQString()); TCharStr theCompany; ar.Att(L"company", theCompany); Q3DStudio::CString theCompanyStr(theCompany.wide_str()); - theProjectSettings->SetCompany(theCompanyStr.toQString()); + theProjectSettings->setCompany(theCompanyStr.toQString()); qt3ds::QT3DSI32 thePresentationWidth; qt3ds::QT3DSI32 thePresentationHeight; ar.Att("presentationWidth", thePresentationWidth); ar.Att("presentationHeight", thePresentationHeight); - theProjectSettings->SetPresentationSize(CPt(thePresentationWidth, thePresentationHeight)); + theProjectSettings->setPresentationSize(QSize(thePresentationWidth, thePresentationHeight)); qt3ds::QT3DSI32 thePresentationRotate; if (ar.Att("presentationRotation", thePresentationRotate) && thePresentationRotate == 90) - theProjectSettings->SetRotatePresentation(true); + theProjectSettings->setRotatePresentation(true); bool theMaintainAspect; ar.Att("maintainAspect", theMaintainAspect); - theProjectSettings->SetMaintainAspect(theMaintainAspect); + theProjectSettings->setMaintainAspect(theMaintainAspect); + + bool thePreferKtx; + ar.Att("preferKtx", thePreferKtx); + theProjectSettings->setPreferCompressedTextures(thePreferKtx); { CustomColorSerializer ccs; diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp index 81d0d736..43f72b1f 100644 --- a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp +++ b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp @@ -2061,11 +2061,11 @@ void STranslation::MarkDirty(qt3dsdm::Qt3DSDMInstanceHandle inInstance) QT3DSVec2 STranslation::GetPreviewViewportDimensions() { CStudioProjectSettings *theSettings = m_Doc.GetCore()->GetStudioProjectSettings(); - CPt thePresSize = theSettings->GetPresentationSize(); + QSize thePresSize = theSettings->getPresentationSize(); QT3DSVec2 vp(GetViewportDimensions()); if (vp.x < m_previewViewportSize || vp.y < m_previewViewportSize) return QT3DSVec2(0.0f); - QT3DSVec2 ret(thePresSize.x, thePresSize.y); + QT3DSVec2 ret(thePresSize.width(), thePresSize.height()); const float aspect = ret.x / ret.y; if (aspect > 1.0) { ret.x = m_previewViewportSize; @@ -2108,7 +2108,7 @@ void STranslation::PreRender(bool scenePreviewPass) if (m_Scene) { CStudioProjectSettings *theSettings = m_Doc.GetCore()->GetStudioProjectSettings(); - CPt thePresSize = theSettings->GetPresentationSize(); + QSize thePresSize = theSettings->getPresentationSize(); // The presentation sizes are used for when we have to render a layer offscreen. If their // width and height // isn't set, then they use the presentation dimensions. @@ -2117,7 +2117,7 @@ void STranslation::PreRender(bool scenePreviewPass) QT3DSVec2((QT3DSF32)theViewportDims.x, (QT3DSF32)theViewportDims.y); } else { m_Presentation.m_PresentationDimensions = - QT3DSVec2((QT3DSF32)thePresSize.x, (QT3DSF32)thePresSize.y); + QT3DSVec2((QT3DSF32)thePresSize.width(), (QT3DSF32)thePresSize.height()); } m_Context.SetWindowDimensions( QSize((QT3DSU32)theViewportDims.x, (QT3DSU32)theViewportDims.y)); @@ -2730,9 +2730,9 @@ void STranslation::Render(int inWidgetId, bool inDrawGuides, bool scenePreviewPa m_Context.SetWindowDimensions(QSize((QT3DSU32)theViewportDims.x, (QT3DSU32)theViewportDims.y)); CStudioProjectSettings *theSettings = m_Doc.GetCore()->GetStudioProjectSettings(); - CPt thePresSize = theSettings->GetPresentationSize(); + QSize thePresSize = theSettings->getPresentationSize(); m_Presentation.m_PresentationDimensions = - QT3DSVec2((QT3DSF32)thePresSize.x, (QT3DSF32)thePresSize.y); + QT3DSVec2((QT3DSF32)thePresSize.width(), (QT3DSF32)thePresSize.height()); if (m_ZoomRender.hasValue()) { RenderZoomRender(*m_ZoomRender); diff --git a/src/Authoring/Studio/UI/PlayerContainerWnd.cpp b/src/Authoring/Studio/UI/PlayerContainerWnd.cpp index 231738de..68cbf78d 100644 --- a/src/Authoring/Studio/UI/PlayerContainerWnd.cpp +++ b/src/Authoring/Studio/UI/PlayerContainerWnd.cpp @@ -277,8 +277,7 @@ void CPlayerContainerWnd::setToolMode(long inMode) QSize CPlayerContainerWnd::GetEffectivePresentationSize() const { - CPt cSize = g_StudioApp.GetCore()->GetStudioProjectSettings()->GetPresentationSize(); - QSize theSize(cSize.x, cSize.y); + QSize theSize = g_StudioApp.GetCore()->GetStudioProjectSettings()->getPresentationSize(); // If we have guides, resize the window with enough space for the guides as well as the // presentation diff --git a/src/Authoring/Studio/UI/SceneView.cpp b/src/Authoring/Studio/UI/SceneView.cpp index 7f9a088d..5e617d92 100644 --- a/src/Authoring/Studio/UI/SceneView.cpp +++ b/src/Authoring/Studio/UI/SceneView.cpp @@ -81,8 +81,7 @@ CSceneView::~CSceneView() QSize CSceneView::sizeHint() const { - CPt theSize = CStudioPreferences::GetDefaultClientSize(); - return QSize(theSize.x, theSize.y); + return CStudioPreferences::GetDefaultClientSize(); } //============================================================================== diff --git a/src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp b/src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp index b8a15de5..a1f98710 100644 --- a/src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp +++ b/src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp @@ -41,20 +41,19 @@ CStudioProjectSettingsPage::CStudioProjectSettingsPage(QWidget *parent) : CStudioPreferencesPropPage(parent) - , m_AspectRatio(0.0f) + , m_aspectRatio(0.0) , m_ui(new Ui::StudioProjectSettingsPage) { - m_Font = QFont(CStudioPreferences::GetFontFaceName()); - m_Font.setPixelSize(CStudioPreferences::fontSize()); + m_font = QFont(CStudioPreferences::GetFontFaceName()); + m_font.setPixelSize(CStudioPreferences::fontSize()); // Create a bold font for the group box text - m_BoldFont = m_Font; - m_BoldFont.setBold(true); + m_boldFont = m_font; + m_boldFont.setBold(true); onInitDialog(); } - CStudioProjectSettingsPage::~CStudioProjectSettingsPage() { } @@ -80,97 +79,97 @@ void CStudioProjectSettingsPage::onInitDialog() // Set fonts for child windows. for (auto w : findChildren<QWidget *>()) - w->setFont(m_Font); + w->setFont(m_font); // Make the group text bold for (auto w : findChildren<QGroupBox *>()) - w->setFont(m_BoldFont); + w->setFont(m_boldFont); // Set the ranges of the client width and height m_ui->m_ClientSizeWidth->setRange(1, 16384); m_ui->m_ClientSizeHeight->setRange(1, 16384); // Load the settings for the controls - this->LoadSettings(); + this->loadSettings(); auto valueChanged = static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged); - connect(m_ui->m_PresentationId, &QLineEdit::textEdited, - this, &CStudioProjectSettingsPage::onChangePresentationId); + connect(m_ui->m_PresentationId, &QLineEdit::textEdited, [=](){ this->setModified(true); }); connect(m_ui->m_ClientSizeWidth, valueChanged, this, &CStudioProjectSettingsPage::onChangeEditPresWidth); connect(m_ui->m_ClientSizeHeight, valueChanged, this, &CStudioProjectSettingsPage::onChangeEditPresHeight); connect(m_ui->m_checkConstrainProportions, &QCheckBox::clicked, this, &CStudioProjectSettingsPage::onCheckMaintainRatio); - connect(m_ui->m_Author, &QLineEdit::textEdited, - this, &CStudioProjectSettingsPage::onChangeAuthor); - connect(m_ui->m_Company, &QLineEdit::textEdited, - this, &CStudioProjectSettingsPage::onChangeCompany); + connect(m_ui->m_checkUseKtx, &QCheckBox::clicked, [=](){ this->setModified(true); }); + connect(m_ui->m_Author, &QLineEdit::textEdited, [=](){ this->setModified(true); }); + connect(m_ui->m_Company, &QLineEdit::textEdited, [=](){ this->setModified(true); }); } // LoadSettings: Load the settings from the project settings and set the control values. -void CStudioProjectSettingsPage::LoadSettings() +void CStudioProjectSettingsPage::loadSettings() { // Presentation Id m_ui->m_PresentationId->setText(g_StudioApp.GetCore()->GetDoc()->getPresentationId()); // Get the Client size CStudioProjectSettings *theProjectSettings = g_StudioApp.GetCore()->GetStudioProjectSettings(); - CPt theClientSize = theProjectSettings->GetPresentationSize(); + QSize theClientSize = theProjectSettings->getPresentationSize(); // Set client width & height - m_ui->m_ClientSizeWidth->setValue(theClientSize.x); - m_ui->m_ClientSizeHeight->setValue(theClientSize.y); + m_ui->m_ClientSizeWidth->setValue(theClientSize.width()); + m_ui->m_ClientSizeHeight->setValue(theClientSize.height()); // Save the aspect ratio - m_AspectRatio = (double)theClientSize.x / (double)theClientSize.y; + m_aspectRatio = double(theClientSize.width()) / double(theClientSize.height()); // Maintain Aspect Ratio checkbox - m_ui->m_checkConstrainProportions->setChecked(theProjectSettings->GetMaintainAspect()); + m_ui->m_checkConstrainProportions->setChecked(theProjectSettings->getMaintainAspect()); + + // Portrait mode, i.e. rotate presentation + m_ui->m_checkPortraitFormat->setChecked(theProjectSettings->getRotatePresentation()); - m_ui->m_checkPortraitFormat->setChecked(theProjectSettings->GetRotatePresentation()); + // Prefer compressed textures + m_ui->m_checkUseKtx->setChecked(theProjectSettings->getPreferCompressedTextures()); // Author - m_ui->m_Author->setText(theProjectSettings->GetAuthor()); + m_ui->m_Author->setText(theProjectSettings->getAuthor()); // Company - m_ui->m_Company->setText(theProjectSettings->GetCompany()); + m_ui->m_Company->setText(theProjectSettings->getCompany()); } // SaveSettings: Save the settings from the controls to the project settings. -void CStudioProjectSettingsPage::SaveSettings() +void CStudioProjectSettingsPage::saveSettings() { - CPt theClientSize; + QSize theClientSize; CStudioProjectSettings *theProjectSettings = g_StudioApp.GetCore()->GetStudioProjectSettings(); // Presentation Id g_StudioApp.GetCore()->getProjectFile().writePresentationId(m_ui->m_PresentationId->text()); // Presentation width & height - theClientSize.x = m_ui->m_ClientSizeWidth->value(); - theClientSize.y = m_ui->m_ClientSizeHeight->value(); - theProjectSettings->SetPresentationSize(theClientSize); + theClientSize.setWidth(m_ui->m_ClientSizeWidth->value()); + theClientSize.setHeight(m_ui->m_ClientSizeHeight->value()); + theProjectSettings->setPresentationSize(theClientSize); // Author QString theAuthor = m_ui->m_Author->text(); - theProjectSettings->SetAuthor(theAuthor); + theProjectSettings->setAuthor(theAuthor); // Company QString theCompany = m_ui->m_Company->text(); - theProjectSettings->SetCompany(theCompany); + theProjectSettings->setCompany(theCompany); g_StudioApp.GetViews()->recheckMainframeSizingMode(); // Maintain Aspect Ratio checkbox - theProjectSettings->SetMaintainAspect(m_ui->m_checkConstrainProportions->isChecked()); + theProjectSettings->setMaintainAspect(m_ui->m_checkConstrainProportions->isChecked()); - theProjectSettings->SetRotatePresentation(m_ui->m_checkPortraitFormat->isChecked()); -} + // Portrait mode, i.e. rotate presentation + theProjectSettings->setRotatePresentation(m_ui->m_checkPortraitFormat->isChecked()); -// Generic function when settings are modified. -void CStudioProjectSettingsPage::onSettingsModified() -{ - this->setModified(TRUE); + // Prefer compressed textures + theProjectSettings->setPreferCompressedTextures(m_ui->m_checkUseKtx->isChecked()); } // OnApply: Handler for the Apply button @@ -187,10 +186,10 @@ bool CStudioProjectSettingsPage::onApply() return false; } - // Apply was clicked - save settings and disabled the Apply button - this->SaveSettings(); + // Apply was clicked - save settings and disable the Apply button + this->saveSettings(); - this->setModified(FALSE); + this->setModified(false); return CStudioPreferencesPropPage::onApply(); } @@ -198,16 +197,17 @@ bool CStudioProjectSettingsPage::onApply() // OnChangeEditPresWidth: EN_CHANGE handler for the IDC_EDIT_PRESWIDTH field void CStudioProjectSettingsPage::onChangeEditPresWidth() { - this->setModified(TRUE); + this->setModified(true); // Should the aspect ratio be maintained? if (m_ui->m_checkConstrainProportions->isChecked()) { - long thePresWidth, thePresHeight; + long thePresWidth; + long thePresHeight; thePresWidth = m_ui->m_ClientSizeWidth->value(); // Change the height - thePresHeight = ((double)thePresWidth / m_AspectRatio); + thePresHeight = thePresWidth / long(m_aspectRatio); QSignalBlocker sb(m_ui->m_ClientSizeHeight); m_ui->m_ClientSizeHeight->setValue(thePresHeight); @@ -217,16 +217,17 @@ void CStudioProjectSettingsPage::onChangeEditPresWidth() // OnChangeEditPresHeight: EN_CHANGE handler for the IDC_EDIT_PRESHEIGHT field void CStudioProjectSettingsPage::onChangeEditPresHeight() { - this->setModified(TRUE); + this->setModified(true); // Should the aspect ratio be maintained? if (m_ui->m_checkConstrainProportions->isChecked()) { - long thePresWidth, thePresHeight; + long thePresWidth; + long thePresHeight; thePresHeight = m_ui->m_ClientSizeHeight->value(); // Change the width - thePresWidth = ((double)thePresHeight * m_AspectRatio); + thePresWidth = thePresHeight * long(m_aspectRatio); QSignalBlocker sb(m_ui->m_ClientSizeWidth); m_ui->m_ClientSizeWidth->setValue(thePresWidth); @@ -236,55 +237,15 @@ void CStudioProjectSettingsPage::onChangeEditPresHeight() // OnCheckMaintainRatio: The aspect ratio checkbox has changed. void CStudioProjectSettingsPage::onCheckMaintainRatio() { - this->setModified(TRUE); + this->setModified(true); - long thePresWidth, thePresHeight; + long thePresWidth; + long thePresHeight; // Get the width and height thePresWidth = m_ui->m_ClientSizeWidth->value(); thePresHeight = m_ui->m_ClientSizeHeight->value(); // Save the Aspect Ratio - m_AspectRatio = (double)thePresWidth / (double)thePresHeight; -} - -void CStudioProjectSettingsPage::onChangePresentationId() -{ - this->setModified(TRUE); -} - -// OnChangeAuthor: EN_CHANGE handler for the IDC_AUTHOR field. -void CStudioProjectSettingsPage::onChangeAuthor() -{ - this->setModified(TRUE); -} - -// OnChangeCompany: EN_CHANGE handler for the IDC_COMPANY field. -void CStudioProjectSettingsPage::onChangeCompany() -{ - this->setModified(TRUE); -} - -// OnChangeSet1: EN_CHANGE handler for the IDC_SET1 field. -void CStudioProjectSettingsPage::onChangeSet1() -{ - this->setModified(TRUE); -} - -// OnChangeSet2: EN_CHANGE handler for the IDC_SET2 field. -void CStudioProjectSettingsPage::onChangeSet2() -{ - this->setModified(TRUE); -} - -// OnChangeSet3: EN_CHANGE handler for the IDC_SET3 field. -void CStudioProjectSettingsPage::onChangeSet3() -{ - this->setModified(TRUE); -} - -// OnChangeSet5: EN_CHANGE handler for the IDC_SET5 field. -void CStudioProjectSettingsPage::onChangeSet5() -{ - this->setModified(TRUE); + m_aspectRatio = double(thePresWidth) / double(thePresHeight); } diff --git a/src/Authoring/Studio/UI/StudioProjectSettingsPage.h b/src/Authoring/Studio/UI/StudioProjectSettingsPage.h index 8db0c1b4..4b2e405d 100644 --- a/src/Authoring/Studio/UI/StudioProjectSettingsPage.h +++ b/src/Authoring/Studio/UI/StudioProjectSettingsPage.h @@ -34,30 +34,19 @@ #pragma once #endif // _MSC_VER > 1000 -//============================================================================== -// Includes -//============================================================================== - #include "StudioPreferencesPropSheet.h" #ifdef _USENEWCOLORPICKER_ #include "StudioColorPicker.h" #endif - -//============================================================================== -// Forwards -//============================================================================== class CStudioApp; QT_BEGIN_NAMESPACE namespace Ui { - class StudioProjectSettingsPage; +class StudioProjectSettingsPage; } QT_END_NAMESPACE -//============================================================================== -// Base class for the settings for different modes -//============================================================================== class CStudioProjectSettingsPage : public CStudioPreferencesPropPage { Q_OBJECT @@ -72,29 +61,19 @@ public: // Implementation protected: - double m_AspectRatio; ///< Stores the presentation width divided by the presentation height - QFont m_Font; ///< Font for text - QFont m_BoldFont; ///< Bold font for drawing the group boxes + double m_aspectRatio; ///< Stores the presentation width divided by the presentation height + QFont m_font; ///< Font for text + QFont m_boldFont; ///< Bold font for drawing the group boxes - void LoadSettings(); - void SaveSettings(); + void loadSettings(); + void saveSettings(); protected: // Generated message map functions virtual void onInitDialog(); - void onChangePresentationId(); void onChangeEditPresWidth(); void onChangeEditPresHeight(); void onCheckMaintainRatio(); - void onChangeAuthor(); - void onChangeCompany(); - void onSettingsModified(); - void onSelChangePreviewApp(); - void onCustomPreviewMore(); - void onChangeSet1(); - void onChangeSet2(); - void onChangeSet3(); - void onChangeSet5(); QScopedPointer<QT_PREPEND_NAMESPACE(Ui::StudioProjectSettingsPage)> m_ui; }; diff --git a/src/Authoring/Studio/UI/StudioProjectSettingsPage.ui b/src/Authoring/Studio/UI/StudioProjectSettingsPage.ui index 1e289212..fba58ee7 100644 --- a/src/Authoring/Studio/UI/StudioProjectSettingsPage.ui +++ b/src/Authoring/Studio/UI/StudioProjectSettingsPage.ui @@ -72,6 +72,20 @@ </property> </widget> </item> + <item row="4" column="0"> + <widget class="QCheckBox" name="m_checkUseKtx"> + <property name="toolTip"> + <string>Force runtime to check first if there +are ktx compressed textures available +when loading texture maps. +Note that this should only be checked +when ktx textures are present.</string> + </property> + <property name="text"> + <string>Use ktx textures if available</string> + </property> + </widget> + </item> </layout> </widget> </item> |