2018-10-18 15:11:11 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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 "RicHoloLensCreateSessionFeature.h"
|
|
|
|
|
2018-10-19 03:08:33 -05:00
|
|
|
#include "RiaQIconTools.h"
|
|
|
|
|
2018-10-18 15:11:11 -05:00
|
|
|
#include "RicHoloLensCreateSessionUi.h"
|
|
|
|
#include "RicHoloLensServerSettings.h"
|
2018-10-22 04:45:33 -05:00
|
|
|
#include "RicHoloLensSession.h"
|
2018-10-18 15:11:11 -05:00
|
|
|
|
|
|
|
#include "cafPdmSettings.h"
|
|
|
|
#include "cafPdmUiPropertyViewDialog.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
2018-10-22 04:45:33 -05:00
|
|
|
#include <QPushButton>
|
2018-10-18 15:11:11 -05:00
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT(RicHoloLensCreateSessionFeature, "RicHoloLensCreateSessionFeature");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicHoloLensCreateSessionFeature::isCommandEnabled()
|
|
|
|
{
|
2018-10-22 04:45:33 -05:00
|
|
|
return !RicHoloLensSession::instance()->isSessionValid();
|
2018-10-18 15:11:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicHoloLensCreateSessionFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
|
|
|
RicHoloLensCreateSessionUi createSessionUi;
|
|
|
|
|
2018-10-22 04:45:33 -05:00
|
|
|
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &createSessionUi, "HoloLens - Create Session", "");
|
|
|
|
propertyDialog.resize(QSize(400, 330));
|
|
|
|
|
|
|
|
{
|
|
|
|
QDialogButtonBox* dialogButtonBox = propertyDialog.dialogButtonBox();
|
|
|
|
dialogButtonBox->clear();
|
|
|
|
|
|
|
|
QPushButton* pushButton = dialogButtonBox->addButton("Create Session", QDialogButtonBox::ActionRole);
|
|
|
|
connect(pushButton, SIGNAL(clicked()), &propertyDialog, SLOT(close()));
|
|
|
|
}
|
|
|
|
|
2018-10-18 15:11:11 -05:00
|
|
|
propertyDialog.exec();
|
2018-10-22 04:45:33 -05:00
|
|
|
|
|
|
|
RicHoloLensSession::instance()->createSession(
|
|
|
|
createSessionUi.serverUrl(), createSessionUi.sessionName(), createSessionUi.sessionPinCode());
|
|
|
|
|
|
|
|
RicHoloLensSession::refreshToolbarState();
|
|
|
|
|
2018-10-18 15:11:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicHoloLensCreateSessionFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
2018-10-19 03:08:33 -05:00
|
|
|
QPixmap pixmap(":/hololens.png");
|
|
|
|
QPixmap overlayPixmap(":/plus-sign-green.png");
|
|
|
|
|
|
|
|
QPixmap combinedPixmap = RiaQIconTools::appendPixmapUpperLeft(pixmap, overlayPixmap);
|
|
|
|
actionToSetup->setIcon(QIcon(combinedPixmap));
|
|
|
|
|
|
|
|
actionToSetup->setText("Create Session");
|
2018-10-18 15:11:11 -05:00
|
|
|
}
|