Rename UserLocationsWindow to UserLocationsDialog

This commit is contained in:
Ryan Huffman 2014-07-01 20:03:05 -07:00
parent aa08577c73
commit 83349e0e53
5 changed files with 30 additions and 30 deletions

View file

@ -91,7 +91,7 @@ Menu::Menu() :
_jsConsole(NULL), _jsConsole(NULL),
_octreeStatsDialog(NULL), _octreeStatsDialog(NULL),
_lodToolsDialog(NULL), _lodToolsDialog(NULL),
_userLocationsWindow(NULL), _userLocationsDialog(NULL),
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM), _maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE), _voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
_oculusUIAngularSize(DEFAULT_OCULUS_UI_ANGULAR_SIZE), _oculusUIAngularSize(DEFAULT_OCULUS_UI_ANGULAR_SIZE),
@ -1186,13 +1186,13 @@ void Menu::namedLocationCreated(LocationManager::NamedLocationCreateResponse res
} }
void Menu::toggleLocationList() { void Menu::toggleLocationList() {
if (!_userLocationsWindow) { if (!_userLocationsDialog) {
_userLocationsWindow = new UserLocationsWindow(Application::getInstance()->getWindow()); _userLocationsDialog = new UserLocationsDialog(Application::getInstance()->getWindow());
} }
if (_userLocationsWindow->isVisible()) { if (_userLocationsDialog->isVisible()) {
_userLocationsWindow->hide(); _userLocationsDialog->hide();
} else { } else {
_userLocationsWindow->show(); _userLocationsDialog->show();
} }
} }

View file

@ -29,7 +29,7 @@
#include "ui/JSConsole.h" #include "ui/JSConsole.h"
#include "ui/LoginDialog.h" #include "ui/LoginDialog.h"
#include "ui/ScriptEditorWindow.h" #include "ui/ScriptEditorWindow.h"
#include "ui/UserLocationsWindow.h" #include "ui/UserLocationsDialog.h"
const float ADJUST_LOD_DOWN_FPS = 40.0; const float ADJUST_LOD_DOWN_FPS = 40.0;
const float ADJUST_LOD_UP_FPS = 55.0; const float ADJUST_LOD_UP_FPS = 55.0;
@ -261,7 +261,7 @@ private:
QDialog* _jsConsole; QDialog* _jsConsole;
OctreeStatsDialog* _octreeStatsDialog; OctreeStatsDialog* _octreeStatsDialog;
LodToolsDialog* _lodToolsDialog; LodToolsDialog* _lodToolsDialog;
UserLocationsWindow* _userLocationsWindow; UserLocationsDialog* _userLocationsDialog;
int _maxVoxels; int _maxVoxels;
float _voxelSizeScale; float _voxelSizeScale;
float _oculusUIAngularSize; float _oculusUIAngularSize;

View file

@ -1,5 +1,5 @@
// //
// UserLocationsWindow.cpp // UserLocationsDialog.cpp
// interface/src/ui // interface/src/ui
// //
// Created by Ryan Huffman on 06/24/14. // Created by Ryan Huffman on 06/24/14.
@ -14,9 +14,9 @@
#include <QPushButton> #include <QPushButton>
#include "Menu.h" #include "Menu.h"
#include "UserLocationsWindow.h" #include "UserLocationsDialog.h"
UserLocationsWindow::UserLocationsWindow(QWidget* parent) : UserLocationsDialog::UserLocationsDialog(QWidget* parent) :
QDialog(parent), QDialog(parent),
_ui(), _ui(),
_proxyModel(this), _proxyModel(this),
@ -32,30 +32,30 @@ UserLocationsWindow::UserLocationsWindow(QWidget* parent) :
_ui.locationsTreeView->sortByColumn(UserLocationsModel::NameColumn, Qt::AscendingOrder); _ui.locationsTreeView->sortByColumn(UserLocationsModel::NameColumn, Qt::AscendingOrder);
connect(_ui.locationsTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, connect(_ui.locationsTreeView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &UserLocationsWindow::updateEnabled); this, &UserLocationsDialog::updateEnabled);
connect(&_userLocationsModel, &UserLocationsModel::modelReset, this, &UserLocationsWindow::updateEnabled); connect(&_userLocationsModel, &UserLocationsModel::modelReset, this, &UserLocationsDialog::updateEnabled);
connect(&_userLocationsModel, &UserLocationsModel::modelReset, &_proxyModel, &QSortFilterProxyModel::invalidate); connect(&_userLocationsModel, &UserLocationsModel::modelReset, &_proxyModel, &QSortFilterProxyModel::invalidate);
connect(_ui.locationsTreeView, &QTreeView::doubleClicked, this, &UserLocationsWindow::goToModelIndex); connect(_ui.locationsTreeView, &QTreeView::doubleClicked, this, &UserLocationsDialog::goToModelIndex);
connect(_ui.deleteButton, &QPushButton::clicked, this, &UserLocationsWindow::deleteSelection); connect(_ui.deleteButton, &QPushButton::clicked, this, &UserLocationsDialog::deleteSelection);
connect(_ui.renameButton, &QPushButton::clicked, this, &UserLocationsWindow::renameSelection); connect(_ui.renameButton, &QPushButton::clicked, this, &UserLocationsDialog::renameSelection);
connect(_ui.refreshButton, &QPushButton::clicked, &_userLocationsModel, &UserLocationsModel::refresh); connect(_ui.refreshButton, &QPushButton::clicked, &_userLocationsModel, &UserLocationsModel::refresh);
this->setWindowTitle("My Locations"); this->setWindowTitle("My Locations");
} }
void UserLocationsWindow::updateEnabled() { void UserLocationsDialog::updateEnabled() {
bool enabled = _ui.locationsTreeView->selectionModel()->hasSelection(); bool enabled = _ui.locationsTreeView->selectionModel()->hasSelection();
_ui.renameButton->setEnabled(enabled); _ui.renameButton->setEnabled(enabled);
_ui.deleteButton->setEnabled(enabled); _ui.deleteButton->setEnabled(enabled);
} }
void UserLocationsWindow::goToModelIndex(const QModelIndex& index) { void UserLocationsDialog::goToModelIndex(const QModelIndex& index) {
QVariant location = _proxyModel.data(index.sibling(index.row(), UserLocationsModel::LocationColumn)); QVariant location = _proxyModel.data(index.sibling(index.row(), UserLocationsModel::LocationColumn));
Menu::getInstance()->goToURL(location.toString()); Menu::getInstance()->goToURL(location.toString());
} }
void UserLocationsWindow::deleteSelection() { void UserLocationsDialog::deleteSelection() {
QModelIndex selection = _ui.locationsTreeView->selectionModel()->currentIndex(); QModelIndex selection = _ui.locationsTreeView->selectionModel()->currentIndex();
selection = _proxyModel.mapToSource(selection); selection = _proxyModel.mapToSource(selection);
if (selection.isValid()) { if (selection.isValid()) {
@ -63,7 +63,7 @@ void UserLocationsWindow::deleteSelection() {
} }
} }
void UserLocationsWindow::renameSelection() { void UserLocationsDialog::renameSelection() {
QModelIndex selection = _ui.locationsTreeView->selectionModel()->currentIndex(); QModelIndex selection = _ui.locationsTreeView->selectionModel()->currentIndex();
selection = _proxyModel.mapToSource(selection); selection = _proxyModel.mapToSource(selection);
if (selection.isValid()) { if (selection.isValid()) {

View file

@ -1,5 +1,5 @@
// //
// UserLocationsWindow.h // UserLocationsDialog.h
// interface/src/ui // interface/src/ui
// //
// Created by Ryan Huffman on 06/24/14. // Created by Ryan Huffman on 06/24/14.
@ -9,16 +9,16 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#ifndef hifi_UserLocationsWindow_h #ifndef hifi_UserLocationsDialog_h
#define hifi_UserLocationsWindow_h #define hifi_UserLocationsDialog_h
#include "ui_userLocationsWindow.h" #include "ui_userLocationsDialog.h"
#include "UserLocationsModel.h" #include "UserLocationsModel.h"
class UserLocationsWindow : public QDialog { class UserLocationsDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
UserLocationsWindow(QWidget* parent = NULL); UserLocationsDialog(QWidget* parent = NULL);
protected slots: protected slots:
void updateEnabled(); void updateEnabled();
@ -27,9 +27,9 @@ protected slots:
void renameSelection(); void renameSelection();
private: private:
Ui::UserLocationsWindow _ui; Ui::UserLocationsDialog _ui;
QSortFilterProxyModel _proxyModel; QSortFilterProxyModel _proxyModel;
UserLocationsModel _userLocationsModel; UserLocationsModel _userLocationsModel;
}; };
#endif // hifi_UserLocationsWindow_h #endif // hifi_UserLocationsDialog_h

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>UserLocationsWindow</class> <class>UserLocationsDialog</class>
<widget class="QWidget" name="UserLocationsWindow"> <widget class="QWidget" name="UserLocationsDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>