-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHistoryHandler.cpp
63 lines (53 loc) · 1.22 KB
/
HistoryHandler.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// HistoryHandler.cpp
// LC3-Sim
//
// Created by Joseph Melberg on 1/1/18.
// Copyright © 2018 EIU. All rights reserved.
//
#include "HistoryHandler.h"
#include "Utility.h"
#include "QUndoStack"
HistoryHandler::HistoryHandler()
{
HistoryHandler::doing = 0;
}
void HistoryHandler::setIndex(int idx)
{
qDebug("Helloooooo");
HistoryHandler::doing++;
QUndoStack::setIndex(idx);
doing--;
}
int HistoryHandler::doing = 0;
void HistoryHandler::undo(int level)
{
// if(dont)return;
doing++;
QUndoStack::undo();
qDebug(QString().setNum(count()).toLocal8Bit());
doing--;
}
const QUndoCommand *HistoryHandler::command(int index) const
{
return QUndoStack::command(index);
}
void HistoryHandler::redo(int level)
{
// if(doing)return;
doing++;
QUndoStack::redo();
doing--;
}
bool HistoryHandler::add(QUndoCommand *cmd)
{
//qDebug(cmd->actionText().toLocal8Bit()+ " " +QString().setNum(this->index()).toLocal8Bit());
if(doing==0)push(cmd);
//qDebug("hy");
return true;
}
void HistoryHandler::push(QUndoCommand *cmd)
{
// qDebug(QString().setNum(cmd->id()).toLocal8Bit());
this->QUndoStack::push(cmd);
}