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@6
|
19 #include "Analyser.h"
|
Chris@6
|
20
|
Chris@0
|
21 #include "framework/Document.h"
|
Chris@0
|
22
|
Chris@0
|
23 #include "view/Pane.h"
|
Chris@0
|
24 #include "view/PaneStack.h"
|
Chris@0
|
25 #include "data/model/WaveFileModel.h"
|
matthiasm@26
|
26 #include "data/model/NoteModel.h"
|
matthiasm@26
|
27 #include "data/model/FlexiNoteModel.h"
|
matthiasm@42
|
28 #include "layer/FlexiNoteLayer.h"
|
matthiasm@26
|
29 #include "data/model/NoteModel.h"
|
Chris@0
|
30 #include "view/ViewManager.h"
|
Chris@0
|
31 #include "base/Preferences.h"
|
Chris@0
|
32 #include "layer/WaveformLayer.h"
|
Chris@0
|
33 #include "layer/TimeInstantLayer.h"
|
Chris@0
|
34 #include "layer/TimeValueLayer.h"
|
Chris@0
|
35 #include "widgets/Fader.h"
|
Chris@0
|
36 #include "view/Overview.h"
|
Chris@0
|
37 #include "widgets/AudioDial.h"
|
Chris@0
|
38 #include "widgets/IconLoader.h"
|
Chris@0
|
39 #include "widgets/KeyReference.h"
|
Chris@0
|
40 #include "audioio/AudioCallbackPlaySource.h"
|
Chris@0
|
41 #include "audioio/AudioCallbackPlayTarget.h"
|
Chris@0
|
42 #include "audioio/PlaySpeedRangeMapper.h"
|
Chris@0
|
43 #include "base/Profiler.h"
|
Chris@0
|
44 #include "base/UnitDatabase.h"
|
Chris@0
|
45 #include "layer/ColourDatabase.h"
|
Chris@0
|
46
|
matthiasm@26
|
47 #include "data/fileio/CSVFileWriter.h"
|
matthiasm@26
|
48 #include "data/fileio/MIDIFileWriter.h"
|
matthiasm@26
|
49 #include "rdf/RDFExporter.h"
|
matthiasm@26
|
50
|
Chris@0
|
51 // For version information
|
Chris@0
|
52 #include "vamp/vamp.h"
|
Chris@0
|
53 #include "vamp-sdk/PluginBase.h"
|
Chris@0
|
54 #include "plugin/api/ladspa.h"
|
Chris@0
|
55 #include "plugin/api/dssi.h"
|
Chris@0
|
56
|
Chris@0
|
57 #include <QApplication>
|
Chris@0
|
58 #include <QMessageBox>
|
Chris@0
|
59 #include <QGridLayout>
|
Chris@0
|
60 #include <QLabel>
|
Chris@0
|
61 #include <QMenuBar>
|
Chris@0
|
62 #include <QToolBar>
|
Chris@0
|
63 #include <QToolButton>
|
Chris@0
|
64 #include <QInputDialog>
|
Chris@0
|
65 #include <QStatusBar>
|
Chris@0
|
66 #include <QFileInfo>
|
Chris@0
|
67 #include <QDir>
|
Chris@0
|
68 #include <QProcess>
|
Chris@2
|
69 #include <QPushButton>
|
Chris@0
|
70 #include <QSettings>
|
Chris@0
|
71 #include <QScrollArea>
|
Chris@0
|
72
|
Chris@0
|
73 #include <iostream>
|
Chris@0
|
74 #include <cstdio>
|
Chris@0
|
75 #include <errno.h>
|
Chris@0
|
76
|
Chris@0
|
77 using std::cerr;
|
Chris@0
|
78 using std::endl;
|
Chris@0
|
79
|
Chris@0
|
80 using std::vector;
|
Chris@0
|
81
|
Chris@0
|
82
|
Chris@0
|
83 MainWindow::MainWindow(bool withAudioOutput, bool withOSCSupport) :
|
Chris@0
|
84 MainWindowBase(withAudioOutput, withOSCSupport, false),
|
Chris@0
|
85 m_overview(0),
|
Chris@0
|
86 m_mainMenusCreated(false),
|
Chris@0
|
87 m_playbackMenu(0),
|
Chris@0
|
88 m_recentFilesMenu(0),
|
Chris@0
|
89 m_rightButtonMenu(0),
|
Chris@0
|
90 m_rightButtonPlaybackMenu(0),
|
Chris@0
|
91 m_deleteSelectedAction(0),
|
Chris@0
|
92 m_ffwdAction(0),
|
Chris@0
|
93 m_rwdAction(0),
|
Chris@0
|
94 m_keyReference(new KeyReference())
|
Chris@0
|
95 {
|
Chris@0
|
96 setWindowTitle(QApplication::applicationName());
|
Chris@0
|
97
|
Chris@0
|
98 UnitDatabase *udb = UnitDatabase::getInstance();
|
Chris@0
|
99 udb->registerUnit("Hz");
|
Chris@0
|
100 udb->registerUnit("dB");
|
Chris@0
|
101 udb->registerUnit("s");
|
Chris@0
|
102
|
Chris@0
|
103 ColourDatabase *cdb = ColourDatabase::getInstance();
|
Chris@0
|
104 cdb->addColour(Qt::black, tr("Black"));
|
Chris@0
|
105 cdb->addColour(Qt::darkRed, tr("Red"));
|
Chris@0
|
106 cdb->addColour(Qt::darkBlue, tr("Blue"));
|
Chris@0
|
107 cdb->addColour(Qt::darkGreen, tr("Green"));
|
Chris@0
|
108 cdb->addColour(QColor(200, 50, 255), tr("Purple"));
|
Chris@0
|
109 cdb->addColour(QColor(255, 150, 50), tr("Orange"));
|
Chris@0
|
110 cdb->setUseDarkBackground(cdb->addColour(Qt::white, tr("White")), true);
|
Chris@0
|
111 cdb->setUseDarkBackground(cdb->addColour(Qt::red, tr("Bright Red")), true);
|
Chris@0
|
112 cdb->setUseDarkBackground(cdb->addColour(QColor(30, 150, 255), tr("Bright Blue")), true);
|
Chris@0
|
113 cdb->setUseDarkBackground(cdb->addColour(Qt::green, tr("Bright Green")), true);
|
Chris@0
|
114 cdb->setUseDarkBackground(cdb->addColour(QColor(225, 74, 255), tr("Bright Purple")), true);
|
Chris@0
|
115 cdb->setUseDarkBackground(cdb->addColour(QColor(255, 188, 80), tr("Bright Orange")), true);
|
Chris@0
|
116
|
Chris@0
|
117 Preferences::getInstance()->setResampleOnLoad(true);
|
Chris@0
|
118 Preferences::getInstance()->setSpectrogramSmoothing
|
Chris@0
|
119 (Preferences::SpectrogramInterpolated);
|
Chris@0
|
120
|
Chris@0
|
121 QSettings settings;
|
Chris@0
|
122
|
Chris@0
|
123 settings.beginGroup("MainWindow");
|
Chris@0
|
124 settings.setValue("showstatusbar", false);
|
Chris@0
|
125 settings.endGroup();
|
Chris@0
|
126
|
Chris@6
|
127 m_viewManager->setAlignMode(false);
|
Chris@6
|
128 m_viewManager->setPlaySoloMode(false);
|
Chris@0
|
129 m_viewManager->setToolMode(ViewManager::NavigateMode);
|
Chris@0
|
130 m_viewManager->setZoomWheelsEnabled(false);
|
Chris@6
|
131 m_viewManager->setIlluminateLocalFeatures(true);
|
Chris@0
|
132 m_viewManager->setShowWorkTitle(true);
|
Chris@6
|
133 m_viewManager->setShowCentreLine(false);
|
Chris@6
|
134 m_viewManager->setOverlayMode(ViewManager::NoOverlays);
|
Chris@0
|
135
|
Chris@0
|
136 QFrame *frame = new QFrame;
|
Chris@0
|
137 setCentralWidget(frame);
|
Chris@0
|
138
|
Chris@0
|
139 QGridLayout *layout = new QGridLayout;
|
Chris@0
|
140
|
Chris@0
|
141 QScrollArea *scroll = new QScrollArea(frame);
|
Chris@0
|
142 scroll->setWidgetResizable(true);
|
Chris@0
|
143 scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
Chris@0
|
144 scroll->setFrameShape(QFrame::NoFrame);
|
Chris@0
|
145
|
Chris@6
|
146 // We have a pane stack: it comes with the territory. However, we
|
Chris@6
|
147 // have a fixed and known number of panes in it (e.g. 1) -- it
|
Chris@6
|
148 // isn't variable
|
Chris@0
|
149 m_paneStack->setLayoutStyle(PaneStack::NoPropertyStacks);
|
Chris@0
|
150 scroll->setWidget(m_paneStack);
|
Chris@6
|
151
|
Chris@0
|
152 m_overview = new Overview(frame);
|
Chris@0
|
153 m_overview->setViewManager(m_viewManager);
|
Chris@0
|
154 m_overview->setFixedHeight(40);
|
Chris@0
|
155 #ifndef _WIN32
|
Chris@0
|
156 // For some reason, the contents of the overview never appear if we
|
Chris@0
|
157 // make this setting on Windows. I have no inclination at the moment
|
Chris@0
|
158 // to track down the reason why.
|
Chris@0
|
159 m_overview->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
|
Chris@0
|
160 #endif
|
Chris@0
|
161 connect(m_overview, SIGNAL(contextHelpChanged(const QString &)),
|
Chris@0
|
162 this, SLOT(contextHelpChanged(const QString &)));
|
Chris@0
|
163
|
Chris@0
|
164 m_panLayer = new WaveformLayer;
|
Chris@0
|
165 m_panLayer->setChannelMode(WaveformLayer::MergeChannels);
|
Chris@0
|
166 m_panLayer->setAggressiveCacheing(true);
|
Chris@0
|
167 m_overview->addLayer(m_panLayer);
|
Chris@0
|
168
|
Chris@0
|
169 if (m_viewManager->getGlobalDarkBackground()) {
|
Chris@0
|
170 m_panLayer->setBaseColour
|
Chris@0
|
171 (ColourDatabase::getInstance()->getColourIndex(tr("Bright Green")));
|
Chris@0
|
172 } else {
|
Chris@0
|
173 m_panLayer->setBaseColour
|
matthiasm@13
|
174 (ColourDatabase::getInstance()->getColourIndex(tr("Blue")));
|
Chris@0
|
175 }
|
Chris@0
|
176
|
Chris@0
|
177 m_fader = new Fader(frame, false);
|
Chris@0
|
178 connect(m_fader, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
Chris@0
|
179 connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
Chris@0
|
180
|
Chris@0
|
181 m_playSpeed = new AudioDial(frame);
|
Chris@0
|
182 m_playSpeed->setMinimum(0);
|
Chris@0
|
183 m_playSpeed->setMaximum(200);
|
Chris@0
|
184 m_playSpeed->setValue(100);
|
Chris@0
|
185 m_playSpeed->setFixedWidth(24);
|
Chris@0
|
186 m_playSpeed->setFixedHeight(24);
|
Chris@0
|
187 m_playSpeed->setNotchesVisible(true);
|
Chris@0
|
188 m_playSpeed->setPageStep(10);
|
Chris@0
|
189 m_playSpeed->setObjectName(tr("Playback Speedup"));
|
Chris@0
|
190 m_playSpeed->setDefaultValue(100);
|
Chris@0
|
191 m_playSpeed->setRangeMapper(new PlaySpeedRangeMapper(0, 200));
|
Chris@0
|
192 m_playSpeed->setShowToolTip(true);
|
Chris@0
|
193 connect(m_playSpeed, SIGNAL(valueChanged(int)),
|
gyorgyf@27
|
194 this, SLOT(playSpeedChanged(int)));
|
Chris@0
|
195 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
|
Chris@0
|
196 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
|
Chris@0
|
197
|
Chris@0
|
198 layout->setSpacing(4);
|
Chris@6
|
199 layout->addWidget(m_overview, 0, 1);
|
Chris@6
|
200 layout->addWidget(scroll, 1, 1);
|
Chris@0
|
201
|
Chris@0
|
202 layout->setColumnStretch(1, 10);
|
Chris@0
|
203
|
Chris@0
|
204 frame->setLayout(layout);
|
Chris@0
|
205
|
gyorgyf@21
|
206 m_analyser = new Analyser();
|
gyorgyf@21
|
207
|
Chris@0
|
208 setupMenus();
|
Chris@0
|
209 setupToolbars();
|
Chris@0
|
210 setupHelpMenu();
|
Chris@0
|
211
|
Chris@0
|
212 statusBar();
|
Chris@0
|
213
|
gyorgyf@21
|
214 // m_analyser = new Analyser();
|
Chris@6
|
215
|
Chris@0
|
216 newSession();
|
Chris@0
|
217 }
|
Chris@0
|
218
|
Chris@0
|
219 MainWindow::~MainWindow()
|
Chris@0
|
220 {
|
Chris@6
|
221 delete m_analyser;
|
Chris@0
|
222 delete m_keyReference;
|
Chris@0
|
223 Profiles::getInstance()->dump();
|
Chris@0
|
224 }
|
Chris@0
|
225
|
Chris@0
|
226 void
|
Chris@0
|
227 MainWindow::setupMenus()
|
Chris@0
|
228 {
|
Chris@0
|
229 if (!m_mainMenusCreated) {
|
Chris@0
|
230 m_rightButtonMenu = new QMenu();
|
Chris@0
|
231 }
|
Chris@0
|
232
|
Chris@0
|
233 if (!m_mainMenusCreated) {
|
Chris@0
|
234 CommandHistory::getInstance()->registerMenu(m_rightButtonMenu);
|
Chris@0
|
235 m_rightButtonMenu->addSeparator();
|
Chris@0
|
236 }
|
Chris@0
|
237
|
Chris@0
|
238 setupFileMenu();
|
Chris@0
|
239 setupEditMenu();
|
Chris@0
|
240 setupViewMenu();
|
Chris@0
|
241
|
Chris@0
|
242 m_mainMenusCreated = true;
|
Chris@0
|
243 }
|
Chris@0
|
244
|
Chris@0
|
245 void
|
Chris@0
|
246 MainWindow::setupFileMenu()
|
Chris@0
|
247 {
|
Chris@0
|
248 if (m_mainMenusCreated) return;
|
Chris@0
|
249
|
Chris@0
|
250 QMenu *menu = menuBar()->addMenu(tr("&File"));
|
Chris@0
|
251 menu->setTearOffEnabled(true);
|
Chris@0
|
252 QToolBar *toolbar = addToolBar(tr("File Toolbar"));
|
Chris@0
|
253
|
Chris@0
|
254 m_keyReference->setCategory(tr("File and Session Management"));
|
Chris@0
|
255
|
Chris@0
|
256 IconLoader il;
|
Chris@1
|
257 QIcon icon;
|
Chris@1
|
258 QAction *action;
|
Chris@0
|
259
|
Chris@0
|
260 icon = il.load("fileopen");
|
Chris@0
|
261 icon.addPixmap(il.loadPixmap("fileopen-22"));
|
Chris@1
|
262 action = new QAction(icon, tr("&Open..."), this);
|
Chris@0
|
263 action->setShortcut(tr("Ctrl+O"));
|
Chris@1
|
264 action->setStatusTip(tr("Open a file"));
|
Chris@0
|
265 connect(action, SIGNAL(triggered()), this, SLOT(openFile()));
|
Chris@0
|
266 m_keyReference->registerShortcut(action);
|
Chris@0
|
267 menu->addAction(action);
|
Chris@0
|
268 toolbar->addAction(action);
|
Chris@0
|
269
|
Chris@1
|
270 action = new QAction(tr("Open Lo&cation..."), this);
|
Chris@0
|
271 action->setShortcut(tr("Ctrl+Shift+O"));
|
Chris@1
|
272 action->setStatusTip(tr("Open a file from a remote URL"));
|
Chris@0
|
273 connect(action, SIGNAL(triggered()), this, SLOT(openLocation()));
|
Chris@0
|
274 m_keyReference->registerShortcut(action);
|
Chris@0
|
275 menu->addAction(action);
|
Chris@0
|
276
|
Chris@1
|
277 m_recentFilesMenu = menu->addMenu(tr("Open &Recent"));
|
Chris@0
|
278 m_recentFilesMenu->setTearOffEnabled(true);
|
Chris@0
|
279 setupRecentFilesMenu();
|
Chris@0
|
280 connect(&m_recentFiles, SIGNAL(recentChanged()),
|
Chris@0
|
281 this, SLOT(setupRecentFilesMenu()));
|
Chris@0
|
282
|
Chris@0
|
283 menu->addSeparator();
|
matthiasm@26
|
284 action = new QAction(tr("Export Annotation Layer..."), this);
|
matthiasm@26
|
285 action->setStatusTip(tr("Export layer data to a file"));
|
matthiasm@26
|
286 connect(action, SIGNAL(triggered()), this, SLOT(exportLayer()));
|
matthiasm@26
|
287 connect(this, SIGNAL(canExportLayer(bool)), action, SLOT(setEnabled(bool)));
|
matthiasm@26
|
288 menu->addAction(action);
|
matthiasm@26
|
289
|
matthiasm@26
|
290 menu->addSeparator();
|
Chris@0
|
291 action = new QAction(il.load("exit"), tr("&Quit"), this);
|
Chris@0
|
292 action->setShortcut(tr("Ctrl+Q"));
|
Chris@0
|
293 action->setStatusTip(tr("Exit %1").arg(QApplication::applicationName()));
|
Chris@0
|
294 connect(action, SIGNAL(triggered()), this, SLOT(close()));
|
Chris@0
|
295 m_keyReference->registerShortcut(action);
|
Chris@0
|
296 menu->addAction(action);
|
Chris@0
|
297 }
|
Chris@0
|
298
|
Chris@0
|
299 void
|
Chris@0
|
300 MainWindow::setupEditMenu()
|
Chris@0
|
301 {
|
Chris@0
|
302 if (m_mainMenusCreated) return;
|
Chris@0
|
303
|
Chris@0
|
304 QMenu *menu = menuBar()->addMenu(tr("&Edit"));
|
Chris@0
|
305 menu->setTearOffEnabled(true);
|
Chris@0
|
306 CommandHistory::getInstance()->registerMenu(menu);
|
Chris@0
|
307 }
|
Chris@0
|
308
|
Chris@0
|
309 void
|
Chris@0
|
310 MainWindow::setupViewMenu()
|
Chris@0
|
311 {
|
Chris@0
|
312 if (m_mainMenusCreated) return;
|
Chris@0
|
313
|
Chris@0
|
314 IconLoader il;
|
Chris@0
|
315
|
Chris@0
|
316 QAction *action = 0;
|
Chris@0
|
317
|
Chris@0
|
318 m_keyReference->setCategory(tr("Panning and Navigation"));
|
Chris@0
|
319
|
Chris@0
|
320 QMenu *menu = menuBar()->addMenu(tr("&View"));
|
Chris@0
|
321 menu->setTearOffEnabled(true);
|
Chris@0
|
322 action = new QAction(tr("Scroll &Left"), this);
|
Chris@0
|
323 action->setShortcut(tr("Left"));
|
Chris@0
|
324 action->setStatusTip(tr("Scroll the current pane to the left"));
|
Chris@0
|
325 connect(action, SIGNAL(triggered()), this, SLOT(scrollLeft()));
|
Chris@0
|
326 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
327 m_keyReference->registerShortcut(action);
|
Chris@0
|
328 menu->addAction(action);
|
gyorgyf@27
|
329
|
Chris@0
|
330 action = new QAction(tr("Scroll &Right"), this);
|
Chris@0
|
331 action->setShortcut(tr("Right"));
|
Chris@0
|
332 action->setStatusTip(tr("Scroll the current pane to the right"));
|
Chris@0
|
333 connect(action, SIGNAL(triggered()), this, SLOT(scrollRight()));
|
Chris@0
|
334 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
335 m_keyReference->registerShortcut(action);
|
Chris@0
|
336 menu->addAction(action);
|
gyorgyf@27
|
337
|
Chris@0
|
338 action = new QAction(tr("&Jump Left"), this);
|
Chris@0
|
339 action->setShortcut(tr("Ctrl+Left"));
|
Chris@0
|
340 action->setStatusTip(tr("Scroll the current pane a big step to the left"));
|
Chris@0
|
341 connect(action, SIGNAL(triggered()), this, SLOT(jumpLeft()));
|
Chris@0
|
342 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
343 m_keyReference->registerShortcut(action);
|
Chris@0
|
344 menu->addAction(action);
|
gyorgyf@27
|
345
|
Chris@0
|
346 action = new QAction(tr("J&ump Right"), this);
|
Chris@0
|
347 action->setShortcut(tr("Ctrl+Right"));
|
Chris@0
|
348 action->setStatusTip(tr("Scroll the current pane a big step to the right"));
|
Chris@0
|
349 connect(action, SIGNAL(triggered()), this, SLOT(jumpRight()));
|
Chris@0
|
350 connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
351 m_keyReference->registerShortcut(action);
|
Chris@0
|
352 menu->addAction(action);
|
Chris@0
|
353
|
Chris@0
|
354 menu->addSeparator();
|
Chris@0
|
355
|
Chris@0
|
356 m_keyReference->setCategory(tr("Zoom"));
|
Chris@0
|
357
|
Chris@0
|
358 action = new QAction(il.load("zoom-in"),
|
Chris@0
|
359 tr("Zoom &In"), this);
|
Chris@0
|
360 action->setShortcut(tr("Up"));
|
Chris@0
|
361 action->setStatusTip(tr("Increase the zoom level"));
|
Chris@0
|
362 connect(action, SIGNAL(triggered()), this, SLOT(zoomIn()));
|
Chris@0
|
363 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
364 m_keyReference->registerShortcut(action);
|
Chris@0
|
365 menu->addAction(action);
|
gyorgyf@27
|
366
|
Chris@0
|
367 action = new QAction(il.load("zoom-out"),
|
Chris@0
|
368 tr("Zoom &Out"), this);
|
Chris@0
|
369 action->setShortcut(tr("Down"));
|
Chris@0
|
370 action->setStatusTip(tr("Decrease the zoom level"));
|
Chris@0
|
371 connect(action, SIGNAL(triggered()), this, SLOT(zoomOut()));
|
Chris@0
|
372 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
373 m_keyReference->registerShortcut(action);
|
Chris@0
|
374 menu->addAction(action);
|
gyorgyf@27
|
375
|
Chris@0
|
376 action = new QAction(tr("Restore &Default Zoom"), this);
|
Chris@0
|
377 action->setStatusTip(tr("Restore the zoom level to the default"));
|
Chris@0
|
378 connect(action, SIGNAL(triggered()), this, SLOT(zoomDefault()));
|
Chris@0
|
379 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
380 menu->addAction(action);
|
Chris@0
|
381
|
Chris@0
|
382 action = new QAction(il.load("zoom-fit"),
|
Chris@0
|
383 tr("Zoom to &Fit"), this);
|
Chris@0
|
384 action->setShortcut(tr("F"));
|
Chris@0
|
385 action->setStatusTip(tr("Zoom to show the whole file"));
|
Chris@0
|
386 connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit()));
|
Chris@0
|
387 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
|
Chris@0
|
388 m_keyReference->registerShortcut(action);
|
Chris@0
|
389 menu->addAction(action);
|
Chris@0
|
390 }
|
Chris@0
|
391
|
Chris@0
|
392 void
|
Chris@0
|
393 MainWindow::setupHelpMenu()
|
Chris@0
|
394 {
|
Chris@0
|
395 QMenu *menu = menuBar()->addMenu(tr("&Help"));
|
Chris@0
|
396 menu->setTearOffEnabled(true);
|
Chris@0
|
397
|
Chris@0
|
398 m_keyReference->setCategory(tr("Help"));
|
Chris@0
|
399
|
Chris@0
|
400 IconLoader il;
|
Chris@0
|
401
|
Chris@1
|
402 QString name = QApplication::applicationName();
|
Chris@1
|
403
|
Chris@0
|
404 QAction *action = new QAction(il.load("help"),
|
Chris@0
|
405 tr("&Help Reference"), this);
|
Chris@0
|
406 action->setShortcut(tr("F1"));
|
Chris@1
|
407 action->setStatusTip(tr("Open the %1 reference manual").arg(name));
|
Chris@0
|
408 connect(action, SIGNAL(triggered()), this, SLOT(help()));
|
Chris@0
|
409 m_keyReference->registerShortcut(action);
|
Chris@0
|
410 menu->addAction(action);
|
Chris@0
|
411
|
Chris@0
|
412 action = new QAction(tr("&Key and Mouse Reference"), this);
|
Chris@0
|
413 action->setShortcut(tr("F2"));
|
Chris@1
|
414 action->setStatusTip(tr("Open a window showing the keystrokes you can use in %1").arg(name));
|
Chris@0
|
415 connect(action, SIGNAL(triggered()), this, SLOT(keyReference()));
|
Chris@0
|
416 m_keyReference->registerShortcut(action);
|
Chris@0
|
417 menu->addAction(action);
|
Chris@0
|
418
|
Chris@1
|
419 action = new QAction(tr("%1 on the &Web").arg(name), this);
|
Chris@1
|
420 action->setStatusTip(tr("Open the %1 website").arg(name));
|
Chris@0
|
421 connect(action, SIGNAL(triggered()), this, SLOT(website()));
|
Chris@0
|
422 menu->addAction(action);
|
Chris@0
|
423
|
Chris@1
|
424 action = new QAction(tr("&About %1").arg(name), this);
|
Chris@1
|
425 action->setStatusTip(tr("Show information about %1").arg(name));
|
Chris@0
|
426 connect(action, SIGNAL(triggered()), this, SLOT(about()));
|
Chris@0
|
427 menu->addAction(action);
|
Chris@0
|
428 }
|
Chris@0
|
429
|
Chris@0
|
430 void
|
Chris@0
|
431 MainWindow::setupRecentFilesMenu()
|
Chris@0
|
432 {
|
Chris@0
|
433 m_recentFilesMenu->clear();
|
Chris@0
|
434 vector<QString> files = m_recentFiles.getRecent();
|
Chris@0
|
435 for (size_t i = 0; i < files.size(); ++i) {
|
gyorgyf@27
|
436 QAction *action = new QAction(files[i], this);
|
gyorgyf@27
|
437 connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
|
Chris@0
|
438 if (i == 0) {
|
Chris@0
|
439 action->setShortcut(tr("Ctrl+R"));
|
Chris@0
|
440 m_keyReference->registerShortcut
|
Chris@0
|
441 (tr("Re-open"),
|
Chris@0
|
442 action->shortcut(),
|
Chris@0
|
443 tr("Re-open the current or most recently opened file"));
|
Chris@0
|
444 }
|
gyorgyf@27
|
445 m_recentFilesMenu->addAction(action);
|
Chris@0
|
446 }
|
Chris@0
|
447 }
|
Chris@0
|
448
|
Chris@0
|
449 void
|
Chris@0
|
450 MainWindow::setupToolbars()
|
Chris@0
|
451 {
|
Chris@0
|
452 m_keyReference->setCategory(tr("Playback and Transport Controls"));
|
Chris@0
|
453
|
Chris@0
|
454 IconLoader il;
|
Chris@0
|
455
|
Chris@0
|
456 QMenu *menu = m_playbackMenu = menuBar()->addMenu(tr("Play&back"));
|
Chris@0
|
457 menu->setTearOffEnabled(true);
|
Chris@0
|
458 m_rightButtonMenu->addSeparator();
|
Chris@0
|
459 m_rightButtonPlaybackMenu = m_rightButtonMenu->addMenu(tr("Playback"));
|
Chris@0
|
460
|
Chris@0
|
461 QToolBar *toolbar = addToolBar(tr("Playback Toolbar"));
|
Chris@0
|
462
|
Chris@0
|
463 QAction *rwdStartAction = toolbar->addAction(il.load("rewind-start"),
|
Chris@0
|
464 tr("Rewind to Start"));
|
Chris@0
|
465 rwdStartAction->setShortcut(tr("Home"));
|
Chris@0
|
466 rwdStartAction->setStatusTip(tr("Rewind to the start"));
|
Chris@0
|
467 connect(rwdStartAction, SIGNAL(triggered()), this, SLOT(rewindStart()));
|
Chris@0
|
468 connect(this, SIGNAL(canPlay(bool)), rwdStartAction, SLOT(setEnabled(bool)));
|
Chris@0
|
469
|
Chris@0
|
470 QAction *m_rwdAction = toolbar->addAction(il.load("rewind"),
|
Chris@0
|
471 tr("Rewind"));
|
Chris@0
|
472 m_rwdAction->setShortcut(tr("PgUp"));
|
Chris@0
|
473 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant or time ruler notch"));
|
Chris@0
|
474 connect(m_rwdAction, SIGNAL(triggered()), this, SLOT(rewind()));
|
Chris@0
|
475 connect(this, SIGNAL(canRewind(bool)), m_rwdAction, SLOT(setEnabled(bool)));
|
Chris@0
|
476
|
Chris@0
|
477 QAction *playAction = toolbar->addAction(il.load("playpause"),
|
Chris@0
|
478 tr("Play / Pause"));
|
Chris@0
|
479 playAction->setCheckable(true);
|
Chris@0
|
480 playAction->setShortcut(tr("Space"));
|
Chris@0
|
481 playAction->setStatusTip(tr("Start or stop playback from the current position"));
|
Chris@0
|
482 connect(playAction, SIGNAL(triggered()), this, SLOT(play()));
|
Chris@0
|
483 connect(m_playSource, SIGNAL(playStatusChanged(bool)),
|
gyorgyf@27
|
484 playAction, SLOT(setChecked(bool)));
|
Chris@0
|
485 connect(this, SIGNAL(canPlay(bool)), playAction, SLOT(setEnabled(bool)));
|
Chris@0
|
486
|
Chris@0
|
487 m_ffwdAction = toolbar->addAction(il.load("ffwd"),
|
Chris@0
|
488 tr("Fast Forward"));
|
Chris@0
|
489 m_ffwdAction->setShortcut(tr("PgDown"));
|
Chris@0
|
490 m_ffwdAction->setStatusTip(tr("Fast-forward to the next time instant or time ruler notch"));
|
Chris@0
|
491 connect(m_ffwdAction, SIGNAL(triggered()), this, SLOT(ffwd()));
|
Chris@0
|
492 connect(this, SIGNAL(canFfwd(bool)), m_ffwdAction, SLOT(setEnabled(bool)));
|
Chris@0
|
493
|
Chris@0
|
494 QAction *ffwdEndAction = toolbar->addAction(il.load("ffwd-end"),
|
Chris@0
|
495 tr("Fast Forward to End"));
|
Chris@0
|
496 ffwdEndAction->setShortcut(tr("End"));
|
Chris@0
|
497 ffwdEndAction->setStatusTip(tr("Fast-forward to the end"));
|
Chris@0
|
498 connect(ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd()));
|
Chris@0
|
499 connect(this, SIGNAL(canPlay(bool)), ffwdEndAction, SLOT(setEnabled(bool)));
|
Chris@6
|
500
|
Chris@0
|
501 toolbar = addToolBar(tr("Play Mode Toolbar"));
|
Chris@0
|
502
|
Chris@0
|
503 QAction *psAction = toolbar->addAction(il.load("playselection"),
|
Chris@0
|
504 tr("Constrain Playback to Selection"));
|
Chris@0
|
505 psAction->setCheckable(true);
|
Chris@0
|
506 psAction->setChecked(m_viewManager->getPlaySelectionMode());
|
Chris@0
|
507 psAction->setShortcut(tr("s"));
|
Chris@0
|
508 psAction->setStatusTip(tr("Constrain playback to the selected regions"));
|
Chris@0
|
509 connect(m_viewManager, SIGNAL(playSelectionModeChanged(bool)),
|
Chris@0
|
510 psAction, SLOT(setChecked(bool)));
|
Chris@0
|
511 connect(psAction, SIGNAL(triggered()), this, SLOT(playSelectionToggled()));
|
Chris@0
|
512 connect(this, SIGNAL(canPlaySelection(bool)), psAction, SLOT(setEnabled(bool)));
|
Chris@0
|
513
|
Chris@0
|
514 QAction *plAction = toolbar->addAction(il.load("playloop"),
|
Chris@0
|
515 tr("Loop Playback"));
|
Chris@0
|
516 plAction->setCheckable(true);
|
Chris@0
|
517 plAction->setChecked(m_viewManager->getPlayLoopMode());
|
Chris@0
|
518 plAction->setShortcut(tr("l"));
|
Chris@0
|
519 plAction->setStatusTip(tr("Loop playback"));
|
Chris@0
|
520 connect(m_viewManager, SIGNAL(playLoopModeChanged(bool)),
|
Chris@0
|
521 plAction, SLOT(setChecked(bool)));
|
Chris@0
|
522 connect(plAction, SIGNAL(triggered()), this, SLOT(playLoopToggled()));
|
Chris@0
|
523 connect(this, SIGNAL(canPlay(bool)), plAction, SLOT(setEnabled(bool)));
|
Chris@0
|
524
|
Chris@0
|
525 m_keyReference->registerShortcut(psAction);
|
Chris@0
|
526 m_keyReference->registerShortcut(plAction);
|
Chris@0
|
527 m_keyReference->registerShortcut(playAction);
|
Chris@0
|
528 m_keyReference->registerShortcut(m_rwdAction);
|
Chris@0
|
529 m_keyReference->registerShortcut(m_ffwdAction);
|
Chris@0
|
530 m_keyReference->registerShortcut(rwdStartAction);
|
Chris@0
|
531 m_keyReference->registerShortcut(ffwdEndAction);
|
Chris@0
|
532
|
Chris@6
|
533 menu->addAction(playAction);
|
Chris@0
|
534 menu->addAction(psAction);
|
Chris@0
|
535 menu->addAction(plAction);
|
Chris@0
|
536 menu->addSeparator();
|
Chris@0
|
537 menu->addAction(m_rwdAction);
|
Chris@0
|
538 menu->addAction(m_ffwdAction);
|
Chris@0
|
539 menu->addSeparator();
|
Chris@0
|
540 menu->addAction(rwdStartAction);
|
Chris@0
|
541 menu->addAction(ffwdEndAction);
|
Chris@0
|
542 menu->addSeparator();
|
Chris@0
|
543
|
Chris@0
|
544 m_rightButtonPlaybackMenu->addAction(playAction);
|
Chris@0
|
545 m_rightButtonPlaybackMenu->addAction(psAction);
|
Chris@0
|
546 m_rightButtonPlaybackMenu->addAction(plAction);
|
Chris@0
|
547 m_rightButtonPlaybackMenu->addSeparator();
|
Chris@0
|
548 m_rightButtonPlaybackMenu->addAction(m_rwdAction);
|
Chris@0
|
549 m_rightButtonPlaybackMenu->addAction(m_ffwdAction);
|
Chris@0
|
550 m_rightButtonPlaybackMenu->addSeparator();
|
Chris@0
|
551 m_rightButtonPlaybackMenu->addAction(rwdStartAction);
|
Chris@0
|
552 m_rightButtonPlaybackMenu->addAction(ffwdEndAction);
|
Chris@0
|
553 m_rightButtonPlaybackMenu->addSeparator();
|
Chris@0
|
554
|
Chris@0
|
555 QAction *fastAction = menu->addAction(tr("Speed Up"));
|
Chris@0
|
556 fastAction->setShortcut(tr("Ctrl+PgUp"));
|
Chris@0
|
557 fastAction->setStatusTip(tr("Time-stretch playback to speed it up without changing pitch"));
|
Chris@0
|
558 connect(fastAction, SIGNAL(triggered()), this, SLOT(speedUpPlayback()));
|
Chris@0
|
559 connect(this, SIGNAL(canSpeedUpPlayback(bool)), fastAction, SLOT(setEnabled(bool)));
|
Chris@0
|
560
|
Chris@0
|
561 QAction *slowAction = menu->addAction(tr("Slow Down"));
|
Chris@0
|
562 slowAction->setShortcut(tr("Ctrl+PgDown"));
|
Chris@0
|
563 slowAction->setStatusTip(tr("Time-stretch playback to slow it down without changing pitch"));
|
Chris@0
|
564 connect(slowAction, SIGNAL(triggered()), this, SLOT(slowDownPlayback()));
|
Chris@0
|
565 connect(this, SIGNAL(canSlowDownPlayback(bool)), slowAction, SLOT(setEnabled(bool)));
|
Chris@0
|
566
|
Chris@0
|
567 QAction *normalAction = menu->addAction(tr("Restore Normal Speed"));
|
Chris@0
|
568 normalAction->setShortcut(tr("Ctrl+Home"));
|
Chris@0
|
569 normalAction->setStatusTip(tr("Restore non-time-stretched playback"));
|
Chris@0
|
570 connect(normalAction, SIGNAL(triggered()), this, SLOT(restoreNormalPlayback()));
|
Chris@0
|
571 connect(this, SIGNAL(canChangePlaybackSpeed(bool)), normalAction, SLOT(setEnabled(bool)));
|
Chris@0
|
572
|
Chris@0
|
573 m_keyReference->registerShortcut(fastAction);
|
Chris@0
|
574 m_keyReference->registerShortcut(slowAction);
|
Chris@0
|
575 m_keyReference->registerShortcut(normalAction);
|
Chris@0
|
576
|
Chris@0
|
577 m_rightButtonPlaybackMenu->addAction(fastAction);
|
Chris@0
|
578 m_rightButtonPlaybackMenu->addAction(slowAction);
|
Chris@0
|
579 m_rightButtonPlaybackMenu->addAction(normalAction);
|
Chris@6
|
580
|
Chris@6
|
581 toolbar = addToolBar(tr("Playback Controls"));
|
Chris@6
|
582 toolbar->addWidget(m_playSpeed);
|
Chris@6
|
583 toolbar->addWidget(m_fader);
|
Chris@0
|
584
|
gyorgyf@27
|
585 toolbar = addToolBar(tr("Test actions toolbar")); // GF: temporary toolbar for triggering actions manually
|
gyorgyf@27
|
586
|
gyorgyf@27
|
587 // GF: TEMP : this created a menu item
|
gyorgyf@24
|
588 m_editSelectAction = toolbar->addAction(il.load("move"), tr("Edit"));
|
gyorgyf@24
|
589 m_editSelectAction->setShortcut(tr("Home"));
|
gyorgyf@24
|
590 m_editSelectAction->setStatusTip(tr("Edit Notes"));
|
gyorgyf@27
|
591 m_editSelectAction->setEnabled(true);
|
gyorgyf@21
|
592 // connect(test, SIGNAL(triggered()), this, SLOT(about()));
|
gyorgyf@21
|
593 // connect(test, SIGNAL(triggered()), m_analyser, SLOT(resizeLayer()));
|
gyorgyf@27
|
594 connect(m_editSelectAction, SIGNAL(triggered()), this, SLOT(selectNoteEditMode()));
|
gyorgyf@21
|
595 // connect(this, SIGNAL(canPlay(bool)), test, SLOT(setEnabled(bool)));
|
gyorgyf@27
|
596 menu->addAction(m_editSelectAction);
|
gyorgyf@21
|
597
|
Chris@0
|
598 Pane::registerShortcuts(*m_keyReference);
|
Chris@0
|
599 }
|
Chris@0
|
600
|
Chris@0
|
601 void
|
gyorgyf@27
|
602 MainWindow::selectNoteEditMode()
|
gyorgyf@21
|
603 {
|
gyorgyf@27
|
604 IconLoader il;
|
gyorgyf@27
|
605 if (m_viewManager->getToolMode() == ViewManager::NoteEditMode) {
|
gyorgyf@27
|
606 m_viewManager->setToolMode(ViewManager::NavigateMode);
|
gyorgyf@27
|
607 m_editSelectAction->setIcon(il.load("move"));
|
gyorgyf@27
|
608 } else {
|
gyorgyf@27
|
609 std::cerr << "NoteEdit mode selected" << std::endl;
|
gyorgyf@27
|
610 m_viewManager->setToolMode(ViewManager::NoteEditMode);
|
gyorgyf@27
|
611 m_editSelectAction->setIcon(il.load("navigate"));
|
gyorgyf@27
|
612 m_editSelectAction->setStatusTip(tr("Navigate"));
|
gyorgyf@27
|
613 }
|
gyorgyf@21
|
614 }
|
gyorgyf@21
|
615
|
gyorgyf@21
|
616 void
|
Chris@0
|
617 MainWindow::updateMenuStates()
|
Chris@0
|
618 {
|
Chris@0
|
619 MainWindowBase::updateMenuStates();
|
Chris@0
|
620
|
Chris@0
|
621 Pane *currentPane = 0;
|
Chris@0
|
622 Layer *currentLayer = 0;
|
Chris@0
|
623
|
Chris@0
|
624 if (m_paneStack) currentPane = m_paneStack->getCurrentPane();
|
Chris@0
|
625 if (currentPane) currentLayer = currentPane->getSelectedLayer();
|
Chris@0
|
626
|
Chris@0
|
627 bool haveCurrentPane =
|
Chris@0
|
628 (currentPane != 0);
|
Chris@0
|
629 bool haveCurrentLayer =
|
Chris@0
|
630 (haveCurrentPane &&
|
Chris@0
|
631 (currentLayer != 0));
|
Chris@0
|
632 bool haveSelection =
|
gyorgyf@27
|
633 (m_viewManager &&
|
gyorgyf@27
|
634 !m_viewManager->getSelections().empty());
|
Chris@0
|
635 bool haveCurrentEditableLayer =
|
gyorgyf@27
|
636 (haveCurrentLayer &&
|
gyorgyf@27
|
637 currentLayer->isLayerEditable());
|
Chris@0
|
638 bool haveCurrentTimeInstantsLayer =
|
gyorgyf@27
|
639 (haveCurrentLayer &&
|
gyorgyf@27
|
640 qobject_cast<TimeInstantLayer *>(currentLayer));
|
Chris@0
|
641 bool haveCurrentTimeValueLayer =
|
gyorgyf@27
|
642 (haveCurrentLayer &&
|
gyorgyf@27
|
643 qobject_cast<TimeValueLayer *>(currentLayer));
|
Chris@0
|
644
|
Chris@0
|
645 emit canChangePlaybackSpeed(true);
|
Chris@0
|
646 int v = m_playSpeed->value();
|
Chris@0
|
647 emit canSpeedUpPlayback(v < m_playSpeed->maximum());
|
Chris@0
|
648 emit canSlowDownPlayback(v > m_playSpeed->minimum());
|
Chris@0
|
649
|
Chris@0
|
650 if (m_ffwdAction && m_rwdAction) {
|
Chris@0
|
651 if (haveCurrentTimeInstantsLayer) {
|
Chris@0
|
652 m_ffwdAction->setText(tr("Fast Forward to Next Instant"));
|
Chris@0
|
653 m_ffwdAction->setStatusTip(tr("Fast forward to the next time instant in the current layer"));
|
Chris@0
|
654 m_rwdAction->setText(tr("Rewind to Previous Instant"));
|
Chris@0
|
655 m_rwdAction->setStatusTip(tr("Rewind to the previous time instant in the current layer"));
|
Chris@0
|
656 } else if (haveCurrentTimeValueLayer) {
|
Chris@0
|
657 m_ffwdAction->setText(tr("Fast Forward to Next Point"));
|
Chris@0
|
658 m_ffwdAction->setStatusTip(tr("Fast forward to the next point in the current layer"));
|
Chris@0
|
659 m_rwdAction->setText(tr("Rewind to Previous Point"));
|
Chris@0
|
660 m_rwdAction->setStatusTip(tr("Rewind to the previous point in the current layer"));
|
Chris@0
|
661 } else {
|
Chris@0
|
662 m_ffwdAction->setText(tr("Fast Forward"));
|
Chris@0
|
663 m_ffwdAction->setStatusTip(tr("Fast forward"));
|
Chris@0
|
664 m_rwdAction->setText(tr("Rewind"));
|
Chris@0
|
665 m_rwdAction->setStatusTip(tr("Rewind"));
|
Chris@0
|
666 }
|
Chris@0
|
667 }
|
Chris@0
|
668 }
|
Chris@0
|
669
|
Chris@0
|
670 void
|
Chris@0
|
671 MainWindow::updateDescriptionLabel()
|
Chris@0
|
672 {
|
Chris@6
|
673 // Nothing, we don't have one
|
Chris@0
|
674 }
|
Chris@0
|
675
|
Chris@0
|
676 void
|
Chris@0
|
677 MainWindow::documentModified()
|
Chris@0
|
678 {
|
Chris@0
|
679 MainWindowBase::documentModified();
|
Chris@0
|
680 }
|
Chris@0
|
681
|
Chris@0
|
682 void
|
Chris@0
|
683 MainWindow::documentRestored()
|
Chris@0
|
684 {
|
Chris@0
|
685 MainWindowBase::documentRestored();
|
Chris@0
|
686 }
|
Chris@0
|
687
|
Chris@0
|
688 void
|
Chris@0
|
689 MainWindow::newSession()
|
Chris@0
|
690 {
|
Chris@0
|
691 if (!checkSaveModified()) return;
|
Chris@0
|
692
|
Chris@0
|
693 closeSession();
|
Chris@0
|
694 createDocument();
|
Chris@0
|
695 m_document->setAutoAlignment(true);
|
Chris@0
|
696
|
Chris@0
|
697 Pane *pane = m_paneStack->addPane();
|
Chris@0
|
698
|
Chris@0
|
699 connect(pane, SIGNAL(contextHelpChanged(const QString &)),
|
Chris@0
|
700 this, SLOT(contextHelpChanged(const QString &)));
|
Chris@0
|
701
|
Chris@6
|
702 // Layer *waveform = m_document->createMainModelLayer(LayerFactory::Waveform);
|
Chris@6
|
703 // m_document->addLayerToView(pane, waveform);
|
Chris@0
|
704
|
Chris@0
|
705 m_overview->registerView(pane);
|
Chris@0
|
706
|
Chris@0
|
707 CommandHistory::getInstance()->clear();
|
Chris@0
|
708 CommandHistory::getInstance()->documentSaved();
|
Chris@0
|
709 documentRestored();
|
Chris@0
|
710 updateMenuStates();
|
Chris@0
|
711 }
|
Chris@0
|
712
|
Chris@0
|
713 void
|
Chris@0
|
714 MainWindow::closeSession()
|
Chris@0
|
715 {
|
Chris@0
|
716 if (!checkSaveModified()) return;
|
Chris@0
|
717
|
Chris@0
|
718 while (m_paneStack->getPaneCount() > 0) {
|
Chris@0
|
719
|
gyorgyf@27
|
720 Pane *pane = m_paneStack->getPane(m_paneStack->getPaneCount() - 1);
|
Chris@0
|
721
|
gyorgyf@27
|
722 while (pane->getLayerCount() > 0) {
|
gyorgyf@27
|
723 m_document->removeLayerFromView
|
gyorgyf@27
|
724 (pane, pane->getLayer(pane->getLayerCount() - 1));
|
gyorgyf@27
|
725 }
|
Chris@0
|
726
|
gyorgyf@27
|
727 m_overview->unregisterView(pane);
|
gyorgyf@27
|
728 m_paneStack->deletePane(pane);
|
Chris@0
|
729 }
|
Chris@0
|
730
|
Chris@0
|
731 while (m_paneStack->getHiddenPaneCount() > 0) {
|
Chris@0
|
732
|
gyorgyf@27
|
733 Pane *pane = m_paneStack->getHiddenPane
|
gyorgyf@27
|
734 (m_paneStack->getHiddenPaneCount() - 1);
|
Chris@0
|
735
|
gyorgyf@27
|
736 while (pane->getLayerCount() > 0) {
|
gyorgyf@27
|
737 m_document->removeLayerFromView
|
gyorgyf@27
|
738 (pane, pane->getLayer(pane->getLayerCount() - 1));
|
gyorgyf@27
|
739 }
|
Chris@0
|
740
|
gyorgyf@27
|
741 m_overview->unregisterView(pane);
|
gyorgyf@27
|
742 m_paneStack->deletePane(pane);
|
Chris@0
|
743 }
|
Chris@0
|
744
|
Chris@0
|
745 delete m_document;
|
Chris@0
|
746 m_document = 0;
|
Chris@0
|
747 m_viewManager->clearSelections();
|
Chris@0
|
748 m_timeRulerLayer = 0; // document owned this
|
Chris@0
|
749
|
Chris@0
|
750 m_sessionFile = "";
|
Chris@0
|
751
|
Chris@0
|
752 CommandHistory::getInstance()->clear();
|
Chris@0
|
753 CommandHistory::getInstance()->documentSaved();
|
Chris@0
|
754 documentRestored();
|
Chris@0
|
755 }
|
Chris@0
|
756
|
Chris@0
|
757 void
|
Chris@0
|
758 MainWindow::openFile()
|
Chris@0
|
759 {
|
Chris@0
|
760 QString orig = m_audioFile;
|
Chris@0
|
761 if (orig == "") orig = ".";
|
Chris@0
|
762 else orig = QFileInfo(orig).absoluteDir().canonicalPath();
|
Chris@0
|
763
|
Chris@0
|
764 QString path = getOpenFileName(FileFinder::AnyFile);
|
Chris@0
|
765
|
Chris@0
|
766 if (path.isEmpty()) return;
|
Chris@0
|
767
|
Chris@1
|
768 FileOpenStatus status = open(path, ReplaceSession);
|
Chris@0
|
769
|
Chris@0
|
770 if (status == FileOpenFailed) {
|
Chris@0
|
771 QMessageBox::critical(this, tr("Failed to open file"),
|
Chris@0
|
772 tr("<b>File open failed</b><p>File \"%1\" could not be opened").arg(path));
|
Chris@0
|
773 } else if (status == FileOpenWrongMode) {
|
Chris@0
|
774 QMessageBox::critical(this, tr("Failed to open file"),
|
Chris@0
|
775 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data"));
|
Chris@0
|
776 } else {
|
Chris@0
|
777 configureNewPane(m_paneStack->getCurrentPane());
|
Chris@0
|
778 }
|
Chris@0
|
779 }
|
Chris@0
|
780
|
Chris@0
|
781 void
|
Chris@0
|
782 MainWindow::openLocation()
|
Chris@0
|
783 {
|
Chris@0
|
784 QSettings settings;
|
Chris@0
|
785 settings.beginGroup("MainWindow");
|
Chris@0
|
786 QString lastLocation = settings.value("lastremote", "").toString();
|
Chris@0
|
787
|
Chris@0
|
788 bool ok = false;
|
Chris@0
|
789 QString text = QInputDialog::getText
|
Chris@0
|
790 (this, tr("Open Location"),
|
Chris@0
|
791 tr("Please enter the URL of the location to open:"),
|
Chris@0
|
792 QLineEdit::Normal, lastLocation, &ok);
|
Chris@0
|
793
|
Chris@0
|
794 if (!ok) return;
|
Chris@0
|
795
|
Chris@0
|
796 settings.setValue("lastremote", text);
|
Chris@0
|
797
|
Chris@0
|
798 if (text.isEmpty()) return;
|
Chris@0
|
799
|
Chris@1
|
800 FileOpenStatus status = open(text, ReplaceSession);
|
Chris@0
|
801
|
Chris@0
|
802 if (status == FileOpenFailed) {
|
Chris@0
|
803 QMessageBox::critical(this, tr("Failed to open location"),
|
Chris@0
|
804 tr("<b>Open failed</b><p>URL \"%1\" could not be opened").arg(text));
|
Chris@0
|
805 } else if (status == FileOpenWrongMode) {
|
Chris@0
|
806 QMessageBox::critical(this, tr("Failed to open location"),
|
Chris@0
|
807 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data"));
|
Chris@0
|
808 } else {
|
Chris@0
|
809 configureNewPane(m_paneStack->getCurrentPane());
|
Chris@0
|
810 }
|
Chris@0
|
811 }
|
Chris@0
|
812
|
Chris@0
|
813 void
|
Chris@0
|
814 MainWindow::openRecentFile()
|
Chris@0
|
815 {
|
Chris@0
|
816 QObject *obj = sender();
|
Chris@3
|
817 QAction *action = qobject_cast<QAction *>(obj);
|
Chris@0
|
818
|
Chris@0
|
819 if (!action) {
|
gyorgyf@27
|
820 std::cerr << "WARNING: MainWindow::openRecentFile: sender is not an action"
|
gyorgyf@27
|
821 << std::endl;
|
gyorgyf@27
|
822 return;
|
Chris@0
|
823 }
|
Chris@0
|
824
|
Chris@0
|
825 QString path = action->text();
|
Chris@0
|
826 if (path == "") return;
|
Chris@0
|
827
|
Chris@1
|
828 FileOpenStatus status = open(path, ReplaceSession);
|
Chris@0
|
829
|
Chris@0
|
830 if (status == FileOpenFailed) {
|
Chris@0
|
831 QMessageBox::critical(this, tr("Failed to open location"),
|
Chris@0
|
832 tr("<b>Open failed</b><p>File or URL \"%1\" could not be opened").arg(path));
|
Chris@0
|
833 } else if (status == FileOpenWrongMode) {
|
Chris@0
|
834 QMessageBox::critical(this, tr("Failed to open location"),
|
Chris@0
|
835 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data"));
|
Chris@0
|
836 } else {
|
Chris@0
|
837 configureNewPane(m_paneStack->getCurrentPane());
|
Chris@0
|
838 }
|
Chris@0
|
839 }
|
Chris@0
|
840
|
Chris@0
|
841 void
|
Chris@0
|
842 MainWindow::paneAdded(Pane *pane)
|
Chris@0
|
843 {
|
Chris@6
|
844 pane->setPlaybackFollow(PlaybackScrollPage);
|
Chris@0
|
845 m_paneStack->sizePanesEqually();
|
Chris@0
|
846 if (m_overview) m_overview->registerView(pane);
|
Chris@0
|
847 }
|
Chris@0
|
848
|
Chris@0
|
849 void
|
Chris@0
|
850 MainWindow::paneHidden(Pane *pane)
|
Chris@0
|
851 {
|
Chris@0
|
852 if (m_overview) m_overview->unregisterView(pane);
|
Chris@0
|
853 }
|
Chris@0
|
854
|
Chris@0
|
855 void
|
Chris@0
|
856 MainWindow::paneAboutToBeDeleted(Pane *pane)
|
Chris@0
|
857 {
|
Chris@0
|
858 if (m_overview) m_overview->unregisterView(pane);
|
Chris@0
|
859 }
|
Chris@0
|
860
|
Chris@0
|
861 void
|
Chris@0
|
862 MainWindow::paneDropAccepted(Pane *pane, QStringList uriList)
|
Chris@0
|
863 {
|
Chris@4
|
864 if (pane) m_paneStack->setCurrentPane(pane);
|
Chris@0
|
865
|
Chris@0
|
866 for (QStringList::iterator i = uriList.begin(); i != uriList.end(); ++i) {
|
Chris@0
|
867
|
Chris@1
|
868 FileOpenStatus status = open(*i, ReplaceSession);
|
Chris@0
|
869
|
Chris@0
|
870 if (status == FileOpenFailed) {
|
Chris@0
|
871 QMessageBox::critical(this, tr("Failed to open dropped URL"),
|
Chris@0
|
872 tr("<b>Open failed</b><p>Dropped URL \"%1\" could not be opened").arg(*i));
|
Chris@0
|
873 } else if (status == FileOpenWrongMode) {
|
Chris@0
|
874 QMessageBox::critical(this, tr("Failed to open dropped URL"),
|
Chris@0
|
875 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data"));
|
Chris@0
|
876 } else {
|
Chris@0
|
877 configureNewPane(m_paneStack->getCurrentPane());
|
Chris@0
|
878 }
|
Chris@0
|
879 }
|
Chris@0
|
880 }
|
Chris@0
|
881
|
Chris@0
|
882 void
|
Chris@0
|
883 MainWindow::paneDropAccepted(Pane *pane, QString text)
|
Chris@0
|
884 {
|
Chris@0
|
885 if (pane) m_paneStack->setCurrentPane(pane);
|
Chris@0
|
886
|
Chris@0
|
887 QUrl testUrl(text);
|
Chris@0
|
888 if (testUrl.scheme() == "file" ||
|
Chris@0
|
889 testUrl.scheme() == "http" ||
|
Chris@0
|
890 testUrl.scheme() == "ftp") {
|
Chris@0
|
891 QStringList list;
|
Chris@0
|
892 list.push_back(text);
|
Chris@0
|
893 paneDropAccepted(pane, list);
|
Chris@0
|
894 return;
|
Chris@0
|
895 }
|
Chris@0
|
896
|
Chris@0
|
897 //!!! open as text -- but by importing as if a CSV, or just adding
|
Chris@0
|
898 //to a text layer?
|
Chris@0
|
899 }
|
Chris@0
|
900
|
Chris@0
|
901 void
|
Chris@0
|
902 MainWindow::configureNewPane(Pane *pane)
|
Chris@0
|
903 {
|
Chris@0
|
904 std::cerr << "MainWindow::configureNewPane(" << pane << ")" << std::endl;
|
Chris@0
|
905
|
Chris@6
|
906 if (!pane) {
|
Chris@6
|
907 pane = m_paneStack->addPane();
|
Chris@6
|
908 }
|
Chris@0
|
909
|
Chris@6
|
910 m_analyser->newFileLoaded(m_document, getMainModel(), m_paneStack, pane);
|
Chris@0
|
911 }
|
Chris@0
|
912
|
Chris@0
|
913 void
|
Chris@0
|
914 MainWindow::closeEvent(QCloseEvent *e)
|
Chris@0
|
915 {
|
Chris@0
|
916 // std::cerr << "MainWindow::closeEvent" << std::endl;
|
Chris@0
|
917
|
Chris@0
|
918 if (m_openingAudioFile) {
|
Chris@0
|
919 // std::cerr << "Busy - ignoring close event" << std::endl;
|
gyorgyf@27
|
920 e->ignore();
|
gyorgyf@27
|
921 return;
|
Chris@0
|
922 }
|
Chris@0
|
923
|
Chris@0
|
924 if (!m_abandoning && !checkSaveModified()) {
|
Chris@0
|
925 // std::cerr << "Ignoring close event" << std::endl;
|
gyorgyf@27
|
926 e->ignore();
|
gyorgyf@27
|
927 return;
|
Chris@0
|
928 }
|
Chris@0
|
929
|
Chris@0
|
930 QSettings settings;
|
Chris@0
|
931 settings.beginGroup("MainWindow");
|
Chris@0
|
932 settings.setValue("size", size());
|
Chris@0
|
933 settings.setValue("position", pos());
|
Chris@0
|
934 settings.endGroup();
|
Chris@0
|
935
|
Chris@0
|
936 delete m_keyReference;
|
Chris@0
|
937 m_keyReference = 0;
|
Chris@0
|
938
|
Chris@0
|
939 closeSession();
|
Chris@0
|
940
|
Chris@0
|
941 e->accept();
|
Chris@0
|
942 return;
|
Chris@0
|
943 }
|
Chris@0
|
944
|
Chris@0
|
945 bool
|
Chris@0
|
946 MainWindow::commitData(bool mayAskUser)
|
Chris@0
|
947 {
|
Chris@0
|
948 if (mayAskUser) {
|
Chris@0
|
949 bool rv = checkSaveModified();
|
Chris@0
|
950 return rv;
|
Chris@0
|
951 } else {
|
Chris@0
|
952 if (!m_documentModified) return true;
|
Chris@0
|
953
|
Chris@0
|
954 // If we can't check with the user first, then we can't save
|
Chris@0
|
955 // to the original session file (even if we have it) -- have
|
Chris@0
|
956 // to use a temporary file
|
Chris@0
|
957
|
Chris@0
|
958 QString svDirBase = ".sv1";
|
Chris@0
|
959 QString svDir = QDir::home().filePath(svDirBase);
|
Chris@0
|
960
|
Chris@0
|
961 if (!QFileInfo(svDir).exists()) {
|
Chris@0
|
962 if (!QDir::home().mkdir(svDirBase)) return false;
|
Chris@0
|
963 } else {
|
Chris@0
|
964 if (!QFileInfo(svDir).isDir()) return false;
|
Chris@0
|
965 }
|
Chris@0
|
966
|
Chris@0
|
967 // This name doesn't have to be unguessable
|
Chris@0
|
968 #ifndef _WIN32
|
Chris@0
|
969 QString fname = QString("tmp-%1-%2.sv")
|
Chris@0
|
970 .arg(QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"))
|
Chris@0
|
971 .arg(QProcess().pid());
|
Chris@0
|
972 #else
|
Chris@0
|
973 QString fname = QString("tmp-%1.sv")
|
Chris@0
|
974 .arg(QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"));
|
Chris@0
|
975 #endif
|
Chris@0
|
976 QString fpath = QDir(svDir).filePath(fname);
|
Chris@0
|
977 if (saveSessionFile(fpath)) {
|
Chris@0
|
978 m_recentFiles.addFile(fpath);
|
Chris@0
|
979 return true;
|
Chris@0
|
980 } else {
|
Chris@0
|
981 return false;
|
Chris@0
|
982 }
|
Chris@0
|
983 }
|
Chris@0
|
984 }
|
Chris@0
|
985
|
Chris@0
|
986 bool
|
Chris@0
|
987 MainWindow::checkSaveModified()
|
Chris@0
|
988 {
|
Chris@0
|
989 // Called before some destructive operation (e.g. new session,
|
Chris@0
|
990 // exit program). Return true if we can safely proceed, false to
|
Chris@0
|
991 // cancel.
|
Chris@0
|
992
|
Chris@0
|
993 if (!m_documentModified) return true;
|
Chris@0
|
994
|
Chris@0
|
995 int button =
|
gyorgyf@27
|
996 QMessageBox::warning(this,
|
gyorgyf@27
|
997 tr("Session modified"),
|
gyorgyf@27
|
998 tr("The current session has been modified.\nDo you want to save it?"),
|
gyorgyf@27
|
999 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
|
Chris@0
|
1000 QMessageBox::Yes);
|
Chris@0
|
1001
|
Chris@0
|
1002 if (button == QMessageBox::Yes) {
|
gyorgyf@27
|
1003 saveSession();
|
gyorgyf@27
|
1004 if (m_documentModified) { // save failed -- don't proceed!
|
gyorgyf@27
|
1005 return false;
|
gyorgyf@27
|
1006 } else {
|
Chris@0
|
1007 return true; // saved, so it's safe to continue now
|
Chris@0
|
1008 }
|
Chris@0
|
1009 } else if (button == QMessageBox::No) {
|
gyorgyf@27
|
1010 m_documentModified = false; // so we know to abandon it
|
gyorgyf@27
|
1011 return true;
|
Chris@0
|
1012 }
|
Chris@0
|
1013
|
Chris@0
|
1014 // else cancel
|
Chris@0
|
1015 return false;
|
Chris@0
|
1016 }
|
Chris@0
|
1017
|
Chris@0
|
1018 void
|
Chris@0
|
1019 MainWindow::saveSession()
|
Chris@0
|
1020 {
|
Chris@0
|
1021 if (m_sessionFile != "") {
|
gyorgyf@27
|
1022 if (!saveSessionFile(m_sessionFile)) {
|
gyorgyf@27
|
1023 QMessageBox::critical(this, tr("Failed to save file"),
|
gyorgyf@27
|
1024 tr("Session file \"%1\" could not be saved.").arg(m_sessionFile));
|
Chris@0
|
1025 } else {
|
gyorgyf@27
|
1026 CommandHistory::getInstance()->documentSaved();
|
gyorgyf@27
|
1027 documentRestored();
|
gyorgyf@27
|
1028 }
|
gyorgyf@27
|
1029 } else {
|
gyorgyf@27
|
1030 saveSessionAs();
|
Chris@0
|
1031 }
|
Chris@0
|
1032 }
|
Chris@0
|
1033
|
Chris@0
|
1034 void
|
Chris@0
|
1035 MainWindow::saveSessionAs()
|
Chris@0
|
1036 {
|
Chris@0
|
1037 QString orig = m_audioFile;
|
Chris@0
|
1038 if (orig == "") orig = ".";
|
Chris@0
|
1039 else orig = QFileInfo(orig).absoluteDir().canonicalPath();
|
Chris@0
|
1040
|
Chris@0
|
1041 QString path = getSaveFileName(FileFinder::SessionFile);
|
Chris@0
|
1042
|
Chris@0
|
1043 if (path == "") return;
|
Chris@0
|
1044
|
Chris@0
|
1045 if (!saveSessionFile(path)) {
|
gyorgyf@27
|
1046 QMessageBox::critical(this, tr("Failed to save file"),
|
gyorgyf@27
|
1047 tr("Session file \"%1\" could not be saved.").arg(path));
|
Chris@0
|
1048 } else {
|
gyorgyf@27
|
1049 setWindowTitle(tr("%1: %2")
|
Chris@0
|
1050 .arg(QApplication::applicationName())
|
gyorgyf@27
|
1051 .arg(QFileInfo(path).fileName()));
|
gyorgyf@27
|
1052 m_sessionFile = path;
|
gyorgyf@27
|
1053 CommandHistory::getInstance()->documentSaved();
|
gyorgyf@27
|
1054 documentRestored();
|
Chris@0
|
1055 m_recentFiles.addFile(path);
|
Chris@0
|
1056 }
|
Chris@0
|
1057 }
|
Chris@0
|
1058
|
Chris@0
|
1059 void
|
matthiasm@26
|
1060 MainWindow::exportLayer()
|
matthiasm@26
|
1061 {
|
matthiasm@26
|
1062 Pane *pane = m_paneStack->getCurrentPane();
|
matthiasm@26
|
1063 if (!pane) return;
|
matthiasm@26
|
1064
|
matthiasm@26
|
1065 Layer *layer = pane->getSelectedLayer();
|
matthiasm@26
|
1066 if (!layer) return;
|
matthiasm@26
|
1067
|
matthiasm@26
|
1068 Model *model = layer->getModel();
|
matthiasm@26
|
1069 if (!model) return;
|
matthiasm@26
|
1070
|
matthiasm@26
|
1071 FileFinder::FileType type = FileFinder::LayerFileNoMidi;
|
matthiasm@26
|
1072
|
matthiasm@26
|
1073 if (dynamic_cast<FlexiNoteModel *>(model)) type = FileFinder::LayerFile;
|
matthiasm@26
|
1074
|
matthiasm@26
|
1075 QString path = getSaveFileName(type);
|
matthiasm@26
|
1076
|
matthiasm@26
|
1077 if (path == "") return;
|
matthiasm@26
|
1078
|
matthiasm@26
|
1079 if (QFileInfo(path).suffix() == "") path += ".svl";
|
matthiasm@26
|
1080
|
matthiasm@26
|
1081 QString suffix = QFileInfo(path).suffix().toLower();
|
matthiasm@26
|
1082
|
matthiasm@26
|
1083 QString error;
|
matthiasm@26
|
1084
|
matthiasm@26
|
1085 if (suffix == "xml" || suffix == "svl") {
|
matthiasm@26
|
1086
|
matthiasm@26
|
1087 QFile file(path);
|
matthiasm@26
|
1088 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
matthiasm@26
|
1089 error = tr("Failed to open file %1 for writing").arg(path);
|
matthiasm@26
|
1090 } else {
|
matthiasm@26
|
1091 QTextStream out(&file);
|
matthiasm@26
|
1092 out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
matthiasm@26
|
1093 << "<!DOCTYPE sonic-visualiser>\n"
|
matthiasm@26
|
1094 << "<sv>\n"
|
matthiasm@26
|
1095 << " <data>\n";
|
matthiasm@26
|
1096
|
matthiasm@26
|
1097 model->toXml(out, " ");
|
matthiasm@26
|
1098
|
matthiasm@26
|
1099 out << " </data>\n"
|
matthiasm@26
|
1100 << " <display>\n";
|
matthiasm@26
|
1101
|
matthiasm@26
|
1102 layer->toXml(out, " ");
|
matthiasm@26
|
1103
|
matthiasm@26
|
1104 out << " </display>\n"
|
matthiasm@26
|
1105 << "</sv>\n";
|
matthiasm@26
|
1106 }
|
matthiasm@26
|
1107
|
matthiasm@26
|
1108 // } else if (suffix == "mid" || suffix == "midi") {
|
matthiasm@26
|
1109 //
|
matthiasm@26
|
1110 // FlexiNoteModel *nm = dynamic_cast<FlexiNoteModel *>(model);
|
matthiasm@26
|
1111 //
|
matthiasm@26
|
1112 // if (!nm) {
|
matthiasm@26
|
1113 // error = tr("Can't export non-note layers to MIDI");
|
matthiasm@26
|
1114 // } else {
|
matthiasm@26
|
1115 // MIDIFileWriter writer(path, nm);
|
matthiasm@26
|
1116 // writer.write();
|
matthiasm@26
|
1117 // if (!writer.isOK()) {
|
matthiasm@26
|
1118 // error = writer.getError();
|
matthiasm@26
|
1119 // }
|
matthiasm@26
|
1120 // }
|
matthiasm@26
|
1121
|
matthiasm@26
|
1122 } else if (suffix == "ttl" || suffix == "n3") {
|
matthiasm@26
|
1123
|
matthiasm@26
|
1124 if (!RDFExporter::canExportModel(model)) {
|
matthiasm@26
|
1125 error = tr("Sorry, cannot export this layer type to RDF (supported types are: region, note, text, time instants, time values)");
|
matthiasm@26
|
1126 } else {
|
matthiasm@26
|
1127 RDFExporter exporter(path, model);
|
matthiasm@26
|
1128 exporter.write();
|
matthiasm@26
|
1129 if (!exporter.isOK()) {
|
matthiasm@26
|
1130 error = exporter.getError();
|
matthiasm@26
|
1131 }
|
matthiasm@26
|
1132 }
|
matthiasm@26
|
1133
|
matthiasm@26
|
1134 } else {
|
matthiasm@26
|
1135
|
matthiasm@26
|
1136 CSVFileWriter writer(path, model,
|
matthiasm@26
|
1137 ((suffix == "csv") ? "," : "\t"));
|
matthiasm@26
|
1138 writer.write();
|
matthiasm@26
|
1139
|
matthiasm@26
|
1140 if (!writer.isOK()) {
|
matthiasm@26
|
1141 error = writer.getError();
|
matthiasm@26
|
1142 }
|
matthiasm@26
|
1143 }
|
matthiasm@26
|
1144
|
matthiasm@26
|
1145 if (error != "") {
|
matthiasm@26
|
1146 QMessageBox::critical(this, tr("Failed to write file"), error);
|
matthiasm@26
|
1147 } else {
|
matthiasm@26
|
1148 m_recentFiles.addFile(path);
|
matthiasm@26
|
1149 emit activity(tr("Export layer to \"%1\"").arg(path));
|
matthiasm@26
|
1150 }
|
matthiasm@26
|
1151 }
|
matthiasm@26
|
1152
|
matthiasm@26
|
1153
|
matthiasm@26
|
1154 void
|
Chris@0
|
1155 MainWindow::renameCurrentLayer()
|
Chris@0
|
1156 {
|
Chris@0
|
1157 Pane *pane = m_paneStack->getCurrentPane();
|
Chris@0
|
1158 if (pane) {
|
gyorgyf@27
|
1159 Layer *layer = pane->getSelectedLayer();
|
gyorgyf@27
|
1160 if (layer) {
|
gyorgyf@27
|
1161 bool ok = false;
|
gyorgyf@27
|
1162 QString newName = QInputDialog::getText
|
gyorgyf@27
|
1163 (this, tr("Rename Layer"),
|
gyorgyf@27
|
1164 tr("New name for this layer:"),
|
gyorgyf@27
|
1165 QLineEdit::Normal, layer->objectName(), &ok);
|
gyorgyf@27
|
1166 if (ok) {
|
gyorgyf@27
|
1167 layer->setObjectName(newName);
|
gyorgyf@27
|
1168 }
|
gyorgyf@27
|
1169 }
|
Chris@0
|
1170 }
|
Chris@0
|
1171 }
|
Chris@0
|
1172
|
Chris@0
|
1173 void
|
Chris@0
|
1174 MainWindow::playSpeedChanged(int position)
|
Chris@0
|
1175 {
|
Chris@0
|
1176 PlaySpeedRangeMapper mapper(0, 200);
|
Chris@0
|
1177
|
Chris@0
|
1178 float percent = m_playSpeed->mappedValue();
|
Chris@0
|
1179 float factor = mapper.getFactorForValue(percent);
|
Chris@0
|
1180
|
Chris@0
|
1181 std::cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << std::endl;
|
Chris@0
|
1182
|
Chris@0
|
1183 bool something = (position != 100);
|
Chris@0
|
1184
|
Chris@0
|
1185 int pc = lrintf(percent);
|
Chris@0
|
1186
|
Chris@0
|
1187 if (!something) {
|
Chris@0
|
1188 contextHelpChanged(tr("Playback speed: Normal"));
|
Chris@0
|
1189 } else {
|
Chris@0
|
1190 contextHelpChanged(tr("Playback speed: %1%2%")
|
Chris@0
|
1191 .arg(position > 100 ? "+" : "")
|
Chris@0
|
1192 .arg(pc));
|
Chris@0
|
1193 }
|
Chris@0
|
1194
|
Chris@0
|
1195 m_playSource->setTimeStretch(factor);
|
Chris@0
|
1196
|
Chris@0
|
1197 updateMenuStates();
|
Chris@0
|
1198 }
|
Chris@0
|
1199
|
Chris@0
|
1200 void
|
Chris@0
|
1201 MainWindow::playSharpenToggled()
|
Chris@0
|
1202 {
|
Chris@0
|
1203 QSettings settings;
|
Chris@0
|
1204 settings.beginGroup("MainWindow");
|
Chris@0
|
1205 settings.setValue("playsharpen", m_playSharpen->isChecked());
|
Chris@0
|
1206 settings.endGroup();
|
Chris@0
|
1207
|
Chris@0
|
1208 playSpeedChanged(m_playSpeed->value());
|
Chris@0
|
1209 }
|
Chris@0
|
1210
|
Chris@0
|
1211 void
|
Chris@0
|
1212 MainWindow::playMonoToggled()
|
Chris@0
|
1213 {
|
Chris@0
|
1214 QSettings settings;
|
Chris@0
|
1215 settings.beginGroup("MainWindow");
|
Chris@0
|
1216 settings.setValue("playmono", m_playMono->isChecked());
|
Chris@0
|
1217 settings.endGroup();
|
Chris@0
|
1218
|
Chris@0
|
1219 playSpeedChanged(m_playSpeed->value());
|
Chris@0
|
1220 }
|
Chris@0
|
1221
|
Chris@0
|
1222 void
|
Chris@0
|
1223 MainWindow::speedUpPlayback()
|
Chris@0
|
1224 {
|
Chris@0
|
1225 int value = m_playSpeed->value();
|
Chris@0
|
1226 value = value + m_playSpeed->pageStep();
|
Chris@0
|
1227 if (value > m_playSpeed->maximum()) value = m_playSpeed->maximum();
|
Chris@0
|
1228 m_playSpeed->setValue(value);
|
Chris@0
|
1229 }
|
Chris@0
|
1230
|
Chris@0
|
1231 void
|
Chris@0
|
1232 MainWindow::slowDownPlayback()
|
Chris@0
|
1233 {
|
Chris@0
|
1234 int value = m_playSpeed->value();
|
Chris@0
|
1235 value = value - m_playSpeed->pageStep();
|
Chris@0
|
1236 if (value < m_playSpeed->minimum()) value = m_playSpeed->minimum();
|
Chris@0
|
1237 m_playSpeed->setValue(value);
|
Chris@0
|
1238 }
|
Chris@0
|
1239
|
Chris@0
|
1240 void
|
Chris@0
|
1241 MainWindow::restoreNormalPlayback()
|
Chris@0
|
1242 {
|
Chris@0
|
1243 m_playSpeed->setValue(m_playSpeed->defaultValue());
|
Chris@0
|
1244 }
|
Chris@0
|
1245
|
Chris@0
|
1246 void
|
Chris@0
|
1247 MainWindow::updateVisibleRangeDisplay(Pane *p) const
|
Chris@0
|
1248 {
|
Chris@0
|
1249 if (!getMainModel() || !p) {
|
Chris@0
|
1250 return;
|
Chris@0
|
1251 }
|
Chris@0
|
1252
|
Chris@0
|
1253 bool haveSelection = false;
|
Chris@0
|
1254 size_t startFrame = 0, endFrame = 0;
|
Chris@0
|
1255
|
Chris@0
|
1256 if (m_viewManager && m_viewManager->haveInProgressSelection()) {
|
Chris@0
|
1257
|
Chris@0
|
1258 bool exclusive = false;
|
Chris@0
|
1259 Selection s = m_viewManager->getInProgressSelection(exclusive);
|
Chris@0
|
1260
|
Chris@0
|
1261 if (!s.isEmpty()) {
|
Chris@0
|
1262 haveSelection = true;
|
Chris@0
|
1263 startFrame = s.getStartFrame();
|
Chris@0
|
1264 endFrame = s.getEndFrame();
|
Chris@0
|
1265 }
|
Chris@0
|
1266 }
|
Chris@0
|
1267
|
Chris@0
|
1268 if (!haveSelection) {
|
Chris@0
|
1269 startFrame = p->getFirstVisibleFrame();
|
Chris@0
|
1270 endFrame = p->getLastVisibleFrame();
|
Chris@0
|
1271 }
|
Chris@0
|
1272
|
Chris@0
|
1273 RealTime start = RealTime::frame2RealTime
|
Chris@0
|
1274 (startFrame, getMainModel()->getSampleRate());
|
Chris@0
|
1275
|
Chris@0
|
1276 RealTime end = RealTime::frame2RealTime
|
Chris@0
|
1277 (endFrame, getMainModel()->getSampleRate());
|
Chris@0
|
1278
|
Chris@0
|
1279 RealTime duration = end - start;
|
Chris@0
|
1280
|
Chris@0
|
1281 QString startStr, endStr, durationStr;
|
Chris@0
|
1282 startStr = start.toText(true).c_str();
|
Chris@0
|
1283 endStr = end.toText(true).c_str();
|
Chris@0
|
1284 durationStr = duration.toText(true).c_str();
|
Chris@0
|
1285
|
Chris@0
|
1286 if (haveSelection) {
|
Chris@0
|
1287 m_myStatusMessage = tr("Selection: %1 to %2 (duration %3)")
|
Chris@0
|
1288 .arg(startStr).arg(endStr).arg(durationStr);
|
Chris@0
|
1289 } else {
|
Chris@0
|
1290 m_myStatusMessage = tr("Visible: %1 to %2 (duration %3)")
|
Chris@0
|
1291 .arg(startStr).arg(endStr).arg(durationStr);
|
Chris@0
|
1292 }
|
matthiasm@42
|
1293
|
matthiasm@42
|
1294 // scale Y axis
|
matthiasm@42
|
1295 FlexiNoteLayer *fnl = dynamic_cast<FlexiNoteLayer *>(p->getLayer(2));
|
matthiasm@42
|
1296 if (fnl) {
|
matthiasm@42
|
1297 fnl->setVerticalRangeToNoteRange(p);
|
matthiasm@42
|
1298 }
|
matthiasm@42
|
1299
|
Chris@0
|
1300 statusBar()->showMessage(m_myStatusMessage);
|
Chris@0
|
1301 }
|
Chris@0
|
1302
|
Chris@0
|
1303 void
|
Chris@0
|
1304 MainWindow::updatePositionStatusDisplays() const
|
Chris@0
|
1305 {
|
Chris@0
|
1306 if (!statusBar()->isVisible()) return;
|
Chris@0
|
1307
|
Chris@0
|
1308 }
|
Chris@0
|
1309
|
Chris@0
|
1310 void
|
Chris@0
|
1311 MainWindow::outputLevelsChanged(float left, float right)
|
Chris@0
|
1312 {
|
Chris@0
|
1313 m_fader->setPeakLeft(left);
|
Chris@0
|
1314 m_fader->setPeakRight(right);
|
Chris@0
|
1315 }
|
Chris@0
|
1316
|
Chris@0
|
1317 void
|
Chris@0
|
1318 MainWindow::sampleRateMismatch(size_t requested, size_t actual,
|
Chris@0
|
1319 bool willResample)
|
Chris@0
|
1320 {
|
Chris@0
|
1321 updateDescriptionLabel();
|
Chris@0
|
1322 }
|
Chris@0
|
1323
|
Chris@0
|
1324 void
|
Chris@0
|
1325 MainWindow::audioOverloadPluginDisabled()
|
Chris@0
|
1326 {
|
Chris@0
|
1327 QMessageBox::information
|
Chris@0
|
1328 (this, tr("Audio processing overload"),
|
Chris@0
|
1329 tr("<b>Overloaded</b><p>Audio effects plugin auditioning has been disabled due to a processing overload."));
|
Chris@0
|
1330 }
|
Chris@0
|
1331
|
Chris@0
|
1332 void
|
Chris@0
|
1333 MainWindow::audioTimeStretchMultiChannelDisabled()
|
Chris@0
|
1334 {
|
Chris@0
|
1335 static bool shownOnce = false;
|
Chris@0
|
1336 if (shownOnce) return;
|
Chris@0
|
1337 QMessageBox::information
|
Chris@0
|
1338 (this, tr("Audio processing overload"),
|
Chris@0
|
1339 tr("<b>Overloaded</b><p>Audio playback speed processing has been reduced to a single channel, due to a processing overload."));
|
Chris@0
|
1340 shownOnce = true;
|
Chris@0
|
1341 }
|
Chris@0
|
1342
|
Chris@0
|
1343 void
|
Chris@0
|
1344 MainWindow::layerRemoved(Layer *layer)
|
Chris@0
|
1345 {
|
Chris@0
|
1346 MainWindowBase::layerRemoved(layer);
|
Chris@0
|
1347 }
|
Chris@0
|
1348
|
Chris@0
|
1349 void
|
Chris@0
|
1350 MainWindow::layerInAView(Layer *layer, bool inAView)
|
Chris@0
|
1351 {
|
Chris@0
|
1352 MainWindowBase::layerInAView(layer, inAView);
|
Chris@0
|
1353 }
|
Chris@0
|
1354
|
Chris@0
|
1355 void
|
Chris@0
|
1356 MainWindow::modelAdded(Model *model)
|
Chris@0
|
1357 {
|
Chris@0
|
1358 MainWindowBase::modelAdded(model);
|
Chris@3
|
1359 DenseTimeValueModel *dtvm = qobject_cast<DenseTimeValueModel *>(model);
|
Chris@0
|
1360 if (dtvm) {
|
Chris@0
|
1361 std::cerr << "A dense time-value model (such as an audio file) has been loaded" << std::endl;
|
Chris@0
|
1362 }
|
Chris@0
|
1363 }
|
Chris@0
|
1364
|
Chris@0
|
1365 void
|
Chris@0
|
1366 MainWindow::modelAboutToBeDeleted(Model *model)
|
Chris@0
|
1367 {
|
Chris@0
|
1368 MainWindowBase::modelAboutToBeDeleted(model);
|
Chris@0
|
1369 }
|
Chris@0
|
1370
|
Chris@0
|
1371 void
|
Chris@0
|
1372 MainWindow::mainModelChanged(WaveFileModel *model)
|
Chris@0
|
1373 {
|
Chris@0
|
1374 m_panLayer->setModel(model);
|
Chris@0
|
1375
|
Chris@0
|
1376 MainWindowBase::mainModelChanged(model);
|
Chris@0
|
1377
|
Chris@0
|
1378 if (m_playTarget) {
|
Chris@0
|
1379 connect(m_fader, SIGNAL(valueChanged(float)),
|
Chris@0
|
1380 m_playTarget, SLOT(setOutputGain(float)));
|
Chris@0
|
1381 }
|
Chris@0
|
1382 }
|
Chris@0
|
1383
|
Chris@0
|
1384 void
|
Chris@0
|
1385 MainWindow::modelGenerationFailed(QString transformName, QString message)
|
Chris@0
|
1386 {
|
Chris@0
|
1387 if (message != "") {
|
Chris@0
|
1388
|
Chris@0
|
1389 QMessageBox::warning
|
Chris@0
|
1390 (this,
|
Chris@0
|
1391 tr("Failed to generate layer"),
|
Chris@0
|
1392 tr("<b>Layer generation failed</b><p>Failed to generate derived layer.<p>The layer transform \"%1\" failed:<p>%2")
|
Chris@0
|
1393 .arg(transformName).arg(message),
|
Chris@0
|
1394 QMessageBox::Ok);
|
Chris@0
|
1395 } else {
|
Chris@0
|
1396 QMessageBox::warning
|
Chris@0
|
1397 (this,
|
Chris@0
|
1398 tr("Failed to generate layer"),
|
Chris@0
|
1399 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
|
1400 .arg(transformName),
|
Chris@0
|
1401 QMessageBox::Ok);
|
Chris@0
|
1402 }
|
Chris@0
|
1403 }
|
Chris@0
|
1404
|
Chris@0
|
1405 void
|
Chris@0
|
1406 MainWindow::modelGenerationWarning(QString transformName, QString message)
|
Chris@0
|
1407 {
|
Chris@0
|
1408 QMessageBox::warning
|
Chris@0
|
1409 (this, tr("Warning"), message, QMessageBox::Ok);
|
Chris@0
|
1410 }
|
Chris@0
|
1411
|
Chris@0
|
1412 void
|
Chris@0
|
1413 MainWindow::modelRegenerationFailed(QString layerName,
|
Chris@0
|
1414 QString transformName, QString message)
|
Chris@0
|
1415 {
|
Chris@0
|
1416 if (message != "") {
|
Chris@0
|
1417
|
Chris@0
|
1418 QMessageBox::warning
|
Chris@0
|
1419 (this,
|
Chris@0
|
1420 tr("Failed to regenerate layer"),
|
Chris@0
|
1421 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
|
1422 .arg(layerName).arg(transformName).arg(message),
|
Chris@0
|
1423 QMessageBox::Ok);
|
Chris@0
|
1424 } else {
|
Chris@0
|
1425 QMessageBox::warning
|
Chris@0
|
1426 (this,
|
Chris@0
|
1427 tr("Failed to regenerate layer"),
|
Chris@0
|
1428 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
|
1429 .arg(layerName).arg(transformName),
|
Chris@0
|
1430 QMessageBox::Ok);
|
Chris@0
|
1431 }
|
Chris@0
|
1432 }
|
Chris@0
|
1433
|
Chris@0
|
1434 void
|
Chris@0
|
1435 MainWindow::modelRegenerationWarning(QString layerName,
|
Chris@0
|
1436 QString transformName, QString message)
|
Chris@0
|
1437 {
|
Chris@0
|
1438 QMessageBox::warning
|
Chris@0
|
1439 (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
|
1440 }
|
Chris@0
|
1441
|
Chris@0
|
1442 void
|
Chris@0
|
1443 MainWindow::alignmentFailed(QString transformName, QString message)
|
Chris@0
|
1444 {
|
Chris@0
|
1445 QMessageBox::warning
|
Chris@0
|
1446 (this,
|
Chris@0
|
1447 tr("Failed to calculate alignment"),
|
Chris@0
|
1448 tr("<b>Alignment calculation failed</b><p>Failed to calculate an audio alignment using transform \"%1\":<p>%2")
|
Chris@0
|
1449 .arg(transformName).arg(message),
|
Chris@0
|
1450 QMessageBox::Ok);
|
Chris@0
|
1451 }
|
Chris@0
|
1452
|
Chris@0
|
1453 void
|
Chris@0
|
1454 MainWindow::rightButtonMenuRequested(Pane *pane, QPoint position)
|
Chris@0
|
1455 {
|
Chris@0
|
1456 // std::cerr << "MainWindow::rightButtonMenuRequested(" << pane << ", " << position.x() << ", " << position.y() << ")" << std::endl;
|
Chris@0
|
1457 m_paneStack->setCurrentPane(pane);
|
Chris@0
|
1458 m_rightButtonMenu->popup(position);
|
Chris@0
|
1459 }
|
Chris@0
|
1460
|
Chris@0
|
1461 void
|
Chris@0
|
1462 MainWindow::handleOSCMessage(const OSCMessage &message)
|
Chris@0
|
1463 {
|
Chris@0
|
1464 std::cerr << "MainWindow::handleOSCMessage: Not implemented" << std::endl;
|
Chris@0
|
1465 }
|
Chris@0
|
1466
|
Chris@0
|
1467 void
|
Chris@0
|
1468 MainWindow::mouseEnteredWidget()
|
Chris@0
|
1469 {
|
Chris@3
|
1470 QWidget *w = qobject_cast<QWidget *>(sender());
|
Chris@0
|
1471 if (!w) return;
|
Chris@0
|
1472
|
Chris@0
|
1473 if (w == m_fader) {
|
Chris@0
|
1474 contextHelpChanged(tr("Adjust the master playback level"));
|
Chris@0
|
1475 } else if (w == m_playSpeed) {
|
Chris@0
|
1476 contextHelpChanged(tr("Adjust the master playback speed"));
|
Chris@0
|
1477 } else if (w == m_playSharpen && w->isEnabled()) {
|
Chris@0
|
1478 contextHelpChanged(tr("Toggle transient sharpening for playback time scaling"));
|
Chris@0
|
1479 } else if (w == m_playMono && w->isEnabled()) {
|
Chris@0
|
1480 contextHelpChanged(tr("Toggle mono mode for playback time scaling"));
|
Chris@0
|
1481 }
|
Chris@0
|
1482 }
|
Chris@0
|
1483
|
Chris@0
|
1484 void
|
Chris@0
|
1485 MainWindow::mouseLeftWidget()
|
Chris@0
|
1486 {
|
Chris@0
|
1487 contextHelpChanged("");
|
Chris@0
|
1488 }
|
Chris@0
|
1489
|
Chris@0
|
1490 void
|
Chris@0
|
1491 MainWindow::website()
|
Chris@0
|
1492 {
|
Chris@4
|
1493 //!!! todo: URL!
|
Chris@4
|
1494 openHelpUrl(tr("http://code.soundsoftware.ac.uk/projects/tony/"));
|
Chris@0
|
1495 }
|
Chris@0
|
1496
|
Chris@0
|
1497 void
|
Chris@0
|
1498 MainWindow::help()
|
Chris@0
|
1499 {
|
Chris@4
|
1500 //!!! todo: help URL!
|
Chris@4
|
1501 openHelpUrl(tr("http://code.soundsoftware.ac.uk/projects/tony/"));
|
Chris@0
|
1502 }
|
Chris@0
|
1503
|
Chris@0
|
1504 void
|
Chris@0
|
1505 MainWindow::about()
|
Chris@0
|
1506 {
|
Chris@0
|
1507 bool debug = false;
|
Chris@0
|
1508 QString version = "(unknown version)";
|
Chris@0
|
1509
|
Chris@0
|
1510 #ifdef BUILD_DEBUG
|
Chris@0
|
1511 debug = true;
|
Chris@0
|
1512 #endif
|
Chris@0
|
1513 version = tr("Release %1").arg(TONY_VERSION);
|
Chris@0
|
1514
|
Chris@0
|
1515 QString aboutText;
|
Chris@0
|
1516
|
Chris@0
|
1517 aboutText += tr("<h3>About Tony</h3>");
|
Chris@0
|
1518 aboutText += tr("<p>Tony is a program for interactive note and pitch analysis and annotation.</p>");
|
Chris@0
|
1519 aboutText += tr("<p>%1 : %2 configuration</p>")
|
Chris@0
|
1520 .arg(version)
|
Chris@0
|
1521 .arg(debug ? tr("Debug") : tr("Release"));
|
Chris@0
|
1522
|
Chris@0
|
1523 #ifndef BUILD_STATIC
|
Chris@0
|
1524 aboutText += tr("<br>Using Qt v%1 © Trolltech AS").arg(QT_VERSION_STR);
|
Chris@0
|
1525 #else
|
Chris@0
|
1526 #ifdef QT_SHARED
|
Chris@0
|
1527 aboutText += tr("<br>Using Qt v%1 © Trolltech AS").arg(QT_VERSION_STR);
|
Chris@0
|
1528 #endif
|
Chris@0
|
1529 #endif
|
Chris@0
|
1530
|
Chris@0
|
1531 #ifdef BUILD_STATIC
|
Chris@0
|
1532 aboutText += tr("<p>Statically linked");
|
Chris@0
|
1533 #ifndef QT_SHARED
|
Chris@0
|
1534 aboutText += tr("<br>With Qt (v%1) © Trolltech AS").arg(QT_VERSION_STR);
|
Chris@0
|
1535 #endif
|
Chris@0
|
1536 #ifdef HAVE_JACK
|
Chris@0
|
1537 #ifdef JACK_VERSION
|
Chris@0
|
1538 aboutText += tr("<br>With JACK audio output (v%1) © Paul Davis and Jack O'Quin").arg(JACK_VERSION);
|
Chris@0
|
1539 #else
|
Chris@0
|
1540 aboutText += tr("<br>With JACK audio output © Paul Davis and Jack O'Quin");
|
Chris@0
|
1541 #endif
|
Chris@0
|
1542 #endif
|
Chris@0
|
1543 #ifdef HAVE_PORTAUDIO
|
Chris@0
|
1544 aboutText += tr("<br>With PortAudio audio output © Ross Bencina and Phil Burk");
|
Chris@0
|
1545 #endif
|
Chris@0
|
1546 #ifdef HAVE_OGGZ
|
Chris@0
|
1547 #ifdef OGGZ_VERSION
|
Chris@0
|
1548 aboutText += tr("<br>With Ogg file decoder (oggz v%1, fishsound v%2) © CSIRO Australia").arg(OGGZ_VERSION).arg(FISHSOUND_VERSION);
|
Chris@0
|
1549 #else
|
Chris@0
|
1550 aboutText += tr("<br>With Ogg file decoder © CSIRO Australia");
|
Chris@0
|
1551 #endif
|
Chris@0
|
1552 #endif
|
Chris@0
|
1553 #ifdef HAVE_MAD
|
Chris@0
|
1554 #ifdef MAD_VERSION
|
Chris@0
|
1555 aboutText += tr("<br>With MAD mp3 decoder (v%1) © Underbit Technologies Inc").arg(MAD_VERSION);
|
Chris@0
|
1556 #else
|
Chris@0
|
1557 aboutText += tr("<br>With MAD mp3 decoder © Underbit Technologies Inc");
|
Chris@0
|
1558 #endif
|
Chris@0
|
1559 #endif
|
Chris@0
|
1560 #ifdef HAVE_SAMPLERATE
|
Chris@0
|
1561 #ifdef SAMPLERATE_VERSION
|
Chris@0
|
1562 aboutText += tr("<br>With libsamplerate (v%1) © Erik de Castro Lopo").arg(SAMPLERATE_VERSION);
|
Chris@0
|
1563 #else
|
Chris@0
|
1564 aboutText += tr("<br>With libsamplerate © Erik de Castro Lopo");
|
Chris@0
|
1565 #endif
|
Chris@0
|
1566 #endif
|
Chris@0
|
1567 #ifdef HAVE_SNDFILE
|
Chris@0
|
1568 #ifdef SNDFILE_VERSION
|
Chris@0
|
1569 aboutText += tr("<br>With libsndfile (v%1) © Erik de Castro Lopo").arg(SNDFILE_VERSION);
|
Chris@0
|
1570 #else
|
Chris@0
|
1571 aboutText += tr("<br>With libsndfile © Erik de Castro Lopo");
|
Chris@0
|
1572 #endif
|
Chris@0
|
1573 #endif
|
Chris@0
|
1574 #ifdef HAVE_FFTW3F
|
Chris@0
|
1575 #ifdef FFTW3_VERSION
|
Chris@0
|
1576 aboutText += tr("<br>With FFTW3 (v%1) © Matteo Frigo and MIT").arg(FFTW3_VERSION);
|
Chris@0
|
1577 #else
|
Chris@0
|
1578 aboutText += tr("<br>With FFTW3 © Matteo Frigo and MIT");
|
Chris@0
|
1579 #endif
|
Chris@0
|
1580 #endif
|
Chris@0
|
1581 #ifdef HAVE_VAMP
|
Chris@0
|
1582 aboutText += tr("<br>With Vamp plugin support (API v%1, host SDK v%2) © Chris Cannam").arg(VAMP_API_VERSION).arg(VAMP_SDK_VERSION);
|
Chris@0
|
1583 #endif
|
Chris@0
|
1584 aboutText += tr("<br>With LADSPA plugin support (API v%1) © Richard Furse, Paul Davis, Stefan Westerfeld").arg(LADSPA_VERSION);
|
Chris@0
|
1585 aboutText += tr("<br>With DSSI plugin support (API v%1) © Chris Cannam, Steve Harris, Sean Bolton").arg(DSSI_VERSION);
|
Chris@0
|
1586 #ifdef HAVE_LIBLO
|
Chris@0
|
1587 #ifdef LIBLO_VERSION
|
Chris@0
|
1588 aboutText += tr("<br>With liblo Lite OSC library (v%1) © Steve Harris").arg(LIBLO_VERSION);
|
Chris@0
|
1589 #else
|
Chris@0
|
1590 aboutText += tr("<br>With liblo Lite OSC library © Steve Harris").arg(LIBLO_VERSION);
|
Chris@0
|
1591 #endif
|
Chris@0
|
1592 if (m_oscQueue && m_oscQueue->isOK()) {
|
Chris@0
|
1593 aboutText += tr("<p>The OSC URL for this instance is: \"%1\"").arg(m_oscQueue->getOSCURL());
|
Chris@0
|
1594 }
|
Chris@0
|
1595 #endif
|
Chris@0
|
1596 aboutText += "</p>";
|
Chris@0
|
1597 #endif
|
Chris@0
|
1598
|
Chris@0
|
1599 aboutText +=
|
Chris@0
|
1600 "<p>Copyright © 2005–2012 Chris Cannam and<br>"
|
Chris@0
|
1601 "Queen Mary, University of London.</p>"
|
Chris@0
|
1602 "<p>This program is free software; you can redistribute it and/or<br>"
|
Chris@0
|
1603 "modify it under the terms of the GNU General Public License as<br>"
|
Chris@0
|
1604 "published by the Free Software Foundation; either version 2 of the<br>"
|
Chris@0
|
1605 "License, or (at your option) any later version.<br>See the file "
|
Chris@0
|
1606 "COPYING included with this distribution for more information.</p>";
|
Chris@0
|
1607
|
Chris@0
|
1608 QMessageBox::about(this, tr("About %1").arg(QApplication::applicationName()), aboutText);
|
Chris@0
|
1609 }
|
Chris@0
|
1610
|
Chris@0
|
1611 void
|
Chris@0
|
1612 MainWindow::keyReference()
|
Chris@0
|
1613 {
|
Chris@0
|
1614 m_keyReference->show();
|
Chris@0
|
1615 }
|
Chris@0
|
1616
|
Chris@0
|
1617
|