From d84a65a5f9a0bc2f373e047e6956dc7f7cf48ee1 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Sat, 10 Jan 2015 01:29:06 +0100 Subject: [PATCH 01/10] running scripts list -> treeview initial --- interface/src/ScriptsModel.cpp | 113 +++++++++++++++++----- interface/src/ScriptsModel.h | 51 ++++++++-- interface/src/ui/RunningScriptsWidget.cpp | 10 +- interface/ui/runningScriptsWidget.ui | 31 +++++- 4 files changed, 164 insertions(+), 41 deletions(-) diff --git a/interface/src/ScriptsModel.cpp b/interface/src/ScriptsModel.cpp index 41ce16c229..d178397fc2 100644 --- a/interface/src/ScriptsModel.cpp +++ b/interface/src/ScriptsModel.cpp @@ -11,6 +11,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include #include #include #include @@ -31,18 +32,30 @@ static const QString IS_TRUNCATED_NAME = "IsTruncated"; static const QString CONTAINER_NAME = "Contents"; static const QString KEY_NAME = "Key"; -ScriptItem::ScriptItem(const QString& filename, const QString& fullPath) : +TreeNodeBase::TreeNodeBase(TreeNodeFolder* parent, TreeNodeType type) : + _parent(parent), + _type(type) { +}; + +TreeNodeScript::TreeNodeScript(const QString& filename, const QString& fullPath, ScriptOrigin origin) : + TreeNodeBase(NULL, TREE_NODE_TYPE_SCRIPT), _filename(filename), - _fullPath(fullPath) { + _fullPath(fullPath), + _origin(origin) +{ +}; + +TreeNodeFolder::TreeNodeFolder(const QString& foldername, TreeNodeFolder* parent) : + TreeNodeBase(parent, TREE_NODE_TYPE_FOLDER), + _foldername(foldername) { }; ScriptsModel::ScriptsModel(QObject* parent) : - QAbstractListModel(parent), + QAbstractItemModel(parent), _loadingScripts(false), _localDirectory(), _fsWatcher(), - _localFiles(), - _remoteFiles() + _treeNodes() { _localDirectory.setFilter(QDir::Files | QDir::Readable); @@ -57,23 +70,31 @@ ScriptsModel::ScriptsModel(QObject* parent) : reloadRemoteFiles(); } +QModelIndex ScriptsModel::index(int row, int column, const QModelIndex& parent) const { + return QModelIndex(); +} + +QModelIndex ScriptsModel::parent(const QModelIndex& child) const { + return QModelIndex(); +} + QVariant ScriptsModel::data(const QModelIndex& index, int role) const { - const QList* files = NULL; + /*const QList* files = NULL; int row = 0; bool isLocal = index.row() < _localFiles.size(); - if (isLocal) { - files = &_localFiles; - row = index.row(); - } else { - files = &_remoteFiles; - row = index.row() - _localFiles.size(); - } + if (isLocal) { + files = &_localFiles; + row = index.row(); + } else { + files = &_remoteFiles; + row = index.row() - _localFiles.size(); + } if (role == Qt::DisplayRole) { return QVariant((*files)[row]->getFilename() + (isLocal ? " (local)" : "")); } else if (role == ScriptPath) { return QVariant((*files)[row]->getFullPath()); - } + }*/ return QVariant(); } @@ -81,9 +102,14 @@ int ScriptsModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) { return 0; } - return _localFiles.length() + _remoteFiles.length(); + return 0;// _localFiles.length() + _remoteFiles.length(); } +int ScriptsModel::columnCount(const QModelIndex& parent) const { + return 1; +} + + void ScriptsModel::updateScriptsLocation(const QString& newPath) { _fsWatcher.removePath(_localDirectory.absolutePath()); @@ -93,7 +119,7 @@ void ScriptsModel::updateScriptsLocation(const QString& newPath) { if (!_localDirectory.absolutePath().isEmpty()) { _fsWatcher.addPath(_localDirectory.absolutePath()); } - } + } reloadLocalFiles(); } @@ -101,8 +127,12 @@ void ScriptsModel::updateScriptsLocation(const QString& newPath) { void ScriptsModel::reloadRemoteFiles() { if (!_loadingScripts) { _loadingScripts = true; - while (!_remoteFiles.isEmpty()) { - delete _remoteFiles.takeFirst(); + for (int i = _treeNodes.size() - 1; i >= 0; i--) { + TreeNodeBase* node = _treeNodes.at(i); + if (typeid(*node) == typeid(TreeNodeScript) && static_cast(node)->getOrigin() == SCRIPT_ORIGIN_REMOTE) { + delete node; + _treeNodes.removeAt(i); + } } requestRemoteFiles(); } @@ -121,7 +151,6 @@ void ScriptsModel::requestRemoteFiles(QString marker) { QNetworkRequest request(url); QNetworkReply* reply = networkAccessManager.get(request); connect(reply, SIGNAL(finished()), SLOT(downloadFinished())); - } void ScriptsModel::downloadFinished() { @@ -170,7 +199,7 @@ bool ScriptsModel::parseXML(QByteArray xmlFile) { xml.readNext(); lastKey = xml.text().toString(); if (jsRegex.exactMatch(xml.text().toString())) { - _remoteFiles.append(new ScriptItem(lastKey.mid(MODELS_LOCATION.length()), S3_URL + "/" + lastKey)); + _treeNodes.append(new TreeNodeScript(lastKey.mid(MODELS_LOCATION.length()), S3_URL + "/" + lastKey, SCRIPT_ORIGIN_REMOTE)); } } xml.readNext(); @@ -178,7 +207,7 @@ bool ScriptsModel::parseXML(QByteArray xmlFile) { } xml.readNext(); } - + rebuildTree(); endResetModel(); // Error handling @@ -198,8 +227,15 @@ bool ScriptsModel::parseXML(QByteArray xmlFile) { void ScriptsModel::reloadLocalFiles() { beginResetModel(); - while (!_localFiles.isEmpty()) { - delete _localFiles.takeFirst(); + for (int i = _treeNodes.size() - 1; i >= 0; i--) { + TreeNodeBase* node = _treeNodes.at(i); + qDebug() << "deleting local " << i << " " << typeid(*node).name(); + if (node->getType() == TREE_NODE_TYPE_SCRIPT && + static_cast(node)->getOrigin() == SCRIPT_ORIGIN_LOCAL) + { + delete node; + _treeNodes.removeAt(i); + } } _localDirectory.refresh(); @@ -207,8 +243,35 @@ void ScriptsModel::reloadLocalFiles() { const QFileInfoList localFiles = _localDirectory.entryInfoList(); for (int i = 0; i < localFiles.size(); i++) { QFileInfo file = localFiles[i]; - _localFiles.append(new ScriptItem(file.fileName(), file.absoluteFilePath())); + _treeNodes.append(new TreeNodeScript(file.fileName(), file.absoluteFilePath(), SCRIPT_ORIGIN_LOCAL)); } - + rebuildTree(); endResetModel(); } + +void ScriptsModel::rebuildTree() { + for (int i = _treeNodes.size() - 1; i >= 0; i--) { + + if (_treeNodes.at(i)->getType() == TREE_NODE_TYPE_FOLDER) { + delete _treeNodes.at(i); + _treeNodes.removeAt(i); + } + } + QHash folders; + for (int i = 0; i < _treeNodes.size(); i++) { + TreeNodeBase* node = _treeNodes.at(i); + qDebug() << "blup" << i << typeid(*node).name(); + if (typeid(*node) == typeid(TreeNodeScript)) { + TreeNodeScript* script = static_cast(node); + TreeNodeFolder* parent = NULL; + QString hash; + QStringList pathList = script->getFilename().split(tr("/")); + QStringList::const_iterator pathIterator; + for (pathIterator = pathList.constBegin(); pathIterator != pathList.constEnd(); ++pathIterator) { + hash.append("/" + *pathIterator); + qDebug() << hash; + } + } + } + folders.clear(); +} diff --git a/interface/src/ScriptsModel.h b/interface/src/ScriptsModel.h index ca72a8d8f4..bb4883e399 100644 --- a/interface/src/ScriptsModel.h +++ b/interface/src/ScriptsModel.h @@ -12,30 +12,67 @@ #ifndef hifi_ScriptsModel_h #define hifi_ScriptsModel_h -#include +#include #include #include #include -class ScriptItem { +class TreeNodeFolder; + +enum ScriptOrigin { + SCRIPT_ORIGIN_LOCAL, + SCRIPT_ORIGIN_REMOTE +}; + +enum TreeNodeType { + TREE_NODE_TYPE_SCRIPT, + TREE_NODE_TYPE_FOLDER +}; + +class TreeNodeBase { public: - ScriptItem(const QString& filename, const QString& fullPath); + const TreeNodeFolder* getParent() { return _parent; } + void setParent(TreeNodeFolder* parent) { _parent = parent; } + TreeNodeType getType() { return _type; } + +private: + TreeNodeFolder* _parent; + TreeNodeType _type; + +protected: + TreeNodeBase(TreeNodeFolder* parent, TreeNodeType type); +}; + +class TreeNodeScript : public TreeNodeBase { +public: + TreeNodeScript(const QString& filename, const QString& fullPath, ScriptOrigin origin); const QString& getFilename() { return _filename; }; const QString& getFullPath() { return _fullPath; }; + const ScriptOrigin getOrigin() { return _origin; }; private: QString _filename; QString _fullPath; + ScriptOrigin _origin; }; -class ScriptsModel : public QAbstractListModel { +class TreeNodeFolder : public TreeNodeBase { +public: + TreeNodeFolder(const QString& foldername, TreeNodeFolder* parent); +private: + QString _foldername; +}; + +class ScriptsModel : public QAbstractItemModel { Q_OBJECT public: ScriptsModel(QObject* parent = NULL); - + QModelIndex index(int row, int column, const QModelIndex& parent) const; + QModelIndex parent(const QModelIndex& child) const; virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; enum Role { ScriptPath = Qt::UserRole, @@ -50,13 +87,13 @@ protected slots: protected: void requestRemoteFiles(QString marker = QString()); bool parseXML(QByteArray xmlFile); + void rebuildTree(); private: bool _loadingScripts; QDir _localDirectory; QFileSystemWatcher _fsWatcher; - QList _localFiles; - QList _remoteFiles; + QList _treeNodes; }; #endif // hifi_ScriptsModel_h diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index 57c0532777..f56c6e32af 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -50,10 +50,10 @@ RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) : _proxyModel.setSourceModel(&_scriptsModel); _proxyModel.sort(0, Qt::AscendingOrder); _proxyModel.setDynamicSortFilter(true); - ui->scriptListView->setModel(&_proxyModel); + ui->scriptTreeView->setModel(&_proxyModel); connect(ui->filterLineEdit, &QLineEdit::textChanged, this, &RunningScriptsWidget::updateFileFilter); - connect(ui->scriptListView, &QListView::doubleClicked, this, &RunningScriptsWidget::loadScriptFromList); + connect(ui->scriptTreeView, &QTreeView::doubleClicked, this, &RunningScriptsWidget::loadScriptFromList); connect(ui->reloadAllButton, &QPushButton::clicked, Application::getInstance(), &Application::reloadAllScripts); @@ -80,7 +80,7 @@ void RunningScriptsWidget::loadScriptFromList(const QModelIndex& index) { } void RunningScriptsWidget::loadSelectedScript() { - QModelIndex selectedIndex = ui->scriptListView->currentIndex(); + QModelIndex selectedIndex = ui->scriptTreeView->currentIndex(); if (selectedIndex.isValid()) { loadScriptFromList(selectedIndex); } @@ -166,7 +166,7 @@ void RunningScriptsWidget::showEvent(QShowEvent* event) { void RunningScriptsWidget::selectFirstInList() { if (_proxyModel.rowCount() > 0) { - ui->scriptListView->setCurrentIndex(_proxyModel.index(0, 0)); + ui->scriptTreeView->setCurrentIndex(_proxyModel.index(0, 0)); } } @@ -177,7 +177,7 @@ bool RunningScriptsWidget::eventFilter(QObject* sender, QEvent* event) { } QKeyEvent* keyEvent = static_cast(event); if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) { - QModelIndex selectedIndex = ui->scriptListView->currentIndex(); + QModelIndex selectedIndex = ui->scriptTreeView->currentIndex(); if (selectedIndex.isValid()) { loadScriptFromList(selectedIndex); } diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index b70200e9f2..203db35d2d 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -245,8 +245,8 @@ font: bold 16px; 0 0 - 328 - 18 + 334 + 20 @@ -390,10 +390,27 @@ font: bold 16px; + + + + color: #0e7077; font: bold 14px; + + + Load script + + + + + + + from URL + + + - Load script + from Disk @@ -429,7 +446,7 @@ font: bold 16px; - + 0 @@ -442,6 +459,12 @@ font: bold 16px; Qt::ScrollBarAlwaysOff + + true + + + true + From 8feb51013ba266fec4b80e10b4dcfded6ff84845 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Mon, 12 Jan 2015 00:41:38 +0100 Subject: [PATCH 02/10] running script window treeview fully works --- interface/src/ScriptsModel.cpp | 106 ++++++++++++++-------- interface/src/ScriptsModel.h | 23 ++--- interface/src/ScriptsModelFilter.cpp | 44 +++++++++ interface/src/ScriptsModelFilter.h | 27 ++++++ interface/src/ui/RunningScriptsWidget.cpp | 20 ++-- interface/src/ui/RunningScriptsWidget.h | 3 +- 6 files changed, 161 insertions(+), 62 deletions(-) create mode 100644 interface/src/ScriptsModelFilter.cpp create mode 100644 interface/src/ScriptsModelFilter.h diff --git a/interface/src/ScriptsModel.cpp b/interface/src/ScriptsModel.cpp index d178397fc2..0c711cd940 100644 --- a/interface/src/ScriptsModel.cpp +++ b/interface/src/ScriptsModel.cpp @@ -11,7 +11,6 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include #include #include #include @@ -32,22 +31,21 @@ static const QString IS_TRUNCATED_NAME = "IsTruncated"; static const QString CONTAINER_NAME = "Contents"; static const QString KEY_NAME = "Key"; -TreeNodeBase::TreeNodeBase(TreeNodeFolder* parent, TreeNodeType type) : +TreeNodeBase::TreeNodeBase(TreeNodeFolder* parent, const QString& name, TreeNodeType type) : _parent(parent), + _name(name), _type(type) { }; -TreeNodeScript::TreeNodeScript(const QString& filename, const QString& fullPath, ScriptOrigin origin) : - TreeNodeBase(NULL, TREE_NODE_TYPE_SCRIPT), - _filename(filename), +TreeNodeScript::TreeNodeScript(const QString& localPath, const QString& fullPath, ScriptOrigin origin) : + TreeNodeBase(NULL, localPath.split("/").last(), TREE_NODE_TYPE_SCRIPT), + _localPath(localPath), _fullPath(fullPath), - _origin(origin) -{ + _origin(origin) { }; TreeNodeFolder::TreeNodeFolder(const QString& foldername, TreeNodeFolder* parent) : - TreeNodeBase(parent, TREE_NODE_TYPE_FOLDER), - _foldername(foldername) { + TreeNodeBase(parent, foldername, TREE_NODE_TYPE_FOLDER) { }; ScriptsModel::ScriptsModel(QObject* parent) : @@ -57,7 +55,6 @@ ScriptsModel::ScriptsModel(QObject* parent) : _fsWatcher(), _treeNodes() { - _localDirectory.setFilter(QDir::Files | QDir::Readable); _localDirectory.setNameFilters(QStringList("*.js")); @@ -70,46 +67,56 @@ ScriptsModel::ScriptsModel(QObject* parent) : reloadRemoteFiles(); } +TreeNodeBase* ScriptsModel::getTreeNodeFromIndex(const QModelIndex& index) const { + if (index.isValid()) { + return static_cast(index.internalPointer()); + } + return NULL; +} + QModelIndex ScriptsModel::index(int row, int column, const QModelIndex& parent) const { - return QModelIndex(); + if (row < 0 || column < 0) { + return QModelIndex(); + } + return createIndex(row, column, getFolderNodes(static_cast(getTreeNodeFromIndex(parent))).at(row)); } QModelIndex ScriptsModel::parent(const QModelIndex& child) const { - return QModelIndex(); + TreeNodeFolder* parent = (static_cast(child.internalPointer()))->getParent(); + if (!parent) { + return QModelIndex(); + } + TreeNodeFolder* grandParent = parent->getParent(); + int row = getFolderNodes(grandParent).indexOf(parent); + return createIndex(row, 0, parent); } QVariant ScriptsModel::data(const QModelIndex& index, int role) const { - /*const QList* files = NULL; - int row = 0; - bool isLocal = index.row() < _localFiles.size(); - if (isLocal) { - files = &_localFiles; - row = index.row(); - } else { - files = &_remoteFiles; - row = index.row() - _localFiles.size(); + TreeNodeBase* node = getTreeNodeFromIndex(index); + if (node->getType() == TREE_NODE_TYPE_SCRIPT) { + TreeNodeScript* script = static_cast(node); + if (role == Qt::DisplayRole) { + return QVariant(script->getName() + (script->getOrigin() == SCRIPT_ORIGIN_LOCAL ? " (local)" : "")); + } else if (role == ScriptPath) { + return QVariant(script->getFullPath()); + } + } else if (node->getType() == TREE_NODE_TYPE_FOLDER) { + TreeNodeFolder* folder = static_cast(node); + if (role == Qt::DisplayRole) { + return QVariant(folder->getName()); + } } - - if (role == Qt::DisplayRole) { - return QVariant((*files)[row]->getFilename() + (isLocal ? " (local)" : "")); - } else if (role == ScriptPath) { - return QVariant((*files)[row]->getFullPath()); - }*/ return QVariant(); } int ScriptsModel::rowCount(const QModelIndex& parent) const { - if (parent.isValid()) { - return 0; - } - return 0;// _localFiles.length() + _remoteFiles.length(); + return getFolderNodes(static_cast(getTreeNodeFromIndex(parent))).count(); } int ScriptsModel::columnCount(const QModelIndex& parent) const { return 1; } - void ScriptsModel::updateScriptsLocation(const QString& newPath) { _fsWatcher.removePath(_localDirectory.absolutePath()); @@ -129,7 +136,9 @@ void ScriptsModel::reloadRemoteFiles() { _loadingScripts = true; for (int i = _treeNodes.size() - 1; i >= 0; i--) { TreeNodeBase* node = _treeNodes.at(i); - if (typeid(*node) == typeid(TreeNodeScript) && static_cast(node)->getOrigin() == SCRIPT_ORIGIN_REMOTE) { + if (node->getType() == TREE_NODE_TYPE_SCRIPT && + static_cast(node)->getOrigin() == SCRIPT_ORIGIN_REMOTE) + { delete node; _treeNodes.removeAt(i); } @@ -229,7 +238,6 @@ void ScriptsModel::reloadLocalFiles() { for (int i = _treeNodes.size() - 1; i >= 0; i--) { TreeNodeBase* node = _treeNodes.at(i); - qDebug() << "deleting local " << i << " " << typeid(*node).name(); if (node->getType() == TREE_NODE_TYPE_SCRIPT && static_cast(node)->getOrigin() == SCRIPT_ORIGIN_LOCAL) { @@ -251,7 +259,6 @@ void ScriptsModel::reloadLocalFiles() { void ScriptsModel::rebuildTree() { for (int i = _treeNodes.size() - 1; i >= 0; i--) { - if (_treeNodes.at(i)->getType() == TREE_NODE_TYPE_FOLDER) { delete _treeNodes.at(i); _treeNodes.removeAt(i); @@ -260,18 +267,37 @@ void ScriptsModel::rebuildTree() { QHash folders; for (int i = 0; i < _treeNodes.size(); i++) { TreeNodeBase* node = _treeNodes.at(i); - qDebug() << "blup" << i << typeid(*node).name(); - if (typeid(*node) == typeid(TreeNodeScript)) { + if (node->getType() == TREE_NODE_TYPE_SCRIPT) { TreeNodeScript* script = static_cast(node); TreeNodeFolder* parent = NULL; QString hash; - QStringList pathList = script->getFilename().split(tr("/")); + QStringList pathList = script->getLocalPath().split(tr("/")); + pathList.removeLast(); QStringList::const_iterator pathIterator; for (pathIterator = pathList.constBegin(); pathIterator != pathList.constEnd(); ++pathIterator) { - hash.append("/" + *pathIterator); - qDebug() << hash; + hash.append(*pathIterator + "/"); + if (!folders.contains(hash)) { + folders[hash] = new TreeNodeFolder(*pathIterator, parent); + } + parent = folders[hash]; } + script->setParent(parent); } } + QHash::const_iterator folderIterator; + for (folderIterator = folders.constBegin(); folderIterator != folders.constEnd(); ++folderIterator) { + _treeNodes.append(*folderIterator); + } folders.clear(); } + +QList ScriptsModel::getFolderNodes(TreeNodeFolder* parent) const { + QList result; + for (int i = 0; i < _treeNodes.size(); i++) { + TreeNodeBase* node = _treeNodes.at(i); + if (node->getParent() == parent) { + result.append(node); + } + } + return result; +} diff --git a/interface/src/ScriptsModel.h b/interface/src/ScriptsModel.h index bb4883e399..549f87c0d7 100644 --- a/interface/src/ScriptsModel.h +++ b/interface/src/ScriptsModel.h @@ -31,28 +31,29 @@ enum TreeNodeType { class TreeNodeBase { public: - const TreeNodeFolder* getParent() { return _parent; } + TreeNodeFolder* getParent() const { return _parent; } void setParent(TreeNodeFolder* parent) { _parent = parent; } TreeNodeType getType() { return _type; } + const QString& getName() { return _name; }; private: TreeNodeFolder* _parent; TreeNodeType _type; protected: - TreeNodeBase(TreeNodeFolder* parent, TreeNodeType type); + QString _name; + TreeNodeBase(TreeNodeFolder* parent, const QString& name, TreeNodeType type); }; class TreeNodeScript : public TreeNodeBase { public: - TreeNodeScript(const QString& filename, const QString& fullPath, ScriptOrigin origin); - - const QString& getFilename() { return _filename; }; + TreeNodeScript(const QString& localPath, const QString& fullPath, ScriptOrigin origin); + const QString& getLocalPath() { return _localPath; } const QString& getFullPath() { return _fullPath; }; const ScriptOrigin getOrigin() { return _origin; }; private: - QString _filename; + QString _localPath; QString _fullPath; ScriptOrigin _origin; }; @@ -60,8 +61,6 @@ private: class TreeNodeFolder : public TreeNodeBase { public: TreeNodeFolder(const QString& foldername, TreeNodeFolder* parent); -private: - QString _foldername; }; class ScriptsModel : public QAbstractItemModel { @@ -70,9 +69,11 @@ public: ScriptsModel(QObject* parent = NULL); QModelIndex index(int row, int column, const QModelIndex& parent) const; QModelIndex parent(const QModelIndex& child) const; - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; + int rowCount(const QModelIndex& parent = QModelIndex()) const; + int columnCount(const QModelIndex& parent = QModelIndex()) const; + TreeNodeBase* getTreeNodeFromIndex(const QModelIndex& index) const; + QList getFolderNodes(TreeNodeFolder* parent) const; enum Role { ScriptPath = Qt::UserRole, diff --git a/interface/src/ScriptsModelFilter.cpp b/interface/src/ScriptsModelFilter.cpp new file mode 100644 index 0000000000..1879e547c0 --- /dev/null +++ b/interface/src/ScriptsModelFilter.cpp @@ -0,0 +1,44 @@ +// +// ScriptsModelFilter.cpp +// interface/src +// +// Created by Thijs Wenker on 01/11/15. +// Copyright 2015 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 "ScriptsModelFilter.h" + +ScriptsModelFilter::ScriptsModelFilter(QObject *parent) : + QSortFilterProxyModel(parent) { +} + +bool ScriptsModelFilter::lessThan(const QModelIndex& left, const QModelIndex& right) const { + ScriptsModel* scriptsModel = static_cast(sourceModel()); + TreeNodeBase* leftNode = scriptsModel->getTreeNodeFromIndex(left); + TreeNodeBase* rightNode = scriptsModel->getTreeNodeFromIndex(right); + if (leftNode->getType() != rightNode->getType()) { + return leftNode->getType() == TREE_NODE_TYPE_FOLDER; + } + return leftNode->getName() < rightNode->getName(); +} + +bool ScriptsModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const { + if (!filterRegExp().isEmpty()) { + ScriptsModel* scriptsModel = static_cast(sourceModel()); + TreeNodeBase* node = scriptsModel->getFolderNodes( + static_cast(scriptsModel->getTreeNodeFromIndex(sourceParent))).at(sourceRow); + QModelIndex sourceIndex = sourceModel()->index(sourceRow, this->filterKeyColumn(), sourceParent); + if (node->getType() == TREE_NODE_TYPE_FOLDER) { + int rows = scriptsModel->rowCount(sourceIndex); + for (int i = 0; i < rows; i++) { + if (filterAcceptsRow(i, sourceIndex)) { + return true; + } + } + } + } + return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); +} diff --git a/interface/src/ScriptsModelFilter.h b/interface/src/ScriptsModelFilter.h new file mode 100644 index 0000000000..7b7cdd974e --- /dev/null +++ b/interface/src/ScriptsModelFilter.h @@ -0,0 +1,27 @@ +// +// ScriptsModelFilter.h +// interface/src +// +// Created by Thijs Wenker on 01/11/15. +// Copyright 2015 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_ScriptsModelFilter_h +#define hifi_ScriptsModelFilter_h + +#include "ScriptsModel.h" +#include + +class ScriptsModelFilter : public QSortFilterProxyModel { + Q_OBJECT +public: + ScriptsModelFilter(QObject *parent = NULL); +protected: + bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const; + bool lessThan(const QModelIndex& left, const QModelIndex& right) const; +}; + +#endif // hifi_ScriptsModelFilter_h diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index f56c6e32af..d577859ebf 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -33,7 +33,7 @@ RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) : Qt::WindowCloseButtonHint), ui(new Ui::RunningScriptsWidget), _signalMapper(this), - _proxyModel(this), + _scriptsModelFilter(this), _scriptsModel(this) { ui->setupUi(this); @@ -41,16 +41,16 @@ RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) : ui->filterLineEdit->installEventFilter(this); - connect(&_proxyModel, &QSortFilterProxyModel::modelReset, + connect(&_scriptsModelFilter, &QSortFilterProxyModel::modelReset, this, &RunningScriptsWidget::selectFirstInList); QString shortcutText = Menu::getInstance()->getActionForOption(MenuOption::ReloadAllScripts)->shortcut().toString(QKeySequence::NativeText); ui->tipLabel->setText("Tip: Use " + shortcutText + " to reload all scripts."); - _proxyModel.setSourceModel(&_scriptsModel); - _proxyModel.sort(0, Qt::AscendingOrder); - _proxyModel.setDynamicSortFilter(true); - ui->scriptTreeView->setModel(&_proxyModel); + _scriptsModelFilter.setSourceModel(&_scriptsModel); + _scriptsModelFilter.sort(0, Qt::AscendingOrder); + _scriptsModelFilter.setDynamicSortFilter(true); + ui->scriptTreeView->setModel(&_scriptsModelFilter); connect(ui->filterLineEdit, &QLineEdit::textChanged, this, &RunningScriptsWidget::updateFileFilter); connect(ui->scriptTreeView, &QTreeView::doubleClicked, this, &RunningScriptsWidget::loadScriptFromList); @@ -70,12 +70,12 @@ RunningScriptsWidget::~RunningScriptsWidget() { void RunningScriptsWidget::updateFileFilter(const QString& filter) { QRegExp regex("^.*" + QRegExp::escape(filter) + ".*$", Qt::CaseInsensitive); - _proxyModel.setFilterRegExp(regex); + _scriptsModelFilter.setFilterRegExp(regex); selectFirstInList(); } void RunningScriptsWidget::loadScriptFromList(const QModelIndex& index) { - QVariant scriptFile = _proxyModel.data(index, ScriptsModel::ScriptPath); + QVariant scriptFile = _scriptsModelFilter.data(index, ScriptsModel::ScriptPath); Application::getInstance()->loadScript(scriptFile.toString()); } @@ -165,8 +165,8 @@ void RunningScriptsWidget::showEvent(QShowEvent* event) { } void RunningScriptsWidget::selectFirstInList() { - if (_proxyModel.rowCount() > 0) { - ui->scriptTreeView->setCurrentIndex(_proxyModel.index(0, 0)); + if (_scriptsModelFilter.rowCount() > 0) { + ui->scriptTreeView->setCurrentIndex(_scriptsModelFilter.index(0, 0)); } } diff --git a/interface/src/ui/RunningScriptsWidget.h b/interface/src/ui/RunningScriptsWidget.h index 69833a890b..3ec5590dee 100644 --- a/interface/src/ui/RunningScriptsWidget.h +++ b/interface/src/ui/RunningScriptsWidget.h @@ -18,6 +18,7 @@ #include #include "ScriptsModel.h" +#include "ScriptsModelFilter.h" #include "ScriptsTableWidget.h" namespace Ui { @@ -54,7 +55,7 @@ private slots: private: Ui::RunningScriptsWidget* ui; QSignalMapper _signalMapper; - QSortFilterProxyModel _proxyModel; + ScriptsModelFilter _scriptsModelFilter; ScriptsModel _scriptsModel; ScriptsTableWidget* _recentlyLoadedScriptsTable; QStringList _recentlyLoadedScripts; From e4fd027d15426ac01bf82b4467231a03daf765bf Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Mon, 12 Jan 2015 00:49:41 +0100 Subject: [PATCH 03/10] "load script from URL" button in Running scripts window --- interface/src/ui/RunningScriptsWidget.cpp | 4 +++- interface/ui/runningScriptsWidget.ui | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index d577859ebf..46c8f90ff6 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -59,8 +59,10 @@ RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) : Application::getInstance(), &Application::reloadAllScripts); connect(ui->stopAllButton, &QPushButton::clicked, this, &RunningScriptsWidget::allScriptsStopped); - connect(ui->loadScriptButton, &QPushButton::clicked, + connect(ui->loadScriptFromDiskButton, &QPushButton::clicked, Application::getInstance(), &Application::loadDialog); + connect(ui->loadScriptFromURLButton, &QPushButton::clicked, + Application::getInstance(), &Application::loadScriptURLDialog); connect(&_signalMapper, SIGNAL(mapped(QString)), Application::getInstance(), SLOT(stopScript(const QString&))); } diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index 203db35d2d..ea53e72e15 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -401,14 +401,14 @@ font: bold 16px; - + from URL - + from Disk @@ -463,7 +463,7 @@ font: bold 16px; true - true + false From 8c7099a0bb44abbac5cf9e5aad20a1260353ee66 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Tue, 13 Jan 2015 01:09:28 +0100 Subject: [PATCH 04/10] changed "Load Scripts" label to be better understandable --- interface/ui/runningScriptsWidget.ui | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index ea53e72e15..3d7db5064a 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -373,7 +373,7 @@ font: bold 16px; font: bold 16px; - Scripts + Load Scripts @@ -390,16 +390,6 @@ font: bold 16px; - - - - color: #0e7077; font: bold 14px; - - - Load script - - - From d820df4972db058449124b56ca37f22b6b1b249e Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Thu, 15 Jan 2015 22:54:32 +0100 Subject: [PATCH 05/10] ScriptModel destructor --- interface/src/ScriptsModel.cpp | 7 +++++++ interface/src/ScriptsModel.h | 1 + interface/src/ui/RunningScriptsWidget.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/interface/src/ScriptsModel.cpp b/interface/src/ScriptsModel.cpp index 0c711cd940..b09762b73c 100644 --- a/interface/src/ScriptsModel.cpp +++ b/interface/src/ScriptsModel.cpp @@ -67,6 +67,13 @@ ScriptsModel::ScriptsModel(QObject* parent) : reloadRemoteFiles(); } +ScriptsModel::~ScriptsModel() { + for (int i = _treeNodes.size() - 1; i >= 0; i--) { + delete _treeNodes.at(i); + } + _treeNodes.clear(); +} + TreeNodeBase* ScriptsModel::getTreeNodeFromIndex(const QModelIndex& index) const { if (index.isValid()) { return static_cast(index.internalPointer()); diff --git a/interface/src/ScriptsModel.h b/interface/src/ScriptsModel.h index 549f87c0d7..914a197201 100644 --- a/interface/src/ScriptsModel.h +++ b/interface/src/ScriptsModel.h @@ -67,6 +67,7 @@ class ScriptsModel : public QAbstractItemModel { Q_OBJECT public: ScriptsModel(QObject* parent = NULL); + ~ScriptsModel(); QModelIndex index(int row, int column, const QModelIndex& parent) const; QModelIndex parent(const QModelIndex& child) const; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index 46c8f90ff6..4346d813bb 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -68,6 +68,7 @@ RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) : RunningScriptsWidget::~RunningScriptsWidget() { delete ui; + _scriptsModel.deleteLater(); } void RunningScriptsWidget::updateFileFilter(const QString& filter) { From cdaecbd8469b5a3d52f5ceb4a9d2f398ee1c380d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 15 Jan 2015 16:40:13 -0800 Subject: [PATCH 06/10] Update lobby.js --- examples/lobby.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/lobby.js b/examples/lobby.js index 636f0a95f1..fcac7a490b 100644 --- a/examples/lobby.js +++ b/examples/lobby.js @@ -165,8 +165,7 @@ function changeLobbyTextures() { for (var j = 0; j < NUM_PANELS; j++) { var panelIndex = placeIndexToPanelIndex(j); - textureProp["textures"]["file" + panelIndex] = HIFI_PUBLIC_BUCKET + "images/places/" - + places[j].id + "/hifi-place-" + places[j].id + "_640x360.jpg"; + textureProp["textures"]["file" + panelIndex] = places[j].previews.lobby; }; Overlays.editOverlay(panelWall, textureProp); From 61caf5e4b4d7e78af4e606b4d36fcabcfcc638c1 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 15 Jan 2015 17:24:25 -0800 Subject: [PATCH 07/10] Fix path to hydraMove.js --- examples/defaultScripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/defaultScripts.js b/examples/defaultScripts.js index cdb8e76c65..a14958dd23 100644 --- a/examples/defaultScripts.js +++ b/examples/defaultScripts.js @@ -11,7 +11,7 @@ Script.load("lookWithTouch.js"); Script.load("editEntities.js"); Script.load("selectAudioDevice.js"); -Script.load("hydraMove.js"); +Script.load("controllers/hydra/hydraMove.js"); Script.load("headMove.js"); Script.load("inspect.js"); Script.load("lobby.js"); From a07b5a9723ed28f6cfcb3b21c53fd6fc315ece19 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Thu, 15 Jan 2015 17:34:52 -0800 Subject: [PATCH 08/10] laser pointers to guns, toppling targets (press 't') --- examples/controllers/hydra/gun.js | 98 ++++++++++++++++--------------- 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/examples/controllers/hydra/gun.js b/examples/controllers/hydra/gun.js index 1f613adf3b..e3450b708e 100644 --- a/examples/controllers/hydra/gun.js +++ b/examples/controllers/hydra/gun.js @@ -16,6 +16,27 @@ HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; +var RED = { red: 255, green: 0, blue: 0 }; +var LASER_WIDTH = 2; + +var pointer = []; +pointer.push(Overlays.addOverlay("line3d", { + start: { x: 0, y: 0, z: 0 }, + end: { x: 0, y: 0, z: 0 }, + color: RED, + alpha: 1, + visible: true, + lineWidth: LASER_WIDTH +})); +pointer.push(Overlays.addOverlay("line3d", { + start: { x: 0, y: 0, z: 0 }, + end: { x: 0, y: 0, z: 0 }, + color: RED, + alpha: 1, + visible: true, + lineWidth: LASER_WIDTH +})); + function getRandomFloat(min, max) { return Math.random() * (max - min) + min; } @@ -26,7 +47,7 @@ var yawFromMouse = 0; var pitchFromMouse = 0; var isMouseDown = false; -var BULLET_VELOCITY = 20.0; +var BULLET_VELOCITY = 5.0; var MIN_THROWER_DELAY = 1000; var MAX_THROWER_DELAY = 1000; var LEFT_BUTTON_3 = 3; @@ -106,8 +127,6 @@ if (showScore) { }); } - - function printVector(string, vector) { print(string + " " + vector.x + ", " + vector.y + ", " + vector.z); } @@ -115,7 +134,7 @@ function printVector(string, vector) { function shootBullet(position, velocity) { var BULLET_SIZE = 0.07; var BULLET_LIFETIME = 10.0; - var BULLET_GRAVITY = -0.02; + var BULLET_GRAVITY = 0.0; bulletID = Entities.addEntity( { type: "Sphere", position: position, @@ -124,6 +143,8 @@ function shootBullet(position, velocity) { velocity: velocity, lifetime: BULLET_LIFETIME, gravity: { x: 0, y: BULLET_GRAVITY, z: 0 }, + damping: 0.01, + density: 5000, ignoreCollisions: false, collisionsWillMove: true }); @@ -146,11 +167,11 @@ function shootBullet(position, velocity) { function shootTarget() { var TARGET_SIZE = 0.50; - var TARGET_GRAVITY = -0.25; + var TARGET_GRAVITY = 0.0; var TARGET_LIFETIME = 300.0; - var TARGET_UP_VELOCITY = 0.5; - var TARGET_FWD_VELOCITY = 1.0; - var DISTANCE_TO_LAUNCH_FROM = 3.0; + var TARGET_UP_VELOCITY = 0.0; + var TARGET_FWD_VELOCITY = 0.0; + var DISTANCE_TO_LAUNCH_FROM = 5.0; var ANGLE_RANGE_FOR_LAUNCH = 20.0; var camera = Camera.getPosition(); //printVector("camera", camera); @@ -166,13 +187,14 @@ function shootTarget() { targetID = Entities.addEntity( { type: "Box", position: newPosition, - dimensions: { x: TARGET_SIZE, y: TARGET_SIZE, z: TARGET_SIZE }, - color: { red: 0, green: 200, blue: 200 }, - //angularVelocity: { x: 1, y: 0, z: 0 }, + dimensions: { x: TARGET_SIZE * (0.5 + Math.random()), y: TARGET_SIZE * (0.5 + Math.random()), z: TARGET_SIZE * (0.5 + Math.random()) / 4.0 }, + color: { red: Math.random() * 255, green: Math.random() * 255, blue: Math.random() * 255 }, velocity: velocity, gravity: { x: 0, y: TARGET_GRAVITY, z: 0 }, lifetime: TARGET_LIFETIME, - damping: 0.0001, + rotation: Camera.getOrientation(), + damping: 0.1, + density: 100.0, collisionsWillMove: true }); // Record start time @@ -183,8 +205,6 @@ function shootTarget() { Audio.playSound(targetLaunchSound, audioOptions); } - - function entityCollisionWithEntity(entity1, entity2, collision) { if (((entity1.id == bulletID.id) || (entity1.id == targetID.id)) && @@ -212,7 +232,7 @@ function keyPressEvent(event) { if (event.text == "t") { var time = MIN_THROWER_DELAY + Math.random() * MAX_THROWER_DELAY; Script.setTimeout(shootTarget, time); - } else if (event.text == ".") { + } else if ((event.text == ".") || (event.text == "SPACE")) { shootFromMouse(); } else if (event.text == "r") { playLoadSound(); @@ -254,7 +274,7 @@ function takeFiringPose() { } } -//MyAvatar.attach(gunModel, "RightHand", {x:0.02, y: 0.11, z: 0.04}, Quat.fromPitchYawRollDegrees(-0, -160, -79), 0.20); +MyAvatar.attach(gunModel, "RightHand", {x:0.02, y: 0.11, z: 0.04}, Quat.fromPitchYawRollDegrees(-0, -160, -79), 0.20); MyAvatar.attach(gunModel, "LeftHand", {x:-0.02, y: 0.11, z: 0.04}, Quat.fromPitchYawRollDegrees(0, 0, 79), 0.20); // Give a bit of time to load before playing sound @@ -262,7 +282,6 @@ Script.setTimeout(playLoadSound, 2000); function update(deltaTime) { if (bulletID && !bulletID.isKnownID) { - print("Trying to identify bullet"); bulletID = Entities.identifyEntity(bulletID); } if (targetID && !targetID.isKnownID) { @@ -304,15 +323,6 @@ function update(deltaTime) { } } - // Check hydra controller for launch button press - if (!isLaunchButtonPressed && Controller.isButtonPressed(LEFT_BUTTON_3)) { - isLaunchButtonPressed = true; - var time = MIN_THROWER_DELAY + Math.random() * MAX_THROWER_DELAY; - Script.setTimeout(shootTarget, time); - } else if (isLaunchButtonPressed && !Controller.isButtonPressed(LEFT_BUTTON_3)) { - isLaunchButtonPressed = false; - - } // check for trigger press @@ -335,14 +345,21 @@ function update(deltaTime) { shootABullet = true; } } + var palmController = t * controllersPerTrigger; + var palmPosition = Controller.getSpatialControlPosition(palmController); + var fingerTipController = palmController + 1; + var fingerTipPosition = Controller.getSpatialControlPosition(fingerTipController); + var laserTip = Vec3.sum(Vec3.multiply(100.0, Vec3.subtract(fingerTipPosition, palmPosition)), palmPosition); + + // Update Lasers + Overlays.editOverlay(pointer[t], { + start: palmPosition, + end: laserTip, + alpha: 1 + }); if (shootABullet) { - var palmController = t * controllersPerTrigger; - var palmPosition = Controller.getSpatialControlPosition(palmController); - - var fingerTipController = palmController + 1; - var fingerTipPosition = Controller.getSpatialControlPosition(fingerTipController); - + var palmToFingerTipVector = { x: (fingerTipPosition.x - palmPosition.x), y: (fingerTipPosition.y - palmPosition.y), @@ -361,20 +378,8 @@ function update(deltaTime) { } } -function mousePressEvent(event) { - isMouseDown = true; - lastX = event.x; - lastY = event.y; - - if (Overlays.getOverlayAtPoint({ x: event.x, y: event.y }) === offButton) { - Script.stop(); - } else { - shootFromMouse(); - } -} - function shootFromMouse() { - var DISTANCE_FROM_CAMERA = 2.0; + var DISTANCE_FROM_CAMERA = 1.0; var camera = Camera.getPosition(); var forwardVector = Quat.getFront(Camera.getOrientation()); var newPosition = Vec3.sum(camera, Vec3.multiply(forwardVector, DISTANCE_FROM_CAMERA)); @@ -402,6 +407,8 @@ function mouseMoveEvent(event) { function scriptEnding() { Overlays.deleteOverlay(reticle); Overlays.deleteOverlay(offButton); + Overlays.deleteOverlay(pointer[0]); + Overlays.deleteOverlay(pointer[1]); Overlays.deleteOverlay(text); MyAvatar.detachOne(gunModel); clearPose(); @@ -410,7 +417,6 @@ function scriptEnding() { Entities.entityCollisionWithEntity.connect(entityCollisionWithEntity); Script.scriptEnding.connect(scriptEnding); Script.update.connect(update); -Controller.mousePressEvent.connect(mousePressEvent); Controller.mouseReleaseEvent.connect(mouseReleaseEvent); Controller.mouseMoveEvent.connect(mouseMoveEvent); Controller.keyPressEvent.connect(keyPressEvent); From 891cb42eff45f9b5deb9af7a059066029c291ba0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 15 Jan 2015 17:41:59 -0800 Subject: [PATCH 09/10] use new place names in domain-server settings --- domain-server/resources/web/js/settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/domain-server/resources/web/js/settings.js b/domain-server/resources/web/js/settings.js index 1e9051d717..1ca11af0e1 100644 --- a/domain-server/resources/web/js/settings.js +++ b/domain-server/resources/web/js/settings.js @@ -652,7 +652,7 @@ function chooseFromHighFidelityDomains(clickedButton) { clickedButton.attr('disabled', 'disabled') // get a list of user domains from data-web - data_web_domains_url = "https://data.highfidelity.io/api/v1/domains?access_token=" + data_web_domains_url = "http://localhost:3000/api/v1/domains?access_token=" $.getJSON(data_web_domains_url + Settings.initialValues.metaverse.access_token, function(data){ modal_buttons = { @@ -667,7 +667,7 @@ function chooseFromHighFidelityDomains(clickedButton) { modal_body = "

Choose the High Fidelity domain you want this domain-server to represent.
This will set your domain ID on the settings page.

" domain_select = $("") _.each(data.data.domains, function(domain){ - domain_select.append("") + domain_select.append(""); }) modal_body += "" + domain_select[0].outerHTML modal_buttons["success"] = { From 2c1d4c8a64263f8193087879454b0c1a2c2d5147 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 15 Jan 2015 17:44:15 -0800 Subject: [PATCH 10/10] fix settings url to check domains --- domain-server/resources/web/js/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain-server/resources/web/js/settings.js b/domain-server/resources/web/js/settings.js index 1ca11af0e1..bdd80df9ec 100644 --- a/domain-server/resources/web/js/settings.js +++ b/domain-server/resources/web/js/settings.js @@ -652,7 +652,7 @@ function chooseFromHighFidelityDomains(clickedButton) { clickedButton.attr('disabled', 'disabled') // get a list of user domains from data-web - data_web_domains_url = "http://localhost:3000/api/v1/domains?access_token=" + data_web_domains_url = "https://data.highfidelity.io/api/v1/domains?access_token=" $.getJSON(data_web_domains_url + Settings.initialValues.metaverse.access_token, function(data){ modal_buttons = {