Back to index

salome-paravis  6.5.0
Public Slots | Signals | Public Member Functions | Protected Slots | Private Slots | Private Attributes
PVGUI_ParaViewSettingsPane Class Reference

#include <PVGUI_ParaViewSettingsPane.h>

Collaboration diagram for PVGUI_ParaViewSettingsPane:
Collaboration graph
[legend]

List of all members.

Public Slots

void setCurrentPage (const QString &path)
 Sets the current options page.
void applyChanges ()
 Calls each page to apply any changes.
void resetChanges ()
 Calls each page to reset any changes.

Signals

void aboutToApplyChanges ()
 Emitted before the option changes are applied.
void appliedChanges ()
 Emitted after the option changes have been applied.

Public Member Functions

 PVGUI_ParaViewSettingsPane (QWidget *parent=0)
virtual ~PVGUI_ParaViewSettingsPane ()
void addOptions (const QString &path, pqOptionsPage *options)
 Gets whether or not there are changes to apply.
void addOptions (pqOptionsContainer *options)
 Adds a container to the options dialog.
void removeOptions (pqOptionsPage *options)
 Removes the options page from the options dialog.
virtual void store (QtxResourceMgr *theRes, QtxPreferenceMgr *thePref)
 Implementation of QtxUserDefinedContent interface.
virtual void retrieve (QtxResourceMgr *theRes, QtxPreferenceMgr *thePref)

Protected Slots

void pluginLoaded (QObject *plugin_interface)

Private Slots

void changeCurrentPage ()
 Changes the current page to match the user selection.

Private Attributes

OptionsDialogFormForm

Detailed Description

Definition at line 41 of file PVGUI_ParaViewSettingsPane.h.


Constructor & Destructor Documentation

Add panes as plugins are loaded.

Definition at line 331 of file PVGUI_ParaViewSettingsPane.cxx.

  : QtxUserDefinedContent(widgetParent)
{
  this->Form = new OptionsDialogForm();
  this->Form->setupUi(this);
  this->Form->PageNames->setModel(this->Form->Model);

  // Hide the tree widget header view.
  this->Form->PageNames->header()->hide();

  // Hide the apply and reset buttons until they are needed.
  //this->Form->ApplyButton->setEnabled(false);
  //this->Form->ResetButton->setEnabled(false);
  //this->Form->ApplyButton->hide();
  //this->Form->ResetButton->hide();

  this->connect(this->Form->PageNames->selectionModel(),
      SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
      this, SLOT(changeCurrentPage()));
  //this->connect(this->Form->ApplyButton, SIGNAL(clicked()),
  //    this, SLOT(applyChanges()));
  //this->connect(this->Form->ResetButton, SIGNAL(clicked()),
  //    this, SLOT(resetChanges()));
  //this->connect(this->Form->CloseButton, SIGNAL(clicked()),
  //    this, SLOT(accept()));

  // Code From pqApplicationOptionsDialog
  //this->setApplyNeeded(true);

  pqApplicationOptions* appOptions = new pqApplicationOptions;
  this->addOptions(appOptions);
  
  pqGlobalRenderViewOptions* renOptions = new pqGlobalRenderViewOptions;
  this->addOptions(renOptions);
  
  QStringList pages = appOptions->getPageList();
  if(pages.size())
    {
    this->setCurrentPage(pages[0]);
    }

  QObject::connect(pqApplicationCore::instance()->getPluginManager(),
    SIGNAL(guiInterfaceLoaded(QObject*)),
    this, SLOT(pluginLoaded(QObject*)));

  // Load panes from already loaded plugins.
  foreach (QObject* plugin_interface, pqApplicationCore::instance()->interfaceTracker()->interfaces())
           //pqApplicationCore::instance()->getPluginManager()->interfaces())
    {
    this->pluginLoaded(plugin_interface);
    }
}

Here is the call graph for this function:

Definition at line 385 of file PVGUI_ParaViewSettingsPane.cxx.

{
  delete this->Form;
}

Member Function Documentation

Emitted before the option changes are applied.

Here is the caller graph for this function:

void PVGUI_ParaViewSettingsPane::addOptions ( const QString &  path,
pqOptionsPage *  options 
)

Gets whether or not there are changes to apply.

Returns:
True if there are changes to apply. Sets whether or not there are changes to apply.
Parameters:
applyNeededTrue if there are changes to apply. Adds a page to the options dialog.

When the options object is a page container, the path parameter becomes the path prefix for the container pages.

Parameters:
pathThe name hierarchy for the options page.
optionsThe options page.

Definition at line 415 of file PVGUI_ParaViewSettingsPane.cxx.

{
  if(!options)
    {
    return;
    }

  // See if the page is a container.
  pqOptionsContainer *container = qobject_cast<pqOptionsContainer *>(options);
  if(!container && path.isEmpty())
    {
    return;
    }

  // See if the page/container uses the apply button.
  if(options->isApplyUsed())
    {
    this->Form->ApplyUseCount++;
    /*if(this->Form->ApplyUseCount == 1)
      {
        //this->Form->ApplyButton->show();
        //this->Form->ResetButton->show();
        //QObject::connect(this, SIGNAL(accepted()), this, SLOT(applyChanges()));
        }*/

    //this->connect(options, SIGNAL(changesAvailable()),
    //this, SLOT(enableButtons()));
    }

  // Add the widget to the stack.
  this->Form->Stack->addWidget(options);

  // Add the page(s) to the map and the model.
  if(container)
    {
    // If the path is not empty, use it as the page prefix.
    QString prefix;
    if(!path.isEmpty())
      {
      prefix = path;
      prefix.append(".");
      }

    container->setPagePrefix(prefix);

    // Get the list of pages from the container.
    QStringList pathList = container->getPageList();
    QStringList::Iterator iter = pathList.begin();
    for( ; iter != pathList.end(); ++iter)
      {
      this->Form->Pages.insert(prefix + *iter, options);
      this->Form->Model->addPath(prefix + *iter);
      }
    }
  else
    {
    this->Form->Pages.insert(path, options);
    this->Form->Model->addPath(path);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PVGUI_ParaViewSettingsPane::addOptions ( pqOptionsContainer *  options)

Adds a container to the options dialog.

Each page listed for the container is added to the root of the selection tree.

Parameters:
optionsThe options container to add.

Definition at line 476 of file PVGUI_ParaViewSettingsPane.cxx.

{
  this->addOptions(QString(), options);
}

Here is the call graph for this function:

Emitted after the option changes have been applied.

Here is the caller graph for this function:

Calls each page to apply any changes.

Definition at line 554 of file PVGUI_ParaViewSettingsPane.cxx.

{
  //if(this->Form->ApplyNeeded)
  //  {
    BEGIN_UNDO_SET("Changed View Settings");
    emit this->aboutToApplyChanges();
    QMap<QString, pqOptionsPage *>::Iterator iter = this->Form->Pages.begin();
    for( ; iter != this->Form->Pages.end(); ++iter)
      {
      (*iter)->applyChanges();
      }

    //this->setApplyNeeded(false);
    emit this->appliedChanges();
    END_UNDO_SET();
    //}
}

Here is the call graph for this function:

Here is the caller graph for this function:

Changes the current page to match the user selection.

Definition at line 586 of file PVGUI_ParaViewSettingsPane.cxx.

{
  // Get the current index from the view.
  QModelIndex current = this->Form->PageNames->currentIndex();

  // Look up the path for the current index.
  QString path = this->Form->Model->getPath(current);
  QMap<QString, pqOptionsPage *>::Iterator iter = this->Form->Pages.find(path);
  if(iter == this->Form->Pages.end())
    {
    // If no page is found, show the blank page.
    this->Form->Stack->setCurrentWidget(this->Form->BlankPage);
    }
  else
    {
    this->Form->Stack->setCurrentWidget(*iter);
    pqOptionsContainer *container = qobject_cast<pqOptionsContainer *>(*iter);
    if(container)
      {
      // Get the path prefix from the container.
      QString prefix = container->getPagePrefix();
      if(!prefix.isEmpty())
        {
        // Remove the prefix from the path.
        path.remove(0, prefix.length());
        }

      // Set the page on the container object.
      container->setPage(path);
      }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PVGUI_ParaViewSettingsPane::pluginLoaded ( QObject *  plugin_interface) [protected, slot]

Definition at line 620 of file PVGUI_ParaViewSettingsPane.cxx.

{
  pqViewOptionsInterface* viewOptions =
    qobject_cast<pqViewOptionsInterface*>(iface);
  if (viewOptions)
    {
    foreach(QString viewtype, viewOptions->viewTypes())
      {
      // Try to create global view options
      pqOptionsContainer* globalOptions =
        viewOptions->createGlobalViewOptions(viewtype, this);
      if (globalOptions)
        {
        this->addOptions(globalOptions);
        }
      }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PVGUI_ParaViewSettingsPane::removeOptions ( pqOptionsPage *  options)

Removes the options page from the options dialog.

The page name is removed from the selection tree. If the page is an options container, all the names are removed.

Parameters:
optionsThe options page/container to remove.

Definition at line 481 of file PVGUI_ParaViewSettingsPane.cxx.

{
  if(!options)
    {
    return;
    }

  // Remove the widget from the stack.
  this->Form->Stack->removeWidget(options);

  // See if the options use the apply button.
  if(options->isApplyUsed())
    {
    this->Form->ApplyUseCount--;
    /*if(this->Form->ApplyUseCount == 0)
      {
        //this->Form->ApplyNeeded = false;
      //this->Form->ApplyButton->setEnabled(false);
      //this->Form->ResetButton->setEnabled(false);
      //this->Form->ApplyButton->hide();
      //this->Form->ResetButton->hide();
      //QObject::disconnect(this, SIGNAL(accepted()), this, SLOT(applyChanges()));
      }*/

    this->disconnect(options, 0, this, 0);
    }

  // Search the map for the paths to remove.
  QMap<QString, pqOptionsPage *>::Iterator iter = this->Form->Pages.begin();
  while(iter != this->Form->Pages.end())
    {
    if(*iter == options)
      {
      QString path = iter.key();
      iter = this->Form->Pages.erase(iter);

      // Remove the item from the tree model as well.
      QModelIndex index = this->Form->Model->getIndex(path);
      QPersistentModelIndex parentIndex = index.parent();
      if(this->Form->Model->removeIndex(index))
        {
        // Remove any empty parent items.
        while(parentIndex.isValid() &&
            this->Form->Model->rowCount(parentIndex) == 0)
          {
          index = parentIndex;
          parentIndex = index.parent();

          // Make sure the index path isn't in the map.
          path = this->Form->Model->getPath(index);
          if(this->Form->Pages.find(path) == this->Form->Pages.end())
            {
            if(!this->Form->Model->removeIndex(index))
              {
              break;
              }
            }
          }
        }
      }
    else
      {
      ++iter;
      }
    }
}

Here is the call graph for this function:

Calls each page to reset any changes.

Definition at line 572 of file PVGUI_ParaViewSettingsPane.cxx.

{
  //if(this->Form->ApplyNeeded)
  //{
    QMap<QString, pqOptionsPage *>::Iterator iter = this->Form->Pages.begin();
    for( ; iter != this->Form->Pages.end(); ++iter)
      {
      (*iter)->resetChanges();
      }

    //this->setApplyNeeded(false);
    //}
}
void PVGUI_ParaViewSettingsPane::retrieve ( QtxResourceMgr *  theRes,
QtxPreferenceMgr *  thePref 
) [virtual]

Definition at line 644 of file PVGUI_ParaViewSettingsPane.cxx.

{
}
void PVGUI_ParaViewSettingsPane::setCurrentPage ( const QString &  path) [slot]

Sets the current options page.

Parameters:
pathThe name of the options page to show.

Definition at line 548 of file PVGUI_ParaViewSettingsPane.cxx.

{
  QModelIndex current = this->Form->Model->getIndex(path);
  this->Form->PageNames->setCurrentIndex(current);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PVGUI_ParaViewSettingsPane::store ( QtxResourceMgr *  theRes,
QtxPreferenceMgr *  thePref 
) [virtual]

Implementation of QtxUserDefinedContent interface.

Definition at line 639 of file PVGUI_ParaViewSettingsPane.cxx.

{
  applyChanges();
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 120 of file PVGUI_ParaViewSettingsPane.h.


The documentation for this class was generated from the following files: