set username instead of UUID in Interface preferences

This commit is contained in:
Stephen Birarda 2013-10-07 13:35:16 -07:00
parent f36fd47ef7
commit e9e77d8276
4 changed files with 9 additions and 12 deletions

View file

@ -52,11 +52,11 @@ void DataServerClient::putValueForKey(const char* key, const char* value) {
void DataServerClient::getValueForKeyAndUUID(const char* key, QUuid &uuid) { void DataServerClient::getValueForKeyAndUUID(const char* key, QUuid &uuid) {
if (!uuid.isNull()) { if (!uuid.isNull()) {
QString uuidString = uuidStringWithoutCurlyBraces(uuid); QString uuidString = uuidStringWithoutCurlyBraces(uuid);
getValueforKeyAndUserString(key, uuidString); getValueForKeyAndUserString(key, uuidString);
} }
} }
void DataServerClient::getValueforKeyAndUserString(const char* key, QString& userString) { void DataServerClient::getValueForKeyAndUserString(const char* key, QString& userString) {
unsigned char getPacket[MAX_PACKET_SIZE]; unsigned char getPacket[MAX_PACKET_SIZE];
// setup the header for this packet // setup the header for this packet

View file

@ -17,12 +17,12 @@ class DataServerClient {
public: public:
static void putValueForKey(const char* key, const char* value); static void putValueForKey(const char* key, const char* value);
static void getValueForKeyAndUUID(const char* key, QUuid& uuid); static void getValueForKeyAndUUID(const char* key, QUuid& uuid);
static void getValueforKeyAndUserString(const char* key, QString& userString); static void getValueForKeyAndUserString(const char* key, QString& userString);
static void getClientValueForKey(const char* key) { getValueForKeyAndUserString(key, _clientUsername); } static void getClientValueForKey(const char* key) { getValueForKeyAndUserString(key, _clientUsername); }
static void processConfirmFromDataServer(unsigned char* packetData, int numPacketBytes); static void processConfirmFromDataServer(unsigned char* packetData, int numPacketBytes);
static void processGetFromDataServer(unsigned char* packetData, int numPacketBytes); static void processGetFromDataServer(unsigned char* packetData, int numPacketBytes);
static void setClientUsername(QString& clientUsername) { _clientUsername = clientUsername; } static void setClientUsername(const QString& clientUsername) { _clientUsername = clientUsername; }
static QString& setClientUsername() { return _clientUsername; } static QString& setClientUsername() { return _clientUsername; }
private: private:
static QString _clientUsername; static QString _clientUsername;

View file

@ -72,13 +72,10 @@ void MyAvatar::setMoveTarget(const glm::vec3 moveTarget) {
_moveTargetStepCounter = 0; _moveTargetStepCounter = 0;
} }
void MyAvatar::setUUID(const QUuid& uuid) { void MyAvatar::setUsername(const QString& username) {
_uuid = uuid; _username = username;
qDebug() << "giving" << _uuid << "to DSC class.\n"; DataServerClient::setClientUsername(username);
// give this UUID to the DataServerClient class as our client UUID
DataServerClient::setClientUUID(_uuid);
} }
void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) { void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) {
@ -560,7 +557,7 @@ void MyAvatar::saveData(QSettings* settings) {
void MyAvatar::loadData(QSettings* settings) { void MyAvatar::loadData(QSettings* settings) {
settings->beginGroup("Avatar"); settings->beginGroup("Avatar");
setUUID(settings->value("Usernmame").toString(); setUsername(settings->value("Username").toString());
// in case settings is corrupt or missing loadSetting() will check for NaN // in case settings is corrupt or missing loadSetting() will check for NaN
_bodyYaw = loadSetting(settings, "bodyYaw", 0.0f); _bodyYaw = loadSetting(settings, "bodyYaw", 0.0f);

View file

@ -34,7 +34,7 @@ public:
void setNewScale(const float scale); void setNewScale(const float scale);
void setWantCollisionsOn(bool wantCollisionsOn) { _isCollisionsOn = wantCollisionsOn; } void setWantCollisionsOn(bool wantCollisionsOn) { _isCollisionsOn = wantCollisionsOn; }
void setMoveTarget(const glm::vec3 moveTarget); void setMoveTarget(const glm::vec3 moveTarget);
void setUsername(const QString& username) { _username = username; } void setUsername(const QString& username);
// getters // getters
float getNewScale() const { return _newScale; } float getNewScale() const { return _newScale; }