File indexing completed on 2024-04-28 15:39:41

0001 /* SPDX-FileCopyrightText: 2014 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef REMOTECONTROL_HISTORY_H
0007 #define REMOTECONTROL_HISTORY_H
0008 
0009 #include "Action.h"
0010 #include <QStack>
0011 #include <memory>
0012 #include <stack>
0013 
0014 namespace RemoteControl
0015 {
0016 
0017 class History
0018 {
0019 public:
0020     void push(std::unique_ptr<Action>);
0021     void goForward();
0022     void goBackward();
0023     bool canGoBack() const;
0024     bool canGoForward() const;
0025     void rerunTopItem();
0026 
0027 private:
0028     std::stack<std::unique_ptr<Action>> m_backward;
0029     std::stack<std::unique_ptr<Action>> m_forward;
0030     std::unique_ptr<Action> m_current = nullptr;
0031 };
0032 
0033 } // namespace RemoteControl
0034 
0035 #endif // REMOTECONTROL_HISTORY_H