USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::HistoryTreeWidget Class Reference

History Widget for cnetsuite. More...

#include <HistoryTreeWidget.h>

Inheritance diagram for Isis::HistoryTreeWidget:
Inheritance graph
Collaboration diagram for Isis::HistoryTreeWidget:
Collaboration graph

Public Member Functions

 HistoryTreeWidget (Project *project, QWidget *parent=0)
 Construct a history tree widget.
 
virtual ~HistoryTreeWidget ()
 Clean up allocated memory.
 

Protected Member Functions

int sizeHintForColumn (int column) const
 Get the preferred size of a given column.
 

Private Slots

void addToHistory (WorkOrder *)
 Add a single work order to the display.
 
void updateProgressWidgets ()
 We need to manually manage these progress widgets because QTreeWidget does a poor job of it.
 
void markNotUndone (QTreeWidgetItem *)
 Display the item as not an item that has been undone - it's working or done.
 
void markUndone (QTreeWidgetItem *)
 Display the item as an item that has been undone.
 
void handleUndoIndexChanged (int)
 The project's undo stack has changed.
 
void removeFromHistory (QObject *)
 A work order was lost...
 
void showHistory ()
 This resets the tree widget and re-initializes.
 
void updateStatus (WorkOrder *)
 
QTreeWidgetItemundoCommandToTreeItem (const QUndoCommand *)
 Get the QTreeWidgetItem associated with the given undo command (work order).
 

Private Member Functions

void refit ()
 This resizes the columns to an okay width for viewing all of the data cleanly.
 
void updateStatus (QTreeWidgetItem *)
 
 Q_DISABLE_COPY (HistoryTreeWidget)
 

Private Attributes

Projectm_project
 

Detailed Description

History Widget for cnetsuite.

This widget shows the history of work orders performed on the project.

Author
2012-07-23 Steven Lambright
History:

2012-07-23 Steven Lambright - Added/fixed documentation, improved implementation of addToHistory to look for alternative text/not display blank items.

2012-07-23 Steven Lambright and Stuart Sides - Added display of undo stack

2012-07-27 Kimberly Oyama and Steven Lambright - Added resizeEvent() and improved implementation of refit(). 2012-07-31 Kimberly Oyama - Added comments to some of the methods.

Definition at line 28 of file HistoryTreeWidget.h.

Constructor & Destructor Documentation

Isis::HistoryTreeWidget::HistoryTreeWidget ( Project project,
QWidget parent = 0 
)

Construct a history tree widget.

Parameters
projectThe project to show history for
parentThe Qt-relationship parent

Definition at line 17 of file HistoryTreeWidget.cpp.

References addToHistory(), handleUndoIndexChanged(), refit(), and showHistory().

Isis::HistoryTreeWidget::~HistoryTreeWidget ( )
virtual

Clean up allocated memory.

Definition at line 44 of file HistoryTreeWidget.cpp.

Member Function Documentation

void Isis::HistoryTreeWidget::addToHistory ( WorkOrder workOrder)
privateslot

Add a single work order to the display.

This uses the QUndoCommand text (if it's blank, it uses the QAction text). If there is no text, this does nothing.

Parameters
workOrderThe work order to display the history for

Definition at line 108 of file HistoryTreeWidget.cpp.

References refit(), removeFromHistory(), and updateProgressWidgets().

Referenced by HistoryTreeWidget(), and showHistory().

void Isis::HistoryTreeWidget::handleUndoIndexChanged ( int  newIndex)
privateslot

The project's undo stack has changed.

Display the changed states appropriately.

Definition at line 206 of file HistoryTreeWidget.cpp.

References markNotUndone(), markUndone(), and undoCommandToTreeItem().

Referenced by HistoryTreeWidget().

void Isis::HistoryTreeWidget::markNotUndone ( QTreeWidgetItem treeItem)
privateslot

Display the item as not an item that has been undone - it's working or done.

This colors it black and sets the text to completed (only visible if there is no progress bar).

Parameters
treeItemThe given GUI tree item/row to color appropriately.

Definition at line 181 of file HistoryTreeWidget.cpp.

Referenced by handleUndoIndexChanged().

void Isis::HistoryTreeWidget::markUndone ( QTreeWidgetItem treeItem)
privateslot

Display the item as an item that has been undone.

This colors it gray and sets the text to Undone.

Parameters
treeItemThe given GUI tree item/row to color appropriately.

Definition at line 195 of file HistoryTreeWidget.cpp.

Referenced by handleUndoIndexChanged().

void Isis::HistoryTreeWidget::refit ( )
private

This resizes the columns to an okay width for viewing all of the data cleanly.

This method depends on sizeHintForColumn() for good column sizes.

Definition at line 87 of file HistoryTreeWidget.cpp.

Referenced by addToHistory(), and HistoryTreeWidget().

void Isis::HistoryTreeWidget::removeFromHistory ( QObject deletedObject)
privateslot

A work order was lost...

compensate by removing it from the tree.

Definition at line 224 of file HistoryTreeWidget.cpp.

References undoCommandToTreeItem().

Referenced by addToHistory().

void Isis::HistoryTreeWidget::showHistory ( )
privateslot

This resets the tree widget and re-initializes.

See Also
addToHistory()

Definition at line 272 of file HistoryTreeWidget.cpp.

References addToHistory(), and Isis::Project::workOrderHistory().

Referenced by HistoryTreeWidget().

int Isis::HistoryTreeWidget::sizeHintForColumn ( int  column) const
protected

Get the preferred size of a given column.

This is used by resizeColumnToContents().

The work order name column prefers space not taken by other columns. The progress column prefers 200. The date column prefers a little more than the text size of a date.

Returns
The preferred width of the given column

Definition at line 58 of file HistoryTreeWidget.cpp.

QTreeWidgetItem * Isis::HistoryTreeWidget::undoCommandToTreeItem ( const QUndoCommand undoCommand)
privateslot

Get the QTreeWidgetItem associated with the given undo command (work order).

Returns NULL if none found or given NULL.

Parameters
undoCommandA work order
Returns
The QTreeWidgetItem that represents (is associated with) the undoCommand

Definition at line 249 of file HistoryTreeWidget.cpp.

Referenced by handleUndoIndexChanged(), and removeFromHistory().

void Isis::HistoryTreeWidget::updateProgressWidgets ( )
privateslot

We need to manually manage these progress widgets because QTreeWidget does a poor job of it.

This should be called when the progress bar instances have changed (new progress, lost a progress, etc...). This is not necessary when the progress values have changed.

Failing to call this method results in seg faults when other events occur - such as a resize event.

Definition at line 163 of file HistoryTreeWidget.cpp.

Referenced by addToHistory().


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