diff --git a/src/app/main.cpp b/src/app/main.cpp index 47d9a987..c5efc82e 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -110,6 +110,11 @@ int main(int argc, char *argv[]) "Use language .", "lang", ""); parser.addOption(localeOption); + // --verbose option + QCommandLineOption verboseOption(QStringList() << "V" << "verbose", + "Enable verbose output, including OSC message logging."); + parser.addOption(verboseOption); + // --frame-rate option QCommandLineOption frameRateOption(QStringList() << "r" << "frame-rate", "Use a framerate of per second.", "frame-rate", QString::number(MM::DEFAULT_FRAMES_PER_SECOND)); @@ -205,6 +210,9 @@ int main(int argc, char *argv[]) if (oscPortValue != "") win->setOscPort(oscPortValue); + if (parser.isSet(verboseOption)) + win->setVerbose(true); + bool optionOk; qreal fps = parser.value("frame-rate").toDouble(&optionOk); if (optionOk) diff --git a/src/control/OscInterface.cpp b/src/control/OscInterface.cpp index e330bfa8..36354679 100644 --- a/src/control/OscInterface.cpp +++ b/src/control/OscInterface.cpp @@ -148,9 +148,8 @@ static void printCommand(QVariantList &command) void OscInterface::applyOscCommand(MainWindow &main_window, QVariantList & command) { Q_UNUSED(main_window); - bool VERBOSE = false; - if (VERBOSE) + if (is_verbose()) { std::cout << "OscInterface::applyOscCommand: Receive OSC: " << std::endl; printCommand(command); @@ -211,7 +210,8 @@ void OscInterface::applyOscCommand(MainWindow &main_window, QVariantList & comma } // Property setting (eg. opacity) else if (command.size() >= 4) { - qDebug() << "Attempt to set a source property" << iterator.first << command.at(3); + if (is_verbose()) + qDebug() << "Attempt to set a source property" << iterator.first << command.at(3); pathIsValid |= setElementProperty(elem, iterator.first, command.at(3)); } } @@ -266,7 +266,7 @@ void OscInterface::applyOscCommand(MainWindow &main_window, QVariantList & comma } } - if (! pathIsValid) + if (! pathIsValid && is_verbose()) { qDebug() << "Path could not be processed: " << path << Qt::endl; printCommand(command); diff --git a/src/control/OscInterface.h b/src/control/OscInterface.h index 856cf7e9..5b7d1df0 100644 --- a/src/control/OscInterface.h +++ b/src/control/OscInterface.h @@ -45,6 +45,8 @@ class OscInterface { OscInterface(int listen_port); ~OscInterface(); + void setVerbose(bool verbose) { verbose_ = verbose; } + /// Starts listening if receiving is enabled. void start(); @@ -59,9 +61,10 @@ class OscInterface { // FIXME use QObject signals instead of polling private: - bool is_verbose() const { return false; } + bool is_verbose() const { return verbose_; } void push_command(QVariantList command); + bool verbose_ = false; bool receiving_enabled_; OscReceiver receiver_; ConcurrentQueue messaging_queue_; diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 0ecd079e..b47d3cef 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -3714,6 +3714,12 @@ int MainWindow::getOscPort() const return oscListeningPort; } +void MainWindow::setVerbose(bool verbose) +{ + if (osc_interface) + osc_interface->setVerbose(verbose); +} + bool MainWindow::setOscPort(QString portNumber) { bool ok; diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index 5074b66a..556293dd 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -623,6 +623,7 @@ public slots: bool setOscPort(QString portNumber); bool setOscPort(int portNumber); int getOscPort() const; + void setVerbose(bool verbose); void setOutputWindowFullScreen(bool enable); public: