Ref T731, AFV sample default value for user name

This commit is contained in:
Klaus Basan
2019-10-03 00:03:34 +02:00
committed by Mat Sutcliffe
parent 89725c3bb4
commit 37a5da4e04
2 changed files with 22 additions and 4 deletions

View File

@@ -3,16 +3,22 @@
#include "blackcore/afv/model/atcstationmodel.h"
#include "blackcore/afv/model/afvmapreader.h"
#include "blackcore/afv/clients/afvclient.h"
#include "blackcore/application.h"
#include "blackmisc/network/user.h"
#include "blackmisc/obfuscation.h"
#include "blackconfig/buildconfig.h"
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QPointer>
#include <QThread>
#include <QTimer>
using namespace BlackConfig;
using namespace BlackMisc;
using namespace BlackMisc::Network;
using namespace BlackCore;
using namespace BlackCore::Afv::Clients;
using namespace BlackCore::Afv::Model;
@@ -21,18 +27,27 @@ int main(int argc, char *argv[])
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication qa(argc, argv);
BlackCore::CApplication a("sampleafvclient", CApplicationInfo::Sample);
CApplication a("sampleafvclient", CApplicationInfo::Sample);
CAfvMapReader *afvMapReader = new CAfvMapReader(&a);
afvMapReader->updateFromMap();
CAfvClient voiceClient("https://voice1.vatsim.uk");
// default user name
QString defaultUserName("1234567");
if (CBuildConfig::isLocalDeveloperDebugBuild())
{
CUser user("OBF:AwLZ7f9hUmpSZhm4=", "Joe Doe");
defaultUserName = user.getId();
}
QQmlApplicationEngine engine;
QQmlContext *ctxt = engine.rootContext();
ctxt->setContextProperty("afvMapReader", afvMapReader);
ctxt->setContextProperty("voiceClient", &voiceClient);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
ctxt->setContextProperty("userName", defaultUserName);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return a.exec();
}

View File

@@ -38,15 +38,18 @@ ApplicationWindow {
Layout.fillWidth: false
}
property alias mapUsername: tfUsername.text
TextField {
id: tfUsername
objectName: "loginUsername"
width: 350
height: 25
text: qsTr("1234567")
text: userName
selectByMouse: true
enabled: voiceClient.connectionStatus == 0 // Disconnected
horizontalAlignment: Text.AlignLeft
renderType: Text.NativeRendering
// text: qsTr("1234567")
}
Label {