diff --git a/Code/Sandbox/Editor/NewLevelDialog.cpp b/Code/Sandbox/Editor/NewLevelDialog.cpp index 75717462b7..2b727665cd 100644 --- a/Code/Sandbox/Editor/NewLevelDialog.cpp +++ b/Code/Sandbox/Editor/NewLevelDialog.cpp @@ -17,10 +17,7 @@ // Qt #include -#include -#include #include -#include // Editor #include "NewTerrainDialog.h" @@ -33,33 +30,11 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING // Folder in which levels are stored static const char kNewLevelDialog_LevelsFolder[] = "Levels"; -class LevelFolderValidator : public QValidator -{ -public: - LevelFolderValidator(QObject* parent) - : QValidator(parent) - { - m_parentDialog = qobject_cast(parent); - } - - QValidator::State validate([[maybe_unused]] QString& input, [[maybe_unused]] int& pos) const override - { - if (m_parentDialog->ValidateLevel()) - { - return QValidator::Acceptable; - } - - return QValidator::Intermediate; - } - -private: - CNewLevelDialog* m_parentDialog; -}; - // CNewLevelDialog dialog CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/) : QDialog(pParent) + , m_ilevelFolders(0) , m_bUpdate(false) , ui(new Ui::CNewLevelDialog) , m_initialized(false) @@ -68,70 +43,46 @@ CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/) setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowTitle(tr("New Level")); - setMaximumSize(QSize(430, 180)); + setMaximumSize(QSize(320, 280)); adjustSize(); - m_bIsResize = false; + // Default level folder is root (Levels/) + m_ilevelFolders = 0; - - ui->TITLE->setText(tr("Assign a name and location to the new level.")); - ui->STATIC1->setText(tr("Location:")); - ui->STATIC2->setText(tr("Name:")); + m_bIsResize = false; // Level name only supports ASCII characters QRegExp rx("[_a-zA-Z0-9-]+"); QValidator* validator = new QRegExpValidator(rx, this); ui->LEVEL->setValidator(validator); - validator = new LevelFolderValidator(this); - ui->LEVEL_FOLDERS->lineEdit()->setValidator(validator); - ui->LEVEL_FOLDERS->setErrorToolTip( - QString("The location must be a folder underneath the current project's %1 folder. (%2)") - .arg(kNewLevelDialog_LevelsFolder) - .arg(GetLevelsFolder())); - - ui->LEVEL_FOLDERS->setClearButtonEnabled(true); - QToolButton* clearButton = AzQtComponents::LineEdit::getClearButton(ui->LEVEL_FOLDERS->lineEdit()); - assert(clearButton); - connect(clearButton, &QToolButton::clicked, this, &CNewLevelDialog::OnClearButtonClicked); - - connect(ui->LEVEL_FOLDERS->lineEdit(), &QLineEdit::textEdited, this, &CNewLevelDialog::OnLevelNameChange); - connect(ui->LEVEL_FOLDERS, &AzQtComponents::BrowseEdit::attachedButtonTriggered, this, &CNewLevelDialog::PopupAssetPicker); - + connect(ui->LEVEL_FOLDERS, SIGNAL(activated(int)), this, SLOT(OnCbnSelendokLevelFolders())); connect(ui->LEVEL, &QLineEdit::textChanged, this, &CNewLevelDialog::OnLevelNameChange); - m_levelFolders = GetLevelsFolder(); - m_level = ""; // First of all, keyboard focus is related to widget tab order, and the default tab order is based on the order in which // widgets are constructed. Therefore, creating more widgets changes the keyboard focus. That is why setFocus() is called last. // Secondly, using singleShot() allows setFocus() slot of the QLineEdit instance to be invoked right after the event system // is ready to do so. Therefore, it is better to use singleShot() than directly call setFocus(). - QTimer::singleShot(0, ui->LEVEL, SLOT(OnStartup())); - - ReloadLevelFolder(); + QTimer::singleShot(0, ui->LEVEL, SLOT(setFocus())); } CNewLevelDialog::~CNewLevelDialog() { } -void CNewLevelDialog::OnStartup() -{ - UpdateData(false); - setFocus(); -} - void CNewLevelDialog::UpdateData(bool fromUi) { if (fromUi) { m_level = ui->LEVEL->text(); - m_levelFolders = ui->LEVEL_FOLDERS->text(); + m_levelFolders = ui->LEVEL_FOLDERS->currentText(); + m_ilevelFolders = ui->LEVEL_FOLDERS->currentIndex(); } else { ui->LEVEL->setText(m_level); - ui->LEVEL_FOLDERS->lineEdit()->setText(m_levelFolders); + ui->LEVEL_FOLDERS->setCurrentText(m_levelFolders); + ui->LEVEL_FOLDERS->setCurrentIndex(m_ilevelFolders); } } @@ -139,7 +90,7 @@ void CNewLevelDialog::UpdateData(bool fromUi) void CNewLevelDialog::OnInitDialog() { - ReloadLevelFolder(); + ReloadLevelFolders(); // Disable OK until some text is entered if (QPushButton* button = ui->buttonBox->button(QDialogButtonBox::Ok)) @@ -153,19 +104,28 @@ void CNewLevelDialog::OnInitDialog() ////////////////////////////////////////////////////////////////////////// -void CNewLevelDialog::ReloadLevelFolder() +void CNewLevelDialog::ReloadLevelFolders() { + QString levelsFolder = QString(Path::GetEditingGameDataFolder().c_str()) + "/" + kNewLevelDialog_LevelsFolder; + m_itemFolders.clear(); - ui->LEVEL_FOLDERS->lineEdit()->clear(); - ui->LEVEL_FOLDERS->setText(QString(kNewLevelDialog_LevelsFolder) + '/'); + ui->LEVEL_FOLDERS->clear(); + ui->LEVEL_FOLDERS->addItem(QString(kNewLevelDialog_LevelsFolder) + '/'); + ReloadLevelFoldersRec(levelsFolder); } -QString CNewLevelDialog::GetLevelsFolder() const +////////////////////////////////////////////////////////////////////////// +void CNewLevelDialog::ReloadLevelFoldersRec(const QString& currentFolder) { - QDir projectDir = QDir(Path::GetEditingGameDataFolder().c_str()); - QDir projectLevelsDir = QDir(QStringLiteral("%1/%2").arg(projectDir.absolutePath()).arg(kNewLevelDialog_LevelsFolder)); + QDir dir(currentFolder); - return projectLevelsDir.absolutePath(); + QFileInfoList infoList = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); + + foreach(const QFileInfo &fi, infoList) + { + m_itemFolders.push_back(fi.baseName()); + ui->LEVEL_FOLDERS->addItem(QString(kNewLevelDialog_LevelsFolder) + '/' + fi.baseName()); + } } ////////////////////////////////////////////////////////////////////////// @@ -173,47 +133,26 @@ QString CNewLevelDialog::GetLevel() const { QString output = m_level; - QDir projectLevelsDir = QDir(GetLevelsFolder()); - - if (!m_levelFolders.isEmpty()) + if (m_itemFolders.size() > 0 && m_ilevelFolders > 0) { - output = m_levelFolders + "/" + m_level; + output = m_itemFolders[m_ilevelFolders - 1] + "/" + m_level; } - QString relativePath = projectLevelsDir.relativeFilePath(output); - - return relativePath; + return output; } -bool CNewLevelDialog::ValidateLevel() +////////////////////////////////////////////////////////////////////////// +void CNewLevelDialog::OnCbnSelendokLevelFolders() { - // Check that the selected folder is in or below the project/LEVELS folder. - QDir projectLevelsDir = QDir(GetLevelsFolder()); - - QString selectedFolder = ui->LEVEL_FOLDERS->text(); - QString absolutePath = QDir::cleanPath(projectLevelsDir.absoluteFilePath(selectedFolder)); - QString relativePath = projectLevelsDir.relativeFilePath(absolutePath); - - // Prevent saving to a different drive. - if (projectLevelsDir.absolutePath()[0] != absolutePath[0]) - { - return false; - } - - if (relativePath.startsWith("..")) - { - return false; - } - - return true; + UpdateData(); } void CNewLevelDialog::OnLevelNameChange() { - UpdateData(true); + m_level = ui->LEVEL->text(); // QRegExpValidator means the string will always be valid as long as it's not empty: - const bool valid = !m_level.isEmpty() && ValidateLevel(); + const bool valid = !m_level.isEmpty(); // Use the validity to dynamically change the Ok button's enabled state if (QPushButton* button = ui->buttonBox->button(QDialogButtonBox::Ok)) @@ -222,24 +161,6 @@ void CNewLevelDialog::OnLevelNameChange() } } -void CNewLevelDialog::OnClearButtonClicked() -{ - ui->LEVEL_FOLDERS->lineEdit()->setText(GetLevelsFolder()); - UpdateData(true); - -} - -void CNewLevelDialog::PopupAssetPicker() -{ - QString newPath = QFileDialog::getExistingDirectory(nullptr, QObject::tr("Choose Destination Folder"), GetLevelsFolder()); - - if (!newPath.isEmpty()) - { - ui->LEVEL_FOLDERS->setText(newPath); - OnLevelNameChange(); - } -} - ////////////////////////////////////////////////////////////////////////// void CNewLevelDialog::IsResize(bool bIsResize) { diff --git a/Code/Sandbox/Editor/NewLevelDialog.h b/Code/Sandbox/Editor/NewLevelDialog.h index f995ebd69c..fd32c03700 100644 --- a/Code/Sandbox/Editor/NewLevelDialog.h +++ b/Code/Sandbox/Editor/NewLevelDialog.h @@ -34,7 +34,6 @@ #include -#include #include #endif @@ -51,29 +50,28 @@ public: CNewLevelDialog(QWidget* pParent = nullptr); // standard constructor ~CNewLevelDialog(); + QString GetLevel() const; void IsResize(bool bIsResize); - bool ValidateLevel(); + protected: void UpdateData(bool fromUi = true); void OnInitDialog(); - void ReloadLevelFolder(); + void ReloadLevelFolders(); + void ReloadLevelFoldersRec(const QString& currentFolder); void showEvent(QShowEvent* event); - QString GetLevelsFolder() const; - protected slots: + void OnCbnSelendokLevelFolders(); void OnLevelNameChange(); - void OnClearButtonClicked(); - void PopupAssetPicker(); - void OnStartup(); public: QString m_level; QString m_levelFolders; + int m_ilevelFolders; bool m_bIsResize; bool m_bUpdate; diff --git a/Code/Sandbox/Editor/NewLevelDialog.ui b/Code/Sandbox/Editor/NewLevelDialog.ui index 14227fbb53..053616c78d 100644 --- a/Code/Sandbox/Editor/NewLevelDialog.ui +++ b/Code/Sandbox/Editor/NewLevelDialog.ui @@ -6,133 +6,74 @@ 0 0 - 430 - 180 + 320 + 280 - - - - - Qt::Vertical - - - - 20 - 10 - - - - - - - - Assign a name and location to the new level. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + + + Level + + + + + + Name: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + LEVEL + - - - - - Qt::Vertical - - - - 20 - 20 - - - - - - - - - - border: 0px; - - - - - - Name - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - LEVEL - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 100 - 0 - - - - Location - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - LEVEL_FOLDERS - - - - - - - - 0 - 0 - - - - - - - - - - - - - Qt::Vertical - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + - - + + + + + Folder: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + LEVEL_FOLDERS + + + + + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + - - - AzQtComponents::BrowseEdit - QWidget -
AzQtComponents/Components/Widgets/BrowseEdit.h
- 1 -
-
diff --git a/Code/Sandbox/Editor/Style/Editor.qss b/Code/Sandbox/Editor/Style/Editor.qss index 2e96c73f35..726902bbd9 100644 --- a/Code/Sandbox/Editor/Style/Editor.qss +++ b/Code/Sandbox/Editor/Style/Editor.qss @@ -208,22 +208,9 @@ WelcomeScreenDialog QLabel margin: 0; } -WelcomeScreenDialog QLabel#titleLabel +WelcomeScreenDialog QLabel#currentProjectLabel { - font-size: 22px; - line-height: 32px; -} - -WelcomeScreenDialog QLabel#bodyLabel -{ - font-size: 14px; - line-height: 20px; -} - -WelcomeScreenDialog QLabel[fontStyle="sectionTitle"], QLabel#titleLabel[fontStyle="sectionTitle"], QLabel#documentationLink -{ - font-size: 16px; - line-height: 24px; + margin-top: 10px; } WelcomeScreenDialog QPushButton @@ -232,36 +219,20 @@ WelcomeScreenDialog QPushButton line-height: 16px; } -WelcomeScreenDialog QFrame#viewContainer -{ - background-color: transparent; -} - -WelcomeScreenDialog QFrame#viewContainer[articleStyle="pinned"] -{ - background: rgba(180,139,255,5%); - border: 1px solid #B48BFF; - box-shadow: 0 0 4px 0 rgba(0,0,0,50%); -} - WelcomeScreenDialog QWidget#articleViewContainerRoot { - background: #111111; + background: #444444; } -WelcomeScreenDialog QScrollArea#previewArea +WelcomeScreenDialog QWidget#levelViewFTUEContainer { - background-color: transparent; + background: #282828; } -WelcomeScreenDialog QWidget#articleViewContents -{ - background-color: transparent; -} - -WelcomeScreenDialog QFrame#imageFrame -{ - background-color: transparent; +QTableWidget#recentLevelTable::item { + background-color: rgb(64,64,64); + margin-bottom: 4px; + margin-top: 4px; } /* Particle Editor */ diff --git a/Code/Sandbox/Editor/WelcomeScreen/DefaultActiveProject.png b/Code/Sandbox/Editor/WelcomeScreen/DefaultActiveProject.png new file mode 100644 index 0000000000..89c3a7cd47 --- /dev/null +++ b/Code/Sandbox/Editor/WelcomeScreen/DefaultActiveProject.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:263e95489560dac6e5944ef3caba13e598f83ddead324b943ad7735ba015e1a9 +size 70727 diff --git a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.cpp b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.cpp index 6faf29dc8e..fa0b2d8135 100644 --- a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.cpp +++ b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.cpp @@ -15,7 +15,8 @@ #include "WelcomeScreenDialog.h" // Qt -#include +#include +#include #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include @@ -74,65 +76,39 @@ static int GetSmallestScreenHeight() WelcomeScreenDialog::WelcomeScreenDialog(QWidget* pParent) : QDialog(new WindowDecorationWrapper(WindowDecorationWrapper::OptionAutoAttach | WindowDecorationWrapper::OptionAutoTitleBarButtons, pParent), Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowTitleHint) , ui(new Ui::WelcomeScreenDialog) - , m_pRecentListModel(new QStringListModel(this)) , m_pRecentList(nullptr) { ui->setupUi(this); - // Make our welcome screen checkboxes appear as toggle switches - AzQtComponents::CheckBox::applyToggleSwitchStyle(ui->autoLoadLevel); - AzQtComponents::CheckBox::applyToggleSwitchStyle(ui->showOnStartup); + ui->recentLevelTable->setColumnCount(3); + ui->recentLevelTable->setMouseTracking(true); + ui->recentLevelTable->setContextMenuPolicy(Qt::CustomContextMenu); + ui->recentLevelTable->horizontalHeader()->hide(); + ui->recentLevelTable->verticalHeader()->hide(); + ui->recentLevelTable->setSelectionBehavior(QAbstractItemView::SelectRows); + ui->recentLevelTable->setSelectionMode(QAbstractItemView::SingleSelection); + ui->recentLevelTable->setIconSize(QSize(20, 20)); + installEventFilter(this); - ui->autoLoadLevel->setChecked(gSettings.bAutoloadLastLevelAtStartup); - ui->showOnStartup->setChecked(!gSettings.bShowDashboardAtStartup); - - ui->recentLevelList->setModel(m_pRecentListModel); - ui->recentLevelList->setMouseTracking(true); - ui->recentLevelList->setContextMenuPolicy(Qt::CustomContextMenu); - - auto currentProjectButtonMenu = new QMenu(); - - ui->currentProjectButton->setMenu(currentProjectButtonMenu); auto projectName = AZ::Utils::GetProjectName(); - ui->currentProjectButton->setText(projectName.c_str()); - ui->currentProjectButton->adjustSize(); - ui->currentProjectButton->setMinimumWidth(ui->currentProjectButton->width() + 40); + ui->currentProjectName->setText(projectName.c_str()); - ui->documentationLink->setCursor(Qt::PointingHandCursor); - ui->documentationLink->installEventFilter(this); + ui->newLevelButton->setDefault(true); - connect(ui->recentLevelList, &QWidget::customContextMenuRequested, this, &WelcomeScreenDialog::OnShowContextMenu); + // Hide these buttons until the new functionality is added + ui->gridButton->hide(); + ui->objectListButton->hide(); + ui->switchProjectButton->hide(); - connect(ui->recentLevelList, &QListView::entered, this, &WelcomeScreenDialog::OnShowToolTip); - connect(ui->recentLevelList, &QListView::clicked, this, &WelcomeScreenDialog::OnRecentLevelListItemClicked); + connect(ui->recentLevelTable, &QWidget::customContextMenuRequested, this, &WelcomeScreenDialog::OnShowContextMenu); + + connect(ui->recentLevelTable, &QTableWidget::entered, this, &WelcomeScreenDialog::OnShowToolTip); + connect(ui->recentLevelTable, &QTableWidget::clicked, this, &WelcomeScreenDialog::OnRecentLevelTableItemClicked); connect(ui->newLevelButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnNewLevelBtnClicked); + connect(ui->levelFileLabel, &QLabel::linkActivated, this, &WelcomeScreenDialog::OnNewLevelLabelClicked); connect(ui->openLevelButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnOpenLevelBtnClicked); - connect(ui->newSliceButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnNewSliceBtnClicked); - connect(ui->openSliceButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnOpenSliceBtnClicked); - - connect(ui->documentationButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnDocumentationBtnClicked); - connect(ui->showOnStartup, &QCheckBox::clicked, this, &WelcomeScreenDialog::OnShowOnStartupBtnClicked); - connect(ui->autoLoadLevel, &QCheckBox::clicked, this, &WelcomeScreenDialog::OnAutoLoadLevelBtnClicked); - - m_manifest = new News::ResourceManifest( - std::bind(&WelcomeScreenDialog::SyncSuccess, this), - std::bind(&WelcomeScreenDialog::SyncFail, this, std::placeholders::_1), - std::bind(&WelcomeScreenDialog::SyncUpdate, this, std::placeholders::_1, std::placeholders::_2)); - - m_articleViewContainer = new News::ArticleViewContainer(this, *m_manifest); - connect(m_articleViewContainer, &News::ArticleViewContainer::scrolled, - this, &WelcomeScreenDialog::previewAreaScrolled); - ui->articleViewContainerRoot->layout()->addWidget(m_articleViewContainer); - - m_manifest->Sync(); - -#ifndef ENABLE_SLICE_EDITOR - ui->newSliceButton->hide(); - ui->openSliceButton->hide(); -#endif - // Adjust the height, if need be // Do it in the constructor so that the WindowDecoratorWrapper handles it correctly int smallestHeight = GetSmallestScreenHeight(); @@ -153,16 +129,10 @@ WelcomeScreenDialog::WelcomeScreenDialog(QWidget* pParent) WelcomeScreenDialog::~WelcomeScreenDialog() { delete ui; - delete m_manifest; } void WelcomeScreenDialog::done(int result) { - if (m_waitingOnAsync) - { - m_manifest->Abort(); - } - QDialog::done(result); } @@ -173,13 +143,11 @@ const QString& WelcomeScreenDialog::GetLevelPath() bool WelcomeScreenDialog::eventFilter(QObject *watched, QEvent *event) { - if (watched == ui->documentationLink) + if (event->type() == QEvent::Show) { - if (event->type() == QEvent::MouseButtonRelease) - { - OnDocumentationBtnClicked(false); - return true; - } + ui->recentLevelTable->horizontalHeader()->resizeSection(0, ui->nameLabel->width()); + ui->recentLevelTable->horizontalHeader()->resizeSection(1, ui->modifiedLabel->width()); + ui->recentLevelTable->horizontalHeader()->resizeSection(2, ui->typeLabel->width()); } return QDialog::eventFilter(watched, event); @@ -207,7 +175,9 @@ void WelcomeScreenDialog::SetRecentFileList(RecentFileList* pList) int nCurDir = sCurDir.length(); int recentListSize = pList->GetSize(); - for (int i = 0; i < recentListSize; ++i) + int currentRow = 0; + ui->recentLevelTable->setRowCount(recentListSize); + for (int i = 0; i < recentListSize; ++i) { const QString& recentFile = pList->m_arrNames[i]; if (recentFile.endsWith(m_levelExtension)) @@ -218,7 +188,7 @@ void WelcomeScreenDialog::SetRecentFileList(RecentFileList* pList) if (sCurEntryDir.compare(sCurDir, Qt::CaseInsensitive) == 0) { QString fullPath = recentFile; - QString name = Path::GetFileName(fullPath); + const QString name = Path::GetFile(fullPath); Path::ConvertSlashToBackSlash(fullPath); fullPath = Path::ToUnixPath(fullPath.toLower()); @@ -226,18 +196,34 @@ void WelcomeScreenDialog::SetRecentFileList(RecentFileList* pList) if (fullPath.contains(gamePath)) { - m_pRecentListModel->setStringList(m_pRecentListModel->stringList() << QString(name)); + if (gSettings.prefabSystem) + { + QIcon icon; + icon.addFile(QString::fromUtf8(":/Level/level.svg"), QSize(), QIcon::Normal, QIcon::Off); + ui->recentLevelTable->setItem(currentRow, 0, new QTableWidgetItem(icon, name)); + } + else + { + ui->recentLevelTable->setItem(currentRow, 0, new QTableWidgetItem(name)); + } + QFileInfo file(recentFile); + QDateTime dateTime = file.lastModified(); + QString date = QLocale::system().toString(dateTime.date(), QLocale::ShortFormat) + " " + + QLocale::system().toString(dateTime.time(), QLocale::LongFormat); + ui->recentLevelTable->setItem(currentRow, 1, new QTableWidgetItem(date)); + ui->recentLevelTable->setItem(currentRow++, 2, new QTableWidgetItem(tr("Level"))); m_levels.push_back(std::make_pair(name, recentFile)); } } } } } + ui->recentLevelTable->setRowCount(currentRow); + ui->recentLevelTable->setMinimumHeight(currentRow * ui->recentLevelTable->verticalHeader()->defaultSectionSize()); + ui->recentLevelTable->setMaximumHeight(currentRow * ui->recentLevelTable->verticalHeader()->defaultSectionSize()); + ui->levelFileLabel->setVisible(currentRow ? false : true); - ui->recentLevelList->setCurrentIndex(QModelIndex()); - int rowSize = ui->recentLevelList->sizeHintForRow(0) + ui->recentLevelList->spacing() * 2; - ui->recentLevelList->setMinimumHeight(m_pRecentListModel->rowCount() * rowSize); - ui->recentLevelList->setMaximumHeight(m_pRecentListModel->rowCount() * rowSize); + ui->recentLevelTable->setCurrentIndex(QModelIndex()); } @@ -245,7 +231,7 @@ void WelcomeScreenDialog::RemoveLevelEntry(int index) { TNamePathPair levelPath = m_levels[index]; - m_pRecentListModel->removeRow(index); + ui->recentLevelTable->removeRow(index); m_levels.erase(m_levels.begin() + index); @@ -284,21 +270,18 @@ void WelcomeScreenDialog::OnShowToolTip(const QModelIndex& index) { const QString& fullPath = m_levels[index.row()].second; - //TEMPORARY:Begin This can be put back once the main window is in Qt - //QRect itemRect = ui->recentLevelList->visualRect(index); - QToolTip::showText(QCursor::pos(), QString("Open level: %1").arg(fullPath) /*, ui->recentLevelList, itemRect*/); - //TEMPORARY:END + QToolTip::showText(QCursor::pos(), QString("Open level: %1").arg(fullPath)); } void WelcomeScreenDialog::OnShowContextMenu(const QPoint& pos) { - QModelIndex index = ui->recentLevelList->indexAt(pos); + QModelIndex index = ui->recentLevelTable->indexAt(pos); if (index.isValid()) { - QString level = m_pRecentListModel->data(index, 0).toString(); + QString level = ui->recentLevelTable->itemAt(pos)->text(); - QPoint globalPos = ui->recentLevelList->viewport()->mapToGlobal(pos); + QPoint globalPos = ui->recentLevelTable->viewport()->mapToGlobal(pos); QMenu contextMenu; contextMenu.addAction(QString("Remove " + level + " from recent list")); @@ -310,13 +293,16 @@ void WelcomeScreenDialog::OnShowContextMenu(const QPoint& pos) } } - void WelcomeScreenDialog::OnNewLevelBtnClicked([[maybe_unused]] bool checked) { m_levelPath = "new"; accept(); } +void WelcomeScreenDialog::OnNewLevelLabelClicked([[maybe_unused]] const QString& path) +{ + OnNewLevelBtnClicked(true); +} void WelcomeScreenDialog::OnOpenLevelBtnClicked([[maybe_unused]] bool checked) { @@ -329,27 +315,7 @@ void WelcomeScreenDialog::OnOpenLevelBtnClicked([[maybe_unused]] bool checked) } } -void WelcomeScreenDialog::OnNewSliceBtnClicked([[maybe_unused]] bool checked) -{ - m_levelPath = "new slice"; - accept(); -} - -void WelcomeScreenDialog::OnOpenSliceBtnClicked(bool) -{ - QString fileName = QFileDialog::getOpenFileName(MainWindow::instance(), - tr("Open Slice"), - Path::GetEditingGameDataFolder().c_str(), - tr("Slice (*.slice)")); - - if (!fileName.isEmpty()) - { - m_levelPath = fileName; - accept(); - } -} - -void WelcomeScreenDialog::OnRecentLevelListItemClicked(const QModelIndex& modelIndex) +void WelcomeScreenDialog::OnRecentLevelTableItemClicked(const QModelIndex& modelIndex) { int index = modelIndex.row(); @@ -365,45 +331,6 @@ void WelcomeScreenDialog::OnCloseBtnClicked([[maybe_unused]] bool checked) accept(); } -void WelcomeScreenDialog::OnAutoLoadLevelBtnClicked(bool checked) -{ - gSettings.bAutoloadLastLevelAtStartup = checked; - gSettings.Save(); -} - - -void WelcomeScreenDialog::OnShowOnStartupBtnClicked(bool checked) -{ - gSettings.bShowDashboardAtStartup = !checked; - gSettings.Save(); - - if (gSettings.bShowDashboardAtStartup == false) - { - QMessageBox msgBox(AzToolsFramework::GetActiveWindow()); - msgBox.setWindowTitle(QObject::tr("Skip the Welcome dialog on startup")); - msgBox.setText(QObject::tr("You may re-enable the Welcome dialog at any time by going to Edit > Editor Settings > Global Preferences in the menu bar.")); - msgBox.exec(); - } -} - -void WelcomeScreenDialog::OnDocumentationBtnClicked([[maybe_unused]] bool checked) -{ - QString webLink = tr("https://aws.amazon.com/lumberyard/support/"); - QDesktopServices::openUrl(QUrl(webLink)); -} - -void WelcomeScreenDialog::SyncFail([[maybe_unused]] News::ErrorCode error) -{ - m_articleViewContainer->AddErrorMessage(); - m_waitingOnAsync = false; -} - -void WelcomeScreenDialog::SyncSuccess() -{ - m_articleViewContainer->PopulateArticles(); - m_waitingOnAsync = false; -} - void WelcomeScreenDialog::previewAreaScrolled() { //this should only be reported once per session diff --git a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.h b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.h index 73e9d75ea3..a3460630ac 100644 --- a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.h +++ b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.h @@ -52,13 +52,9 @@ private: Ui::WelcomeScreenDialog* ui; QString m_levelPath; - QStringListModel* m_pRecentListModel; TNameFullPathArray m_levels; RecentFileList* m_pRecentList; - News::ResourceManifest* m_manifest = nullptr; - News::ArticleViewContainer* m_articleViewContainer = nullptr; const char* m_levelExtension = nullptr; - bool m_waitingOnAsync = true; bool m_messageScrollReported = false; void RemoveLevelEntry(int index); @@ -66,19 +62,11 @@ private: void OnShowToolTip(const QModelIndex& index); void OnShowContextMenu(const QPoint& point); void OnNewLevelBtnClicked(bool checked); + void OnNewLevelLabelClicked(const QString& checked); void OnOpenLevelBtnClicked(bool checked); - void OnNewSliceBtnClicked(bool checked); - void OnOpenSliceBtnClicked(bool checked); - void OnRecentLevelListItemClicked(const QModelIndex& index); - void OnGettingStartedBtnClicked(bool checked); - void OnTutorialsBtnClicked(bool checked); - void OnDocumentationBtnClicked(bool checked); - void OnForumsBtnClicked(bool checked); - void OnAutoLoadLevelBtnClicked(bool checked); - void OnShowOnStartupBtnClicked(bool checked); + void OnRecentLevelTableItemClicked(const QModelIndex& index); void OnCloseBtnClicked(bool checked); - void SyncUpdate(const QString& /* message */, News::LogType /* logType */) {} void SyncFail(News::ErrorCode error); void SyncSuccess(); diff --git a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.qrc b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.qrc index b6fa8150c5..9e8ff62f48 100644 --- a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.qrc +++ b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.qrc @@ -1,5 +1,5 @@ - WelcomeScreenDialogHeader.png + DefaultActiveProject.png diff --git a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.ui b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.ui index be0d175a09..680b411121 100644 --- a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.ui +++ b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialog.ui @@ -2,12 +2,15 @@ WelcomeScreenDialog + + true + 0 0 - 800 - 600 + 945 + 639 @@ -18,21 +21,21 @@ - 800 - 600 + 945 + 639 - 800 - 16777215 + 945 + 639 Qt::TabFocus - Welcome to Open 3D Engine + Welcome to O3DE @@ -53,100 +56,6 @@ 0 - - - - - 0 - 36 - - - - - 16777215 - 36 - - - - - 10 - - - 16 - - - 0 - - - 12 - - - 0 - - - - - - 0 - 0 - - - - Current project: - - - - - - - Current Project Name - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 1 - - - - color: "black" - - - QFrame::Plain - - - 0 - - - Qt::Horizontal - - - @@ -165,20 +74,26 @@ 0 - + + + + 0 + 0 + + - 0 + 183 0 - 320 + 183 16777215 - + 0 @@ -191,6 +106,143 @@ 0 + + 10 + + + + + 15 + + + + + 10 + + + 0 + + + + + + 0 + 0 + + + + Active project + + + + + + + + 0 + 0 + + + + + 126 + 167 + + + + + 126 + 167 + + + + + + + :/WelcomeScreenDialog/DefaultActiveProject.png + + + Qt::AlignCenter + + + + + + + MyGame + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + 15 + + + 15 + + + + + Switch project... + + + + + + + + + + + + + 0 + 0 + + + + + 762 + 0 + + + + + 762 + 16777215 + + + + + 0 + + + 20 + + + 0 + + + 20 + 0 @@ -227,7 +279,7 @@ - Open or create a level + Recent Files -1 @@ -255,16 +307,6 @@ 0 - - - - Qt::ScrollBarAlwaysOff - - - 4 - - - @@ -310,8 +352,26 @@ + + + 0 + 0 + + + + + 156 + 0 + + + + + 156 + 16777215 + + - New level... + Create new... @@ -333,8 +393,67 @@ + + + 156 + 0 + + + + + 156 + 16777215 + + + + Open... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ... + + + + :/stylesheet/img/UI20/toolbar/Object_list.svg:/stylesheet/img/UI20/toolbar/Object_list.svg + + + + 24 + 24 + + + + + + - Open level... + ... + + + + :/stylesheet/img/UI20/toolbar/Grid.svg:/stylesheet/img/UI20/toolbar/Grid.svg + + + + 24 + 24 + @@ -358,65 +477,130 @@ - - - - 0 - 0 - + + + 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - New slice... - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 0 - - - - - - - - Open slice... - - - - - + + + + Name + + + + + + + Last modified + + + + + + + Type + + + + + + + + 16 + + + 16 + + + 16 + + + + + true + + + + 0 + 0 + + + + No level file created yet for this project. <a href="#">Create one</a> now. + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + true + + + + 0 + 0 + + + + + + + Qt::ScrollBarAlwaysOff + + + 3 + + + false + + + false + + + false + + + 1 + + + 48 + + + false + + + false + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + @@ -439,205 +623,16 @@ - - - - - 0 - 48 - - - - - 16777215 - 48 - - - - - 10 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 24 - 24 - - - - info - - - - :/stylesheet/img/UI20/Info.svg:/stylesheet/img/UI20/Info.svg - - - - - - - Documentation and tutorials - - - link - - - - - - - - - - - - - - 1 - 16777215 - - - - color: "black" - - - QFrame::Plain - - - 0 - - - Qt::Vertical - - - - - - - - 480 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 16777215 - 1 - - - - color: "black" - - - QFrame::Plain - - - 0 - - - Qt::Horizontal - - - - - - - - 0 - 36 - - - - - 16777215 - 36 - - - - - 30 - - - 16 - - - 0 - - - 16 - - - 0 - - - - - - 0 - 0 - - - - Auto-load last opened level on startup - - - - - - - - 0 - 0 - - - - Skip this dialog on startup - - - - - - + diff --git a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialogHeader.png b/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialogHeader.png deleted file mode 100644 index e2656e3dfd..0000000000 --- a/Code/Sandbox/Editor/WelcomeScreen/WelcomeScreenDialogHeader.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:53b846352880d940621b14b1ea9514e0a4c95aa6ead4d00234a98684c061c04f -size 29505