Commit 33db2050 authored by Makayla Shepherd's avatar Makayla Shepherd
Browse files

Determined that the changes in ImageFileListWidget class will not impact ISIS...

Determined that the changes in ImageFileListWidget class will not impact ISIS and updated documentation. Fixes #3962.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6777 41f8697f-d340-4b68-9986-7bafba869bb8
parent 9befe0fc
Loading
Loading
Loading
Loading
+137 −22
Original line number Diff line number Diff line
@@ -8,13 +8,13 @@
#include <QDebug>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QMenu>
#include <QPoint>
#include <QScrollArea>
#include <QSettings>
#include <QSize>
#include <QVBoxLayout>
#include <QXmlStreamWriter>

#include "Directory.h"
@@ -30,6 +30,14 @@
#include "XmlStackedHandlerReader.h"

namespace Isis {
  
  /**
   * Constructor. This method sets up the QWidget to show the ImageTreeWidget that is created
   * using directory.
   * 
   * @param directory The directory where you want the ImageTreeWidget to be made
   * @param parent The QWidget parent
   */
  ImageFileListWidget::ImageFileListWidget(Directory *directory,
                                           QWidget *parent) : QWidget(parent) {
    m_directory = directory;
@@ -53,18 +61,30 @@ namespace Isis {
    m_progress->setVisible(false);
  }


  /**
   * Destructor
   */
  ImageFileListWidget::~ImageFileListWidget() {
    delete m_progress;
    m_directory = NULL;
  }


  /**
   * This method returns the progress bar.
   * 
   * @return @b QProgressBar * Returns the ProgressBar
   */
  QProgressBar *ImageFileListWidget::getProgress() {
    return m_progress;
  }


  /**
   * This method loads the state of this class from the pvl.
   * 
   * @param pvl The pvl that we are reading the state from.
   * 
   * @throws IException::Io "Unable to read image file's list widget settings from Pvl"
   */
  void ImageFileListWidget::fromPvl(PvlObject &pvl) {
    if (pvl.name() == "ImageFileList") {
      m_serialized.reset(new PvlObject(pvl));
@@ -124,7 +144,11 @@ namespace Isis {
    }
  }


  /**
   * This method writes the state of this class to a pvl.
   * 
   * @return @b PvlObject The pvl that we are writing too.
   */
  PvlObject ImageFileListWidget::toPvl() const {
    PvlObject output("ImageFileList");

@@ -164,22 +188,43 @@ namespace Isis {
    return output;
  }


  /**
   * This method pushes a new XmlHandler into the parser stack.
   * 
   * @param xmlReader This is the parser stack.
   */
  void ImageFileListWidget::load(XmlStackedHandlerReader *xmlReader) {
    xmlReader->pushContentHandler(new XmlHandler(this));
  }


  /**
   * This method calls ImageTreeWidget::actions() which sets up a QAction
   * that sets a default for the file list columns and returns a QList of
   * QPointers that point to the QAction.
   * 
   * @return @b QList<QAction *> The QList of QPointers that point to the QAction set up by 
   *            ImageTreeWidget::actions().
   */
  QList<QAction *> ImageFileListWidget::actions() {
    return m_tree->actions();
  }


  /**
   * This method calls ImageTreeWidget::getViewActions() which returns a 
   * list of FootprintColumns.
   * 
   * @return @b QList<QAction *> The QList of FootprintColumns.
   */
  QList<QAction *> ImageFileListWidget::getViewActions() {
    return m_tree->getViewActions();
  }


  /**
   * This method creates a new QAction which is connected and when triggered
   * will save the cube list.
   * 
   * @return @b QList<QAction *> The QList of the new QAction.
   */
  QList<QAction *> ImageFileListWidget::getExportActions() {
    QList<QAction *> exportActs;

@@ -193,7 +238,11 @@ namespace Isis {
    return exportActs;
  }


  /**
   * This method creates a QWidget that displays a long help message explaining the tool.
   * 
   * @return @b QWidget Returns the message QWidget that was made.
   */
  QWidget *ImageFileListWidget::getLongHelp(QWidget *fileListContainer) {
    QScrollArea *longHelpWidgetScrollArea = new QScrollArea;

@@ -263,7 +312,11 @@ namespace Isis {
    return longHelpWidgetScrollArea;
  }


  /** 
   * This method adds the new images to the tree.
   * 
   * @param images ImageList containing all of the images that need to be added to the tree.
   */
  void ImageFileListWidget::addImages(ImageList *images) {
    m_progress->setText("Loading file list");
    m_progress->setRange(0, images->size() - 1);
@@ -362,7 +415,12 @@ namespace Isis {
    m_progress->setVisible(false);
  }


  /**
   * This method takes an event and gets all of the FootprintColumns, adds them to
   * the menu, then it pops up the menu at the location of event.
   * 
   * @param event A QContextMenuEvent that is used to find the position of the mouse.
   */
  void ImageFileListWidget::contextMenuEvent(QContextMenuEvent *event) {
    QMenu menu;

@@ -380,7 +438,9 @@ namespace Isis {
    menu.exec(event->globalPos());
  }


  /**
   * This method saves the list to the choosen output file.
   */
  void ImageFileListWidget::saveList() {
    QString output =
        QFileDialog::getSaveFileName((QWidget *)parent(),
@@ -405,7 +465,13 @@ namespace Isis {
    }
  }


  /** 
   * This method takes an image and finds it's position.
   * 
   * @param image The image we are trying to find.
   * 
   * @return @b ImageTreeWidget::ImagePosition The position of the image.
   */
  ImageTreeWidget::ImagePosition ImageFileListWidget::find(const Image *image) const {
    QString id = image->id();

@@ -433,7 +499,12 @@ namespace Isis {
    return result;
  }


  /**
   * This method returns the QTreeWidgetItem to it's expanded state.
   * 
   * @param expandedStates The expanded state that needs to be restored.
   * @param item The QTreeWidgetItem that will be restored to it's expanded state.
   */
  void ImageFileListWidget::restoreExpandedStates(QVariant expandedStates, QTreeWidgetItem *item) {
    QMap<QString, QVariant> states = expandedStates.toMap();

@@ -458,7 +529,13 @@ namespace Isis {
    }
  }


  /**
   * This method saves the the expanded state of item.
   * 
   * @param item The QTreeWidgetItem that we will save the expanded state of.
   * 
   * @return @b QVariant The expanded state of item.
   */
  QVariant ImageFileListWidget::saveExpandedStates(QTreeWidgetItem *item) {
    QMap<QString, QVariant> result;

@@ -477,7 +554,14 @@ namespace Isis {
    return result;
  }


  /**
   * This method saves the FootprintColumns in the project and the settings associated 
   * with every column.
   * 
   * @param stream The QXmlStreamWriter that saves the FootprintColumns.
   * @param project The current project being saved.
   * @param newProjectRoot This is not used.
   */
  void ImageFileListWidget::save(QXmlStreamWriter &stream, Project *project,
                                 FileName newProjectRoot) const {
    stream.writeStartElement("imageFileList");
@@ -531,7 +615,13 @@ namespace Isis {
    stream.writeEndElement();
  }


  /**
   * This method saves the QTreeWidgetItem and the settings associated with the QTreeWidgetItem 
   * to the stream.
   * 
   * @param stream The stream that is saving the QTreeWidgetItem and the settings.
   * @param itemToWrite The QTreeWidgetItem that is being saved.
   */
  void ImageFileListWidget::save(QXmlStreamWriter &stream, QTreeWidgetItem *itemToWrite) const {
    bool done = false;

@@ -579,7 +669,11 @@ namespace Isis {
    stream.writeEndElement();
  }


  /**
   * Creates a XmlHandler for fileList
   * 
   * @param fileList The image file list we are handling
   */
  ImageFileListWidget::XmlHandler::XmlHandler(ImageFileListWidget *fileList) {
    m_fileList = fileList;
    m_currentImageList = NULL;
@@ -587,11 +681,23 @@ namespace Isis {
    m_currentGroup = NULL;
  }


  /**
   * Destructor
   */
  ImageFileListWidget::XmlHandler::~XmlHandler() {
  }


  /**
   * This method calls XmlStackedHandler's startElement() and retrieves attributes from
   * atts according to what localName is and stores that in m_fileList.
   * 
   * @param namespaceURI ???
   * @param localName Determines what attributes to retrieve from atts.
   * @param qName ???
   * @param atts Stores the attributes.
   * 
   * @return @b bool The result of XmlStackedHandler's startElement() method.
   */
  bool ImageFileListWidget::XmlHandler::startElement(const QString &namespaceURI,
      const QString &localName, const QString &qName, const QXmlAttributes &atts) {
    bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts);
@@ -667,7 +773,16 @@ namespace Isis {
    return result;
  }


  /**
   * This method calls XmlStackedHandler's endElement() and dereferences pointers according to
   * the value of localName.
   * 
   * @param namespaceURI ???
   * @param localName Determines which pointers to dereference.
   * @param qName ???
   * 
   * @return @b bool The result of XmlStackedHandler's endElement() method.
   */
  bool ImageFileListWidget::XmlHandler::endElement(const QString &namespaceURI,
      const QString &localName, const QString &qName) {
    bool result = XmlStackedHandler::endElement(namespaceURI, localName, qName);
+9 −6
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ namespace Isis {
   *   @history 2013-06-17 Jeannie Backer, Tracie Sucharski, and Stuart Sides - replaced
   *                          setDefaultFileListCols() with actions() to call
   *                          setDefaultFileListCols() from ImageTreeWidget.
   *   @history 2014-09-05 Kim Oyama - Modified XmlHandler::startElement and save().
   *   @history 2016-04-28 Tracie Sucharski - Modified to use Qt5 and v006 libraries.
   *   @history 2016-06-07 Makayla Shepherd - Updated documentation. Fixes #3962.
   */
  class ImageFileListWidget : public QWidget {
      Q_OBJECT
@@ -95,18 +98,18 @@ namespace Isis {
        private:
          Q_DISABLE_COPY(XmlHandler);

          ImageFileListWidget *m_fileList;
          ImageList *m_currentImageList;
          QTreeWidgetItem *m_currentImageListItem;
          QTreeWidgetItem *m_currentGroup;
          ImageFileListWidget *m_fileList; //!< The widget we are working with
          ImageList *m_currentImageList; //!< The list of images being worked on
          QTreeWidgetItem *m_currentImageListItem; //!< The image being worked on
          QTreeWidgetItem *m_currentGroup; //!< The group of cubes being worked on
      };

    private:
      QPointer<ProgressBar> m_progress;
      QPointer<ProgressBar> m_progress; //!< The ProgressBar of the ImageFileListWidget
      //! Serialized (file) version of this object
      QScopedPointer<PvlObject> m_serialized;
      ImageTreeWidget *m_tree; //!< Tree item associated with this mosaic item
      Directory *m_directory;
      Directory *m_directory; //!< The directory of the project
  };
}