History

Merge branch 'master' of https://github.com/worklist/hifi into aacube

ZappoMan committed 12 years ago

Commit ee523ff2 parents 3a166d2 22548b930 files · +542 −133Browse files

Showing the changes to interface/src/Application.cpp (1 of 30 files). Show all

Unified · Split

interface/src/Application.cpp+26−6
@@ -237,12 +237,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 236 unmodified lines
237237 connect(&nodeList->getDomainHandler(), SIGNAL(connectedToDomain(const QString&)), SLOT(connectedToDomain(const QString&)));
238238
239239 // 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;
241241
242242 QTimer* locationUpdateTimer = new QTimer(this);
243243 connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer);
244244 locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
245−
245+
246246 connect(nodeList, &NodeList::nodeAdded, this, &Application::nodeAdded);
247247 connect(nodeList, &NodeList::nodeKilled, this, &Application::nodeKilled);
248248 connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer)));
@@ -251,9 +251,18 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 2 unmodified lines
251251 connect(nodeList, &NodeList::uuidChanged, this, &Application::updateWindowTitle);
252252 connect(nodeList, SIGNAL(uuidChanged(const QUuid&)), _myAvatar, SLOT(setSessionUUID(const QUuid&)));
253253 connect(nodeList, &NodeList::limitOfSilentDomainCheckInsReached, nodeList, &NodeList::reset);
254−
254+
255255 // connect to appropriate slots on AccountManager
256256 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+
257266 connect(&accountManager, &AccountManager::authRequired, Menu::getInstance(), &Menu::loginForCurrentDomain);
258267 connect(&accountManager, &AccountManager::usernameChanged, this, &Application::updateWindowTitle);
259268
@@ -1476,10 +1485,10 @@ void Application::importVoxels() { · 1216 unmodified lines
14761485 }
14771486
14781487 if (!_voxelImporter->exec()) {
1479− qDebug() << "[DEBUG] Import succeeded." << endl;
1488+ qDebug() << "Import succeeded." << endl;
14801489 _importSucceded = true;
14811490 } else {
1482− qDebug() << "[DEBUG] Import failed." << endl;
1491+ qDebug() << "Import failed." << endl;
14831492 if (_sharedVoxelSystem.getTree() == _voxelImporter->getVoxelTree()) {
14841493 _sharedVoxelSystem.killLocalVoxels();
14851494 _sharedVoxelSystem.changeTree(&_clipboard);
@@ -3094,7 +3103,18 @@ void Application::updateWindowTitle(){ · 1608 unmodified lines
30943103 QString username = AccountManager::getInstance().getAccountInfo().getUsername();
30953104 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
30963105 + 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());
30983118 _window->setWindowTitle(title);
30993119 }
31003120

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t