diff --git a/VirtualReality/Resources/menuTextureImage2.png b/VirtualReality/Resources/menuTextureImage2.png
new file mode 100644
index 0000000..9cf74e2
Binary files /dev/null and b/VirtualReality/Resources/menuTextureImage2.png differ
diff --git a/VirtualReality/Widgets/CMakeLists.txt b/VirtualReality/Widgets/CMakeLists.txt
index 1a8f336..c90eb7a 100644
--- a/VirtualReality/Widgets/CMakeLists.txt
+++ b/VirtualReality/Widgets/CMakeLists.txt
@@ -19,19 +19,24 @@ set(${KIT}_SRCS
qMRML${MODULE_NAME}View.h
qMRML${MODULE_NAME}TransformWidget.cxx
qMRML${MODULE_NAME}TransformWidget.h
+ qMRMLVirtualRealityHomeWidget.cxx
+ qMRMLVirtualRealityHomeWidget.h
)
set(${KIT}_MOC_SRCS
qMRML${MODULE_NAME}View.h
qMRML${MODULE_NAME}TransformWidget.h
qMRML${MODULE_NAME}View_p.h
+ qMRMLVirtualRealityHomeWidget.h
)
set(${KIT}_UI_SRCS
+ Resources/UI/qMRMLVirtualRealityHomeWidget.ui
Resources/UI/qMRML${MODULE_NAME}TransformWidget.ui
)
set(${KIT}_RESOURCES
+ Resources/${KIT}.qrc
Resources/qMRML${MODULE_NAME}TransformWidget.qrc
)
diff --git a/VirtualReality/Widgets/Resources/StyleSheets/VrWidgetStyle.qss b/VirtualReality/Widgets/Resources/StyleSheets/VrWidgetStyle.qss
new file mode 100644
index 0000000..ee037b4
--- /dev/null
+++ b/VirtualReality/Widgets/Resources/StyleSheets/VrWidgetStyle.qss
@@ -0,0 +1,50 @@
+QWidget {
+ font: 20px;
+}
+
+QAbstractButton {
+ color: #3a3a3a;
+ border-color: #3a3a3a;
+ border-style: solid;
+ border-width: 1px;
+ border-radius: 10px;
+ padding: 4px;
+}
+
+QAbstractButton:hover {
+ background-color:#ABABAB;
+}
+
+QAbstractButton:pressed {
+ background-color: #525252;
+}
+
+QSlider {
+ min-height: 68px;
+ max-height: 68px;
+ background: white;
+}
+
+QSlider::groove:horizontal {
+ border: 1px solid #262626;
+ height: 5px;
+ background: #399aef;
+ margin: 0 12px;
+}
+
+QSlider::handle:horizontal {
+ background: white;
+ border: 2px solid black;
+ border-radius: 10px;
+ width: 23px;
+ height: 100px;
+ margin: -24px -12px;
+}
+
+QSlider::handle:horizontal:hover {
+ background: #ABABAB;
+}
+
+QSlider::handle:horizontal:pressed {
+ background: #525252;
+}
diff --git a/VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealityHomeWidget.ui b/VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealityHomeWidget.ui
new file mode 100644
index 0000000..8cd2672
--- /dev/null
+++ b/VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealityHomeWidget.ui
@@ -0,0 +1,206 @@
+
+
+ qMRMLVirtualRealityHomeWidget
+
+
+
+ 0
+ 0
+ 532
+ 262
+
+
+
+ VR Home
+
+
+ -
+
+
+ Back
+
+
+
+ -
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Raised
+
+
+
-
+
+
+ Sync view to reference view
+
+
+
+ -
+
+
+ Fly speed:
+
+
+ Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft
+
+
+
+ -
+
+
+ 1
+
+
+ 0.500000000000000
+
+
+ 2.000000000000000
+
+
+ 0.100000000000000
+
+
+ 10.000000000000000
+
+
+ 1.660000000000000
+
+
+ m/s
+
+
+
+ -
+
+
+ Magnification:
+
+
+ Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft
+
+
+
+ -
+
+
-
+
+
+ 10x
+
+
+
+ -
+
+
+ Lock magnification
+
+
+
+ -
+
+
+ 0.01x
+
+
+
+ -
+
+
+ 1x
+
+
+
+ -
+
+
+ 0.1x
+
+
+
+ -
+
+
+ 100x
+
+
+
+
+
+ -
+
+
+
+ 0
+ 13
+
+
+
+ Motion sensitivity:
+
+
+ Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft
+
+
+
+ -
+
+
+ 0
+
+
+ 100.000000000000000
+
+
+ 50.000000000000000
+
+
+ %
+
+
+
+
+
+
+ -
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Raised
+
+
+
+
+ -
+
+
+ Modules
+
+
+
-
+
+
+
+
+
+
+
+
+
+ qMRMLWidget
+ QWidget
+
+ 1
+
+
+ ctkSliderWidget
+ QWidget
+
+
+
+
+
+
diff --git a/VirtualReality/Widgets/Resources/qSlicerVirtualRealityModuleWidgets.qrc b/VirtualReality/Widgets/Resources/qSlicerVirtualRealityModuleWidgets.qrc
new file mode 100644
index 0000000..9cb40ca
--- /dev/null
+++ b/VirtualReality/Widgets/Resources/qSlicerVirtualRealityModuleWidgets.qrc
@@ -0,0 +1,5 @@
+
+
+ StyleSheets/VrWidgetStyle.qss
+
+
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.cxx b/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.cxx
new file mode 100644
index 0000000..e35b25c
--- /dev/null
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.cxx
@@ -0,0 +1,367 @@
+/*==============================================================================
+
+ Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
+ Queen's University, Kingston, ON, Canada. All Rights Reserved.
+
+ See COPYRIGHT.txt
+ or http://www.slicer.org/copyright/copyright.txt for details.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ This file was originally developed by Csaba Pinter, PerkLab, Queen's University
+ and was supported through the Applied Cancer Research Unit program of Cancer Care
+ Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
+ and CANARIE.
+
+==============================================================================*/
+
+// VirtualReality Widgets includes
+#include "qMRMLVirtualRealityHomeWidget.h"
+
+#include "ui_qMRMLVirtualRealityHomeWidget.h"
+
+// VirtualReality MRML includes
+#include "vtkMRMLVirtualRealityViewNode.h"
+
+// VTK includes
+#include
+
+// Qt includes
+#include
+#include
+
+//-----------------------------------------------------------------------------
+class qMRMLVirtualRealityHomeWidgetPrivate : public Ui_qMRMLVirtualRealityHomeWidget
+{
+ Q_DECLARE_PUBLIC(qMRMLVirtualRealityHomeWidget);
+
+protected:
+ qMRMLVirtualRealityHomeWidget* const q_ptr;
+
+public:
+ qMRMLVirtualRealityHomeWidgetPrivate(qMRMLVirtualRealityHomeWidget& object);
+ virtual ~qMRMLVirtualRealityHomeWidgetPrivate();
+
+ void init();
+
+ QMap ModuleWidgetsMap;
+
+public:
+ /// Virtual reality view MRML node
+ vtkWeakPointer VirtualRealityViewNode;
+};
+
+//-----------------------------------------------------------------------------
+qMRMLVirtualRealityHomeWidgetPrivate::qMRMLVirtualRealityHomeWidgetPrivate(qMRMLVirtualRealityHomeWidget& object)
+ : q_ptr(&object)
+{
+ this->VirtualRealityViewNode = nullptr;
+}
+
+//-----------------------------------------------------------------------------
+qMRMLVirtualRealityHomeWidgetPrivate::~qMRMLVirtualRealityHomeWidgetPrivate()
+{
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidgetPrivate::init()
+{
+ Q_Q(qMRMLVirtualRealityHomeWidget);
+ this->setupUi(q);
+
+ this->backButton->setVisible(false);
+
+ QObject::connect(this->MotionSensitivitySliderWidget, SIGNAL(valueChanged(double)), q, SLOT(onMotionSensitivityChanged(double)));
+ QObject::connect(this->FlySpeedSliderWidget, SIGNAL(valueChanged(double)), q, SLOT(onFlySpeedChanged(double)));
+ QObject::connect(this->Magnification001xButton, SIGNAL(clicked()), q, SLOT(onMagnification001xPressed()));
+ QObject::connect(this->Magnification01xButton, SIGNAL(clicked()), q, SLOT(onMagnification01xPressed()));
+ QObject::connect(this->Magnification1xButton, SIGNAL(clicked()), q, SLOT(onMagnification1xPressed()));
+ QObject::connect(this->Magnification10xButton, SIGNAL(clicked()), q, SLOT(onMagnification10xPressed()));
+ QObject::connect(this->Magnification100xButton, SIGNAL(clicked()), q, SLOT(onMagnification100xPressed()));
+ QObject::connect(this->SyncViewToReferenceViewButton, SIGNAL(clicked()), q, SLOT(updateViewFromReferenceViewCamera()));
+
+ //QObject::connect(this->LockMagnificationCheckBox, SIGNAL(toggled(bool)), q, SLOT(setMagnificationLock(bool)));
+ //TODO: Magnification lock of view node not implemented yet
+}
+
+//-----------------------------------------------------------------------------
+// qMRMLVirtualRealityHomeWidget methods
+
+//-----------------------------------------------------------------------------
+qMRMLVirtualRealityHomeWidget::qMRMLVirtualRealityHomeWidget(QWidget* _parent)
+ : qMRMLWidget(_parent)
+ , d_ptr(new qMRMLVirtualRealityHomeWidgetPrivate(*this))
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ d->init();
+ this->updateWidgetFromMRML();
+}
+
+//-----------------------------------------------------------------------------
+qMRMLVirtualRealityHomeWidget::~qMRMLVirtualRealityHomeWidget()
+= default;
+
+//-----------------------------------------------------------------------------
+vtkMRMLVirtualRealityViewNode* qMRMLVirtualRealityHomeWidget::virtualRealityViewNode() const
+{
+ Q_D(const qMRMLVirtualRealityHomeWidget);
+ return d->VirtualRealityViewNode;
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::addModuleButton(QWidget* moduleWidget, QIcon& icon)
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+
+ if (!moduleWidget)
+ {
+ qCritical() << Q_FUNC_INFO << "Failed: widget is null";
+ return;
+ }
+
+ QPushButton* moduleButton = new QPushButton(d->ModulesGroupBox);
+ d->ModulesGroupBoxLayout->addWidget(moduleButton);
+ moduleButton->setIcon(icon);
+
+ moduleWidget->setParent(d->ModuleWidgetFrame);
+ d->ModuleWidgetsMap[moduleButton] = moduleWidget;
+
+ QObject::connect(moduleButton, SIGNAL(clicked()), this, SLOT(onModuleButtonPressed()));
+ QObject::connect(d->backButton, SIGNAL(clicked()), this, SLOT(onBackButtonPressed()));
+
+ moduleButton->setVisible(true);
+ moduleWidget->setVisible(false);
+ d->backButton->setVisible(false);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onModuleButtonPressed()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+
+ QPushButton* moduleButton = qobject_cast(sender());
+
+ if (!moduleButton)
+ {
+ qCritical() << Q_FUNC_INFO << "Failed: moduleButton is null";
+ return;
+ }
+
+ d->HomeWidgetFrame->setVisible(false);
+ d->ModulesGroupBox->setVisible(false);
+ d->ModuleWidgetsMap[moduleButton]->setVisible(true);
+ d->backButton->setVisible(true);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onBackButtonPressed()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ d->HomeWidgetFrame->setVisible(true);
+ d->ModulesGroupBox->setVisible(true);
+ d->backButton->setVisible(false);
+
+ QMap::const_iterator iteratorForMap;
+ for (iteratorForMap = d->ModuleWidgetsMap.constBegin(); iteratorForMap != d->ModuleWidgetsMap.constEnd(); ++iteratorForMap)
+ {
+ iteratorForMap.value()->setVisible(false);
+ }
+
+}
+
+//-----------------------------------------------------------------------------
+QString qMRMLVirtualRealityHomeWidget::virtualRealityViewNodeID()const
+{
+ Q_D(const qMRMLVirtualRealityHomeWidget);
+ return (d->VirtualRealityViewNode.GetPointer() ? d->VirtualRealityViewNode->GetID() : QString());
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::setVirtualRealityViewNode(vtkMRMLVirtualRealityViewNode * node)
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+
+ if (d->VirtualRealityViewNode == node)
+ {
+ return;
+ }
+
+ qvtkReconnect(d->VirtualRealityViewNode, node, vtkCommand::ModifiedEvent, this, SLOT(updateWidgetFromMRML()));
+
+ vtkMRMLVirtualRealityViewNode* vrViewNode = vtkMRMLVirtualRealityViewNode::SafeDownCast(node);
+ d->VirtualRealityViewNode = vrViewNode;
+
+ this->updateWidgetFromMRML();
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::updateWidgetFromMRML()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ bool wasBlocked = d->MotionSensitivitySliderWidget->blockSignals(true);
+ d->MotionSensitivitySliderWidget->setValue(vrViewNode != nullptr ? vrViewNode->GetMotionSensitivity() * 100.0 : 0);
+ d->MotionSensitivitySliderWidget->setEnabled(vrViewNode != nullptr);
+ d->MotionSensitivitySliderWidget->blockSignals(wasBlocked);
+
+ wasBlocked = d->FlySpeedSliderWidget->blockSignals(true);
+ d->FlySpeedSliderWidget->setValue(vrViewNode != nullptr ? vrViewNode->GetMotionSpeed() : 1.6666);
+ d->FlySpeedSliderWidget->setEnabled(vrViewNode != nullptr);
+ d->FlySpeedSliderWidget->blockSignals(wasBlocked);
+
+ /*
+ bool wasBlocked = d->LockMagnificationCheckBox->blockSignals(true);
+ d->LockMagnificationCheckBox->setChecked(vrViewNode != nullptr && vrViewNode->);
+ d->LockMagnificationCheckBox->setEnabled(vrViewNode != nullptr);
+ d->LockMagnificationCheckBox->blockSignals(wasBlocked);
+ */
+ //TODO: Magnification lock of view node not implemented yet
+
+ d->Magnification001xButton->setEnabled(vrViewNode != nullptr && vrViewNode->GetMagnification() != NULL);
+ d->Magnification01xButton->setEnabled(vrViewNode != nullptr && vrViewNode->GetMagnification() != NULL);
+ d->Magnification1xButton->setEnabled(vrViewNode != nullptr && vrViewNode->GetMagnification() != NULL);
+ d->Magnification10xButton->setEnabled(vrViewNode != nullptr && vrViewNode->GetMagnification() != NULL);
+ d->Magnification100xButton->setEnabled(vrViewNode != nullptr && vrViewNode->GetMagnification() != NULL);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onMotionSensitivityChanged(double percent)
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ if (!vrViewNode)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrViewNode->SetMotionSensitivity(percent * 0.01);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onFlySpeedChanged(double speedMps)
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ if (!vrViewNode)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrViewNode->SetMotionSpeed(speedMps);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onMagnification001xPressed()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ if (!vrViewNode)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrViewNode->SetMagnification(0.01);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onMagnification01xPressed()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ if (!vrViewNode)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrViewNode->SetMagnification(0.1);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onMagnification1xPressed()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ if (!vrViewNode)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrViewNode->SetMagnification(1.0);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onMagnification10xPressed()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ if (!vrViewNode)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrViewNode->SetMagnification(10.0);
+}
+
+//-----------------------------------------------------------------------------
+void qMRMLVirtualRealityHomeWidget::onMagnification100xPressed()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ if (!vrViewNode)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrViewNode->SetMagnification(100.0);
+}
+
+//-----------------------------------------------------------------------------
+/*
+void qMRMLVirtualRealityHomeWidget::updateViewFromReferenceViewCamera()
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ qSlicerVirtualRealityModule* vrModule = dynamic_cast(this->module());
+ if (!vrModule)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: vrModule is null";
+ return;
+ }
+ qMRMLVirtualRealityView* vrView = vrModule->viewWidget();
+ if (!vrView)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrView->updateViewFromReferenceViewCamera();
+}
+*/
+//TODO: This member function won't work unless qSlicerVirtualRealityModule and qMRMLVirtualRealityView are included
+
+//-----------------------------------------------------------------------------
+/*
+void qMRMLVirtualRealityHomeWidget::setMagnificationLock(bool active)
+{
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ vtkMRMLVirtualRealityViewNode* vrViewNode = d->VirtualRealityViewNode;
+
+ if (!vrViewNode)
+ {
+ qCritical() << Q_FUNC_INFO << " Failed: view node is null";
+ return;
+ }
+ vrViewNode->????(active); //TODO: Implement magnification lock for view node
+
+}
+*/
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.h b/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.h
new file mode 100644
index 0000000..470699f
--- /dev/null
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.h
@@ -0,0 +1,89 @@
+/*==============================================================================
+
+ Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
+ Queen's University, Kingston, ON, Canada. All Rights Reserved.
+
+ See COPYRIGHT.txt
+ or http://www.slicer.org/copyright/copyright.txt for details.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ This file was originally developed by Csaba Pinter, PerkLab, Queen's University
+ and was supported through the Applied Cancer Research Unit program of Cancer Care
+ Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
+ and CANARIE.
+
+==============================================================================*/
+
+#ifndef __qMRMLVirtualRealityHomeWidget_h
+#define __qMRMLVirtualRealityHomeWidget_h
+
+// VirtualReality Widgets includes
+#include "qSlicerVirtualRealityModuleWidgetsExport.h"
+
+// MRMLWidgets includes
+#include "qMRMLWidget.h"
+
+// CTK includes
+#include
+#include
+
+// Qt includes
+#include
+#include
+
+class vtkMRMLVirtualRealityViewNode;
+class qMRMLVirtualRealityHomeWidgetPrivate;
+
+/// \ingroup SlicerVirtualReality_Widgets
+class Q_SLICER_QTMODULES_VIRTUALREALITY_WIDGETS_EXPORT qMRMLVirtualRealityHomeWidget : public qMRMLWidget
+{
+ Q_OBJECT
+ QVTK_OBJECT
+
+public:
+ typedef qMRMLWidget Superclass;
+ /// Constructor
+ explicit qMRMLVirtualRealityHomeWidget(QWidget* parent = nullptr);
+ /// Destructor
+ ~qMRMLVirtualRealityHomeWidget() override;
+
+ /// Get virtual reality view MRML node
+ Q_INVOKABLE vtkMRMLVirtualRealityViewNode* virtualRealityViewNode()const;
+ Q_INVOKABLE QString virtualRealityViewNodeID()const;
+
+public slots:
+ /// Set virtual reality view MRML node
+ void setVirtualRealityViewNode(vtkMRMLVirtualRealityViewNode* node);
+
+ void onMotionSensitivityChanged(double);
+ void onFlySpeedChanged(double);
+ void onMagnification001xPressed();
+ void onMagnification01xPressed();
+ void onMagnification1xPressed();
+ void onMagnification10xPressed();
+ void onMagnification100xPressed();
+ //void updateViewFromReferenceViewCamera();
+ //void setMagnificationLock(bool);
+
+ void addModuleButton(QWidget* moduleWidget, QIcon& icon);
+ void onModuleButtonPressed();
+ void onBackButtonPressed();
+
+protected slots:
+ /// Update widgets from the MRML node
+ void updateWidgetFromMRML();
+
+protected:
+ QScopedPointer d_ptr;
+
+private:
+ Q_DECLARE_PRIVATE(qMRMLVirtualRealityHomeWidget);
+ Q_DISABLE_COPY(qMRMLVirtualRealityHomeWidget);
+};
+
+#endif
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityView.cxx b/VirtualReality/Widgets/qMRMLVirtualRealityView.cxx
index 9d8d0f8..4dc3da8 100644
--- a/VirtualReality/Widgets/qMRMLVirtualRealityView.cxx
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityView.cxx
@@ -40,6 +40,7 @@
#include
#include
#include
+#include
// CTK includes
#include
@@ -57,7 +58,7 @@
#include "vtkSlicerCamerasModuleLogic.h"
#include // For Slicer_VERSION_MAJOR, Slicer_VERSION_MINOR
-// VirtualReality includes
+// VirtualReality MRML includes
#include "vtkMRMLVirtualRealityViewNode.h"
// MRMLDisplayableManager includes
@@ -120,6 +121,7 @@ qMRMLVirtualRealityViewPrivate::qMRMLVirtualRealityViewPrivate(qMRMLVirtualReali
, CamerasLogic(NULL)
{
this->MRMLVirtualRealityViewNode = 0;
+ this->HomeWidget = new qMRMLVirtualRealityHomeWidget(q_ptr);
}
//---------------------------------------------------------------------------
@@ -621,7 +623,6 @@ void qMRMLVirtualRealityViewPrivate::updateTransformNodesWithTrackerPoses()
#endif
}
-
//----------------------------------------------------------------------------
void qMRMLVirtualRealityViewPrivate::updateTransformNodeWithPose(vtkMRMLTransformNode* node, vr::TrackedDevicePose_t& pose)
{
@@ -641,7 +642,6 @@ void qMRMLVirtualRealityViewPrivate::updateTransformNodeWithPose(vtkMRMLTransfor
node->SetAttribute("VirtualReality.PoseStatus", PoseStatusToString(pose.eTrackingResult).c_str());
}
-
// --------------------------------------------------------------------------
// qMRMLVirtualRealityView methods
@@ -658,6 +658,13 @@ qMRMLVirtualRealityView::~qMRMLVirtualRealityView()
{
}
+//------------------------------------------------------------------------------
+void qMRMLVirtualRealityView::registerModule(QWidget* widget, QIcon& icon)
+{
+ Q_D(qMRMLVirtualRealityView);
+ d->HomeWidget->addModuleButton(widget, icon);
+}
+
//------------------------------------------------------------------------------
void qMRMLVirtualRealityView::addDisplayableManager(const QString& displayableManagerName)
{
@@ -697,6 +704,13 @@ vtkMRMLVirtualRealityViewNode* qMRMLVirtualRealityView::mrmlVirtualRealityViewNo
return d->MRMLVirtualRealityViewNode;
}
+//----------------------------------------------------------------------------
+qMRMLVirtualRealityHomeWidget* qMRMLVirtualRealityView::vrHomeWidget()const
+{
+ Q_D(const qMRMLVirtualRealityView);
+ return d->HomeWidget;
+}
+
//------------------------------------------------------------------------------
void qMRMLVirtualRealityView::getDisplayableManagers(vtkCollection* displayableManagers)
{
@@ -815,3 +829,17 @@ void qMRMLVirtualRealityView::updateViewFromReferenceViewCamera()
ren->ResetCameraClippingRange();
}
+
+//------------------------------------------------------------------------------
+void qMRMLVirtualRealityView::setVirtualWidget(QWidget* menuWidget)
+{
+ QPixmap menuTexture(menuWidget->size());
+ //TODO: Set VR style sheet on widget (large text etc)
+ menuWidget->render(&menuTexture);
+
+ bool errorCheck = menuTexture.save("menuTextureImage.png", "PNG", 100);
+ if (!errorCheck)
+ {
+ qCritical() << Q_FUNC_INFO << ": Error while saving menu texture";
+ }
+}
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityView.h b/VirtualReality/Widgets/qMRMLVirtualRealityView.h
index ac9f965..6e36771 100644
--- a/VirtualReality/Widgets/qMRMLVirtualRealityView.h
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityView.h
@@ -33,6 +33,7 @@
// CTK includes
#include
+class qMRMLVirtualRealityHomeWidget;
class qMRMLVirtualRealityViewPrivate;
class vtkMRMLVirtualRealityViewNode;
class vtkCollection;
@@ -84,6 +85,8 @@ class Q_SLICER_QTMODULES_VIRTUALREALITY_WIDGETS_EXPORT qMRMLVirtualRealityView :
/// Get the 3D View node observed by view.
Q_INVOKABLE vtkMRMLVirtualRealityViewNode* mrmlVirtualRealityViewNode()const;
+ Q_INVOKABLE qMRMLVirtualRealityHomeWidget* vrHomeWidget()const;
+
/// Get a reference to the associated vtkRenderer
vtkOpenVRRenderer* renderer()const;
@@ -100,6 +103,8 @@ class Q_SLICER_QTMODULES_VIRTUALREALITY_WIDGETS_EXPORT qMRMLVirtualRealityView :
/// Get underlying RenderWindow
Q_INVOKABLE bool isHardwareConnected()const;
+ void registerModule(QWidget* widget, QIcon& icon);
+
signals:
void physicalToWorldMatrixModified();
@@ -109,8 +114,10 @@ public slots:
void onPhysicalToWorldMatrixModified();
-protected:
+ /// Set widget that is being shown on the "tablet panel" in virtual reality
+ void setVirtualWidget(QWidget*);
+protected:
QScopedPointer d_ptr;
private:
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityView_p.h b/VirtualReality/Widgets/qMRMLVirtualRealityView_p.h
index f109afc..26c81db 100644
--- a/VirtualReality/Widgets/qMRMLVirtualRealityView_p.h
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityView_p.h
@@ -40,6 +40,9 @@
#include
#include
+// VirtualReality Widgets includes
+#include "qMRMLVirtualRealityHomeWidget.h"
+
// qMRML includes
#include "qMRMLVirtualRealityView.h"
@@ -115,6 +118,8 @@ public slots:
double LastViewPosition[3];
QTimer VirtualRealityLoopTimer;
+
+ qMRMLVirtualRealityHomeWidget* HomeWidget;
};
#endif
diff --git a/VirtualReality/qSlicerHomeVirtualWidget.cxx b/VirtualReality/qSlicerHomeVirtualWidget.cxx
new file mode 100644
index 0000000..9d36104
--- /dev/null
+++ b/VirtualReality/qSlicerHomeVirtualWidget.cxx
@@ -0,0 +1,93 @@
+/*==============================================================================
+
+ Program: 3D Slicer
+
+ Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
+
+ See COPYRIGHT.txt
+ or http://www.slicer.org/copyright/copyright.txt for details.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+==============================================================================*/
+
+#include
+#include "qSlicerHomeVirtualReality.h"
+
+// Qt includes
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+//-----------------------------------------------------------------------------
+// qSlicerHomeVirtualWidget Methods
+
+//-----------------------------------------------------------------------------
+qSlicerHomeVirtualWidget::qSlicerHomeVirtualWidget(QWidget *parent)
+{
+ this->minimumHeight(650);
+ this->minimumWidth(980);
+ this->resize(dimensions::height, dimensions::width);
+
+ //Create all the Qlabels
+ QLabel *flySpeedLabel = new QLabel("Fly Speed:", this);
+ QLabel *magnificationLabel = new QLabel("Magnification:", this);
+ QLabel *motionSenLabel = new QLabel("Motion Sensitivity:", this;
+ QLabel *lightingLabel = new QLabel("Lighting:", this);
+
+ //Create all the push buttons
+ QPushButton *syncView = new QPushButton("Sync view to Reference View", this);
+ QPushButton *magnificationButton1 = new QPushButton("0.5x", this);
+ QPushButton *magnificationButton2 = new QPushButton("1x", this);
+ QPushButton *magnificationButton3 = new QPushButton("2x", this);
+ QPushButton *magnificationButton4 = new QPushButton("40x", this);
+ QPushButton *twoSidedLighting = new QPushButton("Two-sided Lighting", this);
+ QPushButton *backLighting = new QPushButton("Back Lighting", this);
+
+ //create all sliders
+ QSlider *flySpeedSlider = new QSlider(Qt::Horizontal, this);
+ QSlider *motionSenSlider = new QSlider(Qt::Horizontal, this);
+
+ //create the layouts for the UI
+ QFormLayout *menuLayout = new QFormLayout(this);
+ QHBoxLayout *magnificationButtonLayout = new QHBoxLayout(this);
+ QHBoxLayout *lightingButtonLayout = new QHBoxLayout(this);
+
+ //place Qwidgets in appropriate layouts
+ magnificationButtonLayout->addWidget(magnificationButton1);
+ magnificationButtonLayout->addWidget(magnificationButton2);
+ magnificationButtonLayout->addWidget(magnificationButton3);
+ magnificationButtonLayout->addWidget(magnificationButton4);
+ lightingButtonLayout->addWidget(twoSidedLighting);
+ lightingButtonLayout->addWidget(backLighting);
+
+ //set up the main form layout
+ menuLayout->addRow(flySpeedLabel, flySpeedSlider);
+ menuLayout->addRow(magnificationLabel, magnificationButtonLayout);
+ menuLayout->addRow(motionSenLabel, motionSenSlider);
+ menuLayout->addRow(lightingLabel, lightingButtonLayout);
+
+ //spacing and positioning
+ menuLayout->setHorizontalSpacing(20);
+ menuLayout->setVerticleSpacing(99);
+}
+//---------------------------------------------------------------
+qSlicerHomeVirtualWidget::~qSlicerHomeVirtualWidget()
+{
+};
\ No newline at end of file
diff --git a/VirtualReality/qSlicerHomeVirtualWidget.h b/VirtualReality/qSlicerHomeVirtualWidget.h
new file mode 100644
index 0000000..c27ba39
--- /dev/null
+++ b/VirtualReality/qSlicerHomeVirtualWidget.h
@@ -0,0 +1,43 @@
+/*==============================================================================
+
+ Program: 3D Slicer
+
+ Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
+
+ See COPYRIGHT.txt
+ or http://www.slicer.org/copyright/copyright.txt for details.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+==============================================================================*/
+
+#ifndef __qSlicerHomeVirtualWidget_h
+#define __qSlicerHomeVirtualWidget_h
+
+// SlicerQt includes
+//Qt includes
+#include
+#include
+
+namespace dimensions
+{
+ const int height = 688;
+ const int width = 980;
+}
+
+class qSlicerHomeVirtualWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ qSlicerHomeVirtualWidget(QWidget *parent = 0);
+ ~qSlicerHomeVirtualWidget();
+public slots:
+
+};
+
+
+#endif