Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all
Unified · Split
| @@ -101,6 +101,8 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D · 100 unmodified lines | |||
| 101 | 101 | ||
| 102 | const int STATS_PELS_PER_LINE = 20; | 102 | const int STATS_PELS_PER_LINE = 20; |
| 103 | 103 | ||
| 104 | const QString CUSTOM_URL_SCHEME = "hifi:"; | ||
| 105 | |||
| 104 | void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) { | 106 | void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) { |
| 105 | if (message.size() > 0) { | 107 | if (message.size() > 0) { |
| 106 | QString messageWithNewLine = message + "\n"; | 108 | QString messageWithNewLine = message + "\n"; |
| @@ -680,6 +682,21 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet, const Nod · 573 unmodified lines | |||
| 680 | } | 682 | } |
| 681 | } | 683 | } |
| 682 | 684 | ||
| 685 | bool Application::event(QEvent* event) { | ||
| 686 | |||
| 687 | // handle custom URL | ||
| 688 | if (event->type() == QEvent::FileOpen) { | ||
| 689 | QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event); | ||
| 690 | if (!fileEvent->url().isEmpty() && fileEvent->url().toLocalFile().startsWith(CUSTOM_URL_SCHEME)) { | ||
| 691 | QString destination = fileEvent->url().toLocalFile().remove(QRegExp(CUSTOM_URL_SCHEME + "|/")); | ||
| 692 | Menu::getInstance()->goToDestination(destination); | ||
| 693 | } | ||
| 694 | |||
| 695 | return false; | ||
| 696 | } | ||
| 697 | return QApplication::event(event); | ||
| 698 | } | ||
| 699 | |||
| 683 | void Application::keyPressEvent(QKeyEvent* event) { | 700 | void Application::keyPressEvent(QKeyEvent* event) { |
| 684 | 701 | ||
| 685 | _controllerScriptingInterface.emitKeyPressEvent(event); // send events to any registered scripts | 702 | _controllerScriptingInterface.emitKeyPressEvent(event); // send events to any registered scripts |