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

View file

@ -29,7 +29,7 @@
#include "ui/JSConsole.h"
#include "ui/LoginDialog.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_UP_FPS = 55.0;
@ -261,7 +261,7 @@ private:
QDialog* _jsConsole;
OctreeStatsDialog* _octreeStatsDialog;
LodToolsDialog* _lodToolsDialog;
UserLocationsWindow* _userLocationsWindow;
UserLocationsDialog* _userLocationsDialog;
int _maxVoxels;
float _voxelSizeScale;
float _oculusUIAngularSize;

View file

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

View file

@ -1,5 +1,5 @@
//
// UserLocationsWindow.h
// UserLocationsDialog.h
// interface/src/ui
//
// 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
//
#ifndef hifi_UserLocationsWindow_h
#define hifi_UserLocationsWindow_h
#ifndef hifi_UserLocationsDialog_h
#define hifi_UserLocationsDialog_h
#include "ui_userLocationsWindow.h"
#include "ui_userLocationsDialog.h"
#include "UserLocationsModel.h"
class UserLocationsWindow : public QDialog {
class UserLocationsDialog : public QDialog {
Q_OBJECT
public:
UserLocationsWindow(QWidget* parent = NULL);
UserLocationsDialog(QWidget* parent = NULL);
protected slots:
void updateEnabled();
@ -27,9 +27,9 @@ protected slots:
void renameSelection();
private:
Ui::UserLocationsWindow _ui;
Ui::UserLocationsDialog _ui;
QSortFilterProxyModel _proxyModel;
UserLocationsModel _userLocationsModel;
};
#endif // hifi_UserLocationsWindow_h
#endif // hifi_UserLocationsDialog_h

View file

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