#3524 HoloLens : Add toolbar and icons for operations

This commit is contained in:
Magne Sjaastad 2018-10-19 10:08:33 +02:00
parent 1727ab959a
commit 822645e264
13 changed files with 128 additions and 20 deletions

View File

@ -41,6 +41,7 @@ int main(int argc, char *argv[])
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
window.setWindowTitle("ResInsight " + platform);
window.setDefaultWindowSize();
window.setDefaultToolbarVisibility();
window.loadWinGeoAndDockToolBarLayout();
window.showWindow();

View File

@ -35,6 +35,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaWeightedGeometricMeanCalculator.h
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedHarmonicMeanCalculator.h
${CMAKE_CURRENT_LIST_DIR}/RiaOptionItemFactory.h
${CMAKE_CURRENT_LIST_DIR}/RiaGitDiff.h
${CMAKE_CURRENT_LIST_DIR}/RiaQIconTools.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -70,6 +71,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaWeightedGeometricMeanCalculator.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedHarmonicMeanCalculator.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaOptionItemFactory.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaGitDiff.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaQIconTools.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Equinor 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 "RiaQIconTools.h"
#include <QPainter>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QPixmap RiaQIconTools::appendPixmapUpperLeft(const QPixmap& pixmap, const QPixmap& overlayPixmap)
{
QPixmap scaledToFitIncoming;
{
QSize size = pixmap.size() / 2;
scaledToFitIncoming = overlayPixmap.scaled(size);
}
QPixmap pixmapWithSign(pixmap);
QPainter painter(&pixmapWithSign);
painter.drawPixmap(0, 0, scaledToFitIncoming);
return pixmapWithSign;
}

View File

@ -0,0 +1,32 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Equinor 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 <QIcon>
//==================================================================================================
//
//
//
//==================================================================================================
class RiaQIconTools
{
public:
static QPixmap appendPixmapUpperLeft(const QPixmap& pixmap, const QPixmap& overlayPixmap);
};

View File

@ -18,6 +18,8 @@
#include "RicHoloLensCreateSessionFeature.h"
#include "RiaQIconTools.h"
#include "RicHoloLensCreateSessionUi.h"
#include "RicHoloLensServerSettings.h"
@ -54,6 +56,11 @@ void RicHoloLensCreateSessionFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicHoloLensCreateSessionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/hololens.png"));
actionToSetup->setText("HoloLens : Create Session");
QPixmap pixmap(":/hololens.png");
QPixmap overlayPixmap(":/plus-sign-green.png");
QPixmap combinedPixmap = RiaQIconTools::appendPixmapUpperLeft(pixmap, overlayPixmap);
actionToSetup->setIcon(QIcon(combinedPixmap));
actionToSetup->setText("Create Session");
}

View File

@ -21,6 +21,8 @@
#include "VdeFileExporter.h"
#include "RiaApplication.h"
#include "RiaQIconTools.h"
#include "RimGridView.h"
#include <QAction>
@ -34,7 +36,7 @@ bool RicHoloLensExportToSharingServerFeature::isCommandEnabled()
{
// Return true if a valid session is active
return false;
return true;
}
//--------------------------------------------------------------------------------------------------
@ -55,6 +57,11 @@ void RicHoloLensExportToSharingServerFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicHoloLensExportToSharingServerFeature::setupActionLook(QAction* actionToSetup)
{
//actionToSetup->setIcon(QIcon(":/Save.png"));
actionToSetup->setText("HoloLens : Export to Sharing Server");
QPixmap pixmap(":/hololens.png");
QPixmap overlayPixmap(":/arrow-right-green.png");
QPixmap combinedPixmap = RiaQIconTools::appendPixmapUpperLeft(pixmap, overlayPixmap);
actionToSetup->setIcon(QIcon(combinedPixmap));
actionToSetup->setText("Export to Sharing Server");
}

View File

@ -19,6 +19,7 @@
#include "RicHoloLensTerminateSessionFeature.h"
#include "RiaLogging.h"
#include "RiaQIconTools.h"
#include <QAction>
@ -47,6 +48,11 @@ void RicHoloLensTerminateSessionFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicHoloLensTerminateSessionFeature::setupActionLook(QAction* actionToSetup)
{
//actionToSetup->setIcon(QIcon(":/Save.png"));
actionToSetup->setText("HoloLens : Terminate Session");
QPixmap pixmap(":/hololens.png");
QPixmap overlayPixmap(":/minus-sign-red.png");
QPixmap combinedPixmap = RiaQIconTools::appendPixmapUpperLeft(pixmap, overlayPixmap);
actionToSetup->setIcon(QIcon(combinedPixmap));
actionToSetup->setText("Terminate Session");
}

View File

@ -123,6 +123,9 @@
<file>WellTargetPoint16x16.png</file>
<file>WellTargetPointTangent16x16.png</file>
<file>hololens.png</file>
<file>minus-sign-red.png</file>
<file>plus-sign-green.png</file>
<file>arrow-right-green.png</file>
</qresource>
<qresource prefix="/Shader/">
<file>fs_CellFace.glsl</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

View File

@ -116,7 +116,8 @@ RiuMainWindow::RiuMainWindow()
m_pvtPlotPanel(nullptr),
m_mohrsCirclePlot(nullptr),
m_windowMenu(nullptr),
m_blockSlotSubWindowActivated(false)
m_blockSlotSubWindowActivated(false),
m_holoLensToolBar(nullptr)
{
CVF_ASSERT(sm_mainWindowInstance == nullptr);
@ -581,17 +582,15 @@ void RiuMainWindow::createToolBars()
dsToolBar->addAction(m_drawStyleHideGridCellsAction);
dsToolBar->addAction(m_toggleFaultsLabelAction);
dsToolBar->addAction(m_showWellCellsAction);
dsToolBar->hide();
}
{
QToolBar* toolbar = addToolBar(tr("HoloLens"));
toolbar->setObjectName(toolbar->windowTitle());
m_holoLensToolBar = addToolBar(tr("HoloLens"));
m_holoLensToolBar->setObjectName(m_holoLensToolBar->windowTitle());
toolbar->addAction(cmdFeatureMgr->action("RicHoloLensCreateSessionFeature"));
toolbar->addAction(cmdFeatureMgr->action("RicHoloLensTerminateSessionFeature"));
toolbar->addAction(cmdFeatureMgr->action("RicHoloLensExportToSharingServerFeature"));
toolbar->hide();
m_holoLensToolBar->addAction(cmdFeatureMgr->action("RicHoloLensCreateSessionFeature"));
m_holoLensToolBar->addAction(cmdFeatureMgr->action("RicHoloLensTerminateSessionFeature"));
m_holoLensToolBar->addAction(cmdFeatureMgr->action("RicHoloLensExportToSharingServerFeature"));
}
RiaApplication* app = RiaApplication::instance();
@ -1744,6 +1743,14 @@ void RiuMainWindow::showProcessMonitorDockPanel()
showDockPanel(RiuDockWidgetTools::instance()->processMonitorName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::setDefaultToolbarVisibility()
{
m_holoLensToolBar->hide();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -123,6 +123,7 @@ public:
RiuMessagePanel* messagePanel();
void showProcessMonitorDockPanel();
void setDefaultToolbarVisibility();
protected:
void closeEvent(QCloseEvent* event) override;
@ -213,12 +214,12 @@ private slots:
void slotViewFromBelow();
void slotScaleChanged(int scaleValue);
void slotDrawStyleChanged(QAction* activatedAction);
void slotToggleHideGridCellsAction(bool);
void slotToggleFaultLabelsAction(bool);
void slotDisableLightingAction(bool);
void slotDrawStyleChanged(QAction* activatedAction);
void slotToggleHideGridCellsAction(bool);
void slotToggleFaultLabelsAction(bool);
void slotDisableLightingAction(bool);
void slotShowWellCellsAction(bool doAdd);
void slotShowWellCellsAction(bool doAdd);
// Debug slots
void slotSnapshotAllViewsToFile();
@ -267,6 +268,8 @@ private:
QAction* m_drawStyleSurfOnlyAction;
QAction* m_showWellCellsAction;
QToolBar* m_holoLensToolBar;
std::vector<QPointer<QDockWidget> > additionalProjectViews;
bool m_blockSlotSubWindowActivated;