Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all
Unified · Split
| @@ -48,6 +48,8 @@ · 47 unmodified lines | |||
| 48 | #include <QXmlStreamReader> | 48 | #include <QXmlStreamReader> |
| 49 | #include <QXmlStreamAttributes> | 49 | #include <QXmlStreamAttributes> |
| 50 | #include <QMediaPlayer> | 50 | #include <QMediaPlayer> |
| 51 | #include <QMimeData> | ||
| 52 | #include <QMessageBox> | ||
| 51 | 53 | ||
| 52 | #include <AudioInjector.h> | 54 | #include <AudioInjector.h> |
| 53 | #include <Logging.h> | 55 | #include <Logging.h> |
| @@ -197,7 +199,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 143 unmodified lines | |||
| 197 | connect(audioThread, SIGNAL(started()), &_audio, SLOT(start())); | 199 | connect(audioThread, SIGNAL(started()), &_audio, SLOT(start())); |
| 198 | 200 | ||
| 199 | audioThread->start(); | 201 | audioThread->start(); |
| 200 | 202 | ||
| 201 | connect(nodeList, SIGNAL(domainChanged(const QString&)), SLOT(domainChanged(const QString&))); | 203 | connect(nodeList, SIGNAL(domainChanged(const QString&)), SLOT(domainChanged(const QString&))); |
| 202 | connect(nodeList, &NodeList::nodeAdded, this, &Application::nodeAdded); | 204 | connect(nodeList, &NodeList::nodeAdded, this, &Application::nodeAdded); |
| 203 | connect(nodeList, &NodeList::nodeKilled, this, &Application::nodeKilled); | 205 | connect(nodeList, &NodeList::nodeKilled, this, &Application::nodeKilled); |
| @@ -1378,6 +1380,32 @@ void Application::wheelEvent(QWheelEvent* event) { · 1174 unmodified lines | |||
| 1378 | } | 1380 | } |
| 1379 | } | 1381 | } |
| 1380 | 1382 | ||
| 1383 | void Application::dropEvent(QDropEvent *event) { | ||
| 1384 | QString snapshotPath; | ||
| 1385 | const QMimeData *mimeData = event->mimeData(); | ||
| 1386 | foreach (QUrl url, mimeData->urls()) { | ||
| 1387 | if (url.url().toLower().endsWith("jpg")) { | ||
| 1388 | snapshotPath = url.url().remove("file://"); | ||
| 1389 | break; | ||
| 1390 | } | ||
| 1391 | } | ||
| 1392 | |||
| 1393 | SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath); | ||
| 1394 | if (snapshotData != NULL) { | ||
| 1395 | if (!snapshotData->getDomain().isEmpty()) { | ||
| 1396 | Menu::getInstance()->goToDomain(snapshotData->getDomain()); | ||
| 1397 | } | ||
| 1398 | |||
| 1399 | _myAvatar->setPosition(snapshotData->getLocation()); | ||
| 1400 | _myAvatar->setOrientation(snapshotData->getOrientation()); | ||
| 1401 | } else { | ||
| 1402 | QMessageBox msgBox; | ||
| 1403 | msgBox.setText("No location details were found in this JPG, try dragging in an authentic Hifi snapshot."); | ||
| 1404 | msgBox.setStandardButtons(QMessageBox::Ok); | ||
| 1405 | msgBox.exec(); | ||
| 1406 | } | ||
| 1407 | } | ||
| 1408 | |||
| 1381 | void Application::sendPingPackets() { | 1409 | void Application::sendPingPackets() { |
| 1382 | QByteArray pingPacket = NodeList::getInstance()->constructPingPacket(); | 1410 | QByteArray pingPacket = NodeList::getInstance()->constructPingPacket(); |
| 1383 | controlledBroadcastToNodes(pingPacket, NodeSet() << NodeType::VoxelServer | 1411 | controlledBroadcastToNodes(pingPacket, NodeSet() << NodeType::VoxelServer |
| @@ -3794,7 +3822,7 @@ void Application::updateWindowTitle(){ · 2410 unmodified lines | |||
| 3794 | 3822 | ||
| 3795 | QString title = QString() + _profile.getUsername() + " " + nodeList->getSessionUUID().toString() | 3823 | QString title = QString() + _profile.getUsername() + " " + nodeList->getSessionUUID().toString() |
| 3796 | + " @ " + nodeList->getDomainHostname() + buildVersion; | 3824 | + " @ " + nodeList->getDomainHostname() + buildVersion; |
| 3797 | 3825 | ||
| 3798 | qDebug("Application title set to: %s", title.toStdString().c_str()); | 3826 | qDebug("Application title set to: %s", title.toStdString().c_str()); |
| 3799 | _window->setWindowTitle(title); | 3827 | _window->setWindowTitle(title); |
| 3800 | } | 3828 | } |
| @@ -4170,6 +4198,6 @@ void Application::takeSnapshot() { · 369 unmodified lines | |||
| 4170 | player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); | 4198 | player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); |
| 4171 | player->play(); | 4199 | player->play(); |
| 4172 | 4200 | ||
| 4173 | Snapshot::saveSnapshot(_glWidget, _profile.getUsername(), _myAvatar->getPosition()); | 4201 | Snapshot::saveSnapshot(_glWidget, &_profile, _myAvatar); |
| 4174 | } | 4202 | } |
| 4175 | 4203 | ||