serverselector.cpp 870 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "serverselector.h"

ServerSelector::ServerSelector( QSharedPointer<RocketChatServerData> pServer)
{
    mServer = pServer;
    QVariantMap map;
    map["name"] = "FairChat";
    map["address"] = "chat.fairkom.net";
    mServers.append(map);
}

void ServerSelector::selectServer( QString pServerAddress )
{
    mServer->setServerAddress(pServerAddress);
    emit serverSelected(mServer);
}

void ServerSelector::addServer( QString pName, QString pServer )
{
    QVariantMap map;
    map["name"] = pName;
    map["address"] = pServer;
    mServers.append(map);
    QByteArray temp;
    QDataStream out(temp);
    out<<mServers;
    mSettings.setValue("servers",temp);
    mSettings.sync();
    emit newServerList(mServers);
}

QVariantList ServerSelector::getServerList()
{
    return mServers;
}

void ServerSelector::removeServer( QString pServerAddress )
{

}