mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 16:06:04 -06:00
Merge branch 'dev' of https://github.com/OPM/ResInsight into dev
This commit is contained in:
commit
925e4496ea
@ -27,6 +27,7 @@
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafAboutDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafViewer.h"
|
||||
|
||||
#include <QAction>
|
||||
@ -39,6 +40,7 @@ CAF_CMD_SOURCE_INIT( RicHelpAboutFeature, "RicHelpAboutFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicHelpCommandLineFeature, "RicHelpCommandLineFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicHelpSummaryCommandLineFeature, "RicHelpSummaryCommandLineFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicHelpOpenUsersGuideFeature, "RicHelpOpenUsersGuideFeature" );
|
||||
CAF_CMD_SOURCE_INIT( RicSearchHelpFeature, "RicSearchHelpFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -251,7 +253,7 @@ void RicHelpOpenUsersGuideFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
QString usersGuideUrl = "https://resinsight.org/getting-started/";
|
||||
QString usersGuideUrl = "https://resinsight.org/getting-started/overview/";
|
||||
|
||||
if ( !QDesktopServices::openUrl( usersGuideUrl ) )
|
||||
{
|
||||
@ -267,5 +269,54 @@ void RicHelpOpenUsersGuideFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "&Users Guide" );
|
||||
|
||||
// applyShortcutWithHintToAction( actionToSetup, QKeySequence::HelpContents );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSearchHelpFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSearchHelpFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
QString usersGuideUrl = "https://resinsight.org/getting-started/overview/";
|
||||
|
||||
caf::PdmUiItem* uiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
if ( uiItem && !uiItem->uiName().isEmpty() )
|
||||
{
|
||||
usersGuideUrl = "https://resinsight.org/search/?q=" + uiItem->uiName();
|
||||
}
|
||||
|
||||
if ( !QDesktopServices::openUrl( usersGuideUrl ) )
|
||||
{
|
||||
QErrorMessage* errorHandler = QErrorMessage::qtHandler();
|
||||
errorHandler->showMessage( "Failed open browser with the following url\n\n" + usersGuideUrl );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSearchHelpFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
caf::PdmUiItem* uiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
|
||||
if ( uiItem && !uiItem->uiName().isEmpty() )
|
||||
{
|
||||
actionToSetup->setText( "Search Help For: " + uiItem->uiName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setText( "Search Help" );
|
||||
}
|
||||
|
||||
applyShortcutWithHintToAction( actionToSetup, QKeySequence::HelpContents );
|
||||
}
|
||||
|
@ -75,3 +75,17 @@ protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSearchHelpFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
@ -542,6 +542,9 @@ void RiuMainWindow::createMenus()
|
||||
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpSummaryCommandLineFeature" ) );
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpOpenUsersGuideFeature" ) );
|
||||
helpMenu->addAction( cmdFeatureMgr->action( "RicSearchHelpFeature" ) );
|
||||
|
||||
connect( helpMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshHelpActions() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include <QDockWidget>
|
||||
#include <QMdiArea>
|
||||
#include <QMdiSubWindow>
|
||||
@ -390,3 +391,11 @@ void RiuMainWindowBase::addViewerToMdiArea( QMdiArea* mdiArea,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindowBase::slotRefreshHelpActions()
|
||||
{
|
||||
caf::CmdFeatureManager::instance()->action( "RicSearchHelpFeature" );
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ protected:
|
||||
protected slots:
|
||||
void slotDockWidgetToggleViewActionTriggered();
|
||||
void addViewerToMdiArea( QMdiArea* mdiArea, QWidget* viewer, const QPoint& subWindowPos, const QSize& subWindowSize );
|
||||
void slotRefreshHelpActions();
|
||||
|
||||
protected:
|
||||
caf::PdmUiTreeView* m_projectTreeView;
|
||||
|
@ -317,6 +317,9 @@ void RiuPlotMainWindow::createMenus()
|
||||
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpSummaryCommandLineFeature" ) );
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction( cmdFeatureMgr->action( "RicHelpOpenUsersGuideFeature" ) );
|
||||
helpMenu->addAction( cmdFeatureMgr->action( "RicSearchHelpFeature" ) );
|
||||
|
||||
connect( helpMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshHelpActions() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user