Mercurial > hg > sonic-visualiser
comparison main/OSCHandler.cpp @ 677:bfd68cc71a25 imaf_enc
Merge from default branch, fix build
author | Chris Cannam |
---|---|
date | Thu, 05 Dec 2013 10:57:51 +0000 |
parents | ba338234c001 17fe7e0c23a1 |
children | 5e6e1e074080 |
comparison
equal
deleted
inserted
replaced
676:dabe6e994a9c | 677:bfd68cc71a25 |
---|---|
44 | 44 |
45 if (message.getArgCount() == 1 && | 45 if (message.getArgCount() == 1 && |
46 message.getArg(0).canConvert(QVariant::String)) { | 46 message.getArg(0).canConvert(QVariant::String)) { |
47 QString path = message.getArg(0).toString(); | 47 QString path = message.getArg(0).toString(); |
48 if (open(path, ReplaceMainModel) != FileOpenSucceeded) { | 48 if (open(path, ReplaceMainModel) != FileOpenSucceeded) { |
49 std::cerr << "MainWindow::handleOSCMessage: File open failed for path \"" | 49 cerr << "MainWindow::handleOSCMessage: File open failed for path \"" |
50 << path << "\"" << std::endl; | 50 << path << "\"" << endl; |
51 } | 51 } |
52 //!!! we really need to spin here and not return until the | 52 //!!! we really need to spin here and not return until the |
53 // file has been completely decoded... | 53 // file has been completely decoded... |
54 } | 54 } |
55 | 55 |
57 | 57 |
58 if (message.getArgCount() == 1 && | 58 if (message.getArgCount() == 1 && |
59 message.getArg(0).canConvert(QVariant::String)) { | 59 message.getArg(0).canConvert(QVariant::String)) { |
60 QString path = message.getArg(0).toString(); | 60 QString path = message.getArg(0).toString(); |
61 if (open(path, CreateAdditionalModel) != FileOpenSucceeded) { | 61 if (open(path, CreateAdditionalModel) != FileOpenSucceeded) { |
62 std::cerr << "MainWindow::handleOSCMessage: File open failed for path \"" | 62 cerr << "MainWindow::handleOSCMessage: File open failed for path \"" |
63 << path << "\"" << std::endl; | 63 << path << "\"" << endl; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 } else if (message.getMethod() == "recent" || | 67 } else if (message.getMethod() == "recent" || |
68 message.getMethod() == "last") { | 68 message.getMethod() == "last") { |
74 n = message.getArg(0).toInt() - 1; | 74 n = message.getArg(0).toInt() - 1; |
75 } | 75 } |
76 std::vector<QString> recent = m_recentFiles.getRecent(); | 76 std::vector<QString> recent = m_recentFiles.getRecent(); |
77 if (n >= 0 && n < int(recent.size())) { | 77 if (n >= 0 && n < int(recent.size())) { |
78 if (open(recent[n], ReplaceMainModel) != FileOpenSucceeded) { | 78 if (open(recent[n], ReplaceMainModel) != FileOpenSucceeded) { |
79 std::cerr << "MainWindow::handleOSCMessage: File open failed for path \"" | 79 cerr << "MainWindow::handleOSCMessage: File open failed for path \"" |
80 << recent[n] << "\"" << std::endl; | 80 << recent[n] << "\"" << endl; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 } else if (message.getMethod() == "save") { | 84 } else if (message.getMethod() == "save") { |
85 | 85 |
292 if (message.getArgCount() == 2 && | 292 if (message.getArgCount() == 2 && |
293 message.getArg(0).canConvert(QVariant::Int)) { | 293 message.getArg(0).canConvert(QVariant::Int)) { |
294 channel = message.getArg(0).toInt(); | 294 channel = message.getArg(0).toInt(); |
295 if (channel < -1 || | 295 if (channel < -1 || |
296 channel > int(getMainModel()->getChannelCount())) { | 296 channel > int(getMainModel()->getChannelCount())) { |
297 std::cerr << "WARNING: MainWindow::handleOSCMessage: channel " | 297 cerr << "WARNING: MainWindow::handleOSCMessage: channel " |
298 << channel << " out of range" << std::endl; | 298 << channel << " out of range" << endl; |
299 channel = -1; | 299 channel = -1; |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 QString str = message.getArg(0).toString(); | 303 QString str = message.getArg(0).toString(); |
304 | 304 |
305 LayerFactory::LayerType type = | 305 LayerFactory::LayerType type = |
306 LayerFactory::getInstance()->getLayerTypeForName(str); | 306 LayerFactory::getInstance()->getLayerTypeForName(str); |
307 | 307 |
308 if (type == LayerFactory::UnknownLayer) { | 308 if (type == LayerFactory::UnknownLayer) { |
309 std::cerr << "WARNING: MainWindow::handleOSCMessage: unknown layer " | 309 cerr << "WARNING: MainWindow::handleOSCMessage: unknown layer " |
310 << "type " << str << std::endl; | 310 << "type " << str << endl; |
311 } else { | 311 } else { |
312 | 312 |
313 LayerConfiguration configuration(type, | 313 LayerConfiguration configuration(type, |
314 getMainModel(), | 314 getMainModel(), |
315 channel); | 315 channel); |
426 } else if (target == "layer") { | 426 } else if (target == "layer") { |
427 | 427 |
428 deleteCurrentLayer(); | 428 deleteCurrentLayer(); |
429 | 429 |
430 } else { | 430 } else { |
431 | 431 |
432 std::cerr << "WARNING: MainWindow::handleOSCMessage: Unknown delete target " << target << std::endl; | 432 cerr << "WARNING: MainWindow::handleOSCMessage: Unknown delete target " << target << endl; |
433 } | 433 } |
434 } | 434 } |
435 | 435 |
436 } else if (message.getMethod() == "zoom") { | 436 } else if (message.getMethod() == "zoom") { |
437 | 437 |
542 m_paneStack->setCurrentLayer(pane, newLayer); | 542 m_paneStack->setCurrentLayer(pane, newLayer); |
543 } | 543 } |
544 } | 544 } |
545 | 545 |
546 } else { | 546 } else { |
547 std::cerr << "WARNING: MainWindow::handleOSCMessage: Unknown or unsupported " | 547 cerr << "WARNING: MainWindow::handleOSCMessage: Unknown or unsupported " |
548 << "method \"" << message.getMethod().toStdString() | 548 << "method \"" << message.getMethod() |
549 << "\"" << std::endl; | 549 << "\"" << endl; |
550 } | 550 } |
551 | 551 |
552 } | 552 } |