summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/_Win/UI/StudioAppPrefsPage.cpp
blob: bde792eb1832660a47a84aa35f61b322c9427f58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
/****************************************************************************
**
** Copyright (C) 2002 NVIDIA Corporation.
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

//==============================================================================
//	Prefix
//==============================================================================

#include "stdafx.h"
#include "Strings.h"

#include "ui_StudioAppPrefsPage.h"

//==============================================================================
//	Includes
//==============================================================================
#include "UICOptions.h"
#include "Doc.h"
#include "StudioAppPrefsPage.h"
#include "StudioConst.h"
#include "StudioProjectSettings.h"
#include "StudioPreferences.h"
#include "StudioApp.h"
#include "StudioPreferences.h"
#include "StringLoader.h"
#include "CommonConstants.h"
#include "Views.h"
#include "UICDMStudioSystem.h"
#include "ClientDataModelBridge.h"
#include "Core.h"
#include "IStudioRenderer.h"

#include <QColorDialog>
#include <QMessageBox>

#define WM_PREVIEW_DYNAMIC_CONTROLS WM_USER + 1200
const long MIN_PAGESIZE = 380;

/////////////////////////////////////////////////////////////////////////////
// CStudioAppPrefsPage property page

//==============================================================================
/**
 *	Constructor: Initializes the object.
 */
//==============================================================================
CStudioAppPrefsPage::CStudioAppPrefsPage(QWidget *parent)
    : CStudioPreferencesPropPage(parent)
    , m_nudgeValue(0.0)
    , m_TimebarShowTime(FALSE)
    , m_InterpolationIsSmooth(FALSE)
    , m_ui(new Ui::StudioAppPrefsPage)
{
    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);

    OnInitDialog();
}

//==============================================================================
/**
 *	Destructor: Releases the object.
 */
//==============================================================================
CStudioAppPrefsPage::~CStudioAppPrefsPage()
{
}

/////////////////////////////////////////////////////////////////////////////
// CStudioAppPrefsPage message handlers

void CStudioAppPrefsPage::OnInitDialog()
{
    m_ui->setupUi(this);
    m_ui->m_editNudgeAmount->setValidator(new QDoubleValidator(this));

    // Add tool tips for controls
    m_ui->m_editNudgeAmount->setToolTip(::LoadResourceString(IDS_PREFS_NUDGEAMOUNT).toQString());
    m_ui->m_DefaultInterpolation->setToolTip(::LoadResourceString(IDS_PREFS_INTERPOLATIONDEFAULT).toQString());
    m_ui->m_checkTimelineAbsoluteSnapping->setToolTip(
                ::LoadResourceString(IDS_PREFS_TIMELINEGRIDSNAPPING).toQString());
    m_ui->m_SnapRangeCombo->setToolTip(::LoadResourceString(IDS_PREFS_TIMELINEGRIDRESOLUTION).toQString());
    m_ui->m_buttonRestoreDefaults->setToolTip(::LoadResourceString(IDS_PREFS_RESTOREDEFAULTS).toQString());
    m_ui->m_EditViewBGColor->setAutoFillBackground(true);

    // Set fonts for child windows.
    for (auto w : findChildren<QWidget *>())
        w->setFont(m_Font);

    // Make the group text bold
    for (auto w : findChildren<QGroupBox *>())
        w->setFont(m_BoldFont);

#ifndef INCLUDE_EDIT_CAMERA
    ASSERT(0);
    // This won't work as all the controls have to move accordingly. Don't think INCLUDE_EDIT_CAMERA
    // will be undefined
    // Hide controls related to Edit Camera
    m_ui->m_groupBoxEditingView->setVisible(false);
#endif

    // Load the settings for the controls
    LoadSettings();

    auto activated = static_cast<void(QComboBox::*)(int)>(&QComboBox::activated);
    connect(m_ui->m_buttonRestoreDefaults, &QPushButton::clicked, this, &CStudioAppPrefsPage::OnButtonRestoreDefaults);
    connect(m_ui->m_DefaultInterpolation, activated, this, &CStudioAppPrefsPage::OnSelChangeInterpolationDefault);
    connect(m_ui->m_SnapRangeCombo, activated, this, &CStudioAppPrefsPage::OnSelChangeSnapRange);
    connect(m_ui->m_checkTimelineAbsoluteSnapping, &QCheckBox::clicked, this, &CStudioAppPrefsPage::OnCheckTimelineAbsoluteSnapping);
    connect(m_ui->m_EditViewBGColor, &QPushButton::clicked, this, &CStudioAppPrefsPage::OnBgColorButtonClicked);
    connect(m_ui->m_editNudgeAmount, &QLineEdit::textEdited, this, &CStudioAppPrefsPage::OnChangeEditNudgeAmount);
    connect(m_ui->m_EditViewStartupView, activated, this, &CStudioAppPrefsPage::OnSelChangeStartupView);
    connect(m_ui->m_PreviewSelector, activated, this, &CStudioAppPrefsPage::OnChangePreviewConfiguration);
}

//==============================================================================
/**
 *	LoadSettings: Load the settings from the CDoc and set the control values.
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::LoadSettings()
{
    m_nudgeValue = CStudioPreferences::GetNudgeAmount();

    // Get the Interpolation Preference
    Q3DStudio::CString theComboItem;
    theComboItem = ::LoadResourceString(IDS_PREF_INTERPOLATION_1);
    m_ui->m_DefaultInterpolation->addItem(theComboItem.toQString());
    theComboItem = ::LoadResourceString(IDS_PREF_INTERPOLATION_2);
    m_ui->m_DefaultInterpolation->addItem(theComboItem.toQString());

    long theInterpolationPref = 0;
    if (CStudioPreferences::GetInterpolation())
        theInterpolationPref = 0;
    else
        theInterpolationPref = 1;
    m_ui->m_DefaultInterpolation->setCurrentIndex(theInterpolationPref);

    // Timeline snapping grid
    m_ui->m_checkTimelineAbsoluteSnapping->setChecked(
                   CStudioPreferences::IsTimelineSnappingGridActive());

    // Load the combo boxes with values from the string table so that they are localizable.
    // The scale mode
    (void)theComboItem;
    theComboItem = ::LoadResourceString(IDS_PREF_SNAPRANGE_1);
    m_ui->m_SnapRangeCombo->addItem(theComboItem.toQString());
    theComboItem = ::LoadResourceString(IDS_PREF_SNAPRANGE_2);
    m_ui->m_SnapRangeCombo->addItem(theComboItem.toQString());
    theComboItem = ::LoadResourceString(IDS_PREF_SNAPRANGE_3);
    m_ui->m_SnapRangeCombo->addItem(theComboItem.toQString());
    long theResolution = (long)CStudioPreferences::GetTimelineSnappingGridResolution();
    m_ui->m_SnapRangeCombo->setCurrentIndex(theResolution);

#ifdef INCLUDE_EDIT_CAMERA
    // Edit View Background color
    // TODO: Visualize selected color on the bg color change button
    InitEditStartViewCombo();
#endif

    EnableOptions();

    LoadPreviewSelections();

    m_ui->m_editNudgeAmount->setText(QString::number(m_nudgeValue));
    m_bgColor = CStudioPreferences::GetEditViewBackgroundColor();
    updateColorButton();
}

void CStudioAppPrefsPage::updateColorButton()
{
    QPalette pal = m_ui->m_EditViewBGColor->palette();
    pal.setColor(QPalette::Button, m_bgColor);
    m_ui->m_EditViewBGColor->setPalette(pal);
}

//==============================================================================
/**
 *	SaveSettings: Save the settings from the controls to the CDoc
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::SaveSettings()
{
    // Nudge amount
    CStudioPreferences::SetNudgeAmount(m_nudgeValue);

    // Default interpolation
    g_StudioApp.GetCore()->GetDoc()->SetDefaultKeyframeInterpolation(
        m_ui->m_DefaultInterpolation->currentIndex() == 0);

    // Timeline snapping grid
    CStudioPreferences::SetTimelineSnappingGridActive(
                m_ui->m_checkTimelineAbsoluteSnapping->isChecked());
    long theCurrentSelection = m_ui->m_SnapRangeCombo->currentIndex();
    CStudioPreferences::SetTimelineSnappingGridResolution((ESnapGridResolution)theCurrentSelection);

#ifdef INCLUDE_EDIT_CAMERA
    // Edit View Background Color
    CStudioPreferences::SetEditViewBackgroundColor(m_bgColor);
    //
    // g_StudioApp.GetCore()->GetDoc( )->SetEditViewBackgroundColor( theColor );

    // Preferred Startup View
    long theSel = m_ui->m_EditViewStartupView->currentIndex();
    long theNumItems = m_ui->m_EditViewStartupView->count();
    CStudioPreferences::SetPreferredStartupView(
        (theSel == theNumItems - 1) ? -1 : theSel); // -1 for deployment view
// g_StudioApp.GetCore()->GetDoc( )->UpdateClientScene( false );
#endif

    SavePreviewSettings();
}

//==============================================================================
/**
 *	OnApply: Handler for the Apply button
 *
 *	@param	None
 */
//==============================================================================
bool CStudioAppPrefsPage::OnApply()
{
    // Apply was clicked - save settings and disabled the Apply button
    this->SaveSettings();

    this->SetModified(FALSE);

    // Request that the renderer refreshes as settings may have changed
    g_StudioApp.GetRenderer().RequestRender();

    return CStudioPreferencesPropPage::OnApply();
}

//==============================================================================
/**
 *	OnOK: Handler for the OK button
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::OnOK()
{
    CStudioPreferencesPropPage::OnOK();
}

//==============================================================================
/**
 *	OnCancel: Handler for the Cancel button
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::OnCancel()
{
#ifdef INCLUDE_EDIT_CAMERA
    // if the edit view background color was changed, reset it back to the original
    // value
    CColor theOrigColor = CStudioPreferences::GetEditViewBackgroundColor();
    if (m_bgColor != theOrigColor) {
        // g_StudioApp.GetCore()->GetDoc( )->SetEditViewBackgroundColor( theOrigColor );
        // g_StudioApp.GetCore()->GetDoc( )->UpdateClientScene( false );
    }
#endif
    CStudioPreferencesPropPage::OnCancel();
}

//==============================================================================
/**
 *	OnButtonRestoreDefaults: Restore the defaults and exit the preferences.
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::OnButtonRestoreDefaults()
{
    Q3DStudio::CString theMessage;
    Q3DStudio::CString theTitle;
    int theChoice = 0;

    // Load the text strings for the message box
    theTitle = ::LoadResourceString(IDS_PREF_RESTOREDEFAULT_TITLE);
    theMessage = ::LoadResourceString(IDS_PREF_RESTOREDEFAULT_TEXT);

    // Ask the user if she really wants to do this
    theChoice = QMessageBox::question(this, theTitle.toQString(), theMessage.toQString());

    // If the "yes" button was selected
    if (theChoice == QMessageBox::Yes) {
        // Restore default preferences by passing PREFS_RESET_DEFAULTS back
        // to the CStudioDocPreferences (that called this preferences sheet)
        CStudioPreferencesPropPage::EndDialog(PREFS_RESET_DEFAULTS);
    }
}

//==============================================================================
/**
 *	OnSelChangeInterpolationDefault: CBN_SELCHANGE handler for the
 *									 IDC_INTERPOLATION_DEFAULT combo
 *box.
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::OnSelChangeInterpolationDefault()
{
    this->SetModified(TRUE);
}

//==============================================================================
/**
 *	OnChangeEditNudgeAmount: EN_UPDATE handler for the IDC_EDIT_NUDGE
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::OnChangeEditNudgeAmount()
{
    QString editStr = m_ui->m_editNudgeAmount->text();
    m_nudgeValue = editStr.toDouble();
    this->SetModified(true);
}

//==============================================================================
/**
 *	OnSelChangeSnapRange: CBN_SELCHANGE handler for the IDC_SNAPRANGE combo box.
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::OnSelChangeSnapRange()
{
    this->SetModified(true);
}

//==============================================================================
/**
 *	OnCheckTimelineAbsoluteSnapping: Handler for the IDC_CHECK_TIMELINEABSOLUTESNAPPING
 *checkbox.
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::OnCheckTimelineAbsoluteSnapping()
{
    this->SetModified(true);
    this->EnableOptions();
}

//==============================================================================
/**
 *	EnableOptions: Enable/disable options.
 *
 *	@param	None
 */
//==============================================================================
void CStudioAppPrefsPage::EnableOptions()
{
    m_ui->m_SnapRangeCombo->setEnabled(m_ui->m_checkTimelineAbsoluteSnapping->isChecked());
}

//==============================================================================
/**
 *	OnSelChangeStartupView: CBN_SELCHANGE handler for the IDC_COMBO_EDIT_STARTUP_VIEW
 *	Combo box
 */
void CStudioAppPrefsPage::OnSelChangeStartupView()
{
    this->SetModified(true);
}

//==============================================================================
/**
 *	Initialise the combo box that displays the preferred startup view.
 *	Set the initial selection to that saved to the preferences
 */
//==============================================================================
void CStudioAppPrefsPage::InitEditStartViewCombo()
{
    Q3DStudio::IStudioRenderer &theRenderer = g_StudioApp.GetRenderer();
    QStringList theCameraNames;
    theRenderer.GetEditCameraList(theCameraNames);
    for (size_t idx = 0, end = theCameraNames.size(); idx < end; ++idx) {
        m_ui->m_EditViewStartupView->addItem(
            theCameraNames.at(idx));
        m_ui->m_EditViewStartupView->setItemData(m_ui->m_EditViewStartupView->count() - 1, QVariant((int)idx + 1));
    }

    m_ui->m_EditViewStartupView->addItem("--------------------------");
    m_ui->m_EditViewStartupView->setItemData(m_ui->m_EditViewStartupView->count() - 1, -1); // set to an invalid pointer
    // add the deployment view as the last selection
    m_ui->m_EditViewStartupView->addItem(::LoadResourceString(IDS_SCENE_CAMERA_VIEW).toQString());
    m_ui->m_EditViewStartupView->setItemData(m_ui->m_EditViewStartupView->count() - 1, 0);

    long thePreferredView = CStudioPreferences::GetPreferredStartupView();
    long theNumItems = m_ui->m_EditViewStartupView->count();
    if (thePreferredView == -1) // deployment view
        m_ui->m_EditViewStartupView->setCurrentIndex(theNumItems - 1); // set to the last one
    else if (thePreferredView < theNumItems - 1)
        m_ui->m_EditViewStartupView->setCurrentIndex(thePreferredView);
    else // possibly from old content where cameras are removed
        m_ui->m_EditViewStartupView->setCurrentIndex(0);
}

void CStudioAppPrefsPage::LoadPreviewSelections()
{
    // Load the configurations from all the .build files
    Q3DStudio::CBuildConfigurations &theConfig = g_StudioApp.GetCore()->GetBuildConfigurations();
    Q3DStudio::CBuildConfigurations::TBuildConfigurations theConfigurations =
        theConfig.GetConfigurations();
    Q3DStudio::CBuildConfigurations::TBuildConfigurations::iterator theIter;
    for (theIter = theConfigurations.begin(); theIter != theConfigurations.end(); ++theIter) {
        const Q3DStudio::CString &theConfig = theIter->first;
        m_ui->m_PreviewSelector->addItem(theConfig.toQString());
        m_ui->m_PreviewSelector->setItemData(m_ui->m_PreviewSelector->count() - 1,
                                             QVariant::fromValue(theIter->second));
    }

    int thePreviewSelected = m_ui->m_PreviewSelector->findText(CStudioPreferences::GetPreviewConfig().toQString());
    m_ui->m_PreviewSelector->setCurrentIndex(thePreviewSelected);
    if (thePreviewSelected == -1) {
        // select the first build configuration, or if no conriguration, the first application, i.e.
        // AMPlayer
        m_ui->m_PreviewSelector->setCurrentIndex(0);
        long thePreviewCount = m_ui->m_PreviewSelector->count();
        for (long theIndex = 0; theIndex < thePreviewCount; ++theIndex) {
            if (m_ui->m_PreviewSelector->itemData(theIndex).value<Q3DStudio::CBuildConfiguration *>() != nullptr) {
                m_ui->m_PreviewSelector->setCurrentIndex(theIndex);
                break;
            }
        }
    }

    LoadBuildProperties();
}

//==============================================================================
/**
 *	When the build configuration is changed, all the properties have to be updated.
 */
//==============================================================================
void CStudioAppPrefsPage::OnChangePreviewConfiguration()
{
    LoadBuildProperties();
}

void CStudioAppPrefsPage::OnBgColorButtonClicked() 
{
    QColorDialog dlg(this);
    dlg.setCurrentColor(m_bgColor);
    if (dlg.exec() == QDialog::Accepted) {
        m_bgColor = dlg.selectedColor();
        updateColorButton();
    }

    this->SetModified(true);
}

//==============================================================================
/**
 *	Load the build properties for the current preview application selected
 */
//==============================================================================
void CStudioAppPrefsPage::LoadBuildProperties()
{
    // Remove those dynamic controls
    RemovePreviewPropertyControls();

    if (m_ui->m_PreviewSelector->count() > 0) {
        Q3DStudio::CBuildConfiguration *theConfig =
            m_ui->m_PreviewSelector->itemData(m_ui->m_PreviewSelector->currentIndex()).value<Q3DStudio::CBuildConfiguration *>();
        if (theConfig) {
            // Only configuration read from .build files will have the ItemDataPtr set.

            Q3DStudio::CBuildConfiguration::TConfigProperties &theProperties =
                theConfig->GetBuildProperties();

            auto layout = qobject_cast<QFormLayout *>(m_ui->groupBoxPreview->layout());
            auto activated = static_cast<void(QComboBox::*)(int)>(&QComboBox::activated);

            if (theProperties.empty() == false) {
                Q3DStudio::CBuildConfiguration::TConfigProperties::iterator theIter;

                for (theIter = theProperties.begin(); theIter != theProperties.end(); ++theIter) {
                    Q3DStudio::CBuildConfiguration::TConfigPropertyValues &theValues =
                        theIter->GetAcceptableValues();
                    // Only create the combo if there is more than 1 choices
                    if (theValues.size() > 1) {
                        Q3DStudio::CBuildConfiguration::TConfigPropertyValues::iterator
                            theValueIter;
                        long theMaxLength = 0;
                        for (theValueIter = theValues.begin(); theValueIter != theValues.end();
                             ++theValueIter) {
                            long theLabelLength = theValueIter->GetLabel().Length();
                            if (theLabelLength > theMaxLength)
                                theMaxLength = theLabelLength;
                        }

                        QLabel *theStaticText = new QLabel(theIter->GetLabel().toQString());
                        theStaticText->setFont(m_Font);
                        QComboBox *thePropertyDropdown = new QComboBox();
                        connect(thePropertyDropdown, activated, [&]() {SetModified(true);});
                        thePropertyDropdown->setFont(m_Font);
                        layout->addRow(theStaticText, thePropertyDropdown);

                        m_BuildProperties.push_back(std::make_pair(
                            &*theIter, std::make_pair(theStaticText, thePropertyDropdown)));

                        Q3DStudio::CString thePropertyValue =
                            CStudioPreferences::GetPreviewProperty(theIter->GetName());
                        for (theValueIter = theValues.begin(); theValueIter != theValues.end();
                             ++theValueIter) {
                            thePropertyDropdown->addItem(theValueIter->GetLabel().toQString());
                            thePropertyDropdown->setItemData(thePropertyDropdown->count() - 1, QVariant::fromValue(&*theValueIter));
                            if (theValueIter->GetName() == thePropertyValue)
                                thePropertyDropdown->setCurrentIndex(thePropertyDropdown->count() - 1);
                        }

                        // Select the first entry
                        if (thePropertyDropdown->currentIndex() == -1)
                            thePropertyDropdown->setCurrentIndex(0);
                    }
                }
            }
        }
    }
}

void CStudioAppPrefsPage::SavePreviewSettings()
{
    QString thePreviewApp = m_ui->m_PreviewSelector->currentText();
    CStudioPreferences::SetPreviewConfig(Q3DStudio::CString::fromQString(thePreviewApp));

    std::list<TBuildNameControlPair>::iterator theIter;
    for (theIter = m_BuildProperties.begin(); theIter != m_BuildProperties.end(); ++theIter) {
        QComboBox *theCombo = theIter->second.second;
        Q3DStudio::CString theName = theIter->first->GetName();
        Q3DStudio::CBuildConfiguration::SConfigPropertyValue *thePropertyValue =
                theCombo->itemData(theCombo->currentIndex()).value<Q3DStudio::CBuildConfiguration::SConfigPropertyValue *>();
        CStudioPreferences::SetPreviewProperty(theName, thePropertyValue->GetName());
    }
}

//==============================================================================
/**
 *	Remove all the dynamically added controls that was read in from the build file
 */
//==============================================================================
void CStudioAppPrefsPage::RemovePreviewPropertyControls()
{
    // Remove the created control
    std::list<TBuildNameControlPair>::iterator theIter;
    for (theIter = m_BuildProperties.begin(); theIter != m_BuildProperties.end(); ++theIter) {
        delete theIter->second.first;
        delete theIter->second.second;
    }
    m_BuildProperties.clear();
}