diff --git a/examples/airGuitar.js b/examples/airGuitar.js index b7c4b72948..78c16be7bc 100644 --- a/examples/airGuitar.js +++ b/examples/airGuitar.js @@ -35,16 +35,26 @@ var chords = new Array(); chords[1] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+A.raw"); chords[2] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+B.raw"); chords[3] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+E.raw"); +chords[4] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+G.raw"); + // Electric guitar -chords[4] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+A+short.raw"); -chords[5] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+B+short.raw"); -chords[6] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+E+short.raw"); +chords[5] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+A+short.raw"); +chords[6] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+B+short.raw"); +chords[7] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+E+short.raw"); +chords[8] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+G+short.raw"); -var guitarSelector = 3; +// Steel Guitar +chords[9] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+A.raw"); +chords[10] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+B.raw"); +chords[11] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+E.raw"); +chords[12] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+G.raw"); -var whichChord = chords[guitarSelector + 1]; +var NUM_CHORDS = 4; +var NUM_GUITARS = 3; +var guitarSelector = NUM_CHORDS; +var whichChord = 1; -var leftHanded = false; +var leftHanded = true; if (leftHanded) { var strumHand = 0; var chordHand = 1; @@ -59,20 +69,23 @@ var lastPosition = { x: 0.0, var soundPlaying = false; var selectorPressed = false; +var position; MyAvatar.attach(guitarModel, "Hips", {x: -0.0, y: -0.0, z: 0.0}, Quat.fromPitchYawRollDegrees(0, 0, 0), 1.0); function checkHands(deltaTime) { for (var palm = 0; palm < 2; palm++) { var palmVelocity = Controller.getSpatialControlVelocity(palm * 2 + 1); - var speed = length(palmVelocity) / 4.0; + var volume = length(palmVelocity) / 5.0; var position = Controller.getSpatialControlPosition(palm * 2 + 1); var myPelvis = MyAvatar.position; var trigger = Controller.getTriggerValue(strumHand); var chord = Controller.getTriggerValue(chordHand); + if (volume > 1.0) volume = 1.0; if ((chord > 0.1) && Audio.isInjectorPlaying(soundPlaying)) { // If chord finger trigger pulled, stop current chord + print("stopped sound"); Audio.stopInjector(soundPlaying); } @@ -81,11 +94,10 @@ function checkHands(deltaTime) { // Change guitars if button FWD (5) pressed if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 5)) { if (!selectorPressed) { - if (guitarSelector == 0) { - guitarSelector = 3; - } else { + guitarSelector += NUM_CHORDS; + if (guitarSelector >= NUM_CHORDS * NUM_GUITARS) { guitarSelector = 0; - } + } selectorPressed = true; } } else { @@ -93,38 +105,65 @@ function checkHands(deltaTime) { } if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 1)) { - whichChord = chords[guitarSelector + 1]; + whichChord = 1; } else if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 2)) { - whichChord = chords[guitarSelector + 2]; + whichChord = 2; } else if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 3)) { - whichChord = chords[guitarSelector + 3]; + whichChord = 3; + } else if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 4)) { + whichChord = 4; } if (palm == strumHand) { - var STRUM_HEIGHT_ABOVE_PELVIS = 0.00; + var STRUM_HEIGHT_ABOVE_PELVIS = 0.10; var strumTriggerHeight = myPelvis.y + STRUM_HEIGHT_ABOVE_PELVIS; //printVector(position); if ( ( ((position.y < strumTriggerHeight) && (lastPosition.y >= strumTriggerHeight)) || ((position.y > strumTriggerHeight) && (lastPosition.y <= strumTriggerHeight)) ) && (trigger > 0.1) ){ // If hand passes downward or upward through 'strings', and finger trigger pulled, play - var options = new AudioInjectionOptions(); - options.position = position; - if (speed > 1.0) { speed = 1.0; } - options.volume = speed; - if (Audio.isInjectorPlaying(soundPlaying)) { - Audio.stopInjector(soundPlaying); - } - soundPlaying = Audio.playSound(whichChord, options); + playChord(position, volume); } lastPosition = Controller.getSpatialControlPosition(palm * 2 + 1); } } } +function playChord(position, volume) { + var options = new AudioInjectionOptions(); + options.position = position; + options.volume = volume; + if (Audio.isInjectorPlaying(soundPlaying)) { + print("stopped sound"); + Audio.stopInjector(soundPlaying); + } + print("Played sound: " + whichChord + " at volume " + options.volume); + soundPlaying = Audio.playSound(chords[guitarSelector + whichChord], options); +} + +function keyPressEvent(event) { + // check for keypresses and use those to trigger sounds if not hydra + keyVolume = 0.4; + if (event.text == "1") { + whichChord = 1; + playChord(MyAvatar.position, keyVolume); + } else if (event.text == "2") { + whichChord = 2; + playChord(MyAvatar.position, keyVolume); + } else if (event.text == "3") { + whichChord = 3; + playChord(MyAvatar.position, keyVolume); + } else if (event.text == "4") { + whichChord = 4; + playChord(MyAvatar.position, keyVolume); + } +} + function scriptEnding() { MyAvatar.detachOne(guitarModel); } // Connect a call back that happens every frame Script.update.connect(checkHands); Script.scriptEnding.connect(scriptEnding); +Controller.keyPressEvent.connect(keyPressEvent); + diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1e3e11910e..0b59fc3aa2 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3655,7 +3655,17 @@ void Application::takeSnapshot() { player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); player->play(); - Snapshot::saveSnapshot(_glWidget, _myAvatar); + QString fileName = Snapshot::saveSnapshot(_glWidget, _myAvatar); + + AccountManager& accountManager = AccountManager::getInstance(); + if (!accountManager.isLoggedIn()) { + return; + } + + if (!_snapshotShareDialog) { + _snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget); + } + _snapshotShareDialog->show(); } void Application::urlGoTo(int argc, const char * constArgv[]) { diff --git a/interface/src/Application.h b/interface/src/Application.h index ea0de764b9..67cf7dad44 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -74,6 +74,7 @@ #include "ui/ModelsBrowser.h" #include "ui/OctreeStatsDialog.h" #include "ui/RearMirrorTools.h" +#include "ui/SnapshotShareDialog.h" #include "ui/LodToolsDialog.h" #include "ui/LogDialog.h" #include "ui/UpdateDialog.h" @@ -517,6 +518,7 @@ private: std::vector _voxelFades; ControllerScriptingInterface _controllerScriptingInterface; QPointer _logDialog; + QPointer _snapshotShareDialog; QString _previousScriptLocation; diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 27e07d747e..e1d0c6a574 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -970,9 +970,7 @@ void Menu::goToUser(const QString& user) { /// Open a url, shortcutting any "hifi" scheme URLs to the local application. void Menu::openUrl(const QUrl& url) { if (url.scheme() == "hifi") { - QString path = url.toString(QUrl::RemoveScheme); - path = path.remove(QRegExp("^:?/*")); - goTo(path); + goToURL(url.toString()); } else { QDesktopServices::openUrl(url); } diff --git a/interface/src/XmppClient.cpp b/interface/src/XmppClient.cpp index 666906681c..2d421b1afa 100644 --- a/interface/src/XmppClient.cpp +++ b/interface/src/XmppClient.cpp @@ -16,7 +16,7 @@ #include "XmppClient.h" const QString DEFAULT_XMPP_SERVER = "chat.highfidelity.io"; -const QString DEFAULT_CHAT_ROOM = "public@public-chat.highfidelity.io"; +const QString DEFAULT_CHAT_ROOM = "test@public-chat.highfidelity.io"; XmppClient::XmppClient() : _xmppClient(), diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index b74adee55a..41dc50b1fa 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -406,7 +406,7 @@ void Avatar::renderBillboard() { } _billboardTexture.reset(new Texture()); glBindTexture(GL_TEXTURE_2D, _billboardTexture->getID()); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 1, + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_BGRA, GL_UNSIGNED_BYTE, image.constBits()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); diff --git a/interface/src/renderer/TextureCache.cpp b/interface/src/renderer/TextureCache.cpp index f31e4f9060..0588ca70d2 100644 --- a/interface/src/renderer/TextureCache.cpp +++ b/interface/src/renderer/TextureCache.cpp @@ -366,10 +366,10 @@ void NetworkTexture::setImage(const QImage& image, bool translucent) { imageLoaded(image); glBindTexture(GL_TEXTURE_2D, getID()); if (image.hasAlphaChannel()) { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 1, + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_BGRA, GL_UNSIGNED_BYTE, image.constBits()); } else { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 1, + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, image.constBits()); } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -404,10 +404,10 @@ QSharedPointer DilatableNetworkTexture::getDilatedTexture(float dilatio glBindTexture(GL_TEXTURE_2D, texture->getID()); if (dilatedImage.hasAlphaChannel()) { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dilatedImage.width(), dilatedImage.height(), 1, + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dilatedImage.width(), dilatedImage.height(), 0, GL_BGRA, GL_UNSIGNED_BYTE, dilatedImage.constBits()); } else { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dilatedImage.width(), dilatedImage.height(), 1, + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dilatedImage.width(), dilatedImage.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, dilatedImage.constBits()); } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 72445fa69a..fce900f352 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -30,7 +30,7 @@ const int NUM_MESSAGES_TO_TIME_STAMP = 20; -const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)"); +const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?)|(?:hifi))://\\S+)"); const QRegularExpression regexHifiLinks("([#@]\\S+)"); const QString mentionSoundsPath("/sounds/mention/"); const QString mentionRegex("@(\\b%1\\b)"); diff --git a/interface/src/ui/Snapshot.cpp b/interface/src/ui/Snapshot.cpp index 243acdfb10..d530be57d2 100644 --- a/interface/src/ui/Snapshot.cpp +++ b/interface/src/ui/Snapshot.cpp @@ -64,7 +64,7 @@ SnapshotMetaData* Snapshot::parseSnapshotData(QString snapshotPath) { return data; } -void Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) { +QString Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) { QImage shot = widget->grabFrameBuffer(); glm::vec3 location = avatar->getPosition(); @@ -99,6 +99,8 @@ void Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) { fileName.append(QString(FILENAME_PATH_FORMAT.arg(username, now.toString(DATETIME_FORMAT), formattedLocation))); shot.save(fileName, 0, 100); + + return fileName; } diff --git a/interface/src/ui/Snapshot.h b/interface/src/ui/Snapshot.h index 0fa9017b0a..2872b3fdcb 100644 --- a/interface/src/ui/Snapshot.h +++ b/interface/src/ui/Snapshot.h @@ -41,7 +41,7 @@ private: class Snapshot { public: - static void saveSnapshot(QGLWidget* widget, Avatar* avatar); + static QString saveSnapshot(QGLWidget* widget, Avatar* avatar); static SnapshotMetaData* parseSnapshotData(QString snapshotPath); }; diff --git a/interface/src/ui/SnapshotShareDialog.cpp b/interface/src/ui/SnapshotShareDialog.cpp new file mode 100644 index 0000000000..b5694b3e48 --- /dev/null +++ b/interface/src/ui/SnapshotShareDialog.cpp @@ -0,0 +1,198 @@ +// +// SnapshotShareDialog.cpp +// interface/src/ui +// +// Created by Stojce Slavkovski on 2/16/14. +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "SnapshotShareDialog.h" +#include "AccountManager.h" + +#include +#include +#include +#include +#include +#include + + +const int NARROW_SNAPSHOT_DIALOG_SIZE = 500; +const int WIDE_SNAPSHOT_DIALOG_WIDTH = 650; +const int SUCCESS_LABEL_HEIGHT = 140; + +const QString FORUM_URL = "https://alphas.highfidelity.io"; +const QString FORUM_UPLOADS_URL = FORUM_URL + "/uploads"; +const QString FORUM_POST_URL = FORUM_URL + "/posts"; +const QString FORUM_REPLY_TO_TOPIC = "244"; +const QString FORUM_POST_TEMPLATE = "

%2

"; +const QString SHARE_DEFAULT_ERROR = "The server isn't responding. Please try again in a few minutes."; +const QString SUCCESS_LABEL_TEMPLATE = "Success!!! Go check out your image ...
%1"; + +Q_DECLARE_METATYPE(QNetworkAccessManager::Operation) + +SnapshotShareDialog::SnapshotShareDialog(QString fileName, QWidget* parent) : + QDialog(parent), + _fileName(fileName), + _networkAccessManager(NULL) +{ + + setAttribute(Qt::WA_DeleteOnClose); + + _ui.setupUi(this); + + QPixmap snaphsotPixmap(fileName); + float snapshotRatio = static_cast(snaphsotPixmap.size().width()) / snaphsotPixmap.size().height(); + + // narrow snapshot + if (snapshotRatio > 1) { + setFixedWidth(WIDE_SNAPSHOT_DIALOG_WIDTH); + _ui.snapshotWidget->setFixedWidth(WIDE_SNAPSHOT_DIALOG_WIDTH); + } + + float labelRatio = static_cast(_ui.snapshotWidget->size().width()) / _ui.snapshotWidget->size().height(); + + // set the same aspect ratio of label as of snapshot + if (snapshotRatio > labelRatio) { + int oldHeight = _ui.snapshotWidget->size().height(); + _ui.snapshotWidget->setFixedHeight((int) (_ui.snapshotWidget->size().width() / snapshotRatio)); + + // if height is less then original, resize the window as well + if (_ui.snapshotWidget->size().height() < NARROW_SNAPSHOT_DIALOG_SIZE) { + setFixedHeight(size().height() - (oldHeight - _ui.snapshotWidget->size().height())); + } + } else { + _ui.snapshotWidget->setFixedWidth((int) (_ui.snapshotWidget->size().height() * snapshotRatio)); + } + + _ui.snapshotWidget->setPixmap(snaphsotPixmap); + _ui.snapshotWidget->adjustSize(); +} + +void SnapshotShareDialog::accept() { + uploadSnapshot(); +} + +void SnapshotShareDialog::uploadSnapshot() { + + if (AccountManager::getInstance().getAccountInfo().getDiscourseApiKey().isEmpty()) { + QMessageBox::warning(this, "", + "Your Discourse API key is missing, you cannot share snapshots. Please try to relog."); + return; + } + + if (!_networkAccessManager) { + _networkAccessManager = new QNetworkAccessManager(this); + } + + QHttpMultiPart* multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); + + QHttpPart apiKeyPart; + apiKeyPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"api_key\"")); + apiKeyPart.setBody(AccountManager::getInstance().getAccountInfo().getDiscourseApiKey().toLatin1()); + + QFile* file = new QFile(_fileName); + file->open(QIODevice::ReadOnly); + + QHttpPart imagePart; + imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg")); + imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, + QVariant("form-data; name=\"file\"; filename=\"" + file->fileName() +"\"")); + imagePart.setBodyDevice(file); + file->setParent(multiPart); // we cannot delete the file now, so delete it with the multiPart + + multiPart->append(apiKeyPart); + multiPart->append(imagePart); + + QUrl url(FORUM_UPLOADS_URL); + QNetworkRequest request(url); + + QNetworkReply* reply = _networkAccessManager->post(request, multiPart); + + + connect(reply, &QNetworkReply::finished, this, &SnapshotShareDialog::uploadRequestFinished); + + QEventLoop loop; + connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit); + loop.exec(); +} + +void SnapshotShareDialog::sendForumPost(QString snapshotPath) { + + if (!_networkAccessManager) { + _networkAccessManager = new QNetworkAccessManager(this); + } + + // post to Discourse forum + QNetworkRequest request; + QUrl forumUrl(FORUM_POST_URL); + + QUrlQuery query; + query.addQueryItem("api_key", AccountManager::getInstance().getAccountInfo().getDiscourseApiKey()); + query.addQueryItem("topic_id", FORUM_REPLY_TO_TOPIC); + query.addQueryItem("raw", FORUM_POST_TEMPLATE.arg(snapshotPath, _ui.textEdit->toPlainText())); + forumUrl.setQuery(query); + + QByteArray postData = forumUrl.toEncoded(QUrl::RemoveFragment); + request.setUrl(forumUrl); + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); + + QNetworkReply* requestReply = _networkAccessManager->post(request, postData); + connect(requestReply, &QNetworkReply::finished, this, &SnapshotShareDialog::postRequestFinished); + + QEventLoop loop; + connect(requestReply, &QNetworkReply::finished, &loop, &QEventLoop::quit); + loop.exec(); +} + +void SnapshotShareDialog::postRequestFinished() { + + QNetworkReply* requestReply = reinterpret_cast(sender()); + QJsonDocument jsonResponse = QJsonDocument::fromJson(requestReply->readAll()); + const QJsonObject& responseObject = jsonResponse.object(); + + if (responseObject.contains("id")) { + _ui.textEdit->setHtml(""); + const QString urlTemplate = "%1/t/%2/%3/%4"; + QString link = urlTemplate.arg(FORUM_URL, + responseObject["topic_slug"].toString(), + QString::number(responseObject["topic_id"].toDouble()), + QString::number(responseObject["post_number"].toDouble())); + + _ui.successLabel->setText(SUCCESS_LABEL_TEMPLATE.arg(link)); + _ui.successLabel->setFixedHeight(SUCCESS_LABEL_HEIGHT); + + // hide input widgets + _ui.shareButton->hide(); + _ui.textEdit->hide(); + _ui.labelNotes->hide(); + + } else { + QString errorMessage(SHARE_DEFAULT_ERROR); + if (responseObject.contains("errors")) { + QJsonArray errorArray = responseObject["errors"].toArray(); + if (!errorArray.first().toString().isEmpty()) { + errorMessage = errorArray.first().toString(); + } + } + QMessageBox::warning(this, "", errorMessage); + } +} + +void SnapshotShareDialog::uploadRequestFinished() { + + QNetworkReply* requestReply = reinterpret_cast(sender()); + QJsonDocument jsonResponse = QJsonDocument::fromJson(requestReply->readAll()); + const QJsonObject& responseObject = jsonResponse.object(); + + if (responseObject.contains("url")) { + sendForumPost(responseObject["url"].toString()); + } else { + QMessageBox::warning(this, "", SHARE_DEFAULT_ERROR); + } + + delete requestReply; +} diff --git a/interface/src/ui/SnapshotShareDialog.h b/interface/src/ui/SnapshotShareDialog.h new file mode 100644 index 0000000000..a8795d578a --- /dev/null +++ b/interface/src/ui/SnapshotShareDialog.h @@ -0,0 +1,41 @@ +// +// SnapshotShareDialog.h +// interface/src/ui +// +// Created by Stojce Slavkovski on 2/16/14. +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_snapshotShareDialog +#define hifi_snapshotShareDialog + +#include "ui_shareSnapshot.h" + +#include +#include +#include + +class SnapshotShareDialog : public QDialog { + Q_OBJECT + +public: + SnapshotShareDialog(QString fileName, QWidget* parent = 0); + +private: + QString _fileName; + QNetworkAccessManager* _networkAccessManager; + Ui_SnapshotShareDialog _ui; + + void uploadSnapshot(); + void sendForumPost(QString snapshotPath); + +private slots: + void uploadRequestFinished(); + void postRequestFinished(); + void accept(); +}; + +#endif // hifi_snapshotShareDialog diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index 6abd0f2d5a..cb0106cd48 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -88,10 +88,6 @@ padding-top: 3px; Reload all - - - ../resources/images/reload.svg../resources/images/reload.svg - @@ -115,10 +111,6 @@ padding-top: 3px; Stop all - - - ../resources/images/stop.svg../resources/images/stop.svg - @@ -251,10 +243,6 @@ padding-top: 3px; Load script - - - ../resources/images/plus.svg../resources/images/plus.svg - widgetTitle currentlyRunningLabel diff --git a/interface/ui/shareSnapshot.ui b/interface/ui/shareSnapshot.ui new file mode 100644 index 0000000000..df7fc4939f --- /dev/null +++ b/interface/ui/shareSnapshot.ui @@ -0,0 +1,377 @@ + + + SnapshotShareDialog + + + Qt::NonModal + + + + 0 + 0 + 502 + 616 + + + + + 0 + 0 + + + + + 500 + 616 + + + + + 502 + 616 + + + + Share with Alphas + + + background-color: rgb(255, 255, 255); + + + true + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + QLayout::SetMinAndMaxSize + + + + + + 0 + 0 + + + + + 500 + 500 + + + + + 30 + 2000 + + + + background-color: #ccc; + + + 0 + + + true + + + Qt::AlignCenter + + + 0 + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 9 + + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 0 + + + + + Arial + + + + color: #666 + + + + + + Qt::RichText + + + Qt::AlignCenter + + + true + + + Qt::TextBrowserInteraction + + + + + + + + 0 + 0 + + + + + 0 + 19 + + + + + Helvetica + 14 + 75 + true + + + + color: #666; +padding-left:20px; + + + QFrame::NoFrame + + + 0 + + + Notes about this image + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + 0 + + + + + + + 0 + + + QLayout::SetFixedSize + + + 0 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 19 + 20 + + + + + + + + + 0 + 0 + + + + + 16777215 + 60 + + + + + Helvetica + 14 + + + + border: 1px solid #c5c5c5; + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Helvetica'; font-size:14pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 25 + 19 + + + + + + + + background-color: #333333; + border-width: 0; + border-radius: 9px; + border-radius: 9px; + font-family: Arial; + font-size: 18px; + font-weight: 100; + color: #FFFFFF; + width: 120px; + height: 50px; + + + Share + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 25 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 11 + + + + + + + + + + + + shareButton + clicked() + SnapshotShareDialog + accept() + + + 420 + 565 + + + 250 + 307 + + + + + diff --git a/libraries/networking/src/DataServerAccountInfo.cpp b/libraries/networking/src/DataServerAccountInfo.cpp index 87d3b694a7..a9522148a8 100644 --- a/libraries/networking/src/DataServerAccountInfo.cpp +++ b/libraries/networking/src/DataServerAccountInfo.cpp @@ -16,7 +16,8 @@ DataServerAccountInfo::DataServerAccountInfo() : _accessToken(), _username(), - _xmppPassword() + _xmppPassword(), + _discourseApiKey() { } @@ -29,12 +30,14 @@ DataServerAccountInfo::DataServerAccountInfo(const QJsonObject& jsonObject) : QJsonObject userJSONObject = jsonObject["user"].toObject(); setUsername(userJSONObject["username"].toString()); setXMPPPassword(userJSONObject["xmpp_password"].toString()); + setDiscourseApiKey(userJSONObject["discourse_api_key"].toString()); } DataServerAccountInfo::DataServerAccountInfo(const DataServerAccountInfo& otherInfo) { _accessToken = otherInfo._accessToken; _username = otherInfo._username; _xmppPassword = otherInfo._xmppPassword; + _discourseApiKey = otherInfo._discourseApiKey; } DataServerAccountInfo& DataServerAccountInfo::operator=(const DataServerAccountInfo& otherInfo) { @@ -49,6 +52,7 @@ void DataServerAccountInfo::swap(DataServerAccountInfo& otherInfo) { swap(_accessToken, otherInfo._accessToken); swap(_username, otherInfo._username); swap(_xmppPassword, otherInfo._xmppPassword); + swap(_discourseApiKey, otherInfo._discourseApiKey); } void DataServerAccountInfo::setUsername(const QString& username) { @@ -65,6 +69,12 @@ void DataServerAccountInfo::setXMPPPassword(const QString& xmppPassword) { } } +void DataServerAccountInfo::setDiscourseApiKey(const QString& discourseApiKey) { + if (_discourseApiKey != discourseApiKey) { + _discourseApiKey = discourseApiKey; + } +} + QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info) { out << info._accessToken << info._username << info._xmppPassword; return out; diff --git a/libraries/networking/src/DataServerAccountInfo.h b/libraries/networking/src/DataServerAccountInfo.h index 21380c0855..a7d1fa9cb0 100644 --- a/libraries/networking/src/DataServerAccountInfo.h +++ b/libraries/networking/src/DataServerAccountInfo.h @@ -31,7 +31,10 @@ public: const QString& getXMPPPassword() const { return _xmppPassword; } void setXMPPPassword(const QString& xmppPassword); - + + const QString& getDiscourseApiKey() const { return _discourseApiKey; } + void setDiscourseApiKey(const QString& discourseApiKey); + friend QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info); friend QDataStream& operator>>(QDataStream &in, DataServerAccountInfo& info); private: @@ -40,6 +43,7 @@ private: OAuthAccessToken _accessToken; QString _username; QString _xmppPassword; + QString _discourseApiKey; }; #endif // hifi_DataServerAccountInfo_h