diff align/Align.h @ 776:32e66fcc4cb7 pitch-align

Make querying and setting the external alignment program or transform separate from selecting the alignment type - we need it to work that way for a clearer UI
author Chris Cannam
date Thu, 25 Jun 2020 09:32:01 +0100
parents 1d6cca5a5621
children b651dc5ff555
line wrap: on
line diff
--- a/align/Align.h	Mon Jun 01 17:13:09 2020 +0100
+++ b/align/Align.h	Thu Jun 25 09:32:01 2020 +0100
@@ -23,6 +23,8 @@
 
 #include "Aligner.h"
 
+#include "transform/Transform.h"
+
 class AlignmentModel;
 class Document;
 
@@ -46,18 +48,79 @@
         LastAlignmentType = ExternalProgramAlignment
     };
 
+    /**
+     * Convert an alignment type to a stable machine-readable string.
+     */
     static QString getAlignmentTypeTag(AlignmentType type);
+
+    /**
+     * Convert an alignment type back from a stable machine-readable
+     * string.
+     */
     static AlignmentType getAlignmentTypeForTag(QString tag);
 
-    static AlignmentType getAlignmentPreference(QString &additionalData);
-    static void setAlignmentPreference(AlignmentType type,
-                                       QString additionalData = "");
+    /**
+     * Get the currently set alignment preference from the global
+     * application settings. If the returned preference is
+     * TransformDrivenDTWAlignment or ExternalProgramAlignment, then
+     * it will also be necessary to query
+     * getPreferredAlignmentTransform() or
+     * getPreferredAlignmentProgram() respectively in order to get the
+     * information needed to perform an alignment.
+     */
+    static AlignmentType getAlignmentPreference();
+    
+    /**
+     * Set the alignment preference to the global application
+     * settings. If the preference is TransformDrivenDTWAlignment or
+     * ExternalProgramAlignment, you may also wish to call
+     * setPreferredAlignmentTransform() or
+     * setPreferredAlignmentProgram() respectively.
+     */
+    static void setAlignmentPreference(AlignmentType type);
+
+    /**
+     * Get the external program associated with the
+     * ExternalProgramAlignment type, if any is set (an empty string
+     * otherwise). Note that this will return a value if any has ever
+     * been set, regardless of whether ExternalProgramAlignment is the
+     * currently chosen alignment type or not.
+     */
+    static QString getPreferredAlignmentProgram();
+
+    /**
+     * Set the external program associated with the
+     * ExternalProgramAlignment type. It is not necessary for the
+     * current preferred alignment type actually to be
+     * ExternalProgramAlignment in order to change this setting.  No
+     * validation is carried out on the argument - we don't verify
+     * that it actually is the path of a program, or anything else.
+     */
+    static void setPreferredAlignmentProgram(QString program);
+    
+    /**
+     * Get the transform associated with the
+     * TransformDrivenDTWAlignment type, if any is set (a default
+     * constructed Transform otherwise). Note that this will return a
+     * value if any has ever been set, regardless of whether
+     * TransformDrivenDTWAlignment is the currently chosen alignment
+     * type or not.
+     */
+    static Transform getPreferredAlignmentTransform();
+
+    /**
+     * Set the transform associated with the
+     * TransformDrivenDTWAlignment type. It is not necessary for the
+     * current preferred alignment type actually to be
+     * TransformDrivenDTWAlignment in order to change this setting.
+     */ 
+    static void setPreferredAlignmentTransform(Transform transform);
     
     /**
      * Align the "other" model to the reference, attaching an
      * AlignmentModel to it. Alignment is carried out by the method
-     * configured in the user preferences (either a plugin transform
-     * or an external process) and is done asynchronously. 
+     * configured in the user preferences (see
+     * getAlignmentPreference() etc) and is done asynchronously.
      *
      * Any errors are reported by firing the alignmentFailed
      * signal. Note that the signal may be fired during the call to
@@ -99,13 +162,11 @@
                            ModelId toAlign);
     
     /**
-     * Return true if the alignment facility is available (relevant
-     * plugin installed, etc).
+     * Return true if the preferred alignment facility is available
+     * (relevant plugin installed, etc).
      */
     static bool canAlign();
 
-    //!!! + check whether specific alignment types are available
-
 signals:
     /**
      * Emitted when an alignment is successfully completed. The