Commit 9fe21749 authored by Jeffrey Covington's avatar Jeffrey Covington
Browse files

Added basic model-view classes. Added basic support for model-view in...

Added basic model-view classes. Added basic support for model-view in Directory and cnetsuite. Added new supported types to WorkOrder and marked old types as deprecated. Registered some classes with Qt's metatype system for use in the model-view framework.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6402 41f8697f-d340-4b68-9986-7bafba869bb8
parent 9f068b9c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -72,6 +72,8 @@ namespace Isis {
   *                           is used.
   *   @history 2015-09-03 Jeannie Backer - Added preliminary hdf5 read/write capabilities. Renamed
   *                           member variables to make names more descriptive.
   *   @history 2015-10-14 Jeffrey Covington - Declared BundleResults as a Qt
   *                           metatype for use with QVariant.
   */
  class BundleResults : public QObject {
    Q_OBJECT
@@ -378,4 +380,7 @@ namespace Isis {
  QDataStream &operator<<(QDataStream &stream, const BundleResults &bundleResults);
  QDataStream &operator>>(QDataStream &stream, BundleResults &bundleResults);
};

Q_DECLARE_METATYPE(Isis::BundleResults);

#endif // BundleResults_h
+5 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ namespace Isis {
   *                           test code coverage is (scope 98.79%, line 98.698%, function 96.0%).
   *   @history 2015-09-03 Jeannie Backer - Changed a priori sigma defaults from -1.0 to Isis::Null.
   *   @history 2015-09-03 Jeannie Backer - Added preliminary hdf5 read/write capabilities.
   *   @history 2015-10-14 Jeffrey Covington - Declared BundleSettingsQsp as a
   *                           Qt metatype for use with QVariant.
   *  
   *   @todo Determine whether xml stuff needs a Project pointer
   *   @todo Determine which XmlStackedHandlerReader constructor is preferred
@@ -332,5 +334,8 @@ namespace Isis {
  QDataStream &operator<<(QDataStream &stream, const BundleSettings &settings);
  QDataStream &operator>>(QDataStream &stream, BundleSettings &settings);
};

Q_DECLARE_METATYPE(Isis::BundleSettingsQsp);

#endif
+5 −0
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@ namespace Isis {
   *                           operators and the read/write methods.
   *   @history 2014-12-04 Jeannie Backer - Renamed from BundleResults to BundleSolutionInfo.
   *   @history 2015-09-03 Jeannie Backer - Added preliminary hdf5 read/write capabilities.
   *   @history 2015-10-14 Jeffrey Covington - Declared BundleSolutionInfo * as 
   *                           a Qt metatype for use with QVariant.
   *  
   */
  class BundleSolutionInfo : public QObject {
@@ -154,4 +156,7 @@ namespace Isis {
                          QString attributeName, QString attributeValue);
  QString getStringAttribute(int locationId, QString locationName, QString attributeName);
}; // end namespace Isis

Q_DECLARE_METATYPE(Isis::BundleSolutionInfo *);

#endif // BundleSolutionInfo_h
+4 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ namespace Isis {
   *   @history 2014-07-23 Jeannie Backer - Added QDataStream >> and << operators and read/write
   *                           methods. Created unitTest. Added new operators to assignments in
   *                           copy constructor and operator= methods.
   *   @history 2015-10-14 Jeffrey Covington - Declared CorrelationMatrix as a
   *                           Qt metatype for use with QVariant.
   */
  class CorrelationMatrix {
    public:
@@ -122,4 +124,6 @@ namespace Isis {
  QDataStream &operator>>(QDataStream &stream, CorrelationMatrix &matrix);
};

Q_DECLARE_METATYPE(Isis::CorrelationMatrix);

#endif
+62 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@

#include <QtGui>
#include <QSettings>
#include <QTreeView>

#include "Directory.h"
#include "FileName.h"
@@ -32,6 +33,8 @@
#include "MosaicSceneWidget.h"
#include "ProgressWidget.h"
#include "Project.h"
#include "ProjectItemModel.h"
#include "ProjectItemTreeView.h"
#include "ProjectTreeWidget.h"
#include "TargetInfoWidget.h"

@@ -101,7 +104,11 @@ namespace Isis {
    m_projectDock->setObjectName("projectDock");
    m_projectDock->setFeatures(QDockWidget::DockWidgetMovable |
                              QDockWidget::DockWidgetFloatable);
    m_projectDock->setWidget(m_directory->projectTreeWidget());
    //m_projectDock->setWidget(m_directory->projectTreeWidget());
    ProjectItemTreeView *projectTreeView = m_directory->addProjectItemTreeView();
    projectTreeView->setSourceModel( m_directory->model() );
    projectTreeView->installEventFilter(this);
    m_projectDock->setWidget(projectTreeView);
    addDockWidget(Qt::LeftDockWidgetArea, m_projectDock, Qt::Horizontal);

    QDockWidget *warningsDock = new QDockWidget("Warnings", this, Qt::SubWindow);
@@ -144,6 +151,7 @@ namespace Isis {
    foreach (QProgressBar *progressBar, m_directory->progressBars()) {
      statusBar()->addWidget(progressBar);
    }
    
  }


@@ -188,6 +196,59 @@ namespace Isis {
    delete m_directory;
  }

  /**
   * Filters out context menu events from views so they can be handled
   * by the main window.
   *
   * @param[in] watched (QObject *) The object being filtered.
   * @param[in] event (QEvent *) The event that may be filtered.
   */
  bool CNetSuiteMainWindow::eventFilter(QObject *watched, QEvent *event) {
    if (event->type() == QEvent::DragEnter) {
      return true;
    }
    else if (event->type() == QEvent::Drop) {
      return true;
    }
    else if (event->type() == QEvent::ContextMenu) {

      AbstractProjectItemView *view = qobject_cast<AbstractProjectItemView *>(watched);
      if (view) {
        QMenu contextMenu;

        QList<QAction *> viewActions = view->contextMenuActions();

        if ( !viewActions.isEmpty() ) {
          foreach (QAction *action, viewActions) {
            if (!action) {
              contextMenu.addAction(action);
            }
            else {
              contextMenu.addSeparator();
            }
          }
          contextMenu.addSeparator();
        }

        QList<QAction *> workOrders = m_directory->supportedActions( view->currentItem() );

        if ( !workOrders.isEmpty() ) {
          foreach (QAction *action, workOrders) {
            contextMenu.addAction(action);
          }
          contextMenu.addSeparator();
        }

        contextMenu.exec( static_cast<QContextMenuEvent *>(event)->globalPos() ); 

        return true;
      }
    }

    return QMainWindow::eventFilter(watched, event);
  }



  /**
   * This method takes the max thread count setting and asks QtConcurrent to respect it.
Loading