mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#846 Use one tile window feature for both main windows
This commit is contained in:
@@ -9,7 +9,6 @@ ${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowMainWindowFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicTilePlotWindowsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicOpenProjectFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicOpenLastUsedFileFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.h
|
||||
@@ -24,7 +23,6 @@ ${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowMainWindowFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicTilePlotWindowsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicOpenProjectFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicOpenLastUsedFileFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.cpp
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 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 "RicTilePlotWindowsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicTilePlotWindowsFeature, "RicTilePlotWindowsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTilePlotWindowsFeature::isCommandEnabled()
|
||||
{
|
||||
RiuMainPlotWindow* wnd = RiaApplication::instance()->mainPlotWindow();
|
||||
if (wnd)
|
||||
{
|
||||
return wnd->isAnyMdiSubWindowVisible();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTilePlotWindowsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiuMainPlotWindow* wnd = RiaApplication::instance()->mainPlotWindow();
|
||||
if (wnd)
|
||||
{
|
||||
wnd->tileWindows();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTilePlotWindowsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Tile Windows");
|
||||
actionToSetup->setIcon(QIcon(":/TileWindows24x24.png"));
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 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 RicTilePlotWindowsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
||||
@@ -20,8 +20,10 @@
|
||||
#include "RicTileWindowsFeature.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicTileWindowsFeature, "RicTileWindowsFeature");
|
||||
|
||||
@@ -30,7 +32,20 @@ CAF_CMD_SOURCE_INIT(RicTileWindowsFeature, "RicTileWindowsFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTileWindowsFeature::isCommandEnabled()
|
||||
{
|
||||
return RiuMainWindow::instance()->isAnyMdiSubWindowVisible();
|
||||
QWidget* topLevelWidget = QApplication::activeWindow();
|
||||
|
||||
RiuMainWindow* mainWindow = dynamic_cast<RiuMainWindow*>(topLevelWidget);
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
||||
if (mainWindow)
|
||||
{
|
||||
return mainWindow->isAnyMdiSubWindowVisible();
|
||||
}
|
||||
else if (mainPlotWindow)
|
||||
{
|
||||
return mainPlotWindow->isAnyMdiSubWindowVisible();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -38,7 +53,18 @@ bool RicTileWindowsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTileWindowsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiuMainWindow::instance()->tileWindows();
|
||||
QWidget* topLevelWidget = QApplication::activeWindow();
|
||||
|
||||
RiuMainWindow* mainWindow = dynamic_cast<RiuMainWindow*>(topLevelWidget);
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
||||
if (mainWindow)
|
||||
{
|
||||
mainWindow->tileWindows();
|
||||
}
|
||||
else if (mainPlotWindow)
|
||||
{
|
||||
mainPlotWindow->tileWindows();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user