Removes WinWidget from Code/Editor/Plugins/EditorCommon
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -66,11 +66,6 @@ struct SEditorSettings;
|
||||
class CGameExporter;
|
||||
class IAWSResourceManager;
|
||||
|
||||
namespace WinWidget
|
||||
{
|
||||
class WinWidgetManager;
|
||||
}
|
||||
|
||||
struct ISystem;
|
||||
struct IRenderer;
|
||||
struct AABB;
|
||||
@@ -586,10 +581,6 @@ struct IEditor
|
||||
virtual bool SetViewFocus(const char* sViewClassName) = 0;
|
||||
virtual void CloseView(const GUID& classId) = 0; // close ALL panels related to classId, used when unloading plugins.
|
||||
|
||||
// We want to open a view object but not wrap it in a view pane)
|
||||
virtual QWidget* OpenWinWidget(WinWidgetId openId) = 0;
|
||||
virtual WinWidget::WinWidgetManager* GetWinWidgetManager() const = 0;
|
||||
|
||||
//! Opens standard color selection dialog.
|
||||
//! Initialized with the color specified in color parameter.
|
||||
//! Returns true if selection is made and false if selection is canceled.
|
||||
|
||||
@@ -75,9 +75,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.h"
|
||||
#include "Editor/AssetEditor/AssetEditorRequestsHandler.h"
|
||||
|
||||
// EditorCommon
|
||||
#include <WinWidget/WinWidgetManager.h>
|
||||
|
||||
// AWSNativeSDK
|
||||
#include <AWSNativeSDKInit/AWSNativeSDKInit.h>
|
||||
|
||||
@@ -177,8 +174,6 @@ CEditorImpl::CEditorImpl()
|
||||
DetectVersion();
|
||||
RegisterTools();
|
||||
|
||||
m_winWidgetManager.reset(new WinWidget::WinWidgetManager);
|
||||
|
||||
m_pAssetDatabaseLocationListener = nullptr;
|
||||
m_pAssetBrowserRequestHandler = nullptr;
|
||||
m_assetEditorRequestsHandler = nullptr;
|
||||
@@ -847,20 +842,6 @@ const QtViewPane* CEditorImpl::OpenView(QString sViewClassName, bool reuseOpened
|
||||
return QtViewPaneManager::instance()->OpenPane(sViewClassName, openMode);
|
||||
}
|
||||
|
||||
QWidget* CEditorImpl::OpenWinWidget(WinWidgetId openId)
|
||||
{
|
||||
if (m_winWidgetManager)
|
||||
{
|
||||
return m_winWidgetManager->OpenWinWidget(openId);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WinWidget::WinWidgetManager* CEditorImpl::GetWinWidgetManager() const
|
||||
{
|
||||
return m_winWidgetManager.get();
|
||||
}
|
||||
|
||||
QWidget* CEditorImpl::FindView(QString viewClassName)
|
||||
{
|
||||
return QtViewPaneManager::instance()->GetView(viewClassName);
|
||||
|
||||
@@ -53,11 +53,6 @@ namespace Editor
|
||||
class EditorQtApplication;
|
||||
}
|
||||
|
||||
namespace WinWidget
|
||||
{
|
||||
class WinWidgetManager;
|
||||
}
|
||||
|
||||
namespace AssetDatabase
|
||||
{
|
||||
class AssetDatabaseLocationListener;
|
||||
@@ -221,9 +216,6 @@ public:
|
||||
bool CloseView(const char* sViewClassName) override;
|
||||
bool SetViewFocus(const char* sViewClassName) override;
|
||||
|
||||
QWidget* OpenWinWidget(WinWidgetId openId) override;
|
||||
WinWidget::WinWidgetManager* GetWinWidgetManager() const override;
|
||||
|
||||
// close ALL panels related to classId, used when unloading plugins.
|
||||
void CloseView(const GUID& classId) override;
|
||||
bool SelectColor(QColor &color, QWidget *parent = 0) override;
|
||||
@@ -370,7 +362,6 @@ protected:
|
||||
QString m_levelNameBuffer;
|
||||
|
||||
IAWSResourceManager* m_awsResourceManager;
|
||||
std::unique_ptr<WinWidget::WinWidgetManager> m_winWidgetManager;
|
||||
|
||||
//! True if the editor is in material edit mode. Fast preview of materials.
|
||||
//! In this mode only very limited functionality is available.
|
||||
|
||||
@@ -128,8 +128,6 @@ public:
|
||||
MOCK_METHOD1(CloseView, bool(const char* ));
|
||||
MOCK_METHOD1(SetViewFocus, bool(const char* ));
|
||||
MOCK_METHOD1(CloseView, void(const GUID& ));
|
||||
MOCK_METHOD1(OpenWinWidget, QWidget* (WinWidgetId ));
|
||||
MOCK_CONST_METHOD0(GetWinWidgetManager, WinWidget::WinWidgetManager* ());
|
||||
MOCK_METHOD2(SelectColor, bool(QColor &, QWidget *));
|
||||
MOCK_METHOD0(GetUndoManager, class CUndoManager* ());
|
||||
MOCK_METHOD0(BeginUndo, void());
|
||||
|
||||
@@ -1,26 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by EditorCommon.rc
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#define _APS_NEXT_RESOURCE_VALUE 1000
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 1000
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#endif
|
||||
#endif
|
||||
@@ -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
|
||||
|
||||
#include "EditorCommonAPI.h"
|
||||
#include "IEditor.h"
|
||||
|
||||
|
||||
#include <WinWidget/WinWidgetManager.h>
|
||||
#include <Core/QtEditorApplication.h>
|
||||
#include <QWidget>
|
||||
|
||||
namespace WinWidget
|
||||
{
|
||||
template<class TWidget>
|
||||
bool RegisterWinWidget()
|
||||
{
|
||||
static QWidget* winWidget {nullptr}; // Must declare outside of lambda
|
||||
|
||||
WinWidget::WinWidgetManager::WinWidgetCreateCall createCall = []() -> QWidget*
|
||||
{
|
||||
if (!winWidget)
|
||||
{
|
||||
winWidget = new QWidget(GetIEditor()->GetEditorMainWindow());
|
||||
}
|
||||
|
||||
// Ensure only one instance of each window type exists
|
||||
QList<TWidget*> existingWidgets = winWidget->findChildren<TWidget*>();
|
||||
if (existingWidgets.size() > 0) // Note that the list should contain 0 or 1 entries
|
||||
{
|
||||
if (existingWidgets.first()->isVisible())
|
||||
{
|
||||
return nullptr; // TWidget type already in use - continue using it and don't create another
|
||||
}
|
||||
delete existingWidgets.first(); // Closed TWidget - remove
|
||||
}
|
||||
|
||||
TWidget* createWidget = new TWidget(winWidget);
|
||||
|
||||
createWidget->Display();
|
||||
return winWidget;
|
||||
};
|
||||
|
||||
return GetIEditor()->GetWinWidgetManager()->RegisterWinWidget(TWidget::GetWWId(), createCall);
|
||||
}
|
||||
|
||||
template<class TWidget>
|
||||
void UnregisterWinWidget()
|
||||
{
|
||||
GetIEditor()->GetWinWidgetManager()->UnregisterWinWidget(TWidget::GetWWId());
|
||||
}
|
||||
}
|
||||
@@ -1,70 +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 <WinWidget/WinWidgetManager.h>
|
||||
|
||||
namespace WinWidget
|
||||
{
|
||||
WinWidgetManager::WinWidgetManager()
|
||||
: m_createCalls(size_t(WinWidgetId::NUM_WIN_WIDGET_IDS) + 1)
|
||||
{
|
||||
}
|
||||
|
||||
size_t WinWidgetManager::GetIndexForId(WinWidgetId thisId) const
|
||||
{
|
||||
size_t thisIndex = static_cast<size_t>(thisId);
|
||||
if (thisIndex >= m_createCalls.size())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return thisIndex;
|
||||
}
|
||||
|
||||
WinWidgetManager::WinWidgetCreateCall WinWidgetManager::GetCreateCall(WinWidgetId thisId) const
|
||||
{
|
||||
size_t thisIndex = GetIndexForId(thisId);
|
||||
if (!thisIndex)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return m_createCalls[thisIndex];
|
||||
}
|
||||
|
||||
bool WinWidgetManager::RegisterWinWidget(WinWidgetId thisId, WinWidgetCreateCall createCall)
|
||||
{
|
||||
size_t thisIndex = GetIndexForId(thisId);
|
||||
if (m_createCalls[thisIndex] != nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_createCalls[thisIndex] = createCall;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WinWidgetManager::UnregisterWinWidget(WinWidgetId thisId)
|
||||
{
|
||||
size_t thisIndex = GetIndexForId(thisId);
|
||||
if (m_createCalls[thisIndex] == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_createCalls[thisIndex] = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QWidget* WinWidgetManager::OpenWinWidget(WinWidgetId createId) const
|
||||
{
|
||||
WinWidgetManager::WinWidgetCreateCall createCall = GetCreateCall(createId);
|
||||
if (!createCall)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return createCall();
|
||||
}
|
||||
}
|
||||
@@ -1,41 +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 <WinWidgetId.h>
|
||||
#include "EditorCommonAPI.h"
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace WinWidget
|
||||
{
|
||||
class EDITOR_COMMON_API WinWidgetManager
|
||||
{
|
||||
public:
|
||||
using WinWidgetCreateCall = std::function<QWidget*()>;
|
||||
|
||||
WinWidgetManager();
|
||||
~WinWidgetManager() {}
|
||||
|
||||
bool RegisterWinWidget(WinWidgetId thisId, WinWidgetCreateCall createCall);
|
||||
bool UnregisterWinWidget(WinWidgetId thisId);
|
||||
|
||||
QWidget* OpenWinWidget(WinWidgetId) const;
|
||||
private:
|
||||
WinWidgetCreateCall GetCreateCall(WinWidgetId thisId) const;
|
||||
size_t GetIndexForId(WinWidgetId thisId) const;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
std::vector<WinWidgetCreateCall> m_createCalls;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
}
|
||||
@@ -17,8 +17,4 @@ set(FILES
|
||||
DockTitleBarWidget.h
|
||||
SaveUtilities/AsyncSaveRunner.h
|
||||
SaveUtilities/AsyncSaveRunner.cpp
|
||||
Resource.h
|
||||
WinWidget/WinWidget.h
|
||||
WinWidget/WinWidgetManager.h
|
||||
WinWidget/WinWidgetManager.cpp
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user