diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 7dd498971b..d6c9174c57 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -34,6 +34,7 @@ #include "RicImportInputEclipseCaseFeature.h" #include "RicImportSummaryCasesFeature.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" +#include "HoloLensCommands/RicHoloLensSession.h" #include "Rim2dIntersectionViewCollection.h" #include "RimCellRangeFilterCollection.h" @@ -995,6 +996,8 @@ bool RiaApplication::saveProjectAs(const QString& fileName) //-------------------------------------------------------------------------------------------------- void RiaApplication::closeProject() { + RicHoloLensSession::instance()->terminateSession(); + RiuMainWindow* mainWnd = RiuMainWindow::instance(); RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate(); diff --git a/ApplicationCode/Commands/HoloLensCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/HoloLensCommands/CMakeLists_files.cmake index 3efb232d25..aeb3d9d40a 100644 --- a/ApplicationCode/Commands/HoloLensCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/HoloLensCommands/CMakeLists_files.cmake @@ -8,6 +8,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RicHoloLensCreateSessionFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicHoloLensTerminateSessionFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicHoloLensServerSettings.h ${CMAKE_CURRENT_LIST_DIR}/RicHoloLensCreateSessionUi.h +${CMAKE_CURRENT_LIST_DIR}/RicHoloLensSession.h + ${CMAKE_CURRENT_LIST_DIR}/VdeArrayDataPacket.h @@ -24,6 +26,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicHoloLensCreateSessionFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicHoloLensTerminateSessionFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicHoloLensServerSettings.cpp ${CMAKE_CURRENT_LIST_DIR}/RicHoloLensCreateSessionUi.cpp +${CMAKE_CURRENT_LIST_DIR}/RicHoloLensSession.cpp ${CMAKE_CURRENT_LIST_DIR}/VdeArrayDataPacket.cpp ${CMAKE_CURRENT_LIST_DIR}/VdeExportPart.cpp diff --git a/ApplicationCode/Commands/HoloLensCommands/RicHoloLensSession.cpp b/ApplicationCode/Commands/HoloLensCommands/RicHoloLensSession.cpp new file mode 100644 index 0000000000..8b6d3a4a83 --- /dev/null +++ b/ApplicationCode/Commands/HoloLensCommands/RicHoloLensSession.cpp @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicHoloLensSession.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicHoloLensSession::RicHoloLensSession() + : m_isSessionValid(false) + , m_isDummySession(false) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicHoloLensSession* RicHoloLensSession::instance() +{ + static RicHoloLensSession theInstance; + + return &theInstance; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicHoloLensSession::createSession(const QString& serverUrl, const QString& sessionName, const QString& sessionPinCode) +{ + if (isSessionValid()) + { + return false; + } + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicHoloLensSession::createDummyFileBackedSession() +{ + if (isSessionValid()) + { + return false; + } + + m_isDummySession = true; + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicHoloLensSession::isSessionValid() const +{ + if (m_isDummySession) return true; + + return m_isSessionValid; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicHoloLensSession::updateSessionDataFromView(RimGridView* activeView) {} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicHoloLensSession::terminateSession() +{ + m_isDummySession = false; + m_isSessionValid = false; +} diff --git a/ApplicationCode/Commands/HoloLensCommands/RicHoloLensSession.h b/ApplicationCode/Commands/HoloLensCommands/RicHoloLensSession.h new file mode 100644 index 0000000000..5f4c765b93 --- /dev/null +++ b/ApplicationCode/Commands/HoloLensCommands/RicHoloLensSession.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +class RimGridView; + +//================================================================================================== +/// +//================================================================================================== +class RicHoloLensSession +{ +public: + RicHoloLensSession(); + + static RicHoloLensSession* instance(); + + bool createSession(const QString& serverUrl, const QString& sessionName, const QString& sessionPinCode); + bool createDummyFileBackedSession(); + + bool isSessionValid() const; + + void updateSessionDataFromView(RimGridView* activeView); + void terminateSession(); + +private: + bool m_isSessionValid; + bool m_isDummySession; +};