Commit f20831d7 authored by Makayla Shepherd's avatar Makayla Shepherd
Browse files

Fixed project tree nodes so the names are retained. Fixes #5174.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@8301 41f8697f-d340-4b68-9986-7bafba869bb8
parent be9b314f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ namespace Isis {

    m_projectItemModel = new ProjectItemModel(this);
    m_projectItemModel->addProject(m_project);
    connect(m_projectItemModel, SIGNAL(cleanProject(bool)), SIGNAL(cleanProject(bool)));

//  qDebug()<<"Directory::Directory  model row counter after addProject = "<<m_projectItemModel->rowCount();

+7 −2
Original line number Diff line number Diff line
@@ -191,10 +191,13 @@ namespace Isis {
   *   @history 2017-11-02 Tyler Wilson - Added the updateRecentProjects() function which
   *                           updates the Recent Projects file menu with recently loaded projects.
   *                           Fixes #4492.
   *   @history 2017-11-09 Tyler Wilson - Made changes to updateRecentProjects() to handle deleting
   *                           the OpenRecentProjectWorkOrder.  Fixes #5220.
   *   @history 2017-11-03 Christopher Combs - Added support for new Template and TemplateList
   *                           classes. Fixes #5117.
   *   @history 2017-11-09 Tyler Wilson - Made changes to updateRecentProjects() to handle deleting
   *                           the OpenRecentProjectWorkOrder.  Fixes #5220.
   *   @history 2017-11-13 Makayla Shepherd - Modifying the name of an ImageList, ShapeList or 
   *                           BundeSolutionInfo on the ProjectTree now sets the project to 
   *                           not clean. Fixes #5174.
   */
  class Directory : public QObject {
    Q_OBJECT
@@ -314,6 +317,8 @@ namespace Isis {
      void cnetModified();
      void redrawMeasures();
      
      void cleanProject(bool);

    public slots:
      void cleanupBundleObservationViews(QObject *);
      void cleanupCnetEditorViewWidgets(QObject *);
+31 −13
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <QApplication>
#include <QDateTime>
#include <QDir>
#include <QDebug>
#include <QFile>
#include <QFileDialog>
#include <QFuture>
@@ -209,6 +210,8 @@ namespace Isis {
            this, SLOT(checkControlsAndImagesAvailable()));
    connect(this, SIGNAL(controlListAdded(ControlList *)),
            this, SLOT(checkControlsAndImagesAvailable()));
    connect(m_directory, SIGNAL(cleanProject(bool)),
            this, SLOT(setClean(bool)));

    m_images = new QList<ImageList *>;

@@ -583,13 +586,18 @@ namespace Isis {
  }


  ImageList *Project::createOrRetrieveImageList(QString name) {
  ImageList *Project::createOrRetrieveImageList(QString name, QString path) {
    ImageList *result = imageList(name);
    if (!result) {
      result = new ImageList;

      result->setName(name);
      if (path == "") {
        result->setPath(name);
      }
      else {
        result->setPath(path);
      }

      connect( result, SIGNAL( destroyed(QObject *) ),
               this, SLOT( imageListDeleted(QObject *) ) );
@@ -599,13 +607,18 @@ namespace Isis {
  }


  ShapeList *Project::createOrRetrieveShapeList(QString name) {
  ShapeList *Project::createOrRetrieveShapeList(QString name, QString path) {
    ShapeList *result = shapeList(name);
    if (!result) {
      result = new ShapeList;

      result->setName(name);
      if (path == "") {
        result->setPath(name);
      }
      else {
        result->setPath(path);
      }

      connect( result, SIGNAL( destroyed(QObject *) ),
               this, SLOT( shapeListDeleted(QObject *) ) );
@@ -836,7 +849,7 @@ namespace Isis {
    connect( this, SIGNAL( projectRelocated(Project *) ),
             control, SLOT( updateFileName(Project *) ) );

    createOrRetrieveControlList( FileName( control->fileName() ).dir().dirName() )->append(control);
    createOrRetrieveControlList( FileName( control->fileName() ).dir().dirName(), "" )->append(control);

    (*m_idToControlMap)[control->id()] = control;

@@ -844,14 +857,19 @@ namespace Isis {
  }


  ControlList *Project::createOrRetrieveControlList(QString name) {
  ControlList *Project::createOrRetrieveControlList(QString name, QString path) {
    ControlList *result = controlList(name);

    if (!result) {
      result = new ControlList;

      result->setName(name);
      if (path == "") {
        result->setPath(name);
      }
      else {
        result->setPath(path);
      }

      connect( result, SIGNAL( destroyed(QObject *) ),
               this, SLOT( controlListDeleted(QObject *) ) );
@@ -2415,10 +2433,10 @@ namespace Isis {

      (*m_idToImageMap)[image->id()] = image;
      if (images.name() != "") {
        createOrRetrieveImageList(images.name())->append(image);
        createOrRetrieveImageList(images.name(), images.path())->append(image);
      }
      else {
        createOrRetrieveImageList(FileName(images[0]->fileName()).dir().dirName())->append(image);
        createOrRetrieveImageList(FileName(images[0]->fileName()).dir().dirName(), "")->append(image);
      }
    }

@@ -2664,10 +2682,10 @@ namespace Isis {

      (*m_idToShapeMap)[shape->id()] = shape;
      if (shapes.name() != "") {
        createOrRetrieveShapeList(shapes.name())->append(shape);
        createOrRetrieveShapeList(shapes.name(), shapes.path())->append(shape);
      }
      else {
        createOrRetrieveShapeList(FileName(shapes[0]->fileName()).dir().dirName())->append(shape);
        createOrRetrieveShapeList(FileName(shapes[0]->fileName()).dir().dirName(), "")->append(shape);
      }

    }
+10 −4
Original line number Diff line number Diff line
@@ -187,6 +187,9 @@ namespace Isis {
   *                           saved (i.e. not cancelled). Fixes #5205.
   *   @history 2017-11-03 Christopher Combs - Added support for new Template and TemplateList
   *                           classes. Fixes #5117.
   *   @history 2017-11-13 Makayla Shepherd - Modifying the name of an ImageList, ShapeList or 
   *                           BundeSolutionInfo on the ProjectTree now sets the project to 
   *                           not clean. Fixes #5174.
   */
  class Project : public QObject {
    Q_OBJECT
@@ -231,7 +234,7 @@ namespace Isis {
      QMutex *mutex();
      QString projectRoot() const;
      QString projectPath() const;
      void setClean(bool value);

      void setName(QString newName);
      QUndoStack *undoStack();
      void waitForImageReaderFinished();
@@ -421,6 +424,7 @@ namespace Isis {

    public slots:
      void open(QString);
      void setClean(bool value);

    private slots:
      void controlClosed(QObject *control);
@@ -442,10 +446,12 @@ namespace Isis {
      Project(const Project &other);
      Project &operator=(const Project &rhs);
      void createFolders();

      ControlList *createOrRetrieveControlList(QString name, QString path = "");
      ImageList *createOrRetrieveImageList(QString name, QString path = "");
      ShapeList *createOrRetrieveShapeList(QString name, QString path = "");
      
      void writeSettings();
      ControlList *createOrRetrieveControlList(QString name);
      ImageList *createOrRetrieveImageList(QString name);
      ShapeList *createOrRetrieveShapeList(QString name);


      QString nextImageListGroupName();
+5 −0
Original line number Diff line number Diff line
@@ -772,21 +772,26 @@ namespace Isis {
    else if (item->isBundleSolutionInfo() && role == Qt::EditRole) {
      item->setText(name);
      item->bundleSolutionInfo()->setName(name);
      emit cleanProject(false);
    }
    else if (item->isImageList() && role == Qt::EditRole) {
      item->setText(name);
      item->imageList()->setName(name);
      emit cleanProject(false);
    }
    else if (item->isControlList() && role == Qt::EditRole) {
      item->setText(name);
      item->controlList()->setName(name);
      emit cleanProject(false);
    }
    else if (item->isShapeList() && role == Qt::EditRole) {
      item->setText(name);
      item->shapeList()->setName(name);
      emit cleanProject(false);
    }
    else if (item->isTemplate() && role == Qt::EditRole) {
      item->setText(name);
      emit cleanProject(false);
    }
    return true;
  }
Loading