mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
* tick label, shows OK/failure * serverlist selector, select 1 of servers * used tick label in selcal selector * fixed include in transponder mode selector
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
/* Copyright (C) 2013
|
|
* swift project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
#include "serverlistselector.h"
|
|
|
|
using namespace BlackMisc::Network;
|
|
|
|
namespace BlackGui
|
|
{
|
|
|
|
CServerListSelector::CServerListSelector(QWidget *parent) :
|
|
QComboBox(parent)
|
|
{
|
|
}
|
|
|
|
void CServerListSelector::setServers(const BlackMisc::Network::CServerList &servers)
|
|
{
|
|
if (this->m_servers == servers) { return; }
|
|
this->setItemStrings(servers);
|
|
}
|
|
|
|
BlackMisc::Network::CServer CServerListSelector::currentServer() const
|
|
{
|
|
int i = currentIndex();
|
|
if (i < 0 || i >= m_servers.size()) { return CServer(); }
|
|
return m_servers[i];
|
|
}
|
|
|
|
void CServerListSelector::setItemStrings(const CServerList &servers)
|
|
{
|
|
this->m_servers = servers;
|
|
this->m_items.clear();
|
|
foreach(CServer server, servers)
|
|
{
|
|
QString d(server.getName() + ": " + server.getDescription());
|
|
m_items.append(d);
|
|
}
|
|
this->clear(); // ui
|
|
this->addItems(m_items);
|
|
}
|
|
|
|
} // namespace
|