#2535 Add MainWindow tools class that can reduce number of mainWindow includes and hopefully reduce compile time

This commit is contained in:
Jacob Støren 2018-02-27 12:52:38 +01:00
parent 6a3b43ec7c
commit 43dc25eca0
5 changed files with 186 additions and 0 deletions

View File

@ -70,6 +70,8 @@ ${CEE_CURRENT_LIST_DIR}RiuCalculationsContextMenuManager.h
${CEE_CURRENT_LIST_DIR}RiuGridStatisticsHistogramWidget.h ${CEE_CURRENT_LIST_DIR}RiuGridStatisticsHistogramWidget.h
${CEE_CURRENT_LIST_DIR}RiuTools.h ${CEE_CURRENT_LIST_DIR}RiuTools.h
${CEE_CURRENT_LIST_DIR}RiuMohrsCirclePlot.h ${CEE_CURRENT_LIST_DIR}RiuMohrsCirclePlot.h
${CEE_CURRENT_LIST_DIR}RiuPlotMainWindowTools.h
${CEE_CURRENT_LIST_DIR}Riu3DMainWindowTools.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@ -135,6 +137,8 @@ ${CEE_CURRENT_LIST_DIR}RiuCalculationsContextMenuManager.cpp
${CEE_CURRENT_LIST_DIR}RiuGridStatisticsHistogramWidget.cpp ${CEE_CURRENT_LIST_DIR}RiuGridStatisticsHistogramWidget.cpp
${CEE_CURRENT_LIST_DIR}RiuTools.cpp ${CEE_CURRENT_LIST_DIR}RiuTools.cpp
${CEE_CURRENT_LIST_DIR}RiuMohrsCirclePlot.cpp ${CEE_CURRENT_LIST_DIR}RiuMohrsCirclePlot.cpp
${CEE_CURRENT_LIST_DIR}RiuPlotMainWindowTools.cpp
${CEE_CURRENT_LIST_DIR}Riu3DMainWindowTools.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "Riu3DMainWindowTools.h"
#include "RiuMainWindow.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riu3DMainWindowTools::setActiveViewer(QWidget* subWindow)
{
RiuMainWindow::instance()->setActiveViewer(subWindow);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riu3DMainWindowTools::setExpanded(const caf::PdmUiItem* uiItem, bool expanded /*= true*/)
{
RiuMainWindow::instance()->setExpanded(uiItem, expanded);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riu3DMainWindowTools::selectAsCurrentItem(const caf::PdmObject* object, bool allowActiveViewChange /*= true*/)
{
RiuMainWindow::instance()->selectAsCurrentItem(object, allowActiveViewChange);
}

View File

@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
class QWidget;
namespace caf
{
class PdmUiItem;
class PdmObject;
}
class Riu3DMainWindowTools
{
public:
static void setActiveViewer(QWidget* subWindow) ;
static void setExpanded(const caf::PdmUiItem* uiItem, bool expanded = true);
static void selectAsCurrentItem(const caf::PdmObject* object, bool allowActiveViewChange = true);
};

View File

@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RiuPlotMainWindowTools.h"
#include "RiaApplication.h"
#include "RiuMainPlotWindow.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindowTools::showPlotMainWindow()
{
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindowTools::setActiveViewer(QWidget* subWindow)
{
RiuMainPlotWindow* mpw = RiaApplication::instance()->mainPlotWindow();
if (mpw) mpw->setActiveViewer(subWindow);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindowTools::setExpanded(const caf::PdmUiItem* uiItem, bool expanded /*= true*/)
{
RiuMainPlotWindow* mpw = RiaApplication::instance()->mainPlotWindow();
if (mpw) mpw->setExpanded(uiItem, expanded);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindowTools::selectAsCurrentItem(const caf::PdmObject* object, bool allowActiveViewChange /*= true*/)
{
RiuMainPlotWindow* mpw = RiaApplication::instance()->mainPlotWindow();
if (mpw) mpw->selectAsCurrentItem(object, allowActiveViewChange);
}

View File

@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
class QWidget;
namespace caf
{
class PdmUiItem;
class PdmObject;
}
class RiuPlotMainWindowTools
{
public:
static void showPlotMainWindow();
static void setActiveViewer(QWidget* subWindow) ;
static void setExpanded(const caf::PdmUiItem* uiItem, bool expanded = true);
static void selectAsCurrentItem(const caf::PdmObject* object, bool allowActiveViewChange = true);
};