changeset 423:6a96bff0bd59

* Update translations, and add change counter to name of bundle command
author Chris Cannam
date Thu, 12 Jun 2008 10:47:11 +0000
parents 4caa28a0a8a2
children eafef13bb0b3
files base/Command.cpp base/Command.h data/model/ImageModel.h data/model/Labeller.h data/model/NoteModel.h data/model/SparseOneDimensionalModel.h data/model/SparseTimeValueModel.h data/model/TextModel.h
diffstat 8 files changed, 51 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/base/Command.cpp	Thu Jun 12 09:03:00 2008 +0000
+++ b/base/Command.cpp	Thu Jun 12 10:47:11 2008 +0000
@@ -14,6 +14,7 @@
 */
 
 #include "Command.h"
+#include <QCoreApplication>
 
 MacroCommand::MacroCommand(QString name) :
     m_name(name)
@@ -81,3 +82,19 @@
     m_name = name;
 }
 
+BundleCommand::BundleCommand(QString name) :
+    MacroCommand(name)
+{
+}
+
+BundleCommand::~BundleCommand()
+{
+}
+
+QString
+BundleCommand::getName() const
+{
+    if (m_commands.size() == 1) return m_name;
+    return tr("%1 (%n change(s))", "", m_commands.size()).arg(m_name);
+}
+
--- a/base/Command.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/base/Command.h	Thu Jun 12 10:47:11 2008 +0000
@@ -16,6 +16,7 @@
 #ifndef _COMMAND_H_
 #define _COMMAND_H_
 
+#include <QObject>
 #include <QString>
 #include <vector>
 
@@ -50,5 +51,21 @@
     std::vector<Command *> m_commands;
 };
 
+/**
+ * BundleCommand is a MacroCommand whose name includes a note of how
+ * many commands it contains.  It is a QObject with Q_OBJECT macro so
+ * that it can do plural-sensitive translations.
+ */
+class BundleCommand : public QObject, public MacroCommand
+{
+    Q_OBJECT
+
+public:
+    BundleCommand(QString name);
+    virtual ~BundleCommand();
+
+    virtual QString getName() const;
+};
+
 #endif
 
--- a/data/model/ImageModel.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/data/model/ImageModel.h	Thu Jun 12 10:47:11 2008 +0000
@@ -20,6 +20,8 @@
 #include "base/XmlExportable.h"
 #include "base/RealTime.h"
 
+#include <QStringList>
+
 /**
  * Image point type for use in a SparseModel.  This represents an
  * image, identified by filename, at a given time.  The filename can
@@ -84,6 +86,8 @@
 
 class ImageModel : public SparseModel<ImagePoint>
 {
+    Q_OBJECT
+
 public:
     ImageModel(size_t sampleRate, size_t resolution, bool notifyOnAdd = true) :
 	SparseModel<ImagePoint>(sampleRate, resolution, notifyOnAdd)
--- a/data/model/Labeller.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/data/model/Labeller.h	Thu Jun 12 10:47:11 2008 +0000
@@ -28,6 +28,8 @@
 
 class Labeller : public QObject
 {
+    Q_OBJECT
+
 public:
     enum ValueType {
         ValueNone,
--- a/data/model/NoteModel.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/data/model/NoteModel.h	Thu Jun 12 10:47:11 2008 +0000
@@ -88,6 +88,8 @@
 
 class NoteModel : public SparseValueModel<Note>
 {
+    Q_OBJECT
+    
 public:
     NoteModel(size_t sampleRate, size_t resolution,
 	      bool notifyOnAdd = true) :
--- a/data/model/SparseOneDimensionalModel.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/data/model/SparseOneDimensionalModel.h	Thu Jun 12 10:47:11 2008 +0000
@@ -70,6 +70,8 @@
 
 class SparseOneDimensionalModel : public SparseModel<OneDimensionalPoint>
 {
+    Q_OBJECT
+    
 public:
     SparseOneDimensionalModel(size_t sampleRate, size_t resolution,
 			      bool notifyOnAdd = true) :
--- a/data/model/SparseTimeValueModel.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/data/model/SparseTimeValueModel.h	Thu Jun 12 10:47:11 2008 +0000
@@ -77,6 +77,8 @@
 
 class SparseTimeValueModel : public SparseValueModel<TimeValuePoint>
 {
+    Q_OBJECT
+    
 public:
     SparseTimeValueModel(size_t sampleRate, size_t resolution,
 			 bool notifyOnAdd = true) :
@@ -143,8 +145,6 @@
 
     virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) const
     {
-        std::cerr << "SparseTimeValueModel::setData: row = " << row << ", column = " << column << ", role = " << role << std::endl;
-
         if (role != Qt::EditRole) return false;
         PointListIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) {
@@ -159,9 +159,7 @@
         switch (column) {
         case 0: break; 
         case 1: break;
-        case 2: point.value = value.toDouble();
-            std::cerr << "setting value of point at " << point.frame << " to " << point.value << std::endl;
-            break;
+        case 2: point.value = value.toDouble(); break;
         case 3: point.label = value.toString(); break;
         }
 
--- a/data/model/TextModel.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/data/model/TextModel.h	Thu Jun 12 10:47:11 2008 +0000
@@ -20,6 +20,8 @@
 #include "base/XmlExportable.h"
 #include "base/RealTime.h"
 
+#include <QStringList>
+
 /**
  * Text point type for use in a SparseModel.  This represents a piece
  * of text at a given time and y-value in the [0,1) range (indicative
@@ -80,6 +82,8 @@
 
 class TextModel : public SparseModel<TextPoint>
 {
+    Q_OBJECT
+    
 public:
     TextModel(size_t sampleRate, size_t resolution, bool notifyOnAdd = true) :
 	SparseModel<TextPoint>(sampleRate, resolution, notifyOnAdd)