mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3541 HoloLens : Create dummy file backed feature
This commit is contained in:
@@ -997,6 +997,7 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
|
||||
void RiaApplication::closeProject()
|
||||
{
|
||||
RicHoloLensSession::instance()->terminateSession();
|
||||
RicHoloLensSession::refreshToolbarState();
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ ${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}/RicHoloLensCreateDummyFileBackedSessionFeature.h
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/VdeArrayDataPacket.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/VdeExportPart.h
|
||||
@@ -27,6 +26,7 @@ ${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}/RicHoloLensCreateDummyFileBackedSessionFeature.cpp
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/VdeArrayDataPacket.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/VdeExportPart.cpp
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicHoloLensCreateDummyFileBackedSessionFeature.h"
|
||||
|
||||
#include "RicHoloLensSession.h"
|
||||
|
||||
#include "RiaQIconTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicHoloLensCreateDummyFiledBackedSessionFeature, "RicHoloLensCreateDummyFiledBackedSessionFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicHoloLensCreateDummyFiledBackedSessionFeature::isCommandEnabled()
|
||||
{
|
||||
return !RicHoloLensSession::instance()->isSessionValid();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHoloLensCreateDummyFiledBackedSessionFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RicHoloLensSession::instance()->createDummyFileBackedSession();
|
||||
|
||||
RicHoloLensSession::refreshToolbarState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHoloLensCreateDummyFiledBackedSessionFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
QPixmap pixmap(":/hololens.png");
|
||||
QPixmap overlayPixmap(":/plus-sign-green.png");
|
||||
|
||||
QPixmap combinedPixmap = RiaQIconTools::appendPixmapUpperLeft(pixmap, overlayPixmap);
|
||||
actionToSetup->setIcon(QIcon(combinedPixmap));
|
||||
|
||||
actionToSetup->setText("Create Dummy File Backed Session");
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicHoloLensCreateDummyFiledBackedSessionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
private:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
};
|
||||
@@ -27,7 +27,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicHoloLensSession::RicHoloLensSession()
|
||||
: m_isSessionValid(false)
|
||||
, m_isDummySession(false)
|
||||
, m_isIsFileBackedSessionValid(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ bool RicHoloLensSession::createDummyFileBackedSession()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_isDummySession = true;
|
||||
m_isIsFileBackedSessionValid = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -82,11 +82,19 @@ bool RicHoloLensSession::createDummyFileBackedSession()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicHoloLensSession::isSessionValid() const
|
||||
{
|
||||
if (m_isDummySession) return true;
|
||||
if (m_isIsFileBackedSessionValid) return true;
|
||||
|
||||
return m_isSessionValid;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicHoloLensSession::isFileBackedSessionValid() const
|
||||
{
|
||||
return m_isIsFileBackedSessionValid;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -104,7 +112,7 @@ void RicHoloLensSession::terminateSession()
|
||||
|
||||
RiaLogging::info("Terminating HoloLens Session");
|
||||
|
||||
m_isDummySession = false;
|
||||
m_isIsFileBackedSessionValid = false;
|
||||
m_isSessionValid = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
bool createDummyFileBackedSession();
|
||||
|
||||
bool isSessionValid() const;
|
||||
bool isFileBackedSessionValid() const;
|
||||
|
||||
void updateSessionDataFromView(RimGridView* activeView);
|
||||
void terminateSession();
|
||||
@@ -44,5 +45,5 @@ public:
|
||||
|
||||
private:
|
||||
bool m_isSessionValid;
|
||||
bool m_isDummySession;
|
||||
bool m_isIsFileBackedSessionValid;
|
||||
};
|
||||
|
||||
@@ -499,6 +499,7 @@ void RiuMainWindow::createMenus()
|
||||
testMenu->addSeparator();
|
||||
|
||||
testMenu->addAction(cmdFeatureMgr->action("RicHoloLensExportToFolderFeature"));
|
||||
testMenu->addAction(cmdFeatureMgr->action("RicHoloLensCreateDummyFiledBackedSessionFeature"));
|
||||
|
||||
// Windows menu
|
||||
m_windowMenu = menuBar()->addMenu("&Windows");
|
||||
|
||||
Reference in New Issue
Block a user