comparison src/main.cpp @ 399:ffd1a89a68fa cxx11-types

Build fixes etc
author Chris Cannam
date Wed, 11 Mar 2015 11:54:29 +0000
parents fa329ca6d75e
children a0eedd10dee3
comparison
equal deleted inserted replaced
352:7178bb4dcdfb 399:ffd1a89a68fa
98 98
99 bool m_readyForFiles; 99 bool m_readyForFiles;
100 QStringList m_filepathQueue; 100 QStringList m_filepathQueue;
101 101
102 virtual bool event(QEvent *event) { 102 virtual bool event(QEvent *event) {
103 switch (event->type()) { 103 if (event->type() == QEvent::FileOpen) {
104 case QEvent::FileOpen:
105 {
106 QString path = static_cast<QFileOpenEvent *>(event)->file(); 104 QString path = static_cast<QFileOpenEvent *>(event)->file();
107 if (m_readyForFiles) { 105 if (m_readyForFiles) {
108 handleFilepathArgument(path, NULL); 106 handleFilepathArgument(path, NULL);
109 } else { 107 } else {
110 m_filepathQueue.append(path); 108 m_filepathQueue.append(path);
111 } 109 }
112 return true; 110 return true;
113 } 111 } else {
114 default:
115 return QApplication::event(event); 112 return QApplication::event(event);
116 } 113 }
117 } 114 }
118 }; 115 };
119 116
150 147
151 bool audioOutput = true; 148 bool audioOutput = true;
152 149
153 if (args.contains("--help") || args.contains("-h") || args.contains("-?")) { 150 if (args.contains("--help") || args.contains("-h") || args.contains("-?")) {
154 std::cerr << QApplication::tr( 151 std::cerr << QApplication::tr(
155 "\nTony is a program for interactive note and pitch analysis and annotation.\n\nUsage:\n\n %1 [--no-audio] [--no-osc] [<file> ...]\n\n --no-audio: Do not attempt to open an audio output device\n <file>: One or more Tony (.ton) and audio files may be provided.\n").arg(argv[0]).toStdString() << std::endl; 152 "\nTony is a program for interactive note and pitch analysis and annotation.\n\nUsage:\n\n %1 [--no-audio] [<file> ...]\n\n --no-audio: Do not attempt to open an audio output device\n <file>: One or more Tony (.ton) and audio files may be provided.\n").arg(argv[0]).toStdString() << std::endl;
156 exit(2); 153 exit(2);
157 } 154 }
158 155
159 if (args.contains("--no-audio")) audioOutput = false; 156 if (args.contains("--no-audio")) audioOutput = false;
160 157
196 193
197 // Permit size_t and PropertyName to be used as args in queued signal calls 194 // Permit size_t and PropertyName to be used as args in queued signal calls
198 qRegisterMetaType<size_t>("size_t"); 195 qRegisterMetaType<size_t>("size_t");
199 qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName"); 196 qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName");
200 197
201 MainWindow *gui = new MainWindow(audioOutput, false); // no osc support 198 MainWindow *gui = new MainWindow(audioOutput);
202 application.setMainWindow(gui); 199 application.setMainWindow(gui);
203 if (splash) { 200 if (splash) {
204 QObject::connect(gui, SIGNAL(hideSplash()), splash, SLOT(hide())); 201 QObject::connect(gui, SIGNAL(hideSplash()), splash, SLOT(hide()));
205 } 202 }
206 203
282 path.replace("\\", "/"); 279 path.replace("\\", "/");
283 #endif 280 #endif
284 281
285 if (path.endsWith("ton")) { 282 if (path.endsWith("ton")) {
286 if (!haveSession) { 283 if (!haveSession) {
287 status = m_mainWindow->openSessionFile(path); 284 status = m_mainWindow->openSessionPath(path);
288 if (status == MainWindow::FileOpenSucceeded) { 285 if (status == MainWindow::FileOpenSucceeded) {
289 haveSession = true; 286 haveSession = true;
290 haveMainModel = true; 287 haveMainModel = true;
291 } 288 }
292 } else { 289 } else {
294 status = MainWindow::FileOpenSucceeded; 291 status = MainWindow::FileOpenSucceeded;
295 } 292 }
296 } 293 }
297 if (status != MainWindow::FileOpenSucceeded) { 294 if (status != MainWindow::FileOpenSucceeded) {
298 if (!haveMainModel) { 295 if (!haveMainModel) {
299 status = m_mainWindow->open(path, MainWindow::ReplaceSession); 296 status = m_mainWindow->openPath(path, MainWindow::ReplaceSession);
300 if (status == MainWindow::FileOpenSucceeded) { 297 if (status == MainWindow::FileOpenSucceeded) {
301 haveMainModel = true; 298 haveMainModel = true;
302 } 299 }
303 } else { 300 } else {
304 if (haveSession && !havePriorCommandLineModel) { 301 if (haveSession && !havePriorCommandLineModel) {
305 status = m_mainWindow->open(path, MainWindow::AskUser); 302 status = m_mainWindow->openPath(path, MainWindow::AskUser);
306 if (status == MainWindow::FileOpenSucceeded) { 303 if (status == MainWindow::FileOpenSucceeded) {
307 havePriorCommandLineModel = true; 304 havePriorCommandLineModel = true;
308 } 305 }
309 } else { 306 } else {
310 status = m_mainWindow->open(path, MainWindow::CreateAdditionalModel); 307 status = m_mainWindow->openPath(path, MainWindow::CreateAdditionalModel);
311 } 308 }
312 } 309 }
313 } 310 }
314 if (status == MainWindow::FileOpenFailed) { 311 if (status == MainWindow::FileOpenFailed) {
315 if (splash) splash->hide(); 312 if (splash) splash->hide();