Commit 463cae60 authored by Adam Goins's avatar Adam Goins Committed by Makayla Shepherd
Browse files

Added the Activity History tab to QnetNavTool. Added appropriate signal/slot

parent 381b6962
Loading
Loading
Loading
Loading
+86 −31
Original line number Diff line number Diff line
@@ -11,10 +11,12 @@
#include <QListWidgetItem>
#include <QMessageBox>
#include <QPushButton>
#include <QScrollArea>
#include <QSettings>
#include <QStackedWidget>
#include <QString>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QWidget>

#include "QnetCubeDistanceFilter.h"
@@ -47,6 +49,9 @@
#include "SpecialPixel.h"
#include "SurfacePoint.h"


#include <typeinfo>

using namespace std;

namespace Isis {
@@ -79,6 +84,8 @@ namespace Isis {

    createNavigationDialog(parent);
    connect(this, SIGNAL(deletedPoints()), this, SLOT(refreshList()));
    connect(this, SIGNAL( activityUpdate(QString) ),
            this, SLOT( updateActivityHistory(QString) ) );
  }

  /**
@@ -268,6 +275,10 @@ namespace Isis {
   *                           "Properties". Updated "What's This?" documentation
   *                           for Measure Properties to explain use of ignore
   *                           status and measure type filters.
   *   @history  2018-01-10 Adam Goins - Added the Activity History tab to the window.
   *                           This tab will keep track of edits made to control points/measures.
   *                           More history entries can be kept track of
   *                           by emitting the activityUpdate(QString message) signal.
   */
  void QnetNavTool::createFilters() {
    // Set up the point filters
@@ -419,6 +430,29 @@ namespace Isis {
    // Add widgets to the filter stack
    m_filterStack->addWidget(pointFilters);
    m_filterStack->addWidget(cubeFilters);


    // Create the Activity History Tab
    QScrollArea *scrollArea = new QScrollArea();

    QWidget *historyWidget = new QWidget();
    QWidget *innerWidget = new QWidget();

    QVBoxLayout *innerLayout = new QVBoxLayout();
    QLabel *title = new QLabel("<b>History</b>");
    innerLayout->addWidget(title);
    innerLayout->addWidget(scrollArea);

    m_historyLayout = new QVBoxLayout(scrollArea);
    m_historyLayout->setAlignment(Qt::AlignTop);

    historyWidget->setLayout(innerLayout);
    innerWidget->setLayout(m_historyLayout);
    scrollArea->setWidget(innerWidget);
    scrollArea->setWidgetResizable(true);

    pointFilters->addTab(historyWidget, QString("&Activity History") );

  }


@@ -574,10 +608,32 @@ namespace Isis {
    else {
      m_listBox->setCurrentItem(items.at(0));
    }
    QString activityMessage("Point selected: " + pointId);
    emit(activityUpdate(activityMessage));
    return;
  }

  /**
  *   Slot to update the history tab with current edits.
  *   It is deisgned not to allow duplicate history entries back to back.
  *
  *   @internal
  *     @history 2018-01-10 Adam Goins - Slot was created.
  */
  void QnetNavTool::updateActivityHistory(QString activityMessage) {

    // Check to ensure duplicate entries aren't added back to back.
    if (m_historyLayout->count() > 0) {
      QWidget *firstEntry = m_historyLayout->layout()->itemAt(0)->widget();
      QLabel *firstLabel = dynamic_cast<QLabel*>(firstEntry);
      if (firstLabel->text() == activityMessage) {
        return;
      }
    }

    QLabel *historyEntry = new QLabel(activityMessage);
    m_historyLayout->insertWidget(0, historyEntry);
  }

  /**
   *   Slot to refresh the listBox
@@ -1243,4 +1299,3 @@ namespace Isis {
  }
#endif
}