mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1401 Move serialization of tree view state to a single location
This commit is contained in:
@@ -44,8 +44,6 @@ void RicSaveProjectAsFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
RicSaveProjectFeature::storeTreeViewState();
|
||||
|
||||
app->saveProjectPromptForFileName();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,16 +20,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTreeViewStateSerializer.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "cafPdmUiTreeView.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QTreeView>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicSaveProjectFeature, "RicSaveProjectFeature");
|
||||
|
||||
@@ -50,8 +41,6 @@ void RicSaveProjectFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
RicSaveProjectFeature::storeTreeViewState();
|
||||
|
||||
app->saveProject();
|
||||
}
|
||||
|
||||
@@ -65,44 +54,3 @@ void RicSaveProjectFeature::setupActionLook(QAction* actionToSetup)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveProjectFeature::storeTreeViewState()
|
||||
{
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if (app->mainPlotWindow() && app->mainPlotWindow()->projectTreeView())
|
||||
{
|
||||
caf::PdmUiTreeView* projectTreeView = app->mainPlotWindow()->projectTreeView();
|
||||
|
||||
QString treeViewState;
|
||||
RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
|
||||
|
||||
QModelIndex mi = projectTreeView->treeView()->currentIndex();
|
||||
|
||||
QString encodedModelIndexString;
|
||||
RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
RiaApplication::instance()->project()->plotWindowTreeViewState = treeViewState;
|
||||
RiaApplication::instance()->project()->plotWindowCurrentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiTreeView* projectTreeView = RiuMainWindow::instance()->projectTreeView();
|
||||
if (projectTreeView)
|
||||
{
|
||||
QString treeViewState;
|
||||
RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
|
||||
|
||||
QModelIndex mi = projectTreeView->treeView()->currentIndex();
|
||||
|
||||
QString encodedModelIndexString;
|
||||
RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
RiaApplication::instance()->project()->mainWindowTreeViewState = treeViewState;
|
||||
RiaApplication::instance()->project()->mainWindowCurrentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,6 @@ class RicSaveProjectFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void storeTreeViewState();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
||||
Reference in New Issue
Block a user