Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 Tony
|
Chris@0
|
5 An intonation analysis and annotation tool
|
Chris@0
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@0
|
7 This file copyright 2006-2012 Chris Cannam and QMUL.
|
Chris@0
|
8
|
Chris@0
|
9 This program is free software; you can redistribute it and/or
|
Chris@0
|
10 modify it under the terms of the GNU General Public License as
|
Chris@0
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@0
|
12 License, or (at your option) any later version. See the file
|
Chris@0
|
13 COPYING included with this distribution for more information.
|
Chris@0
|
14 */
|
Chris@0
|
15
|
Chris@0
|
16 #include "../version.h"
|
Chris@0
|
17
|
Chris@0
|
18 #include "MainWindow.h"
|
Chris@95
|
19 #include "NetworkPermissionTester.h"
|
Chris@6
|
20 #include "Analyser.h"
|
Chris@6
|
21
|
Chris@0
|
22 #include "framework/Document.h"
|
Chris@95
|
23 #include "framework/VersionTester.h"
|
Chris@0
|
24
|
Chris@0
|
25 #include "view/Pane.h"
|
Chris@0
|
26 #include "view/PaneStack.h"
|
Chris@0
|
27 #include "data/model/WaveFileModel.h"
|
matthiasm@26
|
28 #include "data/model/NoteModel.h"
|
matthiasm@26
|
29 #include "data/model/FlexiNoteModel.h"
|
matthiasm@42
|
30 #include "layer/FlexiNoteLayer.h"
|
matthiasm@26
|
31 #include "data/model/NoteModel.h"
|
Chris@0
|
32 #include "view/ViewManager.h"
|
Chris@0
|
33 #include "base/Preferences.h"
|
Chris@0
|
34 #include "layer/WaveformLayer.h"
|
Chris@0
|
35 #include "layer/TimeInstantLayer.h"
|
Chris@0
|
36 #include "layer/TimeValueLayer.h"
|
Chris@0
|
37 #include "widgets/Fader.h"
|
Chris@0
|
38 #include "view/Overview.h"
|
Chris@0
|
39 #include "widgets/AudioDial.h"
|
Chris@0
|
40 #include "widgets/IconLoader.h"
|
Chris@0
|
41 #include "widgets/KeyReference.h"
|
Chris@0
|
42 #include "audioio/AudioCallbackPlaySource.h"
|
Chris@0
|
43 #include "audioio/AudioCallbackPlayTarget.h"
|
Chris@0
|
44 #include "audioio/PlaySpeedRangeMapper.h"
|
Chris@0
|
45 #include "base/Profiler.h"
|
Chris@0
|
46 #include "base/UnitDatabase.h"
|
Chris@0
|
47 #include "layer/ColourDatabase.h"
|
Chris@139
|
48 #include "base/Selection.h"
|
Chris@0
|
49
|
matthiasm@26
|
50 #include "data/fileio/CSVFileWriter.h"
|
matthiasm@26
|
51 #include "data/fileio/MIDIFileWriter.h"
|
matthiasm@26
|
52 #include "rdf/RDFExporter.h"
|
matthiasm@26
|
53
|
Chris@0
|
54 // For version information
|
Chris@0
|
55 #include "vamp/vamp.h"
|
Chris@0
|
56 #include "vamp-sdk/PluginBase.h"
|
Chris@0
|
57 #include "plugin/api/ladspa.h"
|
Chris@0
|
58 #include "plugin/api/dssi.h"
|
Chris@0
|
59
|
Chris@0
|
60 #include <QApplication>
|
Chris@0
|
61 #include <QMessageBox>
|
Chris@0
|
62 #include <QGridLayout>
|
Chris@0
|
63 #include <QLabel>
|
Chris@0
|
64 #include <QMenuBar>
|
Chris@0
|
65 #include <QToolBar>
|
Chris@0
|
66 #include <QToolButton>
|
Chris@0
|
67 #include <QInputDialog>
|
Chris@0
|
68 #include <QStatusBar>
|
Chris@0
|
69 #include <QFileInfo>
|
Chris@0
|
70 #include <QDir>
|
Chris@0
|
71 #include <QProcess>
|
Chris@2
|
72 #include <QPushButton>
|
Chris@0
|
73 #include <QSettings>
|
Chris@0
|
74 #include <QScrollArea>
|
Chris@128
|
75 #include <QPainter>
|
Chris@0
|
76
|
Chris@0
|
77 #include <iostream>
|
Chris@0
|
78 #include <cstdio>
|
Chris@0
|
79 #include <errno.h>
|
Chris@0
|
80
|
Chris@0
|
81 using std::vector;
|
Chris@0
|
82
|
Chris@0
|
83
|
Chris@0
|
84 MainWindow::MainWindow(bool withAudioOutput, bool withOSCSupport) :
|
Chris@0
|
85 MainWindowBase(withAudioOutput, withOSCSupport, false),
|
Chris@0
|
86 m_overview(0),
|
Chris@0
|
87 m_mainMenusCreated(false),
|
Chris@0
|
88 m_playbackMenu(0),
|
gyorgyf@45
|
89 m_recentFilesMenu(0),
|
Chris@0
|
90 m_rightButtonMenu(0),
|
Chris@0
|
91 m_rightButtonPlaybackMenu(0),
|
Chris@0
|
92 m_deleteSelectedAction(0),
|
Chris@0
|
93 m_ffwdAction(0),
|
Chris@0
|
94 m_rwdAction(0),
|
Chris@168
|
95 m_intelligentActionOn(true), //GF: !!! temporary
|
Chris@0
|
96 m_keyReference(new KeyReference())
|
Chris@0
|
97 {
|
Chris@0
|
98 setWindowTitle(QApplication::applicationName());
|
Chris@0
|
99
|
Chris@0
|
100 UnitDatabase *udb = UnitDatabase::getInstance();
|
Chris@0
|
101 udb->registerUnit("Hz");
|
Chris@0
|
102 udb->registerUnit("dB");
|
Chris@0
|
103 udb->registerUnit("s");
|
Chris@0
|
104
|
Chris@0
|
105 ColourDatabase *cdb = ColourDatabase::getInstance();
|
Chris@0
|
106 cdb->addColour(Qt::black, tr("Black"));
|
Chris@0
|
107 cdb->addColour(Qt::darkRed, tr("Red"));
|
Chris@0
|
108 cdb->addColour(Qt::darkBlue, tr("Blue"));
|
Chris@0
|
109 cdb->addColour(Qt::darkGreen, tr("Green"));
|
Chris@0
|
110 cdb->addColour(QColor(200, 50, 255), tr("Purple"));
|
Chris@0
|
111 cdb->addColour(QColor(255, 150, 50), tr("Orange"));
|
Chris@120
|
112 cdb->addColour(QColor(180, 180, 180), tr("Grey"));
|
Chris@0
|
113 cdb->setUseDarkBackground(cdb->addColour(Qt::white, tr("White")), true);
|
Chris@0
|
114 cdb->setUseDarkBackground(cdb->addColour(Qt::red, tr("Bright Red")), true);
|
Chris@0
|
115 cdb->setUseDarkBackground(cdb->addColour(QColor(30, 150, 255), tr("Bright Blue")), true);
|
Chris@0
|
116 cdb->setUseDarkBackground(cdb->addColour(Qt::green, tr("Bright Green")), true);
|
Chris@0
|
117 cdb->setUseDarkBackground(cdb->addColour(QColor(225, 74, 255), tr("Bright Purple")), true);
|
Chris@0
|
118 cdb->setUseDarkBackground(cdb->addColour(QColor(255, 188, 80), tr("Bright Orange")), true);
|
Chris@0
|
119
|
Chris@0
|
120 Preferences::getInstance()->setResampleOnLoad(true);
|
Chris@0
|
121 Preferences::getInstance()->setSpectrogramSmoothing
|
Chris@0
|
122 (Preferences::SpectrogramInterpolated);
|
Chris@0
|
123
|
Chris@0
|
124 QSettings settings;
|
Chris@0
|
125
|
Chris@0
|
126 settings.beginGroup("MainWindow");
|
Chris@0
|
127 settings.setValue("showstatusbar", false);
|
Chris@0
|
128 settings.endGroup();
|
Chris@0
|
129
|
Chris@96
|
130 settings.beginGroup("Transformer");
|
Chris@96
|
131 settings.setValue("use-flexi-note-model", true);
|
Chris@96
|
132 settings.endGroup();
|
Chris@96
|
133
|
Chris@73
|
134 settings.beginGroup("LayerDefaults");
|
Chris@73
|
135 settings.setValue("waveform",
|
Chris@73
|
136 QString("<layer scale=\"%1\" channelMode=\"%2\"/>")
|
Chris@73
|
137 .arg(int(WaveformLayer::LinearScale))
|
Chris@73
|
138 .arg(int(WaveformLayer::MixChannels)));
|
Chris@73
|
139 settings.endGroup();
|
Chris@73
|
140
|
Chris@6
|
141 m_viewManager->setAlignMode(false);
|
Chris@6
|
142 m_viewManager->setPlaySoloMode(false);
|
Chris@0
|
143 m_viewManager->setToolMode(ViewManager::NavigateMode);
|
Chris@0
|
144 m_viewManager->setZoomWheelsEnabled(false);
|
Chris@6
|
145 m_viewManager->setIlluminateLocalFeatures(true);
|
Chris@0
|
146 m_viewManager->setShowWorkTitle(true);
|
Chris@6
|
147 m_viewManager->setShowCentreLine(false);
|
Chris@91
|
148 m_viewManager->setOverlayMode(ViewManager::MinimalOverlays);
|
Chris@0
|
149
|
Chris@164
|
150 connect(m_viewManager, SIGNAL(selectionChanged()),
|
Chris@164
|
151 this, SLOT(selectionChanged()));
|
Chris@164
|
152
|
Chris@0
|
153 QFrame *frame = new QFrame;
|
Chris@0
|
154 setCentralWidget(frame);
|
Chris@0
|
155
|
Chris@0
|
156 QGridLayout *layout = new QGridLayout;
|
Chris@0
|
157
|
Chris@0
|
158 QScrollArea *scroll = new QScrollArea(frame);
|
Chris@0
|
159 scroll->setWidgetResizable(true);
|
Chris@0
|
160 scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
Chris@0
|
161 scroll->setFrameShape(QFrame::NoFrame);
|
Chris@0
|
162
|
Chris@6
|
163 // We have a pane stack: it comes with the territory. However, we
|
Chris@120
|
164 // have a fixed and known number of panes in it -- it isn't
|
Chris@120
|
165 // variable
|
Chris@0
|
166 m_paneStack->setLayoutStyle(PaneStack::NoPropertyStacks);
|
Chris@137
|
167 m_paneStack->setShowPaneAccessories(false);
|
Chris@139
|
168 connect(m_paneStack, SIGNAL(doubleClickSelectInvoked(size_t)),
|
Chris@139
|
169 this, SLOT(doubleClickSelectInvoked(size_t)));
|
Chris@0
|
170 scroll->setWidget(m_paneStack);
|
Chris@6
|
171
|
Chris@0
|
172 m_overview = new Overview(frame);
|
Chris@0
|
173 m_overview->setViewManager(m_viewManager);
|
Chris@0
|
174 m_overview->setFixedHeight(40);
|
Chris@0
|
175 #ifndef _WIN32
|
Chris@0
|
176 // For some reason, the contents of the overview never appear if we
|
Chris@0
|
177 // make this setting on Windows. I have no inclination at the moment
|
Chris@0
|
178 // to track down the reason why.
|
Chris@0
|
179 m_overview->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
|
Chris@0
|
180 #endif
|
Chris@0
|
181 connect(m_overview, SIGNAL(contextHelpChanged(const QString &)),
|
Chris@0
|
182 this, SLOT(contextHelpChanged(const QString &)));
|
Chris@0
|
183
|
Chris@0
|
184 m_panLayer = new WaveformLayer;
|
Chris@0
|
185 m_panLayer->setChannelMode(WaveformLayer::MergeChannels);
|
Chris@0
|
186 m_panLayer->setAggressiveCacheing(true);
|
Chris@0
|
187 m_overview->addLayer(m_panLayer);
|
Chris@0
|
188
|
Chris@0
|
189 if (m_viewManager->getGlobalDarkBackground()) {
|
Chris@0
|
190 m_panLayer->setBaseColour
|
Chris@0
|
191 (ColourDatabase::getInstance()->getColourIndex(tr("Bright Green")));
|
Chris@0
|
192 } else {
|
Chris@0
|
193 m_panLayer->setBaseColour
|
matthiasm@13
|
194 (ColourDatabase::getInstance()->getColourIndex(tr("Blue")));
|
Chris@0
|
195 }
|
Chris@0
|
196
|
Chris@0
|
197 m_fader = new Fader(frame, false);
|
Chris@0
|
198 connect(m_fader, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
Chris@0
|
199 connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
Chris@0
|
200
|
Chris@0
|
201 m_playSpeed = new AudioDial(frame);
|
Chris@0
|
202 m_playSpeed->setMinimum(0);
|
Chris@0
|
203 m_playSpeed->setMaximum(200);
|
Chris@0
|
204 m_playSpeed->setValue(100);
|
Chris@0
|
205 m_playSpeed->setFixedWidth(24);
|
Chris@0
|
206 m_playSpeed->setFixedHeight(24);
|
Chris@0
|
207 m_playSpeed->setNotchesVisible(true);
|
Chris@0
|
208 m_playSpeed->setPageStep(10);
|
Chris@0
|
209 m_playSpeed->setObjectName(tr("Playback Speedup"));
|
Chris@0
|
210 m_playSpeed->setDefaultValue(100);
|
Chris@0
|
211 m_playSpeed->setRangeMapper(new PlaySpeedRangeMapper(0, 200));
|
Chris@0
|
212 m_playSpeed->setShowToolTip(true);
|
Chris@0
|
213 connect(m_playSpeed, SIGNAL(valueChanged(int)),
|
gyorgyf@27
|
214 this, SLOT(playSpeedChanged(int)));
|
Chris@0
|
215 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
Chris@0
|
216 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
Chris@0
|
217
|
justin@159
|
218 // Gain controls
|
justin@159
|
219 m_gainAudio = new AudioDial(frame);
|
justin@159
|
220 m_gainAudio->setMinimum(-50);
|
justin@159
|
221 m_gainAudio->setMaximum(50);
|
justin@159
|
222 m_gainAudio->setValue(0);
|
justin@159
|
223 m_gainAudio->setDefaultValue(0);
|
justin@159
|
224 m_gainAudio->setFixedWidth(24);
|
justin@159
|
225 m_gainAudio->setFixedHeight(24);
|
justin@159
|
226 m_gainAudio->setNotchesVisible(true);
|
justin@159
|
227 m_gainAudio->setPageStep(10);
|
justin@159
|
228 m_gainAudio->setObjectName(tr("Audio Track Gain"));
|
justin@159
|
229 m_gainAudio->setRangeMapper(new LinearRangeMapper(-50, 50, -25, 25, tr("dB")));
|
justin@159
|
230 m_gainAudio->setShowToolTip(true);
|
justin@159
|
231 connect(m_gainAudio, SIGNAL(valueChanged(int)),
|
justin@159
|
232 this, SLOT(audioGainChanged(int)));
|
justin@159
|
233 connect(m_gainAudio, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
justin@159
|
234 connect(m_gainAudio, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
justin@159
|
235
|
justin@157
|
236 m_gainPitch = new AudioDial(frame);
|
Chris@158
|
237 m_gainPitch->setMinimum(-50);
|
Chris@158
|
238 m_gainPitch->setMaximum(50);
|
Chris@158
|
239 m_gainPitch->setValue(0);
|
Chris@158
|
240 m_gainPitch->setDefaultValue(0);
|
justin@157
|
241 m_gainPitch->setFixedWidth(24);
|
justin@157
|
242 m_gainPitch->setFixedHeight(24);
|
justin@157
|
243 m_gainPitch->setNotchesVisible(true);
|
justin@157
|
244 m_gainPitch->setPageStep(10);
|
Chris@158
|
245 m_gainPitch->setObjectName(tr("Pitch Track Gain"));
|
Chris@158
|
246 m_gainPitch->setRangeMapper(new LinearRangeMapper(-50, 50, -25, 25, tr("dB")));
|
justin@157
|
247 m_gainPitch->setShowToolTip(true);
|
justin@157
|
248 connect(m_gainPitch, SIGNAL(valueChanged(int)),
|
Chris@158
|
249 this, SLOT(pitchGainChanged(int)));
|
justin@157
|
250 connect(m_gainPitch, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
justin@157
|
251 connect(m_gainPitch, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
justin@157
|
252
|
justin@159
|
253 m_gainNotes = new AudioDial(frame);
|
justin@159
|
254 m_gainNotes->setMinimum(-50);
|
justin@159
|
255 m_gainNotes->setMaximum(50);
|
justin@159
|
256 m_gainNotes->setValue(0);
|
justin@159
|
257 m_gainNotes->setDefaultValue(0);
|
justin@159
|
258 m_gainNotes->setFixedWidth(24);
|
justin@159
|
259 m_gainNotes->setFixedHeight(24);
|
justin@159
|
260 m_gainNotes->setNotchesVisible(true);
|
justin@159
|
261 m_gainNotes->setPageStep(10);
|
justin@159
|
262 m_gainNotes->setObjectName(tr("Pitch Track Gain"));
|
justin@159
|
263 m_gainNotes->setRangeMapper(new LinearRangeMapper(-50, 50, -25, 25, tr("dB")));
|
justin@159
|
264 m_gainNotes->setShowToolTip(true);
|
justin@159
|
265 connect(m_gainNotes, SIGNAL(valueChanged(int)),
|
justin@159
|
266 this, SLOT(notesGainChanged(int)));
|
justin@159
|
267 connect(m_gainNotes, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
justin@159
|
268 connect(m_gainNotes, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
justin@159
|
269 // End of Gain controls
|
justin@159
|
270
|
justin@160
|
271 // Pan controls
|
justin@160
|
272 m_panAudio = new AudioDial(frame);
|
justin@160
|
273 m_panAudio->setMinimum(-100);
|
justin@160
|
274 m_panAudio->setMaximum(100);
|
justin@160
|
275 m_panAudio->setValue(-100);
|
justin@160
|
276 m_panAudio->setDefaultValue(-100);
|
justin@160
|
277 m_panAudio->setFixedWidth(24);
|
justin@160
|
278 m_panAudio->setFixedHeight(24);
|
justin@160
|
279 m_panAudio->setNotchesVisible(true);
|
justin@160
|
280 m_panAudio->setPageStep(10);
|
justin@160
|
281 m_panAudio->setObjectName(tr("Audio Track Pan"));
|
justin@160
|
282 m_panAudio->setRangeMapper(new LinearRangeMapper(-100, 100, -100, 100, tr("")));
|
justin@160
|
283 m_panAudio->setShowToolTip(true);
|
justin@160
|
284 connect(m_panAudio, SIGNAL(valueChanged(int)),
|
justin@160
|
285 this, SLOT(audioPanChanged(int)));
|
justin@160
|
286 connect(m_panAudio, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
justin@160
|
287 connect(m_panAudio, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
justin@160
|
288
|
justin@160
|
289 m_panPitch = new AudioDial(frame);
|
justin@160
|
290 m_panPitch->setMinimum(-100);
|
justin@160
|
291 m_panPitch->setMaximum(100);
|
justin@160
|
292 m_panPitch->setValue(100);
|
justin@160
|
293 m_panPitch->setDefaultValue(100);
|
justin@160
|
294 m_panPitch->setFixedWidth(24);
|
justin@160
|
295 m_panPitch->setFixedHeight(24);
|
justin@160
|
296 m_panPitch->setNotchesVisible(true);
|
justin@160
|
297 m_panPitch->setPageStep(10);
|
justin@160
|
298 m_panPitch->setObjectName(tr("Pitch Track Pan"));
|
justin@160
|
299 m_panPitch->setRangeMapper(new LinearRangeMapper(-100, 100, -100, 100, tr("")));
|
justin@160
|
300 m_panPitch->setShowToolTip(true);
|
justin@160
|
301 connect(m_panPitch, SIGNAL(valueChanged(int)),
|
justin@160
|
302 this, SLOT(pitchPanChanged(int)));
|
justin@160
|
303 connect(m_panPitch, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
justin@160
|
304 connect(m_panPitch, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
justin@160
|
305
|
justin@160
|
306 m_panNotes = new AudioDial(frame);
|
justin@160
|
307 m_panNotes->setMinimum(-100);
|
justin@160
|
308 m_panNotes->setMaximum(100);
|
justin@160
|
309 m_panNotes->setValue(100);
|
justin@160
|
310 m_panNotes->setDefaultValue(100);
|
justin@160
|
311 m_panNotes->setFixedWidth(24);
|
justin@160
|
312 m_panNotes->setFixedHeight(24);
|
justin@160
|
313 m_panNotes->setNotchesVisible(true);
|
justin@160
|
314 m_panNotes->setPageStep(10);
|
justin@160
|
315 m_panNotes->setObjectName(tr("Notes Track Pan"));
|
justin@160
|
316 m_panNotes->setRangeMapper(new LinearRangeMapper(-100, 100, -100, 100, tr("")));
|
justin@160
|
317 m_panNotes->setShowToolTip(true);
|
justin@160
|
318 connect(m_panNotes, SIGNAL(valueChanged(int)),
|
justin@160
|
319 this, SLOT(notesPanChanged(int)));
|
justin@160
|
320 connect(m_panNotes, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
justin@160
|
321 connect(m_panNotes, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
justin@160
|
322 // End of Pan controls
|
justin@160
|
323
|
Chris@0
|
324 layout->setSpacing(4);
|
Chris@6
|
325 layout->addWidget(m_overview, 0, 1);
|
Chris@6
|
326 layout->addWidget(scroll, 1, 1);
|
Chris@0
|
327
|
Chris@0
|
328 layout->setColumnStretch(1, 10);
|
Chris@0
|
329
|
Chris@0
|
330 frame->setLayout(layout);
|
Chris@0
|
331
|
gyorgyf@21
|
332 m_analyser = new Analyser();
|
Chris@128
|
333 connect(m_analyser, SIGNAL(layersChanged()),
|
Chris@128
|
334 this, SLOT(updateLayerStatuses()));
|
gyorgyf@21
|
335
|
Chris@0
|
336 setupMenus();
|
Chris@0
|
337 setupToolbars();
|
Chris@0
|
338 setupHelpMenu();
|
Chris@0
|
339
|
Chris@0
|
340 statusBar();
|
Chris@0
|
341
|
Chris@95
|
342 newSession();
|
Chris@6
|
343
|
Chris@95
|
344 settings.beginGroup("MainWindow");
|
Chris@95
|
345 settings.setValue("zoom-default", 512);
|
Chris@95
|
346 settings.endGroup();
|
Chris@95
|
347 zoomDefault();
|
Chris@95
|
348
|
Chris@95
|
349 NetworkPermissionTester tester;
|
Chris@95
|
350 bool networkPermission = tester.havePermission();
|
Chris@95
|
351 if (networkPermission) {
|
Chris@95
|
352 m_versionTester = new VersionTester
|
Chris@95
|
353 ("sonicvisualiser.org", "latest-tony-version.txt", TONY_VERSION);
|
Chris@95
|
354 connect(m_versionTester, SIGNAL(newerVersionAvailable(QString)),
|
Chris@95
|
355 this, SLOT(newerVersionAvailable(QString)));
|
Chris@95
|
356 } else {
|
Chris@95
|
357 m_versionTester = 0;
|
Chris@95
|
358 }
|
Chris@0
|
359 }
|
Chris@0
|
360
|
Chris@0
|
361 MainWindow::~MainWindow()
|
Chris@0
|
362 {
|
Chris@6
|
363 delete m_analyser;
|
Chris@0
|
364 delete m_keyReference;
|
Chris@0
|
365 Profiles::getInstance()->dump();
|
Chris@0
|
366 }
|
Chris@0
|
367
|
Chris@0
|
368 void
|
Chris@0
|
369 MainWindow::setupMenus()
|
Chris@0
|
370 {
|
Chris@0
|
371 if (!m_mainMenusCreated) {
|
Chris@0
|
372 m_rightButtonMenu = new QMenu();
|
Chris@0
|
373 }
|
Chris@0
|
374
|
Chris@0
|
375 if (!m_mainMenusCreated) {
|
Chris@0
|
376 CommandHistory::getInstance()->registerMenu(m_rightButtonMenu);
|
Chris@0
|
377 m_rightButtonMenu->addSeparator();
|
Chris@0
|
378 }
|
Chris@0
|
379
|
Chris@0
|
380 setupFileMenu();
|
Chris@0
|
381 setupEditMenu();
|
Chris@0
|
382 setupViewMenu();
|
Chris@0
|
383
|
Chris@0
|
384 m_mainMenusCreated = true;
|
Chris@0
|
385 }
|
Chris@0
|
386
|
Chris@0
|
387 void
|
Chris@0
|
388 MainWindow::setupFileMenu()
|
Chris@0
|
389 {
|
Chris@0
|
390 if (m_mainMenusCreated) return;
|
Chris@0
|
391
|
Chris@0
|
392 QMenu *menu = menuBar()->addMenu(tr("&File"));
|
Chris@0
|
393 menu->setTearOffEnabled(true);
|
Chris@0
|
394 QToolBar *toolbar = addToolBar(tr("File Toolbar"));
|
Chris@0
|
395
|
Chris@0
|
396 m_keyReference->setCategory(tr("File and Session Management"));
|
Chris@0
|
397
|
Chris@0
|
398 IconLoader il;
|
Chris@1
|
399 QIcon icon;
|
Chris@1
|
400 QAction *action;
|
Chris@0
|
401
|
Chris@0
|
402 icon = il.load("fileopen");
|
Chris@0
|
403 icon.addPixmap(il.loadPixmap("fileopen-22"));
|
Chris@1
|
404 action = new QAction(icon, tr("&Open..."), this);
|
Chris@0
|
405 action->setShortcut(tr("Ctrl+O"));
|
Chris@1
|
406 action->setStatusTip(tr("Open a file"));
|
Chris@0
|
407 connect(action, SIGNAL(triggered()), this, SLOT(openFile()));
|
Chris@0
|
408 m_keyReference->registerShortcut(action);
|
Chris@0
|
409 menu->addAction(action);
|
Chris@0
|
410 toolbar->addAction(action);
|
Chris@0
|
411
|
Chris@1
|
412 action = new QAction(tr("Open Lo&cation..."), this);
|
Chris@0
|
413 action->setShortcut(tr("Ctrl+Shift+O"));
|
Chris@1
|
414 action->setStatusTip(tr("Open a file from a remote URL"));
|
Chris@0
|
415 connect(action, SIGNAL(triggered()), this, SLOT(openLocation()));
|
Chris@0
|
416 m_keyReference->registerShortcut(action);
|
Chris@0
|
417 menu->addAction(action);
|
Chris@0
|
418
|
Chris@1
|
419 m_recentFilesMenu = menu->addMenu(tr("Open &Recent"));
|
Chris@0
|
420 m_recentFilesMenu->setTearOffEnabled(true);
|
Chris@0
|
421 setupRecentFilesMenu();
|
Chris@0
|
422 connect(&m_recentFiles, SIGNAL(recentChanged()),
|
Chris@0
|
423 this, SLOT(setupRecentFilesMenu()));
|
Chris@0
|
424
|
Chris@0
|
425 menu->addSeparator();
|
Chris@85
|
426 action = new QAction(tr("Export Pitch Track Data..."), this);
|
Chris@85
|
427 action->setStatusTip(tr("Export pitch-track data to a file"));
|
Chris@85
|
428 connect(action, SIGNAL(triggered()), this, SLOT(exportPitchLayer()));
|
Chris@85
|
429 connect(this, SIGNAL(canExportLayer(bool)), action, SLOT(setEnabled(bool)));
|
Chris@85
|
430 menu->addAction(action);
|
Chris@85
|
431
|
Chris@85
|
432 action = new QAction(tr("Export Note Data..."), this);
|
Chris@85
|
433 action->setStatusTip(tr("Export note data to a file"));
|
Chris@85
|
434 connect(action, SIGNAL(triggered()), this, SLOT(exportNoteLayer()));
|
matthiasm@26
|
435 connect(this, SIGNAL(canExportLayer(bool)), action, SLOT(setEnabled(bool)));
|
matthiasm@26
|
436 menu->addAction(action);
|
matthiasm@26
|
437
|
matthiasm@26
|
438 menu->addSeparator();
|
Chris@0
|
439 action = new QAction(il.load("exit"), tr("&Quit"), this);
|
Chris@0
|
440 action->setShortcut(tr("Ctrl+Q"));
|
Chris@0
|
441 action->setStatusTip(tr("Exit %1").arg(QApplication::applicationName()));
|
Chris@0
|
442 connect(action, SIGNAL(triggered()), this, SLOT(close()));
|
Chris@0
|
443 m_keyReference->registerShortcut(action);
|
Chris@0
|
444 menu->addAction(action);
|
Chris@0
|
445 }
|
Chris@0
|
446
|
Chris@0
|
447 void
|
Chris@0
|
448 MainWindow::setupEditMenu()
|
Chris@0
|
449 {
|
Chris@0
|
450 if (m_mainMenusCreated) return;
|
Chris@0
|
451
|
Chris@0
|
452 QMenu *menu = menuBar()->addMenu(tr("&Edit"));
|
Chris@0
|
453 menu->setTearOffEnabled(true);
|
Chris@0
|
454 CommandHistory::getInstance()->registerMenu(menu);
|
Chris@126
|
455 menu->addSeparator();
|
Chris@126
|
456
|
Chris@126
|
457 QToolBar *toolbar = addToolBar(tr("Tools Toolbar"));
|
Chris@126
|
458
|
Chris@126
|
459 CommandHistory::getInstance()->registerToolbar(toolbar);
|
Chris@126
|
460
|
Chris@126
|
461 m_keyReference->setCategory(tr("Tool Selection"));
|
Chris@126
|
462
|
Chris@126
|
463 QActionGroup *group = new QActionGroup(this);
|
Chris@126
|
464
|
Chris@126
|
465 IconLoader il;
|
Chris@126
|
466
|
Chris@126
|
467 QAction *action = toolbar->addAction(il.load("navigate"),
|
Chris@126
|
468 tr("Navigate"));
|
Chris@126
|
469 action->setCheckable(true);
|
Chris@126
|
470 action->setChecked(true);
|
Chris@126
|
471 action->setShortcut(tr("1"));
|
Chris@126
|
472 action->setStatusTip(tr("Navigate"));
|
Chris@126
|
473 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected()));
|
Chris@126
|
474 connect(this, SIGNAL(replacedDocument()), action, SLOT(trigger()));
|
Chris@126
|
475 group->addAction(action);
|
Chris@126
|
476 menu->addAction(action);
|
Chris@126
|
477 m_keyReference->registerShortcut(action);
|
Chris@126
|
478
|
Chris@126
|
479 action = toolbar->addAction(il.load("move"),
|
Chris@126
|
480 tr("Edit"));
|
Chris@126
|
481 action->setCheckable(true);
|
Chris@126
|
482 action->setShortcut(tr("2"));
|
Chris@126
|
483 action->setStatusTip(tr("Edit with Note Intelligence"));
|
Chris@126
|
484 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected()));
|
Chris@126
|
485 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
|
Chris@126
|
486 group->addAction(action);
|
Chris@126
|
487 menu->addAction(action);
|
Chris@126
|
488 m_keyReference->registerShortcut(action);
|
Chris@126
|
489
|
Chris@126
|
490 /* Remove for now...
|
Chris@126
|
491
|
Chris@126
|
492 action = toolbar->addAction(il.load("notes"),
|
Chris@126
|
493 tr("Free Edit"));
|
Chris@126
|
494 action->setCheckable(true);
|
Chris@126
|
495 action->setShortcut(tr("3"));
|
Chris@126
|
496 action->setStatusTip(tr("Free Edit"));
|
Chris@126
|
497 connect(action, SIGNAL(triggered()), this, SLOT(toolFreeEditSelected()));
|
Chris@126
|
498 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
|
Chris@126
|
499 group->addAction(action);
|
Chris@126
|
500 m_keyReference->registerShortcut(action);
|
Chris@126
|
501 */
|
Chris@142
|
502
|
Chris@142
|
503 menu->addSeparator();
|
Chris@142
|
504
|
Chris@143
|
505 m_keyReference->setCategory(tr("Selection"));
|
Chris@143
|
506
|
Chris@143
|
507 action = new QAction(tr("Select &All"), this);
|
Chris@143
|
508 action->setShortcut(tr("Ctrl+A"));
|
Chris@143
|
509 action->setStatusTip(tr("Select the whole duration of the current session"));
|
Chris@143
|
510 connect(action, SIGNAL(triggered()), this, SLOT(selectAll()));
|
Chris@143
|
511 connect(this, SIGNAL(canSelect(bool)), action, SLOT(setEnabled(bool)));
|
Chris@143
|
512 m_keyReference->registerShortcut(action);
|
Chris@143
|
513 menu->addAction(action);
|
Chris@143
|
514 m_rightButtonMenu->addAction(action);
|
Chris@143
|
515
|
Chris@143
|
516 action = new QAction(tr("C&lear Selection"), this);
|
Chris@143
|
517 action->setShortcut(tr("Esc"));
|
Chris@143
|
518 action->setStatusTip(tr("Clear the selection"));
|
Chris@143
|
519 connect(action, SIGNAL(triggered()), this, SLOT(clearSelection()));
|
Chris@143
|
520 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
|
Chris@143
|
521 m_keyReference->registerShortcut(action);
|
Chris@143
|
522 menu->addAction(action);
|
Chris@143
|
523 m_rightButtonMenu->addAction(action);
|
Chris@143
|
524
|
Chris@143
|
525 menu->addSeparator();
|
Chris@143
|
526
|
Chris@143
|
527 //!!! shortcuts, status tip, key reference etc
|
Chris@168
|
528 action = new QAction(tr("Clear Pitches"), this);
|
Chris@168
|
529 action->setShortcut(tr("Backspace"));
|
Chris@168
|
530 connect(action, SIGNAL(triggered()), this, SLOT(clearPitches()));
|
Chris@168
|
531 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
|
Chris@168
|
532 menu->addAction(action);
|
Chris@168
|
533
|
Chris@168
|
534 //!!! shortcuts, status tip, key reference etc
|
Chris@142
|
535 action = new QAction(tr("Octave Shift Up"), this);
|
Chris@142
|
536 action->setShortcut(tr("PgUp"));
|
Chris@142
|
537 connect(action, SIGNAL(triggered()), this, SLOT(octaveShiftUp()));
|
Chris@142
|
538 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
|
Chris@142
|
539 menu->addAction(action);
|
Chris@142
|
540
|
Chris@142
|
541 action = new QAction(tr("Octave Shift Down"), this);
|
Chris@142
|
542 action->setShortcut(tr("PgDown"));
|
Chris@142
|
543 connect(action, SIGNAL(triggered()), this, SLOT(octaveShiftDown()));
|
Chris@142
|
544 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
|
Chris@142
|
545 menu->addAction(action);
|
Chris@167
|
546
|
Chris@167
|
547 //!!! shortcuts, status tip, key reference etc
|
Chris@167
|
548 action = new QAction(tr("Switch Pitch Candidate"), this);
|
Chris@167
|
549 action->setShortcut(tr("Return"));
|
Chris@168
|
550 connect(action, SIGNAL(triggered()), this, SLOT(switchPitch()));
|
Chris@167
|
551 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
|
Chris@167
|
552 menu->addAction(action);
|
Chris@0
|
553 }
|
Chris@0
|
554
|
Chris@0
|
555 void
|
Chris@0
|
556 MainWindow::setupViewMenu()
|
Chris@0
|
557 {
|
Chris@0
|
558 if (m_mainMenusCreated) return;
|
Chris@0
|
559
|
Chris@0
|
560 IconLoader il;
|
Chris@0
|
561
|
Chris@0
|
562 QAction *action = 0;
|
Chris@0
|
563
|
Chris@0
|
564 m_keyReference->setCategory(tr("Panning and Navigation"));
|
Chris@0
|
565
|
Chris@0
|
566 QMenu *menu = menuBar()->addMenu(tr("&View"));
|
Chris@0
|
567 menu->setTearOffEnabled(true);
|
Chris@0
|
568 action = new QAction(tr("Scroll &Left"), this);
|
Chris@0
|
569 action->setShortcut(tr("Left"));
|
Chris@0
|
570 action->setStatusTip(tr("Scroll the current pane to the left"));
|
Chris@0
|
571 connect(action, SIGNAL(triggered()), this, SLOT(scrollLeft()));
|
Chris@0
|
572 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
573 m_keyReference->registerShortcut(action);
|
Chris@0
|
574 menu->addAction(action);
|
gyorgyf@27
|
575
|
Chris@0
|
576 action = new QAction(tr("Scroll &Right"), this);
|
Chris@0
|
577 action->setShortcut(tr("Right"));
|
Chris@0
|
578 action->setStatusTip(tr("Scroll the current pane to the right"));
|
Chris@0
|
579 connect(action, SIGNAL(triggered()), this, SLOT(scrollRight()));
|
Chris@0
|
580 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
581 m_keyReference->registerShortcut(action);
|
Chris@0
|
582 menu->addAction(action);
|
gyorgyf@27
|
583
|
Chris@0
|
584 action = new QAction(tr("&Jump Left"), this);
|
Chris@0
|
585 action->setShortcut(tr("Ctrl+Left"));
|
Chris@0
|
586 action->setStatusTip(tr("Scroll the current pane a big step to the left"));
|
Chris@0
|
587 connect(action, SIGNAL(triggered()), this, SLOT(jumpLeft()));
|
Chris@0
|
588 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
589 m_keyReference->registerShortcut(action);
|
Chris@0
|
590 menu->addAction(action);
|
gyorgyf@27
|
591
|
Chris@0
|
592 action = new QAction(tr("J&ump Right"), this);
|
Chris@0
|
593 action->setShortcut(tr("Ctrl+Right"));
|
Chris@0
|
594 action->setStatusTip(tr("Scroll the current pane a big step to the right"));
|
Chris@0
|
595 connect(action, SIGNAL(triggered()), this, SLOT(jumpRight()));
|
Chris@0
|
596 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
597 m_keyReference->registerShortcut(action);
|
Chris@0
|
598 menu->addAction(action);
|
Chris@0
|
599
|
Chris@0
|
600 menu->addSeparator();
|
Chris@0
|
601
|
Chris@0
|
602 m_keyReference->setCategory(tr("Zoom"));
|
Chris@0
|
603
|
Chris@0
|
604 action = new QAction(il.load("zoom-in"),
|
Chris@0
|
605 tr("Zoom &In"), this);
|
Chris@0
|
606 action->setShortcut(tr("Up"));
|
Chris@0
|
607 action->setStatusTip(tr("Increase the zoom level"));
|
Chris@0
|
608 connect(action, SIGNAL(triggered()), this, SLOT(zoomIn()));
|
Chris@0
|
609 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
610 m_keyReference->registerShortcut(action);
|
Chris@0
|
611 menu->addAction(action);
|
gyorgyf@27
|
612
|
Chris@0
|
613 action = new QAction(il.load("zoom-out"),
|
Chris@0
|
614 tr("Zoom &Out"), this);
|
Chris@0
|
615 action->setShortcut(tr("Down"));
|
Chris@0
|
616 action->setStatusTip(tr("Decrease the zoom level"));
|
Chris@0
|
617 connect(action, SIGNAL(triggered()), this, SLOT(zoomOut()));
|
Chris@0
|
618 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
619 m_keyReference->registerShortcut(action);
|
Chris@0
|
620 menu->addAction(action);
|
gyorgyf@27
|
621
|
Chris@0
|
622 action = new QAction(tr("Restore &Default Zoom"), this);
|
Chris@0
|
623 action->setStatusTip(tr("Restore the zoom level to the default"));
|
Chris@0
|
624 connect(action, SIGNAL(triggered()), this, SLOT(zoomDefault()));
|
Chris@0
|
625 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
626 menu->addAction(action);
|
Chris@0
|
627
|
Chris@0
|
628 action = new QAction(il.load("zoom-fit"),
|
Chris@0
|
629 tr("Zoom to &Fit"), this);
|
Chris@0
|
630 action->setShortcut(tr("F"));
|
Chris@0
|
631 action->setStatusTip(tr("Zoom to show the whole file"));
|
Chris@0
|
632 connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit()));
|
Chris@0
|
633 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
634 m_keyReference->registerShortcut(action);
|
Chris@0
|
635 menu->addAction(action);
|
Chris@0
|
636 }
|
Chris@0
|
637
|
Chris@0
|
638 void
|
Chris@0
|
639 MainWindow::setupHelpMenu()
|
Chris@0
|
640 {
|
Chris@0
|
641 QMenu *menu = menuBar()->addMenu(tr("&Help"));
|
Chris@0
|
642 menu->setTearOffEnabled(true);
|
Chris@0
|
643
|
Chris@0
|
644 m_keyReference->setCategory(tr("Help"));
|
Chris@0
|
645
|
Chris@0
|
646 IconLoader il;
|
Chris@0
|
647
|
Chris@1
|
648 QString name = QApplication::applicationName();
|
Chris@1
|
649
|
Chris@0
|
650 QAction *action = new QAction(il.load("help"),
|
Chris@0
|
651 tr("&Help Reference"), this);
|
Chris@0
|
652 action->setShortcut(tr("F1"));
|
Chris@1
|
653 action->setStatusTip(tr("Open the %1 reference manual").arg(name));
|
Chris@0
|
654 connect(action, SIGNAL(triggered()), this, SLOT(help()));
|
Chris@0
|
655 m_keyReference->registerShortcut(action);
|
Chris@0
|
656 menu->addAction(action);
|
Chris@0
|
657
|
Chris@0
|
658 action = new QAction(tr("&Key and Mouse Reference"), this);
|
Chris@0
|
659 action->setShortcut(tr("F2"));
|
Chris@1
|
660 action->setStatusTip(tr("Open a window showing the keystrokes you can use in %1").arg(name));
|
Chris@0
|
661 connect(action, SIGNAL(triggered()), this, SLOT(keyReference()));
|
Chris@0
|
662 m_keyReference->registerShortcut(action);
|
Chris@0
|
663 menu->addAction(action);
|
Chris@0
|
664
|
Chris@1
|
665 action = new QAction(tr("%1 on the &Web").arg(name), this);
|
Chris@1
|
666 action->setStatusTip(tr("Open the %1 website").arg(name));
|
Chris@0
|
667 connect(action, SIGNAL(triggered()), this, SLOT(website()));
|
Chris@0
|
668 menu->addAction(action);
|
Chris@0
|
669
|
Chris@1
|
670 action = new QAction(tr("&About %1").arg(name), this);
|
Chris@1
|
671 action->setStatusTip(tr("Show information about %1").arg(name));
|
Chris@0
|
672 connect(action, SIGNAL(triggered()), this, SLOT(about()));
|
Chris@0
|
673 menu->addAction(action);
|
Chris@0
|
674 }
|
Chris@0
|
675
|
Chris@0
|
676 void
|
Chris@0
|
677 MainWindow::setupRecentFilesMenu()
|
Chris@0
|
678 {
|
Chris@0
|
679 m_recentFilesMenu->clear();
|
Chris@0
|
680 vector<QString> files = m_recentFiles.getRecent();
|
Chris@0
|
681 for (size_t i = 0; i < files.size(); ++i) {
|
Chris@50
|
682 QAction *action = new QAction(files[i], this);
|
Chris@50
|
683 connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
|
Chris@0
|
684 if (i == 0) {
|
Chris@0
|
685 action->setShortcut(tr("Ctrl+R"));
|
Chris@0
|
686 m_keyReference->registerShortcut
|
Chris@0
|
687 (tr("Re-open"),
|
Chris@50
|
688 action->shortcut().toString(),
|
Chris@0
|
689 tr("Re-open the current or most recently opened file"));
|
Chris@0
|
690 }
|
Chris@50
|
691 m_recentFilesMenu->addAction(action);
|
Chris@0
|
692 }
|
Chris@0
|
693 }
|
Chris@0
|
694
|
Chris@0
|
695 void
|
Chris@0
|
696 MainWindow::setupToolbars()
|
Chris@0
|
697 {
|
Chris@0
|
698 m_keyReference->setCategory(tr("Playback and Transport Controls"));
|
Chris@0
|
699
|
Chris@0
|
700 IconLoader il;
|
Chris@0
|
701
|
Chris@0
|
702 QMenu *menu = m_playbackMenu = menuBar()->addMenu(tr("Play&back"));
|
Chris@0
|
703 menu->setTearOffEnabled(true);
|
Chris@0
|
704 m_rightButtonMenu->addSeparator();
|
Chris@0
|
705 m_rightButtonPlaybackMenu = m_rightButtonMenu->addMenu(tr("Playback"));
|
Chris@0
|
706
|
Chris@0
|
707 QToolBar *toolbar = addToolBar(tr("Playback Toolbar"));
|
Chris@0
|
708
|
Chris@0
|
709 QAction *rwdStartAction = toolbar->addAction(il.load("rewind-start"),
|
Chris@0
|
710 tr("Rewind to Start"));
|
Chris@0
|
711 rwdStartAction->setShortcut(tr("Home"));
|
Chris@0
|
712 rwdStartAction->setStatusTip(tr("Rewind to the start"));
|
Chris@0
|
713 connect(rwdStartAction, SIGNAL(triggered()), this, SLOT(rewindStart()));
|
Chris@0
|
714 connect(this, SIGNAL(canPlay(bool)), rwdStartAction, SLOT(setEnabled(bool)));
|
Chris@0
|
715
|
Chris@0
|
716 QAction *m_rwdAction = toolbar->addAction(il.load("rewind"),
|
Chris@0
|
717 tr("Rewind"));
|
Chris@0
|
718 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant or time ruler notch"));
|
Chris@0
|
719 connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind()));
|
Chris@0
|
720 connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool)));
|
Chris@0
|
721
|
Chris@0
|
722 QAction *playAction = toolbar->addAction(il.load("playpause"),
|
Chris@0
|
723 tr("Play / Pause"));
|
Chris@0
|
724 playAction->setCheckable(true);
|
Chris@0
|
725 playAction->setShortcut(tr("Space"));
|
Chris@0
|
726 playAction->setStatusTip(tr("Start or stop playback from the current position"));
|
Chris@0
|
727 connect(playAction, SIGNAL(triggered()), this, SLOT(play()));
|
Chris@0
|
728 connect(m_playSource, SIGNAL(playStatusChanged(bool)),
|
gyorgyf@27
|
729 playAction, SLOT(setChecked(bool)));
|
Chris@0
|
730 connect(this, SIGNAL(canPlay(bool)), playAction, SLOT(setEnabled(bool)));
|
Chris@0
|
731
|
Chris@0
|
732 m_ffwdAction = toolbar->addAction(il.load("ffwd"),
|
Chris@0
|
733 tr("Fast Forward"));
|
Chris@0
|
734 m_ffwdAction->setStatusTip(tr("Fast-forward to the next time instant or time ruler notch"));
|
Chris@0
|
735 connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd()));
|
Chris@0
|
736 connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool)));
|
Chris@0
|
737
|
Chris@0
|
738 QAction *ffwdEndAction = toolbar->addAction(il.load("ffwd-end"),
|
Chris@0
|
739 tr("Fast Forward to End"));
|
Chris@0
|
740 ffwdEndAction->setShortcut(tr("End"));
|
Chris@0
|
741 ffwdEndAction->setStatusTip(tr("Fast-forward to the end"));
|
Chris@0
|
742 connect(ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd()));
|
Chris@0
|
743 connect(this, SIGNAL(canPlay(bool)), ffwdEndAction, SLOT(setEnabled(bool)));
|
Chris@6
|
744
|
Chris@0
|
745 toolbar = addToolBar(tr("Play Mode Toolbar"));
|
Chris@0
|
746
|
Chris@0
|
747 QAction *psAction = toolbar->addAction(il.load("playselection"),
|
Chris@0
|
748 tr("Constrain Playback to Selection"));
|
Chris@0
|
749 psAction->setCheckable(true);
|
Chris@0
|
750 psAction->setChecked(m_viewManager->getPlaySelectionMode());
|
Chris@0
|
751 psAction->setShortcut(tr("s"));
|
Chris@0
|
752 psAction->setStatusTip(tr("Constrain playback to the selected regions"));
|
Chris@0
|
753 connect(m_viewManager, SIGNAL(playSelectionModeChanged(bool)),
|
Chris@0
|
754 psAction, SLOT(setChecked(bool)));
|
Chris@0
|
755 connect(psAction, SIGNAL(triggered()), this, SLOT(playSelectionToggled()));
|
Chris@0
|
756 connect(this, SIGNAL(canPlaySelection(bool)), psAction, SLOT(setEnabled(bool)));
|
Chris@0
|
757
|
Chris@0
|
758 QAction *plAction = toolbar->addAction(il.load("playloop"),
|
Chris@0
|
759 tr("Loop Playback"));
|
Chris@0
|
760 plAction->setCheckable(true);
|
Chris@0
|
761 plAction->setChecked(m_viewManager->getPlayLoopMode());
|
Chris@0
|
762 plAction->setShortcut(tr("l"));
|
Chris@0
|
763 plAction->setStatusTip(tr("Loop playback"));
|
Chris@0
|
764 connect(m_viewManager, SIGNAL(playLoopModeChanged(bool)),
|
Chris@0
|
765 plAction, SLOT(setChecked(bool)));
|
Chris@0
|
766 connect(plAction, SIGNAL(triggered()), this, SLOT(playLoopToggled()));
|
Chris@0
|
767 connect(this, SIGNAL(canPlay(bool)), plAction, SLOT(setEnabled(bool)));
|
Chris@0
|
768
|
Chris@0
|
769 m_keyReference->registerShortcut(psAction);
|
Chris@0
|
770 m_keyReference->registerShortcut(plAction);
|
Chris@0
|
771 m_keyReference->registerShortcut(playAction);
|
Chris@0
|
772 m_keyReference->registerShortcut(m_rwdAction);
|
Chris@0
|
773 m_keyReference->registerShortcut(m_ffwdAction);
|
Chris@0
|
774 m_keyReference->registerShortcut(rwdStartAction);
|
Chris@0
|
775 m_keyReference->registerShortcut(ffwdEndAction);
|
Chris@0
|
776
|
Chris@6
|
777 menu->addAction(playAction);
|
Chris@0
|
778 menu->addAction(psAction);
|
Chris@0
|
779 menu->addAction(plAction);
|
Chris@0
|
780 menu->addSeparator();
|
Chris@0
|
781 menu->addAction(m_rwdAction);
|
Chris@0
|
782 menu->addAction(m_ffwdAction);
|
Chris@0
|
783 menu->addSeparator();
|
Chris@0
|
784 menu->addAction(rwdStartAction);
|
Chris@0
|
785 menu->addAction(ffwdEndAction);
|
Chris@0
|
786 menu->addSeparator();
|
Chris@0
|
787
|
Chris@0
|
788 m_rightButtonPlaybackMenu->addAction(playAction);
|
Chris@0
|
789 m_rightButtonPlaybackMenu->addAction(psAction);
|
Chris@0
|
790 m_rightButtonPlaybackMenu->addAction(plAction);
|
Chris@0
|
791 m_rightButtonPlaybackMenu->addSeparator();
|
Chris@0
|
792 m_rightButtonPlaybackMenu->addAction(m_rwdAction);
|
Chris@0
|
793 m_rightButtonPlaybackMenu->addAction(m_ffwdAction);
|
Chris@0
|
794 m_rightButtonPlaybackMenu->addSeparator();
|
Chris@0
|
795 m_rightButtonPlaybackMenu->addAction(rwdStartAction);
|
Chris@0
|
796 m_rightButtonPlaybackMenu->addAction(ffwdEndAction);
|
Chris@0
|
797 m_rightButtonPlaybackMenu->addSeparator();
|
Chris@0
|
798
|
Chris@0
|
799 QAction *fastAction = menu->addAction(tr("Speed Up"));
|
Chris@0
|
800 fastAction->setShortcut(tr("Ctrl+PgUp"));
|
Chris@0
|
801 fastAction->setStatusTip(tr("Time-stretch playback to speed it up without changing pitch"));
|
Chris@0
|
802 connect(fastAction, SIGNAL(triggered()), this, SLOT(speedUpPlayback()));
|
Chris@0
|
803 connect(this, SIGNAL(canSpeedUpPlayback(bool)), fastAction, SLOT(setEnabled(bool)));
|
Chris@0
|
804
|
Chris@0
|
805 QAction *slowAction = menu->addAction(tr("Slow Down"));
|
Chris@0
|
806 slowAction->setShortcut(tr("Ctrl+PgDown"));
|
Chris@0
|
807 slowAction->setStatusTip(tr("Time-stretch playback to slow it down without changing pitch"));
|
Chris@0
|
808 connect(slowAction, SIGNAL(triggered()), this, SLOT(slowDownPlayback()));
|
Chris@0
|
809 connect(this, SIGNAL(canSlowDownPlayback(bool)), slowAction, SLOT(setEnabled(bool)));
|
Chris@0
|
810
|
Chris@0
|
811 QAction *normalAction = menu->addAction(tr("Restore Normal Speed"));
|
Chris@0
|
812 normalAction->setShortcut(tr("Ctrl+Home"));
|
Chris@0
|
813 normalAction->setStatusTip(tr("Restore non-time-stretched playback"));
|
Chris@0
|
814 connect(normalAction, SIGNAL(triggered()), this, SLOT(restoreNormalPlayback()));
|
Chris@0
|
815 connect(this, SIGNAL(canChangePlaybackSpeed(bool)), normalAction, SLOT(setEnabled(bool)));
|
Chris@0
|
816
|
Chris@0
|
817 m_keyReference->registerShortcut(fastAction);
|
Chris@0
|
818 m_keyReference->registerShortcut(slowAction);
|
Chris@0
|
819 m_keyReference->registerShortcut(normalAction);
|
Chris@0
|
820
|
Chris@0
|
821 m_rightButtonPlaybackMenu->addAction(fastAction);
|
Chris@0
|
822 m_rightButtonPlaybackMenu->addAction(slowAction);
|
Chris@0
|
823 m_rightButtonPlaybackMenu->addAction(normalAction);
|
Chris@6
|
824
|
Chris@6
|
825 toolbar = addToolBar(tr("Playback Controls"));
|
Chris@6
|
826 toolbar->addWidget(m_playSpeed);
|
Chris@6
|
827 toolbar->addWidget(m_fader);
|
Chris@0
|
828
|
Chris@128
|
829 toolbar = addToolBar(tr("Show and Play"));
|
Chris@144
|
830
|
justin@156
|
831 /* ORIGINAL DESIGN
|
Chris@144
|
832 QLabel *eye = new QLabel;
|
Chris@144
|
833 eye->setFixedWidth(40);
|
Chris@144
|
834 eye->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
Chris@144
|
835 eye->setPixmap(il.loadPixmap("eye"));
|
Chris@144
|
836 toolbar->addWidget(eye);
|
Chris@144
|
837
|
Chris@144
|
838 m_showAudio = toolbar->addAction(il.load("waveform"), tr("Show Audio"));
|
Chris@144
|
839 m_showAudio->setCheckable(true);
|
Chris@144
|
840 connect(m_showAudio, SIGNAL(triggered()), this, SLOT(showAudioToggled()));
|
Chris@144
|
841 connect(this, SIGNAL(canPlay(bool)), m_showAudio, SLOT(setEnabled(bool)));
|
Chris@144
|
842
|
Chris@145
|
843 m_showSpect = toolbar->addAction(il.load("spectrogram"), tr("Show Spectrogram"));
|
Chris@145
|
844 m_showSpect->setCheckable(true);
|
Chris@145
|
845 connect(m_showSpect, SIGNAL(triggered()), this, SLOT(showSpectToggled()));
|
Chris@145
|
846 connect(this, SIGNAL(canPlay(bool)), m_showSpect, SLOT(setEnabled(bool)));
|
Chris@145
|
847
|
Chris@144
|
848 m_showPitch = toolbar->addAction(il.load("values"), tr("Show Pitch Track"));
|
Chris@144
|
849 m_showPitch->setCheckable(true);
|
Chris@144
|
850 connect(m_showPitch, SIGNAL(triggered()), this, SLOT(showPitchToggled()));
|
Chris@144
|
851 connect(this, SIGNAL(canPlay(bool)), m_showPitch, SLOT(setEnabled(bool)));
|
Chris@144
|
852
|
Chris@144
|
853 m_showNotes = toolbar->addAction(il.load("notes"), tr("Show Notes"));
|
Chris@144
|
854 m_showNotes->setCheckable(true);
|
Chris@144
|
855 connect(m_showNotes, SIGNAL(triggered()), this, SLOT(showNotesToggled()));
|
Chris@144
|
856 connect(this, SIGNAL(canPlay(bool)), m_showNotes, SLOT(setEnabled(bool)));
|
Chris@144
|
857
|
Chris@144
|
858 QLabel *speaker = new QLabel;
|
Chris@144
|
859 speaker->setFixedWidth(40);
|
Chris@144
|
860 speaker->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
Chris@144
|
861 speaker->setPixmap(il.loadPixmap("speaker"));
|
Chris@144
|
862 toolbar->addWidget(speaker);
|
Chris@128
|
863
|
Chris@144
|
864 m_playAudio = toolbar->addAction(il.load("waveform"), tr("Play Audio"));
|
Chris@144
|
865 m_playAudio->setCheckable(true);
|
Chris@144
|
866 connect(m_playAudio, SIGNAL(triggered()), this, SLOT(playAudioToggled()));
|
Chris@144
|
867 connect(this, SIGNAL(canPlay(bool)), m_playAudio, SLOT(setEnabled(bool)));
|
Chris@128
|
868
|
Chris@144
|
869 m_playPitch = toolbar->addAction(il.load("values"), tr("Play Pitch Track"));
|
Chris@144
|
870 m_playPitch->setCheckable(true);
|
Chris@144
|
871 connect(m_playPitch, SIGNAL(triggered()), this, SLOT(playPitchToggled()));
|
Chris@144
|
872 connect(this, SIGNAL(canPlay(bool)), m_playPitch, SLOT(setEnabled(bool)));
|
Chris@128
|
873
|
Chris@144
|
874 m_playNotes = toolbar->addAction(il.load("notes"), tr("Play Notes"));
|
Chris@144
|
875 m_playNotes->setCheckable(true);
|
Chris@144
|
876 connect(m_playNotes, SIGNAL(triggered()), this, SLOT(playNotesToggled()));
|
Chris@144
|
877 connect(this, SIGNAL(canPlay(bool)), m_playNotes, SLOT(setEnabled(bool)));
|
justin@156
|
878 */
|
justin@156
|
879
|
justin@156
|
880 // Audio
|
justin@156
|
881 QLabel *icon_audio = new QLabel;
|
justin@156
|
882 icon_audio->setFixedWidth(40);
|
justin@156
|
883 icon_audio->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
justin@156
|
884 icon_audio->setPixmap(il.loadPixmap("waveform"));
|
justin@156
|
885 toolbar->addWidget(icon_audio);
|
justin@156
|
886
|
justin@156
|
887 m_showAudio = toolbar->addAction(il.load("eye"), tr("Show Audio"));
|
justin@156
|
888 m_showAudio->setCheckable(true);
|
justin@156
|
889 connect(m_showAudio, SIGNAL(triggered()), this, SLOT(showAudioToggled()));
|
justin@156
|
890 connect(this, SIGNAL(canPlay(bool)), m_showAudio, SLOT(setEnabled(bool)));
|
justin@156
|
891
|
justin@156
|
892 m_playAudio = toolbar->addAction(il.load("speaker"), tr("Play Audio"));
|
justin@156
|
893 m_playAudio->setCheckable(true);
|
justin@156
|
894 connect(m_playAudio, SIGNAL(triggered()), this, SLOT(playAudioToggled()));
|
justin@156
|
895 connect(this, SIGNAL(canPlay(bool)), m_playAudio, SLOT(setEnabled(bool)));
|
justin@156
|
896
|
justin@159
|
897 toolbar->addWidget(m_gainAudio);
|
justin@160
|
898 toolbar->addWidget(m_panAudio);
|
justin@159
|
899
|
justin@156
|
900 // Pitch (f0)
|
justin@156
|
901 QLabel *icon_pitch = new QLabel;
|
justin@156
|
902 icon_pitch->setFixedWidth(40);
|
justin@156
|
903 icon_pitch->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
justin@156
|
904 icon_pitch->setPixmap(il.loadPixmap("values"));
|
justin@156
|
905 toolbar->addWidget(icon_pitch);
|
justin@156
|
906
|
justin@156
|
907 m_showPitch = toolbar->addAction(il.load("eye"), tr("Show Pitch Track"));
|
justin@156
|
908 m_showPitch->setCheckable(true);
|
justin@156
|
909 connect(m_showPitch, SIGNAL(triggered()), this, SLOT(showPitchToggled()));
|
justin@156
|
910 connect(this, SIGNAL(canPlay(bool)), m_showPitch, SLOT(setEnabled(bool)));
|
justin@156
|
911
|
justin@156
|
912 m_playPitch = toolbar->addAction(il.load("speaker"), tr("Play Pitch Track"));
|
justin@156
|
913 m_playPitch->setCheckable(true);
|
justin@156
|
914 connect(m_playPitch, SIGNAL(triggered()), this, SLOT(playPitchToggled()));
|
justin@156
|
915 connect(this, SIGNAL(canPlay(bool)), m_playPitch, SLOT(setEnabled(bool)));
|
justin@156
|
916
|
Chris@158
|
917 toolbar->addWidget(m_gainPitch);
|
justin@160
|
918 toolbar->addWidget(m_panPitch);
|
justin@156
|
919
|
justin@156
|
920 // Notes
|
justin@156
|
921 QLabel *icon_notes = new QLabel;
|
justin@156
|
922 icon_notes->setFixedWidth(40);
|
justin@156
|
923 icon_notes->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
justin@156
|
924 icon_notes->setPixmap(il.loadPixmap("notes"));
|
justin@156
|
925 toolbar->addWidget(icon_notes);
|
justin@156
|
926
|
justin@156
|
927 m_showNotes = toolbar->addAction(il.load("eye"), tr("Show Notes"));
|
justin@156
|
928 m_showNotes->setCheckable(true);
|
justin@156
|
929 connect(m_showNotes, SIGNAL(triggered()), this, SLOT(showNotesToggled()));
|
justin@156
|
930 connect(this, SIGNAL(canPlay(bool)), m_showNotes, SLOT(setEnabled(bool)));
|
justin@156
|
931
|
justin@156
|
932 m_playNotes = toolbar->addAction(il.load("speaker"), tr("Play Notes"));
|
justin@156
|
933 m_playNotes->setCheckable(true);
|
justin@156
|
934 connect(m_playNotes, SIGNAL(triggered()), this, SLOT(playNotesToggled()));
|
justin@156
|
935 connect(this, SIGNAL(canPlay(bool)), m_playNotes, SLOT(setEnabled(bool)));
|
justin@156
|
936
|
justin@159
|
937 toolbar->addWidget(m_gainNotes);
|
justin@160
|
938 toolbar->addWidget(m_panNotes);
|
justin@159
|
939
|
justin@156
|
940 // Spectrogram
|
justin@156
|
941 QLabel *icon_spectrogram = new QLabel;
|
justin@156
|
942 icon_spectrogram->setFixedWidth(40);
|
justin@156
|
943 icon_spectrogram->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
justin@156
|
944 icon_spectrogram->setPixmap(il.loadPixmap("spectrogram"));
|
justin@156
|
945 toolbar->addWidget(icon_spectrogram);
|
justin@156
|
946
|
justin@156
|
947 m_showSpect = toolbar->addAction(il.load("eye"), tr("Show Spectrogram"));
|
justin@156
|
948 m_showSpect->setCheckable(true);
|
justin@156
|
949 connect(m_showSpect, SIGNAL(triggered()), this, SLOT(showSpectToggled()));
|
justin@156
|
950 connect(this, SIGNAL(canPlay(bool)), m_showSpect, SLOT(setEnabled(bool)));
|
Chris@128
|
951
|
Chris@0
|
952 Pane::registerShortcuts(*m_keyReference);
|
Chris@0
|
953 }
|
Chris@0
|
954
|
Chris@0
|
955 void
|
Chris@70
|
956 MainWindow::toolNavigateSelected()
|
Chris@70
|
957 {
|
Chris@70
|
958 m_viewManager->setToolMode(ViewManager::NavigateMode);
|
Chris@70
|
959 m_intelligentActionOn = true;
|
Chris@70
|
960 }
|
Chris@70
|
961
|
Chris@70
|
962 void
|
Chris@70
|
963 MainWindow::toolEditSelected()
|
Chris@70
|
964 {
|
Chris@77
|
965 m_viewManager->setToolMode(ViewManager::NoteEditMode);
|
Chris@70
|
966 m_intelligentActionOn = true;
|
Chris@70
|
967 m_analyser->setIntelligentActions(m_intelligentActionOn);
|
Chris@70
|
968 }
|
Chris@70
|
969
|
Chris@70
|
970 void
|
Chris@70
|
971 MainWindow::toolFreeEditSelected()
|
Chris@70
|
972 {
|
Chris@77
|
973 m_viewManager->setToolMode(ViewManager::NoteEditMode);
|
Chris@70
|
974 m_intelligentActionOn = false;
|
Chris@70
|
975 m_analyser->setIntelligentActions(m_intelligentActionOn);
|
Chris@70
|
976 }
|
Chris@70
|
977
|
gyorgyf@21
|
978 void
|
Chris@0
|
979 MainWindow::updateMenuStates()
|
Chris@0
|
980 {
|
Chris@0
|
981 MainWindowBase::updateMenuStates();
|
Chris@0
|
982
|
Chris@0
|
983 Pane *currentPane = 0;
|
Chris@0
|
984 Layer *currentLayer = 0;
|
Chris@0
|
985
|
Chris@0
|
986 if (m_paneStack) currentPane = m_paneStack->getCurrentPane();
|
Chris@0
|
987 if (currentPane) currentLayer = currentPane->getSelectedLayer();
|
Chris@0
|
988
|
Chris@0
|
989 bool haveCurrentPane =
|
Chris@0
|
990 (currentPane != 0);
|
Chris@0
|
991 bool haveCurrentLayer =
|
Chris@0
|
992 (haveCurrentPane &&
|
Chris@0
|
993 (currentLayer != 0));
|
Chris@0
|
994 bool haveSelection =
|
gyorgyf@27
|
995 (m_viewManager &&
|
gyorgyf@27
|
996 !m_viewManager->getSelections().empty());
|
Chris@0
|
997 bool haveCurrentEditableLayer =
|
gyorgyf@27
|
998 (haveCurrentLayer &&
|
gyorgyf@27
|
999 currentLayer->isLayerEditable());
|
Chris@0
|
1000 bool haveCurrentTimeInstantsLayer =
|
gyorgyf@27
|
1001 (haveCurrentLayer &&
|
gyorgyf@27
|
1002 qobject_cast<TimeInstantLayer *>(currentLayer));
|
Chris@0
|
1003 bool haveCurrentTimeValueLayer =
|
gyorgyf@27
|
1004 (haveCurrentLayer &&
|
gyorgyf@27
|
1005 qobject_cast<TimeValueLayer *>(currentLayer));
|
Chris@0
|
1006
|
Chris@0
|
1007 emit canChangePlaybackSpeed(true);
|
Chris@0
|
1008 int v = m_playSpeed->value();
|
Chris@0
|
1009 emit canSpeedUpPlayback(v < m_playSpeed->maximum());
|
Chris@0
|
1010 emit canSlowDownPlayback(v > m_playSpeed->minimum());
|
Chris@0
|
1011
|
Chris@0
|
1012 if (m_ffwdAction && m_rwdAction) {
|
Chris@0
|
1013 if (haveCurrentTimeInstantsLayer) {
|
Chris@0
|
1014 m_ffwdAction->setText(tr("Fast Forward to Next Instant"));
|
Chris@0
|
1015 m_ffwdAction->setStatusTip(tr("Fast forward to the next time instant in the current layer"));
|
Chris@0
|
1016 m_rwdAction->setText(tr("Rewind to Previous Instant"));
|
Chris@0
|
1017 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant in the current layer"));
|
Chris@0
|
1018 } else if (haveCurrentTimeValueLayer) {
|
Chris@0
|
1019 m_ffwdAction->setText(tr("Fast Forward to Next Point"));
|
Chris@0
|
1020 m_ffwdAction->setStatusTip(tr("Fast forward to the next point in the current layer"));
|
Chris@0
|
1021 m_rwdAction->setText(tr("Rewind to Previous Point"));
|
Chris@0
|
1022 m_rwdAction->setStatusTip(tr("Rewind to the previous point in the current layer"));
|
Chris@0
|
1023 } else {
|
Chris@0
|
1024 m_ffwdAction->setText(tr("Fast Forward"));
|
Chris@0
|
1025 m_ffwdAction->setStatusTip(tr("Fast forward"));
|
Chris@0
|
1026 m_rwdAction->setText(tr("Rewind"));
|
Chris@0
|
1027 m_rwdAction->setStatusTip(tr("Rewind"));
|
Chris@0
|
1028 }
|
Chris@0
|
1029 }
|
Chris@0
|
1030 }
|
Chris@0
|
1031
|
Chris@0
|
1032 void
|
Chris@144
|
1033 MainWindow::showAudioToggled()
|
Chris@128
|
1034 {
|
Chris@144
|
1035 m_analyser->toggleVisible(Analyser::Audio);
|
Chris@128
|
1036 }
|
Chris@128
|
1037
|
Chris@128
|
1038 void
|
Chris@144
|
1039 MainWindow::showPitchToggled()
|
Chris@128
|
1040 {
|
Chris@144
|
1041 m_analyser->toggleVisible(Analyser::PitchTrack);
|
Chris@128
|
1042 }
|
Chris@128
|
1043
|
Chris@128
|
1044 void
|
Chris@145
|
1045 MainWindow::showSpectToggled()
|
Chris@145
|
1046 {
|
Chris@145
|
1047 m_analyser->toggleVisible(Analyser::Spectrogram);
|
Chris@145
|
1048 }
|
Chris@145
|
1049
|
Chris@145
|
1050 void
|
Chris@144
|
1051 MainWindow::showNotesToggled()
|
Chris@128
|
1052 {
|
Chris@144
|
1053 m_analyser->toggleVisible(Analyser::Notes);
|
Chris@144
|
1054 }
|
Chris@144
|
1055
|
Chris@144
|
1056 void
|
Chris@144
|
1057 MainWindow::playAudioToggled()
|
Chris@144
|
1058 {
|
Chris@144
|
1059 m_analyser->toggleAudible(Analyser::Audio);
|
Chris@144
|
1060 }
|
Chris@144
|
1061
|
Chris@144
|
1062 void
|
Chris@144
|
1063 MainWindow::playPitchToggled()
|
Chris@144
|
1064 {
|
Chris@144
|
1065 m_analyser->toggleAudible(Analyser::PitchTrack);
|
Chris@144
|
1066 }
|
Chris@144
|
1067
|
Chris@144
|
1068 void
|
Chris@144
|
1069 MainWindow::playNotesToggled()
|
Chris@144
|
1070 {
|
Chris@144
|
1071 m_analyser->toggleAudible(Analyser::Notes);
|
Chris@144
|
1072 }
|
Chris@144
|
1073
|
Chris@144
|
1074 void
|
Chris@144
|
1075 MainWindow::updateLayerStatuses()
|
Chris@144
|
1076 {
|
Chris@144
|
1077 m_showAudio->setChecked(m_analyser->isVisible(Analyser::Audio));
|
Chris@145
|
1078 m_showSpect->setChecked(m_analyser->isVisible(Analyser::Spectrogram));
|
Chris@144
|
1079 m_showPitch->setChecked(m_analyser->isVisible(Analyser::PitchTrack));
|
Chris@144
|
1080 m_showNotes->setChecked(m_analyser->isVisible(Analyser::Notes));
|
Chris@144
|
1081 m_playAudio->setChecked(m_analyser->isAudible(Analyser::Audio));
|
Chris@144
|
1082 m_playPitch->setChecked(m_analyser->isAudible(Analyser::PitchTrack));
|
Chris@144
|
1083 m_playNotes->setChecked(m_analyser->isAudible(Analyser::Notes));
|
Chris@128
|
1084 }
|
Chris@128
|
1085
|
Chris@128
|
1086 void
|
Chris@0
|
1087 MainWindow::updateDescriptionLabel()
|
Chris@0
|
1088 {
|
Chris@6
|
1089 // Nothing, we don't have one
|
Chris@0
|
1090 }
|
Chris@0
|
1091
|
Chris@0
|
1092 void
|
Chris@0
|
1093 MainWindow::documentModified()
|
Chris@0
|
1094 {
|
Chris@0
|
1095 MainWindowBase::documentModified();
|
Chris@0
|
1096 }
|
Chris@0
|
1097
|
Chris@0
|
1098 void
|
Chris@0
|
1099 MainWindow::documentRestored()
|
Chris@0
|
1100 {
|
Chris@0
|
1101 MainWindowBase::documentRestored();
|
Chris@0
|
1102 }
|
Chris@0
|
1103
|
Chris@0
|
1104 void
|
Chris@0
|
1105 MainWindow::newSession()
|
Chris@0
|
1106 {
|
Chris@0
|
1107 if (!checkSaveModified()) return;
|
Chris@0
|
1108
|
Chris@0
|
1109 closeSession();
|
Chris@0
|
1110 createDocument();
|
Chris@0
|
1111 m_document->setAutoAlignment(true);
|
Chris@0
|
1112
|
Chris@0
|
1113 Pane *pane = m_paneStack->addPane();
|
Chris@0
|
1114
|
Chris@0
|
1115 connect(pane, SIGNAL(contextHelpChanged(const QString &)),
|
Chris@0
|
1116 this, SLOT(contextHelpChanged(const QString &)));
|
Chris@0
|
1117
|
Chris@6
|
1118 // Layer *waveform = m_document->createMainModelLayer(LayerFactory::Waveform);
|
Chris@6
|
1119 // m_document->addLayerToView(pane, waveform);
|
Chris@0
|
1120
|
Chris@0
|
1121 m_overview->registerView(pane);
|
Chris@0
|
1122
|
Chris@0
|
1123 CommandHistory::getInstance()->clear();
|
Chris@0
|
1124 CommandHistory::getInstance()->documentSaved();
|
Chris@0
|
1125 documentRestored();
|
Chris@0
|
1126 updateMenuStates();
|
Chris@0
|
1127 }
|
Chris@0
|
1128
|
Chris@0
|
1129 void
|
Chris@0
|
1130 MainWindow::closeSession()
|
Chris@0
|
1131 {
|
Chris@0
|
1132 if (!checkSaveModified()) return;
|
Chris@0
|
1133
|
Chris@0
|
1134 while (m_paneStack->getPaneCount() > 0) {
|
Chris@0
|
1135
|
Chris@167
|
1136 Pane *pane = m_paneStack->getPane(m_paneStack->getPaneCount() - 1);
|
Chris@0
|
1137
|
Chris@167
|
1138 while (pane->getLayerCount() > 0) {
|
Chris@167
|
1139 m_document->removeLayerFromView
|
Chris@167
|
1140 (pane, pane->getLayer(pane->getLayerCount() - 1));
|
Chris@167
|
1141 }
|
Chris@167
|
1142
|
Chris@167
|
1143 m_overview->unregisterView(pane);
|
Chris@167
|
1144 m_paneStack->deletePane(pane);
|
Chris@0
|
1145 }
|
Chris@0
|
1146
|
Chris@0
|
1147 while (m_paneStack->getHiddenPaneCount() > 0) {
|
Chris@0
|
1148
|
Chris@167
|
1149 Pane *pane = m_paneStack->getHiddenPane
|
Chris@167
|
1150 (m_paneStack->getHiddenPaneCount() - 1);
|
Chris@167
|
1151
|
Chris@167
|
1152 while (pane->getLayerCount() > 0) {
|
Chris@167
|
1153 m_document->removeLayerFromView
|
Chris@167
|
1154 (pane, pane->getLayer(pane->getLayerCount() - 1));
|
Chris@167
|
1155 }
|
Chris@167
|
1156
|
Chris@167
|
1157 m_overview->unregisterView(pane);
|
Chris@167
|
1158 m_paneStack->deletePane(pane);
|
Chris@0
|
1159 }
|
Chris@0
|
1160
|
Chris@0
|
1161 delete m_document;
|
Chris@0
|
1162 m_document = 0;
|
Chris@0
|
1163 m_viewManager->clearSelections();
|
Chris@0
|
1164 m_timeRulerLayer = 0; // document owned this
|
Chris@0
|
1165
|
Chris@0
|
1166 m_sessionFile = "";
|
Chris@0
|
1167
|
Chris@0
|
1168 CommandHistory::getInstance()->clear();
|
Chris@0
|
1169 CommandHistory::getInstance()->documentSaved();
|
Chris@0
|
1170 documentRestored();
|
Chris@0
|
1171 }
|
Chris@0
|
1172
|
Chris@0
|
1173 void
|
Chris@0
|
1174 MainWindow::openFile()
|
Chris@0
|
1175 {
|
Chris@0
|
1176 QString orig = m_audioFile;
|
Chris@0
|
1177 if (orig == "") orig = ".";
|
Chris@0
|
1178 else orig = QFileInfo(orig).absoluteDir().canonicalPath();
|
Chris@0
|
1179
|
Chris@0
|
1180 QString path = getOpenFileName(FileFinder::AnyFile);
|
Chris@0
|
1181
|
Chris@0
|
1182 if (path.isEmpty()) return;
|
Chris@0
|
1183
|
Chris@1
|
1184 FileOpenStatus status = open(path, ReplaceSession);
|
Chris@0
|
1185
|
Chris@0
|
1186 if (status == FileOpenFailed) {
|
Chris@0
|
1187 QMessageBox::critical(this, tr("Failed to open file"),
|
Chris@0
|
1188 tr("<b>File open failed</b><p>File \"%1\" could not be opened").arg(path));
|
Chris@0
|
1189 } else if (status == FileOpenWrongMode) {
|
Chris@0
|
1190 QMessageBox::critical(this, tr("Failed to open file"),
|
Chris@0
|
1191 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data"));
|
Chris@0
|
1192 }
|
Chris@0
|
1193 }
|
Chris@0
|
1194
|
Chris@0
|
1195 void
|
Chris@0
|
1196 MainWindow::openLocation()
|
Chris@0
|
1197 {
|
Chris@0
|
1198 QSettings settings;
|
Chris@0
|
1199 settings.beginGroup("MainWindow");
|
Chris@0
|
1200 QString lastLocation = settings.value("lastremote", "").toString();
|
Chris@0
|
1201
|
Chris@0
|
1202 bool ok = false;
|
Chris@0
|
1203 QString text = QInputDialog::getText
|
Chris@0
|
1204 (this, tr("Open Location"),
|
Chris@0
|
1205 tr("Please enter the URL of the location to open:"),
|
Chris@0
|
1206 QLineEdit::Normal, lastLocation, &ok);
|
Chris@0
|
1207
|
Chris@0
|
1208 if (!ok) return;
|
Chris@0
|
1209
|
Chris@0
|
1210 settings.setValue("lastremote", text);
|
Chris@0
|
1211
|
Chris@0
|
1212 if (text.isEmpty()) return;
|
Chris@0
|
1213
|
Chris@1
|
1214 FileOpenStatus status = open(text, ReplaceSession);
|
Chris@0
|
1215
|
Chris@0
|
1216 if (status == FileOpenFailed) {
|
Chris@0
|
1217 QMessageBox::critical(this, tr("Failed to open location"),
|
Chris@0
|
1218 tr("<b>Open failed</b><p>URL \"%1\" could not be opened").arg(text));
|
Chris@0
|
1219 } else if (status == FileOpenWrongMode) {
|
Chris@0
|
1220 QMessageBox::critical(this, tr("Failed to open location"),
|
Chris@0
|
1221 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data"));
|
Chris@0
|
1222 }
|
Chris@0
|
1223 }
|
Chris@0
|
1224
|
Chris@0
|
1225 void
|
Chris@0
|
1226 MainWindow::openRecentFile()
|
Chris@0
|
1227 {
|
Chris@0
|
1228 QObject *obj = sender();
|
Chris@3
|
1229 QAction *action = qobject_cast<QAction *>(obj);
|
Chris@0
|
1230
|
Chris@0
|
1231 if (!action) {
|
Chris@70
|
1232 cerr << "WARNING: MainWindow::openRecentFile: sender is not an action"
|
Chris@70
|
1233 << endl;
|
gyorgyf@27
|
1234 return;
|
Chris@0
|
1235 }
|
Chris@0
|
1236
|
Chris@0
|
1237 QString path = action->text();
|
Chris@0
|
1238 if (path == "") return;
|
Chris@0
|
1239
|
Chris@1
|
1240 FileOpenStatus status = open(path, ReplaceSession);
|
Chris@0
|
1241
|
Chris@0
|
1242 if (status == FileOpenFailed) {
|
Chris@0
|
1243 QMessageBox::critical(this, tr("Failed to open location"),
|
Chris@0
|
1244 tr("<b>Open failed</b><p>File or URL \"%1\" could not be opened").arg(path));
|
Chris@0
|
1245 } else if (status == FileOpenWrongMode) {
|
Chris@0
|
1246 QMessageBox::critical(this, tr("Failed to open location"),
|
Chris@0
|
1247 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data"));
|
Chris@0
|
1248 }
|
Chris@0
|
1249 }
|
Chris@0
|
1250
|
Chris@0
|
1251 void
|
Chris@0
|
1252 MainWindow::paneAdded(Pane *pane)
|
Chris@0
|
1253 {
|
Chris@6
|
1254 pane->setPlaybackFollow(PlaybackScrollPage);
|
Chris@0
|
1255 m_paneStack->sizePanesEqually();
|
Chris@0
|
1256 if (m_overview) m_overview->registerView(pane);
|
Chris@0
|
1257 }
|
Chris@0
|
1258
|
Chris@0
|
1259 void
|
Chris@0
|
1260 MainWindow::paneHidden(Pane *pane)
|
Chris@0
|
1261 {
|
Chris@0
|
1262 if (m_overview) m_overview->unregisterView(pane);
|
Chris@0
|
1263 }
|
Chris@0
|
1264
|
Chris@0
|
1265 void
|
Chris@0
|
1266 MainWindow::paneAboutToBeDeleted(Pane *pane)
|
Chris@0
|
1267 {
|
Chris@0
|
1268 if (m_overview) m_overview->unregisterView(pane);
|
Chris@0
|
1269 }
|
Chris@0
|
1270
|
Chris@0
|
1271 void
|
Chris@0
|
1272 MainWindow::paneDropAccepted(Pane *pane, QStringList uriList)
|
Chris@0
|
1273 {
|
Chris@4
|
1274 if (pane) m_paneStack->setCurrentPane(pane);
|
Chris@0
|
1275
|
Chris@0
|
1276 for (QStringList::iterator i = uriList.begin(); i != uriList.end(); ++i) {
|
Chris@0
|
1277
|
Chris@1
|
1278 FileOpenStatus status = open(*i, ReplaceSession);
|
Chris@0
|
1279
|
Chris@0
|
1280 if (status == FileOpenFailed) {
|
Chris@0
|
1281 QMessageBox::critical(this, tr("Failed to open dropped URL"),
|
Chris@0
|
1282 tr("<b>Open failed</b><p>Dropped URL \"%1\" could not be opened").arg(*i));
|
Chris@0
|
1283 } else if (status == FileOpenWrongMode) {
|
Chris@0
|
1284 QMessageBox::critical(this, tr("Failed to open dropped URL"),
|
Chris@0
|
1285 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data"));
|
Chris@0
|
1286 }
|
Chris@0
|
1287 }
|
Chris@0
|
1288 }
|
Chris@0
|
1289
|
Chris@0
|
1290 void
|
Chris@0
|
1291 MainWindow::paneDropAccepted(Pane *pane, QString text)
|
Chris@0
|
1292 {
|
Chris@0
|
1293 if (pane) m_paneStack->setCurrentPane(pane);
|
Chris@0
|
1294
|
Chris@0
|
1295 QUrl testUrl(text);
|
Chris@0
|
1296 if (testUrl.scheme() == "file" ||
|
Chris@0
|
1297 testUrl.scheme() == "http" ||
|
Chris@0
|
1298 testUrl.scheme() == "ftp") {
|
Chris@0
|
1299 QStringList list;
|
Chris@0
|
1300 list.push_back(text);
|
Chris@0
|
1301 paneDropAccepted(pane, list);
|
Chris@0
|
1302 return;
|
Chris@0
|
1303 }
|
Chris@0
|
1304
|
Chris@0
|
1305 //!!! open as text -- but by importing as if a CSV, or just adding
|
Chris@0
|
1306 //to a text layer?
|
Chris@0
|
1307 }
|
Chris@0
|
1308
|
Chris@0
|
1309 void
|
Chris@0
|
1310 MainWindow::closeEvent(QCloseEvent *e)
|
Chris@0
|
1311 {
|
Chris@70
|
1312 // cerr << "MainWindow::closeEvent" << endl;
|
Chris@0
|
1313
|
Chris@0
|
1314 if (m_openingAudioFile) {
|
Chris@70
|
1315 // cerr << "Busy - ignoring close event" << endl;
|
gyorgyf@27
|
1316 e->ignore();
|
gyorgyf@27
|
1317 return;
|
Chris@0
|
1318 }
|
Chris@0
|
1319
|
Chris@0
|
1320 if (!m_abandoning && !checkSaveModified()) {
|
Chris@70
|
1321 // cerr << "Ignoring close event" << endl;
|
gyorgyf@27
|
1322 e->ignore();
|
gyorgyf@27
|
1323 return;
|
Chris@0
|
1324 }
|
Chris@0
|
1325
|
Chris@0
|
1326 QSettings settings;
|
Chris@0
|
1327 settings.beginGroup("MainWindow");
|
Chris@0
|
1328 settings.setValue("size", size());
|
Chris@0
|
1329 settings.setValue("position", pos());
|
Chris@0
|
1330 settings.endGroup();
|
Chris@0
|
1331
|
Chris@0
|
1332 delete m_keyReference;
|
Chris@0
|
1333 m_keyReference = 0;
|
Chris@0
|
1334
|
Chris@0
|
1335 closeSession();
|
Chris@0
|
1336
|
Chris@0
|
1337 e->accept();
|
Chris@0
|
1338 return;
|
Chris@0
|
1339 }
|
Chris@0
|
1340
|
Chris@0
|
1341 bool
|
Chris@0
|
1342 MainWindow::commitData(bool mayAskUser)
|
Chris@0
|
1343 {
|
Chris@0
|
1344 if (mayAskUser) {
|
Chris@0
|
1345 bool rv = checkSaveModified();
|
Chris@0
|
1346 return rv;
|
Chris@0
|
1347 } else {
|
Chris@0
|
1348 if (!m_documentModified) return true;
|
Chris@0
|
1349
|
Chris@0
|
1350 // If we can't check with the user first, then we can't save
|
Chris@0
|
1351 // to the original session file (even if we have it) -- have
|
Chris@0
|
1352 // to use a temporary file
|
Chris@0
|
1353
|
Chris@0
|
1354 QString svDirBase = ".sv1";
|
Chris@0
|
1355 QString svDir = QDir::home().filePath(svDirBase);
|
Chris@0
|
1356
|
Chris@0
|
1357 if (!QFileInfo(svDir).exists()) {
|
Chris@0
|
1358 if (!QDir::home().mkdir(svDirBase)) return false;
|
Chris@0
|
1359 } else {
|
Chris@0
|
1360 if (!QFileInfo(svDir).isDir()) return false;
|
Chris@0
|
1361 }
|
Chris@0
|
1362
|
Chris@0
|
1363 // This name doesn't have to be unguessable
|
Chris@0
|
1364 #ifndef _WIN32
|
Chris@0
|
1365 QString fname = QString("tmp-%1-%2.sv")
|
Chris@0
|
1366 .arg(QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"))
|
Chris@0
|
1367 .arg(QProcess().pid());
|
Chris@0
|
1368 #else
|
Chris@0
|
1369 QString fname = QString("tmp-%1.sv")
|
Chris@0
|
1370 .arg(QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"));
|
Chris@0
|
1371 #endif
|
Chris@0
|
1372 QString fpath = QDir(svDir).filePath(fname);
|
Chris@0
|
1373 if (saveSessionFile(fpath)) {
|
Chris@0
|
1374 m_recentFiles.addFile(fpath);
|
Chris@0
|
1375 return true;
|
Chris@0
|
1376 } else {
|
Chris@0
|
1377 return false;
|
Chris@0
|
1378 }
|
Chris@0
|
1379 }
|
Chris@0
|
1380 }
|
Chris@0
|
1381
|
Chris@0
|
1382 bool
|
Chris@0
|
1383 MainWindow::checkSaveModified()
|
Chris@0
|
1384 {
|
Chris@0
|
1385 // Called before some destructive operation (e.g. new session,
|
Chris@0
|
1386 // exit program). Return true if we can safely proceed, false to
|
Chris@0
|
1387 // cancel.
|
Chris@0
|
1388
|
Chris@0
|
1389 if (!m_documentModified) return true;
|
Chris@0
|
1390
|
Chris@0
|
1391 int button =
|
gyorgyf@27
|
1392 QMessageBox::warning(this,
|
gyorgyf@27
|
1393 tr("Session modified"),
|
gyorgyf@27
|
1394 tr("The current session has been modified.\nDo you want to save it?"),
|
gyorgyf@27
|
1395 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
|
Chris@0
|
1396 QMessageBox::Yes);
|
Chris@0
|
1397
|
Chris@0
|
1398 if (button == QMessageBox::Yes) {
|
gyorgyf@27
|
1399 saveSession();
|
gyorgyf@27
|
1400 if (m_documentModified) { // save failed -- don't proceed!
|
gyorgyf@27
|
1401 return false;
|
gyorgyf@27
|
1402 } else {
|
Chris@0
|
1403 return true; // saved, so it's safe to continue now
|
Chris@0
|
1404 }
|
Chris@0
|
1405 } else if (button == QMessageBox::No) {
|
gyorgyf@27
|
1406 m_documentModified = false; // so we know to abandon it
|
gyorgyf@27
|
1407 return true;
|
Chris@0
|
1408 }
|
Chris@0
|
1409
|
Chris@0
|
1410 // else cancel
|
Chris@0
|
1411 return false;
|
Chris@0
|
1412 }
|
Chris@0
|
1413
|
Chris@0
|
1414 void
|
Chris@0
|
1415 MainWindow::saveSession()
|
Chris@0
|
1416 {
|
Chris@0
|
1417 if (m_sessionFile != "") {
|
gyorgyf@27
|
1418 if (!saveSessionFile(m_sessionFile)) {
|
gyorgyf@27
|
1419 QMessageBox::critical(this, tr("Failed to save file"),
|
gyorgyf@27
|
1420 tr("Session file \"%1\" could not be saved.").arg(m_sessionFile));
|
Chris@0
|
1421 } else {
|
gyorgyf@27
|
1422 CommandHistory::getInstance()->documentSaved();
|
gyorgyf@27
|
1423 documentRestored();
|
gyorgyf@27
|
1424 }
|
gyorgyf@27
|
1425 } else {
|
gyorgyf@27
|
1426 saveSessionAs();
|
Chris@0
|
1427 }
|
Chris@0
|
1428 }
|
Chris@0
|
1429
|
Chris@0
|
1430 void
|
Chris@0
|
1431 MainWindow::saveSessionAs()
|
Chris@0
|
1432 {
|
Chris@0
|
1433 QString orig = m_audioFile;
|
Chris@0
|
1434 if (orig == "") orig = ".";
|
Chris@0
|
1435 else orig = QFileInfo(orig).absoluteDir().canonicalPath();
|
Chris@0
|
1436
|
Chris@0
|
1437 QString path = getSaveFileName(FileFinder::SessionFile);
|
Chris@0
|
1438
|
Chris@0
|
1439 if (path == "") return;
|
Chris@0
|
1440
|
Chris@0
|
1441 if (!saveSessionFile(path)) {
|
Chris@85
|
1442 QMessageBox::critical(this, tr("Failed to save file"),
|
Chris@85
|
1443 tr("Session file \"%1\" could not be saved.").arg(path));
|
Chris@0
|
1444 } else {
|
Chris@85
|
1445 setWindowTitle(tr("%1: %2")
|
Chris@0
|
1446 .arg(QApplication::applicationName())
|
Chris@85
|
1447 .arg(QFileInfo(path).fileName()));
|
Chris@85
|
1448 m_sessionFile = path;
|
Chris@85
|
1449 CommandHistory::getInstance()->documentSaved();
|
Chris@85
|
1450 documentRestored();
|
Chris@0
|
1451 m_recentFiles.addFile(path);
|
Chris@0
|
1452 }
|
Chris@0
|
1453 }
|
Chris@0
|
1454
|
Chris@85
|
1455 QString
|
Chris@85
|
1456 MainWindow::exportToSVL(QString path, Layer *layer)
|
Chris@85
|
1457 {
|
Chris@85
|
1458 Model *model = layer->getModel();
|
Chris@85
|
1459
|
Chris@85
|
1460 QFile file(path);
|
Chris@85
|
1461 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
Chris@85
|
1462 return tr("Failed to open file %1 for writing").arg(path);
|
Chris@85
|
1463 } else {
|
Chris@85
|
1464 QTextStream out(&file);
|
Chris@85
|
1465 out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
Chris@85
|
1466 << "<!DOCTYPE sonic-visualiser>\n"
|
Chris@85
|
1467 << "<sv>\n"
|
Chris@85
|
1468 << " <data>\n";
|
Chris@85
|
1469
|
Chris@85
|
1470 model->toXml(out, " ");
|
Chris@85
|
1471
|
Chris@85
|
1472 out << " </data>\n"
|
Chris@85
|
1473 << " <display>\n";
|
Chris@85
|
1474
|
Chris@85
|
1475 layer->toXml(out, " ");
|
Chris@85
|
1476
|
Chris@85
|
1477 out << " </display>\n"
|
Chris@85
|
1478 << "</sv>\n";
|
Chris@85
|
1479
|
Chris@85
|
1480 return "";
|
Chris@85
|
1481 }
|
Chris@85
|
1482 }
|
Chris@85
|
1483
|
Chris@0
|
1484 void
|
Chris@85
|
1485 MainWindow::exportPitchLayer()
|
matthiasm@26
|
1486 {
|
Chris@85
|
1487 Layer *layer = 0;
|
Chris@85
|
1488 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
|
Chris@85
|
1489 Pane *pane = m_paneStack->getPane(i);
|
Chris@85
|
1490 for (int j = 0; j < pane->getLayerCount(); ++j) {
|
Chris@85
|
1491 layer = qobject_cast<TimeValueLayer *>(pane->getLayer(j));
|
Chris@85
|
1492 if (layer) break;
|
Chris@85
|
1493 }
|
Chris@85
|
1494 if (layer) break;
|
Chris@85
|
1495 }
|
matthiasm@26
|
1496
|
matthiasm@26
|
1497 if (!layer) return;
|
matthiasm@26
|
1498
|
Chris@85
|
1499 SparseTimeValueModel *model =
|
Chris@85
|
1500 qobject_cast<SparseTimeValueModel *>(layer->getModel());
|
matthiasm@26
|
1501 if (!model) return;
|
matthiasm@26
|
1502
|
Chris@96
|
1503 FileFinder::FileType type = FileFinder::LayerFileNoMidiNonSV;
|
matthiasm@26
|
1504
|
matthiasm@26
|
1505 QString path = getSaveFileName(type);
|
matthiasm@26
|
1506
|
matthiasm@26
|
1507 if (path == "") return;
|
matthiasm@26
|
1508
|
matthiasm@26
|
1509 if (QFileInfo(path).suffix() == "") path += ".svl";
|
matthiasm@26
|
1510
|
matthiasm@26
|
1511 QString suffix = QFileInfo(path).suffix().toLower();
|
matthiasm@26
|
1512
|
matthiasm@26
|
1513 QString error;
|
matthiasm@26
|
1514
|
matthiasm@26
|
1515 if (suffix == "xml" || suffix == "svl") {
|
matthiasm@26
|
1516
|
Chris@85
|
1517 error = exportToSVL(path, layer);
|
matthiasm@26
|
1518
|
matthiasm@26
|
1519 } else if (suffix == "ttl" || suffix == "n3") {
|
matthiasm@26
|
1520
|
Chris@85
|
1521 RDFExporter exporter(path, model);
|
Chris@85
|
1522 exporter.write();
|
Chris@85
|
1523 if (!exporter.isOK()) {
|
Chris@85
|
1524 error = exporter.getError();
|
Chris@85
|
1525 }
|
Chris@85
|
1526
|
Chris@85
|
1527 } else {
|
Chris@85
|
1528
|
Chris@85
|
1529 CSVFileWriter writer(path, model,
|
Chris@85
|
1530 ((suffix == "csv") ? "," : "\t"));
|
Chris@85
|
1531 writer.write();
|
Chris@85
|
1532
|
Chris@85
|
1533 if (!writer.isOK()) {
|
Chris@85
|
1534 error = writer.getError();
|
Chris@85
|
1535 }
|
Chris@85
|
1536 }
|
Chris@85
|
1537
|
Chris@85
|
1538 if (error != "") {
|
Chris@85
|
1539 QMessageBox::critical(this, tr("Failed to write file"), error);
|
Chris@85
|
1540 } else {
|
Chris@85
|
1541 m_recentFiles.addFile(path);
|
Chris@85
|
1542 emit activity(tr("Export layer to \"%1\"").arg(path));
|
Chris@85
|
1543 }
|
Chris@85
|
1544 }
|
Chris@85
|
1545
|
Chris@85
|
1546 void
|
Chris@85
|
1547 MainWindow::exportNoteLayer()
|
Chris@85
|
1548 {
|
Chris@85
|
1549 Layer *layer = 0;
|
Chris@85
|
1550 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
|
Chris@85
|
1551 Pane *pane = m_paneStack->getPane(i);
|
Chris@85
|
1552 for (int j = 0; j < pane->getLayerCount(); ++j) {
|
Chris@85
|
1553 layer = qobject_cast<FlexiNoteLayer *>(pane->getLayer(j));
|
Chris@85
|
1554 if (layer) break;
|
Chris@85
|
1555 }
|
Chris@85
|
1556 if (layer) break;
|
Chris@85
|
1557 }
|
Chris@85
|
1558
|
Chris@85
|
1559 if (!layer) return;
|
Chris@85
|
1560
|
Chris@85
|
1561 FlexiNoteModel *model = qobject_cast<FlexiNoteModel *>(layer->getModel());
|
Chris@85
|
1562 if (!model) return;
|
Chris@85
|
1563
|
Chris@96
|
1564 FileFinder::FileType type = FileFinder::LayerFileNonSV;
|
Chris@85
|
1565
|
Chris@85
|
1566 QString path = getSaveFileName(type);
|
Chris@85
|
1567
|
Chris@85
|
1568 if (path == "") return;
|
Chris@85
|
1569
|
Chris@85
|
1570 if (QFileInfo(path).suffix() == "") path += ".svl";
|
Chris@85
|
1571
|
Chris@85
|
1572 QString suffix = QFileInfo(path).suffix().toLower();
|
Chris@85
|
1573
|
Chris@85
|
1574 QString error;
|
Chris@85
|
1575
|
Chris@85
|
1576 if (suffix == "xml" || suffix == "svl") {
|
Chris@85
|
1577
|
Chris@85
|
1578 error = exportToSVL(path, layer);
|
Chris@85
|
1579
|
Chris@85
|
1580 } else if (suffix == "mid" || suffix == "midi") {
|
Chris@85
|
1581
|
Chris@85
|
1582 MIDIFileWriter writer(path, model, model->getSampleRate());
|
Chris@85
|
1583 writer.write();
|
Chris@85
|
1584 if (!writer.isOK()) {
|
Chris@85
|
1585 error = writer.getError();
|
Chris@85
|
1586 }
|
Chris@85
|
1587
|
Chris@85
|
1588 } else if (suffix == "ttl" || suffix == "n3") {
|
Chris@85
|
1589
|
Chris@85
|
1590 RDFExporter exporter(path, model);
|
Chris@85
|
1591 exporter.write();
|
Chris@85
|
1592 if (!exporter.isOK()) {
|
Chris@85
|
1593 error = exporter.getError();
|
matthiasm@26
|
1594 }
|
matthiasm@26
|
1595
|
matthiasm@26
|
1596 } else {
|
matthiasm@26
|
1597
|
matthiasm@26
|
1598 CSVFileWriter writer(path, model,
|
matthiasm@26
|
1599 ((suffix == "csv") ? "," : "\t"));
|
matthiasm@26
|
1600 writer.write();
|
matthiasm@26
|
1601
|
matthiasm@26
|
1602 if (!writer.isOK()) {
|
matthiasm@26
|
1603 error = writer.getError();
|
matthiasm@26
|
1604 }
|
matthiasm@26
|
1605 }
|
matthiasm@26
|
1606
|
matthiasm@26
|
1607 if (error != "") {
|
matthiasm@26
|
1608 QMessageBox::critical(this, tr("Failed to write file"), error);
|
matthiasm@26
|
1609 } else {
|
matthiasm@26
|
1610 m_recentFiles.addFile(path);
|
matthiasm@26
|
1611 emit activity(tr("Export layer to \"%1\"").arg(path));
|
matthiasm@26
|
1612 }
|
matthiasm@26
|
1613 }
|
matthiasm@26
|
1614
|
matthiasm@26
|
1615
|
matthiasm@26
|
1616 void
|
Chris@0
|
1617 MainWindow::renameCurrentLayer()
|
Chris@0
|
1618 {
|
Chris@0
|
1619 Pane *pane = m_paneStack->getCurrentPane();
|
Chris@0
|
1620 if (pane) {
|
Chris@139
|
1621 Layer *layer = pane->getSelectedLayer();
|
Chris@139
|
1622 if (layer) {
|
Chris@139
|
1623 bool ok = false;
|
Chris@139
|
1624 QString newName = QInputDialog::getText
|
Chris@139
|
1625 (this, tr("Rename Layer"),
|
Chris@139
|
1626 tr("New name for this layer:"),
|
Chris@139
|
1627 QLineEdit::Normal, layer->objectName(), &ok);
|
Chris@139
|
1628 if (ok) {
|
Chris@139
|
1629 layer->setObjectName(newName);
|
Chris@139
|
1630 }
|
gyorgyf@27
|
1631 }
|
gyorgyf@27
|
1632 }
|
Chris@139
|
1633 }
|
Chris@139
|
1634
|
Chris@139
|
1635 void
|
Chris@139
|
1636 MainWindow::doubleClickSelectInvoked(size_t frame)
|
Chris@139
|
1637 {
|
Chris@139
|
1638 size_t f0, f1;
|
Chris@139
|
1639 m_analyser->getEnclosingSelectionScope(frame, f0, f1);
|
Chris@139
|
1640
|
Chris@139
|
1641 cerr << "MainWindow::doubleClickSelectInvoked(" << frame << "): [" << f0 << "," << f1 << "]" << endl;
|
Chris@139
|
1642
|
Chris@164
|
1643 Selection sel(f0, f1);
|
Chris@164
|
1644 m_viewManager->setSelection(sel);
|
Chris@164
|
1645 }
|
Chris@164
|
1646
|
Chris@164
|
1647 void
|
Chris@167
|
1648 MainWindow::clearSelection()
|
Chris@167
|
1649 {
|
Chris@167
|
1650 cerr << "MainWindow::clearSelection()" << endl;
|
Chris@167
|
1651
|
Chris@168
|
1652 CommandHistory::getInstance()->startCompoundOperation(tr("Clear Selection"), true);
|
Chris@168
|
1653
|
Chris@167
|
1654 m_analyser->clearReAnalysis();
|
Chris@167
|
1655 MainWindowBase::clearSelection();
|
Chris@168
|
1656
|
Chris@168
|
1657 CommandHistory::getInstance()->endCompoundOperation();
|
Chris@167
|
1658 }
|
Chris@167
|
1659
|
Chris@167
|
1660 void
|
Chris@164
|
1661 MainWindow::selectionChanged()
|
Chris@164
|
1662 {
|
Chris@164
|
1663 MultiSelection::SelectionList selections = m_viewManager->getSelections();
|
Chris@164
|
1664
|
Chris@164
|
1665 cerr << "MainWindow::selectionChanged" << endl;
|
Chris@164
|
1666
|
Chris@164
|
1667 if (!selections.empty()) {
|
Chris@164
|
1668 Selection sel = *selections.begin();
|
Chris@164
|
1669 cerr << "MainWindow::selectionChanged: have selection" << endl;
|
Chris@164
|
1670 QString error = m_analyser->reAnalyseSelection(sel);
|
Chris@164
|
1671 if (error != "") {
|
Chris@164
|
1672 QMessageBox::critical
|
Chris@164
|
1673 (this, tr("Failed to analyse selection"),
|
Chris@164
|
1674 tr("<b>Analysis failed</b><p>%2</p>").arg(error));
|
Chris@164
|
1675 }
|
Chris@164
|
1676 }
|
Chris@0
|
1677 }
|
Chris@0
|
1678
|
Chris@0
|
1679 void
|
Chris@168
|
1680 MainWindow::clearPitches()
|
Chris@168
|
1681 {
|
Chris@168
|
1682 MultiSelection::SelectionList selections = m_viewManager->getSelections();
|
Chris@168
|
1683
|
Chris@168
|
1684 CommandHistory::getInstance()->startCompoundOperation(tr("Clear Pitches"), true);
|
Chris@168
|
1685
|
Chris@168
|
1686 for (MultiSelection::SelectionList::iterator k = selections.begin();
|
Chris@168
|
1687 k != selections.end(); ++k) {
|
Chris@168
|
1688 m_analyser->clearPitches(*k);
|
Chris@168
|
1689 }
|
Chris@168
|
1690
|
Chris@168
|
1691 CommandHistory::getInstance()->endCompoundOperation();
|
Chris@168
|
1692 }
|
Chris@168
|
1693
|
Chris@168
|
1694 void
|
Chris@142
|
1695 MainWindow::octaveShiftUp()
|
Chris@142
|
1696 {
|
Chris@142
|
1697 octaveShift(true);
|
Chris@142
|
1698 }
|
Chris@142
|
1699
|
Chris@142
|
1700 void
|
Chris@142
|
1701 MainWindow::octaveShiftDown()
|
Chris@142
|
1702 {
|
Chris@142
|
1703 octaveShift(false);
|
Chris@142
|
1704 }
|
Chris@142
|
1705
|
Chris@142
|
1706 void
|
Chris@142
|
1707 MainWindow::octaveShift(bool up)
|
Chris@142
|
1708 {
|
Chris@142
|
1709 MultiSelection::SelectionList selections = m_viewManager->getSelections();
|
Chris@142
|
1710
|
Chris@142
|
1711 CommandHistory::getInstance()->startCompoundOperation(tr("Octave Shift"), true);
|
Chris@142
|
1712
|
Chris@168
|
1713 for (MultiSelection::SelectionList::iterator k = selections.begin();
|
Chris@168
|
1714 k != selections.end(); ++k) {
|
Chris@142
|
1715
|
Chris@168
|
1716 m_analyser->shiftOctave(*k, up);
|
Chris@142
|
1717 }
|
Chris@142
|
1718
|
Chris@142
|
1719 CommandHistory::getInstance()->endCompoundOperation();
|
Chris@142
|
1720 }
|
Chris@142
|
1721
|
Chris@142
|
1722 void
|
Chris@168
|
1723 MainWindow::switchPitch()
|
Chris@167
|
1724 {
|
Chris@168
|
1725 CommandHistory::getInstance()->startCompoundOperation
|
Chris@168
|
1726 (tr("Switch Pitch Candidate"), true);
|
Chris@168
|
1727
|
Chris@167
|
1728 MultiSelection::SelectionList selections = m_viewManager->getSelections();
|
Chris@167
|
1729
|
Chris@167
|
1730 for (MultiSelection::SelectionList::iterator k = selections.begin();
|
Chris@167
|
1731 k != selections.end(); ++k) {
|
Chris@167
|
1732 m_analyser->switchPitchCandidate(*k, true);
|
Chris@167
|
1733 }
|
Chris@167
|
1734
|
Chris@168
|
1735 CommandHistory::getInstance()->endCompoundOperation();
|
Chris@167
|
1736 }
|
Chris@167
|
1737
|
Chris@167
|
1738 void
|
Chris@0
|
1739 MainWindow::playSpeedChanged(int position)
|
Chris@0
|
1740 {
|
Chris@0
|
1741 PlaySpeedRangeMapper mapper(0, 200);
|
Chris@0
|
1742
|
Chris@0
|
1743 float percent = m_playSpeed->mappedValue();
|
Chris@0
|
1744 float factor = mapper.getFactorForValue(percent);
|
Chris@0
|
1745
|
Chris@70
|
1746 cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << endl;
|
Chris@0
|
1747
|
Chris@0
|
1748 bool something = (position != 100);
|
Chris@0
|
1749
|
Chris@0
|
1750 int pc = lrintf(percent);
|
Chris@0
|
1751
|
Chris@0
|
1752 if (!something) {
|
Chris@0
|
1753 contextHelpChanged(tr("Playback speed: Normal"));
|
Chris@0
|
1754 } else {
|
Chris@0
|
1755 contextHelpChanged(tr("Playback speed: %1%2%")
|
Chris@0
|
1756 .arg(position > 100 ? "+" : "")
|
Chris@0
|
1757 .arg(pc));
|
Chris@0
|
1758 }
|
Chris@0
|
1759
|
Chris@0
|
1760 m_playSource->setTimeStretch(factor);
|
Chris@0
|
1761
|
Chris@0
|
1762 updateMenuStates();
|
Chris@0
|
1763 }
|
Chris@0
|
1764
|
Chris@0
|
1765 void
|
Chris@0
|
1766 MainWindow::playSharpenToggled()
|
Chris@0
|
1767 {
|
Chris@0
|
1768 QSettings settings;
|
Chris@0
|
1769 settings.beginGroup("MainWindow");
|
Chris@0
|
1770 settings.setValue("playsharpen", m_playSharpen->isChecked());
|
Chris@0
|
1771 settings.endGroup();
|
Chris@0
|
1772
|
Chris@0
|
1773 playSpeedChanged(m_playSpeed->value());
|
justin@157
|
1774 // TODO: pitch gain?
|
Chris@0
|
1775 }
|
Chris@0
|
1776
|
Chris@0
|
1777 void
|
Chris@0
|
1778 MainWindow::playMonoToggled()
|
Chris@0
|
1779 {
|
Chris@0
|
1780 QSettings settings;
|
Chris@0
|
1781 settings.beginGroup("MainWindow");
|
Chris@0
|
1782 settings.setValue("playmono", m_playMono->isChecked());
|
Chris@0
|
1783 settings.endGroup();
|
Chris@0
|
1784
|
Chris@0
|
1785 playSpeedChanged(m_playSpeed->value());
|
justin@157
|
1786 // TODO: pitch gain?
|
Chris@0
|
1787 }
|
Chris@0
|
1788
|
Chris@0
|
1789 void
|
Chris@0
|
1790 MainWindow::speedUpPlayback()
|
Chris@0
|
1791 {
|
Chris@0
|
1792 int value = m_playSpeed->value();
|
Chris@0
|
1793 value = value + m_playSpeed->pageStep();
|
Chris@0
|
1794 if (value > m_playSpeed->maximum()) value = m_playSpeed->maximum();
|
Chris@0
|
1795 m_playSpeed->setValue(value);
|
Chris@0
|
1796 }
|
Chris@0
|
1797
|
Chris@0
|
1798 void
|
Chris@0
|
1799 MainWindow::slowDownPlayback()
|
Chris@0
|
1800 {
|
Chris@0
|
1801 int value = m_playSpeed->value();
|
Chris@0
|
1802 value = value - m_playSpeed->pageStep();
|
Chris@0
|
1803 if (value < m_playSpeed->minimum()) value = m_playSpeed->minimum();
|
Chris@0
|
1804 m_playSpeed->setValue(value);
|
Chris@0
|
1805 }
|
Chris@0
|
1806
|
Chris@0
|
1807 void
|
Chris@0
|
1808 MainWindow::restoreNormalPlayback()
|
Chris@0
|
1809 {
|
Chris@0
|
1810 m_playSpeed->setValue(m_playSpeed->defaultValue());
|
Chris@0
|
1811 }
|
Chris@0
|
1812
|
justin@157
|
1813 void
|
justin@159
|
1814 MainWindow::audioGainChanged(int position)
|
justin@159
|
1815 {
|
justin@159
|
1816 float level = m_gainAudio->mappedValue();
|
justin@159
|
1817 float gain = powf(10, level / 20.0);
|
justin@159
|
1818
|
justin@159
|
1819 cerr << "gain = " << gain << " (" << position << " dB)" << endl;
|
justin@159
|
1820
|
justin@159
|
1821 contextHelpChanged(tr("Audio Gain: %1 dB").arg(position));
|
justin@159
|
1822
|
justin@159
|
1823 m_analyser->setGain(Analyser::Audio, gain);
|
justin@159
|
1824
|
justin@159
|
1825 updateMenuStates();
|
justin@159
|
1826 }
|
justin@159
|
1827
|
justin@159
|
1828 void
|
justin@159
|
1829 MainWindow::increaseAudioGain()
|
justin@159
|
1830 {
|
justin@159
|
1831 int value = m_gainAudio->value();
|
justin@159
|
1832 value = value + m_gainAudio->pageStep();
|
justin@159
|
1833 if (value > m_gainAudio->maximum()) value = m_gainAudio->maximum();
|
justin@159
|
1834 m_gainAudio->setValue(value);
|
justin@159
|
1835 }
|
justin@159
|
1836
|
justin@159
|
1837 void
|
justin@159
|
1838 MainWindow::decreaseAudioGain()
|
justin@159
|
1839 {
|
justin@159
|
1840 int value = m_gainAudio->value();
|
justin@159
|
1841 value = value - m_gainAudio->pageStep();
|
justin@159
|
1842 if (value < m_gainAudio->minimum()) value = m_gainAudio->minimum();
|
justin@159
|
1843 m_gainAudio->setValue(value);
|
justin@159
|
1844 }
|
justin@159
|
1845
|
justin@159
|
1846 void
|
justin@159
|
1847 MainWindow::restoreNormalAudioGain()
|
justin@159
|
1848 {
|
justin@159
|
1849 m_gainAudio->setValue(m_gainAudio->defaultValue());
|
justin@159
|
1850 }
|
justin@159
|
1851
|
justin@159
|
1852 void
|
justin@157
|
1853 MainWindow::pitchGainChanged(int position)
|
justin@157
|
1854 {
|
Chris@158
|
1855 float level = m_gainPitch->mappedValue();
|
Chris@158
|
1856 float gain = powf(10, level / 20.0);
|
justin@157
|
1857
|
Chris@158
|
1858 cerr << "gain = " << gain << " (" << position << " dB)" << endl;
|
justin@157
|
1859
|
Chris@158
|
1860 contextHelpChanged(tr("Pitch Gain: %1 dB").arg(position));
|
justin@157
|
1861
|
Chris@158
|
1862 m_analyser->setGain(Analyser::PitchTrack, gain);
|
justin@157
|
1863
|
justin@157
|
1864 updateMenuStates();
|
justin@157
|
1865 }
|
justin@157
|
1866
|
justin@157
|
1867 void
|
justin@157
|
1868 MainWindow::increasePitchGain()
|
justin@157
|
1869 {
|
justin@157
|
1870 int value = m_gainPitch->value();
|
justin@157
|
1871 value = value + m_gainPitch->pageStep();
|
justin@157
|
1872 if (value > m_gainPitch->maximum()) value = m_gainPitch->maximum();
|
justin@157
|
1873 m_gainPitch->setValue(value);
|
justin@157
|
1874 }
|
justin@157
|
1875
|
justin@157
|
1876 void
|
justin@157
|
1877 MainWindow::decreasePitchGain()
|
justin@157
|
1878 {
|
justin@157
|
1879 int value = m_gainPitch->value();
|
justin@157
|
1880 value = value - m_gainPitch->pageStep();
|
justin@157
|
1881 if (value < m_gainPitch->minimum()) value = m_gainPitch->minimum();
|
justin@157
|
1882 m_gainPitch->setValue(value);
|
justin@157
|
1883 }
|
justin@157
|
1884
|
justin@157
|
1885 void
|
justin@157
|
1886 MainWindow::restoreNormalPitchGain()
|
justin@157
|
1887 {
|
justin@157
|
1888 m_gainPitch->setValue(m_gainPitch->defaultValue());
|
justin@157
|
1889 }
|
justin@157
|
1890
|
Chris@0
|
1891 void
|
justin@159
|
1892 MainWindow::notesGainChanged(int position)
|
justin@159
|
1893 {
|
justin@159
|
1894 float level = m_gainNotes->mappedValue();
|
justin@159
|
1895 float gain = powf(10, level / 20.0);
|
justin@159
|
1896
|
justin@159
|
1897 cerr << "gain = " << gain << " (" << position << " dB)" << endl;
|
justin@159
|
1898
|
justin@159
|
1899 contextHelpChanged(tr("Notes Gain: %1 dB").arg(position));
|
justin@159
|
1900
|
justin@159
|
1901 m_analyser->setGain(Analyser::Notes, gain);
|
justin@159
|
1902
|
justin@159
|
1903 updateMenuStates();
|
justin@159
|
1904 }
|
justin@159
|
1905
|
justin@159
|
1906 void
|
justin@159
|
1907 MainWindow::increaseNotesGain()
|
justin@159
|
1908 {
|
justin@159
|
1909 int value = m_gainNotes->value();
|
justin@159
|
1910 value = value + m_gainNotes->pageStep();
|
justin@159
|
1911 if (value > m_gainNotes->maximum()) value = m_gainNotes->maximum();
|
justin@159
|
1912 m_gainNotes->setValue(value);
|
justin@159
|
1913 }
|
justin@159
|
1914
|
justin@159
|
1915 void
|
justin@159
|
1916 MainWindow::decreaseNotesGain()
|
justin@159
|
1917 {
|
justin@159
|
1918 int value = m_gainNotes->value();
|
justin@159
|
1919 value = value - m_gainNotes->pageStep();
|
justin@159
|
1920 if (value < m_gainNotes->minimum()) value = m_gainNotes->minimum();
|
justin@159
|
1921 m_gainNotes->setValue(value);
|
justin@159
|
1922 }
|
justin@159
|
1923
|
justin@159
|
1924 void
|
justin@159
|
1925 MainWindow::restoreNormalNotesGain()
|
justin@159
|
1926 {
|
justin@159
|
1927 m_gainNotes->setValue(m_gainNotes->defaultValue());
|
justin@159
|
1928 }
|
justin@159
|
1929
|
justin@159
|
1930 void
|
justin@160
|
1931 MainWindow::audioPanChanged(int position)
|
justin@160
|
1932 {
|
justin@160
|
1933 float level = m_panAudio->mappedValue();
|
justin@160
|
1934 float pan = level/100.f;
|
justin@160
|
1935
|
justin@160
|
1936 cerr << "pan = " << pan << " (" << position << ")" << endl;
|
justin@160
|
1937
|
justin@160
|
1938 contextHelpChanged(tr("Audio Pan: %1").arg(position));
|
justin@160
|
1939
|
justin@160
|
1940 m_analyser->setPan(Analyser::Audio, pan);
|
justin@160
|
1941
|
justin@160
|
1942 updateMenuStates();
|
justin@160
|
1943 }
|
justin@160
|
1944
|
justin@160
|
1945 void
|
justin@160
|
1946 MainWindow::increaseAudioPan()
|
justin@160
|
1947 {
|
justin@160
|
1948 int value = m_panAudio->value();
|
justin@160
|
1949 value = value + m_panAudio->pageStep();
|
justin@160
|
1950 if (value > m_panAudio->maximum()) value = m_panAudio->maximum();
|
justin@160
|
1951 m_panAudio->setValue(value);
|
justin@160
|
1952 }
|
justin@160
|
1953
|
justin@160
|
1954 void
|
justin@160
|
1955 MainWindow::decreaseAudioPan()
|
justin@160
|
1956 {
|
justin@160
|
1957 int value = m_panAudio->value();
|
justin@160
|
1958 value = value - m_panAudio->pageStep();
|
justin@160
|
1959 if (value < m_panAudio->minimum()) value = m_panAudio->minimum();
|
justin@160
|
1960 m_panAudio->setValue(value);
|
justin@160
|
1961 }
|
justin@160
|
1962
|
justin@160
|
1963 void
|
justin@160
|
1964 MainWindow::restoreNormalAudioPan()
|
justin@160
|
1965 {
|
justin@160
|
1966 m_panAudio->setValue(m_panAudio->defaultValue());
|
justin@160
|
1967 }
|
justin@160
|
1968
|
justin@160
|
1969 void
|
justin@160
|
1970 MainWindow::pitchPanChanged(int position)
|
justin@160
|
1971 {
|
justin@160
|
1972 float level = m_panPitch->mappedValue();
|
justin@160
|
1973 float pan = level/100.f;
|
justin@160
|
1974
|
justin@160
|
1975 cerr << "pan = " << pan << " (" << position << ")" << endl;
|
justin@160
|
1976
|
justin@160
|
1977 contextHelpChanged(tr("Pitch Pan: %1").arg(position));
|
justin@160
|
1978
|
justin@160
|
1979 m_analyser->setPan(Analyser::PitchTrack, pan);
|
justin@160
|
1980
|
justin@160
|
1981 updateMenuStates();
|
justin@160
|
1982 }
|
justin@160
|
1983
|
justin@160
|
1984 void
|
justin@160
|
1985 MainWindow::increasePitchPan()
|
justin@160
|
1986 {
|
justin@160
|
1987 int value = m_panPitch->value();
|
justin@160
|
1988 value = value + m_panPitch->pageStep();
|
justin@160
|
1989 if (value > m_panPitch->maximum()) value = m_panPitch->maximum();
|
justin@160
|
1990 m_panPitch->setValue(value);
|
justin@160
|
1991 }
|
justin@160
|
1992
|
justin@160
|
1993 void
|
justin@160
|
1994 MainWindow::decreasePitchPan()
|
justin@160
|
1995 {
|
justin@160
|
1996 int value = m_panPitch->value();
|
justin@160
|
1997 value = value - m_panPitch->pageStep();
|
justin@160
|
1998 if (value < m_panPitch->minimum()) value = m_panPitch->minimum();
|
justin@160
|
1999 m_panPitch->setValue(value);
|
justin@160
|
2000 }
|
justin@160
|
2001
|
justin@160
|
2002 void
|
justin@160
|
2003 MainWindow::restoreNormalPitchPan()
|
justin@160
|
2004 {
|
justin@160
|
2005 m_panPitch->setValue(m_panPitch->defaultValue());
|
justin@160
|
2006 }
|
justin@160
|
2007
|
justin@160
|
2008 void
|
justin@160
|
2009 MainWindow::notesPanChanged(int position)
|
justin@160
|
2010 {
|
justin@160
|
2011 float level = m_panNotes->mappedValue();
|
justin@160
|
2012 float pan = level/100.f;
|
justin@160
|
2013
|
justin@160
|
2014 cerr << "pan = " << pan << " (" << position << ")" << endl;
|
justin@160
|
2015
|
justin@160
|
2016 contextHelpChanged(tr("Notes Pan: %1").arg(position));
|
justin@160
|
2017
|
justin@160
|
2018 m_analyser->setPan(Analyser::Notes, pan);
|
justin@160
|
2019
|
justin@160
|
2020 updateMenuStates();
|
justin@160
|
2021 }
|
justin@160
|
2022
|
justin@160
|
2023 void
|
justin@160
|
2024 MainWindow::increaseNotesPan()
|
justin@160
|
2025 {
|
justin@160
|
2026 int value = m_panNotes->value();
|
justin@160
|
2027 value = value + m_panNotes->pageStep();
|
justin@160
|
2028 if (value > m_panNotes->maximum()) value = m_panNotes->maximum();
|
justin@160
|
2029 m_panNotes->setValue(value);
|
justin@160
|
2030 }
|
justin@160
|
2031
|
justin@160
|
2032 void
|
justin@160
|
2033 MainWindow::decreaseNotesPan()
|
justin@160
|
2034 {
|
justin@160
|
2035 int value = m_panNotes->value();
|
justin@160
|
2036 value = value - m_panNotes->pageStep();
|
justin@160
|
2037 if (value < m_panNotes->minimum()) value = m_panNotes->minimum();
|
justin@160
|
2038 m_panNotes->setValue(value);
|
justin@160
|
2039 }
|
justin@160
|
2040
|
justin@160
|
2041 void
|
justin@160
|
2042 MainWindow::restoreNormalNotesPan()
|
justin@160
|
2043 {
|
justin@160
|
2044 m_panNotes->setValue(m_panNotes->defaultValue());
|
justin@160
|
2045 }
|
justin@160
|
2046
|
justin@160
|
2047 void
|
Chris@0
|
2048 MainWindow::updateVisibleRangeDisplay(Pane *p) const
|
Chris@0
|
2049 {
|
Chris@0
|
2050 if (!getMainModel() || !p) {
|
Chris@0
|
2051 return;
|
Chris@0
|
2052 }
|
Chris@0
|
2053
|
Chris@0
|
2054 bool haveSelection = false;
|
Chris@0
|
2055 size_t startFrame = 0, endFrame = 0;
|
Chris@0
|
2056
|
Chris@0
|
2057 if (m_viewManager && m_viewManager->haveInProgressSelection()) {
|
Chris@0
|
2058
|
Chris@0
|
2059 bool exclusive = false;
|
Chris@0
|
2060 Selection s = m_viewManager->getInProgressSelection(exclusive);
|
Chris@0
|
2061
|
Chris@0
|
2062 if (!s.isEmpty()) {
|
Chris@0
|
2063 haveSelection = true;
|
Chris@0
|
2064 startFrame = s.getStartFrame();
|
Chris@0
|
2065 endFrame = s.getEndFrame();
|
Chris@0
|
2066 }
|
Chris@0
|
2067 }
|
Chris@0
|
2068
|
Chris@0
|
2069 if (!haveSelection) {
|
Chris@0
|
2070 startFrame = p->getFirstVisibleFrame();
|
Chris@0
|
2071 endFrame = p->getLastVisibleFrame();
|
Chris@0
|
2072 }
|
Chris@0
|
2073
|
Chris@0
|
2074 RealTime start = RealTime::frame2RealTime
|
Chris@0
|
2075 (startFrame, getMainModel()->getSampleRate());
|
Chris@0
|
2076
|
Chris@0
|
2077 RealTime end = RealTime::frame2RealTime
|
Chris@0
|
2078 (endFrame, getMainModel()->getSampleRate());
|
Chris@0
|
2079
|
Chris@0
|
2080 RealTime duration = end - start;
|
Chris@0
|
2081
|
Chris@0
|
2082 QString startStr, endStr, durationStr;
|
Chris@0
|
2083 startStr = start.toText(true).c_str();
|
Chris@0
|
2084 endStr = end.toText(true).c_str();
|
Chris@0
|
2085 durationStr = duration.toText(true).c_str();
|
Chris@0
|
2086
|
Chris@0
|
2087 if (haveSelection) {
|
Chris@0
|
2088 m_myStatusMessage = tr("Selection: %1 to %2 (duration %3)")
|
Chris@0
|
2089 .arg(startStr).arg(endStr).arg(durationStr);
|
Chris@0
|
2090 } else {
|
Chris@0
|
2091 m_myStatusMessage = tr("Visible: %1 to %2 (duration %3)")
|
Chris@0
|
2092 .arg(startStr).arg(endStr).arg(durationStr);
|
Chris@0
|
2093 }
|
matthiasm@42
|
2094
|
matthiasm@42
|
2095 // scale Y axis
|
matthiasm@42
|
2096 FlexiNoteLayer *fnl = dynamic_cast<FlexiNoteLayer *>(p->getLayer(2));
|
matthiasm@42
|
2097 if (fnl) {
|
matthiasm@42
|
2098 fnl->setVerticalRangeToNoteRange(p);
|
matthiasm@42
|
2099 }
|
matthiasm@42
|
2100
|
Chris@0
|
2101 statusBar()->showMessage(m_myStatusMessage);
|
Chris@0
|
2102 }
|
Chris@0
|
2103
|
Chris@0
|
2104 void
|
Chris@0
|
2105 MainWindow::updatePositionStatusDisplays() const
|
Chris@0
|
2106 {
|
Chris@0
|
2107 if (!statusBar()->isVisible()) return;
|
Chris@0
|
2108
|
Chris@0
|
2109 }
|
Chris@0
|
2110
|
Chris@0
|
2111 void
|
Chris@0
|
2112 MainWindow::outputLevelsChanged(float left, float right)
|
Chris@0
|
2113 {
|
Chris@0
|
2114 m_fader->setPeakLeft(left);
|
Chris@0
|
2115 m_fader->setPeakRight(right);
|
Chris@0
|
2116 }
|
Chris@0
|
2117
|
Chris@0
|
2118 void
|
Chris@0
|
2119 MainWindow::sampleRateMismatch(size_t requested, size_t actual,
|
Chris@0
|
2120 bool willResample)
|
Chris@0
|
2121 {
|
Chris@0
|
2122 updateDescriptionLabel();
|
Chris@0
|
2123 }
|
Chris@0
|
2124
|
Chris@0
|
2125 void
|
Chris@0
|
2126 MainWindow::audioOverloadPluginDisabled()
|
Chris@0
|
2127 {
|
Chris@0
|
2128 QMessageBox::information
|
Chris@0
|
2129 (this, tr("Audio processing overload"),
|
Chris@0
|
2130 tr("<b>Overloaded</b><p>Audio effects plugin auditioning has been disabled due to a processing overload."));
|
Chris@0
|
2131 }
|
Chris@0
|
2132
|
Chris@0
|
2133 void
|
Chris@0
|
2134 MainWindow::audioTimeStretchMultiChannelDisabled()
|
Chris@0
|
2135 {
|
Chris@0
|
2136 static bool shownOnce = false;
|
Chris@0
|
2137 if (shownOnce) return;
|
Chris@0
|
2138 QMessageBox::information
|
Chris@0
|
2139 (this, tr("Audio processing overload"),
|
Chris@0
|
2140 tr("<b>Overloaded</b><p>Audio playback speed processing has been reduced to a single channel, due to a processing overload."));
|
Chris@0
|
2141 shownOnce = true;
|
Chris@0
|
2142 }
|
Chris@0
|
2143
|
Chris@0
|
2144 void
|
Chris@0
|
2145 MainWindow::layerRemoved(Layer *layer)
|
Chris@0
|
2146 {
|
Chris@0
|
2147 MainWindowBase::layerRemoved(layer);
|
Chris@0
|
2148 }
|
Chris@0
|
2149
|
Chris@0
|
2150 void
|
Chris@0
|
2151 MainWindow::layerInAView(Layer *layer, bool inAView)
|
Chris@0
|
2152 {
|
Chris@0
|
2153 MainWindowBase::layerInAView(layer, inAView);
|
Chris@0
|
2154 }
|
Chris@0
|
2155
|
Chris@0
|
2156 void
|
Chris@0
|
2157 MainWindow::modelAdded(Model *model)
|
Chris@0
|
2158 {
|
Chris@0
|
2159 MainWindowBase::modelAdded(model);
|
Chris@3
|
2160 DenseTimeValueModel *dtvm = qobject_cast<DenseTimeValueModel *>(model);
|
Chris@0
|
2161 if (dtvm) {
|
Chris@70
|
2162 cerr << "A dense time-value model (such as an audio file) has been loaded" << endl;
|
Chris@0
|
2163 }
|
Chris@0
|
2164 }
|
Chris@0
|
2165
|
Chris@0
|
2166 void
|
Chris@0
|
2167 MainWindow::modelAboutToBeDeleted(Model *model)
|
Chris@0
|
2168 {
|
Chris@0
|
2169 MainWindowBase::modelAboutToBeDeleted(model);
|
Chris@0
|
2170 }
|
Chris@0
|
2171
|
Chris@0
|
2172 void
|
Chris@0
|
2173 MainWindow::mainModelChanged(WaveFileModel *model)
|
Chris@0
|
2174 {
|
Chris@0
|
2175 m_panLayer->setModel(model);
|
Chris@0
|
2176
|
Chris@0
|
2177 MainWindowBase::mainModelChanged(model);
|
Chris@0
|
2178
|
Chris@0
|
2179 if (m_playTarget) {
|
Chris@168
|
2180
|
Chris@0
|
2181 connect(m_fader, SIGNAL(valueChanged(float)),
|
Chris@0
|
2182 m_playTarget, SLOT(setOutputGain(float)));
|
Chris@168
|
2183
|
Chris@168
|
2184 m_playSource->setSelectionMargin(RealTime(2, 0));
|
Chris@0
|
2185 }
|
Chris@72
|
2186
|
Chris@72
|
2187 if (model) {
|
Chris@72
|
2188 if (m_paneStack) {
|
Chris@72
|
2189 Pane *pane = m_paneStack->getCurrentPane();
|
Chris@72
|
2190 if (!pane) {
|
Chris@72
|
2191 pane = m_paneStack->addPane();
|
Chris@131
|
2192
|
Chris@131
|
2193 Pane *selectionStrip = m_paneStack->addPane();
|
Chris@131
|
2194 selectionStrip->setFixedHeight(26);
|
Chris@131
|
2195 m_document->addLayerToView
|
Chris@131
|
2196 (selectionStrip,
|
Chris@131
|
2197 m_document->createMainModelLayer(LayerFactory::TimeRuler));
|
Chris@131
|
2198 m_paneStack->sizePanesEqually();
|
Chris@131
|
2199
|
Chris@131
|
2200 m_viewManager->clearToolModeOverrides();
|
Chris@131
|
2201 m_viewManager->setToolModeFor(selectionStrip,
|
Chris@131
|
2202 ViewManager::SelectMode);
|
Chris@72
|
2203 }
|
Chris@72
|
2204 if (pane) {
|
Chris@140
|
2205 QString error = m_analyser->newFileLoaded
|
Chris@72
|
2206 (m_document, getMainModel(), m_paneStack, pane);
|
Chris@140
|
2207 if (error != "") {
|
Chris@140
|
2208 QMessageBox::warning
|
Chris@140
|
2209 (this,
|
Chris@140
|
2210 tr("Failed to analyse audio"),
|
Chris@140
|
2211 tr("<b>Analysis failed</b><p>%1</p>").arg(error),
|
Chris@140
|
2212 QMessageBox::Ok);
|
Chris@140
|
2213 }
|
Chris@72
|
2214 }
|
Chris@72
|
2215 }
|
Chris@72
|
2216 }
|
Chris@0
|
2217 }
|
Chris@0
|
2218
|
Chris@0
|
2219 void
|
Chris@0
|
2220 MainWindow::modelGenerationFailed(QString transformName, QString message)
|
Chris@0
|
2221 {
|
Chris@0
|
2222 if (message != "") {
|
Chris@0
|
2223
|
Chris@0
|
2224 QMessageBox::warning
|
Chris@0
|
2225 (this,
|
Chris@0
|
2226 tr("Failed to generate layer"),
|
Chris@0
|
2227 tr("<b>Layer generation failed</b><p>Failed to generate derived layer.<p>The layer transform \"%1\" failed:<p>%2")
|
Chris@0
|
2228 .arg(transformName).arg(message),
|
Chris@0
|
2229 QMessageBox::Ok);
|
Chris@0
|
2230 } else {
|
Chris@0
|
2231 QMessageBox::warning
|
Chris@0
|
2232 (this,
|
Chris@0
|
2233 tr("Failed to generate layer"),
|
Chris@0
|
2234 tr("<b>Layer generation failed</b><p>Failed to generate a derived layer.<p>The layer transform \"%1\" failed.<p>No error information is available.")
|
Chris@0
|
2235 .arg(transformName),
|
Chris@0
|
2236 QMessageBox::Ok);
|
Chris@0
|
2237 }
|
Chris@0
|
2238 }
|
Chris@0
|
2239
|
Chris@0
|
2240 void
|
Chris@0
|
2241 MainWindow::modelGenerationWarning(QString transformName, QString message)
|
Chris@0
|
2242 {
|
Chris@0
|
2243 QMessageBox::warning
|
Chris@0
|
2244 (this, tr("Warning"), message, QMessageBox::Ok);
|
Chris@0
|
2245 }
|
Chris@0
|
2246
|
Chris@0
|
2247 void
|
Chris@0
|
2248 MainWindow::modelRegenerationFailed(QString layerName,
|
Chris@0
|
2249 QString transformName, QString message)
|
Chris@0
|
2250 {
|
Chris@0
|
2251 if (message != "") {
|
Chris@0
|
2252
|
Chris@0
|
2253 QMessageBox::warning
|
Chris@0
|
2254 (this,
|
Chris@0
|
2255 tr("Failed to regenerate layer"),
|
Chris@0
|
2256 tr("<b>Layer generation failed</b><p>Failed to regenerate derived layer \"%1\" using new data model as input.<p>The layer transform \"%2\" failed:<p>%3")
|
Chris@0
|
2257 .arg(layerName).arg(transformName).arg(message),
|
Chris@0
|
2258 QMessageBox::Ok);
|
Chris@0
|
2259 } else {
|
Chris@0
|
2260 QMessageBox::warning
|
Chris@0
|
2261 (this,
|
Chris@0
|
2262 tr("Failed to regenerate layer"),
|
Chris@0
|
2263 tr("<b>Layer generation failed</b><p>Failed to regenerate derived layer \"%1\" using new data model as input.<p>The layer transform \"%2\" failed.<p>No error information is available.")
|
Chris@0
|
2264 .arg(layerName).arg(transformName),
|
Chris@0
|
2265 QMessageBox::Ok);
|
Chris@0
|
2266 }
|
Chris@0
|
2267 }
|
Chris@0
|
2268
|
Chris@0
|
2269 void
|
Chris@0
|
2270 MainWindow::modelRegenerationWarning(QString layerName,
|
Chris@0
|
2271 QString transformName, QString message)
|
Chris@0
|
2272 {
|
Chris@0
|
2273 QMessageBox::warning
|
Chris@0
|
2274 (this, tr("Warning"), tr("<b>Warning when regenerating layer</b><p>When regenerating the derived layer \"%1\" using new data model as input:<p>%2").arg(layerName).arg(message), QMessageBox::Ok);
|
Chris@0
|
2275 }
|
Chris@0
|
2276
|
Chris@0
|
2277 void
|
Chris@0
|
2278 MainWindow::alignmentFailed(QString transformName, QString message)
|
Chris@0
|
2279 {
|
Chris@0
|
2280 QMessageBox::warning
|
Chris@0
|
2281 (this,
|
Chris@0
|
2282 tr("Failed to calculate alignment"),
|
Chris@0
|
2283 tr("<b>Alignment calculation failed</b><p>Failed to calculate an audio alignment using transform \"%1\":<p>%2")
|
Chris@0
|
2284 .arg(transformName).arg(message),
|
Chris@0
|
2285 QMessageBox::Ok);
|
Chris@0
|
2286 }
|
Chris@0
|
2287
|
Chris@0
|
2288 void
|
Chris@0
|
2289 MainWindow::rightButtonMenuRequested(Pane *pane, QPoint position)
|
Chris@0
|
2290 {
|
Chris@70
|
2291 // cerr << "MainWindow::rightButtonMenuRequested(" << pane << ", " << position.x() << ", " << position.y() << ")" << endl;
|
Chris@0
|
2292 m_paneStack->setCurrentPane(pane);
|
Chris@0
|
2293 m_rightButtonMenu->popup(position);
|
Chris@0
|
2294 }
|
Chris@0
|
2295
|
Chris@0
|
2296 void
|
Chris@0
|
2297 MainWindow::handleOSCMessage(const OSCMessage &message)
|
Chris@0
|
2298 {
|
Chris@70
|
2299 cerr << "MainWindow::handleOSCMessage: Not implemented" << endl;
|
Chris@0
|
2300 }
|
Chris@0
|
2301
|
Chris@0
|
2302 void
|
Chris@0
|
2303 MainWindow::mouseEnteredWidget()
|
Chris@0
|
2304 {
|
Chris@3
|
2305 QWidget *w = qobject_cast<QWidget *>(sender());
|
Chris@0
|
2306 if (!w) return;
|
Chris@0
|
2307
|
Chris@0
|
2308 if (w == m_fader) {
|
Chris@0
|
2309 contextHelpChanged(tr("Adjust the master playback level"));
|
Chris@0
|
2310 } else if (w == m_playSpeed) {
|
Chris@0
|
2311 contextHelpChanged(tr("Adjust the master playback speed"));
|
Chris@0
|
2312 } else if (w == m_playSharpen && w->isEnabled()) {
|
Chris@0
|
2313 contextHelpChanged(tr("Toggle transient sharpening for playback time scaling"));
|
Chris@0
|
2314 } else if (w == m_playMono && w->isEnabled()) {
|
Chris@0
|
2315 contextHelpChanged(tr("Toggle mono mode for playback time scaling"));
|
Chris@0
|
2316 }
|
Chris@0
|
2317 }
|
Chris@0
|
2318
|
Chris@0
|
2319 void
|
Chris@0
|
2320 MainWindow::mouseLeftWidget()
|
Chris@0
|
2321 {
|
Chris@0
|
2322 contextHelpChanged("");
|
Chris@0
|
2323 }
|
Chris@0
|
2324
|
Chris@0
|
2325 void
|
Chris@0
|
2326 MainWindow::website()
|
Chris@0
|
2327 {
|
Chris@4
|
2328 //!!! todo: URL!
|
Chris@4
|
2329 openHelpUrl(tr("http://code.soundsoftware.ac.uk/projects/tony/"));
|
Chris@0
|
2330 }
|
Chris@0
|
2331
|
Chris@0
|
2332 void
|
Chris@0
|
2333 MainWindow::help()
|
Chris@0
|
2334 {
|
Chris@4
|
2335 //!!! todo: help URL!
|
Chris@4
|
2336 openHelpUrl(tr("http://code.soundsoftware.ac.uk/projects/tony/"));
|
Chris@0
|
2337 }
|
Chris@0
|
2338
|
Chris@0
|
2339 void
|
Chris@0
|
2340 MainWindow::about()
|
Chris@0
|
2341 {
|
Chris@0
|
2342 bool debug = false;
|
Chris@0
|
2343 QString version = "(unknown version)";
|
Chris@0
|
2344
|
Chris@0
|
2345 #ifdef BUILD_DEBUG
|
Chris@0
|
2346 debug = true;
|
Chris@0
|
2347 #endif
|
Chris@0
|
2348 version = tr("Release %1").arg(TONY_VERSION);
|
Chris@0
|
2349
|
Chris@0
|
2350 QString aboutText;
|
Chris@0
|
2351
|
Chris@0
|
2352 aboutText += tr("<h3>About Tony</h3>");
|
Chris@0
|
2353 aboutText += tr("<p>Tony is a program for interactive note and pitch analysis and annotation.</p>");
|
Chris@0
|
2354 aboutText += tr("<p>%1 : %2 configuration</p>")
|
Chris@0
|
2355 .arg(version)
|
Chris@0
|
2356 .arg(debug ? tr("Debug") : tr("Release"));
|
Chris@0
|
2357
|
Chris@0
|
2358 aboutText +=
|
Chris@90
|
2359 "<p>Copyright © 2005–2013 Chris Cannam, Matthias Mauch, George Fazekas, and Queen Mary University of London.</p>"
|
Chris@90
|
2360 "<p>This program is free software; you can redistribute it and/or "
|
Chris@90
|
2361 "modify it under the terms of the GNU General Public License as "
|
Chris@90
|
2362 "published by the Free Software Foundation; either version 2 of the "
|
Chris@0
|
2363 "License, or (at your option) any later version.<br>See the file "
|
Chris@0
|
2364 "COPYING included with this distribution for more information.</p>";
|
Chris@0
|
2365
|
Chris@0
|
2366 QMessageBox::about(this, tr("About %1").arg(QApplication::applicationName()), aboutText);
|
Chris@0
|
2367 }
|
Chris@0
|
2368
|
Chris@0
|
2369 void
|
Chris@0
|
2370 MainWindow::keyReference()
|
Chris@0
|
2371 {
|
Chris@0
|
2372 m_keyReference->show();
|
Chris@0
|
2373 }
|
Chris@0
|
2374
|
Chris@0
|
2375
|