Engine settings UX update and basic functionality
parent
d20f3d8bd4
commit
d112ae403b
@ -1,4 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="24" height="24" fill="#444444"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M13 3H11V11H3V13H11V21H13V13H21V11H13V3Z" fill="white"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 209 B |
@ -0,0 +1,16 @@
|
||||
<RCC>
|
||||
<qresource prefix="/ProjectManager/style">
|
||||
<file>ProjectManager.qss</file>
|
||||
</qresource>
|
||||
<qresource prefix="/">
|
||||
<file>Add.svg</file>
|
||||
<file>Select_Folder.svg</file>
|
||||
<file>o3de_editor.ico</file>
|
||||
<file>Windows.svg</file>
|
||||
<file>Android.svg</file>
|
||||
<file>iOS.svg</file>
|
||||
<file>Linux.svg</file>
|
||||
<file>macOS.svg</file>
|
||||
<file>Backgrounds/FirstTimeBackgroundImage.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@ -0,0 +1,73 @@
|
||||
/************** General (MainWindow) **************/
|
||||
QMainWindow {
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
|
||||
QPushButton:focus {
|
||||
outline: none;
|
||||
border:1px solid #1e70eb;
|
||||
}
|
||||
|
||||
/************** General (Forms) **************/
|
||||
|
||||
#formLineEditWidget,
|
||||
#formBrowseEditWidget {
|
||||
max-width: 780px;
|
||||
}
|
||||
|
||||
#formFrame {
|
||||
max-width: 720px;
|
||||
background-color: #444444;
|
||||
border:1px solid #dddddd;
|
||||
border-radius: 4px;
|
||||
padding: 0px 10px 2px 6px;
|
||||
margin-top:10px;
|
||||
margin-left:30px;
|
||||
}
|
||||
|
||||
#formFrame[Focus="true"] {
|
||||
border:1px solid #1e70eb;
|
||||
}
|
||||
|
||||
#formFrame[Valid="false"] {
|
||||
border:1px solid red;
|
||||
}
|
||||
|
||||
#formFrame QLabel {
|
||||
font-size: 13px;
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
#formFrame QPushButton {
|
||||
background-color: transparent;
|
||||
background:transparent url(:/Select_Folder.svg) no-repeat center;
|
||||
qproperty-flat: true;
|
||||
}
|
||||
|
||||
#formFrame QPushButton:focus {
|
||||
border:none;
|
||||
}
|
||||
|
||||
#formFrame QLineEdit {
|
||||
background-color: rgba(0,0,0,0);
|
||||
font-size: 18px;
|
||||
color: #ffffff;
|
||||
border:0;
|
||||
line-height: 30px;
|
||||
height: 1em;
|
||||
padding-top: -4px;
|
||||
}
|
||||
|
||||
#formErrorLabel {
|
||||
color: #ec3030;
|
||||
font-size: 14px;
|
||||
margin-left: 40px;
|
||||
}
|
||||
|
||||
#formTitleLabel {
|
||||
font-size:21px;
|
||||
color:#ffffff;
|
||||
margin: 10px 0 10px 30px;
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="24" height="24" fill="#444444"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.98407 4H2V6V7V19.8145H2.07539L6.02059 7.99123H19V6H11.328L9.98407 4ZM19 19.7473L22.0766 10H7.05436L3.68763 19.8329H18.973L18.9788 19.8145H19V19.7473Z" fill="white"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 321 B |
@ -1,82 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EngineSettingsClass</class>
|
||||
<widget class="QWidget" name="EngineSettingsClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>839</width>
|
||||
<height>597</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>O3DE Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Engine Version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>v1.01</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>3rd Party Software Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Restricted Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_2"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Default Gems Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_3"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Default Project Templates Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_4"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <FormBrowseEditWidget.h>
|
||||
#include <AzQtComponents/Components/StyledLineEdit.h>
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QStandardPaths>
|
||||
#include <QIcon>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
FormBrowseEditWidget::FormBrowseEditWidget(const QString& labelText, const QString& valueText, QWidget* parent)
|
||||
: FormLineEditWidget(labelText, valueText, parent)
|
||||
{
|
||||
setObjectName("formBrowseEditWidget");
|
||||
|
||||
QPushButton* browseButton = new QPushButton(this);
|
||||
connect(browseButton, &QPushButton::pressed, this, &FormBrowseEditWidget::HandleBrowseButton);
|
||||
m_frameLayout->addWidget(browseButton);
|
||||
}
|
||||
|
||||
void FormBrowseEditWidget::HandleBrowseButton()
|
||||
{
|
||||
QString defaultPath = m_lineEdit->text();
|
||||
if (defaultPath.isEmpty())
|
||||
{
|
||||
defaultPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
}
|
||||
|
||||
QString directory = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, tr("Browse"), defaultPath));
|
||||
if (!directory.isEmpty())
|
||||
{
|
||||
m_lineEdit->setText(directory);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <FormLineEditWidget.h>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class FormBrowseEditWidget
|
||||
: public FormLineEditWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormBrowseEditWidget(const QString& labelText, const QString& valueText = "", QWidget* parent = nullptr);
|
||||
~FormBrowseEditWidget() = default;
|
||||
|
||||
private slots:
|
||||
void HandleBrowseButton();
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <FormLineEditWidget.h>
|
||||
#include <AzQtComponents/Components/StyledLineEdit.h>
|
||||
#include <AzQtComponents/Components/Widgets/LineEdit.h>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QValidator>
|
||||
#include <QStyle>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
FormLineEditWidget::FormLineEditWidget(const QString& labelText, const QString& valueText, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setObjectName("formLineEditWidget");
|
||||
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout();
|
||||
mainLayout->setAlignment(Qt::AlignTop);
|
||||
{
|
||||
m_frame = new QFrame(this);
|
||||
m_frame->setObjectName("formFrame");
|
||||
|
||||
// use a horizontal box layout so buttons can be added to the right of the field
|
||||
m_frameLayout = new QHBoxLayout();
|
||||
{
|
||||
QVBoxLayout* fieldLayout = new QVBoxLayout();
|
||||
|
||||
QLabel* label = new QLabel(labelText, this);
|
||||
fieldLayout->addWidget(label);
|
||||
|
||||
m_lineEdit = new AzQtComponents::StyledLineEdit(this);
|
||||
m_lineEdit->setFlavor(AzQtComponents::StyledLineEdit::Question);
|
||||
AzQtComponents::LineEdit::setErrorIconEnabled(m_lineEdit, false);
|
||||
m_lineEdit->setText(valueText);
|
||||
|
||||
connect(m_lineEdit, &AzQtComponents::StyledLineEdit::flavorChanged, this, &FormLineEditWidget::flavorChanged);
|
||||
connect(m_lineEdit, &AzQtComponents::StyledLineEdit::onFocus, this, &FormLineEditWidget::onFocus);
|
||||
connect(m_lineEdit, &AzQtComponents::StyledLineEdit::onFocusOut, this, &FormLineEditWidget::onFocusOut);
|
||||
|
||||
m_lineEdit->setFrame(false);
|
||||
fieldLayout->addWidget(m_lineEdit);
|
||||
|
||||
m_frameLayout->addLayout(fieldLayout);
|
||||
|
||||
QWidget* emptyWidget = new QWidget(this);
|
||||
m_frameLayout->addWidget(emptyWidget);
|
||||
}
|
||||
|
||||
m_frame->setLayout(m_frameLayout);
|
||||
|
||||
mainLayout->addWidget(m_frame);
|
||||
|
||||
m_errorLabel = new QLabel(this);
|
||||
m_errorLabel->setObjectName("formErrorLabel");
|
||||
m_errorLabel->setVisible(false);
|
||||
mainLayout->addWidget(m_errorLabel);
|
||||
}
|
||||
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
|
||||
void FormLineEditWidget::setErrorLabelText(const QString& labelText)
|
||||
{
|
||||
m_errorLabel->setText(labelText);
|
||||
}
|
||||
|
||||
QLineEdit* FormLineEditWidget::lineEdit() const
|
||||
{
|
||||
return m_lineEdit;
|
||||
}
|
||||
|
||||
void FormLineEditWidget::flavorChanged()
|
||||
{
|
||||
if (m_lineEdit->flavor() == AzQtComponents::StyledLineEdit::Flavor::Invalid)
|
||||
{
|
||||
m_frame->setProperty("Valid", false);
|
||||
m_errorLabel->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->setProperty("Valid", true);
|
||||
m_errorLabel->setVisible(false);
|
||||
}
|
||||
refreshStyle();
|
||||
}
|
||||
|
||||
void FormLineEditWidget::onFocus()
|
||||
{
|
||||
m_frame->setProperty("Focus", true);
|
||||
refreshStyle();
|
||||
}
|
||||
|
||||
void FormLineEditWidget::onFocusOut()
|
||||
{
|
||||
m_frame->setProperty("Focus", false);
|
||||
refreshStyle();
|
||||
}
|
||||
|
||||
void FormLineEditWidget::refreshStyle()
|
||||
{
|
||||
// we must unpolish/polish every child after changing a property
|
||||
// or else they won't use the correct stylesheet selector
|
||||
for (auto child : findChildren<QWidget*>())
|
||||
{
|
||||
child->style()->unpolish(child);
|
||||
child->style()->polish(child);
|
||||
}
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QWidget>
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QLineEdit)
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||
QT_FORWARD_DECLARE_CLASS(QFrame)
|
||||
QT_FORWARD_DECLARE_CLASS(QHBoxLayout)
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
class StyledLineEdit;
|
||||
}
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class FormLineEditWidget
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormLineEditWidget(const QString& labelText, const QString& valueText = "", QWidget* parent = nullptr);
|
||||
~FormLineEditWidget() = default;
|
||||
|
||||
//! Set the error message for to display when invalid.
|
||||
void setErrorLabelText(const QString& labelText);
|
||||
|
||||
//! Returns a pointer to the underlying LineEdit.
|
||||
QLineEdit* lineEdit() const;
|
||||
|
||||
protected:
|
||||
QLabel* m_errorLabel = nullptr;
|
||||
QFrame* m_frame = nullptr;
|
||||
QHBoxLayout* m_frameLayout = nullptr;
|
||||
AzQtComponents::StyledLineEdit* m_lineEdit = nullptr;
|
||||
|
||||
private slots:
|
||||
void flavorChanged();
|
||||
void onFocus();
|
||||
void onFocusOut();
|
||||
|
||||
private:
|
||||
void refreshStyle();
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PathValidator.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
PathValidator::PathValidator(PathMode pathMode, QWidget* parent)
|
||||
: QValidator(parent)
|
||||
, m_pathMode(pathMode)
|
||||
{
|
||||
}
|
||||
|
||||
void PathValidator::setAllowEmpty(bool allowEmpty)
|
||||
{
|
||||
m_allowEmpty = allowEmpty;
|
||||
}
|
||||
|
||||
void PathValidator::setPathMode(PathMode pathMode)
|
||||
{
|
||||
m_pathMode = pathMode;
|
||||
}
|
||||
|
||||
QValidator::State PathValidator::validate(QString &text, int &) const
|
||||
{
|
||||
if(text.isEmpty())
|
||||
{
|
||||
return m_allowEmpty ? QValidator::Acceptable : QValidator::Intermediate;
|
||||
}
|
||||
|
||||
QFileInfo pathInfo(text);
|
||||
if(!pathInfo.dir().exists())
|
||||
{
|
||||
return QValidator::Intermediate;
|
||||
}
|
||||
|
||||
switch(m_pathMode)
|
||||
{
|
||||
case PathMode::AnyFile://acceptable, as long as it's not an directoy
|
||||
return pathInfo.isDir() ? QValidator::Intermediate : QValidator::Acceptable;
|
||||
case PathMode::ExistingFile://must be an existing file
|
||||
return pathInfo.exists() && pathInfo.isFile() ? QValidator::Acceptable : QValidator::Intermediate;
|
||||
case PathMode::ExistingFolder://must be an existing folder
|
||||
return pathInfo.exists() && pathInfo.isDir() ? QValidator::Acceptable : QValidator::Intermediate;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
return QValidator::Invalid;
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QValidator>
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QWidget)
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class PathValidator
|
||||
: public QValidator
|
||||
{
|
||||
public:
|
||||
enum class PathMode {
|
||||
ExistingFile, //!< A single, existings file. Useful for "Open file"
|
||||
ExistingFolder, //!< A single, existing directory. Useful for "Open Folder"
|
||||
AnyFile //!< A single, valid file, doesn't have to exist but the directory must. Useful for "Save File"
|
||||
};
|
||||
|
||||
explicit PathValidator(PathMode pathMode, QWidget* parent = nullptr);
|
||||
~PathValidator() = default;
|
||||
|
||||
void setAllowEmpty(bool allowEmpty);
|
||||
void setPathMode(PathMode pathMode);
|
||||
|
||||
QValidator::State validate(QString &text, int &) const override;
|
||||
|
||||
private:
|
||||
PathMode m_pathMode = PathMode::AnyFile;
|
||||
bool m_allowEmpty = false;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -1,16 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>Resources/ProjectManager.qss</file>
|
||||
<file>Resources/Add.svg</file>
|
||||
<file>Resources/Select_Folder.svg</file>
|
||||
<file>Resources/o3de_editor.ico</file>
|
||||
<file>Resources/Windows.svg</file>
|
||||
<file>Resources/Android.svg</file>
|
||||
<file>Resources/iOS.svg</file>
|
||||
<file>Resources/Linux.svg</file>
|
||||
<file>Resources/macOS.svg</file>
|
||||
<file>Resources/ArrowDownLine.svg</file>
|
||||
<file>Resources/ArrowUpLine.svg</file>
|
||||
<file>Resources/Backgrounds/FirstTimeBackgroundImage.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
Loading…
Reference in New Issue