From 3ec0d129ab9d0237f0afb8421a422cabee4f6977 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 19 Sep 2018 17:03:41 +0300 Subject: Update welcome screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Welcome screen is now simply a single screen instead of a multi-screen tutorial. A button was added to open getting started documentation. Note: Font family is not correct, to be fixed later. Task-number: QT3DS-2239 Change-Id: I98e8d07d72ce33c433a187d989f36d10d09a4ec8 Reviewed-by: Tomi Korpipää --- .../Client/Code/Core/Utility/StudioPreferences.cpp | 10 + .../Client/Code/Core/Utility/StudioPreferences.h | 2 + src/Authoring/Studio/Application/StudioApp.cpp | 119 +++-- src/Authoring/Studio/Application/StudioApp.h | 5 +- .../Studio/Application/StudioTutorialWidget.cpp | 230 ++------- .../Studio/Application/StudioTutorialWidget.h | 33 +- .../Studio/Application/StudioTutorialWidget.ui | 561 +++++++++++---------- src/Authoring/Studio/MainFrm.cpp | 9 +- src/Authoring/Studio/MainFrm.ui | 4 +- src/Authoring/Studio/images.qrc | 29 +- .../Studio/images/Tutorial/background.png | Bin 7419 -> 0 bytes .../Studio/images/Tutorial/background@2x.png | Bin 24837 -> 0 bytes .../Studio/images/Tutorial/button_back.png | Bin 807 -> 0 bytes .../Studio/images/Tutorial/button_back@2x.png | Bin 1510 -> 0 bytes .../Studio/images/Tutorial/button_next.png | Bin 782 -> 0 bytes .../Studio/images/Tutorial/button_next@2x.png | Bin 1499 -> 0 bytes .../Studio/images/Tutorial/dot_active.png | Bin 683 -> 0 bytes .../Studio/images/Tutorial/dot_active@2x.png | Bin 856 -> 0 bytes .../Studio/images/Tutorial/dot_inactive.png | Bin 1021 -> 0 bytes .../Studio/images/Tutorial/dot_inactive@2x.png | Bin 2386 -> 0 bytes .../Studio/images/Tutorial/screens/1x/1.png | Bin 226304 -> 0 bytes .../Studio/images/Tutorial/screens/1x/2.png | Bin 85453 -> 0 bytes .../Studio/images/Tutorial/screens/1x/3.png | Bin 104340 -> 0 bytes .../Studio/images/Tutorial/screens/1x/4.png | Bin 82564 -> 0 bytes .../Studio/images/Tutorial/screens/1x/5.png | Bin 92253 -> 0 bytes .../Studio/images/Tutorial/screens/1x/6.png | Bin 89810 -> 0 bytes .../Studio/images/Tutorial/screens/1x/7.png | Bin 93514 -> 0 bytes .../Studio/images/Tutorial/screens/1x/8.png | Bin 88906 -> 0 bytes .../Studio/images/Tutorial/screens/1x/9.png | Bin 98073 -> 0 bytes .../Studio/images/Tutorial/screens/2x/1.png | Bin 348409 -> 0 bytes .../Studio/images/Tutorial/screens/2x/2.png | Bin 180698 -> 0 bytes .../Studio/images/Tutorial/screens/2x/3.png | Bin 205814 -> 0 bytes .../Studio/images/Tutorial/screens/2x/4.png | Bin 160298 -> 0 bytes .../Studio/images/Tutorial/screens/2x/5.png | Bin 178744 -> 0 bytes .../Studio/images/Tutorial/screens/2x/6.png | Bin 176670 -> 0 bytes .../Studio/images/Tutorial/screens/2x/7.png | Bin 183698 -> 0 bytes .../Studio/images/Tutorial/screens/2x/8.png | Bin 172953 -> 0 bytes .../Studio/images/Tutorial/screens/2x/9.png | Bin 190544 -> 0 bytes .../Studio/images/welcomedialog/laptop.png | Bin 0 -> 207370 bytes src/Authoring/Studio/style.qss | 35 +- 40 files changed, 456 insertions(+), 581 deletions(-) delete mode 100644 src/Authoring/Studio/images/Tutorial/background.png delete mode 100644 src/Authoring/Studio/images/Tutorial/background@2x.png delete mode 100644 src/Authoring/Studio/images/Tutorial/button_back.png delete mode 100644 src/Authoring/Studio/images/Tutorial/button_back@2x.png delete mode 100644 src/Authoring/Studio/images/Tutorial/button_next.png delete mode 100644 src/Authoring/Studio/images/Tutorial/button_next@2x.png delete mode 100644 src/Authoring/Studio/images/Tutorial/dot_active.png delete mode 100644 src/Authoring/Studio/images/Tutorial/dot_active@2x.png delete mode 100644 src/Authoring/Studio/images/Tutorial/dot_inactive.png delete mode 100644 src/Authoring/Studio/images/Tutorial/dot_inactive@2x.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/1.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/2.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/3.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/4.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/5.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/6.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/7.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/8.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/1x/9.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/1.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/2.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/3.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/4.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/5.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/6.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/7.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/8.png delete mode 100644 src/Authoring/Studio/images/Tutorial/screens/2x/9.png create mode 100644 src/Authoring/Studio/images/welcomedialog/laptop.png diff --git a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp index 18632072..8a1f61ac 100644 --- a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp +++ b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp @@ -56,6 +56,7 @@ static QColor s_textColor; static QColor s_masterColor; static QColor s_disabledColor; static QColor s_dataInputColor; +static QLinearGradient s_welcomeBackgroundGradient; static QColor s_timelineRowColorNormal; static QColor s_timelineRowColorNormalProp; @@ -136,6 +137,10 @@ void CStudioPreferences::LoadPreferences() s_disabledColor = QColor("#727476"); s_dataInputColor = QColor("#ff5102"); + s_welcomeBackgroundGradient = QLinearGradient(0.0, 0.0, 1.0, 0.0); + s_welcomeBackgroundGradient.setColorAt(0.0, QColor("#343E55")); + s_welcomeBackgroundGradient.setColorAt(1.0, QColor("#000727")); + s_timelineRowColorNormal = QColor("#404040"); s_timelineRowColorNormalProp = QColor("#373737"); s_timelineRowColorOver = QColor("#4d4d4d"); @@ -849,6 +854,11 @@ QColor CStudioPreferences::dataInputColor() return s_dataInputColor; } +QLinearGradient CStudioPreferences::welcomeBackgroundGradient() +{ + return s_welcomeBackgroundGradient; +} + QColor CStudioPreferences::timelineRowColorNormal() { return s_timelineRowColorNormal; diff --git a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h index ae8be55c..bd586629 100644 --- a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h +++ b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h @@ -33,6 +33,7 @@ #pragma once #include +#include #include "CoreConst.h" #include "Qt3DSFile.h" @@ -163,6 +164,7 @@ public: static QColor masterColor(); static QColor disabledColor(); static QColor dataInputColor(); + static QLinearGradient welcomeBackgroundGradient(); static QColor timelineRowColorNormal(); static QColor timelineRowColorNormalProp(); diff --git a/src/Authoring/Studio/Application/StudioApp.cpp b/src/Authoring/Studio/Application/StudioApp.cpp index f7dc7b42..91b1ab92 100644 --- a/src/Authoring/Studio/Application/StudioApp.cpp +++ b/src/Authoring/Studio/Application/StudioApp.cpp @@ -310,9 +310,11 @@ bool CStudioApp::initInstance(const QCommandLineParser &parser) thePreferencesPath, CFilePath(L"Qt3DSComposer\\Preferences.setting")); CPreferences::SetPreferencesFile(thePreferencesPath); - // Initialize help file path - m_pszHelpFilePath = Qt3DSFile::GetApplicationDirectory().GetPath() + - Q3DStudio::CString("/../doc/qt3dstudio/qt3dstudio-index.html"); + // Initialize help file paths + m_helpFilePath = Qt3DSFile::GetApplicationDirectory().GetPath().toQString() + + QStringLiteral("/../doc/qt3dstudio/qt3dstudio-index.html"); + m_gettingStartedFilePath = Qt3DSFile::GetApplicationDirectory().GetPath().toQString() + + QStringLiteral("/../doc/qt3dstudio/getting-started.html"); CStudioPreferences::LoadPreferences(); @@ -393,83 +395,88 @@ bool CStudioApp::run(const QCommandLineParser &parser) bool CStudioApp::handleWelcomeRes(int res, bool recursive) { bool theReturn = true; + bool canceled = false; switch (res) { case StudioTutorialWidget::createNewResult: { - Qt3DSFile theFile(m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir())); - if (theFile.GetPath() != "") { - if (!m_core->OnNewDocument(theFile, true)) { - // Invalid filename, show a message box and the startup dialog - showInvalidFilenameWarning(); - theReturn = showStartupDialog(); + if (PerformSavePrompt()) { + Qt3DSFile theFile(m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir())); + if (theFile.GetPath() != "") { + if (!m_core->OnNewDocument(theFile, true)) { + // Invalid filename, show a message box and the startup dialog + showInvalidFilenameWarning(); + theReturn = showStartupDialog(); + } else { + theReturn = true; + m_welcomeShownThisSession = true; + } } else { - theReturn = true; - m_welcomeShownThisSession = true; + canceled = true; } } else { - // User Cancels the dialog. Show the welcome screen. - if (recursive) { - m_welcomeShownThisSession = false; - m_goStraightToWelcomeFileDialog = true; - theReturn = showStartupDialog(); - } else { - theReturn = false; - } + canceled = true; } } break; case StudioTutorialWidget::openSampleResult: { - // Try three options: - // - open a specific example .uip - // - failing that, show the main example root dir - // - failing all previous, show default Documents dir - QFileInfo filePath; - QString theFile(QStringLiteral(".")); + if (PerformSavePrompt()) { + // Try three options: + // - open a specific example .uip + // - failing that, show the main example root dir + // - failing all previous, show default Documents dir + QFileInfo filePath; + QString theFile(QStringLiteral(".")); #ifndef Q_OS_MACOS - filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() + - QStringLiteral("/../examples/studio3d/SampleProject")); - - if (!filePath.exists()) { filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() + - QStringLiteral("/../examples/studio3d")); -#else - filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() + - QStringLiteral("/../../../../examples/studio3d/SampleProject")); + QStringLiteral("/../examples/studio3d/SampleProject")); - if (!filePath.exists()) { + if (!filePath.exists()) { + filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() + + QStringLiteral("/../examples/studio3d")); +#else filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() + - QStringLiteral("/../../../../examples/studio3d")); -#endif + QStringLiteral("/../../../../examples/studio3d/SampleProject")); + if (!filePath.exists()) { - filePath.setFile(QStandardPaths::writableLocation( - QStandardPaths::DocumentsLocation)); + filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() + + QStringLiteral("/../../../../examples/studio3d")); +#endif + if (!filePath.exists()) { + filePath.setFile(QStandardPaths::writableLocation( + QStandardPaths::DocumentsLocation)); + } + theFile = m_dialogs->GetFileOpenChoice(filePath.absoluteFilePath()); + } else { + theFile = filePath.absoluteFilePath() + QStringLiteral("/SampleProject.uip"); } - theFile = m_dialogs->GetFileOpenChoice(filePath.absoluteFilePath()); - } else { - theFile = filePath.absoluteFilePath() + QStringLiteral("/SampleProject.uip"); - } - if (!theFile.isEmpty()) { - OnLoadDocument(theFile); - theReturn = true; - m_welcomeShownThisSession = true; - } else { - // User Cancels the dialog. Show the welcome screen. - if (recursive) { - m_welcomeShownThisSession = false; - m_goStraightToWelcomeFileDialog = true; - theReturn = showStartupDialog(); + if (!theFile.isEmpty()) { + OnLoadDocument(theFile); + theReturn = true; + m_welcomeShownThisSession = true; } else { - theReturn = false; + canceled = true; } + } else { + canceled = true; } } break; - default: - ASSERT(false); // Should not reach this block. + // Welcome screen was simply closed theReturn = false; break; } + + if (canceled) { + // User Cancels the dialog. Show the welcome screen. + if (recursive) { + m_welcomeShownThisSession = false; + m_goStraightToWelcomeFileDialog = true; + theReturn = showStartupDialog(); + } else { + theReturn = false; + } + } return theReturn; } @@ -527,7 +534,7 @@ bool CStudioApp::showStartupDialog() } if (show) { - StudioTutorialWidget tutorial(m_pMainWnd, m_goStraightToWelcomeFileDialog, true); + StudioTutorialWidget tutorial(m_pMainWnd); welcomeRes = tutorial.exec(); } } diff --git a/src/Authoring/Studio/Application/StudioApp.h b/src/Authoring/Studio/Application/StudioApp.h index c4b10ca9..e91be9e8 100644 --- a/src/Authoring/Studio/Application/StudioApp.h +++ b/src/Authoring/Studio/Application/StudioApp.h @@ -95,6 +95,7 @@ public: #if (defined Q_OS_MACOS) void openApplication(const QString &inFilename); #endif + bool handleWelcomeRes(int res, bool recursive); public Q_SLOTS: void handleMessageReceived(const QString &message, QObject *socket); @@ -108,7 +109,6 @@ protected: bool isNewProject = true); void initCore(); bool showStartupDialog(); - bool handleWelcomeRes(int res, bool recursive); QString resolvePresentationFile(const QString &inFile); CCore *m_core; @@ -249,7 +249,8 @@ public: void OnNewPresentation() override; void OnPresentationModifiedExternally() override; - Q3DStudio::CString m_pszHelpFilePath; + QString m_helpFilePath; + QString m_gettingStartedFilePath; QVector m_subpresentations; QMap m_dataInputDialogItems; diff --git a/src/Authoring/Studio/Application/StudioTutorialWidget.cpp b/src/Authoring/Studio/Application/StudioTutorialWidget.cpp index c6240531..bb80e7bf 100644 --- a/src/Authoring/Studio/Application/StudioTutorialWidget.cpp +++ b/src/Authoring/Studio/Application/StudioTutorialWidget.cpp @@ -28,165 +28,69 @@ #include "StudioTutorialWidget.h" #include "ui_StudioTutorialWidget.h" #include "StudioUtils.h" +#include "StudioApp.h" +#include "StudioPreferences.h" #include #include +#include +#include +#include +#include -StudioTutorialWidget::StudioTutorialWidget(QWidget *parent, bool goToFileDialog, - bool showProjectButtons) : +StudioTutorialWidget::StudioTutorialWidget(QWidget *parent) : QDialog(parent, Qt::MSWindowsFixedSizeDialogHint), - m_ui(new Ui::StudioTutorialWidget), - m_welcomeImages(0), - m_imgIter(0), - m_palette(0), - m_displayScale(1.0), - m_showProjectButtons(showProjectButtons) + m_ui(new Ui::StudioTutorialWidget) { m_ui->setupUi(this); - connect(m_ui->studioTutorialBack, &QPushButton::clicked, this, - &StudioTutorialWidget::handleBack); - connect(m_ui->studioTutorialForward, &QPushButton::clicked, this, - &StudioTutorialWidget::handleFwd); - connect(m_ui->pageIndicator, &StudioTutorialPageIndicator::indexChanged, this, - &StudioTutorialWidget::handleIndexChange); connect(m_ui->studioTutorialShowAgain, &QCheckBox::stateChanged, this, &StudioTutorialWidget::handleDoNotShowAgainChange); connect(m_ui->studioTutorialNew, &QPushButton::clicked, this, &StudioTutorialWidget::handleCreateNew); connect(m_ui->studioTutorialOpen, &QPushButton::clicked, this, &StudioTutorialWidget::handleOpenSample); + connect(m_ui->studioTutorialQuickStart, &QPushButton::clicked, this, + &StudioTutorialWidget::handleQuickStartGuide); - OnInitDialog(goToFileDialog); + QTimer::singleShot(0, this, &StudioTutorialWidget::OnInitDialog); - if (m_showProjectButtons) - m_ui->studioTutorialNew->setText(tr("Create New")); - else - m_ui->studioTutorialNew->setText(tr("OK")); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); } StudioTutorialWidget::~StudioTutorialWidget() { delete m_ui; - delete m_welcomeImages; - delete m_palette; + delete m_backgroundPalette; } -void StudioTutorialWidget::OnInitDialog(bool goToFileDialog) +void StudioTutorialWidget::OnInitDialog() { - m_welcomeImages = new QList(); - - // populate welcome screen images - getImageList(); - m_imgIter = m_welcomeImages->begin(); - m_imgIterPrev = m_imgIter; - m_pageOutPixmap = getScaledPic(m_imgIterPrev); - m_pageInPixmap = getScaledPic(m_imgIter); - m_backgroundPixmap = QPixmap(":/images/Tutorial/background.png"); - - // based on background PNG, get the scale that we need to fit welcome - // screen and buttons comfortably on display - m_displayScale = getDisplayScalingForImage(m_backgroundPixmap); - QSize backgroundSize = m_backgroundPixmap.size(); + QSize backgroundSize = size(); QRect screenRect = QApplication::desktop()->availableGeometry( QApplication::desktop()->screenNumber(this)); QSize windowSize = screenRect.size(); - m_ui->verticalWidget->setFixedSize(backgroundSize); - move(screenRect.x() + (windowSize.width() - backgroundSize.width()) / 2, screenRect.y() + (windowSize.height() - backgroundSize.height()) / 2); - // do we go straight to last page with file dialog buttons? - int initPage = goToFileDialog ? m_welcomeImages->size() - 1 : 0; - m_imgIter = m_welcomeImages->begin() + initPage; - updateButtons(); + setFixedSize(backgroundSize); QSettings settings; m_ui->studioTutorialShowAgain->setChecked(!settings.value("showWelcomeScreen").toBool()); - - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); -} - -void StudioTutorialWidget::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event) - - QPainter painter(this); - - if (!m_palette) { - m_palette = new QPalette; - m_palette->setBrush(QPalette::Window, m_backgroundPixmap); - setPalette(*m_palette); - resize(m_backgroundPixmap.size()); - setFixedSize(size()); - } - - // Make tutorial images to scale to full background width, vertically centered, - // while keeping correct aspect ratio - qreal aspectRatio = (qreal) m_pageInPixmap.height() / m_pageInPixmap.width(); - int rectHeight = size().width() * aspectRatio; - QRect rect(0, (size().height() / 2) - (rectHeight / 2), - size().width(), rectHeight); - - qreal pageOutOpacity = 1.0 - m_pageInOpacity; - - if (pageOutOpacity > 0.0) { - painter.setOpacity(pageOutOpacity); - painter.drawPixmap(rect, m_pageOutPixmap); - } - if (m_pageInOpacity > 0.0) { - painter.setOpacity(m_pageInOpacity); - painter.drawPixmap(rect, m_pageInPixmap); - } - - if (m_pageInOpacity < 1.0) { - // Page switching animation still going on - qreal opacityAnimationStep = qreal(m_opacityTime.restart()) / 300.0; - m_pageInOpacity += opacityAnimationStep; - m_pageInOpacity = qMin(m_pageInOpacity, 1.0); - update(); - } -} - -void StudioTutorialWidget::animateInOut() -{ - m_pageOutPixmap = getScaledPic(m_imgIterPrev); - m_pageInPixmap = getScaledPic(m_imgIter); - m_pageInOpacity = 0.0; - m_opacityTime.start(); - update(); -} - -void StudioTutorialWidget::handleFwd() -{ - if (*m_imgIter != m_welcomeImages->last()) { - m_imgIterPrev = m_imgIter; - m_imgIter++; - updateButtons(); - animateInOut(); - } -} - -void StudioTutorialWidget::handleBack() -{ - if (*m_imgIter != m_welcomeImages->first()) { - m_imgIterPrev = m_imgIter; - m_imgIter--; - updateButtons(); - animateInOut(); - } + m_backgroundPalette = new QPalette(palette()); + QPixmap background(size()); + QPainter backgroundPainter(&background); + QLinearGradient gradient = CStudioPreferences::welcomeBackgroundGradient(); + gradient.setFinalStop(background.width(), 0.0); + backgroundPainter.fillRect(background.rect(), gradient); + QPixmap laptop(":/images/welcomedialog/laptop.png"); + backgroundPainter.drawPixmap(0, 100, laptop.width(), laptop.height(), laptop); + backgroundPainter.end(); + m_backgroundPalette->setBrush(backgroundRole(), QBrush(background)); + setAutoFillBackground(true); + setPalette(*m_backgroundPalette); } -void StudioTutorialWidget::handleIndexChange(int index) -{ - index = qBound(0, index, m_welcomeImages->size() - 1); - if (index != page()) { - m_imgIterPrev = m_imgIter; - m_imgIter = m_welcomeImages->begin() + index; - updateButtons(); - animateInOut(); - } -} void StudioTutorialWidget::handleDoNotShowAgainChange(int state) { @@ -205,79 +109,9 @@ void StudioTutorialWidget::handleCreateNew() this->done(StudioTutorialWidget::createNewResult); } -void StudioTutorialWidget::getImageList() -{ - QString imagePath = QStringLiteral(":/images/Tutorial/screens/1x"); - - // Use @2x images for hiDPI displays - if (devicePixelRatio() > 1.0) - imagePath = QStringLiteral(":/images/Tutorial/screens/2x"); - - QDirIterator *it = new QDirIterator(imagePath, QDirIterator::NoIteratorFlags); - - while (it->hasNext()) - m_welcomeImages->append(it->next()); - - m_ui->pageIndicator->setCount(m_welcomeImages->size()); -} - -int StudioTutorialWidget::page() const +void StudioTutorialWidget::handleQuickStartGuide() { - int i = 0; - QList::iterator iter = m_welcomeImages->begin(); - while (iter != m_imgIter) { ++i; iter++; } - return i; -} - -QPixmap StudioTutorialWidget::getScaledPic(const QList::iterator &iter) -{ - QPixmap picOrig = QPixmap(*iter); - QPixmap pic = picOrig; - if (m_displayScale < 1.0) { - // Limit to the maximum size of @2x images - pic = picOrig.scaledToHeight(qMin(1200.0, m_displayScale * picOrig.height()), - Qt::SmoothTransformation); - } - - pic.setDevicePixelRatio(devicePixelRatio()); - return pic; -} - -qreal StudioTutorialWidget::getDisplayScalingForImage(const QPixmap &picOrig) -{ - // Note that high DPI scaling has an effect on the display - // resolution returned by QApplication::desktop()->availableGeometry(). - // DPI scaling factor is integer and taken from the primary screen. - // When running studio on secondary monitor with different DPI, - // or running it on primary with non-integer scaling, we might - // get different dialog size than intended. - QSize displaySize = QApplication::desktop()->availableGeometry( - QApplication::desktop()->screenNumber(this)).size(); - - // Scale down if images do not fit on screen, otherwise use - // 1:1 PNGs to avoid scaling artifacts. Scale to 90% of the display size if scaling is needed. - if (picOrig.height() > displaySize.height() || picOrig.width() > displaySize.width()) { - QSize picScaledSize = picOrig.size(); - picScaledSize.scale(displaySize * 0.9, Qt::KeepAspectRatio); - m_displayScale = qMin((qreal)picScaledSize.height() / (qreal)picOrig.height(), - (qreal)picScaledSize.width() / (qreal)picOrig.width()); - return m_displayScale; - } else { - return 1.0; - } -} - -void StudioTutorialWidget::updateButtons() -{ - bool isFirst = (*m_imgIter == m_welcomeImages->first()); - bool isLast = (*m_imgIter == m_welcomeImages->last()); - - m_ui->studioTutorialBack->setVisible(!isFirst); - m_ui->studioTutorialForward->setVisible(!isLast); - m_ui->studioTutorialOpen->setVisible(isLast && m_showProjectButtons); - m_ui->studioTutorialNew->setVisible(isLast); - m_ui->studioTutorialShowAgain->setVisible(isFirst); - m_ui->checkBoxLabel->setVisible(isFirst); - - m_ui->pageIndicator->setCurrentIndex(page()); + QFile theFile(g_StudioApp.m_gettingStartedFilePath); + if (theFile.exists()) + QDesktopServices::openUrl(QUrl::fromLocalFile(theFile.fileName())); } diff --git a/src/Authoring/Studio/Application/StudioTutorialWidget.h b/src/Authoring/Studio/Application/StudioTutorialWidget.h index e55f5efb..8cd8ca0f 100644 --- a/src/Authoring/Studio/Application/StudioTutorialWidget.h +++ b/src/Authoring/Studio/Application/StudioTutorialWidget.h @@ -51,7 +51,7 @@ class StudioTutorialWidget : public QDialog { Q_OBJECT public: - explicit StudioTutorialWidget(QWidget *parent, bool goToFileDialog, bool showProjectButtons); + explicit StudioTutorialWidget(QWidget *parent); ~StudioTutorialWidget(); @@ -63,42 +63,17 @@ public: }; protected: - void paintEvent(QPaintEvent *event) override; - void OnInitDialog(bool goToFileDialog); + void OnInitDialog(); public: - void handleFwd(); - void handleBack(); - void handleIndexChange(int index); void handleDoNotShowAgainChange(int state); void handleOpenSample(); void handleCreateNew(); - int page() const; + void handleQuickStartGuide(); private: Ui::StudioTutorialWidget *m_ui; - - QList *m_welcomeImages; - QList::iterator m_imgIter; - QList::iterator m_imgIterPrev; - - QPalette *m_palette; - QPixmap m_pageInPixmap; - QPixmap m_pageOutPixmap; - QPixmap m_backgroundPixmap; - - qreal m_displayScale; - qreal m_pageInOpacity = 0.0; - QTime m_opacityTime; - - bool m_showProjectButtons; - - void getImageList(); - void updateButtons(); - void animateInOut(); - - QPixmap getScaledPic(const QList::iterator &iter); - qreal getDisplayScalingForImage(const QPixmap &picOrig); + QPalette *m_backgroundPalette = nullptr; }; #endif // STUDIOTUTORIALWIDGET_H diff --git a/src/Authoring/Studio/Application/StudioTutorialWidget.ui b/src/Authoring/Studio/Application/StudioTutorialWidget.ui index f7e9dd64..f251cc7b 100644 --- a/src/Authoring/Studio/Application/StudioTutorialWidget.ui +++ b/src/Authoring/Studio/Application/StudioTutorialWidget.ui @@ -14,7 +14,7 @@ - + 0 0 @@ -25,7 +25,10 @@ StudioTutorialWidget - + + + 0 + 0 @@ -38,186 +41,58 @@ 0 - - - - - 0 - - - - - QLayout::SetNoConstraint + + + + + 0 + 0 + + + + false + + + + + + + 0 + 0 + - - - - - 0 - 0 - - - - studioTutorialShowAgain - - - - - - - - - - - 0 - 0 - - - - Do Not Show This Again - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 16 - - - - - - - - Qt::Horizontal - - - - 40 - 16 - - - - - - - - - - - 0 - - - QLayout::SetMaximumSize - - - 0 - - - 0 - - - 0 - - - 0 - + - - - - 39 - 39 - - - - Qt::NoFocus + + + + 0 + 0 + - studioTutorialBack + studioTutorialShowAgain - - - :/images/Tutorial/button_back.png:/images/Tutorial/button_back.png - - - - 39 - 39 - - - - true - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 323 - 46 - - - - - - + - + 0 0 - - - 39 - 39 - - - - Qt::NoFocus - - - StudioTutorialWidget - - + Do Not Show This Again - - - :/images/Tutorial/button_next.png:/images/Tutorial/button_next.png + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - 39 - 39 - - - + true @@ -225,11 +100,14 @@ - - + + Qt::Vertical + + QSizePolicy::Fixed + 20 @@ -238,102 +116,275 @@ - - - - - QLayout::SetMaximumSize - - - - - - 160 - 80 - - - - - - - - Qt::Horizontal - - - - - - - - 200 - 40 - - - - - - - - Qt::Horizontal - - - - - - - - 160 - 80 - - - - - - - Qt::NoFocus - - - studioTutorialOpen - - - Open Sample Project - - - - - - - Qt::NoFocus - - - studioTutorialNew - - - Create New + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 150 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 700 + 20 + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Titillium Web + 24 + + + + Welcome to + + + + + + + + Titillium Web + 24 + + + + Qt 3D Studio + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 160 + 80 + + + + + 18 - - - - - - - + + + + + 300 + 50 + + + + + 24 + + + + Qt::NoFocus + + + studioTutorialNew + + + Quick Start Guide + + + + + + + + 300 + 50 + + + + + 24 + + + + Qt::NoFocus + + + studioTutorialOpen + + + Open Example Project + + + + + + + + 300 + 50 + + + + + 24 + + + + Qt::NoFocus + + + studioTutorialNew + + + Create New Project + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 250 + + + - - - StudioTutorialPageIndicator - QWidget -
StudioTutorialPageIndicator.h
- 1 -
-
- - - + diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp index 1862e256..e1ba46b6 100644 --- a/src/Authoring/Studio/MainFrm.cpp +++ b/src/Authoring/Studio/MainFrm.cpp @@ -1717,7 +1717,7 @@ void CMainFrame::OnViewTooltips() */ void CMainFrame::OnUpdateHelpIndex() { - QFile theFile(g_StudioApp.m_pszHelpFilePath.toQString()); + QFile theFile(g_StudioApp.m_helpFilePath); m_ui->action_Reference_Manual->setEnabled(theFile.exists()); } @@ -1727,7 +1727,7 @@ void CMainFrame::OnUpdateHelpIndex() */ void CMainFrame::OnHelpIndex() { - QFile theFile(g_StudioApp.m_pszHelpFilePath.toQString()); + QFile theFile(g_StudioApp.m_helpFilePath); if (theFile.exists()) QDesktopServices::openUrl(QUrl::fromLocalFile(theFile.fileName())); } @@ -1747,8 +1747,9 @@ void CMainFrame::OnHelpVisitQt() */ void CMainFrame::OnHelpOpenTutorial() { - StudioTutorialWidget tutorial(this, false, false); - tutorial.exec(); + StudioTutorialWidget tutorial(this); + int welcomeRes = tutorial.exec(); + g_StudioApp.handleWelcomeRes(welcomeRes, false); } //============================================================================== diff --git a/src/Authoring/Studio/MainFrm.ui b/src/Authoring/Studio/MainFrm.ui index 7d9c0aae..6e4ca810 100644 --- a/src/Authoring/Studio/MainFrm.ui +++ b/src/Authoring/Studio/MainFrm.ui @@ -45,7 +45,7 @@ Project palette using Import functionality. 0 0 1800 - 22 + 21
@@ -274,7 +274,7 @@ Project palette using Import functionality. - &Open Tutorial... + &Show Welcome Screen... diff --git a/src/Authoring/Studio/images.qrc b/src/Authoring/Studio/images.qrc index 3f2d3c5c..7e0367fb 100644 --- a/src/Authoring/Studio/images.qrc +++ b/src/Authoring/Studio/images.qrc @@ -230,10 +230,6 @@ images/client_tools_hi_color-06@2x.png images/prefstab-00@2x.png images/playback_tools_low-03@2x.png - images/Tutorial/button_back.png - images/Tutorial/button_next.png - images/Tutorial/button_back@2x.png - images/Tutorial/button_next@2x.png images/Objects-edit-disabled.png images/Objects-edit-disabled@2x.png images/Objects-edit-normal.png @@ -257,30 +253,6 @@ images/zoom_out@2x.png images/zoom_in.png images/zoom_in@2x.png - images/Tutorial/background.png - images/Tutorial/background@2x.png - images/Tutorial/dot_active.png - images/Tutorial/dot_active@2x.png - images/Tutorial/dot_inactive.png - images/Tutorial/dot_inactive@2x.png - images/Tutorial/screens/1x/1.png - images/Tutorial/screens/1x/2.png - images/Tutorial/screens/1x/3.png - images/Tutorial/screens/1x/4.png - images/Tutorial/screens/1x/5.png - images/Tutorial/screens/1x/6.png - images/Tutorial/screens/1x/7.png - images/Tutorial/screens/1x/8.png - images/Tutorial/screens/1x/9.png - images/Tutorial/screens/2x/1.png - images/Tutorial/screens/2x/2.png - images/Tutorial/screens/2x/3.png - images/Tutorial/screens/2x/4.png - images/Tutorial/screens/2x/5.png - images/Tutorial/screens/2x/6.png - images/Tutorial/screens/2x/7.png - images/Tutorial/screens/2x/8.png - images/Tutorial/screens/2x/9.png images/remote.png images/remote@2x.png images/remote-disabled.png @@ -299,6 +271,7 @@ images/qml_used@2x.png images/Toggle-HideShowControlled.png images/Toggle-HideShowControlled@2x.png + images/welcomedialog/laptop.png images/open_dialog.png diff --git a/src/Authoring/Studio/images/Tutorial/background.png b/src/Authoring/Studio/images/Tutorial/background.png deleted file mode 100644 index 374eb982..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/background.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/background@2x.png b/src/Authoring/Studio/images/Tutorial/background@2x.png deleted file mode 100644 index d6235212..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/background@2x.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/button_back.png b/src/Authoring/Studio/images/Tutorial/button_back.png deleted file mode 100644 index 8113df5b..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/button_back.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/button_back@2x.png b/src/Authoring/Studio/images/Tutorial/button_back@2x.png deleted file mode 100644 index ec6a2f13..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/button_back@2x.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/button_next.png b/src/Authoring/Studio/images/Tutorial/button_next.png deleted file mode 100644 index 857dcada..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/button_next.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/button_next@2x.png b/src/Authoring/Studio/images/Tutorial/button_next@2x.png deleted file mode 100644 index f32c4f26..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/button_next@2x.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/dot_active.png b/src/Authoring/Studio/images/Tutorial/dot_active.png deleted file mode 100644 index 009e5f85..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/dot_active.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/dot_active@2x.png b/src/Authoring/Studio/images/Tutorial/dot_active@2x.png deleted file mode 100644 index 59ab92bb..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/dot_active@2x.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/dot_inactive.png b/src/Authoring/Studio/images/Tutorial/dot_inactive.png deleted file mode 100644 index 0550db1e..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/dot_inactive.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/dot_inactive@2x.png b/src/Authoring/Studio/images/Tutorial/dot_inactive@2x.png deleted file mode 100644 index 697d1db0..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/dot_inactive@2x.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/1.png b/src/Authoring/Studio/images/Tutorial/screens/1x/1.png deleted file mode 100644 index b20c2154..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/1.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/2.png b/src/Authoring/Studio/images/Tutorial/screens/1x/2.png deleted file mode 100644 index d890a8f8..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/2.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/3.png b/src/Authoring/Studio/images/Tutorial/screens/1x/3.png deleted file mode 100644 index 41a9ea8a..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/3.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/4.png b/src/Authoring/Studio/images/Tutorial/screens/1x/4.png deleted file mode 100644 index fd43b00c..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/4.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/5.png b/src/Authoring/Studio/images/Tutorial/screens/1x/5.png deleted file mode 100644 index 8204a1bb..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/5.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/6.png b/src/Authoring/Studio/images/Tutorial/screens/1x/6.png deleted file mode 100644 index 8f878f7b..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/6.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/7.png b/src/Authoring/Studio/images/Tutorial/screens/1x/7.png deleted file mode 100644 index 39aaf6dc..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/7.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/8.png b/src/Authoring/Studio/images/Tutorial/screens/1x/8.png deleted file mode 100644 index adfbb798..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/8.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/9.png b/src/Authoring/Studio/images/Tutorial/screens/1x/9.png deleted file mode 100644 index 5a3401f0..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/1x/9.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/1.png b/src/Authoring/Studio/images/Tutorial/screens/2x/1.png deleted file mode 100644 index 1cea5bfa..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/1.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/2.png b/src/Authoring/Studio/images/Tutorial/screens/2x/2.png deleted file mode 100644 index a95f4cfd..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/2.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/3.png b/src/Authoring/Studio/images/Tutorial/screens/2x/3.png deleted file mode 100644 index d8d3cf42..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/3.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/4.png b/src/Authoring/Studio/images/Tutorial/screens/2x/4.png deleted file mode 100644 index a27debc9..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/4.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/5.png b/src/Authoring/Studio/images/Tutorial/screens/2x/5.png deleted file mode 100644 index 1723dad6..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/5.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/6.png b/src/Authoring/Studio/images/Tutorial/screens/2x/6.png deleted file mode 100644 index 4a552b84..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/6.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/7.png b/src/Authoring/Studio/images/Tutorial/screens/2x/7.png deleted file mode 100644 index 0efe714d..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/7.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/8.png b/src/Authoring/Studio/images/Tutorial/screens/2x/8.png deleted file mode 100644 index 2b97b613..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/8.png and /dev/null differ diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/9.png b/src/Authoring/Studio/images/Tutorial/screens/2x/9.png deleted file mode 100644 index a9b2317f..00000000 Binary files a/src/Authoring/Studio/images/Tutorial/screens/2x/9.png and /dev/null differ diff --git a/src/Authoring/Studio/images/welcomedialog/laptop.png b/src/Authoring/Studio/images/welcomedialog/laptop.png new file mode 100644 index 00000000..0bdeef44 Binary files /dev/null and b/src/Authoring/Studio/images/welcomedialog/laptop.png differ diff --git a/src/Authoring/Studio/style.qss b/src/Authoring/Studio/style.qss index b464bbc0..dbc1bbba 100644 --- a/src/Authoring/Studio/style.qss +++ b/src/Authoring/Studio/style.qss @@ -267,21 +267,42 @@ QHeaderView::section:hover { /* Tutorial Dialog */ QDialog#StudioTutorialWidget, QDialog#StudioTutorialWidget QWidget { - color: #ffffff; background-color: transparent; border: 0px; } +QLabel#studioTutorialName { + font-size: 52px; + color: "#00cd45"; +} + +QLabel#studioTutorialWelcome { + font-size: 52px; + color: #ffffff; +} + +QPushButton#studioTutorialOpen, +QPushButton#studioTutorialNew, +QPushButton#studioTutorialQuickStart { + font-size: 36px; + color: #ffffff; + padding: 0px 60px 0px 60px; +} + QPushButton:!pressed#studioTutorialOpen, -QPushButton:!pressed#studioTutorialNew { - background: transparent; - border: 1px solid #41cd52; +QPushButton:!pressed#studioTutorialNew, +QPushButton:!pressed#studioTutorialQuickStart { + background: "#00cd45"; + border: 3px solid "#00cd45"; + border-radius: 10px; } QPushButton:pressed#studioTutorialOpen, -QPushButton:pressed#studioTutorialNew { - background: #41cd52; - border: 1px solid #41cd52; +QPushButton:pressed#studioTutorialNew, +QPushButton:pressed#studioTutorialQuickStart { + background: transparent; + border: 3px solid "#00cd45"; + border-radius: 10px; } /* Startup Dialog */ -- cgit v1.2.3