Skip to content

Commit a1947bb

Browse files
committed
Queue semantics
1 parent 6e59c8d commit a1947bb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Interface/Application/ProvenanceWindow.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,16 @@ void ProvenanceWindow::addProvenanceItem(ProvenanceItemHandle item)
125125
for (int i = provenanceListWidget_->count() - 1; i > lastUndoRow_; --i)
126126
delete provenanceListWidget_->takeItem(i);
127127

128+
if (provenanceListWidget_->count() == maxItems_)
129+
{
130+
delete provenanceListWidget_->takeItem(0);
131+
}
132+
else
133+
{
134+
lastUndoRow_++;
135+
}
136+
128137
new ProvenanceWindowListItem(item, provenanceListWidget_);
129-
lastUndoRow_++;
130138
setRedoEnabled(false);
131139
setUndoEnabled(true);
132140

@@ -156,6 +164,7 @@ void ProvenanceWindow::clear()
156164

157165
void ProvenanceWindow::setMaxItems(int max)
158166
{
167+
maxItems_ = max;
159168
for (int i = 0; i < provenanceListWidget_->count() - max; ++i)
160169
{
161170
delete provenanceListWidget_->takeItem(0);

src/Interface/Application/ProvenanceWindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private Q_SLOTS:
6767
void networkModified();
6868
private:
6969
SCIRun::Dataflow::Engine::ProvenanceManagerHandle provenanceManager_;
70-
int lastUndoRow_;
70+
int lastUndoRow_, maxItems_{10};
7171
const SCIRun::Dataflow::Engine::ProvenanceManagerHandle::element_type::IOType* networkEditor_;
7272

7373
void setUndoEnabled(bool enable);

0 commit comments

Comments
 (0)