Mercurial > hg > svapp
comparison 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 |
comparison
equal
deleted
inserted
replaced
773:699b5b130ea2 | 776:32e66fcc4cb7 |
---|---|
20 #include <QProcess> | 20 #include <QProcess> |
21 #include <QMutex> | 21 #include <QMutex> |
22 #include <set> | 22 #include <set> |
23 | 23 |
24 #include "Aligner.h" | 24 #include "Aligner.h" |
25 | |
26 #include "transform/Transform.h" | |
25 | 27 |
26 class AlignmentModel; | 28 class AlignmentModel; |
27 class Document; | 29 class Document; |
28 | 30 |
29 class Align : public QObject | 31 class Align : public QObject |
44 ExternalProgramAlignment, | 46 ExternalProgramAlignment, |
45 | 47 |
46 LastAlignmentType = ExternalProgramAlignment | 48 LastAlignmentType = ExternalProgramAlignment |
47 }; | 49 }; |
48 | 50 |
51 /** | |
52 * Convert an alignment type to a stable machine-readable string. | |
53 */ | |
49 static QString getAlignmentTypeTag(AlignmentType type); | 54 static QString getAlignmentTypeTag(AlignmentType type); |
55 | |
56 /** | |
57 * Convert an alignment type back from a stable machine-readable | |
58 * string. | |
59 */ | |
50 static AlignmentType getAlignmentTypeForTag(QString tag); | 60 static AlignmentType getAlignmentTypeForTag(QString tag); |
51 | 61 |
52 static AlignmentType getAlignmentPreference(QString &additionalData); | 62 /** |
53 static void setAlignmentPreference(AlignmentType type, | 63 * Get the currently set alignment preference from the global |
54 QString additionalData = ""); | 64 * application settings. If the returned preference is |
65 * TransformDrivenDTWAlignment or ExternalProgramAlignment, then | |
66 * it will also be necessary to query | |
67 * getPreferredAlignmentTransform() or | |
68 * getPreferredAlignmentProgram() respectively in order to get the | |
69 * information needed to perform an alignment. | |
70 */ | |
71 static AlignmentType getAlignmentPreference(); | |
72 | |
73 /** | |
74 * Set the alignment preference to the global application | |
75 * settings. If the preference is TransformDrivenDTWAlignment or | |
76 * ExternalProgramAlignment, you may also wish to call | |
77 * setPreferredAlignmentTransform() or | |
78 * setPreferredAlignmentProgram() respectively. | |
79 */ | |
80 static void setAlignmentPreference(AlignmentType type); | |
81 | |
82 /** | |
83 * Get the external program associated with the | |
84 * ExternalProgramAlignment type, if any is set (an empty string | |
85 * otherwise). Note that this will return a value if any has ever | |
86 * been set, regardless of whether ExternalProgramAlignment is the | |
87 * currently chosen alignment type or not. | |
88 */ | |
89 static QString getPreferredAlignmentProgram(); | |
90 | |
91 /** | |
92 * Set the external program associated with the | |
93 * ExternalProgramAlignment type. It is not necessary for the | |
94 * current preferred alignment type actually to be | |
95 * ExternalProgramAlignment in order to change this setting. No | |
96 * validation is carried out on the argument - we don't verify | |
97 * that it actually is the path of a program, or anything else. | |
98 */ | |
99 static void setPreferredAlignmentProgram(QString program); | |
100 | |
101 /** | |
102 * Get the transform associated with the | |
103 * TransformDrivenDTWAlignment type, if any is set (a default | |
104 * constructed Transform otherwise). Note that this will return a | |
105 * value if any has ever been set, regardless of whether | |
106 * TransformDrivenDTWAlignment is the currently chosen alignment | |
107 * type or not. | |
108 */ | |
109 static Transform getPreferredAlignmentTransform(); | |
110 | |
111 /** | |
112 * Set the transform associated with the | |
113 * TransformDrivenDTWAlignment type. It is not necessary for the | |
114 * current preferred alignment type actually to be | |
115 * TransformDrivenDTWAlignment in order to change this setting. | |
116 */ | |
117 static void setPreferredAlignmentTransform(Transform transform); | |
55 | 118 |
56 /** | 119 /** |
57 * Align the "other" model to the reference, attaching an | 120 * Align the "other" model to the reference, attaching an |
58 * AlignmentModel to it. Alignment is carried out by the method | 121 * AlignmentModel to it. Alignment is carried out by the method |
59 * configured in the user preferences (either a plugin transform | 122 * configured in the user preferences (see |
60 * or an external process) and is done asynchronously. | 123 * getAlignmentPreference() etc) and is done asynchronously. |
61 * | 124 * |
62 * Any errors are reported by firing the alignmentFailed | 125 * Any errors are reported by firing the alignmentFailed |
63 * signal. Note that the signal may be fired during the call to | 126 * signal. Note that the signal may be fired during the call to |
64 * this function, if the aligner fails to start at all. | 127 * this function, if the aligner fails to start at all. |
65 * | 128 * |
97 void scheduleAlignment(Document *doc, | 160 void scheduleAlignment(Document *doc, |
98 ModelId reference, | 161 ModelId reference, |
99 ModelId toAlign); | 162 ModelId toAlign); |
100 | 163 |
101 /** | 164 /** |
102 * Return true if the alignment facility is available (relevant | 165 * Return true if the preferred alignment facility is available |
103 * plugin installed, etc). | 166 * (relevant plugin installed, etc). |
104 */ | 167 */ |
105 static bool canAlign(); | 168 static bool canAlign(); |
106 | |
107 //!!! + check whether specific alignment types are available | |
108 | 169 |
109 signals: | 170 signals: |
110 /** | 171 /** |
111 * Emitted when an alignment is successfully completed. The | 172 * Emitted when an alignment is successfully completed. The |
112 * reference and other models can be queried from the alignment | 173 * reference and other models can be queried from the alignment |