diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindow.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindow.h new file mode 100644 index 0000000000..21afe114f5 --- /dev/null +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindow.h @@ -0,0 +1,48 @@ +/* + * 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 +#include + +#include +#include +#include + +namespace AtomToolsFramework +{ + class AtomToolsMainWindow + : public AzQtComponents::DockMainWindow + { + public: + AtomToolsMainWindow(QWidget* parent = 0); + protected: + AzQtComponents::FancyDocking* m_advancedDockManager = nullptr; + QWidget* m_centralWidget = nullptr; + QMenuBar* m_menuBar = nullptr; + AzQtComponents::TabWidget* m_tabWidget = nullptr; + + virtual void SetupMenu(); + + virtual void SetupTabs(); + virtual void AddTabForDocumentId(const AZ::Uuid& documentId); + virtual void RemoveTabForDocumentId(const AZ::Uuid& documentId); + virtual void UpdateTabForDocumentId(const AZ::Uuid& documentId); + virtual AZ::Uuid GetDocumentIdFromTab(const int tabIndex) const; + + virtual void OpenTabContextMenu(); + virtual void SelectPreviousTab(); + virtual void SelectNextTab(); + + QMenu* m_menuFile = {}; + }; +} diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Window/AtomToolsMainWindow.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Window/AtomToolsMainWindow.cpp new file mode 100644 index 0000000000..15edd8c5b6 --- /dev/null +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Window/AtomToolsMainWindow.cpp @@ -0,0 +1,135 @@ +/* + * 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 + + +namespace AtomToolsFramework +{ + AtomToolsMainWindow::AtomToolsMainWindow(QWidget* parent) + : AzQtComponents::DockMainWindow(parent) + { + m_advancedDockManager = new AzQtComponents::FancyDocking(this); + + setDockNestingEnabled(true); + setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); + setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); + setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); + setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); + + m_menuBar = new QMenuBar(this); + m_menuBar->setObjectName("MenuBar"); + setMenuBar(m_menuBar); + + m_centralWidget = new QWidget(this); + m_tabWidget = new AzQtComponents::TabWidget(m_centralWidget); + m_tabWidget->setObjectName("TabWidget"); + m_tabWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); + m_tabWidget->setContentsMargins(0, 0, 0, 0); + } + + void AtomToolsMainWindow::SetupMenu() + { + // Generating the main menu manually because it's easier and we will have some dynamic or data driven entries + m_menuFile = m_menuBar->addMenu("&File"); + } + + void AtomToolsMainWindow::SetupTabs() + { + // The tab bar should only be visible if it has active documents + m_tabWidget->setVisible(false); + m_tabWidget->setTabBarAutoHide(false); + m_tabWidget->setMovable(true); + m_tabWidget->setTabsClosable(true); + m_tabWidget->setUsesScrollButtons(true); + + // Add context menu for right-clicking on tabs + m_tabWidget->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); + connect(m_tabWidget, &QWidget::customContextMenuRequested, this, [this]() { + OpenTabContextMenu(); + }); + } + + void AtomToolsMainWindow::AddTabForDocumentId(const AZ::Uuid& documentId) + { + // Blocking signals from the tab bar so the currentChanged signal is not sent while a document is already being opened. + // This prevents the OnDocumentOpened notification from being sent recursively. + const QSignalBlocker blocker(m_tabWidget); + + // If a tab for this document already exists then select it instead of creating a new one + for (int tabIndex = 0; tabIndex < m_tabWidget->count(); ++tabIndex) + { + if (documentId == GetDocumentIdFromTab(tabIndex)) + { + m_tabWidget->setCurrentIndex(tabIndex); + m_tabWidget->repaint(); + return; + } + } + } + + void AtomToolsMainWindow::RemoveTabForDocumentId(const AZ::Uuid& documentId) + { + // We are not blocking signals here because we want closing tabs to close the associated document + // and automatically select the next document. + for (int tabIndex = 0; tabIndex < m_tabWidget->count(); ++tabIndex) + { + if (documentId == GetDocumentIdFromTab(tabIndex)) + { + m_tabWidget->removeTab(tabIndex); + m_tabWidget->setVisible(m_tabWidget->count() > 0); + m_tabWidget->repaint(); + break; + } + } + } + + void AtomToolsMainWindow::UpdateTabForDocumentId(const AZ::Uuid& documentId) + { + // Whenever a document is opened, saved, or modified we need to update the tab label + if (!documentId.IsNull()) + { + return; + } + } + + AZ::Uuid AtomToolsMainWindow::GetDocumentIdFromTab(const int tabIndex) const + { + const QVariant tabData = m_tabWidget->tabBar()->tabData(tabIndex); + if (!tabData.isNull()) + { + // We need to be able to convert between a UUID and a string to store and retrieve a document ID from the tab bar + const QString documentIdString = tabData.toString(); + const QByteArray documentIdBytes = documentIdString.toUtf8(); + const AZ::Uuid documentId(documentIdBytes.data(), documentIdBytes.size()); + return documentId; + } + return AZ::Uuid::CreateNull(); + } + + void AtomToolsMainWindow::OpenTabContextMenu() + { + } + + void AtomToolsMainWindow::SelectPreviousTab() + { + if (m_tabWidget->count() > 1) + { + // Adding count to wrap around when index <= 0 + m_tabWidget->setCurrentIndex((m_tabWidget->currentIndex() + m_tabWidget->count() - 1) % m_tabWidget->count()); + } + } + + void AtomToolsMainWindow::SelectNextTab() + { + if (m_tabWidget->count() > 1) + { + m_tabWidget->setCurrentIndex((m_tabWidget->currentIndex() + 1) % m_tabWidget->count()); + } + } +} diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/atomtoolsframework_files.cmake b/Gems/Atom/Tools/AtomToolsFramework/Code/atomtoolsframework_files.cmake index 86fc3f5f5e..5ef4426537 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/atomtoolsframework_files.cmake +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/atomtoolsframework_files.cmake @@ -24,6 +24,7 @@ set(FILES Include/AtomToolsFramework/Viewport/RenderViewportWidget.h Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h Include/AtomToolsFramework/Viewport/ModularViewportCameraControllerRequestBus.h + Include/AtomToolsFramework/Window/AtomToolsMainWindow.h Source/Application/AtomToolsApplication.cpp Source/Communication/LocalServer.cpp Source/Communication/LocalSocket.cpp @@ -40,4 +41,5 @@ set(FILES Source/Util/Util.cpp Source/Viewport/RenderViewportWidget.cpp Source/Viewport/ModularViewportCameraController.cpp + Source/Window/AtomToolsMainWindow.cpp ) diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp index abb0102de6..78670ac710 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp @@ -56,7 +56,7 @@ AZ_POP_DISABLE_WARNING namespace MaterialEditor { MaterialEditorWindow::MaterialEditorWindow(QWidget* parent /* = 0 */) - : AzQtComponents::DockMainWindow(parent) + : AtomToolsFramework::AtomToolsMainWindow(parent) { resize(1280, 1024); @@ -83,29 +83,12 @@ namespace MaterialEditor setWindowTitle(QApplication::applicationName()); } - m_advancedDockManager = new AzQtComponents::FancyDocking(this); - setObjectName("MaterialEditorWindow"); - setDockNestingEnabled(true); - setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); - setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); - setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); - setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); - - m_menuBar = new QMenuBar(this); - m_menuBar->setObjectName("MenuBar"); - setMenuBar(m_menuBar); m_toolBar = new MaterialEditorToolBar(this); m_toolBar->setObjectName("ToolBar"); addToolBar(m_toolBar); - m_centralWidget = new QWidget(this); - m_tabWidget = new AzQtComponents::TabWidget(m_centralWidget); - m_tabWidget->setObjectName("TabWidget"); - m_tabWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); - m_tabWidget->setContentsMargins(0, 0, 0, 0); - m_materialViewport = new MaterialViewportWidget(m_centralWidget); m_materialViewport->setObjectName("Viewport"); m_materialViewport->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); @@ -370,8 +353,7 @@ namespace MaterialEditor void MaterialEditorWindow::SetupMenu() { - // Generating the main menu manually because it's easier and we will have some dynamic or data driven entries - m_menuFile = m_menuBar->addMenu("&File"); + AtomToolsFramework::AtomToolsMainWindow::SetupMenu(); m_actionNew = m_menuFile->addAction("&New...", [this]() { CreateMaterialDialog createDialog(this); @@ -563,18 +545,7 @@ namespace MaterialEditor void MaterialEditorWindow::SetupTabs() { - // The tab bar should only be visible if it has active documents - m_tabWidget->setVisible(false); - m_tabWidget->setTabBarAutoHide(false); - m_tabWidget->setMovable(true); - m_tabWidget->setTabsClosable(true); - m_tabWidget->setUsesScrollButtons(true); - - // Add context menu for right-clicking on tabs - m_tabWidget->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); - connect(m_tabWidget, &QWidget::customContextMenuRequested, this, [this]() { - OpenTabContextMenu(); - }); + AtomToolsFramework::AtomToolsMainWindow::SetupTabs(); // This signal will be triggered whenever a tab is added, removed, selected, clicked, dragged // When the last tab is removed tabIndex will be -1 and the document ID will be null @@ -600,20 +571,7 @@ namespace MaterialEditor return; } - // Blocking signals from the tab bar so the currentChanged signal is not sent while a document is already being opened. - // This prevents the OnDocumentOpened notification from being sent recursively. - const QSignalBlocker blocker(m_tabWidget); - - // If a tab for this document already exists then select it instead of creating a new one - for (int tabIndex = 0; tabIndex < m_tabWidget->count(); ++tabIndex) - { - if (documentId == GetDocumentIdFromTab(tabIndex)) - { - m_tabWidget->setCurrentIndex(tabIndex); - m_tabWidget->repaint(); - return; - } - } + AtomToolsMainWindow::AddTabForDocumentId(documentId); // Create a new tab for the document ID and assign it's label to the file name of the document. AZStd::string absolutePath; @@ -639,22 +597,6 @@ namespace MaterialEditor m_tabWidget->repaint(); } - void MaterialEditorWindow::RemoveTabForDocumentId(const AZ::Uuid& documentId) - { - // We are not blocking signals here because we want closing tabs to close the associated document - // and automatically select the next document. - for (int tabIndex = 0; tabIndex < m_tabWidget->count(); ++tabIndex) - { - if (documentId == GetDocumentIdFromTab(tabIndex)) - { - m_tabWidget->removeTab(tabIndex); - m_tabWidget->setVisible(m_tabWidget->count() > 0); - m_tabWidget->repaint(); - break; - } - } - } - void MaterialEditorWindow::UpdateTabForDocumentId(const AZ::Uuid& documentId) { // Whenever a document is opened, saved, or modified we need to update the tab label @@ -698,20 +640,6 @@ namespace MaterialEditor return absolutePath.c_str(); } - AZ::Uuid MaterialEditorWindow::GetDocumentIdFromTab(const int tabIndex) const - { - const QVariant tabData = m_tabWidget->tabBar()->tabData(tabIndex); - if (!tabData.isNull()) - { - // We need to be able to convert between a UUID and a string to store and retrieve a document ID from the tab bar - const QString documentIdString = tabData.toString(); - const QByteArray documentIdBytes = documentIdString.toUtf8(); - const AZ::Uuid documentId(documentIdBytes.data(), documentIdBytes.size()); - return documentId; - } - return AZ::Uuid::CreateNull(); - } - void MaterialEditorWindow::OpenTabContextMenu() { const QTabBar* tabBar = m_tabWidget->tabBar(); @@ -738,23 +666,6 @@ namespace MaterialEditor tabMenu.exec(QCursor::pos()); } } - - void MaterialEditorWindow::SelectPreviousTab() - { - if (m_tabWidget->count() > 1) - { - // Adding count to wrap around when index <= 0 - m_tabWidget->setCurrentIndex((m_tabWidget->currentIndex() + m_tabWidget->count() - 1) % m_tabWidget->count()); - } - } - - void MaterialEditorWindow::SelectNextTab() - { - if (m_tabWidget->count() > 1) - { - m_tabWidget->setCurrentIndex((m_tabWidget->currentIndex() + 1) % m_tabWidget->count()); - } - } } // namespace MaterialEditor #include diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.h b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.h index dac420ab21..96f03e6eed 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.h +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.h @@ -11,6 +11,7 @@ #if !defined(Q_MOC_RUN) #include #include +#include AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT #include @@ -44,7 +45,7 @@ namespace MaterialEditor * 3) MaterialPropertyInspector - The user edits the properties of the selected Material. */ class MaterialEditorWindow - : public AzQtComponents::DockMainWindow + : public AtomToolsFramework::AtomToolsMainWindow , private MaterialEditorWindowRequestBus::Handler , private MaterialDocumentNotificationBus::Handler { @@ -52,6 +53,8 @@ namespace MaterialEditor public: AZ_CLASS_ALLOCATOR(MaterialEditorWindow, AZ::SystemAllocator, 0); + using Base = AtomToolsFramework::AtomToolsMainWindow; + MaterialEditorWindow(QWidget* parent = 0); ~MaterialEditorWindow(); @@ -75,31 +78,22 @@ namespace MaterialEditor void OnDocumentUndoStateChanged(const AZ::Uuid& documentId) override; void OnDocumentSaved(const AZ::Uuid& documentId) override; - void SetupMenu(); + void SetupMenu() override; - void SetupTabs(); - void AddTabForDocumentId(const AZ::Uuid& documentId); - void RemoveTabForDocumentId(const AZ::Uuid& documentId); - void UpdateTabForDocumentId(const AZ::Uuid& documentId); + void SetupTabs() override; + void AddTabForDocumentId(const AZ::Uuid& documentId) override; + void UpdateTabForDocumentId(const AZ::Uuid& documentId) override; QString GetDocumentPath(const AZ::Uuid& documentId) const; - AZ::Uuid GetDocumentIdFromTab(const int tabIndex) const; - void OpenTabContextMenu(); - void SelectPreviousTab(); - void SelectNextTab(); + void OpenTabContextMenu() override; void closeEvent(QCloseEvent* closeEvent) override; - AzQtComponents::FancyDocking* m_advancedDockManager = nullptr; - QWidget* m_centralWidget = nullptr; - QMenuBar* m_menuBar = nullptr; - AzQtComponents::TabWidget* m_tabWidget = nullptr; MaterialViewportWidget* m_materialViewport = nullptr; MaterialEditorToolBar* m_toolBar = nullptr; AZStd::unordered_map m_dockWidgets; - QMenu* m_menuFile = {}; QAction* m_actionNew = {}; QAction* m_actionOpen = {}; QAction* m_actionOpenRecent = {}; diff --git a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp index 3900720bf6..90a2e238a9 100644 --- a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp +++ b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp @@ -38,29 +38,16 @@ AZ_POP_DISABLE_WARNING namespace ShaderManagementConsole { ShaderManagementConsoleWindow::ShaderManagementConsoleWindow(QWidget* parent /* = 0 */) - : AzQtComponents::DockMainWindow(parent) + : AtomToolsFramework::AtomToolsMainWindow(parent) { setWindowTitle("Shader Management Console"); - m_advancedDockManager = new AzQtComponents::FancyDocking(this); - - setDockNestingEnabled(true); - setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); - setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); - setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); - setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); - - m_menuBar = new QMenuBar(this); - setMenuBar(m_menuBar); + setObjectName("ShaderManagementConsoleWindow"); m_toolBar = new ShaderManagementConsoleToolBar(this); + m_toolBar->setObjectName("ToolBar"); addToolBar(m_toolBar); - m_centralWidget = new QWidget(this); - m_tabWidget = new AzQtComponents::TabWidget(m_centralWidget); - m_tabWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); - m_tabWidget->setContentsMargins(0, 0, 0, 0); - QVBoxLayout* vl = new QVBoxLayout(m_centralWidget); vl->setMargin(0); vl->setContentsMargins(0, 0, 0, 0); @@ -144,7 +131,7 @@ namespace ShaderManagementConsole m_actionUndo->setEnabled(canUndo); m_actionRedo->setEnabled(canRedo); - m_actionPreferences->setEnabled(false); + m_actionSettings->setEnabled(false); m_actionAssetBrowser->setEnabled(true); m_actionPythonTerminal->setEnabled(true); @@ -188,8 +175,7 @@ namespace ShaderManagementConsole void ShaderManagementConsoleWindow::SetupMenu() { - // Generating the main menu manually because it's easier and we will have some dynamic or data driven entries - m_menuFile = m_menuBar->addMenu("&File"); + AtomToolsFramework::AtomToolsMainWindow::SetupMenu(); m_actionOpen = m_menuFile->addAction("&Open...", [this]() { const AZStd::vector assetTypes = { @@ -264,9 +250,9 @@ namespace ShaderManagementConsole m_menuEdit->addSeparator(); - m_actionPreferences = m_menuEdit->addAction("&Preferences...", [this]() { + m_actionSettings = m_menuEdit->addAction("&Preferences...", [this]() { }, QKeySequence::Preferences); - m_actionPreferences->setEnabled(false); + m_actionSettings->setEnabled(false); m_menuView = m_menuBar->addMenu("&View"); @@ -304,18 +290,7 @@ namespace ShaderManagementConsole void ShaderManagementConsoleWindow::SetupTabs() { - // The tab bar should only be visible if it has active documents - m_tabWidget->setVisible(false); - m_tabWidget->setTabBarAutoHide(false); - m_tabWidget->setMovable(true); - m_tabWidget->setTabsClosable(true); - m_tabWidget->setUsesScrollButtons(true); - - // Add context menu for right-clicking on tabs - m_tabWidget->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); - connect(m_tabWidget, &QWidget::customContextMenuRequested, this, [this]() { - OpenTabContextMenu(); - }); + AtomToolsFramework::AtomToolsMainWindow::SetupTabs(); // This signal will be triggered whenever a tab is added, removed, selected, clicked, dragged // When the last tab is removed tabIndex will be -1 and the document ID will be null @@ -339,20 +314,7 @@ namespace ShaderManagementConsole return; } - // Blocking signals from the tab bar so the currentChanged signal is not sent while a document is already being opened. - // This prevents the OnDocumentOpened notification from being sent recursively. - const QSignalBlocker blocker(m_tabWidget); - - // If a tab for this document already exists then select it instead of creating a new one - for (int tabIndex = 0; tabIndex < m_tabWidget->count(); ++tabIndex) - { - if (documentId == GetDocumentIdFromTab(tabIndex)) - { - m_tabWidget->setCurrentIndex(tabIndex); - m_tabWidget->repaint(); - return; - } - } + AtomToolsMainWindow::AddTabForDocumentId(documentId); // Create a new tab for the document ID and assign it's label to the file name of the document. AZStd::string absolutePath; @@ -382,22 +344,6 @@ namespace ShaderManagementConsole CreateDocumentContent(documentId, model); } - void ShaderManagementConsoleWindow::RemoveTabForDocumentId(const AZ::Uuid& documentId) - { - // We are not blocking signals here because we want closing tabs to close the associated document - // and automatically select the next document. - for (int tabIndex = 0; tabIndex < m_tabWidget->count(); ++tabIndex) - { - if (documentId == GetDocumentIdFromTab(tabIndex)) - { - m_tabWidget->removeTab(tabIndex); - m_tabWidget->setVisible(m_tabWidget->count() > 0); - m_tabWidget->repaint(); - break; - } - } - } - void ShaderManagementConsoleWindow::UpdateTabForDocumentId(const AZ::Uuid& documentId) { // Whenever a document is opened, saved, or modified we need to update the tab label @@ -434,20 +380,6 @@ namespace ShaderManagementConsole } } - AZ::Uuid ShaderManagementConsoleWindow::GetDocumentIdFromTab(const int tabIndex) const - { - const QVariant tabData = m_tabWidget->tabBar()->tabData(tabIndex); - if (!tabData.isNull()) - { - // We need to be able to convert between a UUID and a string to store and retrieve a document ID from the tab bar - const QString documentIdString = tabData.toString(); - const QByteArray documentIdBytes = documentIdString.toUtf8(); - const AZ::Uuid documentId(documentIdBytes.data(), documentIdBytes.size()); - return documentId; - } - return AZ::Uuid::CreateNull(); - } - void ShaderManagementConsoleWindow::OpenTabContextMenu() { const QTabBar* tabBar = m_tabWidget->tabBar(); @@ -472,23 +404,6 @@ namespace ShaderManagementConsole } } - void ShaderManagementConsoleWindow::SelectPreviousTab() - { - if (m_tabWidget->count() > 1) - { - // Adding count to wrap around when index <= 0 - m_tabWidget->setCurrentIndex((m_tabWidget->currentIndex() + m_tabWidget->count() - 1) % m_tabWidget->count()); - } - } - - void ShaderManagementConsoleWindow::SelectNextTab() - { - if (m_tabWidget->count() > 1) - { - m_tabWidget->setCurrentIndex((m_tabWidget->currentIndex() + 1) % m_tabWidget->count()); - } - } - void ShaderManagementConsoleWindow::SelectDocumentForTab(const int tabIndex) { const AZ::Uuid documentId = GetDocumentIdFromTab(tabIndex); diff --git a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.h b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.h index 5ab94aa34e..cb371bc4d6 100644 --- a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.h +++ b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.h @@ -14,6 +14,7 @@ #include #include +#include AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT #include @@ -42,13 +43,15 @@ namespace ShaderManagementConsole * its panels, managing selection of assets, and performing high-level actions like saving. It contains... */ class ShaderManagementConsoleWindow - : public AzQtComponents::DockMainWindow + : public AtomToolsFramework::AtomToolsMainWindow , private ShaderManagementConsoleDocumentNotificationBus::Handler { Q_OBJECT public: AZ_CLASS_ALLOCATOR(ShaderManagementConsoleWindow, AZ::SystemAllocator, 0); + using Base = AtomToolsFramework::AtomToolsMainWindow; + ShaderManagementConsoleWindow(QWidget* parent = 0); ~ShaderManagementConsoleWindow(); @@ -60,17 +63,13 @@ namespace ShaderManagementConsole void OnDocumentUndoStateChanged(const AZ::Uuid& documentId) override; void OnDocumentSaved(const AZ::Uuid& documentId) override; - void SetupMenu(); + void SetupMenu() override; - void SetupTabs(); - void AddTabForDocumentId(const AZ::Uuid& documentId); - void RemoveTabForDocumentId(const AZ::Uuid& documentId); - void UpdateTabForDocumentId(const AZ::Uuid& documentId); - AZ::Uuid GetDocumentIdFromTab(const int tabIndex) const; + void SetupTabs() override; + void AddTabForDocumentId(const AZ::Uuid& documentId) override; + void UpdateTabForDocumentId(const AZ::Uuid& documentId) override; - void OpenTabContextMenu(); - void SelectPreviousTab(); - void SelectNextTab(); + void OpenTabContextMenu() override; void SelectDocumentForTab(const int tabIndex); void CloseDocumentForTab(const int tabIndex); @@ -80,10 +79,6 @@ namespace ShaderManagementConsole void CreateDocumentContent(const AZ::Uuid& documentId, QStandardItemModel* model); - AzQtComponents::FancyDocking* m_advancedDockManager = nullptr; - QMenuBar* m_menuBar = nullptr; - QWidget* m_centralWidget = nullptr; - AzQtComponents::TabWidget* m_tabWidget = nullptr; ShaderManagementConsoleBrowserWidget* m_assetBrowser = nullptr; ShaderManagementConsoleToolBar* m_toolBar = nullptr; AzToolsFramework::CScriptTermDialog* m_pythonTerminal = nullptr; @@ -91,7 +86,6 @@ namespace ShaderManagementConsole AzQtComponents::StyledDockWidget* m_assetBrowserDockWidget = nullptr; AzQtComponents::StyledDockWidget* m_pythonTerminalDockWidget = nullptr; - QMenu* m_menuFile = {}; QMenu* m_menuNew = {}; QAction* m_actionOpen = {}; QAction* m_actionOpenRecent = {}; @@ -106,7 +100,7 @@ namespace ShaderManagementConsole QMenu* m_menuEdit = {}; QAction* m_actionUndo = {}; QAction* m_actionRedo = {}; - QAction* m_actionPreferences = {}; + QAction* m_actionSettings = {}; QMenu* m_menuView = {}; QAction* m_actionAssetBrowser = {};