swift
src
gui
ecosystemcombobox.cpp
1
// SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
4
#include "
ecosystemcombobox.h
"
5
6
#include "
misc/network/ecosystemlist.h
"
7
8
using namespace
swift::misc::network;
9
10
namespace
swift::gui
11
{
12
CEcosystemComboBox::CEcosystemComboBox(
QWidget
*parent) :
QComboBox
(parent) { this->initAllItems(); }
13
14
CEcosystemComboBox::CEcosystemComboBox
(
const
CEcosystemList
&systems,
QWidget
*parent)
15
:
QComboBox
(parent), m_systems(systems)
16
{
17
this->initAllItems();
18
}
19
20
CEcosystem
CEcosystemComboBox::getSelectedEcosystem
()
const
21
{
22
if
(this->
currentIndex
() < 0 || this->
currentIndex
() >= m_systems.
size
()) {
return
CEcosystem
(); }
23
return
m_systems[this->
currentIndex
()];
24
}
25
26
void
CEcosystemComboBox::setCurrentEcosystem
(
const
CEcosystem
&ecosystem)
27
{
28
if
(m_systems.
contains
(ecosystem)) { this->
setCurrentText
(ecosystem.
getSystemString
()); }
29
}
30
31
void
CEcosystemComboBox::setEcosystems
(
const
CEcosystemList
&systems)
32
{
33
m_systems = systems;
34
this->initAllItems();
35
}
36
37
void
CEcosystemComboBox::initAllItems()
38
{
39
this->
clear
();
40
for
(
const
CEcosystem
&e : m_systems) { this->
addItem
(e.getSystemString()); }
41
}
42
}
// namespace swift::gui
swift::gui::CEcosystemComboBox::getSelectedEcosystem
swift::misc::network::CEcosystem getSelectedEcosystem() const
The selected ecosystem.
Definition:
ecosystemcombobox.cpp:20
swift::gui::CEcosystemComboBox::CEcosystemComboBox
CEcosystemComboBox(QWidget *parent=nullptr)
Constructor.
Definition:
ecosystemcombobox.cpp:12
swift::gui::CEcosystemComboBox::setCurrentEcosystem
void setCurrentEcosystem(const swift::misc::network::CEcosystem &ecosystem)
Set current system.
Definition:
ecosystemcombobox.cpp:26
swift::gui::CEcosystemComboBox::setEcosystems
void setEcosystems(const swift::misc::network::CEcosystemList &systems)
Set the supported systems.
Definition:
ecosystemcombobox.cpp:31
swift::misc::CRangeBase::contains
bool contains(const T &object) const
Return true if there is an element equal to given object. Uses the most efficient implementation avai...
Definition:
range.h:109
swift::misc::CSequence::size
size_type size() const
Returns number of elements in the sequence.
Definition:
sequence.h:273
swift::misc::network::CEcosystem
Ecosystem of server belonging together.
Definition:
ecosystem.h:21
swift::misc::network::CEcosystem::getSystemString
const QString & getSystemString() const
Get the system string.
Definition:
ecosystem.cpp:50
swift::misc::network::CEcosystemList
Value object encapsulating a list of voice rooms.
Definition:
ecosystemlist.h:25
ecosystemcombobox.h
ecosystemlist.h
swift::gui
GUI related classes.
Definition:
altitudeedit.cpp:13
QComboBox
QComboBox::addItem
void addItem(const QIcon &icon, const QString &text, const QVariant &userData)
QComboBox::clear
void clear()
QComboBox::currentIndex
currentIndex
QComboBox::setCurrentText
void setCurrentText(const QString &text)
QWidget
Generated on Wed Sep 3 2025 21:41:18 for swift by
1.9.1