From db2c5f87b1c03a88e78e23d6f120c3f37011dcdc Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 29 Mar 2023 21:13:34 +0200 Subject: [PATCH] Squish: Prepare perspective for object picker Visual adaption for the later addition of the object picker functionality. Change-Id: Id1c422465d4cebcea9eb366621b57a3c076385cc Reviewed-by: Reviewed-by: David Schulz --- src/plugins/squish/images/picker.png | Bin 0 -> 194 bytes src/plugins/squish/images/picker@2x.png | Bin 0 -> 362 bytes src/plugins/squish/squish.qrc | 2 + src/plugins/squish/squishperspective.cpp | 77 ++++++++++++++++++++--- src/plugins/squish/squishperspective.h | 4 ++ 5 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 src/plugins/squish/images/picker.png create mode 100644 src/plugins/squish/images/picker@2x.png diff --git a/src/plugins/squish/images/picker.png b/src/plugins/squish/images/picker.png new file mode 100644 index 0000000000000000000000000000000000000000..1e9a13e8a199b5f5531b0411d921b601c6109d07 GIT binary patch literal 194 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4h9AW2CEqh_A)Rqbb7ithDc0J{?X4SG2zDg zX1hfkH3lgL70lv4-fcTNqp?v@M(xA#)|pdV8xKBF_Ia>fS(sUS_QUEOlJbvZZc0Qf zJCOTR;`@{B?842KJ`a-bT>k%FsJ7S6fz__z$I12oYul}OPPOm;694M+|MidWE6mxK x_WFM~hh4ye2lv-4*?wYPbl`?R@_hH37#a2@U*+Ct`ymwMI8RqUmvv4FO#qyvQvm<~ literal 0 HcmV?d00001 diff --git a/src/plugins/squish/images/picker@2x.png b/src/plugins/squish/images/picker@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..390926b891a62ee91d50c9a23765269ac676e706 GIT binary patch literal 362 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4h9AWhA=@@4F(2ALr)jS5R22vKl~XCCag_3 z&-#bUY*Uf!(d7x^*38Ps_OhO^bQ+=4YJ2VJ_Izm*7K_?N6ee} z+NiBb{L>nq9G-y6bHWl~H6ba?CmnPiSoFL+@xAB`kAdi$>W!73TXmR2SbvwTVJw{# z-^IKriS60~J7trnd+j1vCqGEl;X23R%W8E+V$mUvV8)1l|NpPQm0&;bNI*f4yw3l6 z>-Bo#SNb)$5h`!rkVHa(y5Dn@{Ec`2YVqa}P_gNTi&1SJTOS*XiwA7N_iG zwe|~U&$2mf&wnQJ{ASkdMSs`cWt{l@ZkKJS|CPVIN$U=)@dtfyW|Aq)uH63cg!t{L z|Ns8~pD*>kEJiXt=*9p4?PsR&KRgqe{xfN7>#co{PgX6rx>mo`@mVV)!`GHDvkjqw Q;-EnEboFyt=akR{0He8^xBvhE literal 0 HcmV?d00001 diff --git a/src/plugins/squish/squish.qrc b/src/plugins/squish/squish.qrc index 1a62ee1c1c6..e55323c3cc7 100644 --- a/src/plugins/squish/squish.qrc +++ b/src/plugins/squish/squish.qrc @@ -8,6 +8,8 @@ images/jumpTo@2x.png images/data.png images/data@2x.png + images/picker.png + images/picker@2x.png wizard/suite/wizard.json diff --git a/src/plugins/squish/squishperspective.cpp b/src/plugins/squish/squishperspective.cpp index fca93ce35db..b229541842a 100644 --- a/src/plugins/squish/squishperspective.cpp +++ b/src/plugins/squish/squishperspective.cpp @@ -26,10 +26,13 @@ namespace Squish { namespace Internal { -enum class IconType { StopRecord, Play, Pause, StepIn, StepOver, StepReturn, Stop }; +enum class IconType { StopRecord, Play, Pause, StepIn, StepOver, StepReturn, Stop, Inspect }; static QIcon iconForType(IconType type) { + static const Utils::Icon inspectIcon({{":/squish/images/picker.png", + Utils::Theme::IconsBaseColor}}); + switch (type) { case IconType::StopRecord: return Debugger::Icons::RECORD_ON.icon(); @@ -45,6 +48,8 @@ static QIcon iconForType(IconType type) return Debugger::Icons::STEP_OUT_TOOLBAR.icon(); case IconType::Stop: return Utils::Icons::STOP_SMALL.icon(); + case IconType::Inspect: + return inspectIcon.icon(); } return QIcon(); } @@ -209,10 +214,14 @@ void SquishPerspective::initPerspective() m_stepOutAction->setEnabled(false); m_stopAction = Debugger::createStopAction(); m_stopAction->setEnabled(false); + m_inspectAction = new QAction(this); + m_inspectAction->setIcon(iconForType(IconType::Inspect)); + m_inspectAction->setToolTip(Tr::tr("Inspect")); + m_inspectAction->setEnabled(false); - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->setContentsMargins(0, 0, 0, 0); - mainLayout->setSpacing(1); + QVBoxLayout *localsMainLayout = new QVBoxLayout; + localsMainLayout->setContentsMargins(0, 0, 0, 0); + localsMainLayout->setSpacing(1); m_localsModel.setHeader({Tr::tr("Name"), Tr::tr("Type"), Tr::tr("Value")}); auto localsView = new Utils::TreeView; @@ -220,11 +229,45 @@ void SquishPerspective::initPerspective() localsView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); localsView->setModel(&m_localsModel); localsView->setRootIsDecorated(true); - mainLayout->addWidget(localsView); - QWidget *mainWidget = new QWidget; - mainWidget->setObjectName("SquishLocalsView"); - mainWidget->setWindowTitle(Tr::tr("Squish Locals")); - mainWidget->setLayout(mainLayout); + localsMainLayout->addWidget(localsView); + QWidget *localsWidget = new QWidget; + localsWidget->setObjectName("SquishLocalsView"); + localsWidget->setWindowTitle(Tr::tr("Squish Locals")); + localsWidget->setLayout(localsMainLayout); + + QVBoxLayout *objectsMainLayout = new QVBoxLayout; + objectsMainLayout->setContentsMargins(0, 0, 0, 0); + objectsMainLayout->setSpacing(1); + + m_objectsModel.setHeader({Tr::tr("Object"), Tr::tr("Type")}); + auto objectsView = new Utils::TreeView; + objectsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + objectsView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + objectsView->setModel(&m_objectsModel); + objectsView->setRootIsDecorated(true); + objectsMainLayout->addWidget(objectsView); + + QWidget *objectWidget = new QWidget; + objectWidget->setObjectName("SquishObjectsView"); + objectWidget->setWindowTitle(Tr::tr("Squish Objects")); + objectWidget->setLayout(objectsMainLayout); + + QVBoxLayout *propertiesMainLayout = new QVBoxLayout; + propertiesMainLayout->setContentsMargins(0, 0, 0, 0); + propertiesMainLayout->setSpacing(1); + + m_propertiesModel.setHeader({Tr::tr("Property"), Tr::tr("Value")}); + auto propertiesView = new Utils::TreeView; + propertiesView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + propertiesView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + propertiesView->setModel(&m_propertiesModel); + propertiesView->setRootIsDecorated(true); + propertiesMainLayout->addWidget(propertiesView); + + QWidget *propertiesWidget = new QWidget; + propertiesWidget->setObjectName("SquishPropertiesView"); + propertiesWidget->setWindowTitle(Tr::tr("Squish Object Properties")); + propertiesWidget->setLayout(propertiesMainLayout); addToolBarAction(m_pausePlayAction); addToolBarAction(m_stepInAction); @@ -232,10 +275,14 @@ void SquishPerspective::initPerspective() addToolBarAction(m_stepOutAction); addToolBarAction(m_stopAction); addToolbarSeparator(); + addToolBarAction(m_inspectAction); + addToolbarSeparator(); m_status = new QLabel; addToolBarWidget(m_status); - addWindow(mainWidget, Perspective::AddToTab, nullptr, true, Qt::RightDockWidgetArea); + addWindow(objectWidget, Perspective::SplitVertical, nullptr); + addWindow(propertiesWidget, Perspective::SplitHorizontal, objectWidget); + addWindow(localsWidget, Perspective::AddToTab, nullptr, true, Qt::RightDockWidgetArea); connect(m_pausePlayAction, &QAction::triggered, this, &SquishPerspective::onPausePlayTriggered); connect(m_stepInAction, &QAction::triggered, this, [this] { @@ -250,6 +297,10 @@ void SquishPerspective::initPerspective() connect(m_stopAction, &QAction::triggered, this, &SquishPerspective::onStopTriggered); connect(m_stopRecordAction, &QAction::triggered, this, &SquishPerspective::onStopRecordTriggered); + connect(m_inspectAction, &QAction::triggered, this, [this]{ + m_inspectAction->setEnabled(false); + emit inspectTriggered(); + }); connect(SquishTools::instance(), &SquishTools::localsUpdated, this, &SquishPerspective::onLocalsUpdated); @@ -269,6 +320,7 @@ void SquishPerspective::onStopTriggered() m_stopRecordAction->setEnabled(false); m_pausePlayAction->setEnabled(false); m_stopAction->setEnabled(false); + m_inspectAction->setEnabled(false); emit stopRequested(); } @@ -277,6 +329,7 @@ void SquishPerspective::onStopRecordTriggered() m_stopRecordAction->setEnabled(false); m_pausePlayAction->setEnabled(false); m_stopAction->setEnabled(false); + m_inspectAction->setEnabled(false); emit stopRecordRequested(); } @@ -376,6 +429,7 @@ void SquishPerspective::setPerspectiveMode(PerspectiveMode mode) m_stepOverAction->setEnabled(false); m_stepOutAction->setEnabled(false); m_stopAction->setEnabled(true); + m_inspectAction->setEnabled(false); break; case Recording: m_stopRecordAction->setEnabled(true); @@ -386,6 +440,7 @@ void SquishPerspective::setPerspectiveMode(PerspectiveMode mode) m_stepOverAction->setEnabled(false); m_stepOutAction->setEnabled(false); m_stopAction->setEnabled(true); + m_inspectAction->setEnabled(false); break; case Interrupted: m_pausePlayAction->setEnabled(true); @@ -395,6 +450,7 @@ void SquishPerspective::setPerspectiveMode(PerspectiveMode mode) m_stepOverAction->setEnabled(true); m_stepOutAction->setEnabled(true); m_stopAction->setEnabled(true); + m_inspectAction->setEnabled(true); break; case Configuring: case Querying: @@ -407,6 +463,7 @@ void SquishPerspective::setPerspectiveMode(PerspectiveMode mode) m_stepOverAction->setEnabled(false); m_stepOutAction->setEnabled(false); m_stopAction->setEnabled(false); + m_inspectAction->setEnabled(false); m_localsModel.clear(); break; default: diff --git a/src/plugins/squish/squishperspective.h b/src/plugins/squish/squishperspective.h index 1e5c4aa515f..3a69247c33a 100644 --- a/src/plugins/squish/squishperspective.h +++ b/src/plugins/squish/squishperspective.h @@ -47,6 +47,7 @@ signals: void stopRecordRequested(); void interruptRequested(); void runRequested(StepMode mode); + void inspectTriggered(); private: void onStopTriggered(); @@ -60,9 +61,12 @@ private: QAction *m_stepOverAction = nullptr; QAction *m_stepOutAction = nullptr; QAction *m_stopAction = nullptr; + QAction *m_inspectAction = nullptr; QLabel *m_status = nullptr; class SquishControlBar *m_controlBar = nullptr; Utils::TreeModel m_localsModel; + Utils::TreeModel<> m_objectsModel; + Utils::TreeModel<> m_propertiesModel; PerspectiveMode m_mode = NoMode; friend class SquishControlBar;