1
mirror of https://github.com/monero-project/monero-gui synced 2025-01-01 21:56:23 +01:00

generate default account name from env username

This commit is contained in:
Jacob Brydolf 2016-10-29 12:13:20 +02:00
parent a3c6c40832
commit b795c4b0d7
No known key found for this signature in database
GPG Key ID: DE46246550D2F3C5

View File

@ -120,6 +120,17 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("moneroAccountsDir", moneroAccountsDir); engine.rootContext()->setContextProperty("moneroAccountsDir", moneroAccountsDir);
} }
// Get default account name
QString accountName = qgetenv("USER"); // mac/linux
if (accountName.isEmpty()){
accountName = qgetenv("USERNAME"); // Windows
}
if (accountName.isEmpty()) {
accountName = "My monero Account";
}
engine.rootContext()->setContextProperty("defaultAccountName", accountName);
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath()); engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
QObject *rootObject = engine.rootObjects().first(); QObject *rootObject = engine.rootObjects().first();