annotate base/Command.h @ 1210:584b2d7d7cd9 piper

Try AutoPlugin; also not very successful
author Chris Cannam
date Fri, 14 Oct 2016 16:23:04 +0100
parents b4a8d8221eaf
children c01cbe41aeb5
rev   line source
Chris@49 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@16 2
Chris@16 3 /*
Chris@52 4 Sonic Visualiser
Chris@52 5 An audio file viewer and annotation editor.
Chris@52 6 Centre for Digital Music, Queen Mary, University of London.
Chris@52 7 This file copyright 2006 Chris Cannam.
Chris@16 8
Chris@52 9 This program is free software; you can redistribute it and/or
Chris@52 10 modify it under the terms of the GNU General Public License as
Chris@52 11 published by the Free Software Foundation; either version 2 of the
Chris@52 12 License, or (at your option) any later version. See the file
Chris@52 13 COPYING included with this distribution for more information.
Chris@16 14 */
Chris@16 15
Chris@16 16 #ifndef _COMMAND_H_
Chris@16 17 #define _COMMAND_H_
Chris@16 18
Chris@423 19 #include <QObject>
Chris@17 20 #include <QString>
Chris@17 21 #include <vector>
Chris@17 22
Chris@686 23 #include "Debug.h"
Chris@686 24
Chris@16 25 class Command
Chris@16 26 {
Chris@16 27 public:
Chris@17 28 virtual ~Command() { }
Chris@17 29
Chris@16 30 virtual void execute() = 0;
Chris@16 31 virtual void unexecute() = 0;
Chris@17 32 virtual QString getName() const = 0;
Chris@17 33 };
Chris@17 34
Chris@17 35 class MacroCommand : public Command
Chris@17 36 {
Chris@17 37 public:
Chris@17 38 MacroCommand(QString name);
Chris@17 39 virtual ~MacroCommand();
Chris@17 40
Chris@17 41 virtual void addCommand(Command *command);
Chris@17 42 virtual void deleteCommand(Command *command);
Chris@47 43 virtual bool haveCommands() const;
Chris@17 44
Chris@17 45 virtual void execute();
Chris@17 46 virtual void unexecute();
Chris@17 47
Chris@47 48 virtual QString getName() const;
Chris@47 49 virtual void setName(QString name);
Chris@17 50
Chris@17 51 protected:
Chris@17 52 QString m_name;
Chris@17 53 std::vector<Command *> m_commands;
Chris@16 54 };
Chris@16 55
Chris@423 56 /**
Chris@423 57 * BundleCommand is a MacroCommand whose name includes a note of how
Chris@423 58 * many commands it contains. It is a QObject with Q_OBJECT macro so
Chris@423 59 * that it can do plural-sensitive translations.
Chris@423 60 */
Chris@423 61 class BundleCommand : public QObject, public MacroCommand
Chris@423 62 {
Chris@423 63 Q_OBJECT
Chris@423 64
Chris@423 65 public:
Chris@423 66 BundleCommand(QString name);
Chris@423 67 virtual ~BundleCommand();
Chris@423 68
Chris@423 69 virtual QString getName() const;
Chris@423 70 };
Chris@423 71
Chris@16 72 #endif
Chris@16 73