This commit is contained in:
Andrzej Kapolka 2014-04-11 16:37:49 -07:00
commit 39135d3d5f
13 changed files with 31 additions and 38 deletions

View file

@ -74,11 +74,6 @@ file (GLOB_RECURSE QT_UI_FILES ui/*.ui)
# have qt5 wrap them and generate the appropriate header files # have qt5 wrap them and generate the appropriate header files
qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}") qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}")
# grab the resource files in resources
file (GLOB_RECURSE QT_RESOURCE_FILES resources/*.qrc)
# have qt5 wrap them and generate the appropriate source files
qt5_add_resources(QT_RESOURCES "${QT_RESOURCE_FILES}")
# add them to the interface source files # add them to the interface source files
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}" "${QT_RESOURCES}") set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}" "${QT_RESOURCES}")

View file

@ -1,11 +0,0 @@
<RCC>
<qresource prefix="/">
<file>styles/search.svg</file>
<file>images/close.svg</file>
<file>images/kill-script.svg</file>
<file>images/reload.svg</file>
<file>images/stop.svg</file>
<file>images/pin.svg</file>
<file>images/pinned.svg</file>
</qresource>
</RCC>

View file

@ -251,6 +251,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection); QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection);
_settings = new QSettings(this); _settings = new QSettings(this);
_numChangedSettings = 0;
// Check to see if the user passed in a command line option for loading a local // Check to see if the user passed in a command line option for loading a local
// Voxel File. // Voxel File.
@ -407,6 +408,7 @@ void Application::saveSettings() {
_voxelImporter->saveSettings(_settings); _voxelImporter->saveSettings(_settings);
} }
_settings->sync(); _settings->sync();
_numChangedSettings = 0;
} }
@ -1322,6 +1324,9 @@ void Application::idle() {
// After finishing all of the above work, restart the idle timer, allowing 2ms to process events. // After finishing all of the above work, restart the idle timer, allowing 2ms to process events.
idleTimer->start(2); idleTimer->start(2);
} }
if (_numChangedSettings > 0) {
saveSettings();
}
} }
} }
@ -1668,6 +1673,7 @@ void Application::init() {
connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
connect(_myAvatar, SIGNAL(transformChanged()), this, SLOT(bumpSettings()));
} }
void Application::closeMirrorView() { void Application::closeMirrorView() {

View file

@ -286,6 +286,8 @@ public slots:
void uploadHead(); void uploadHead();
void uploadSkeleton(); void uploadSkeleton();
void bumpSettings() { ++_numChangedSettings; }
private slots: private slots:
void timer(); void timer();
void idle(); void idle();
@ -376,6 +378,7 @@ private:
QNetworkAccessManager* _networkAccessManager; QNetworkAccessManager* _networkAccessManager;
QMutex _settingsMutex; QMutex _settingsMutex;
QSettings* _settings; QSettings* _settings;
int _numChangedSettings;
QUndoStack _undoStack; QUndoStack _undoStack;

View file

@ -695,6 +695,7 @@ QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu,
QAction::NoRole, menuItemLocation); QAction::NoRole, menuItemLocation);
action->setCheckable(true); action->setCheckable(true);
action->setChecked(checked); action->setChecked(checked);
connect(action, SIGNAL(changed()), Application::getInstance(), SLOT(bumpSettings()));
return action; return action;
} }
@ -928,7 +929,6 @@ void Menu::goToLocation() {
QString currentLocation = QString("%1, %2, %3").arg(QString::number(avatarPos.x), QString currentLocation = QString("%1, %2, %3").arg(QString::number(avatarPos.x),
QString::number(avatarPos.y), QString::number(avatarPos.z)); QString::number(avatarPos.y), QString::number(avatarPos.z));
QInputDialog coordinateDialog(Application::getInstance()->getWindow()); QInputDialog coordinateDialog(Application::getInstance()->getWindow());
coordinateDialog.setWindowTitle("Go to Location"); coordinateDialog.setWindowTitle("Go to Location");
coordinateDialog.setLabelText("Coordinate as x,y,z:"); coordinateDialog.setLabelText("Coordinate as x,y,z:");

View file

@ -1167,6 +1167,7 @@ void MyAvatar::goToLocationFromResponse(const QJsonObject& jsonObject) {
glm::vec3 newPosition = glm::vec3(coordinateItems[0].toFloat(), coordinateItems[1].toFloat(), glm::vec3 newPosition = glm::vec3(coordinateItems[0].toFloat(), coordinateItems[1].toFloat(),
coordinateItems[2].toFloat()) - newOrientation * IDENTITY_FRONT * DISTANCE_TO_USER; coordinateItems[2].toFloat()) - newOrientation * IDENTITY_FRONT * DISTANCE_TO_USER;
setPosition(newPosition); setPosition(newPosition);
emit transformChanged();
} }
} }

View file

@ -106,6 +106,9 @@ public slots:
glm::vec3 getThrust() { return _thrust; }; glm::vec3 getThrust() { return _thrust; };
void setThrust(glm::vec3 newThrust) { _thrust = newThrust; } void setThrust(glm::vec3 newThrust) { _thrust = newThrust; }
signals:
void transformChanged();
private: private:
bool _mousePressed; bool _mousePressed;
float _bodyPitchDelta; // degrees float _bodyPitchDelta; // degrees

View file

@ -118,8 +118,6 @@ void LocationManager::checkForMultipleDestinations() {
Application::getInstance()->getAvatar()->goToLocationFromResponse(_placeData); Application::getInstance()->getAvatar()->goToLocationFromResponse(_placeData);
return; return;
} }
emit locationChanged();
} }
} }
@ -178,6 +176,7 @@ void LocationManager::goToOrientation(QString orientation) {
glm::quat avatarOrientation = myAvatar->getOrientation(); glm::quat avatarOrientation = myAvatar->getOrientation();
if (newAvatarOrientation != avatarOrientation) { if (newAvatarOrientation != avatarOrientation) {
myAvatar->setOrientation(newAvatarOrientation); myAvatar->setOrientation(newAvatarOrientation);
emit myAvatar->transformChanged();
} }
} }
} }
@ -211,6 +210,7 @@ bool LocationManager::goToDestination(QString destination) {
qDebug("Going To Location: %f, %f, %f...", x, y, z); qDebug("Going To Location: %f, %f, %f...", x, y, z);
myAvatar->setPosition(newAvatarPos); myAvatar->setPosition(newAvatarPos);
emit myAvatar->transformChanged();
} }
return true; return true;

View file

@ -48,7 +48,6 @@ private:
signals: signals:
void creationCompleted(LocationManager::NamedLocationCreateResponse response); void creationCompleted(LocationManager::NamedLocationCreateResponse response);
void multipleDestinationsFound(const QJsonObject& userData, const QJsonObject& placeData); void multipleDestinationsFound(const QJsonObject& userData, const QJsonObject& placeData);
void locationChanged();
private slots: private slots:
void namedLocationDataReceived(const QJsonObject& data); void namedLocationDataReceived(const QJsonObject& data);

View file

@ -140,6 +140,7 @@ void PreferencesDialog::savePreferences() {
if (shouldDispatchIdentityPacket) { if (shouldDispatchIdentityPacket) {
myAvatar->sendIdentityPacket(); myAvatar->sendIdentityPacket();
Application::getInstance()->bumpSettings();
} }
myAvatar->getHead()->setPupilDilation(ui.pupilDilationSlider->value() / (float)ui.pupilDilationSlider->maximum()); myAvatar->getHead()->setPupilDilation(ui.pupilDilationSlider->value() / (float)ui.pupilDilationSlider->maximum());

View file

@ -77,7 +77,7 @@ void RunningScriptsWidget::setRunningScripts(const QStringList& list)
scriptName->setToolTip(list.at(i)); scriptName->setToolTip(list.at(i));
scriptName->setTextAlignment(Qt::AlignCenter); scriptName->setTextAlignment(Qt::AlignCenter);
QTableWidgetItem *closeIcon = new QTableWidgetItem; QTableWidgetItem *closeIcon = new QTableWidgetItem;
closeIcon->setIcon(QIcon(":/images/kill-script.svg")); closeIcon->setIcon(QIcon(Application::resourcesPath() + "/images/kill-script.svg"));
ui->runningScriptsTableWidget->setItem(i, 0, scriptName); ui->runningScriptsTableWidget->setItem(i, 0, scriptName);
ui->runningScriptsTableWidget->setItem(i, 1, closeIcon); ui->runningScriptsTableWidget->setItem(i, 1, closeIcon);

View file

@ -100,9 +100,9 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources/resources.qrc"> <iconset>
<normaloff>:/images/pin.svg</normaloff> <normaloff>../resources/images/pin.svg</normaloff>
<normalon>:/images/pinned.svg</normalon>:/images/pin.svg</iconset> <normalon>../resources/images/pinned.svg</normalon>../resources/images/pin.svg</iconset>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
@ -139,8 +139,8 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources/resources.qrc"> <iconset>
<normaloff>:/images/close.svg</normaloff>:/images/close.svg</iconset> <normaloff>../resources/images/close.svg</normaloff>../resources/images/close.svg</iconset>
</property> </property>
<property name="flat"> <property name="flat">
<bool>true</bool> <bool>true</bool>
@ -239,9 +239,7 @@
<tabstop>messagePlainTextEdit</tabstop> <tabstop>messagePlainTextEdit</tabstop>
<tabstop>messagesScrollArea</tabstop> <tabstop>messagesScrollArea</tabstop>
</tabstops> </tabstops>
<resources> <resources/>
<include location="../resources/resources.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>togglePinnedButton</sender> <sender>togglePinnedButton</sender>

View file

@ -70,8 +70,8 @@ border-radius: 6px;</string>
<string>Reload All</string> <string>Reload All</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources/resources.qrc"> <iconset>
<normaloff>:/images/reload.svg</normaloff>:/images/reload.svg</iconset> <normaloff>../resources/images/reload.svg</normaloff>../resources/images/reload.svg</iconset>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="stopAllButton"> <widget class="QPushButton" name="stopAllButton">
@ -95,8 +95,8 @@ border-radius: 6px;</string>
<string>Stop All</string> <string>Stop All</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources/resources.qrc"> <iconset>
<normaloff>:/images/stop.svg</normaloff>:/images/stop.svg</iconset> <normaloff>../resources/images/stop.svg</normaloff>../resources/images/stop.svg</iconset>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="recentlyLoadedLabel"> <widget class="QLabel" name="recentlyLoadedLabel">
@ -166,8 +166,8 @@ border-radius: 6px;</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources/resources.qrc"> <iconset>
<normaloff>:/images/close.svg</normaloff>:/images/close.svg</iconset> <normaloff>../resources/images/close.svg</normaloff>../resources/images/close.svg</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -241,8 +241,6 @@ border-radius: 6px;</string>
</property> </property>
</widget> </widget>
</widget> </widget>
<resources> <resources/>
<include location="../resources/resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>