Showing the changes to interface/src/Application.cpp (1 of 30 files). Show all
Unified · Split
| @@ -237,12 +237,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 236 unmodified lines | ||
| 237 | 237 | connect(&nodeList->getDomainHandler(), SIGNAL(connectedToDomain(const QString&)), SLOT(connectedToDomain(const QString&))); |
| 238 | 238 | |
| 239 | 239 | // update our location every 5 seconds in the data-server, assuming that we are authenticated with one |
| 240 | − const float DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5.0f * 1000.0f; | |
| 240 | + const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000; | |
| 241 | 241 | |
| 242 | 242 | QTimer* locationUpdateTimer = new QTimer(this); |
| 243 | 243 | connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer); |
| 244 | 244 | locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS); |
| 245 | − | |
| 245 | + | |
| 246 | 246 | connect(nodeList, &NodeList::nodeAdded, this, &Application::nodeAdded); |
| 247 | 247 | connect(nodeList, &NodeList::nodeKilled, this, &Application::nodeKilled); |
| 248 | 248 | connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer))); |
| @@ -251,9 +251,18 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 2 unmodified lines | ||
| 251 | 251 | connect(nodeList, &NodeList::uuidChanged, this, &Application::updateWindowTitle); |
| 252 | 252 | connect(nodeList, SIGNAL(uuidChanged(const QUuid&)), _myAvatar, SLOT(setSessionUUID(const QUuid&))); |
| 253 | 253 | connect(nodeList, &NodeList::limitOfSilentDomainCheckInsReached, nodeList, &NodeList::reset); |
| 254 | − | |
| 254 | + | |
| 255 | 255 | // connect to appropriate slots on AccountManager |
| 256 | 256 | AccountManager& accountManager = AccountManager::getInstance(); |
| 257 | + | |
| 258 | + const qint64 BALANCE_UPDATE_INTERVAL_MSECS = 5 * 1000; | |
| 259 | + | |
| 260 | + QTimer* balanceUpdateTimer = new QTimer(this); | |
| 261 | + connect(balanceUpdateTimer, &QTimer::timeout, &accountManager, &AccountManager::updateBalance); | |
| 262 | + balanceUpdateTimer->start(BALANCE_UPDATE_INTERVAL_MSECS); | |
| 263 | + | |
| 264 | + connect(&accountManager, &AccountManager::balanceChanged, this, &Application::updateWindowTitle); | |
| 265 | + | |
| 257 | 266 | connect(&accountManager, &AccountManager::authRequired, Menu::getInstance(), &Menu::loginForCurrentDomain); |
| 258 | 267 | connect(&accountManager, &AccountManager::usernameChanged, this, &Application::updateWindowTitle); |
| 259 | 268 | |
| @@ -1476,10 +1485,10 @@ void Application::importVoxels() { · 1216 unmodified lines | ||
| 1476 | 1485 | } |
| 1477 | 1486 | |
| 1478 | 1487 | if (!_voxelImporter->exec()) { |
| 1479 | − qDebug() << "[DEBUG] Import succeeded." << endl; | |
| 1488 | + qDebug() << "Import succeeded." << endl; | |
| 1480 | 1489 | _importSucceded = true; |
| 1481 | 1490 | } else { |
| 1482 | − qDebug() << "[DEBUG] Import failed." << endl; | |
| 1491 | + qDebug() << "Import failed." << endl; | |
| 1483 | 1492 | if (_sharedVoxelSystem.getTree() == _voxelImporter->getVoxelTree()) { |
| 1484 | 1493 | _sharedVoxelSystem.killLocalVoxels(); |
| 1485 | 1494 | _sharedVoxelSystem.changeTree(&_clipboard); |
| @@ -3094,7 +3103,18 @@ void Application::updateWindowTitle(){ · 1608 unmodified lines | ||
| 3094 | 3103 | QString username = AccountManager::getInstance().getAccountInfo().getUsername(); |
| 3095 | 3104 | QString title = QString() + (!username.isEmpty() ? username + " @ " : QString()) |
| 3096 | 3105 | + nodeList->getDomainHandler().getHostname() + buildVersion; |
| 3097 | − qDebug("Application title set to: %s", title.toStdString().c_str()); | |
| 3106 | + | |
| 3107 | + AccountManager& accountManager = AccountManager::getInstance(); | |
| 3108 | + if (accountManager.getAccountInfo().hasBalance()) { | |
| 3109 | + float creditBalance = accountManager.getAccountInfo().getBalance() * pow(10.0f, -8.0f); | |
| 3110 | + | |
| 3111 | + QString creditBalanceString; | |
| 3112 | + creditBalanceString.sprintf("%.8f", creditBalance); | |
| 3113 | + | |
| 3114 | + title += " - ₵" + creditBalanceString; | |
| 3115 | + } | |
| 3116 | + | |
| 3117 | + qDebug("Application title set to: %s", title.toStdString().c_str()); | |
| 3098 | 3118 | _window->setWindowTitle(title); |
| 3099 | 3119 | } |
| 3100 | 3120 | |