Mercurial > hg > svcore
annotate base/Command.h @ 618:b1dc68507e46 sv-v1.7.1
* Layer data editor window: fix sorting for columns in region model,
add Find feature
* RDF import: assign names to layers based on event types, if no suitable
labels are found in the RDF
* Add label to status bar showing the last text that was passed in current
layer (so e.g. counting 1, 2, 3, 4 if that's what beats are labelled)
* Better layout of text labels for region layers in segmentation mode when
they are close together
* Give text layer the same method for finding "nearest point" as region and
note layers, should improve its editability
author | Chris Cannam |
---|---|
date | Thu, 22 Oct 2009 15:54:21 +0000 |
parents | 6a96bff0bd59 |
children | b4a8d8221eaf |
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@16 | 23 class Command |
Chris@16 | 24 { |
Chris@16 | 25 public: |
Chris@17 | 26 virtual ~Command() { } |
Chris@17 | 27 |
Chris@16 | 28 virtual void execute() = 0; |
Chris@16 | 29 virtual void unexecute() = 0; |
Chris@17 | 30 virtual QString getName() const = 0; |
Chris@17 | 31 }; |
Chris@17 | 32 |
Chris@17 | 33 class MacroCommand : public Command |
Chris@17 | 34 { |
Chris@17 | 35 public: |
Chris@17 | 36 MacroCommand(QString name); |
Chris@17 | 37 virtual ~MacroCommand(); |
Chris@17 | 38 |
Chris@17 | 39 virtual void addCommand(Command *command); |
Chris@17 | 40 virtual void deleteCommand(Command *command); |
Chris@47 | 41 virtual bool haveCommands() const; |
Chris@17 | 42 |
Chris@17 | 43 virtual void execute(); |
Chris@17 | 44 virtual void unexecute(); |
Chris@17 | 45 |
Chris@47 | 46 virtual QString getName() const; |
Chris@47 | 47 virtual void setName(QString name); |
Chris@17 | 48 |
Chris@17 | 49 protected: |
Chris@17 | 50 QString m_name; |
Chris@17 | 51 std::vector<Command *> m_commands; |
Chris@16 | 52 }; |
Chris@16 | 53 |
Chris@423 | 54 /** |
Chris@423 | 55 * BundleCommand is a MacroCommand whose name includes a note of how |
Chris@423 | 56 * many commands it contains. It is a QObject with Q_OBJECT macro so |
Chris@423 | 57 * that it can do plural-sensitive translations. |
Chris@423 | 58 */ |
Chris@423 | 59 class BundleCommand : public QObject, public MacroCommand |
Chris@423 | 60 { |
Chris@423 | 61 Q_OBJECT |
Chris@423 | 62 |
Chris@423 | 63 public: |
Chris@423 | 64 BundleCommand(QString name); |
Chris@423 | 65 virtual ~BundleCommand(); |
Chris@423 | 66 |
Chris@423 | 67 virtual QString getName() const; |
Chris@423 | 68 }; |
Chris@423 | 69 |
Chris@16 | 70 #endif |
Chris@16 | 71 |