mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#846 Created help menu features
This commit is contained in:
parent
ee0038ac74
commit
58a25c9fe9
@ -16,6 +16,7 @@ ${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveProjectAsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -30,6 +31,7 @@ ${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveProjectAsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
151
ApplicationCode/Commands/ApplicationCommands/RicHelpFeatures.cpp
Normal file
151
ApplicationCode/Commands/ApplicationCommands/RicHelpFeatures.cpp
Normal file
@ -0,0 +1,151 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicHelpFeatures.h"
|
||||
|
||||
#include "RiaBaseDefs.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafAboutDialog.h"
|
||||
#include "cafViewer.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDesktopServices>
|
||||
#include <QErrorMessage>
|
||||
#include <QUrl>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicHelpAboutFeature, "RicHelpAboutFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicHelpCommandLineFeature, "RicHelpCommandLineFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicHelpOpenUsersGuideFeature, "RicHelpOpenUsersGuideFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicHelpAboutFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpAboutFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
caf::AboutDialog dlg(NULL);
|
||||
|
||||
dlg.setApplicationName(RI_APPLICATION_NAME);
|
||||
dlg.setApplicationVersion(RiaApplication::getVersionStringApp(true));
|
||||
dlg.setCopyright("Copyright Statoil ASA, Ceetron Solutions AS, Ceetron AS");
|
||||
dlg.showQtVersion(false);
|
||||
#ifdef _DEBUG
|
||||
dlg.setIsDebugBuild(true);
|
||||
#endif
|
||||
|
||||
dlg.addVersionEntry(" ", "ResInsight is made available under the GNU General Public License v. 3");
|
||||
dlg.addVersionEntry(" ", "See http://www.gnu.org/licenses/gpl.html");
|
||||
dlg.addVersionEntry(" ", " ");
|
||||
dlg.addVersionEntry(" ", " ");
|
||||
dlg.addVersionEntry(" ", "Technical Information");
|
||||
dlg.addVersionEntry(" ", QString(" Qt ") + qVersion());
|
||||
dlg.addVersionEntry(" ", QString(" ") + caf::AboutDialog::versionStringForcurrentOpenGLContext());
|
||||
dlg.addVersionEntry(" ", caf::Viewer::isShadersSupported() ? " Hardware OpenGL" : " Software OpenGL");
|
||||
|
||||
dlg.create();
|
||||
dlg.resize(300, 200);
|
||||
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpAboutFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("&About");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicHelpCommandLineFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpCommandLineFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString text = app->commandLineParameterHelp();
|
||||
app->showFormattedTextInMessageBox(text);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpCommandLineFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("&Command Line Help");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicHelpOpenUsersGuideFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpOpenUsersGuideFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
QString usersGuideUrl = "http://resinsight.org/docs/home";
|
||||
|
||||
if (!QDesktopServices::openUrl(usersGuideUrl))
|
||||
{
|
||||
QErrorMessage* errorHandler = QErrorMessage::qtHandler();
|
||||
errorHandler->showMessage("Failed open browser with the following url\n\n" + usersGuideUrl);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpOpenUsersGuideFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("&Users Guide");
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 RicHelpAboutFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicHelpCommandLineFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicHelpOpenUsersGuideFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
};
|
||||
|
||||
|
@ -293,14 +293,6 @@ void RiuMainWindow::createActions()
|
||||
m_newPropertyView = new QAction("New Project and Property View", this);
|
||||
connect(m_newPropertyView, SIGNAL(triggered()), SLOT(slotNewObjectPropertyView()));
|
||||
|
||||
// Help actions
|
||||
m_aboutAction = new QAction("&About", this);
|
||||
connect(m_aboutAction, SIGNAL(triggered()), SLOT(slotAbout()));
|
||||
m_commandLineHelpAction = new QAction("&Command Line Help", this);
|
||||
connect(m_commandLineHelpAction, SIGNAL(triggered()), SLOT(slotShowCommandLineHelp()));
|
||||
m_openUsersGuideInBrowserAction = new QAction("&Users Guide", this);
|
||||
connect(m_openUsersGuideInBrowserAction, SIGNAL(triggered()), SLOT(slotOpenUsersGuideInBrowserAction()));
|
||||
|
||||
// Draw style actions
|
||||
m_dsActionGroup = new QActionGroup(this);
|
||||
|
||||
@ -441,10 +433,10 @@ void RiuMainWindow::createMenus()
|
||||
|
||||
// Help menu
|
||||
QMenu* helpMenu = menuBar()->addMenu("&Help");
|
||||
helpMenu->addAction(m_openUsersGuideInBrowserAction);
|
||||
helpMenu->addAction(m_commandLineHelpAction);
|
||||
helpMenu->addAction(cmdFeatureMgr->action("RicHelpAboutFeature"));
|
||||
helpMenu->addAction(cmdFeatureMgr->action("RicHelpCommandLineFeature"));
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction(m_aboutAction);
|
||||
helpMenu->addAction(cmdFeatureMgr->action("RicHelpOpenUsersGuideFeature"));
|
||||
}
|
||||
|
||||
|
||||
@ -760,37 +752,6 @@ void RiuMainWindow::refreshAnimationActions()
|
||||
m_animationToolBar->setEnabled(enableAnimControls);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotAbout()
|
||||
{
|
||||
caf::AboutDialog dlg(this);
|
||||
|
||||
dlg.setApplicationName(RI_APPLICATION_NAME);
|
||||
dlg.setApplicationVersion(RiaApplication::getVersionStringApp(true));
|
||||
dlg.setCopyright("Copyright Statoil ASA, Ceetron Solutions AS, Ceetron AS");
|
||||
dlg.showQtVersion(false);
|
||||
#ifdef _DEBUG
|
||||
dlg.setIsDebugBuild(true);
|
||||
#endif
|
||||
|
||||
dlg.addVersionEntry(" ", "ResInsight is made available under the GNU General Public License v. 3");
|
||||
dlg.addVersionEntry(" ", "See http://www.gnu.org/licenses/gpl.html");
|
||||
dlg.addVersionEntry(" ", " ");
|
||||
dlg.addVersionEntry(" ", " ");
|
||||
dlg.addVersionEntry(" ", "Technical Information");
|
||||
dlg.addVersionEntry(" ", QString(" Qt ") + qVersion());
|
||||
dlg.addVersionEntry(" ", QString(" ") + caf::AboutDialog::versionStringForcurrentOpenGLContext());
|
||||
dlg.addVersionEntry(" ", caf::Viewer::isShadersSupported() ? " Hardware OpenGL" : " Software OpenGL");
|
||||
|
||||
dlg.create();
|
||||
dlg.resize(300, 200);
|
||||
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1526,27 +1487,6 @@ void RiuMainWindow::slotDisableLightingAction(bool disable)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::storeTreeViewState()
|
||||
{
|
||||
if (m_projectTreeView)
|
||||
{
|
||||
QString treeViewState;
|
||||
RimTreeViewStateSerializer::storeTreeViewStateToString(m_projectTreeView->treeView(), treeViewState);
|
||||
|
||||
QModelIndex mi = m_projectTreeView->treeView()->currentIndex();
|
||||
|
||||
QString encodedModelIndexString;
|
||||
RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
RiaApplication::instance()->project()->treeViewState = treeViewState;
|
||||
RiaApplication::instance()->project()->currentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1618,16 +1558,6 @@ void RiuMainWindow::selectedCases(std::vector<RimCase*>& cases)
|
||||
caf::SelectionManager::instance()->objectsByType(&cases);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotShowCommandLineHelp()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString text = app->commandLineParameterHelp();
|
||||
app->showFormattedTextInMessageBox(text);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1742,20 +1672,6 @@ void RiuMainWindow::slotAddWellCellsToRangeFilterAction(bool doAdd)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotOpenUsersGuideInBrowserAction()
|
||||
{
|
||||
QString usersGuideUrl = "http://resinsight.org/docs/home";
|
||||
|
||||
if (!QDesktopServices::openUrl(usersGuideUrl))
|
||||
{
|
||||
QErrorMessage* errorHandler = QErrorMessage::qtHandler();
|
||||
errorHandler->showMessage("Failed open browser with the following url\n\n" + usersGuideUrl);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -129,7 +129,6 @@ private:
|
||||
void createToolBars();
|
||||
void createDockPanels();
|
||||
|
||||
void storeTreeViewState();
|
||||
void restoreTreeViewState();
|
||||
|
||||
private:
|
||||
@ -166,11 +165,6 @@ private:
|
||||
QAction* m_showRegressionTestDialog;
|
||||
QAction* m_executePaintEventPerformanceTest;
|
||||
|
||||
// Help actions
|
||||
QAction* m_aboutAction;
|
||||
QAction* m_commandLineHelpAction;
|
||||
QAction* m_openUsersGuideInBrowserAction;
|
||||
|
||||
// Animation
|
||||
caf::AnimationToolBar* m_animationToolBar;
|
||||
|
||||
@ -244,11 +238,6 @@ private slots:
|
||||
// Windows slots
|
||||
void slotBuildWindowActions();
|
||||
|
||||
// Help slots
|
||||
void slotAbout();
|
||||
void slotShowCommandLineHelp();
|
||||
void slotOpenUsersGuideInBrowserAction();
|
||||
|
||||
void slotSubWindowActivated(QMdiSubWindow* subWindow);
|
||||
|
||||
void selectedObjectsChanged();
|
||||
|
Loading…
Reference in New Issue
Block a user