Chris@49: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@16: 
Chris@16: /*
Chris@52:     Sonic Visualiser
Chris@52:     An audio file viewer and annotation editor.
Chris@52:     Centre for Digital Music, Queen Mary, University of London.
Chris@52:     This file copyright 2006 Chris Cannam.
Chris@16:     
Chris@52:     This program is free software; you can redistribute it and/or
Chris@52:     modify it under the terms of the GNU General Public License as
Chris@52:     published by the Free Software Foundation; either version 2 of the
Chris@52:     License, or (at your option) any later version.  See the file
Chris@52:     COPYING included with this distribution for more information.
Chris@16: */
Chris@16: 
Chris@16: #ifndef _COMMAND_H_
Chris@16: #define _COMMAND_H_
Chris@16: 
Chris@423: #include <QObject>
Chris@17: #include <QString>
Chris@17: #include <vector>
Chris@17: 
Chris@686: #include "Debug.h"
Chris@686: 
Chris@16: class Command
Chris@16: {
Chris@16: public:
Chris@17:     virtual ~Command() { }
Chris@17: 
Chris@16:     virtual void execute() = 0;
Chris@16:     virtual void unexecute() = 0;
Chris@17:     virtual QString getName() const = 0;
Chris@17: };
Chris@17: 
Chris@17: class MacroCommand : public Command
Chris@17: {
Chris@17: public:
Chris@17:     MacroCommand(QString name);
Chris@17:     virtual ~MacroCommand();
Chris@17: 
Chris@17:     virtual void addCommand(Command *command);
Chris@17:     virtual void deleteCommand(Command *command);
Chris@47:     virtual bool haveCommands() const;
Chris@17: 
Chris@17:     virtual void execute();
Chris@17:     virtual void unexecute();
Chris@17: 
Chris@47:     virtual QString getName() const;
Chris@47:     virtual void setName(QString name);
Chris@17: 
Chris@17: protected:
Chris@17:     QString m_name;
Chris@17:     std::vector<Command *> m_commands;
Chris@16: };
Chris@16: 
Chris@423: /**
Chris@423:  * BundleCommand is a MacroCommand whose name includes a note of how
Chris@423:  * many commands it contains.  It is a QObject with Q_OBJECT macro so
Chris@423:  * that it can do plural-sensitive translations.
Chris@423:  */
Chris@423: class BundleCommand : public QObject, public MacroCommand
Chris@423: {
Chris@423:     Q_OBJECT
Chris@423: 
Chris@423: public:
Chris@423:     BundleCommand(QString name);
Chris@423:     virtual ~BundleCommand();
Chris@423: 
Chris@423:     virtual QString getName() const;
Chris@423: };
Chris@423: 
Chris@16: #endif
Chris@16: