changeset 397:2c59b0cd176b

* Update translations, and add change counter to name of bundle command
author Chris Cannam
date Thu, 12 Jun 2008 10:47:11 +0000
parents 2669267fb7ea
children 80e279e4f9fe
files layer/SingleColourLayer.h widgets/CommandHistory.cpp widgets/MIDIFileImportDialog.h widgets/ModelDataTableDialog.cpp widgets/PropertyStack.cpp
diffstat 5 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SingleColourLayer.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/layer/SingleColourLayer.h	Thu Jun 12 10:47:11 2008 +0000
@@ -23,6 +23,8 @@
 
 class SingleColourLayer : public Layer
 {
+    Q_OBJECT
+    
 public:
     virtual void setBaseColour(int);
     virtual int getBaseColour() const;
--- a/widgets/CommandHistory.cpp	Thu Jun 12 09:03:00 2008 +0000
+++ b/widgets/CommandHistory.cpp	Thu Jun 12 10:47:11 2008 +0000
@@ -35,7 +35,7 @@
 
 #include <iostream>
 
-//#define DEBUG_COMMAND_HISTORY 1
+#define DEBUG_COMMAND_HISTORY 1
 
 CommandHistory *CommandHistory::m_instance = 0;
 
@@ -139,6 +139,10 @@
 {
     if (!command) return;
 
+#ifdef DEBUG_COMMAND_HISTORY
+    std::cerr << "CommandHistory::addCommand: " << command->getName().toLocal8Bit().data() << " at " << command << ": execute = " << execute << ", bundle = " << bundle << " (m_currentCompound = " << m_currentCompound << ", m_currentBundle = " << m_currentBundle << ")" << std::endl;
+#endif
+
     if (m_currentCompound) {
 	addToCompound(command, execute);
 	return;
@@ -152,7 +156,6 @@
     }
 
 #ifdef DEBUG_COMMAND_HISTORY
-    std::cerr << "CommandHistory::addCommand: " << command->getName().toLocal8Bit().data() << " at " << command << std::endl;
     if (!m_redoStack.empty()) {
         std::cerr << "CommandHistory::clearing redo stack" << std::endl;
     }
@@ -205,7 +208,7 @@
 
 	// need to addCommand before setting m_currentBundle, as addCommand
 	// with bundle false will reset m_currentBundle to 0
-	MacroCommand *mc = new MacroCommand(command->getName());
+	MacroCommand *mc = new BundleCommand(command->getName());
 	addCommand(mc, false);
 	m_currentBundle = mc;
 	m_currentBundleName = command->getName();
--- a/widgets/MIDIFileImportDialog.h	Thu Jun 12 09:03:00 2008 +0000
+++ b/widgets/MIDIFileImportDialog.h	Thu Jun 12 10:47:11 2008 +0000
@@ -22,6 +22,8 @@
 class MIDIFileImportDialog : public QObject,
                              public MIDIFileImportPreferenceAcquirer
 {
+    Q_OBJECT
+
 public:
     MIDIFileImportDialog(QWidget *parent = 0);
 
--- a/widgets/ModelDataTableDialog.cpp	Thu Jun 12 09:03:00 2008 +0000
+++ b/widgets/ModelDataTableDialog.cpp	Thu Jun 12 10:47:11 2008 +0000
@@ -70,6 +70,8 @@
             this, SLOT(viewClicked(const QModelIndex &)));
     connect(m_tableView, SIGNAL(pressed(const QModelIndex &)),
             this, SLOT(viewPressed(const QModelIndex &)));
+    connect(m_table, SIGNAL(executeCommand(Command *)),
+            this, SLOT(executeCommand(Command *)));
 
     QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Close);
     connect(bb, SIGNAL(rejected()), this, SLOT(close()));
@@ -118,6 +120,7 @@
 void
 ModelDataTableDialog::executeCommand(Command *command)
 {
-    CommandHistory::getInstance()->addCommand(command, true, true);
+    std::cerr << "ModelDataTableDialog::executeCommand(" << command << ")" << std::endl;
+    CommandHistory::getInstance()->addCommand(command, false, true);
 }
 
--- a/widgets/PropertyStack.cpp	Thu Jun 12 09:03:00 2008 +0000
+++ b/widgets/PropertyStack.cpp	Thu Jun 12 10:47:11 2008 +0000
@@ -203,8 +203,8 @@
 class ShowLayerCommand : public QObject, public Command
 {
 public:
-    ShowLayerCommand(View *view, Layer *layer, bool show) :
-        m_view(view), m_layer(layer), m_show(show) { }
+    ShowLayerCommand(View *view, Layer *layer, bool show, QString name) :
+        m_view(view), m_layer(layer), m_show(show), m_name(name) { }
     void execute() {
         m_layer->showLayer(m_view, m_show);
     }
@@ -212,12 +212,13 @@
         m_layer->showLayer(m_view, !m_show);
     }
     QString getName() const {
-        return tr("Change Layer Visibility");
+        return m_name;
     }
 protected:
     View *m_view;
     Layer *m_layer;
     bool m_show;
+    QString m_name;
 };
 
 void
@@ -230,7 +231,8 @@
 	    Layer *layer = dynamic_cast<Layer *>(m_boxes[i]->getContainer());
 	    if (layer) {
                 CommandHistory::getInstance()->addCommand
-                    (new ShowLayerCommand(m_client, layer, show));
+                    (new ShowLayerCommand(m_client, layer, show,
+                                          tr("Change Layer Visibility")));
 		return;
 	    }
 	}