Commit a18c2b54 authored by T.J. Corona's avatar T.J. Corona Committed by Kitware Robot

Merge topic 'save-resource-stuff' into release

a1908376 When closing resources, prompt for save if they are not clean
9c1faad4 Remove superfluous file
626ac067 Import operations do not set a file location.
a4761843 pqSMTKSaveResourceBehavior: if a resource has no location, 'Save as...'
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David Thompson's avatarDavid Thompson <david.thompson@kitware.com>
Merge-request: !1344
parents 2c1e4b14 a1908376
Pipeline #126682 running with stage
# Prompt to save resources before removing them from a ParaView-based application
Since ParaView-based applications can treat resources similarly to documents,
we adopt the pattern of prompting the user to save changes made to
modified resources when a "Close Resource" action is requested.
......@@ -39,11 +39,32 @@ set(PQComponentsSrcs
pqSMTKResource.cxx
pqSMTKResourceBrowser.cxx
pqSMTKResourcePanel.cxx
pqSMTKSaveOnCloseResourceBehavior.cxx
pqSMTKSaveResourceBehavior.cxx
pqSMTKSelectionFilterBehavior.cxx
pqSMTKWrapper.cxx
)
# One feature of pqSMTKSaveOnCloseResourceBehavior is the construction of a
# prompt to save all resources upon closing the main window. This feature uses
# parts of ParaView that were added just after the tagging of 5.6.0. To support
# both pre- and post-5.6.0, we set a local compiler definition to enable this
# feature if the detected ParaView contains the features we need.
#
# TODO: In the future, ParaView will have a means of differentiating between the
# latest tagged branch and master. When that happens, we can replace this logic
# with a ParaView version check to see if our ParaView is greater than 5.6.0.
# Until then, we simply look for the header file associated with the feature we
# want.
find_file(main_window_event_manager_hdr
NAMES pqMainWindowEventManager.h
PATHS ${PARAVIEW_INCLUDE_DIRS}
NO_DEFAULT_PATH)
if (main_window_event_manager_hdr)
set_source_files_properties(pqSMTKSaveOnCloseResourceBehavior.cxx
PROPERTIES COMPILE_DEFINITIONS "HAS_MAIN_WINDOW_EVENT_MANAGER")
endif()
set(PQComponentsHeaders
pqPluginSMTKViewBehavior.h
pqSMTKAttributePanel.h
......@@ -63,6 +84,7 @@ set(PQComponentsHeaders
pqSMTKResource.h
pqSMTKResourceBrowser.h
pqSMTKResourcePanel.h
pqSMTKSaveOnCloseResourceBehavior.h
pqSMTKSaveResourceBehavior.h
pqSMTKSelectionFilterBehavior.h
pqSMTKWrapper.h
......
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#ifndef smtk_extension_appcomponents_VisibleResourcePhraseModel_h
#define smtk_extension_appcomponents_VisibleResourcePhraseModel_h
#include "smtk/view/ResourcePhraseModel.h"
namespace smtk
{
namespace view
{
/**\brief A subclass of ResourcePhraseModel that decorates items with ParaView visibility.
*
*/
class VisibleResourcePhraseModel : public ResourcePhraseModel
{
public:
smtkTypeMacro(VisibleResourcePhraseModel);
smtkSuperclassMacro(ResourcePhraseModel);
smtkSharedPtrCreateMacro(PhraseModel);
virtual ~VisibleResourcePhraseModel();
void decoratePhrase(DescriptivePhrasePtr phr) const override;
void setResourceManager(pqResourceManager* rsrcMgr);
protected:
VisibleResourcePhraseModel();
pqResourceManager* m_pqResourceManager;
};
}
}
#endif
......@@ -21,6 +21,7 @@
#include "smtk/extension/paraview/appcomponents/pqSMTKPipelineSelectionBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKRegisterImportersBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKRenderResourceBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKSaveOnCloseResourceBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKSaveResourceBehavior.h"
#include "smtk/extension/paraview/server/vtkSMSMTKWrapperProxy.h"
......@@ -44,6 +45,7 @@ void pqSMTKAppComponentsAutoStart::startup()
auto rsrcMgr = pqSMTKBehavior::instance(this);
auto renderResourceBehavior = pqSMTKRenderResourceBehavior::instance(this);
auto closeResourceBehavior = pqSMTKCloseResourceBehavior::instance(this);
auto saveOnCloseResourceBehavior = pqSMTKSaveOnCloseResourceBehavior::instance(this);
auto rsrcImportOpMgr = pqSMTKImportOperationBehavior::instance(this);
auto rsrcExportSimMgr = pqSMTKExportSimulationBehavior::instance(this);
auto pipelineSync = pqSMTKPipelineSelectionBehavior::instance(this);
......@@ -63,6 +65,7 @@ void pqSMTKAppComponentsAutoStart::startup()
{
pqCore->registerManager("smtk resource", rsrcMgr);
pqCore->registerManager("smtk render resource", renderResourceBehavior);
pqCore->registerManager("smtk save on close resource", saveOnCloseResourceBehavior);
pqCore->registerManager("smtk close resource", closeResourceBehavior);
pqCore->registerManager("smtk import operation", rsrcImportOpMgr);
pqCore->registerManager("smtk export simulation", rsrcExportSimMgr);
......@@ -82,6 +85,7 @@ void pqSMTKAppComponentsAutoStart::shutdown()
{
pqCore->unRegisterManager("smtk resource");
pqCore->unRegisterManager("smtk render resource");
pqCore->unRegisterManager("smtk save on close resource");
pqCore->unRegisterManager("smtk close resource");
pqCore->unRegisterManager("smtk import operation");
pqCore->unRegisterManager("smtk export simulation");
......
......@@ -229,7 +229,7 @@ void pqSMTKBehavior::removeManagerFromServer(pqServer* remote)
return;
}
// Clear the server-side resource manager
// Clear the client-side resource manager
if (entry->second.first && entry->second.first->GetResourceManager())
{
entry->second.first->GetResourceManager()->clear();
......
......@@ -30,6 +30,7 @@
#include "smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKRenderResourceBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKResource.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKSaveResourceBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKWrapper.h"
#include "smtk/extension/qt/qtOperationView.h"
#include "smtk/extension/qt/qtUIManager.h"
......@@ -81,16 +82,49 @@ void pqCloseResourceReaction::closeResource()
// Access the active resource
smtk::resource::ResourcePtr resource = smtkResource->getResource();
// Remove it from its manager
if (smtk::resource::Manager::Ptr manager = resource->manager())
int ret = QMessageBox::Discard;
if (resource && resource->clean() == false)
{
manager->remove(resource);
QMessageBox msgBox;
msgBox.setText("The resource has been modified.");
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Save);
ret = msgBox.exec();
if (ret == QMessageBox::Save)
{
pqActiveObjects* activeObjects = &pqActiveObjects::instance();
activeObjects->setActiveSource(smtkResource);
pqSaveResourceReaction::State state = pqSaveResourceReaction::saveResource();
if (state == pqSaveResourceReaction::State::Aborted)
{
ret = QMessageBox::Cancel;
}
}
else if (ret == QMessageBox::Discard)
{
// Mark the resource as clean, even though it hasn't been saved. This way,
// other listeners will not prompt the user to save the resource.
resource->setClean(true);
}
}
// Destroy the active source associated with the active resource
pqApplicationCore* core = pqApplicationCore::instance();
pqObjectBuilder* builder = core->getObjectBuilder();
builder->destroy(smtkResource);
if (ret != QMessageBox::Cancel)
{
// Remove it from its manager
if (smtk::resource::Manager::Ptr manager = resource->manager())
{
manager->remove(resource);
}
// Destroy the active source associated with the active resource
pqApplicationCore* core = pqApplicationCore::instance();
pqObjectBuilder* builder = core->getObjectBuilder();
builder->destroy(smtkResource);
}
}
namespace
......
......@@ -20,7 +20,7 @@
class QMenu;
/// A reaction for creating a new SMTK Resource.
/// A reaction for closing an SMTK Resource.
class pqCloseResourceReaction : public pqReaction
{
Q_OBJECT
......@@ -36,8 +36,7 @@ public:
public slots:
/**
* Updates the enabled state. Applications need not explicitly call
* this.
* Updates the enabled state. Applications need not explicitly call this.
*/
void updateEnableState() override;
......@@ -52,8 +51,11 @@ private:
};
/// Create a menu item under "File" for closing an SMTK resource. The behavior
/// executes the "RemoveResource" operation on the server with the active
/// resource as its input.
/// checks the state of the active resource and allows the user to save or
/// cancel the close action if the resource is modified from its on-disk
/// representation. If the resource is "clean", the user has selected to save
/// the resource or the user has opted to discard changes, the resource is then
/// removed from the resource manager.
class SMTKPQCOMPONENTSEXT_EXPORT pqSMTKCloseResourceBehavior : public QObject
{
Q_OBJECT
......
......@@ -77,6 +77,13 @@ pqSMTKResource* pqSMTKRenderResourceBehavior::createPipelineSource(
{
pqApplicationCore* pqCore = pqApplicationCore::instance();
pqServer* server = pqActiveObjects::instance().activeServer();
// If there is no active server, there is not much we can do.
if (server == nullptr)
{
return nullptr;
}
pqObjectBuilder* builder = pqCore->getObjectBuilder();
pqSMTKResource* source =
......
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#include "smtk/extension/paraview/appcomponents/pqSMTKSaveOnCloseResourceBehavior.h"
// Client side
#include "pqActiveObjects.h"
#include "pqApplicationCore.h"
#include "pqCoreUtilities.h"
#include "pqFileDialog.h"
#include "pqObjectBuilder.h"
#include "pqPipelineSource.h"
#include "pqServer.h"
#include "vtkSMProxy.h"
#include "vtkSMProxyManager.h"
// One feature of pqSMTKSaveOnCloseResourceBehavior is the construction of a
// prompt to save all resources upon closing the main window. This feature uses
// parts of ParaView that were added just after the tagging of 5.6.0. To support
// both pre- and post-5.6.0, we set a local compiler definition to enable this
// feature if the detected ParaView contains the features we need.
#ifdef HAS_MAIN_WINDOW_EVENT_MANAGER
#include "pqMainWindowEventManager.h"
#endif
#include "smtk/attribute/Resource.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKResource.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKSaveResourceBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKWrapper.h"
#include "smtk/io/AttributeWriter.h"
#include "smtk/io/Logger.h"
#include "smtk/resource/Manager.h"
#include <QApplication>
static pqSMTKSaveOnCloseResourceBehavior* g_instance = nullptr;
pqSMTKSaveOnCloseResourceBehavior::pqSMTKSaveOnCloseResourceBehavior(QObject* parent)
: Superclass(parent)
{
// Wait until the event loop starts, ensuring that the main window will be
// accessible.
QTimer::singleShot(0, this, [this]() {
// Blech: pqApplicationCore doesn't have the selection manager yet,
// so wait until we hear that the server is ready to make the connection.
// We can't have a selection before the first connection, anyway.
auto pqCore = pqApplicationCore::instance();
if (pqCore)
{
// The first functor listens to the object builder's "destroying" signal
// to identify pqPipelineSources that are being removed in order to give
// the user a chance to save resources before they are destroyed. ParaView
// does not offer us the ability to cancel the destruction of the pipeline
// source, so we do not offer the option to cancel in our modal dialog.
pqObjectBuilder* builder = pqCore->getObjectBuilder();
QObject::connect(builder,
(void (pqObjectBuilder::*)(pqPipelineSource*)) & pqObjectBuilder::destroying,
[](pqPipelineSource* source) {
pqSMTKResource* smtkResource = dynamic_cast<pqSMTKResource*>(source);
if (smtkResource == nullptr)
{
return;
}
smtk::resource::ResourcePtr resource = smtkResource->getResource();
if (resource && resource->clean() == false)
{
QMessageBox msgBox;
msgBox.setText("The resource has been modified.");
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
msgBox.setDefaultButton(QMessageBox::Save);
int ret = msgBox.exec();
if (ret == QMessageBox::Save)
{
pqActiveObjects* activeObjects = &pqActiveObjects::instance();
activeObjects->setActiveSource(smtkResource);
pqSaveResourceReaction::saveResource();
}
}
});
// The second functor is connected to the "removingManagerFromServer"
// signal of pqSMTKBehavior, and it checks all resources on the server and
// prompts the user to save them. Again, we are not offered the ability to
// cancel whatever action is removing the manager from the server. All we
// can do is prompt the user to save any modified resources held by the
// server.
auto onRemovingManagerFromServer = [&](pqSMTKWrapper* wrapper, pqServer*) {
std::size_t numberOfUnsavedResources = 0;
wrapper->visitResources([&](pqSMTKResource* smtkResource) {
smtk::resource::ResourcePtr resource = smtkResource->getResource();
if (resource && resource->clean() == false)
{
++numberOfUnsavedResources;
}
return false;
});
if (numberOfUnsavedResources > 0)
{
QMessageBox msgBox;
if (numberOfUnsavedResources == 1)
{
msgBox.setText("The resource has been modified.");
}
else
{
msgBox.setText(
QString::number(numberOfUnsavedResources) + " resources have been modified.");
}
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
msgBox.setDefaultButton(QMessageBox::Save);
int ret = msgBox.exec();
if (ret == QMessageBox::Save)
{
wrapper->visitResources([&](pqSMTKResource* smtkResource) {
pqActiveObjects* activeObjects = &pqActiveObjects::instance();
activeObjects->setActiveSource(smtkResource);
pqSaveResourceReaction::saveResource();
return false;
});
}
}
};
QObject::connect(pqSMTKBehavior::instance(),
(void (pqSMTKBehavior::*)(pqSMTKWrapper*, pqServer*)) &
pqSMTKBehavior::removingManagerFromServer,
onRemovingManagerFromServer);
#ifdef HAS_MAIN_WINDOW_EVENT_MANAGER
// The final functor is connected to the main window's "close" signal, and
// it prompts the user to save all unsaved resources on all servers. It
// also provides the user with the ability to cancel the close.
QObject::connect(pqApplicationCore::instance()->getMainWindowEventManager(),
&pqMainWindowEventManager::close, [](QCloseEvent* closeEvent) {
std::size_t numberOfUnsavedResources = 0;
pqSMTKBehavior::instance()->visitResourceManagersOnServers(
[&numberOfUnsavedResources](pqSMTKWrapper* wrapper, pqServer*) {
wrapper->visitResources([&numberOfUnsavedResources](pqSMTKResource* smtkResource) {
smtk::resource::ResourcePtr resource = smtkResource->getResource();
if (resource && resource->clean() == false)
{
++numberOfUnsavedResources;
}
return false;
});
return false;
});
int ret = QMessageBox::Discard;
if (numberOfUnsavedResources > 0)
{
QMessageBox msgBox;
if (numberOfUnsavedResources == 1)
{
msgBox.setText("A resource has been modified.");
}
else
{
msgBox.setText(
QString::number(numberOfUnsavedResources) + " resources have been modified.");
}
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Save);
ret = msgBox.exec();
if (ret == QMessageBox::Save)
{
pqSMTKBehavior::instance()->visitResourceManagersOnServers(
[&](pqSMTKWrapper* wrapper, pqServer*) {
wrapper->visitResources([&](pqSMTKResource* smtkResource) {
pqActiveObjects* activeObjects = &pqActiveObjects::instance();
activeObjects->setActiveSource(smtkResource);
pqSaveResourceReaction::State state = pqSaveResourceReaction::saveResource();
// If the user first selects "Save", is provided a
// "Save As" window and then cancels the save, we treat
// the action as though the user had pressed "Cancel" at
// the first step. This behavior is in keeping with other
// document-based applications.
if (state == pqSaveResourceReaction::State::Aborted)
{
ret = QMessageBox::Cancel;
return true;
}
return false;
});
return ret == QMessageBox::Cancel;
});
}
}
closeEvent->setAccepted(ret != QMessageBox::Cancel);
});
#endif
}
});
}
pqSMTKSaveOnCloseResourceBehavior* pqSMTKSaveOnCloseResourceBehavior::instance(QObject* parent)
{
if (!g_instance)
{
g_instance = new pqSMTKSaveOnCloseResourceBehavior(parent);
}
if (g_instance->parent() == nullptr && parent)
{
g_instance->setParent(parent);
}
return g_instance;
}
pqSMTKSaveOnCloseResourceBehavior::~pqSMTKSaveOnCloseResourceBehavior()
{
if (g_instance == this)
{
g_instance = nullptr;
}
QObject::disconnect(this);
}
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#ifndef smtk_extension_paraview_appcomponents_pqSMTKSaveOnCloseResourceBehavior_h
#define smtk_extension_paraview_appcomponents_pqSMTKSaveOnCloseResourceBehavior_h
#include "smtk/extension/paraview/appcomponents/Exports.h"
#include <QObject>
/// A behavior for prompting the user to save resources before closing them.
/// Currently, this occurs in three places:
///
/// 1. A pipeline source is destroyed.
/// 2. A resource manager is removed from the server.
/// 3. The main window event manager has received a close event.
///
/// Absent from this list is the case when "File->Close Resource" is selected by
/// the user. This instance is handled by pqSMTKCloseResourceBehavior, which
/// additionally provides an option to cancel the close action. Of the three
/// instances where this behavior prompts to save before closing resources, only
/// the third instance is cancelable. The other two are connected to ParaView
/// signals that do not support cancelling the action.
class SMTKPQCOMPONENTSEXT_EXPORT pqSMTKSaveOnCloseResourceBehavior : public QObject
{
Q_OBJECT
using Superclass = QObject;
public:
static pqSMTKSaveOnCloseResourceBehavior* instance(QObject* parent = nullptr);
~pqSMTKSaveOnCloseResourceBehavior() override;
protected:
pqSMTKSaveOnCloseResourceBehavior(QObject* parent = nullptr);
private:
Q_DISABLE_COPY(pqSMTKSaveOnCloseResourceBehavior);
};
#endif // smtk_extension_paraview_appcomponents_pqSMTKSaveOnCloseResourceBehavior_h
......@@ -21,7 +21,9 @@
#include "vtkSMProxyManager.h"
#include "smtk/attribute/Resource.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKBehavior.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKResource.h"
#include "smtk/extension/paraview/appcomponents/pqSMTKWrapper.h"
#include "smtk/io/AttributeWriter.h"
#include "smtk/io/Logger.h"
#include "smtk/resource/Manager.h"
......@@ -62,19 +64,29 @@ void pqSaveResourceReaction::updateEnableState()
}
//-----------------------------------------------------------------------------
void pqSaveResourceReaction::saveResource()
pqSaveResourceReaction::State pqSaveResourceReaction::saveResource()
{
pqActiveObjects& activeObjects = pqActiveObjects::instance();
pqSMTKResource* smtkResource = dynamic_cast<pqSMTKResource*>(activeObjects.activeSource());
smtk::resource::ResourcePtr resource = smtkResource->getResource();
// If there is no associated file name with this resource, call
// pqSaveResourceAsReaction's saveResourceAs static method instead.
if (resource->location().empty())
{
return pqSaveResourceAsReaction::saveResourceAs();
}
if (smtk::attribute::ResourcePtr attResource =
std::dynamic_pointer_cast<smtk::attribute::Resource>(resource))
{
smtk::io::Logger logger;
smtk::io::AttributeWriter writer;
writer.write(attResource, attResource->location(), logger);
return;
// The attribute write returns true on failure
return writer.write(attResource, attResource->location(), logger)
? pqSaveResourceReaction::State::Failed
: pqSaveResourceReaction::State::Succeeded;
}
// Append the location with ".smtk" if it is not already there.
......@@ -86,8 +98,12 @@ void pqSaveResourceReaction::saveResource()
if (smtk::resource::Manager::Ptr manager = resource->manager())
{
manager->write(resource);
// The resource manager returns true on success
return manager->write(resource) ? pqSaveResourceReaction::State::Succeeded
: pqSaveResourceReaction::State::Failed;
}
return pqSaveResourceReaction::State::Failed;
}
//-----------------------------------------------------------------------------
......@@ -114,7 +130,7 @@ void pqSaveResourceAsReaction::updateEnableState()
}
//-----------------------------------------------------------------------------
void pqSaveResourceAsReaction::saveResourceAs()
pqSaveResourceReaction::State pqSaveResourceAsReaction::saveResourceAs()
{
pqServer* server = pqActiveObjects::instance().activeServer();
pqActiveObjects& activeObjects = pqActiveObjects::instance();
......@@ -131,8 +147,12 @@ void pqSaveResourceAsReaction::saveResourceAs()
filters = QString("Simulation Modeling Toolkit Attribute files (*.sbi)");
}
pqFileDialog fileDialog(server, pqCoreUtilities::mainWidget(), tr("Save File:"),
QFileInfo(QString::fromStdString(resource->location())).absoluteDir().absolutePath(), filters);
pqFileDialog fileDialog(
server, pqCoreUtilities::mainWidget(), tr("Save File:"),
(resource->location().empty()
? QString()
: QFileInfo(QString::fromStdString(resource->location())).absoluteDir().absolutePath()),
filters);
fileDialog.setObjectName("FileSaveDialog");
fileDialog.setFileMode(pqFileDialog::AnyFile);
......@@ -144,17 +164,32 @@ void pqSaveResourceAsReaction::saveResourceAs()
{
smtk::io::Logger logger;
smtk::io::AttributeWriter writer;
bool success = writer.write(attResource, fname.toStdString(), logger);
if (!success)
bool fail = writer.write(attResource, fname.toStdString(), logger);
if (fail)
{
std::cout << logger.convertToString(true) << std::endl;
return pqSaveResourceReaction::State::Failed;
}
else
{
return pqSaveResourceReaction::State::Succeeded;
}
}
else if (smtk::resource::Manager::Ptr manager = resource->manager())
{
manager->write(resource, fname.toStdString());
return manager->write(resource, fname.toStdString())
? pqSaveResourceReaction::State::Succeeded
: pqSaveResourceReaction::State::Failed;
}
else
{
return pqSaveResourceReaction::State::Failed;
}
}
else
{
return pqSaveResourceReaction::State::Aborted;
}
}
namespace
......
......@@ -34,7 +34,14 @@ public:
*/
pqSaveResourceReaction(QAction* parent);
static void saveResource();
enum class State
{
Succeeded,
Failed,
Aborted
};
static State saveResource();
public slots:
/**
......@@ -47,7 +54,7 @@ protected:
/**
* Called when the action is triggered.
*/
void onTriggered() override { pqSaveResourceReaction::saveResource(); }
void onTriggered() override { (void)pqSaveResourceReaction::saveResource(); }
private:
Q_DISABLE_COPY(pqSaveResourceReaction)
......@@ -65,7 +72,7 @@ public:
*/
pqSaveResourceAsReaction(QAction* parent);
static void saveResourceAs();
static pqSaveResourceReaction::State saveResourceAs();
public slots:
/**
......@@ -78,7 +85,7 @@ protected:
/**
* Called when the action is triggered.
*/
void onTriggered() override { pqSaveResourceAsReaction::saveResourceAs(); }
void onTriggered() override { (void)pqSaveResourceAsReaction::saveResourceAs(); }
private:
Q_DISABLE_COPY(pqSaveResourceAsReaction)
......
......@@ -159,7 +159,6 @@ ImportOperation::Result ImportOperation::operateInternal()
session = smtk::session::discrete::Session::create();
// Create a new resource for the import
resource->setLocation(filename);
resource->setSession(session);
}
......