From 63526655a270762f8291b600be0fff741629ff55 Mon Sep 17 00:00:00 2001 From: jjjoness <82226755+jjjoness@users.noreply.github.com> Date: Fri, 30 Apr 2021 14:27:55 +0100 Subject: [PATCH] Fixed asset source tree layout in AssetProcessor --- .../assetprocessor_gui_files.cmake | 4 ++- .../native/ui/JobTreeViewItemDelegate.cpp | 25 +++++++++++++++ .../native/ui/JobTreeViewItemDelegate.h | 32 +++++++++++++++++++ .../AssetProcessor/native/ui/MainWindow.cpp | 2 ++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 Code/Tools/AssetProcessor/native/ui/JobTreeViewItemDelegate.cpp create mode 100644 Code/Tools/AssetProcessor/native/ui/JobTreeViewItemDelegate.h diff --git a/Code/Tools/AssetProcessor/assetprocessor_gui_files.cmake b/Code/Tools/AssetProcessor/assetprocessor_gui_files.cmake index 79771a9d37..ab7a1e4a9f 100644 --- a/Code/Tools/AssetProcessor/assetprocessor_gui_files.cmake +++ b/Code/Tools/AssetProcessor/assetprocessor_gui_files.cmake @@ -31,7 +31,9 @@ set(FILES native/ui/GoToButton.h native/ui/GoToButton.cpp native/ui/GoToButton.ui - native/ui/MainWindow.h + native/ui/JobTreeViewItemDelegate.h + native/ui/JobTreeViewItemDelegate.cpp + native/ui/MainWindow.ui native/ui/MainWindow.cpp native/ui/MainWindow.ui native/ui/ProductAssetDetailsPanel.h diff --git a/Code/Tools/AssetProcessor/native/ui/JobTreeViewItemDelegate.cpp b/Code/Tools/AssetProcessor/native/ui/JobTreeViewItemDelegate.cpp new file mode 100644 index 0000000000..e0da06ad79 --- /dev/null +++ b/Code/Tools/AssetProcessor/native/ui/JobTreeViewItemDelegate.cpp @@ -0,0 +1,25 @@ +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ + +#include "JobTreeViewItemDelegate.h" + +namespace AssetProcessor +{ + void JobTreeViewItemDelegate::initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const + { + AzQtComponents::TableViewItemDelegate::initStyleOption(option, index); + + option->features &= ~(QStyleOptionViewItem::WrapText); + } +} + +#include diff --git a/Code/Tools/AssetProcessor/native/ui/JobTreeViewItemDelegate.h b/Code/Tools/AssetProcessor/native/ui/JobTreeViewItemDelegate.h new file mode 100644 index 0000000000..f0e74145ee --- /dev/null +++ b/Code/Tools/AssetProcessor/native/ui/JobTreeViewItemDelegate.h @@ -0,0 +1,32 @@ +#pragma once + +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ + +#if !defined(Q_MOC_RUN) +#include +#endif + +namespace AssetProcessor +{ + class JobTreeViewItemDelegate + : public AzQtComponents::TableViewItemDelegate + { + Q_OBJECT + + public: + using AzQtComponents::TableViewItemDelegate::TableViewItemDelegate; + + protected: + void initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const override; + }; +} // namespace AssetProcessor diff --git a/Code/Tools/AssetProcessor/native/ui/MainWindow.cpp b/Code/Tools/AssetProcessor/native/ui/MainWindow.cpp index 3a874a464c..79019ab8fc 100644 --- a/Code/Tools/AssetProcessor/native/ui/MainWindow.cpp +++ b/Code/Tools/AssetProcessor/native/ui/MainWindow.cpp @@ -32,6 +32,7 @@ #include #include "native/ui/ui_MainWindow.h" +#include "native/ui/JobTreeViewItemDelegate.h" #include "../utilities/GUIApplicationManager.h" @@ -221,6 +222,7 @@ void MainWindow::Activate() ui->jobTreeView->setModel(m_jobSortFilterProxy); ui->jobTreeView->setSortingEnabled(true); ui->jobTreeView->header()->setDefaultAlignment(Qt::AlignVCenter | Qt::AlignHCenter); + ui->jobTreeView->setItemDelegate(new AssetProcessor::JobTreeViewItemDelegate(ui->jobTreeView)); ui->jobTreeView->setToolTip(tr("Click to view Job Log"));