diff --git a/Code/Editor/CMakeLists.txt b/Code/Editor/CMakeLists.txt index 8a5f35fb92..5a846a267a 100644 --- a/Code/Editor/CMakeLists.txt +++ b/Code/Editor/CMakeLists.txt @@ -111,7 +111,6 @@ ly_add_target( AZ::AzCore AZ::AzToolsFramework Gem::LmbrCentral.Static - Legacy::NewsShared AZ::AWSNativeSDKInit AZ::AtomCore Gem::Atom_RPI.Edit diff --git a/Code/Editor/WelcomeScreen/WelcomeScreenDialog.cpp b/Code/Editor/WelcomeScreen/WelcomeScreenDialog.cpp index f9560aef55..49d9c58159 100644 --- a/Code/Editor/WelcomeScreen/WelcomeScreenDialog.cpp +++ b/Code/Editor/WelcomeScreen/WelcomeScreenDialog.cpp @@ -40,10 +40,6 @@ #include "CryEdit.h" #include "LevelFileDialog.h" -// NewsShared -#include // for News::ResourceManifest -#include // for News::ArticleViewContainer - AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING #include AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING diff --git a/Code/Editor/WelcomeScreen/WelcomeScreenDialog.h b/Code/Editor/WelcomeScreen/WelcomeScreenDialog.h index 4338a8250f..39c0ad6316 100644 --- a/Code/Editor/WelcomeScreen/WelcomeScreenDialog.h +++ b/Code/Editor/WelcomeScreen/WelcomeScreenDialog.h @@ -8,8 +8,6 @@ #if !defined(Q_MOC_RUN) #include -#include "NewsShared/LogType.h" -#include "NewsShared/ErrorCodes.h" #endif namespace News { @@ -62,9 +60,6 @@ private: void OnRecentLevelTableItemClicked(const QModelIndex& index); void OnCloseBtnClicked(bool checked); - void SyncFail(News::ErrorCode error); - void SyncSuccess(); - private Q_SLOTS: void previewAreaScrolled(); }; diff --git a/Code/Tools/CMakeLists.txt b/Code/Tools/CMakeLists.txt index 6c025a0543..1bab1cee77 100644 --- a/Code/Tools/CMakeLists.txt +++ b/Code/Tools/CMakeLists.txt @@ -10,7 +10,6 @@ add_subdirectory(AssetProcessor) add_subdirectory(AWSNativeSDKInit) add_subdirectory(AzTestRunner) add_subdirectory(CrashHandler) -add_subdirectory(News) add_subdirectory(PythonBindingsExample) add_subdirectory(RemoteConsole) add_subdirectory(DeltaCataloger) diff --git a/Code/Tools/News/CMakeLists.txt b/Code/Tools/News/CMakeLists.txt deleted file mode 100644 index 78c5774ef0..0000000000 --- a/Code/Tools/News/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -add_subdirectory(NewsBuilder) - -if (NOT PAL_TRAIT_BUILD_HOST_TOOLS) - return() -endif() - -ly_add_target( - NAME NewsShared STATIC - NAMESPACE Legacy - AUTOMOC - AUTOUIC - AUTORCC - FILES_CMAKE - news_shared_files.cmake - INCLUDE_DIRECTORIES - PUBLIC - . - BUILD_DEPENDENCIES - PRIVATE - 3rdParty::Qt::Core - 3rdParty::Qt::Network - 3rdParty::Qt::Widgets - AZ::AzQtComponents -) diff --git a/Code/Tools/News/NewsBuilder/CMakeLists.txt b/Code/Tools/News/NewsBuilder/CMakeLists.txt deleted file mode 100644 index 218f4e28f5..0000000000 --- a/Code/Tools/News/NewsBuilder/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) - -include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) - -if (NOT PAL_TRAIT_BUILD_NEWSBUILDER_SUPPORTED OR NOT PAL_TRAIT_BUILD_HOST_TOOLS) - return() -endif() - -ly_add_target( - NAME NewsBuilder EXECUTABLE - NAMESPACE Legacy - AUTOMOC - AUTOUIC - AUTORCC - FILES_CMAKE - news_builder_files.cmake - INCLUDE_DIRECTORIES - PUBLIC - . - BUILD_DEPENDENCIES - PRIVATE - 3rdParty::Qt::Core - 3rdParty::Qt::Widgets - 3rdParty::AWSNativeSDK::Dependencies - 3rdParty::AWSNativeSDK::Core - 3rdParty::AWSNativeSDK::S3 - Legacy::NewsShared - AZ::AzCore - AZ::AzQtComponents - AZ::AzFramework -) diff --git a/Code/Tools/News/NewsBuilder/EndpointManager.cpp b/Code/Tools/News/NewsBuilder/EndpointManager.cpp deleted file mode 100644 index 0b2ea4dd5c..0000000000 --- a/Code/Tools/News/NewsBuilder/EndpointManager.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "EndpointManager.h" -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace News -{ - - Endpoint::Endpoint(QString name, QString awsProfile, QString url, QString bucket) - : m_name(name) - , m_awsProfile(awsProfile) - , m_url(url) - , m_bucket(bucket) - {} - - Endpoint::Endpoint(const QJsonObject& json) - : Endpoint(json["name"].toString(), - json["awsProfile"].toString(), - json["url"].toString(), - json["bucket"].toString()) - { - } - - Endpoint::~Endpoint() {} - - void Endpoint::Write(QJsonObject& json) const - { - json["name"] = m_name; - json["awsProfile"] = m_awsProfile; - json["url"] = m_url; - json["bucket"] = m_bucket; - } - - QString Endpoint::GetName() const - { - return m_name; - } - - void Endpoint::SetName(const QString& name) - { - m_name = QString(name); - } - - QString Endpoint::GetAwsProfile() const - { - return m_awsProfile; - } - - void Endpoint::SetAwsProfile(const QString& awsProfile) - { - m_awsProfile = QString(awsProfile); - } - - QString Endpoint::GetUrl() const - { - return m_url; - } - - void Endpoint::SetUrl(const QString& url) - { - m_url = QString(url); - } - - QString Endpoint::GetBucket() const - { - return m_bucket; - } - - void Endpoint::SetBucket(const QString& bucket) - { - m_bucket = bucket; - } - - EndpointManager::EndpointManager() - { - Load(); - } - - EndpointManager::~EndpointManager() - { - ClearEndpoints(); - } - - void EndpointManager::Load() - { - ClearEndpoints(); - QFile file("newsBuilderConfig.txt"); - if (file.open(QIODevice::ReadOnly)) - { - QTextStream in(&file); - QString str = in.readAll().trimmed(); - QByteArray array(str.toStdString().c_str()); - QJsonDocument doc(QJsonDocument::fromJson(array)); - QJsonObject json = doc.object(); - QJsonArray endpointArray = json["endpoints"].toArray(); - for (auto endpointDoc : endpointArray) - { - m_endpoints.append(new Endpoint(endpointDoc.toObject())); - } - int endpointIndex = json["currentEndpointIndex"].toInt(); - if (endpointIndex >= 0 && m_endpoints.count() > endpointIndex) - { - m_selectedEndpoint = m_endpoints[endpointIndex]; - } - else - { - m_selectedEndpoint = nullptr; - } - file.close(); - - SaveUrl(); - } - } - - void EndpointManager::Save() - { - QFile file("newsBuilderConfig.txt"); - if (file.open(QIODevice::WriteOnly)) - { - QJsonObject json; - QJsonArray endpointArray; - for (auto endpoint : m_endpoints) - { - QJsonObject endpointObject; - endpoint->Write(endpointObject); - endpointArray.append(endpointObject); - } - json["endpoints"] = endpointArray; - json["currentEndpointIndex"] = m_endpoints.indexOf(m_selectedEndpoint); - QTextStream out(&file); - QJsonDocument doc(json); - out << doc.toJson(QJsonDocument::Compact); - file.close(); - - SaveUrl(); - } - } - - void EndpointManager::SelectEndpoint(Endpoint* endpoint) - { - m_selectedEndpoint = endpoint; - } - - void EndpointManager::AddEndpoint(Endpoint* endpoint) - { - m_endpoints.append(endpoint); - } - - void EndpointManager::RemoveEndpoint(Endpoint* endpoint) - { - if (endpoint == m_selectedEndpoint) - { - m_selectedEndpoint = nullptr; - } - m_endpoints.removeAll(endpoint); - delete endpoint; - } - - Endpoint* EndpointManager::GetSelectedEndpoint() const - { - return m_selectedEndpoint; - } - - QList::const_iterator EndpointManager::begin() const - { - return m_endpoints.begin(); - } - - QList::const_iterator EndpointManager::end() const - { - return m_endpoints.end(); - } - - void EndpointManager::ClearEndpoints() - { - for (auto endpoint : m_endpoints) - { - delete endpoint; - } - m_endpoints.clear(); - } - - void EndpointManager::SaveUrl() const - { - if (!m_selectedEndpoint) - { - return; - } - // Editor looks for config file in /dev folder, so this file is placed in parent directory - QFile file(QCoreApplication::applicationDirPath() + "/newsConfig.txt"); - if (file.open(QIODevice::WriteOnly)) - { - QTextStream out(&file); - out << m_selectedEndpoint->GetUrl(); - file.close(); - } - } - -} diff --git a/Code/Tools/News/NewsBuilder/EndpointManager.h b/Code/Tools/News/NewsBuilder/EndpointManager.h deleted file mode 100644 index cc44951d16..0000000000 --- a/Code/Tools/News/NewsBuilder/EndpointManager.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include -#include - -class QJsonObject; - -namespace News -{ - //! Endpoint represents a location of news data - class Endpoint - { - public: - Endpoint(QString name, QString awsProfile, QString url, QString bucket); - explicit Endpoint(const QJsonObject& json); - ~Endpoint(); - - void Write(QJsonObject& json) const; - - QString GetName() const; - void SetName(const QString& name); - - QString GetAwsProfile() const; - void SetAwsProfile(const QString& awsProfile); - - QString GetUrl() const; - void SetUrl(const QString& url); - - QString GetBucket() const; - void SetBucket(const QString& bucket); - - private: - //! name of endpoint to distinguish with others - QString m_name; - //! name of aws credentials file - QString m_awsProfile; - //! url location of news data (e.g. cloudfront url) - QString m_url; - //! name of s3 bucket where news data resides - QString m_bucket; - }; - - //! EndpointManager handles endpoint collection - class EndpointManager - { - public: - EndpointManager(); - ~EndpointManager(); - - //! Load endpoints file - void Load(); - //! Save endpoints file - void Save(); - void SelectEndpoint(Endpoint* endpoint); - void AddEndpoint(Endpoint* endpoint); - void RemoveEndpoint(Endpoint* endpoint); - Endpoint* GetSelectedEndpoint() const; - - QList::const_iterator begin() const; - QList::const_iterator end() const; - - private: - QList m_endpoints; - Endpoint* m_selectedEndpoint = nullptr; - - void ClearEndpoints(); - //! Saves news config file which is used by LY Editor to determine news location - void SaveUrl() const; - }; -} diff --git a/Code/Tools/News/NewsBuilder/Platform/Android/PAL_android.cmake b/Code/Tools/News/NewsBuilder/Platform/Android/PAL_android.cmake deleted file mode 100644 index 929d864fc4..0000000000 --- a/Code/Tools/News/NewsBuilder/Platform/Android/PAL_android.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(PAL_TRAIT_BUILD_NEWSBUILDER_SUPPORTED FALSE) diff --git a/Code/Tools/News/NewsBuilder/Platform/Linux/PAL_linux.cmake b/Code/Tools/News/NewsBuilder/Platform/Linux/PAL_linux.cmake deleted file mode 100644 index 929d864fc4..0000000000 --- a/Code/Tools/News/NewsBuilder/Platform/Linux/PAL_linux.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(PAL_TRAIT_BUILD_NEWSBUILDER_SUPPORTED FALSE) diff --git a/Code/Tools/News/NewsBuilder/Platform/Mac/PAL_mac.cmake b/Code/Tools/News/NewsBuilder/Platform/Mac/PAL_mac.cmake deleted file mode 100644 index 929d864fc4..0000000000 --- a/Code/Tools/News/NewsBuilder/Platform/Mac/PAL_mac.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(PAL_TRAIT_BUILD_NEWSBUILDER_SUPPORTED FALSE) diff --git a/Code/Tools/News/NewsBuilder/Platform/Windows/PAL_windows.cmake b/Code/Tools/News/NewsBuilder/Platform/Windows/PAL_windows.cmake deleted file mode 100644 index 180b7b9492..0000000000 --- a/Code/Tools/News/NewsBuilder/Platform/Windows/PAL_windows.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(PAL_TRAIT_BUILD_NEWSBUILDER_SUPPORTED TRUE) diff --git a/Code/Tools/News/NewsBuilder/Platform/iOS/PAL_ios.cmake b/Code/Tools/News/NewsBuilder/Platform/iOS/PAL_ios.cmake deleted file mode 100644 index 929d864fc4..0000000000 --- a/Code/Tools/News/NewsBuilder/Platform/iOS/PAL_ios.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(PAL_TRAIT_BUILD_NEWSBUILDER_SUPPORTED FALSE) diff --git a/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.cpp b/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.cpp deleted file mode 100644 index 2872a714e8..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ArticleDetails.h" -#include "SelectImage.h" -#include -#include "ResourceManagement/BuilderResourceManifest.h" -#include "ResourceManagement/ImageDescriptor.h" -#include "NewsShared/ErrorCodes.h" - -#include - -#include -#include -#include -#include - -#include "Qt/ui_ArticleDetails.h" - -namespace News -{ - - ArticleDetails::ArticleDetails(QWidget* parent, - Resource& resource, - BuilderResourceManifest& manifest) - : QWidget(parent) - , m_ui(new Ui::ArticleDetailsWidget) - , m_filename("") - , m_article(resource) - , m_manifest(manifest) - , m_imageIdOriginal("") - , m_imageId("") - { - m_ui->setupUi(this); - m_ui->uidLabel->setText(QString("Article: %1").arg(m_article.GetResource().GetId())); - - resizePreviewImage(); - - //! try to load image icon - auto pImageResource = m_manifest.FindById(m_article.GetImageId()); - if (pImageResource) - { - m_imageIdOriginal = pImageResource->GetId(); - SetImage(*pImageResource); - } - else - { - SetNoImage(); - } - - m_ui->titleText->setText(m_article.GetTitle()); - m_ui->descriptionText->setPlainText(m_article.GetBody()); - - connect(m_ui->fromFileButton, &QPushButton::clicked, this, &ArticleDetails::OpenImageFromFile); - connect(m_ui->fromResourceButton, &QPushButton::clicked, this, &ArticleDetails::OpenImageFromResource); - connect(m_ui->clearImageButton, &QPushButton::clicked, this, &ArticleDetails::ClearImage); - connect(m_ui->updateButton, &QPushButton::clicked, this, &ArticleDetails::UpdateArticle); - connect(m_ui->deleteButton, &QPushButton::clicked, this, &ArticleDetails::DeleteArticle); - connect(m_ui->cancelButton, &QPushButton::clicked, this, &ArticleDetails::Close); - connect(m_ui->upButton, &QPushButton::clicked, this, &ArticleDetails::MoveUp); - connect(m_ui->downButton, &QPushButton::clicked, this, &ArticleDetails::MoveDown); - } - - ArticleDetails::~ArticleDetails() {} - - void ArticleDetails::resizeEvent(QResizeEvent *event) - { - QWidget::resizeEvent(event); - resizePreviewImage(); - } - - void ArticleDetails::resizePreviewImage() - { - // Resize the imagePreview to keep the proportions - int newHeight = aznumeric_cast(m_imageRatio * width()); - m_ui->imagePreview->setFixedHeight(newHeight); - } - - ArticleDescriptor& ArticleDetails::GetArticle() - { - return m_article; - } - - QString ArticleDetails::GetId() const - { - return m_article.GetResource().GetId(); - } - - void ArticleDetails::OpenImageFromFile() - { - m_filename = QFileDialog::getOpenFileName(this, - "Open Image", ".", "Image Files (*.png *.jpg *.bmp)"); - SetImage(m_filename); - } - - void ArticleDetails::OpenImageFromResource() - { - m_pSelectImage = new SelectImage(m_manifest); - if (m_pSelectImage->exec() == QDialog::DialogCode::Accepted) - { - auto pSelectedResource = m_pSelectImage->GetSelected(); - if (!pSelectedResource) - { - QMessageBox msgBox(QMessageBox::Critical, - "Error", - "No resource pSelectedResource", - QMessageBox::Ok, - this); - msgBox.exec(); - return; - } - SetImage(*pSelectedResource); - } - delete m_pSelectImage; - } - - //! once the Update button is clicked, article resource is updated in this function - void ArticleDetails::UpdateArticle() - { - //! this flag remains false if no new changes are detected, thus avoiding unnecessary - //! re-uploading unchanged resources - bool updated = false; - - m_imageId = LoadImage(); - if (m_imageId.compare(m_imageIdOriginal) != 0) - { - m_article.SetImageId(m_imageId); - m_filename = ""; - m_imageIdOriginal = m_imageId; - m_ui->imagePathLabel->setText(QString("Image: %1").arg(m_imageId)); - updated = true; - } - - QString newTitle = m_ui->titleText->text(); - if (m_article.GetTitle().compare(newTitle)) - { - m_article.SetTitle(newTitle); - updated = true; - } - QString newBody = m_ui->descriptionText->toPlainText(); - if (m_article.GetBody().compare(newBody) != 0) - { - m_article.SetBody(newBody); - updated = true; - } - - QString newStyle = m_ui->articleStyleButtonGroup->checkedButton()->property("style").toString(); - if (m_article.GetArticleStyle() != newStyle) - { - m_article.SetArticleStyle(newStyle); - updated = true; - } - - if (updated) - { - m_article.Update(); - m_manifest.UpdateResource(&m_article.GetResource()); - emit logSignal(QString("Article %1 updated") - .arg(m_article.GetResource().GetId()), LogOk); - } - else - { - emit logSignal("Nothing to update", LogWarning); - } - emit updateArticleSignal(); - } - - //! try to load an image either from filename or from another resource, - //! update resource manifest accordingly - QString ArticleDetails::LoadImage() const - { - if (!m_filename.isEmpty()) - { - if (!m_imageIdOriginal.isEmpty()) - { - m_manifest.FreeResource(m_imageIdOriginal); - } - auto pResource = m_manifest.AddImage(m_filename); - if (pResource) - { - return pResource->GetId(); - } - return ""; - } - - if (m_imageId.compare(m_imageIdOriginal) != 0) - { - if (!m_imageIdOriginal.isEmpty()) - { - m_manifest.FreeResource(m_imageIdOriginal); - } - if (!m_imageId.isEmpty()) - { - m_manifest.UseResource(m_imageId); - } - return m_imageId; - } - - return m_imageIdOriginal; - } - - void ArticleDetails::SetImage(Resource& resource) - { - m_ui->imagePathLabel->setText(QString("Image: %1").arg(resource.GetId())); - - QPixmap pixmap; - if (pixmap.loadFromData(resource.GetData())) - { - m_ui->imagePreview->setPixmap(pixmap); - m_imageId = resource.GetId(); - } - else - { - SetNoImage(); - emit logSignal(QString("Failed to load image: %1.").arg(m_imageId)); - } - } - - void ArticleDetails::SetImage([[maybe_unused]] QString& filename) - { - m_ui->imagePathLabel->setText(QString("Image: %1").arg(m_filename)); - - QPixmap pixmap; - if (pixmap.load(m_filename)) - { - m_ui->imagePreview->setPixmap(pixmap); - } - else - { - SetNoImage(); - emit logSignal(QString("Failed to load image: %1.").arg(m_filename)); - } - } - - void ArticleDetails::SetNoImage() const - { - m_ui->imagePreview->setPixmap(QPixmap(":/images/Resources/missing-image.png")); - m_ui->imagePathLabel->setText("no image"); - } - - void ArticleDetails::ClearImage() - { - m_imageId = ""; - m_filename = ""; - SetNoImage(); - } - - void ArticleDetails::DeleteArticle() - { - if (!m_article.GetImageId().isEmpty()) - { - m_manifest.FreeResource(m_article.GetImageId()); - } - m_manifest.FreeResource(m_article.GetResource().GetId()); - emit deleteArticleSignal(); - } - - void ArticleDetails::Close() - { - emit closeArticleSignal(); - } - - void ArticleDetails::MoveUp() - { - ErrorCode error; - if (!m_manifest.UpdateArticleOrder(m_article.GetResource().GetId(), 1, error)) - { - emit logSignal(GetErrorMessage(error)); - } - else - { - emit orderChangedSignal(m_article.GetResource().GetId(), 1); - } - } - - void ArticleDetails::MoveDown() - { - ErrorCode error; - if (!m_manifest.UpdateArticleOrder(m_article.GetResource().GetId(), 0, error)) - { - emit logSignal(GetErrorMessage(error)); - } - else - { - emit orderChangedSignal(m_article.GetResource().GetId(), 0); - } - } - -#include "Qt/moc_ArticleDetails.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.h b/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.h deleted file mode 100644 index 7f8d482e3f..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - - -#if !defined(Q_MOC_RUN) -#include -#include "ResourceManagement/BuilderResourceManifest.h" - -#include -#endif - -namespace Ui -{ - class ArticleDetailsWidget; -} - -namespace News { - class SelectImage; - class ResourceManifest; - class Resource; - - //! Control that allows to modify all parameters of a single article - class ArticleDetails - : public QWidget - { - Q_OBJECT - - public: - ArticleDetails(QWidget* parent, - Resource& resource, - BuilderResourceManifest& manifest); - ~ArticleDetails(); - ArticleDescriptor& GetArticle(); - QString GetId() const; - - Q_SIGNALS: - void logSignal(QString text, LogType logType = LogInfo); - void deleteArticleSignal(); - void updateArticleSignal(); - void closeArticleSignal(); - void orderChangedSignal(QString id, bool direction); - - private: - QScopedPointer m_ui; - QString m_filename; - ArticleDescriptor m_article; - BuilderResourceManifest& m_manifest; - SelectImage* m_pSelectImage; - QString m_imageIdOriginal; - QString m_imageId; - float m_imageRatio = 184.0f / 430.0f; - - void resizeEvent(QResizeEvent *event) override; - void resizePreviewImage(); - - void OpenImageFromFile(); - void OpenImageFromResource(); - QString LoadImage() const; - void SetImage(Resource& resource); - void SetImage(QString& filename); - void SetNoImage() const; - void ClearImage(); - - void UpdateArticle(); - void DeleteArticle(); - void Close(); - void MoveUp(); - void MoveDown(); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.ui b/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.ui deleted file mode 100644 index 92970f1130..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ArticleDetails.ui +++ /dev/null @@ -1,406 +0,0 @@ - - - ArticleDetailsWidget - - - - 0 - 0 - 250 - 420 - - - - - 0 - 0 - - - - - 100 - 420 - - - - - 640 - 16777215 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 100 - 100 - - - - - 16777215 - 16777215 - - - - - - - :/images/Resources/missing-image.png - - - false - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - 100 - 100 - - - - - - - - - 16777215 - 140 - - - - - 0 - - - - - Image: - - - true - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - - 16777215 - 16777215 - - - - Clear - - - - - - - - 16777215 - 16777215 - - - - Library... - - - - - - - - 16777215 - 16777215 - - - - Load... - - - - - - - - - - - - - - - - 1280 - 1280 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 16777215 - 20 - - - - Article: 0 - - - - - - - 0 - - - 0 - - - 3 - - - 0 - - - 3 - - - - - Default Style - - - true - - - default - - - articleStyleButtonGroup - - - - - - - Pinned Style - - - pinned - - - articleStyleButtonGroup - - - - - - - - - Title: - - - - - - - true - - - - - - - - - - 0 - - - - - Description: - - - - - - - - - - 0 - - - - - 0 - - - - - Delete - - - - - - - Cancel - - - - - - - Save - - - - - - - - - 0 - - - - - - 16777215 - 16777215 - - - - Move Up - - - - - - - - 16777215 - 16777215 - - - - Move Down - - - - - - - - - - - - - - - - - AzQtComponents::ExtendedLabel - QLabel -
AzQtComponents/Components/ExtendedLabel.h
-
-
- - - - - - - -
diff --git a/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.cpp b/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.cpp deleted file mode 100644 index 586978a562..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ArticleDetailsContainer.h" -#include "ResourceManagement/BuilderResourceManifest.h" -#include "ArticleDetails.h" -#include "Qt/ui_ArticleDetailsContainer.h" - -namespace News -{ - - ArticleDetailsContainer::ArticleDetailsContainer( - QWidget* parent, - BuilderResourceManifest& manifest) - : QWidget(parent) - , m_ui(new Ui::ArticleDetailsContainerWidget) - , m_manifest(manifest) - , m_articleDetails(nullptr) - { - m_ui->setupUi(this); - } - - ArticleDetailsContainer::~ArticleDetailsContainer() {} - - //! When article is selected, old articleDetails control is removed, new one is created - void ArticleDetailsContainer::SelectArticle(const QString& id) - { - closeArticleSlot(); - - if (!id.isEmpty()) - { - auto article = m_manifest.FindById(id); - if (article) - { - m_articleDetails = new ArticleDetails( - m_ui->scrollAreaWidgetContents, - *article, - m_manifest); - m_ui->scrollAreaWidgetContents->layout()->addWidget(m_articleDetails); - connect(m_articleDetails, &ArticleDetails::updateArticleSignal, - this, &ArticleDetailsContainer::updateArticleSlot); - connect(m_articleDetails, &ArticleDetails::deleteArticleSignal, - this, &ArticleDetailsContainer::deleteArticleSlot); - connect(m_articleDetails, &ArticleDetails::closeArticleSignal, - this, &ArticleDetailsContainer::closeArticleSlot); - connect(m_articleDetails, SIGNAL(logSignal(QString, LogType)), - this, SIGNAL(logSignal(QString, LogType))); - connect(m_articleDetails, SIGNAL(orderChangedSignal(QString, bool)), - this, SIGNAL(orderChangedSignal(QString, bool))); - m_selectedId = id; - } - } - } - - void ArticleDetailsContainer::Reset() - { - SelectArticle(m_selectedId); - } - - void ArticleDetailsContainer::updateArticleSlot() - { - emit updateArticleSignal(m_articleDetails->GetId()); - } - - void ArticleDetailsContainer::deleteArticleSlot() - { - emit deleteArticleSignal(m_articleDetails->GetId()); - closeArticleSlot(); - } - - void ArticleDetailsContainer::closeArticleSlot() - { - if (m_articleDetails) - { - emit closeArticleSignal(m_selectedId); - delete m_articleDetails; - m_articleDetails = nullptr; - m_selectedId = ""; - } - } - -#include "Qt/moc_ArticleDetailsContainer.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.h b/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.h deleted file mode 100644 index 1df42198c3..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#endif - -namespace Ui -{ - class ArticleDetailsContainerWidget; -} - -namespace News -{ - class ArticleDetails; - class BuilderResourceManifest; - class SelectImage; - class ResourceManifest; - class Resource; - - //! Control that manages articleDetails control - class ArticleDetailsContainer - : public QWidget - { - Q_OBJECT - - public: - ArticleDetailsContainer(QWidget* parent, BuilderResourceManifest& manifest); - ~ArticleDetailsContainer(); - - void SelectArticle(const QString& id); - void Reset(); - -Q_SIGNALS: - void logSignal(QString text, LogType logType = LogInfo); - void updateArticleSignal(QString id); - void deleteArticleSignal(QString id); - void closeArticleSignal(QString id); - void orderChangedSignal(QString id, bool direction); - - private: - QScopedPointer m_ui; - BuilderResourceManifest& m_manifest; - ArticleDetails* m_articleDetails = nullptr; - QString m_selectedId; - - private Q_SLOTS: - void updateArticleSlot(); - void deleteArticleSlot(); - void closeArticleSlot(); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.ui b/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.ui deleted file mode 100644 index 7652fa114d..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ArticleDetailsContainer.ui +++ /dev/null @@ -1,100 +0,0 @@ - - - ArticleDetailsContainerWidget - - - - 0 - 0 - 250 - 386 - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 640 - 16777215 - - - - ArticleDetailsContainer - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Qt::ScrollBarAlwaysOff - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 248 - 384 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - diff --git a/Code/Tools/News/NewsBuilder/Qt/AwsDialog.ui b/Code/Tools/News/NewsBuilder/Qt/AwsDialog.ui deleted file mode 100644 index f58243ed8d..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/AwsDialog.ui +++ /dev/null @@ -1,102 +0,0 @@ - - - Dialog - - - - 0 - 0 - 176 - 137 - - - - - 0 - 0 - - - - Dialog - - - - - - - - - - AWS Key Id: - - - - - - - - - - - - - - AWS Secret Key: - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.cpp b/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.cpp deleted file mode 100644 index bf77a89895..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "BuilderArticleViewContainer.h" -#include "ResourceManagement/BuilderResourceManifest.h" -#include "ArticleDetails.h" -#include -#include -#include -#include "Qt/ui_BuilderArticleViewContainer.h" - -#include - -#include "QCustomMessageBox.h" - -namespace News -{ - - BuilderArticleViewContainer::BuilderArticleViewContainer( - QWidget* parent, - BuilderResourceManifest& manifest) - : QWidget(parent) - , m_ui(new Ui::BuilderArticleViewContainerWidget) - , m_container(new ArticleViewContainer(this, manifest)) - , m_manifest(manifest) - { - m_ui->setupUi(this); - - m_ui->ArticleViewContainerRoot->layout()->addWidget(m_container); - connect(m_container, SIGNAL(articleSelectedSignal(QString)), - this, SLOT(articleSelectedSlot(QString))); - } - - BuilderArticleViewContainer::~BuilderArticleViewContainer(){} - - void BuilderArticleViewContainer::AddArticle() - { - auto pArticleResource = static_cast(m_manifest).AddArticle(); - if (pArticleResource) - { - m_container->AddArticleView(ArticleDescriptor(*pArticleResource)); - SelectArticle(pArticleResource->GetId()); - } - } - - void BuilderArticleViewContainer::SelectArticle(QString id) - { - if (m_selectedArticleId.compare(id) == 0) - { - return; - } - - UnselectArticle(); - m_selectedArticleId = id; - auto article = m_container->FindById(id); - if (article) - { - m_container->ScrollToView(article); - emit articleSelectedSignal(id); - - // Add class and refresh style - AzQtComponents::Style::addClass(article, m_selectedArticleClass); - article->style()->unpolish(qApp); - article->style()->polish(qApp); - } - } - - void BuilderArticleViewContainer::Sync() - { - emit logSignal("Starting sync"); - - m_manifest.Sync(); - } - - void BuilderArticleViewContainer::UpdateArticle(QString& id) const - { - auto view = m_container->FindById(id); - if (view) - { - view->Update(); - m_container->ForceRefreshArticleView(view); - } - } - - void BuilderArticleViewContainer::DeleteArticle(QString& id) const - { - auto view = m_container->FindById(id); - if (view) - { - m_container->DeleteArticleView(view); - } - } - - //possibly support multiple selection in future? - void BuilderArticleViewContainer::CloseArticle(QString& id) - { - if (m_selectedArticleId == id) - { - UnselectArticle(); - } - } - - void BuilderArticleViewContainer::UpdateArticleOrder(QString& id, bool direction) const - { - auto view = m_container->FindById(id); - if (view) - { - m_container->UpdateArticleOrder(view, direction); - } - } - - void BuilderArticleViewContainer::PopulateArticles() - { - m_container->PopulateArticles(); - - if (!m_selectedArticleId.isEmpty()) - { - SelectArticle(m_selectedArticleId); - } - } - - void BuilderArticleViewContainer::AddErrorMessage() const - { - m_container->AddErrorMessage(); - } - - void BuilderArticleViewContainer::UnselectArticle() - { - if (m_selectedArticleId.isEmpty()) - { - return; - } - auto article = m_container->FindById(m_selectedArticleId); - - // Remove class and refresh style - if (article) - { - AzQtComponents::Style::removeClass(article, m_selectedArticleClass); - article->style()->unpolish(qApp); - article->style()->polish(qApp); - } - - m_selectedArticleId = ""; - } - - void BuilderArticleViewContainer::articleSelectedSlot(QString id) - { - SelectArticle(id); - } - -#include "Qt/moc_BuilderArticleViewContainer.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.h b/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.h deleted file mode 100644 index 94712ca768..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#endif - -namespace Ui -{ - class BuilderArticleViewContainerWidget; -} - -namespace News -{ - class ArticleViewContainer; - class BuilderResourceManifest; - - //! BuilderArticleViewContainer is a Builder container for ArticleViewContainer. - /*! - It is a wrapper with additional builder functionality for displaying articles - */ - class BuilderArticleViewContainer - : public QWidget - { - Q_OBJECT - public: - BuilderArticleViewContainer(QWidget* parent, BuilderResourceManifest& manifest); - ~BuilderArticleViewContainer(); - - void UpdateArticle(QString& id) const; - void DeleteArticle(QString& id) const; - void CloseArticle(QString& id); - void UpdateArticleOrder(QString& id, bool direction) const; - void PopulateArticles(); - void AddErrorMessage() const; - void AddArticle(); - -Q_SIGNALS: - void logSignal(QString text, LogType logType = LogInfo); - void articleSelectedSignal(QString id); - - private: - QScopedPointer m_ui; - ArticleViewContainer* m_container; - QString m_selectedArticleId; - QString m_selectedArticleClass = "SelectedArticle"; - BuilderResourceManifest& m_manifest; - - void Sync(); - void SelectArticle(QString id); - void UnselectArticle(); - - - private Q_SLOTS: - void articleSelectedSlot(QString id); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.ui b/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.ui deleted file mode 100644 index dafac9b9ff..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/BuilderArticleViewContainer.ui +++ /dev/null @@ -1,57 +0,0 @@ - - - BuilderArticleViewContainerWidget - - - - 0 - 0 - 250 - 500 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - diff --git a/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.cpp b/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.cpp deleted file mode 100644 index 5e698eea97..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "EndpointEntryView.h" -#include "Qt/ui_EndpointEntryView.h" -#include -#include - -namespace News -{ - - const char* EndpointEntryView::SELECTED_CSS = - "background-color: rgb(60, 100, 60);\ncolor: white;"; - const char* EndpointEntryView::UNSELECTED_CSS = - "background-color: rgb(60, 60, 60);\ncolor: white;"; - - EndpointEntryView::EndpointEntryView(QWidget* parent, Endpoint* pEndpoint) - : QWidget(parent) - , m_ui(new Ui::EndpointEntryViewWidget) - , m_pEndpoint(pEndpoint) - { - m_ui->setupUi(this); - - m_ui->labelName->setText(pEndpoint->GetName()); - - connect(m_ui->labelName, &AzQtComponents::ExtendedLabel::clicked, this, &EndpointEntryView::selectSlot); - connect(m_ui->buttonDelete, &QToolButton::clicked, this, &EndpointEntryView::deleteSlot); - } - - EndpointEntryView::~EndpointEntryView() {} - - void EndpointEntryView::SetSelected(bool selected) - { - setStyleSheet(selected ? SELECTED_CSS : UNSELECTED_CSS); - } - - Endpoint* EndpointEntryView::GetEndpoint() const - { - return m_pEndpoint; - } - - void EndpointEntryView::selectSlot() - { - emit selectSignal(this); - } - - void EndpointEntryView::deleteSlot() - { - emit deleteSignal(this); - } - -#include "Qt/moc_EndpointEntryView.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.h b/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.h deleted file mode 100644 index c8b014c167..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Ui -{ - class EndpointEntryViewWidget; -} - -namespace News -{ - class Endpoint; - - //! Qt widget representing a single endpoint entry - class EndpointEntryView - : public QWidget - { - Q_OBJECT - public: - EndpointEntryView(QWidget* parent, Endpoint* pEndpoint); - ~EndpointEntryView(); - - void SetSelected(bool selected); - - Endpoint* GetEndpoint() const; - - Q_SIGNALS: - void selectSignal(EndpointEntryView* pEndpointView); - void deleteSignal(EndpointEntryView* pEndpointView); - - private: - static const char* SELECTED_CSS; - static const char* UNSELECTED_CSS; - - QScopedPointer m_ui; - Endpoint* m_pEndpoint = nullptr; - - private Q_SLOTS: - void selectSlot(); - void deleteSlot(); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.ui b/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.ui deleted file mode 100644 index 309fcd5662..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/EndpointEntryView.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - EndpointEntryViewWidget - - - - 0 - 0 - 356 - 23 - - - - - 0 - 23 - - - - - 16777215 - 23 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - - 25 - 0 - - - - - 25 - 16777215 - - - - background-color: red; - - - X - - - - - - - - AzQtComponents::ExtendedLabel - QLabel -
AzQtComponents/Components/ExtendedLabel.h
-
-
- - -
diff --git a/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.cpp b/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.cpp deleted file mode 100644 index e28245b895..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "EndpointManagerView.h" -#include "EndpointManager.h" -#include "EndpointEntryView.h" -#include "Qt/ui_EndpointManagerView.h" -#include "Qt/QCustomMessageBox.h" -#include "ResourceManagement/BuilderResourceManifest.h" - -#include - -namespace News -{ - - EndpointManagerView::EndpointManagerView(QWidget* parent, - BuilderResourceManifest& manifest) - : QDialog(parent) - , m_ui(new Ui::EndpointManagerViewWidget) - , m_pManager(manifest.GetEndpointManager()) - , m_manifest(manifest) - { - m_ui->setupUi(this); - - for (auto endpoint : *m_pManager) - { - auto endpointView = AddEndpointEntry(endpoint); - if (m_pManager->GetSelectedEndpoint() == endpoint) - { - selectEndpointSlot(endpointView); - } - } - - connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - connect(m_ui->buttonAdd, &QPushButton::clicked, this, &EndpointManagerView::addEndpointSlot); - } - - EndpointManagerView::~EndpointManagerView() {} - - EndpointEntryView* EndpointManagerView::AddEndpointEntry(Endpoint* pEndpoint) - { - auto endpointView = new EndpointEntryView(m_ui->endpointListContents, pEndpoint); - auto layout = static_cast(m_ui->endpointListContents->layout()); - layout->insertWidget(layout->count() - 2, endpointView); - m_endpoints.append(endpointView); - connect(endpointView, SIGNAL(selectSignal(EndpointEntryView*)), - this, SLOT(selectEndpointSlot(EndpointEntryView*))); - connect(endpointView, SIGNAL(deleteSignal(EndpointEntryView*)), - this, SLOT(deleteEndpointSlot(EndpointEntryView*))); - // this lets us modify newly-added widget in the same function - qApp->processEvents(); - return endpointView; - } - - void EndpointManagerView::Update() const - { - if (m_pSelectedEndpoint) - { - auto pEndpoint = m_pSelectedEndpoint->GetEndpoint(); - pEndpoint->SetName(m_ui->nameText->text()); - pEndpoint->SetAwsProfile(m_ui->awsProfileText->text()); - pEndpoint->SetUrl(m_ui->urlText->text()); - pEndpoint->SetBucket(m_ui->bucketText->text()); - m_pManager->SelectEndpoint(m_pSelectedEndpoint->GetEndpoint()); - } - m_pManager->Save(); - } - - void EndpointManagerView::accept() - { - enum SyncResponse - { - Merge, ReplaceLocal, ReplaceRemote, Cancel - }; - enum YesNoResponse - { - Yes, No - }; - - QCustomMessageBox msgBox( - QCustomMessageBox::Question, - tr("Pull data from Endpoint"), - tr("You are changing an endpoint. " - "What would you like to do with the data on the current endpoint?\n\n" - "Merge - merge resources from the endpoint\n" - "Replace Local - overwrite local resources with endpoint resources\n" - "Replace Endpoint - overwrite endpoint resources with local resources\n" - "Cancel - undo endpoint selection" - ), - this); - msgBox.AddButton(tr("Merge"), Merge); - msgBox.AddButton(tr("Replace Local"), ReplaceLocal); - msgBox.AddButton(tr("Replace Endpoint"), ReplaceRemote); - msgBox.AddButton(tr("Cancel"), Cancel); - - switch (msgBox.exec()) - { - case Merge: - { - m_manifest.SetSyncType(SyncType::Merge); - m_manifest.PersistLocalResources(); - } - break; - case ReplaceLocal: - { - if (m_manifest.HasChanges()) - { - QCustomMessageBox msgBoxWarning( - QCustomMessageBox::Critical, - tr("Unsaved changes"), - tr("Local resources were modified but not published." - "Changing endpoints will cause unpublished work to be lost.\n\n" - "Would you like to proceed?"), - this); - msgBoxWarning.AddButton(tr("Yes"), Yes); - msgBoxWarning.AddButton(tr("No"), No); - if (msgBoxWarning.exec() == No) - { - return; - } - } - m_manifest.SetSyncType(SyncType::Merge); - m_manifest.Reset(); - } - break; - case ReplaceRemote: - { - QCustomMessageBox msgBoxWarning2( - QCustomMessageBox::Critical, - tr("Warning"), - tr("This operation will IRREVERSABLY replace ALL resources on ") + - m_pSelectedEndpoint->GetEndpoint()->GetName() + - tr(" endpoint with local data.\n\n" - "Are you sure you'd like to proceed?"), - this); - msgBoxWarning2.AddButton(tr("Yes"), Yes); - msgBoxWarning2.AddButton(tr("No"), No); - if (msgBoxWarning2.exec() == No) - { - return; - } - m_manifest.SetSyncType(SyncType::Overwrite); - m_manifest.PersistLocalResources(); - } - break; - case Cancel: - return; - } - - Update(); - - QDialog::accept(); - } - - void EndpointManagerView::addEndpointSlot() - { - auto pEndpoint = new Endpoint( - QObject::tr("New endpoint"), - QObject::tr("Enter AWS profile name"), - QObject::tr("Enter root URL"), - QObject::tr("Enter s3 bucket name")); - m_pManager->AddEndpoint(pEndpoint); - auto endpointView = AddEndpointEntry(pEndpoint); - selectEndpointSlot(endpointView); - } - - void EndpointManagerView::selectEndpointSlot(EndpointEntryView* pEndpointView) - { - m_pSelectedEndpoint = pEndpointView; - - for (auto view : m_endpoints) - { - view->SetSelected(view == pEndpointView); - } - - if (pEndpointView) - { - auto pEndpoint = pEndpointView->GetEndpoint(); - m_ui->nameText->setText(pEndpoint->GetName()); - m_ui->awsProfileText->setText(pEndpoint->GetAwsProfile()); - m_ui->urlText->setText(pEndpoint->GetUrl()); - m_ui->bucketText->setText(pEndpoint->GetBucket()); - } - else - { - m_ui->nameText->setText(""); - m_ui->awsProfileText->setText(""); - m_ui->urlText->setText(""); - m_ui->bucketText->setText(""); - } - } - - void EndpointManagerView::deleteEndpointSlot(EndpointEntryView* pEndpointView) - { - m_pManager->RemoveEndpoint(pEndpointView->GetEndpoint()); - m_endpoints.removeAll(pEndpointView); - - if (pEndpointView == m_pSelectedEndpoint) - { - if (m_endpoints.count() > 0) - { - selectEndpointSlot(m_endpoints[0]); - } - else - { - selectEndpointSlot(nullptr); - } - } - - delete pEndpointView; - } - - -#include "Qt/moc_EndpointManagerView.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.h b/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.h deleted file mode 100644 index c6362a06af..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Ui -{ - class EndpointManagerViewWidget; -} - -namespace News -{ - class BuilderResourceManifest; - class Endpoint; - class EndpointEntryView; - class EndpointManager; - - //! Qt dialog for managing endpoints - class EndpointManagerView - : public QDialog - { - Q_OBJECT - public: - EndpointManagerView(QWidget* parent, - BuilderResourceManifest& manifest); - ~EndpointManagerView(); - - private: - QScopedPointer m_ui; - EndpointManager* m_pManager = nullptr; - EndpointEntryView* m_pSelectedEndpoint = nullptr; - QList m_endpoints; - BuilderResourceManifest& m_manifest; - - EndpointEntryView* AddEndpointEntry(Endpoint* pEndpoint); - void Update() const; - - private Q_SLOTS: - void accept() override; - void addEndpointSlot(); - void selectEndpointSlot(EndpointEntryView* pEndpoint); - void deleteEndpointSlot(EndpointEntryView* pEndpoint); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.ui b/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.ui deleted file mode 100644 index 5295e30616..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/EndpointManagerView.ui +++ /dev/null @@ -1,224 +0,0 @@ - - - EndpointManagerViewWidget - - - - 0 - 0 - 400 - 350 - - - - - 400 - 350 - - - - - 400 - 350 - - - - Change Endpoint - - - Qt::LeftToRight - - - - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 363 - 189 - - - - - - - + - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - Name: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 250 - 0 - - - - - - - - - - - - AWS Profile Name: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 250 - 0 - - - - - - - - - - - - URL: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 250 - 0 - - - - - - - - - - - - S3 Bucket - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 250 - 0 - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - diff --git a/Code/Tools/News/NewsBuilder/Qt/ImageItem.cpp b/Code/Tools/News/NewsBuilder/Qt/ImageItem.cpp deleted file mode 100644 index 1566b8309d..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ImageItem.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ImageItem.h" -#include "NewsShared/ResourceManagement/Resource.h" - -#include "Qt/ui_ImageItem.h" - -namespace News -{ - - const char* ImageItem::SELECTED_CSS = - "border: 4px solid; border-color: white; background-color: rgb(45, 45, 45);"; - const char* ImageItem::UN_SELECTED_CSS = - "background-color: rgb(45, 45, 45);"; - - ImageItem::ImageItem(Resource& resource) - : QWidget() - , m_ui(new Ui::ImageItemWidget) - , m_resource(resource) - { - m_ui->setupUi(this); - - QPixmap pixmap; - pixmap.loadFromData(m_resource.GetData()); - m_ui->ImageLabel->setPixmap(pixmap); - - connect(m_ui->ImageLabel, &AzQtComponents::ExtendedLabel::clicked, this, &ImageItem::imageClickedSlot); - } - - void ImageItem::imageClickedSlot() - { - emit selectSignal(this); - } - - ImageItem::~ImageItem() {} - - void ImageItem::SetSelect(bool selected) const - { - m_ui->ImageLabel->setStyleSheet(selected ? SELECTED_CSS : UN_SELECTED_CSS); - } - - Resource& ImageItem::GetResource() const - { - return m_resource; - } - -#include "Qt/moc_ImageItem.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/ImageItem.h b/Code/Tools/News/NewsBuilder/Qt/ImageItem.h deleted file mode 100644 index ba883bc736..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ImageItem.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Ui -{ - class ImageItemWidget; -} - -namespace News { - class Resource; - - //! A clickable image in selectImage control - class ImageItem - : public QWidget - { - Q_OBJECT - public: - explicit ImageItem(Resource& resource); - ~ImageItem(); - - void SetSelect(bool selected) const; - Resource& GetResource() const; - - Q_SIGNALS: - void selectSignal(ImageItem* imageItem); - - private: - QScopedPointer m_ui; - const static char* SELECTED_CSS; - const static char* UN_SELECTED_CSS; - - Resource& m_resource; - private Q_SLOTS: - void imageClickedSlot(); - }; -} diff --git a/Code/Tools/News/NewsBuilder/Qt/ImageItem.ui b/Code/Tools/News/NewsBuilder/Qt/ImageItem.ui deleted file mode 100644 index 9aef880c10..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/ImageItem.ui +++ /dev/null @@ -1,65 +0,0 @@ - - - ImageItemWidget - - - - 0 - 0 - 200 - 200 - - - - - 200 - 200 - - - - - 200 - 200 - - - - Form - - - - 20 - - - 20 - - - 20 - - - 20 - - - - - - - - - 160 - 90 - - - - - - - - - AzQtComponents::ExtendedLabel1 - QLabel -
AzQtComponents/Components/ExtendedLabel.h
-
-
- - -
diff --git a/Code/Tools/News/NewsBuilder/Qt/LogContainer.cpp b/Code/Tools/News/NewsBuilder/Qt/LogContainer.cpp deleted file mode 100644 index 5efda641db..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/LogContainer.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "LogContainer.h" - -#include "Qt/ui_LogContainer.h" - -namespace News -{ - - LogContainer::LogContainer(QWidget* parent) - : QWidget(parent) - , m_ui(new Ui::LogContainerWidget) - { - m_ui->setupUi(this); - } - - LogContainer::~LogContainer() {} - - void LogContainer::AddLog(QString text, LogType logType) const { - QString color; - switch (logType) - { - case LogOk: - color = "green"; - break; - case LogInfo: - color = "white"; - break; - case LogError: - color = "red"; - break; - case LogWarning: - color = "yellow"; - break; - default: - color = "white"; - break; - } - auto fullText = QString("%2
").arg(color).arg(text); - m_ui->logText->setTextFormat(Qt::RichText); - m_ui->logText->setText(QString("%2%1").arg(m_ui->logText->text()).arg(fullText)); - } - -#include "Qt/moc_LogContainer.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/LogContainer.h b/Code/Tools/News/NewsBuilder/Qt/LogContainer.h deleted file mode 100644 index 8f46f3b406..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/LogContainer.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#endif - -namespace Ui -{ - class LogContainerWidget; -} - -namespace News -{ - //! A control for displaying log - class LogContainer - : public QWidget - { - Q_OBJECT - - public: - explicit LogContainer(QWidget* parent); - ~LogContainer(); - - void AddLog(QString text, LogType logType) const; - - private: - QScopedPointer m_ui; - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/LogContainer.ui b/Code/Tools/News/NewsBuilder/Qt/LogContainer.ui deleted file mode 100644 index 3757f52480..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/LogContainer.ui +++ /dev/null @@ -1,131 +0,0 @@ - - - LogContainerWidget - - - - 0 - 0 - 547 - 125 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - LogContainer - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - true - - - - - 0 - 0 - 545 - 123 - - - - - 0 - 0 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - background-color: rgb(45, 45, 45); - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - false - - - Qt::TextBrowserInteraction - - - - - - - - - - - - diff --git a/Code/Tools/News/NewsBuilder/Qt/NewsBuilder.cpp b/Code/Tools/News/NewsBuilder/Qt/NewsBuilder.cpp deleted file mode 100644 index 5cbb510dd6..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/NewsBuilder.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include "NewsBuilder.h" -#include "Qt/ArticleDetails.h" -#include "Qt/BuilderArticleViewContainer.h" -#include "NewsShared/Qt/ArticleViewContainer.h" -#include "NewsShared/ResourceManagement/Resource.h" -#include "ResourceManagement/BuilderResourceManifest.h" -#include "ArticleDetailsContainer.h" -#include "LogContainer.h" -#include "EndpointManagerView.h" -#include "EndpointManager.h" -#include "Qt/QCustomMessageBox.h" - -#include -#include - -AZ_PUSH_DISABLE_WARNING(4251 4996, "-Wunknown-warning-option") -#include -AZ_POP_DISABLE_WARNING - -#include -#include -#include -#include - -#include "Qt/ui_Newsbuilder.h" - -namespace News -{ - NewsBuilder::NewsBuilder(QWidget* parent, const AZ::IO::PathView& engineRootPath) - : QMainWindow(parent) - , m_ui(new Ui::NewsBuilderClass()) - , m_manifest(new BuilderResourceManifest( - std::bind(&NewsBuilder::SyncSuccess, this), - std::bind(&NewsBuilder::SyncFail, this, std::placeholders::_1), - std::bind(&NewsBuilder::SyncUpdate, this, std::placeholders::_1, std::placeholders::_2))) - , m_articleDetailsContainer(new ArticleDetailsContainer(this, *m_manifest)) - , m_articleViewContainer(new BuilderArticleViewContainer(this, *m_manifest)) - , m_logContainer(new LogContainer(this)) - { - - AzQtComponents::StyleManager* m_styleSheet = new AzQtComponents::StyleManager(this); - m_styleSheet->initialize(qApp, engineRootPath); - - m_ui->setupUi(this); - - QDir rootDir = QString::fromUtf8(engineRootPath.Native().data(), aznumeric_cast(engineRootPath.Native().size())); - const auto pathOnDisk = rootDir.absoluteFilePath("Code/Tools/News/NewsBuilder/Resources"); - const auto qrcPath = QStringLiteral(":/NewsBuilder"); - AzQtComponents::StyleManager::addSearchPaths("newsbuilder", pathOnDisk, qrcPath, engineRootPath); - - AzQtComponents::StyleManager::setStyleSheet(this, QStringLiteral("newsbuilder:NewsBuilder.qss")); - - UpdateEndpointLabel(); - - m_ui->articleViewContainerRoot->layout()->addWidget(m_articleViewContainer); - m_ui->articleDetailsContainerRoot->layout()->addWidget(m_articleDetailsContainer); - m_ui->dockWidgetContents->layout()->addWidget(m_logContainer); - - connect(m_articleViewContainer, SIGNAL(articleSelectedSignal(QString)), - this, SLOT(selectArticleSlot(QString))); - connect(m_articleViewContainer, SIGNAL(logSignal(QString, LogType)), - this, SLOT(addLogSlot(QString, LogType))); - - connect(m_articleDetailsContainer, &ArticleDetailsContainer::updateArticleSignal, - this, &NewsBuilder::updateArticleSlot); - connect(m_articleDetailsContainer, &ArticleDetailsContainer::deleteArticleSignal, - this, &NewsBuilder::deleteArticleSlot); - connect(m_articleDetailsContainer, &ArticleDetailsContainer::orderChangedSignal, - this, &NewsBuilder::orderChangedSlot); - connect(m_articleDetailsContainer, &ArticleDetailsContainer::closeArticleSignal, - this, &NewsBuilder::closeArticleSlot); - connect(m_articleDetailsContainer, SIGNAL(logSignal(QString, LogType)), - this, SLOT(addLogSlot(QString, LogType))); - - m_manifest->SetSyncType(SyncType::Merge); - m_manifest->Sync(); - - // Sync Console pane with View menu - connect(m_ui->actionConsole, &QAction::triggered, this, &NewsBuilder::OnViewLogWindow); - connect(m_ui->dockWidget, &QDockWidget::visibilityChanged, this, &NewsBuilder::OnViewVisibilityChanged); - } - - NewsBuilder::~NewsBuilder() {} - - void NewsBuilder::selectArticleSlot(const QString& id) const - { - m_articleDetailsContainer->SelectArticle(id); - } - - void NewsBuilder::addLogSlot(QString text, LogType logType) const - { - AddLog(text, logType); - } - - void NewsBuilder::addArticleToBottomSlot() const - { - m_articleViewContainer->AddArticle(); - } - - void NewsBuilder::updateArticleSlot(QString id) const - { - m_articleViewContainer->UpdateArticle(id); - } - - void NewsBuilder::deleteArticleSlot(QString id) const - { - m_articleViewContainer->DeleteArticle(id); - } - - void NewsBuilder::closeArticleSlot(QString id) const - { - m_articleViewContainer->CloseArticle(id); - } - - void NewsBuilder::orderChangedSlot(QString id, bool direction) const - { - m_articleViewContainer->UpdateArticleOrder(id, direction); - } - - void NewsBuilder::openSlot() - { - EndpointManagerView endpointManagerView( - m_ui->centralWidget, - *m_manifest); - if (endpointManagerView.exec() == QDialog::Accepted) - { - m_manifest->Sync(); - } - UpdateEndpointLabel(); - } - - void NewsBuilder::publishSlot() - { - if (!m_manifest->HasChanges()) - { - QCustomMessageBox msgBox( - QCustomMessageBox::Information, - tr("Nothing to publish"), - tr("No local changes were made, nothing to publish."), - this); - msgBox.AddButton(tr("Good"), 0); - msgBox.exec(); - return; - } - - enum Response - { - Yes, No - }; - - QCustomMessageBox msgBox( - QCustomMessageBox::Critical, - tr("Publish resources"), - tr("You are about to overwrite the current Open 3D Engine Welcome Message. Are you sure you want to publish?"), - this); - msgBox.AddButton("Yes", Yes); - msgBox.AddButton("No", No); - if (msgBox.exec() == Yes) - { - m_manifest->SetSyncType(SyncType::Verify); - m_manifest->Sync(); - } - } - - void NewsBuilder::OnViewVisibilityChanged([[maybe_unused]] bool visibility) - { - UpdateViewMenu(); - } - - void NewsBuilder::UpdateViewMenu() - { - if (m_ui->actionConsole->isChecked() != m_ui->dockWidget->isVisible()) - { - QSignalBlocker signalBlocker(m_ui->actionConsole); - m_ui->actionConsole->setChecked(m_ui->dockWidget->isVisible()); - } - } - - void NewsBuilder::OnViewLogWindow() - { - if (m_ui->dockWidget) - { - m_ui->dockWidget->toggleViewAction()->trigger(); - } - } - - void NewsBuilder::UpdateEndpointLabel() - { - auto pEndpoint = m_manifest->GetEndpointManager()->GetSelectedEndpoint(); - if (pEndpoint) - { - this->setWindowTitle("News Builder (" + pEndpoint->GetName() + ")"); - } - else - { - this->setWindowTitle("News Builder (No endpoint selected)"); - } - } - - void NewsBuilder::AddLog(QString text, LogType logType) const - { - m_logContainer->AddLog(text, logType); - } - - void NewsBuilder::SyncUpdate(const QString& message, LogType logType) const - { - AddLog(message, logType); - } - - void NewsBuilder::SyncFail(ErrorCode error) - { - const char* errorMessage = GetErrorMessage(error); - AddLog(tr("Sync failed: %1").arg(errorMessage), LogError); - QCustomMessageBox msgBoxSyncFail( - QCustomMessageBox::Critical, - tr("Sync failed"), - errorMessage, - this); - msgBoxSyncFail.AddButton("Ok", 0); - msgBoxSyncFail.exec(); - - m_articleViewContainer->PopulateArticles(); - m_articleDetailsContainer->Reset(); - } - - void NewsBuilder::SyncSuccess() const - { - AddLog("Sync completed", LogOk); - m_articleViewContainer->PopulateArticles(); - m_articleDetailsContainer->Reset(); - } -#include "Qt/moc_NewsBuilder.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/NewsBuilder.h b/Code/Tools/News/NewsBuilder/Qt/NewsBuilder.h deleted file mode 100644 index 61e25bda1b..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/NewsBuilder.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include - -#include "NewsShared/LogType.h" -#include "NewsShared/ErrorCodes.h" - -#include -#endif - -class QSignalMapper; -class QPushButton; - -namespace Ui -{ - class NewsBuilderClass; -} - -namespace News -{ - class BuilderArticleViewContainer; - class LogContainer; - class BuilderResourceManifest; - class ArticleDetailsContainer; - - //! A central control of News Builder. - class NewsBuilder - : public QMainWindow - { - Q_OBJECT - - public: - explicit NewsBuilder(QWidget* parent, const AZ::IO::PathView& engineRootPath); - ~NewsBuilder(); - - private: - QScopedPointer m_ui; - BuilderResourceManifest* m_manifest = nullptr; - ArticleDetailsContainer* m_articleDetailsContainer = nullptr; - BuilderArticleViewContainer* m_articleViewContainer = nullptr; - LogContainer* m_logContainer = nullptr; - - void UpdateEndpointLabel(); - void AddLog(QString text, LogType logType = LogInfo) const; - - void SyncUpdate(const QString& message, LogType logType) const; - void SyncFail(ErrorCode error); - void SyncSuccess() const; - - void OnViewVisibilityChanged(bool visibility); - void UpdateViewMenu(); - void OnViewLogWindow(); - - private Q_SLOTS: - void selectArticleSlot(const QString& id) const; - void addLogSlot(QString text, LogType logType) const; - void addArticleToBottomSlot() const; - void updateArticleSlot(QString id) const; - void deleteArticleSlot(QString id) const; - void closeArticleSlot(QString id) const; - void orderChangedSlot(QString id, bool direction) const; - void openSlot(); - void publishSlot(); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/Newsbuilder.qrc b/Code/Tools/News/NewsBuilder/Qt/Newsbuilder.qrc deleted file mode 100644 index 768281fb12..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/Newsbuilder.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - ../Resources/missing-image.png - - diff --git a/Code/Tools/News/NewsBuilder/Qt/Newsbuilder.ui b/Code/Tools/News/NewsBuilder/Qt/Newsbuilder.ui deleted file mode 100644 index 55e7fe5b68..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/Newsbuilder.ui +++ /dev/null @@ -1,326 +0,0 @@ - - - NewsBuilderClass - - - - 0 - 0 - 800 - 540 - - - - - 0 - 480 - - - - - 1024 - 16777215 - - - - News Builder - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 800 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 480 - 0 - - - - - 16777215 - 16777215 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - - - - - - - - 0 - 0 - 800 - 21 - - - - - File - - - - - - - Article - - - - - - View - - - - - - - - - - - 0 - 0 - - - - - 63 - 66 - - - - QDockWidget::DockWidgetClosable - - - Qt::BottomDockWidgetArea - - - Console - - - 8 - - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - Change Endpoint - - - false - - - - - Publish Resources - - - false - - - - - Add to Bottom - - - - - Delete Selected - - - - - true - - - Console - - - - - - - AzQtComponents::StyledDockWidget - QDockWidget -
AzQtComponents/Components/StyledDockWidget.h
- 1 -
-
- - - - - - actionOpen - triggered() - NewsBuilderClass - openSlot() - - - -1 - -1 - - - 399 - 269 - - - - - actionPublish - triggered() - NewsBuilderClass - publishSlot() - - - -1 - -1 - - - 399 - 269 - - - - - actionAdd_New - triggered() - NewsBuilderClass - addArticleToBottomSlot() - - - -1 - -1 - - - 399 - 269 - - - - -
diff --git a/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.cpp b/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.cpp deleted file mode 100644 index 1b92f91e42..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "QCustomMessageBox.h" -#include "Qt/ui_QCustomMessageBox.h" - -#include -#include -#include - -namespace News -{ - - QCustomMessageBox::QCustomMessageBox( - Icon icon, - const QString& title, - const QString& text, - QWidget* parent) - : QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint) - , m_ui(new Ui::CustomMessageBoxDialog) - { - m_ui->setupUi(this); - - m_signalMapper = new QSignalMapper(this); - - this->setWindowTitle(title); - m_ui->labelText->setText(text); - - QStyle* style = QApplication::style(); - QIcon tmpIcon; - switch (icon) - { - case Information: - tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation); - break; - case Warning: - tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning); - break; - case Critical: - tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical); - break; - case Question: - tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion); - default: - break; - } - if (!tmpIcon.isNull()) - { - QLabel* iconLabel = new QLabel(this); - iconLabel->setPixmap(tmpIcon.pixmap(64, 64)); - m_ui->bodyLayout->insertWidget(0, iconLabel); - } - - connect(m_signalMapper, SIGNAL(mapped(int)), - this, SLOT(clickedSlot(int))); - } - - QCustomMessageBox::~QCustomMessageBox() - { - delete m_signalMapper; - } - - void QCustomMessageBox::AddButton(const QString& name, int result) - { - auto button = new QPushButton(name, this); - connect(button, SIGNAL(clicked()), m_signalMapper, SLOT(map())); - m_signalMapper->setMapping(button, result); - m_ui->buttonLayout->layout()->addWidget(button); - } - - void QCustomMessageBox::clickedSlot(int result) - { - done(result); - } - -#include "Qt/moc_QCustomMessageBox.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.h b/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.h deleted file mode 100644 index 6cd6771514..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -class QSignalMapper; - -namespace Ui -{ - class CustomMessageBoxDialog; -} - -namespace News -{ - class ArticleDetails; - class BuilderResourceManifest; - class SelectImage; - class ResourceManifest; - class Resource; - - //! Allows to add custom buttons which is not well-supported by default QMessageBox - class QCustomMessageBox - : public QDialog - { - Q_OBJECT - - public: - enum Icon { - NoIcon = 0, - Information = 1, - Warning = 2, - Critical = 3, - Question = 4 - }; - - QCustomMessageBox( - Icon, - const QString& title, - const QString& text, - QWidget* parent); - ~QCustomMessageBox(); - - void AddButton(const QString& name, int result); - - private: - QScopedPointer m_ui; - QSignalMapper* m_signalMapper = nullptr; - - private Q_SLOTS: - void clickedSlot(int result); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.ui b/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.ui deleted file mode 100644 index c1fb5f40bf..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/QCustomMessageBox.ui +++ /dev/null @@ -1,84 +0,0 @@ - - - CustomMessageBoxDialog - - - - 0 - 0 - 102 - 43 - - - - - 0 - 0 - - - - Message Title - - - - - - - - - - - Message text - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - 0 - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - 10 - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - - - - diff --git a/Code/Tools/News/NewsBuilder/Qt/SelectImage.cpp b/Code/Tools/News/NewsBuilder/Qt/SelectImage.cpp deleted file mode 100644 index 7a9e427f4b..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/SelectImage.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "SelectImage.h" -#include "ImageItem.h" -#include "NewsShared/ResourceManagement/Resource.h" -#include "ResourceManagement/BuilderResourceManifest.h" - -#include "Qt/ui_SelectImage.h" - -namespace News -{ - - const int SelectImage::MAX_COLS = 2; - - SelectImage::SelectImage(const ResourceManifest& manifest) - : QDialog() - , m_ui(new Ui::SelectImageDialog) - , m_manifest(manifest) - { - m_ui->setupUi(this); - - auto layout = static_cast(m_ui->scrollAreaContents->layout()); - layout->setAlignment(Qt::AlignTop | Qt::AlignLeft); - int row = 0; - int col = 0; - //! read all image resources and populate the container - for (auto pResource : m_manifest) - { - if (pResource->GetType().compare("image") == 0) - { - auto imageItem = new ImageItem(*pResource); - connect(imageItem, &ImageItem::selectSignal, this, &SelectImage::ImageSelected); - layout->addWidget(imageItem, row, col, Qt::AlignLeft); - m_images.append(imageItem); - col++; - if (col >= MAX_COLS) - { - col = 0; - row++; - } - } - } - - connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - } - - SelectImage::~SelectImage() {} - - Resource* SelectImage::GetSelected() const - { - return m_pSelected; - } - - void SelectImage::ImageSelected(ImageItem* imageItem) - { - for (auto image : m_images) - { - image->SetSelect(image == imageItem); - } - if (imageItem) - { - m_pSelected = &imageItem->GetResource(); - } - } - -#include "Qt/moc_SelectImage.cpp" - -} diff --git a/Code/Tools/News/NewsBuilder/Qt/SelectImage.h b/Code/Tools/News/NewsBuilder/Qt/SelectImage.h deleted file mode 100644 index 5fc80cfe5a..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/SelectImage.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Ui -{ - class SelectImageDialog; -} - -namespace News { - class ImageItem; - class Resource; - class ResourceManifest; - - //! Allows to select existing images for multiple messages without re-uploading same one - class SelectImage - : public QDialog - { - Q_OBJECT - public: - explicit SelectImage(const ResourceManifest& manifest); - ~SelectImage(); - - void Select(); - void Close(); - Resource* GetSelected() const; - - private: - const static int MAX_COLS; - QScopedPointer m_ui; - const ResourceManifest& m_manifest; - QList m_images; - Resource* m_pSelected = nullptr; - - void ImageSelected(ImageItem* imageItem); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/Qt/SelectImage.ui b/Code/Tools/News/NewsBuilder/Qt/SelectImage.ui deleted file mode 100644 index 55b27bfb7f..0000000000 --- a/Code/Tools/News/NewsBuilder/Qt/SelectImage.ui +++ /dev/null @@ -1,106 +0,0 @@ - - - SelectImageDialog - - - Qt::ApplicationModal - - - - 0 - 0 - 439 - 406 - - - - Select Image - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::LeftToRight - - - Qt::ScrollBarAlwaysOff - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 437 - 379 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 2 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - diff --git a/Code/Tools/News/NewsBuilder/ResourceManagement/BuilderResourceManifest.cpp b/Code/Tools/News/NewsBuilder/ResourceManagement/BuilderResourceManifest.cpp deleted file mode 100644 index 0a845216fe..0000000000 --- a/Code/Tools/News/NewsBuilder/ResourceManagement/BuilderResourceManifest.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "BuilderResourceManifest.h" -#include "NewsShared/ResourceManagement/QtDownloadManager.h" -#include "NewsBuilder/S3Connector.h" -#include "UidGenerator.h" -#include "NewsShared/ResourceManagement/Resource.h" -#include "NewsBuilder/ResourceManagement/UploadDescriptor.h" -#include "NewsBuilder/ResourceManagement/DeleteDescriptor.h" -#include "NewsShared/ResourceManagement/ArticleDescriptor.h" -#include "NewsBuilder/ResourceManagement/ImageDescriptor.h" -#include "EndpointManager.h" - -#include -#include - -#include -#include - -namespace News { - - BuilderResourceManifest::BuilderResourceManifest( - std::function syncSuccessCallback, - std::function syncFailCallback, - std::function syncUpdateCallback) - : ResourceManifest(syncSuccessCallback, syncFailCallback, syncUpdateCallback) - , m_s3Connector(new S3Connector) - , m_uidGenerator(new UidGenerator) - , m_endpointManager(new EndpointManager) {} - - - Resource* BuilderResourceManifest::AddArticle() - { - auto pResource = new Resource( - QString("%1").arg(m_uidGenerator->GenerateUid()), - "article"); - QJsonObject json; - json["title"] = "New Article"; - json["body"] = "Enter article body here"; - json["imageId"] = "0"; - QJsonDocument doc(json); - QByteArray data = doc.toJson(QJsonDocument::Compact).toStdString().data(); - pResource->SetData(data); - m_toUpload.push(pResource); - AppendResource(pResource); - m_order.append(pResource->GetId()); - return pResource; - } - - Resource* BuilderResourceManifest::AddImage(const QString& filename) - { - auto pResource = new Resource( - QString("%1").arg(m_uidGenerator->GenerateUid()), - "image"); - ImageDescriptor descriptor(*pResource); - QString error; - if (!descriptor.Read(filename, error)) - { - m_syncUpdateCallback(error, LogError); - delete pResource; - return nullptr; - } - m_toUpload.push(pResource); - AppendResource(pResource); - return pResource; - } - - void BuilderResourceManifest::UpdateResource(Resource* pResource) - { - if (!m_toUpload.contains(pResource)) - { - pResource->SetVersion(pResource->GetVersion() + 1); - m_toUpload.push(pResource); - } - } - - void BuilderResourceManifest::UseResource(const QString& id) - { - auto pResource = FindById(id, m_resources); - if (!pResource) - { - return; - } - pResource->SetRefCount(pResource->GetRefCount() + 1); - UpdateResource(pResource); - } - - void BuilderResourceManifest::FreeResource(const QString& id) - { - auto pResource = FindById(id, m_resources); - if (!pResource) - { - return; - } - if (m_toDelete.contains(pResource)) - { - return; - } - pResource->SetRefCount(pResource->GetRefCount() - 1); - if (pResource->GetRefCount() <= 0) - { - m_toDelete.push(pResource); - RemoveResource(pResource); - m_toUpload.removeAll(pResource); - - if (pResource->GetType().compare("article") == 0) - { - m_order.removeAll(pResource->GetId()); - } - } - else - { - m_toUpload.push(pResource); - } - } - - bool BuilderResourceManifest::UpdateArticleOrder(const QString& id, bool direction, ErrorCode& error) - { - int index = m_order.indexOf(id); - if (index == -1) - { - m_syncUpdateCallback(QString("Couldn't find article: %1").arg(id), LogError); - error = ErrorCode::MissingArticle; - return false; - } - m_order.removeAll(id); - - index = index + (direction ? -1 : 1); - if (index < 0) - { - index = 0; - } - if (index > m_order.count()) - { - index = m_order.count(); - } - m_order.insert(index, id); - return true; - } - - EndpointManager* BuilderResourceManifest::GetEndpointManager() const - { - return m_endpointManager; - } - - void BuilderResourceManifest::Sync() - { - if (!m_endpointManager->GetSelectedEndpoint()) - { - FailSync(ErrorCode::NoEndpoint); - return; - } - if (!InitS3Connector()) - { - FailSync(ErrorCode::S3Fail); - return; - } - ResourceManifest::Sync(); - } - - void BuilderResourceManifest::Reset() - { - if (s_syncing) - { - m_syncUpdateCallback("Sync is already running", LogError); - return; - } - - m_toUpload.clear(); - - for (auto pResource : m_toDelete) - { - delete pResource; - } - m_toDelete.clear(); - - m_uidGenerator->Clear(); - - ResourceManifest::Reset(); - } - - void BuilderResourceManifest::PersistLocalResources() - { - // we are switching to another manifest here, while having the local data still present - // so we need to explicitly mark it for uploading so that it does not get deleted - for (auto pResource : m_resources) - { - if (!m_toUpload.contains(pResource)) - { - m_toUpload.push(pResource); - } - } - } - - void BuilderResourceManifest::SetSyncType(SyncType syncType) - { - m_syncType = syncType; - } - - bool BuilderResourceManifest::HasChanges() const - { - return m_toUpload.count() > 0 || m_toDelete.count() > 0; - } - - void BuilderResourceManifest::AppendResource(Resource* pResource) - { - m_uidGenerator->AddUid(pResource->GetId().toInt()); - ResourceManifest::AppendResource(pResource); - } - - void BuilderResourceManifest::RemoveResource(Resource* pResource) - { - m_uidGenerator->RemoveUid(pResource->GetId().toInt()); - ResourceManifest::RemoveResource(pResource); - } - - void BuilderResourceManifest::OnDownloadFail() - { - QMessageBox msgBox(QMessageBox::Critical, - "Sync failed", - QString("%1\n\n%2") - .arg(GetErrorMessage(ErrorCode::ManifestDownloadFail)) - .arg(QObject::tr("Overwrite resource manifest?")), - QMessageBox::Yes | QMessageBox::No); - if (msgBox.exec() == QMessageBox::Yes) - { - if (!UploadManifest()) - { - m_failed = true; - m_errorCode = ErrorCode::ManifestUploadFail; - } - } - ResourceManifest::OnDownloadFail(); - } - - //! This function overrides ResourceManifest Read and tries to do some minimal version checking - //! NOTE: version checking is not done yet, this needs a lot more work to version check properly - ErrorCode BuilderResourceManifest::Read(const QJsonObject& json) - { - int version = json["version"].toInt(); - if (version > m_version && m_syncType == SyncType::Verify) - { - return ErrorCode::OutOfSync; - } - - m_version = version; - QJsonArray resourceArray = json["resources"].toArray(); - - // initially mark ALL existing resource for deletion - QList toDelete = m_resources; - - for (auto resourceDoc : resourceArray) - { - auto pNewResource = new Resource(resourceDoc.toObject()); - // find local resource with the same id as new resource - auto pOldResource = FindById(pNewResource->GetId(), m_resources); - // if resource with the same id already exists then check its version - if (pOldResource) - { - // local resource is outdated, keep its in delete list, and download new one instead - if (pNewResource->GetVersion() > pOldResource->GetVersion()) - { - if (m_syncType == SyncType::Merge) - { - m_toDownload.push(pNewResource); - } - else if (m_syncType == SyncType::Overwrite) - { - m_toDelete.push(pNewResource); - } - } - // local resource is newer or same version, keep it (remove from toDelete list) - // and don't need to download new one - else - { - delete pNewResource; - toDelete.removeAll(pOldResource); - } - } - else - { - // if remote resource was NOT deleted locally then download it - if (!FindById(pNewResource->GetId(), m_toDelete)) - { - if (m_syncType == SyncType::Merge) - { - m_toDownload.push(pNewResource); - } - else if (m_syncType == SyncType::Overwrite) - { - m_toDelete.push(pNewResource); - } - } - // otherwise user deleted it... needs version check here - else - { - delete pNewResource; - } - } - } - - for (auto pResource : m_toUpload) - { - toDelete.removeAll(pResource); - } - - for (auto pResource : toDelete) - { - RemoveResource(pResource); - m_toDelete.removeAll(pResource); - delete pResource; - } - - //! Sync article display order - //! this is more complex to implement because articles may have been added or deleted - //! remotely by another developer while newsbuilder was running - //! for now just overwrite s3 version - QJsonArray orderArray = json["order"].toArray(); - for (auto idObject : orderArray) - { - QString id = idObject.toString(); - if (FindById(id, m_toDownload) && !m_order.contains(id)) - { - m_order.append(id); - } - } - return ErrorCode::None; - } - - //! Write resource manifest to JSON - void BuilderResourceManifest::Write(QJsonObject& json) const - { - QJsonArray resourceArray; - foreach(auto pResource, m_resources) - { - QJsonObject resourceObject; - pResource->Write(resourceObject); - resourceArray.append(resourceObject); - } - json["resources"] = resourceArray; - - QJsonArray orderArray; - foreach(auto id, m_order) - { - orderArray.append(id); - } - json["order"] = orderArray; - json["version"] = m_version; - } - - //! Figure out how many resources need to be synced - void BuilderResourceManifest::PrepareForSync() - { - // if resource is locally marked for deletion, then we don't need to upload/download it - for (auto pResource : m_toDelete) - { - m_toDownload.removeAll(pResource); - m_toUpload.removeAll(pResource); - } - - m_syncLeft = - m_toDownload.size() + - m_toUpload.size() + - m_toDelete.size(); - } - - void BuilderResourceManifest::SyncResources() - { - ResourceManifest::SyncResources(); - UploadResources(); - DeleteResources(); - } - - void BuilderResourceManifest::UploadResources() - { - QStack failures; - while (m_toUpload.count() > 0) - { - m_syncUpdateCallback( - QString("Uploading: %1 resources left").arg(m_toUpload.count()), - LogInfo); - - auto pResource = m_toUpload.pop(); - - auto uploadDescriptor = UploadDescriptor(*pResource); - uploadDescriptor.Upload(*m_s3Connector, - [&](QString url) - { - UpdateSync(); - }, - [&, pResource](QString error) - { - failures.push(pResource); - m_failed = true; - UpdateSync(); - m_syncUpdateCallback( - error, - LogError); - }); - } - while (failures.count() > 0) - { - m_toUpload.push(failures.pop()); - } - } - - void BuilderResourceManifest::DeleteResources() - { - while (m_toDelete.count() > 0) - { - m_syncUpdateCallback( - QString("Deleting: %1 resources left").arg(m_toDelete.count()), - LogInfo); - - auto pResource = m_toDelete.pop(); - - auto deleteDescriptor = DeleteDescriptor(*pResource); - deleteDescriptor.Delete(*m_s3Connector, - [&, pResource]() - { - delete pResource; - UpdateSync(); - }, - [&, pResource](QString error) - { - m_failed = true; - delete pResource; - UpdateSync(); - m_syncUpdateCallback( - QString("Failed to delete resource: %1").arg(error), - LogError); - }); - } - } - - void BuilderResourceManifest::FinishSync() - { - if (!m_failed) - { - QString error; - if (!UploadManifest()) - { - m_failed = true; - m_errorCode = ErrorCode::ManifestUploadFail; - } - } - ResourceManifest::FinishSync(); - } - - bool BuilderResourceManifest::UploadManifest() - { - m_syncUpdateCallback(QObject::tr("%1 to %2") - .arg("Uploading manifest") - .arg(m_endpointManager->GetSelectedEndpoint()->GetBucket()), - LogInfo); - m_version++; - Aws::String awsError; - QJsonObject manifestObject; - Write(manifestObject); - QJsonDocument doc(manifestObject); - auto ss = Aws::MakeShared( - S3Connector::ALLOCATION_TAG, - std::ios::in | std::ios::out | std::ios::binary); - *ss << QString(doc.toJson(QJsonDocument::Compact)).toStdString(); - Aws::String url; - if (!m_s3Connector->PutObject("resourceManifest", ss, url, awsError)) - { - m_syncUpdateCallback(QObject::tr(awsError.c_str()), LogError); - return false; - } - return true; - } - - bool BuilderResourceManifest::InitS3Connector() const - { - auto awsProfileName = - m_endpointManager->GetSelectedEndpoint()->GetAwsProfile(); - auto bucketName = - m_endpointManager->GetSelectedEndpoint()->GetBucket(); - Aws::String awsError; - if (!m_s3Connector->Init( - awsProfileName.toStdString().c_str(), - bucketName.toStdString().c_str(), - awsError)) - { - m_syncUpdateCallback(QObject::tr(awsError.c_str()), LogError); - return false; - } - return true; - } - -} diff --git a/Code/Tools/News/NewsBuilder/ResourceManagement/BuilderResourceManifest.h b/Code/Tools/News/NewsBuilder/ResourceManagement/BuilderResourceManifest.h deleted file mode 100644 index b6c20df571..0000000000 --- a/Code/Tools/News/NewsBuilder/ResourceManagement/BuilderResourceManifest.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include "NewsShared/ResourceManagement/ResourceManifest.h" - -#include - -class QJsonObject; - -namespace News -{ - class EndpointManager; - class ArticleDescriptor; - class UidGenerator; - class S3Connector; - class QtDownloadManager; - class Descriptor; - class DownloadDescriptor; - class Resource; - - //! Type of sync behavior - enum class SyncType - { - Merge, // merge resources from both endpoints, i.e. replacing outdated and appending missing (also normal sync behavior) - Overwrite, // overwrite resources on new endpoint with old endpoint - Verify // attempt to publish changes but abort if out of sync - }; - - //! Adds news-builder functionality layer to resource manager - class BuilderResourceManifest - : public ResourceManifest - { - public: - explicit BuilderResourceManifest( - std::function syncSuccessCallback, - std::function syncFailCallback, - std::function syncUpdateCallback); - - //! Create new article resource - /*! - Create new article with default parameters, - Add it to resource collection, - Mark it for upload. - - \retval Resource * - a pointer to an article Resource - */ - Resource* AddArticle(); - - //! Create new image resource - /*! - Create new image from file, - add it to resource collection, - mark it for upload. - - \param filename - path to an image on hard drive - \retval Resource * - a pointer to an image Resource - */ - Resource* AddImage(const QString& filename); - - //! If resource was modified, add it to upload list and increment its version - void UpdateResource(Resource* resource); - - //! When resource is used by several other resources, this function is called - //! to increment its ref count - void UseResource(const QString& id); - - //! When resource is no longer used by another resource - //! decrement refCount, - //! if nothing else is using it, then mark for delete - void FreeResource(const QString& id); - - //! Move article either up or down in order queue - bool UpdateArticleOrder(const QString& id, bool direction, ErrorCode& error); - - EndpointManager* GetEndpointManager() const; - - void Sync() override; - - void Reset() override; - - //! When switching endpoints Merge allows to persist resources to another endpoint, - //! thus copying news from one location to another upon next Sync - void PersistLocalResources(); - - void SetSyncType(SyncType syncType); - - //! Are there local changes - bool HasChanges() const; - - protected: - void AppendResource(Resource* pResource) override; - void RemoveResource(Resource* pResource) override; - void OnDownloadFail() override; - void FinishSync() override; - - private: - S3Connector* m_s3Connector = nullptr; - UidGenerator* m_uidGenerator = nullptr; - EndpointManager* m_endpointManager = nullptr; - SyncType m_syncType = SyncType::Merge; - - QStack m_toUpload; - QStack m_toDelete; - - ErrorCode Read(const QJsonObject& json) override; - void Write(QJsonObject& json) const; - - void PrepareForSync() override; - void SyncResources() override; - - void UploadResources(); - void DeleteResources(); - - bool UploadManifest(); - - //! Initializes S3 connector with selected endpoint - bool InitS3Connector() const; - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/ResourceManagement/DeleteDescriptor.cpp b/Code/Tools/News/NewsBuilder/ResourceManagement/DeleteDescriptor.cpp deleted file mode 100644 index 63cdb46218..0000000000 --- a/Code/Tools/News/NewsBuilder/ResourceManagement/DeleteDescriptor.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "DeleteDescriptor.h" -#include "NewsBuilder/S3Connector.h" -#include "NewsShared/ResourceManagement/Resource.h" - -#include - -namespace News -{ - - DeleteDescriptor::DeleteDescriptor(Resource& resource) - : Descriptor(resource) {} - - void DeleteDescriptor::Delete(S3Connector& s3Connector, - std::function deleteSuccessCallback, - std::function deleteFailCallback) const - { - Aws::String error; - if (!s3Connector.DeleteObject( - m_resource.GetId().toStdString().c_str(), - error)) - { - deleteFailCallback(QString("Error deleting resource %1: %2") - .arg(m_resource.GetId()) - .arg(error.c_str())); - } - else - { - deleteSuccessCallback(); - } - } - -} diff --git a/Code/Tools/News/NewsBuilder/ResourceManagement/DeleteDescriptor.h b/Code/Tools/News/NewsBuilder/ResourceManagement/DeleteDescriptor.h deleted file mode 100644 index 8928e9e19d..0000000000 --- a/Code/Tools/News/NewsBuilder/ResourceManagement/DeleteDescriptor.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include "NewsShared/ResourceManagement/Descriptor.h" - -#include -#include - -namespace News -{ - class S3Connector; - - class DeleteDescriptor - : public Descriptor - { - public: - explicit DeleteDescriptor(Resource& resource); - - void Delete(S3Connector& s3Connector, - std::function deleteSuccessCallback, - std::function deleteFailCallback) const; - }; -} diff --git a/Code/Tools/News/NewsBuilder/ResourceManagement/ImageDescriptor.cpp b/Code/Tools/News/NewsBuilder/ResourceManagement/ImageDescriptor.cpp deleted file mode 100644 index a16ec48851..0000000000 --- a/Code/Tools/News/NewsBuilder/ResourceManagement/ImageDescriptor.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ImageDescriptor.h" -#include "NewsShared/ResourceManagement/Resource.h" - -#include -#include -#include -#include -#include - -namespace News -{ - - ImageDescriptor::ImageDescriptor( - Resource& resource) - : Descriptor(resource) - { - } - - bool ImageDescriptor::Read(const QString& filename, QString& error) const - { - QImageReader reader(filename); - if (!reader.canRead()) - { - error = reader.errorString(); - return false; - } - QImage image = reader.read(); - - QPixmap pixmap(filename); - QByteArray data; - QBuffer buffer(&data); - buffer.open(QIODevice::WriteOnly); - QFile test("test.png"); - if (pixmap.save(&buffer, "PNG")) - { - m_resource.SetData(data); - return true; - } - error = QString("failed to save image %1").arg(filename); - return false; - } - -} diff --git a/Code/Tools/News/NewsBuilder/ResourceManagement/ImageDescriptor.h b/Code/Tools/News/NewsBuilder/ResourceManagement/ImageDescriptor.h deleted file mode 100644 index ba4533b0c0..0000000000 --- a/Code/Tools/News/NewsBuilder/ResourceManagement/ImageDescriptor.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -class QString; - -namespace News -{ - class ImageDescriptor - : public Descriptor - { - public: - explicit ImageDescriptor(Resource& resource); - - bool Read(const QString& filename, QString& error) const; - }; -} diff --git a/Code/Tools/News/NewsBuilder/ResourceManagement/UploadDescriptor.cpp b/Code/Tools/News/NewsBuilder/ResourceManagement/UploadDescriptor.cpp deleted file mode 100644 index 699959ed85..0000000000 --- a/Code/Tools/News/NewsBuilder/ResourceManagement/UploadDescriptor.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "NewsBuilder/S3Connector.h" -#include "UploadDescriptor.h" -#include "NewsShared/ResourceManagement/Resource.h" - -#include -#include -#include - -#include - -namespace News -{ - - UploadDescriptor::UploadDescriptor(Resource& resource) - : Descriptor(resource) {} - - void UploadDescriptor::Upload(S3Connector& s3Connector, - std::function uploadSuccessCallback, - std::function uploadFailCallback) const - { - Aws::String error; - - auto ss = - Aws::MakeShared(S3Connector::ALLOCATION_TAG, - std::ios::in | std::ios::out | std::ios::binary); - auto* pbuf = ss->rdbuf(); - pbuf->sputn(m_resource.GetData().data(), m_resource.GetData().size()); - Aws::String awsUrl; - - if (!s3Connector.PutObject( - m_resource.GetId().toStdString().c_str(), - ss, - m_resource.GetData().size(), - awsUrl, - error)) - { - uploadFailCallback(QObject::tr("Error uploading resource %1: %2") - .arg(m_resource.GetId()) - .arg(error.c_str())); - } - else - { - uploadSuccessCallback(QString(awsUrl.c_str())); - } - } - -} diff --git a/Code/Tools/News/NewsBuilder/ResourceManagement/UploadDescriptor.h b/Code/Tools/News/NewsBuilder/ResourceManagement/UploadDescriptor.h deleted file mode 100644 index 71a7732c1e..0000000000 --- a/Code/Tools/News/NewsBuilder/ResourceManagement/UploadDescriptor.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include "NewsShared/ResourceManagement/Descriptor.h" - -#include -#include - -namespace News -{ - class S3Connector; - - class UploadDescriptor - : public Descriptor - { - public: - explicit UploadDescriptor(Resource& resource); - - void Upload(S3Connector& s3Connector, - std::function uploadSuccessCallback, - std::function uploadFailCallback) const; - }; -} diff --git a/Code/Tools/News/NewsBuilder/Resources/NewsBuilder.qss b/Code/Tools/News/NewsBuilder/Resources/NewsBuilder.qss deleted file mode 100644 index 01ca308585..0000000000 --- a/Code/Tools/News/NewsBuilder/Resources/NewsBuilder.qss +++ /dev/null @@ -1,44 +0,0 @@ -QLabel -{ - font-size: 12px; - color: #FFFFFF; - line-height: 20px; - background-color: transparent; - margin: 0; -} - -QLabel#titleLabel -{ - font-size: 22px; - line-height: 32px; -} - -QLabel#bodyLabel -{ - font-size: 14px; - line-height: 20px; -} - -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%); -} - -QWidget#articleViewContainerRoot -{ - background: #222222; -} - -QScrollArea#previewArea, -QWidget#articleViewContents, -QFrame#imageFrame -{ - background-color: transparent; -} - -News--ArticleView.SelectedArticle > QWidget -{ - background: #333333; -} diff --git a/Code/Tools/News/NewsBuilder/Resources/missing-image.png b/Code/Tools/News/NewsBuilder/Resources/missing-image.png deleted file mode 100644 index 889493e628..0000000000 --- a/Code/Tools/News/NewsBuilder/Resources/missing-image.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4255a25636d77a54809592bc98bef47fa9044be03cd65d73daa821711489e00f -size 7379 diff --git a/Code/Tools/News/NewsBuilder/S3Connector.cpp b/Code/Tools/News/NewsBuilder/S3Connector.cpp deleted file mode 100644 index a54b6fa8f8..0000000000 --- a/Code/Tools/News/NewsBuilder/S3Connector.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "S3Connector.h" - -#include -#include -#include - - -AZ_PUSH_DISABLE_WARNING(4251 4819, "-Wunknown-warning-option") // Invalid character not in default code page -#include -#include -#include -#include -#include -#include -#include -#include -AZ_POP_DISABLE_WARNING - -namespace News -{ - const char* S3Connector::ALLOCATION_TAG = "NewsBuilder"; - - S3Connector::S3Connector() - : m_s3Client(nullptr) - , m_limiter(nullptr) - , m_valid(false) - { - } - - S3Connector::~S3Connector() {} - - bool S3Connector::Init(const char* awsProfileName, const char* bucket, Aws::String& error) - { - Aws::SDKOptions options; - options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace; - Aws::InitAPI(options); - - Aws::Client::ClientConfiguration config; - config.enableTcpKeepAlive = AZ_TRAIT_AZFRAMEWORK_AWS_ENABLE_TCP_KEEP_ALIVE_SUPPORTED; - config.scheme = Aws::Http::Scheme::HTTPS; - config.connectTimeoutMs = 30000; - config.requestTimeoutMs = 30000; - config.readRateLimiter = m_limiter; - config.writeRateLimiter = m_limiter; - - auto provider = - Aws::MakeShared( - ALLOCATION_TAG, - awsProfileName); - - auto accessKeyId = provider->GetAWSCredentials().GetAWSAccessKeyId(); - - //! verify that credential file exists - if (accessKeyId.empty()) - { - error = "LY_NEWS_DEVELOPER AWS credentials not found. Add credentials in LY Editor AWS->ClientManager"; - m_valid = false; - return false; - } - - m_bucket = Aws::String(bucket); - m_s3Client = Aws::MakeShared( - ALLOCATION_TAG, - provider, - config); - - m_valid = true; - return true; - } - - bool S3Connector::GetObject(const char* key, - Aws::String& data, - Aws::String& url, - Aws::String& error) const - { - if (!m_valid) - { - error = "Client not initialized"; - return false; - } - - Aws::S3::Model::GetObjectRequest getObjectRequest; - getObjectRequest.SetBucket(m_bucket); - getObjectRequest.SetKey(key); - auto outcome = m_s3Client->GetObject(getObjectRequest); - if (!outcome.IsSuccess()) - { - error = outcome.GetError().GetMessage(); - return false; - } - url = m_s3Client->GeneratePresignedUrl(m_bucket, key, Aws::Http::HttpMethod::HTTP_GET); - Aws::StringStream ss; - ss << outcome.GetResult().GetBody().rdbuf(); - data = ss.str(); - return true; - } - - bool S3Connector::PutObject(const char* key, - STREAM_PTR stream, - Aws::String& url, - Aws::String& error) const - { - return PutObject(key, stream, GetStreamLength(stream), url, error); - } - - bool S3Connector::PutObject(const char* key, - STREAM_PTR stream, - int length, - Aws::String& url, - Aws::String& error) const - { - if (!m_valid) - { - error = "Client not initialized"; - return false; - } - - Aws::S3::Model::PutObjectRequest putObjectRequest; - putObjectRequest.SetBucket(m_bucket); - putObjectRequest.SetBody(stream); - putObjectRequest.SetContentLength(length); - putObjectRequest.SetContentMD5( - Aws::Utils::HashingUtils::Base64Encode( - Aws::Utils::HashingUtils::CalculateMD5(*putObjectRequest.GetBody()))); - putObjectRequest.SetContentType(Aws::String("binary/octet-stream")); - putObjectRequest.SetKey(key); - putObjectRequest.SetACL(Aws::S3::Model::ObjectCannedACL::public_read); - auto outcome = m_s3Client->PutObject(putObjectRequest); - if (!outcome.IsSuccess()) - { - error = outcome.GetError().GetMessage(); - return false; - } - url = m_s3Client->GeneratePresignedUrl(m_bucket, key, Aws::Http::HttpMethod::HTTP_GET); - return true; - } - - bool S3Connector::DeleteObject(const char* key, Aws::String& error) const - { - if (!m_valid) - { - error = "Client not initialized"; - return false; - } - - Aws::S3::Model::DeleteObjectRequest deleteObjectRequest; - deleteObjectRequest.SetBucket(m_bucket); - deleteObjectRequest.SetKey(key); - auto outcome = m_s3Client->DeleteObject(deleteObjectRequest); - if (!outcome.IsSuccess()) - { - error = outcome.GetError().GetMessage(); - return false; - } - return true; - } - - int S3Connector::GetStreamLength(STREAM_PTR stream) - { - stream->seekg(0, std::ios::end); - auto length = stream->tellg(); - stream->seekg(0, std::ios::beg); - return static_cast(length); - } - -} diff --git a/Code/Tools/News/NewsBuilder/S3Connector.h b/Code/Tools/News/NewsBuilder/S3Connector.h deleted file mode 100644 index d0404bfddb..0000000000 --- a/Code/Tools/News/NewsBuilder/S3Connector.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include -#include -AZ_PUSH_DISABLE_WARNING(4251 4355 4996, "-Wunknown-warning-option") // includes ppltasks.h which throws a C4355 warning: 'this' used in base member initializer list -#include -AZ_POP_DISABLE_WARNING - -typedef std::shared_ptr STREAM_PTR; - -namespace News -{ - //! A light wrapper around AWS SDK - class S3Connector - { - public: - static const char* ALLOCATION_TAG; - - S3Connector(); - ~S3Connector(); - - //! Make s3 client using credentials stored in [user]/.aws/credentials file - /*! - \param awsProfileName - name of AWS credentials - \param bucket - name of s3 bucket to use for AWS operations - \param error - error string - \retval bool - true if success else false - */ - bool Init(const char* awsProfileName, const char* bucket, Aws::String& error); - - bool GetObject(const char* key, - Aws::String& data, - Aws::String& url, - Aws::String& error) const; - - bool PutObject(const char* key, - STREAM_PTR stream, - Aws::String& url, - Aws::String& error) const; - - bool PutObject(const char* key, - STREAM_PTR stream, - int length, - Aws::String& url, - Aws::String& error) const; - - bool DeleteObject(const char* key, - Aws::String& error) const; - - private: - Aws::String m_bucket; - std::shared_ptr m_s3Client; - std::shared_ptr m_limiter; - bool m_valid; - - static int GetStreamLength(STREAM_PTR stream); - }; -} // namespace News diff --git a/Code/Tools/News/NewsBuilder/UidGenerator.cpp b/Code/Tools/News/NewsBuilder/UidGenerator.cpp deleted file mode 100644 index 060f593996..0000000000 --- a/Code/Tools/News/NewsBuilder/UidGenerator.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "UidGenerator.h" - -#include - -namespace News -{ - - UidGenerator::UidGenerator() - { - srand(static_cast(time(nullptr))); - } - - int UidGenerator::GenerateUid() - { - int uid; - do - { - uid = rand(); - } - while (std::find(m_uids.begin(), m_uids.end(), uid) != m_uids.end()); - m_uids.push_back(uid); - return uid; - } - - int UidGenerator::AddUid(int uid) - { - if (std::find(m_uids.begin(), m_uids.end(), uid) == m_uids.end()) - { - m_uids.push_back(uid); - } - return uid; - } - - void UidGenerator::RemoveUid(int uid) - { - auto it = std::find(m_uids.begin(), m_uids.end(), uid); - if (it != m_uids.end()) - { - m_uids.erase(it); - } - } - - void UidGenerator::Clear() - { - m_uids.clear(); - } - -} diff --git a/Code/Tools/News/NewsBuilder/UidGenerator.h b/Code/Tools/News/NewsBuilder/UidGenerator.h deleted file mode 100644 index 825df9e340..0000000000 --- a/Code/Tools/News/NewsBuilder/UidGenerator.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -namespace News -{ - //! A simple unique id generator. - class UidGenerator - { - public: - UidGenerator(); - int GenerateUid(); - int AddUid(int uid); - void RemoveUid(int uid); - void Clear(); - - private: - std::vector m_uids; - }; -} diff --git a/Code/Tools/News/NewsBuilder/main.cpp b/Code/Tools/News/NewsBuilder/main.cpp deleted file mode 100644 index 6a43c681b1..0000000000 --- a/Code/Tools/News/NewsBuilder/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -#include "Qt/NewsBuilder.h" -#include -#include -#include -#include - - -int main(int argc, char *argv[]) -{ - // Must be set before QApplication is initialized, so that we support HighDpi monitors, like the Retina displays - // on Windows 10 - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); - - QApplication a(argc, argv); - AZ::IO::FixedMaxPath engineRootPath; - { - AZ::ComponentApplication componentApplication; - auto settingsRegistry = AZ::SettingsRegistry::Get(); - settingsRegistry->Get(engineRootPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder); - } - News::NewsBuilder w(nullptr, engineRootPath); - w.show(); - return a.exec(); -} diff --git a/Code/Tools/News/NewsBuilder/news_builder.qrc b/Code/Tools/News/NewsBuilder/news_builder.qrc deleted file mode 100644 index 010ac598f1..0000000000 --- a/Code/Tools/News/NewsBuilder/news_builder.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - Resources/NewsBuilder.qss - - diff --git a/Code/Tools/News/NewsBuilder/news_builder_files.cmake b/Code/Tools/News/NewsBuilder/news_builder_files.cmake deleted file mode 100644 index c46e66a357..0000000000 --- a/Code/Tools/News/NewsBuilder/news_builder_files.cmake +++ /dev/null @@ -1,64 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - main.cpp - S3Connector.cpp - S3Connector.h - UidGenerator.cpp - UidGenerator.h - EndpointManager.cpp - EndpointManager.h - Qt/ArticleDetails.cpp - Qt/ArticleDetails.h - Qt/ArticleDetails.ui - Qt/ArticleDetailsContainer.cpp - Qt/ArticleDetailsContainer.h - Qt/ArticleDetailsContainer.ui - Qt/AwsDialog.ui - Qt/BuilderArticleViewContainer.cpp - Qt/BuilderArticleViewContainer.h - Qt/BuilderArticleViewContainer.ui - Qt/EndpointEntryView.cpp - Qt/EndpointEntryView.h - Qt/EndpointEntryView.ui - Qt/EndpointManagerView.cpp - Qt/EndpointManagerView.h - Qt/EndpointManagerView.ui - Qt/ImageItem.cpp - Qt/ImageItem.h - Qt/ImageItem.ui - Qt/LogContainer.cpp - Qt/LogContainer.h - Qt/LogContainer.ui - Qt/NewsBuilder.cpp - Qt/NewsBuilder.h - Qt/Newsbuilder.qrc - Qt/Newsbuilder.ui - Qt/QCustomMessageBox.cpp - Qt/QCustomMessageBox.h - Qt/QCustomMessageBox.ui - Qt/SelectImage.cpp - Qt/SelectImage.h - Qt/SelectImage.ui - ResourceManagement/BuilderResourceManifest.cpp - ResourceManagement/BuilderResourceManifest.h - ResourceManagement/DeleteDescriptor.cpp - ResourceManagement/DeleteDescriptor.h - ResourceManagement/ImageDescriptor.cpp - ResourceManagement/ImageDescriptor.h - ResourceManagement/UploadDescriptor.cpp - ResourceManagement/UploadDescriptor.h -) - -set(SKIP_UNITY_BUILD_INCLUSION_FILES - # Fix for unity causing the 'News::BuilderResourceManifest::UpdateResourceA' symbol to be unresolved - Qt/ArticleDetails.cpp - # Fix for unity causing the ' Aws::S3::S3Client::GetObjectA' symbol to be unresolved - S3Connector.cpp - -) diff --git a/Code/Tools/News/NewsShared/ErrorCodes.h b/Code/Tools/News/NewsShared/ErrorCodes.h deleted file mode 100644 index 444e0c6f67..0000000000 --- a/Code/Tools/News/NewsShared/ErrorCodes.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -namespace News -{ - enum class ErrorCode : int - { - None, - OutOfSync, - ManifestDownloadFail, - FailedToSync, - AlreadySyncing, - FailedToParseManifest, - MissingArticle, - NoEndpoint, - ManifestUploadFail, - S3Fail - }; - - inline extern const char* GetErrorMessage(ErrorCode errorCode) - { - static const char* errors[] - { - "", - "Your manifest is out of sync. Reopen the same endpoint and sync to resolve the conflict and try again.", - "Failed to download resource manifest", - "Failed to sync resources", - "Sync is already running", - "Failed to parse resource manifest", - "Could not find article, try syncing again", - "Missing or incorrect endpoint selected", - "Failed to upload resource manifest", - "Failed to init S3 connection" - }; - int errorCount = sizeof errors / sizeof errors[0]; - int typeIndex = static_cast(errorCode); - if (typeIndex < 0 || typeIndex >= errorCount) - { - return "Invalid error code"; - } - return errors[typeIndex]; - } -} // namespace News diff --git a/Code/Tools/News/NewsShared/LogType.h b/Code/Tools/News/NewsShared/LogType.h deleted file mode 100644 index 92834adc58..0000000000 --- a/Code/Tools/News/NewsShared/LogType.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -namespace News { - enum LogType - { - LogOk, - LogInfo, - LogError, - LogWarning - }; -} // namespace News diff --git a/Code/Tools/News/NewsShared/Qt/ArticleErrorView.cpp b/Code/Tools/News/NewsShared/Qt/ArticleErrorView.cpp deleted file mode 100644 index 6f2a7e3c9c..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleErrorView.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ArticleErrorView.h" -#include "NewsShared/Qt/ui_ArticleErrorView.h" - -using namespace News; - -ArticleErrorView::ArticleErrorView( - QWidget* parent) - : QWidget(parent) - , m_ui(new Ui::ArticleErrorViewWidget()) -{ - m_ui->setupUi(this); -} - -ArticleErrorView::~ArticleErrorView(){} - -#include "NewsShared/Qt/moc_ArticleErrorView.cpp" diff --git a/Code/Tools/News/NewsShared/Qt/ArticleErrorView.h b/Code/Tools/News/NewsShared/Qt/ArticleErrorView.h deleted file mode 100644 index 3130690dc1..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleErrorView.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Ui -{ - class ArticleErrorViewWidget; -} - -namespace AzQtComponents -{ - class ExtendedLabel; -} - -namespace News -{ - class ArticleErrorView - : public QWidget - { - Q_OBJECT - public: - ArticleErrorView(QWidget* parent); - ~ArticleErrorView(); - - private: - QScopedPointer m_ui; - }; -} diff --git a/Code/Tools/News/NewsShared/Qt/ArticleErrorView.ui b/Code/Tools/News/NewsShared/Qt/ArticleErrorView.ui deleted file mode 100644 index c94c636720..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleErrorView.ui +++ /dev/null @@ -1,239 +0,0 @@ - - - ArticleErrorViewWidget - - - - 0 - 0 - 192 - 228 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - ArticleView - - - background-color: none; text-align: left; - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - border: none; - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 14 - - - - - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 14 - 20 - - - - - - - - 0 - - - - - - 160 - 90 - - - - - - - :/images/Resources/ErrorImage.jpg - - - - 160 - 90 - - - - - - - - Qt::Vertical - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - - Open Sans - 8 - 50 - false - - - - a { text-decoration: underline; color: red } - - - We couldn’t connect to the network or access our news database. To see the latest Open 3D Engine news, blogs, tutorials, and more, please visit the <a href="http://aws.amazon.com/lumberyard/">Lumberyard website</a>. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - true - - - Qt::LinksAccessibleByMouse - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 14 - 20 - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - - - - - AzQtComponents::ExtendedLabel - QLabel -
AzQtComponents/Components/ExtendedLabel.h
-
-
- - - - -
diff --git a/Code/Tools/News/NewsShared/Qt/ArticleView.cpp b/Code/Tools/News/NewsShared/Qt/ArticleView.cpp deleted file mode 100644 index 082a29d38a..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleView.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ArticleView.h" - -#include - -AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: '...' needs to have dll-interface to be used by clients of class '...' -#include "NewsShared/ResourceManagement/ArticleDescriptor.h" -#include "NewsShared/Qt/ui_ArticleView.h" -#include "NewsShared/Qt/ui_PinnedArticleView.h" -#include "NewsShared/ResourceManagement/ResourceManifest.h" -#include "NewsShared/ResourceManagement/Resource.h" - - -#include -#include -AZ_POP_DISABLE_WARNING - -using namespace News; - -ArticleView::ArticleView( - QWidget* parent, - const ArticleDescriptor& article, - const ResourceManifest& manifest) - : QWidget(parent) - , m_pArticle(new ArticleDescriptor(article)) - , m_manifest(manifest) - , m_icon(nullptr) -{ - -} - -void ArticleView::Update() -{ - Q_ASSERT(m_widgetImageFrame && m_widgetTitle && m_widgetBody); - - auto pResource = m_manifest.FindById(m_pArticle->GetResource().GetId()); - m_pArticle.reset(); - if (pResource) - { - m_pArticle = QSharedPointer(new ArticleDescriptor(*pResource)); - m_widgetTitle->setText(m_pArticle->GetTitle()); - m_widgetBody->setText(m_pArticle->GetBody()); - auto pImageResource = m_manifest.FindById(m_pArticle->GetImageId()); - if (pImageResource) - { - QPixmap pixmap; - if (pixmap.loadFromData(pImageResource->GetData())) - { - if (!m_icon) - { - m_icon = new AzQtComponents::ExtendedLabel(this); - m_icon->setStyleSheet("border: none;"); - m_icon->setAlignment(Qt::AlignCenter); - static_cast( - m_widgetImageFrame->layout())->insertWidget(0, m_icon); - connect(m_icon, &AzQtComponents::ExtendedLabel::clicked, this, &ArticleView::articleSelectedSlot); - } - m_icon->setPixmap(pixmap.scaled(m_widgetImageFrame->minimumWidth(), - m_widgetImageFrame->minimumHeight(), - Qt::KeepAspectRatioByExpanding)); - } - else - { - RemoveIcon(); - } - } - else - { - RemoveIcon(); - } - } -} - -void ArticleView::mousePressEvent([[maybe_unused]] QMouseEvent* event) -{ - articleSelectedSlot(); -} - -void ArticleView::RemoveIcon() -{ - if (m_icon) - { - delete m_icon; - m_icon = nullptr; - } -} - -void ArticleView::linkActivatedSlot(const QString& link) -{ - QDesktopServices::openUrl(QUrl(link)); - Q_EMIT linkActivatedSignal(link); -} - -void ArticleView::articleSelectedSlot() -{ - Q_EMIT articleSelectedSignal(m_pArticle->GetResource().GetId()); -} - -QSharedPointer ArticleView::GetArticle() const -{ - return m_pArticle; -} - -void ArticleView::SetupViewWidget(QFrame* widgetImageFrame, AzQtComponents::ExtendedLabel* widgetTitle, AzQtComponents::ExtendedLabel* widgetBody) -{ - Q_ASSERT(m_widgetImageFrame == nullptr && m_widgetTitle == nullptr && m_widgetBody == nullptr); - - m_widgetImageFrame = widgetImageFrame; - m_widgetTitle = widgetTitle; - m_widgetBody = widgetBody; - - connect(m_widgetTitle, &QLabel::linkActivated, this, &ArticleView::linkActivatedSlot); - connect(m_widgetBody, &QLabel::linkActivated, this, &ArticleView::linkActivatedSlot); - connect(m_widgetTitle, &AzQtComponents::ExtendedLabel::clicked, this, &ArticleView::articleSelectedSlot); - connect(m_widgetBody, &AzQtComponents::ExtendedLabel::clicked, this, &ArticleView::articleSelectedSlot); - - Q_ASSERT(m_widgetImageFrame && m_widgetTitle && m_widgetBody); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// ArticleViewDefaultWidget -//////////////////////////////////////////////////////////////////////////////////////////////////// -ArticleViewDefaultWidget::ArticleViewDefaultWidget(QWidget* parent, - const ArticleDescriptor& article, - const ResourceManifest& manifest) - : ArticleView(parent, article, manifest) - , m_ui(new Ui::ArticleViewWidget()) -{ - m_ui->setupUi(this); - SetupViewWidget(m_ui->imageFrame, m_ui->titleLabel, m_ui->bodyLabel); - Update(); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// ArticleViewPinnedWidget -//////////////////////////////////////////////////////////////////////////////////////////////////// -ArticleViewPinnedWidget::ArticleViewPinnedWidget(QWidget* parent, - const ArticleDescriptor& article, - const ResourceManifest& manifest) - : ArticleView(parent, article, manifest) - , m_ui(new Ui::PinnedArticleViewWidget()) -{ - m_ui->setupUi(this); - SetupViewWidget(m_ui->imageFrame, m_ui->titleLabel, m_ui->bodyLabel); - Update(); -} - -#include "NewsShared/Qt/moc_ArticleView.cpp" diff --git a/Code/Tools/News/NewsShared/Qt/ArticleView.h b/Code/Tools/News/NewsShared/Qt/ArticleView.h deleted file mode 100644 index 16a29732f0..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleView.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Ui -{ - class ArticleViewWidget; - class PinnedArticleViewWidget; -} - -namespace AzQtComponents -{ - class ExtendedLabel; -} - -class QFrame; - -namespace News -{ - class ArticleDescriptor; - class ResourceManifest; - - class ArticleView - : public QWidget - { - Q_OBJECT - public: - ArticleView(QWidget* parent, - const ArticleDescriptor& article, - const ResourceManifest& manifest); - ~ArticleView() = default; - - void Update(); - QSharedPointer GetArticle() const; - - Q_SIGNALS: - void articleSelectedSignal(QString resourceId); - void linkActivatedSignal(const QString& link); - - protected: - void SetupViewWidget(QFrame* widgetImageFrame, AzQtComponents::ExtendedLabel* widgetTitle, AzQtComponents::ExtendedLabel* widgetBody); - void mousePressEvent(QMouseEvent* event); - - private: - - QFrame* m_widgetImageFrame = nullptr; - AzQtComponents::ExtendedLabel* m_widgetTitle = nullptr; - AzQtComponents::ExtendedLabel* m_widgetBody = nullptr; - AzQtComponents::ExtendedLabel* m_icon = nullptr; - - QSharedPointer m_pArticle; - const ResourceManifest& m_manifest; - - void RemoveIcon(); - - private Q_SLOTS: - void linkActivatedSlot(const QString& link); - void articleSelectedSlot(); - }; - - class ArticleViewDefaultWidget : public ArticleView - { - public: - ArticleViewDefaultWidget(QWidget* parent, - const ArticleDescriptor& article, - const ResourceManifest& manifest); - ~ArticleViewDefaultWidget() = default; - - private: - Ui::ArticleViewWidget* m_ui = nullptr; - }; - - class ArticleViewPinnedWidget : public ArticleView - { - public: - ArticleViewPinnedWidget(QWidget* parent, - const ArticleDescriptor& article, - const ResourceManifest& manifest); - ~ArticleViewPinnedWidget() = default; - - private: - Ui::PinnedArticleViewWidget* m_ui = nullptr; - }; -} diff --git a/Code/Tools/News/NewsShared/Qt/ArticleView.ui b/Code/Tools/News/NewsShared/Qt/ArticleView.ui deleted file mode 100644 index 67d1d8857b..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleView.ui +++ /dev/null @@ -1,244 +0,0 @@ - - - ArticleViewWidget - - - - 0 - 0 - 430 - 376 - - - - - 0 - 0 - - - - - 430 - 0 - - - - - 430 - 16777215 - - - - ArticleView - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - default - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 430 - 184 - - - - - 430 - 184 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 20 - - - - - - - - - 0 - 0 - - - - - Open Sans - 14 - 50 - false - - - - Title: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - false - - - Qt::LinksAccessibleByMouse - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 12 - - - - - - - - - 0 - 0 - - - - - Open Sans - 8 - 50 - false - - - - Body - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - 0 - - - 0 - - - false - - - Qt::LinksAccessibleByMouse - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 24 - - - - - - - - - - - - AzQtComponents::ExtendedLabel - QLabel -
AzQtComponents/Components/ExtendedLabel.h
-
-
- - -
diff --git a/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.cpp b/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.cpp deleted file mode 100644 index 1d718d1bb8..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ArticleViewContainer.h" -#include "ArticleView.h" -#include "NewsShared/ResourceManagement/ResourceManifest.h" -#include "NewsShared/ResourceManagement/ArticleDescriptor.h" -#include "NewsShared/ResourceManagement/Resource.h" -#include "NewsShared/Qt/ArticleErrorView.h" -#include "NewsShared/Qt/KeepInTouchView.h" -#include "NewsShared/Qt/ui_ArticleViewContainer.h" - -#include -#include - -namespace News -{ - - ArticleViewContainer::ArticleViewContainer(QWidget* parent, ResourceManifest& manifest) - : QWidget(parent) - , m_ui(new Ui::ArticleViewContainerWidget) - , m_manifest(manifest) - , m_loadingLabel(nullptr) - , m_errorMessage(nullptr) - { - m_ui->setupUi(this); - AddLoadingMessage(); - - m_keepInTouchViewWidget = new KeepInTouchView(this); - m_keepInTouchViewWidget->setVisible(false); - connect(m_keepInTouchViewWidget, &KeepInTouchView::linkActivatedSignal, - this, &ArticleViewContainer::linkActivatedSignal); - } - - ArticleViewContainer::~ArticleViewContainer() {} - - void ArticleViewContainer::PopulateArticles() - { - Clear(); - - bool articlesFound = false; - for (auto id : m_manifest.GetOrder()) - { - auto pResource = m_manifest.FindById(id); - if (pResource && pResource->GetType().compare("article") == 0) - { - AddArticleView(ArticleDescriptor(*pResource)); - articlesFound = true; - } - } - - if (!articlesFound) - { - AddErrorMessage(); - } - else - { - auto layout = static_cast(m_ui->articleViewContents->layout()); - layout->insertWidget(layout->count() - 1, m_keepInTouchViewWidget); - m_keepInTouchViewWidget->setVisible(true); - } - - qApp->processEvents(); - } - - ArticleView* ArticleViewContainer::FindById(const QString& id) - { - auto it = std::find_if( - m_articles.begin(), - m_articles.end(), - [id](ArticleView* articleView) -> bool - { - if (!articleView) - { - return false; - } - return articleView->GetArticle()->GetResource().GetId().compare(id) == 0; - }); - if (it == m_articles.end()) - { - return nullptr; - } - return *it; - } - - void ArticleViewContainer::AddArticleView(const ArticleDescriptor& articleDesc, int articlePosition) - { - ClearError(); - - ArticleView* view = CreateArticleView(articleDesc); - if (view == nullptr) - { - return; - } - - m_articles.append(view); - - connect(view, &ArticleView::articleSelectedSignal, - this, &ArticleViewContainer::articleSelectedSlot); - connect(view, &ArticleView::linkActivatedSignal, - this, &ArticleViewContainer::linkActivatedSignal); - - auto layout = static_cast(m_ui->articleViewContents->layout()); - if (articlePosition == -1) - { - articlePosition = layout->count() - 1; - } - - layout->insertWidget(articlePosition, view); - qApp->processEvents(); - } - - void ArticleViewContainer::DeleteArticleView(ArticleView* view) - { - m_articles.removeAll(view); - m_ui->articleViewContents->layout()->removeWidget(view); - delete view; - } - - void ArticleViewContainer::ForceRefreshArticleView(ArticleView* articleView) - { - if (articleView == nullptr) - { - return; - } - - QSharedPointer articleDesc = articleView->GetArticle(); - auto layout = static_cast(m_ui->articleViewContents->layout()); - const int viewIndex = layout->indexOf(articleView); - - DeleteArticleView(articleView); - AddArticleView(*articleDesc, viewIndex); - } - - void ArticleViewContainer::ScrollToView(ArticleView* view) const - { - m_ui->previewArea->ensureWidgetVisible(view); - } - - void ArticleViewContainer::ClearError() - { - //delete loading label - if (m_loadingLabel) - { - delete m_loadingLabel; - m_loadingLabel = nullptr; - } - - //delete error message - if (m_errorMessage) - { - delete m_errorMessage; - m_errorMessage = nullptr; - } - } - - void ArticleViewContainer::articleSelectedSlot(QString id) - { - emit articleSelectedSignal(id); - } - - void ArticleViewContainer::UpdateArticleOrder(ArticleView* view, bool direction) const - { - QVBoxLayout* layout = qobject_cast(m_ui->articleViewContents->layout()); - - const int index = layout->indexOf(view); - - if (direction && index == 0) - { - return; - } - - if (!direction && index == layout->count() - 2) - { - return; - } - - const int newIndex = direction ? index - 1 : index + 1; - layout->removeWidget(view); - layout->insertWidget(newIndex, view); - } - - void ArticleViewContainer::AddLoadingMessage() - { - if (m_errorMessage) - { - delete m_errorMessage; - m_errorMessage = nullptr; - } - - if (!m_loadingLabel) - { - m_loadingLabel = new QLabel(this); - m_loadingLabel->setText("Retrieving news..."); - auto layout = static_cast(m_ui->articleViewContents->layout()); - layout->insertWidget(0, m_loadingLabel); - } - } - - void ArticleViewContainer::AddErrorMessage() - { - if (m_loadingLabel) - { - delete m_loadingLabel; - m_loadingLabel = nullptr; - } - - if (!m_errorMessage) - { - m_errorMessage = new ArticleErrorView(this); - auto layout = static_cast(m_ui->articleViewContents->layout()); - layout->insertWidget(0, m_errorMessage); - } - } - - void ArticleViewContainer::Clear() - { - ClearError(); - - for (auto articleView : m_articles) - { - delete articleView; - } - - m_articles.clear(); - } - - ArticleViewContainer::ArticleStyle ArticleViewContainer::GetArticleStyleEnumFromString(const QString& articleStyleStr) const - { - static const QMap articleStyleStringEnumMap = { - { "default", ArticleStyle::Default }, - { "pinned", ArticleStyle::Pinned } - }; - - if (articleStyleStringEnumMap.contains(articleStyleStr) == false) - { - Q_ASSERT(false); - return ArticleStyle::Default; - } - - return articleStyleStringEnumMap.value(articleStyleStr); - } - - ArticleView* ArticleViewContainer::CreateArticleView(const ArticleDescriptor& articleDesc) - { - ArticleStyle articleStyle = GetArticleStyleEnumFromString(articleDesc.GetArticleStyle()); - - switch(articleStyle) - { - case ArticleStyle::Default: - return new ArticleViewDefaultWidget(this, articleDesc, m_manifest); - case ArticleStyle::Pinned: - return new ArticleViewPinnedWidget(this, articleDesc, m_manifest); - default: - Q_ASSERT(false); - return nullptr; - } - } - -} - -#include "NewsShared/Qt/moc_ArticleViewContainer.cpp" diff --git a/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.h b/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.h deleted file mode 100644 index c0ae3b2701..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include "NewsShared/LogType.h" - -#include -#include -#endif - -class QLabel; - -namespace Ui -{ - class ArticleViewContainerWidget; -} - -namespace News -{ - class Resource; - class ArticleView; - class ArticleDescriptor; - class ResourceManifest; - class ArticleErrorView; - class KeepInTouchView; - - class ArticleViewContainer - : public QWidget - { - Q_OBJECT - - enum ArticleStyle - { - Default, - Pinned - }; - - public: - explicit ArticleViewContainer(QWidget* parent, ResourceManifest& manifest); - ~ArticleViewContainer(); - - virtual void PopulateArticles(); - ArticleView* FindById(const QString& id); - void AddArticleView(const ArticleDescriptor& articleDesc, int articlePosition = -1); - void DeleteArticleView(ArticleView* view); - void ForceRefreshArticleView(ArticleView* articleView); - void ScrollToView(ArticleView* view) const; - void UpdateArticleOrder(ArticleView* view, bool direction) const; - void AddLoadingMessage(); - void AddErrorMessage(); - void Clear(); - - Q_SIGNALS: - void articleSelectedSignal(QString resourceId); - void addArticle(Resource* article); - void logSignal(QString text, LogType logType = LogInfo); - void scrolled(); - void linkActivatedSignal(const QString& link); - - private: - QScopedPointer m_ui; - QList m_articles; - ResourceManifest& m_manifest; - QLabel* m_loadingLabel; - ArticleErrorView* m_errorMessage; - KeepInTouchView* m_keepInTouchViewWidget = nullptr; - - void ClearError(); - ArticleStyle GetArticleStyleEnumFromString(const QString& articleStyleStr) const; - ArticleView* CreateArticleView(const ArticleDescriptor& articleDesc); - - private Q_SLOTS: - virtual void articleSelectedSlot(QString id); - }; -} diff --git a/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.ui b/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.ui deleted file mode 100644 index dfb71ea31f..0000000000 --- a/Code/Tools/News/NewsShared/Qt/ArticleViewContainer.ui +++ /dev/null @@ -1,104 +0,0 @@ - - - ArticleViewContainerWidget - - - - 0 - 0 - 606 - 753 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - true - - - Qt::AlignHCenter|Qt::AlignTop - - - - - 0 - 0 - 589 - 753 - - - - - 16 - - - 15 - - - 15 - - - 15 - - - 15 - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - - - - - diff --git a/Code/Tools/News/NewsShared/Qt/KeepInTouchView.cpp b/Code/Tools/News/NewsShared/Qt/KeepInTouchView.cpp deleted file mode 100644 index 43c32c43fc..0000000000 --- a/Code/Tools/News/NewsShared/Qt/KeepInTouchView.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "KeepInTouchView.h" -#include "NewsShared/Qt/ui_KeepInTouchView.h" - -#include -#include -#include -#include - -namespace News -{ - KeepInTouchView::KeepInTouchView(QWidget* parent) - : QWidget(parent) - , m_ui(new Ui::KeepInTouchViewWidget()) - { - m_ui->setupUi(this); - - m_ui->twich_container->setCursor(Qt::PointingHandCursor); - m_ui->twitter_container->setCursor(Qt::PointingHandCursor); - m_ui->youtube_container->setCursor(Qt::PointingHandCursor); - m_ui->facebook_container->setCursor(Qt::PointingHandCursor); - - m_ui->twich_container->installEventFilter(this); - m_ui->twitter_container->installEventFilter(this); - m_ui->youtube_container->installEventFilter(this); - m_ui->facebook_container->installEventFilter(this); - } - - bool KeepInTouchView::eventFilter(QObject *watched, QEvent *event) - { - if (event->type() == QEvent::MouseButtonRelease) - { - if (watched == m_ui->twich_container) - { - return LaunchSocialMediaUrl(SocialMediaType::Twitch); - } - else if (watched == m_ui->twitter_container) - { - return LaunchSocialMediaUrl(SocialMediaType::Twitter); - } - else if (watched == m_ui->youtube_container) - { - return LaunchSocialMediaUrl(SocialMediaType::YouTube); - } - else if (watched == m_ui->facebook_container) - { - return LaunchSocialMediaUrl(SocialMediaType::Facebook); - } - } - - return QWidget::eventFilter(watched, event); - } - - bool KeepInTouchView::LaunchSocialMediaUrl(SocialMediaType type) - { - static const QMap socialMediaTypeToUrlMap = - { - { SocialMediaType::Twitch, m_twitchUrl }, - { SocialMediaType::Twitter, m_twitterUrl }, - { SocialMediaType::YouTube, m_youtubeUrl }, - { SocialMediaType::Facebook, m_facebookUrl } - }; - - if (socialMediaTypeToUrlMap.contains(type) == false) - { - return false; - } - - QString link = socialMediaTypeToUrlMap[type]; - Q_EMIT linkActivatedSignal(link); - - return QDesktopServices::openUrl(QUrl(link)); - } -} - -#include "NewsShared/Qt/moc_KeepInTouchView.cpp" diff --git a/Code/Tools/News/NewsShared/Qt/KeepInTouchView.h b/Code/Tools/News/NewsShared/Qt/KeepInTouchView.h deleted file mode 100644 index 5d5c6a9e36..0000000000 --- a/Code/Tools/News/NewsShared/Qt/KeepInTouchView.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Ui -{ - class KeepInTouchViewWidget; -} - -namespace News -{ - class KeepInTouchView - : public QWidget - { - Q_OBJECT - - enum class SocialMediaType - { - Twitch, - Twitter, - YouTube, - Facebook - }; - - public: - KeepInTouchView(QWidget* parent); - ~KeepInTouchView() = default; - - bool eventFilter(QObject *watched, QEvent *event); - - Q_SIGNALS: - void linkActivatedSignal(const QString& link); - - private: - bool LaunchSocialMediaUrl(SocialMediaType type); - - Ui::KeepInTouchViewWidget* m_ui = nullptr; - - const char* m_twitchUrl = "https://docs.aws.amazon.com/console/lumberyard/twitch"; - const char* m_twitterUrl = "https://docs.aws.amazon.com/console/lumberyard/twitter"; - const char* m_youtubeUrl = "https://docs.aws.amazon.com/console/lumberyard/youtube"; - const char* m_facebookUrl = "https://docs.aws.amazon.com/console/lumberyard/facebook"; - }; -} diff --git a/Code/Tools/News/NewsShared/Qt/KeepInTouchView.ui b/Code/Tools/News/NewsShared/Qt/KeepInTouchView.ui deleted file mode 100644 index 076059f49d..0000000000 --- a/Code/Tools/News/NewsShared/Qt/KeepInTouchView.ui +++ /dev/null @@ -1,423 +0,0 @@ - - - KeepInTouchViewWidget - - - - 0 - 0 - 430 - 336 - - - - - 0 - 0 - - - - - 430 - 0 - - - - - 430 - 16777215 - - - - ArticleView - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 430 - 184 - - - - - 430 - 184 - - - - - - - :/images/Resources/KeepInTouchBanner.jpg - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 20 - - - - - - - - - 0 - 0 - - - - - Open Sans - 14 - 50 - false - - - - Keep in touch! - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - false - - - Qt::LinksAccessibleByMouse - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 12 - - - - - - - - - 0 - 0 - - - - - Open Sans - 8 - 50 - false - - - - Want to know the latest news at AmazonGameDev? Sign up for our newsletter and use the following links to find us! - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - 0 - - - 0 - - - false - - - Qt::LinksAccessibleByMouse - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 16 - - - - - - - - background: transparent; - - - - 20 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 8 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - :/images/Resources/icon_twitch.png - - - - - - - Twitch - - - - - - - - - - - 0 - 0 - - - - - 8 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - :/images/Resources/icon_twitter.png - - - - - - - Twitter - - - - - - - - - - - 0 - 0 - - - - - 8 - - - 0 - - - 0 - - - 0 - - - - - - - - :/images/Resources/icon_youtube.png - - - - - - - Youtube - - - - - - - - - - - 8 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - :/images/Resources/icon_facebook.png - - - - - - - Facebook - - - - - - - - - - - - - - - - - AzQtComponents::ExtendedLabel - QLabel -
AzQtComponents/Components/ExtendedLabel.h
-
-
- - - - -
diff --git a/Code/Tools/News/NewsShared/Qt/NewsShared.qrc b/Code/Tools/News/NewsShared/Qt/NewsShared.qrc deleted file mode 100644 index 8d5b84494b..0000000000 --- a/Code/Tools/News/NewsShared/Qt/NewsShared.qrc +++ /dev/null @@ -1,10 +0,0 @@ - - - ../Resources/ErrorImage.jpg - ../Resources/KeepInTouchBanner.jpg - ../Resources/icon_facebook.png - ../Resources/icon_twitch.png - ../Resources/icon_twitter.png - ../Resources/icon_youtube.png - - diff --git a/Code/Tools/News/NewsShared/Qt/PinnedArticleView.ui b/Code/Tools/News/NewsShared/Qt/PinnedArticleView.ui deleted file mode 100644 index 928046a064..0000000000 --- a/Code/Tools/News/NewsShared/Qt/PinnedArticleView.ui +++ /dev/null @@ -1,260 +0,0 @@ - - - PinnedArticleViewWidget - - - - 0 - 0 - 430 - 376 - - - - - 0 - 0 - - - - - 430 - 0 - - - - - 430 - 16777215 - - - - ArticleView - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - pinned - - - - 12 - - - 16 - - - 16 - - - 16 - - - 16 - - - - - - 128 - 0 - - - - - 128 - 16777215 - - - - background-color: transparent; - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 128 - 96 - - - - - 128 - 96 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - background-color: transparent; - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - Open Sans - 14 - 50 - false - - - - Title: - - - true - - - false - - - Qt::LinksAccessibleByMouse - - - sectionTitle - - - - - - - - 0 - 0 - - - - - Open Sans - 8 - 50 - false - - - - Body - - - true - - - false - - - Qt::LinksAccessibleByMouse - - - - - - - - - - - - - - AzQtComponents::ExtendedLabel - QLabel -
AzQtComponents/Components/ExtendedLabel.h
-
-
- - -
diff --git a/Code/Tools/News/NewsShared/ResourceManagement/ArticleDescriptor.cpp b/Code/Tools/News/NewsShared/ResourceManagement/ArticleDescriptor.cpp deleted file mode 100644 index c26d2357d7..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/ArticleDescriptor.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ArticleDescriptor.h" -#include "Resource.h" - -#include -#include - -using namespace News; - -ArticleDescriptor::ArticleDescriptor( - Resource& resource) - : JsonDescriptor(resource) - , m_imageId(m_json["image"].toString()) - , m_title(m_json["title"].toString()) - , m_body(m_json["body"].toString()) - , m_order(m_json["order"].toInt()) -{ - if (m_json.contains("articleStyle") == true) - { - m_articleStyle = m_json["articleStyle"].toString(); - } -} - -void ArticleDescriptor::Update() const -{ - QJsonObject json; - json["image"] = m_imageId; - json["title"] = m_title; - json["body"] = m_body; - json["order"] = m_order; - json["articleStyle"] = m_articleStyle; - QJsonDocument doc(json); - QByteArray data = doc.toJson(QJsonDocument::Compact).toStdString().data(); - m_resource.SetData(data); -} - -const QString& ArticleDescriptor::GetArticleStyle() const -{ - return m_articleStyle; -} - -void ArticleDescriptor::SetArticleStyle(const QString& style) -{ - m_articleStyle = style; -} - -const QString& ArticleDescriptor::GetImageId() const -{ - return m_imageId; -} - -void ArticleDescriptor::SetImageId(const QString& imageId) -{ - m_imageId = imageId; -} - -const QString& ArticleDescriptor::GetTitle() const -{ - return m_title; -} - -void ArticleDescriptor::SetTitle(const QString& title) -{ - m_title = title; -} - -const QString& ArticleDescriptor::GetBody() const -{ - return m_body; -} - -void ArticleDescriptor::SetBody(const QString& body) -{ - m_body = body; -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/ArticleDescriptor.h b/Code/Tools/News/NewsShared/ResourceManagement/ArticleDescriptor.h deleted file mode 100644 index c0ca459cf4..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/ArticleDescriptor.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include "JsonDescriptor.h" - -#include - -namespace News -{ - class Resource; - - //! ArticleDescriptor represents Resource as an article - class ArticleDescriptor - : public JsonDescriptor - { - public: - explicit ArticleDescriptor(Resource& resource); - - //! If article was modified, call this to update resource data - void Update() const; - - const QString& GetArticleStyle() const; - - void SetArticleStyle(const QString& style); - - const QString& GetImageId() const; - - void SetImageId(const QString& imageId); - - const QString& GetTitle() const; - - void SetTitle(const QString& title); - - const QString& GetBody() const; - - void SetBody(const QString& body); - - private: - QString m_articleStyle = "default"; - QString m_imageId; - QString m_title; - QString m_body; - int m_order; - }; -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/Descriptor.cpp b/Code/Tools/News/NewsShared/ResourceManagement/Descriptor.cpp deleted file mode 100644 index 0d21a18c05..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/Descriptor.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Descriptor.h" - -using namespace News; - -Descriptor::Descriptor(Resource& resource) - : m_resource(resource) {} - -Descriptor::~Descriptor() {} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/Descriptor.h b/Code/Tools/News/NewsShared/ResourceManagement/Descriptor.h deleted file mode 100644 index 3d56037543..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/Descriptor.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -namespace News -{ - class Resource; - - //! Descriptor is a simple solution to add additional functionality to a Resource - /*! - Some descriptors can only work with certain resource types, like AerticleDescriptor - */ - class Descriptor - { - public: - explicit Descriptor(Resource& resource); - virtual ~Descriptor(); - - Resource& GetResource() const - { - return m_resource; - } - - protected: - Resource& m_resource; - }; -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/JsonDescriptor.cpp b/Code/Tools/News/NewsShared/ResourceManagement/JsonDescriptor.cpp deleted file mode 100644 index 5e71c8f10b..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/JsonDescriptor.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "JsonDescriptor.h" -#include "Resource.h" - -#include - -using namespace News; - -JsonDescriptor::JsonDescriptor(Resource& resource) - : Descriptor(resource) - , m_doc(QJsonDocument::fromJson(m_resource.GetData())) - , m_json(m_doc.object()) -{ -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/JsonDescriptor.h b/Code/Tools/News/NewsShared/ResourceManagement/JsonDescriptor.h deleted file mode 100644 index 286e66c4ac..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/JsonDescriptor.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include "Descriptor.h" - -#include -#include - -namespace News -{ - //! JsonDescriptor assumes Resource is a JSON file - class JsonDescriptor - : public Descriptor - { - public: - explicit JsonDescriptor(Resource& resource); - - protected: - QJsonDocument m_doc; - QJsonObject m_json; - }; -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/QtDownloadManager.cpp b/Code/Tools/News/NewsShared/ResourceManagement/QtDownloadManager.cpp deleted file mode 100644 index e70285fd31..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/QtDownloadManager.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "QtDownloadManager.h" -#include "QtDownloader.h" - -namespace News -{ - -QtDownloadManager::QtDownloadManager() - : QObject() - , m_worker(new QtDownloader) // this will start the thread which does downloads -{ - // make sure the response handlers are queued connections as the worker runs in a different thread - connect(m_worker, &QtDownloader::failed, this, &QtDownloadManager::failedReply, Qt::QueuedConnection); - connect(m_worker, &QtDownloader::successfullyFinished, this, &QtDownloadManager::successfulReply, Qt::QueuedConnection); -} - -QtDownloadManager::~QtDownloadManager() -{ - // NOTE: we don't delete the QtDownloader; it deletes itself. - // We just tell it to stop - m_worker->Finish(); -} - -void QtDownloadManager::Download(const QString& url, - std::function downloadSuccessCallback, - std::function downloadFailCallback) -{ - int downloadId = m_worker->Download(url); - m_downloads[downloadId] = { downloadSuccessCallback, downloadFailCallback }; -} - -void QtDownloadManager::Abort() -{ - m_worker->Abort(); - m_downloads.clear(); -} - -void QtDownloadManager::successfulReply(int downloadId, QByteArray data) -{ - m_downloads[downloadId].downloadSuccessCallback(data); - m_downloads.remove(downloadId); -} - -void QtDownloadManager::failedReply(int downloadId) -{ - m_downloads[downloadId].downloadFailCallback(); - m_downloads.remove(downloadId); -} - -} // namespace News - -#include "NewsShared/ResourceManagement/moc_QtDownloadManager.cpp" diff --git a/Code/Tools/News/NewsShared/ResourceManagement/QtDownloadManager.h b/Code/Tools/News/NewsShared/ResourceManagement/QtDownloadManager.h deleted file mode 100644 index 6a7c93a51f..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/QtDownloadManager.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include - -#include -#include -#endif - -namespace News -{ - class QtDownloader; - - //! QtDownloadManager handles multiple asynchronous downloads - class QtDownloadManager - : public QObject - { - Q_OBJECT - public: - QtDownloadManager(); - ~QtDownloadManager(); - - //! Asynchronously download a file from the input url and return it as QByteArray via the success callback - /*! - \param url - file url to download - \param downloadSuccessCallback - if download is successful pass file's data as QByteArray - \param downloadFailCallback - if download failed, pass error message - */ - void Download(const QString& url, - std::function downloadSuccessCallback, - std::function downloadFailCallback); - - //! Aborts all currently active downloads. Success/failure callbacks will not be called. - void Abort(); - - private: - void successfulReply(int downloadId, QByteArray data); - void failedReply(int downloadId); - - QtDownloader* m_worker = nullptr; - - struct DownloadResponses - { - std::function downloadSuccessCallback; - std::function downloadFailCallback; - }; - QMap m_downloads; - }; -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/QtDownloader.cpp b/Code/Tools/News/NewsShared/ResourceManagement/QtDownloader.cpp deleted file mode 100644 index 0139ec5344..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/QtDownloader.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "QtDownloader.h" - -#include -#include -#include -#include - - -namespace News -{ - QtDownloader::QtDownloader() - : m_thread(new QThread()) - { - // make sure that everything that QObject::connects to us knows we're running in a different thread - moveToThread(m_thread); - - // handle clean up of both ourselves and of our thread. - // We manage thread clean up so that it can keep running and be cleaned up later, regardless of what - // the thing that created the QtDownloader does - connect(m_thread, &QThread::finished, m_thread, [this] { - m_thread->deleteLater(); - deleteLater(); - }); - - auto abortDownloadsHandler = [this] { - auto replies = m_downloads.keys(); - for (QNetworkReply* reply : replies) - { - reply->abort(); - } - - m_downloads.clear(); - }; - - auto queueDownloadHandler = [this](int downloadId, QString url) { - if (m_networkManager) - { - QNetworkReply* reply = m_networkManager->get(QNetworkRequest(QUrl(url))); - m_downloads.insert(reply, downloadId); - } - }; - - auto createNetworkManagerHandler = [this] { - m_networkManager = new QNetworkAccessManager; - connect(m_networkManager, &QNetworkAccessManager::finished, this, &QtDownloader::downloadFinished); - }; - - auto deleteNetworkManagerHandler = [this] { - delete m_networkManager; - m_networkManager = nullptr; - }; - - auto quitHandler = [this] { - // call quit via this callback, so that it executes in the running thread. - // QThread::quit() is actually blocking and waits until everything finishes, so - // we don't want to call it in the main thread - m_thread->quit(); - }; - - // make sure the response handlers are queued connections as the worker runs in one thread, but these triggers - // will be emitted from the main thread - connect(this, &QtDownloader::triggerAbortAll, this, abortDownloadsHandler, Qt::QueuedConnection); - connect(this, &QtDownloader::triggerDownload, this, queueDownloadHandler, Qt::QueuedConnection); - connect(this, &QtDownloader::triggerQuit, this, quitHandler, Qt::QueuedConnection); - - // create/delete the QNetworkAccessManager in our thread, to ensure that any slowdowns caused by - // having to create network connectors / load drivers are done in our non-ui thread. - // make sure that these connections are direct so that network requests can't predate the network engine itself - connect(m_thread, &QThread::started, this, createNetworkManagerHandler, Qt::DirectConnection); - connect(m_thread, &QThread::finished, this, deleteNetworkManagerHandler, Qt::DirectConnection); - - m_thread->start(); - } - - QtDownloader::~QtDownloader() - { - } - - int QtDownloader::Download(const QString& url) - { - // create a unique id for this download - int downloadId = m_lastId++; - - // trigger a download running in our worker thread - Q_EMIT triggerDownload(downloadId, url); - - return downloadId; - } - - void QtDownloader::Abort() - { - // trigger an abort in our worker thread - Q_EMIT triggerAbortAll(); - } - - void QtDownloader::Finish() - { - // trigger a quit in our worker thread - Q_EMIT triggerQuit(); - } - - void QtDownloader::downloadFinished(QNetworkReply* reply) - { - // Note: this will run in our worker thread - int downloadId = m_downloads[reply]; - - // emit the signal back to the main thread indicating that we're finished, either - // successfully or unsuccessfully - if (reply->error() == QNetworkReply::NoError) - { - Q_EMIT successfullyFinished(downloadId, reply->readAll()); - } - else - { - Q_EMIT failed(downloadId); - } - - // clean up the reply; have to do this later, according to the Qt docs - reply->deleteLater(); - - // make sure to remove our reference to this reply from our list of active downloads - m_downloads.remove(reply); - } - - #include "NewsShared/ResourceManagement/moc_QtDownloader.cpp" -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/QtDownloader.h b/Code/Tools/News/NewsShared/ResourceManagement/QtDownloader.h deleted file mode 100644 index 0dcc86e951..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/QtDownloader.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include -#endif - -class QNetworkAccessManager; -class QNetworkReply; -class QThread; - -namespace News -{ - //! QtDownloader is a wrapper around Qt's file download functions - /*! - The QtDownloader spins up another thread and does all downloads in that thread. - The public slot methods (Finish, Download and Abort) can all be called from any thread. - The response signals (successfullyFinished and failed) should be QObject::connect to with - Qt::QueuedConnection, as they will be emitted from the worker thread. - */ - class QtDownloader - : public QObject - { - Q_OBJECT - - public: - QtDownloader(); - ~QtDownloader(); - - public Q_SLOTS: - void Finish(); - - int Download(const QString& url); - void Abort(); - - Q_SIGNALS: - void successfullyFinished(int downloadId, QByteArray data); - void failed(int downloadId); - - // *********************************************** - // private - DO NOT CONNECT TO outside of the class! - // (qt signals can't be made private) - void triggerAbortAll(); - void triggerDownload(int downloadId, QString url); - void triggerQuit(); - // *********************************************** - - private: - void downloadFinished(QNetworkReply* reply); - - int m_lastId = 0; - - QMap m_downloads; - QNetworkAccessManager* m_networkManager = nullptr; - QThread* m_thread; - }; -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/Resource.cpp b/Code/Tools/News/NewsShared/ResourceManagement/Resource.cpp deleted file mode 100644 index d40b66d6d7..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/Resource.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Resource.h" - -#include - -using namespace News; - -Resource::Resource(const QJsonObject& json) - : Resource( - json["id"].toString(), - QByteArray(), - json["url"].toString(), - json["type"].toString(), - json["refCount"].toInt(), - json["version"].toInt()) {} - -Resource::Resource(const QString& id, const QString& type) - : Resource( - id, - QByteArray(), - "", - type, - 1, - 0) {} - -Resource::Resource(const QString& id, - const QByteArray& data, - [[maybe_unused]] const QString& url, - const QString& type, - int refCount, - int version) - : m_id(id) - , m_data(data) - , m_type(type) - , m_refCount(refCount) - , m_version(version) {} - -Resource::~Resource() {} - -void Resource::Write(QJsonObject& json) const -{ - json["id"] = m_id; - json["type"] = m_type; - json["refCount"] = m_refCount; - json["version"] = m_version; -} - -QString Resource::GetId() const -{ - return m_id; -} - -void Resource::SetId(const QString& id) -{ - m_id = id; -} - -QByteArray Resource::GetData() const -{ - return m_data; -} - -void Resource::SetData(QByteArray data) -{ - m_data = data; -} - -QString Resource::GetType() const -{ - return m_type; -} - -int Resource::GetRefCount() const -{ - return m_refCount; -} - -void Resource::SetRefCount(int refCount) -{ - m_refCount = refCount; -} - -int Resource::GetVersion() const -{ - return m_version; -} - -void Resource::SetVersion(int version) -{ - m_version = version; -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/Resource.h b/Code/Tools/News/NewsShared/ResourceManagement/Resource.h deleted file mode 100644 index 1174fea788..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/Resource.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -class QJsonObject; - -namespace News -{ - class Descriptor; - - //! Resource is a central element of in-editor messages - //! It represents articles, images, and anything else that is part of news feed - class Resource - { - public: - //! resources are stored as json objects in \ref News::ResourceManifest - //! this creates resource with empty data array, that can be downloaded later - //! by calling News::ResourceManifest::Sync - explicit Resource(const QJsonObject& json); - - explicit Resource(const QString& id, - const QString& type); - - Resource(const QString& id, - const QByteArray& data, - const QString& url, - const QString& type, - int refCount, - int version); - - ~Resource(); - - //! Saves resource's description to a json file - void Write(QJsonObject& json) const; - - QString GetId() const; - - void SetId(const QString& id); - - QByteArray GetData() const; - - void SetData(QByteArray data); - - QString GetType() const; - - int GetRefCount() const; - - void SetRefCount(int refCount); - - int GetVersion() const; - - void SetVersion(int version); - - private: - QString m_id; - QByteArray m_data; - QString m_type; - int m_refCount; - int m_version; - }; -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/ResourceManifest.cpp b/Code/Tools/News/NewsShared/ResourceManagement/ResourceManifest.cpp deleted file mode 100644 index 969c4ec8f1..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/ResourceManifest.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ResourceManifest.h" -#include "NewsShared/ResourceManagement/QtDownloadManager.h" -#include "NewsShared/ResourceManagement/Resource.h" -#include "NewsShared/ResourceManagement/ArticleDescriptor.h" - -#include -#include -#include -#include -#include - -namespace News -{ - - const QString ResourceManifest::MANIFEST_NAME = "resourceManifest"; - bool ResourceManifest::s_syncing = false; - - ResourceManifest::ResourceManifest( - std::function syncSuccessCallback, - std::function syncFailCallback, - std::function syncUpdateCallback) - : m_downloader(new QtDownloadManager) - , m_syncSuccessCallback(syncSuccessCallback) - , m_syncFailCallback(syncFailCallback) - , m_syncUpdateCallback(syncUpdateCallback) - { - } - - ResourceManifest::~ResourceManifest() - { - // clean everything up - DeleteResources(); - - delete m_downloader; - } - - Resource* ResourceManifest::FindById(const QString& id) const - { - return FindById(id, m_resources); - } - - Resource* ResourceManifest::FindById(const QString& id, const QList& resources) - { - auto it = std::find_if( - resources.begin(), - resources.end(), - [id](Resource* resource) -> bool - { - return resource->GetId().compare(id) == 0; - }); - if (it == resources.end()) - { - return nullptr; - } - return *it; - } - - Resource* ResourceManifest::FindById(const QString& id, - const QStack& resources) - { - auto it = std::find_if( - resources.begin(), - resources.end(), - [id](Resource* resource) -> bool - { - return resource->GetId().compare(id) == 0; - }); - if (it == resources.end()) - { - return nullptr; - } - return *it; - } - - void ResourceManifest::Sync() - { - if (s_syncing) - { - FailSync(ErrorCode::AlreadySyncing); - return; - } - s_syncing = true; - m_failed = false; - - m_syncUpdateCallback("Starting sync", LogInfo); - - ReadConfig(); - - // first download the manifest json - m_syncUpdateCallback("Downloading manifest", LogInfo); - m_downloader->Download(QString(m_url).append(MANIFEST_NAME), - std::bind(&ResourceManifest::OnDownloadSuccess, this, std::placeholders::_1), - std::bind(&ResourceManifest::OnDownloadFail, this)); - } - - void ResourceManifest::Abort() - { - m_aborted = true; - m_downloader->Abort(); - } - - void ResourceManifest::Reset() - { - if (s_syncing) - { - m_syncUpdateCallback("Sync is already running", LogError); - return; - } - - m_aborted = false; - m_failed = false; - m_version = -1; - - DeleteResources(); - - m_order.clear(); - } - - QList::const_iterator ResourceManifest::begin() const - { - return m_resources.constBegin(); - } - - QList::const_iterator ResourceManifest::end() const - { - return m_resources.constEnd(); - } - - QList ResourceManifest::GetOrder() const - { - return m_order; - } - - void ResourceManifest::OnDownloadSuccess(QByteArray data) - { - QJsonDocument doc(QJsonDocument::fromJson(data)); - if (doc.isNull()) - { - FailSync(ErrorCode::FailedToParseManifest); - return; - } - - ErrorCode error = Read(doc.object()); - if (error != ErrorCode::None) - { - FailSync(error); - return; - } - - // check how many resources to sync - PrepareForSync(); - // if there is anything to sync, do that - if (m_syncLeft > 0) - { - m_syncUpdateCallback("Syncing resources", LogInfo); - SyncResources(); - } - // otherwise just finish sync - else - { - m_syncUpdateCallback("No new resources to sync", LogInfo); - FinishSync(); - } - } - - void ResourceManifest::OnDownloadFail() - { - FailSync(ErrorCode::ManifestDownloadFail); - } - - ErrorCode ResourceManifest::Read(const QJsonObject& json) - { - m_version = json["version"].toInt(); - QJsonArray resourceArray = json["resources"].toArray(); - // initially mark ALL existing resource for deletion - QList toDelete = m_resources; - - for (auto resourceDoc : resourceArray) - { - auto pNewResource = new Resource(resourceDoc.toObject()); - // find local resource with the same id as new resource - auto pOldResource = FindById(pNewResource->GetId(), m_resources); - // if resource with the same id already exists then check its version - if (pOldResource) - { - // local resource is outdated, keep it in delete list, and download new one instead - if (pNewResource->GetVersion() > pOldResource->GetVersion()) - { - m_toDownload.push(pNewResource); - } - // local resource is newer or same version, keep it (remove from toDelete list) - // and don't need to download new one - else - { - delete pNewResource; - toDelete.removeAll(pOldResource); - } - } - // resource with same id not found - else - { - m_toDownload.push(pNewResource); - } - } - - // delete everything that's not in s3 - for (auto pResource : toDelete) - { - RemoveResource(pResource); - delete pResource; - } - - // parse order of articles - m_order.clear(); - QJsonArray orderArray = json["order"].toArray(); - for (auto idObject : orderArray) - { - m_order.append(idObject.toString()); - } - return ErrorCode::None; - } - - void ResourceManifest::PrepareForSync() - { - if (m_aborted) - { - m_syncLeft = 0; - } - - m_syncLeft = m_toDownload.count(); - } - - void ResourceManifest::SyncResources() - { - DownloadResources(); - } - - void ResourceManifest::DownloadResources() - { - while (m_toDownload.count() > 0) - { - m_syncUpdateCallback( - QString("Downloading: %1 resources left").arg(m_toDownload.count()), - LogInfo); - - auto pResource = m_toDownload.pop(); - - m_downloader->Download(QString(m_url).append(pResource->GetId()), - //download success - [&, pResource](QByteArray data) - { - pResource->SetData(data); - AppendResource(pResource); - UpdateSync(); - }, - //download fail - [&, pResource]() - { - m_failed = true; - delete pResource; - m_syncUpdateCallback("Failed to download resource", LogError); - UpdateSync(); - }); - } - } - - void ResourceManifest::ReadConfig() - { - QFile file(QCoreApplication::applicationDirPath() + "/newsConfig.txt"); - if (file.exists()) - { - if (file.open(QIODevice::ReadOnly)) - { - QTextStream in(&file); - m_url = in.readAll().trimmed(); - file.close(); - } - } - } - - void ResourceManifest::DeleteResources() - { - for (auto pResource : m_toDownload) - { - delete pResource; - } - m_toDownload.clear(); - - for (auto pResource : m_resources) - { - delete pResource; - } - m_resources.clear(); - } - - void ResourceManifest::UpdateSync() - { - m_syncLeft--; - if (m_syncLeft == 0) - { - if (!m_failed) - { - FinishSync(); - } - else - { - FailSync(ErrorCode::FailedToSync); - } - } - } - - void ResourceManifest::FinishSync() - { - if (!m_failed) - { - m_syncSuccessCallback(); - } - else - { - m_syncFailCallback(m_errorCode); - } - s_syncing = false; - } - - void ResourceManifest::FailSync(ErrorCode error) - { - m_failed = true; - m_errorCode = error; - FinishSync(); - } - - void ResourceManifest::AppendResource(Resource* pResource) - { - m_resources.append(pResource); - } - - void ResourceManifest::RemoveResource(Resource* pResource) - { - m_resources.removeAll(pResource); - } - -} diff --git a/Code/Tools/News/NewsShared/ResourceManagement/ResourceManifest.h b/Code/Tools/News/NewsShared/ResourceManagement/ResourceManifest.h deleted file mode 100644 index 3a0f31de8f..0000000000 --- a/Code/Tools/News/NewsShared/ResourceManagement/ResourceManifest.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include -#include -#include - -#include "NewsShared/LogType.h" -#include "NewsShared/ErrorCodes.h" - -class QJsonObject; - -namespace News -{ - class ArticleDescriptor; - class UidGenerator; - class S3Connector; - class QtDownloadManager; - class Descriptor; - class DownloadDescriptor; - class Resource; - - //! ResourceManifest manages resources. - /*! - Manifest contains information on resources, it handles syncing resources with s3 - */ - class ResourceManifest - { - public: - //! ResourceManifest ctor - /*! - \param syncSuccessCallback - called once when everything is synced - \param syncFailCallback - called once when sync failed - \param syncUpdateCallback - called multiple times to update information on sync process - */ - explicit ResourceManifest( - std::function syncSuccessCallback, - std::function syncFailCallback, - std::function syncUpdateCallback); - virtual ~ResourceManifest(); - - //! Find a resource that matches id - /*! - \retval Resource * - a pointer to a Resource with matching id, if none found return nullptr - */ - Resource* FindById(const QString& id) const; - static Resource* FindById(const QString& id, const QList& resources); - static Resource* FindById(const QString& id, const QStack& resources); - - //! Sync resources with s3 - /* - 1) First download resource manifest file - 2) Parse manifest - 3) Determine which resources need to be downloaded, updated, or deleted - 4) Download missing resources or resource that are out of date - 5) Call m_syncSuccessCallback - */ - virtual void Sync(); - - //! Gracegully stop sync process - /*! - Aborting works differently depending at what point during sync porocess it is called - If called before resources started to download, then skip download altogether - Otherwise gracefully abort all downloads and call m_syncFailCallback - */ - void Abort(); - - //! Called when switching endpoints to reset resource manifest to a clean state - virtual void Reset(); - - QList::const_iterator begin() const; - QList::const_iterator end() const; - - //! Get order of article resources, so they can be displayed properly in ArticleViewContainer - QList GetOrder() const; - - protected: - //! The root location of cloudfront resources - QString m_url = "https://lumberyard-data.amazon.com/"; - //! Name of resourceManifest file that links all other resources - static const QString MANIFEST_NAME; - //! Identifies whether syncing is in progress - static bool s_syncing; - //! Manifest Version - int m_version = -1; - //! Number of resources left to sync - int m_syncLeft = 0; - //! Identifies whether sync process was aborted - bool m_aborted = false; - //! Indentifies whether sync process has failed - bool m_failed = false; - ErrorCode m_errorCode = ErrorCode::None; - - QtDownloadManager* m_downloader = nullptr; - - QList m_resources; - QList m_order; - QStack m_toDownload; - - std::function m_syncSuccessCallback; - std::function m_syncFailCallback; - std::function m_syncUpdateCallback; - - //! Parse resource manifest json, and figure out which resources need to be downloaded - virtual ErrorCode Read(const QJsonObject& json); - - //! Executed before sync to figure out how many resources need to be synced - virtual void PrepareForSync(); - //! Actual sync function - virtual void SyncResources(); - //! Check whether everything is synced, if so call ResourceManifest::FinishSync - void UpdateSync(); - //! Notify that everything is synced - virtual void FinishSync(); - void FailSync(ErrorCode error); - - virtual void AppendResource(Resource* pResource); - virtual void RemoveResource(Resource* pResource); - - virtual void OnDownloadSuccess(QByteArray data); - virtual void OnDownloadFail(); - virtual void DownloadResources(); - - private: - void ReadConfig(); - void DeleteResources(); - }; -} // namespace News diff --git a/Code/Tools/News/NewsShared/Resources/ErrorImage.jpg b/Code/Tools/News/NewsShared/Resources/ErrorImage.jpg deleted file mode 100644 index 216fe14bd5..0000000000 --- a/Code/Tools/News/NewsShared/Resources/ErrorImage.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0a7430d63820b3b00e03b4a8ec73b5e8e3946659031e3aeeb355b632acca4122 -size 8857 diff --git a/Code/Tools/News/NewsShared/Resources/KeepInTouchBanner.jpg b/Code/Tools/News/NewsShared/Resources/KeepInTouchBanner.jpg deleted file mode 100644 index b47040b717..0000000000 --- a/Code/Tools/News/NewsShared/Resources/KeepInTouchBanner.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:09c1733f116c11b56c54f7c3b6b4462884116db06605ca3cdfa23c45a3695385 -size 68024 diff --git a/Code/Tools/News/NewsShared/Resources/icon_facebook.png b/Code/Tools/News/NewsShared/Resources/icon_facebook.png deleted file mode 100644 index 0fb823969b..0000000000 --- a/Code/Tools/News/NewsShared/Resources/icon_facebook.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f8b5493c81354b6757a21bea6baedd5665b8cb9ca19a6ff4fbd40afef534f35f -size 1257 diff --git a/Code/Tools/News/NewsShared/Resources/icon_twitch.png b/Code/Tools/News/NewsShared/Resources/icon_twitch.png deleted file mode 100644 index 50d7436b0d..0000000000 --- a/Code/Tools/News/NewsShared/Resources/icon_twitch.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2882aad73e2ecf310934ec3eacd0c1fa0a6ff012a4c3c9cf4ca96a72cef2fb8c -size 514 diff --git a/Code/Tools/News/NewsShared/Resources/icon_twitter.png b/Code/Tools/News/NewsShared/Resources/icon_twitter.png deleted file mode 100644 index d1cf7eb3dd..0000000000 --- a/Code/Tools/News/NewsShared/Resources/icon_twitter.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:046e14f1d90f77bb6ea0fe700bb10049748b46bb84c8ac3620642d4bca9df533 -size 954 diff --git a/Code/Tools/News/NewsShared/Resources/icon_youtube.png b/Code/Tools/News/NewsShared/Resources/icon_youtube.png deleted file mode 100644 index d3e7869387..0000000000 --- a/Code/Tools/News/NewsShared/Resources/icon_youtube.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3abaf8b178763441ac6812ae518c2f8cbea9b228aa1f84052a65836b33dc980c -size 976 diff --git a/Code/Tools/News/news_shared_files.cmake b/Code/Tools/News/news_shared_files.cmake deleted file mode 100644 index 2f20029068..0000000000 --- a/Code/Tools/News/news_shared_files.cmake +++ /dev/null @@ -1,45 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - NewsShared/LogType.h - NewsShared/ErrorCodes.h - NewsShared/Qt/ArticleErrorView.cpp - NewsShared/Qt/ArticleErrorView.h - NewsShared/Qt/ArticleErrorView.ui - NewsShared/Qt/ArticleView.cpp - NewsShared/Qt/ArticleView.h - NewsShared/Qt/ArticleView.ui - NewsShared/Qt/PinnedArticleView.ui - NewsShared/Qt/ArticleViewContainer.cpp - NewsShared/Qt/ArticleViewContainer.h - NewsShared/Qt/ArticleViewContainer.ui - NewsShared/Qt/KeepInTouchView.cpp - NewsShared/Qt/KeepInTouchView.h - NewsShared/Qt/KeepInTouchView.ui - NewsShared/Qt/NewsShared.qrc - NewsShared/ResourceManagement/ArticleDescriptor.cpp - NewsShared/ResourceManagement/ArticleDescriptor.h - NewsShared/ResourceManagement/Descriptor.cpp - NewsShared/ResourceManagement/Descriptor.h - NewsShared/ResourceManagement/JsonDescriptor.cpp - NewsShared/ResourceManagement/JsonDescriptor.h - NewsShared/ResourceManagement/QtDownloader.cpp - NewsShared/ResourceManagement/QtDownloader.h - NewsShared/ResourceManagement/QtDownloadManager.cpp - NewsShared/ResourceManagement/QtDownloadManager.h - NewsShared/ResourceManagement/Resource.cpp - NewsShared/ResourceManagement/Resource.h - NewsShared/ResourceManagement/ResourceManifest.cpp - NewsShared/ResourceManagement/ResourceManifest.h - NewsShared/Resources/ErrorImage.jpg - NewsShared/Resources/KeepInTouchBanner.jpg - NewsShared/Resources/icon_facebook.png - NewsShared/Resources/icon_twitch.png - NewsShared/Resources/icon_twitter.png - NewsShared/Resources/icon_youtube.png -)