swift
Loading...
Searching...
No Matches
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())
23
{
24
return
{};
25
}
26
return
m_systems[this->
currentIndex
()];
27
}
28
29
void
CEcosystemComboBox::setCurrentEcosystem
(
const
CEcosystem
&ecosystem)
30
{
31
if
(m_systems.contains(ecosystem))
32
{
33
this->
setCurrentText
(ecosystem.
getSystemString
());
34
}
35
}
36
37
void
CEcosystemComboBox::setEcosystems
(
const
CEcosystemList
&systems)
38
{
39
m_systems = systems;
40
this->initAllItems();
41
}
42
43
void
CEcosystemComboBox::initAllItems()
44
{
45
this->
clear
();
46
for
(
const
CEcosystem
&e : m_systems)
47
{
48
this->
addItem
(e.getSystemString());
49
}
50
}
51
}
// 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:29
swift::gui::CEcosystemComboBox::setEcosystems
void setEcosystems(const swift::misc::network::CEcosystemList &systems)
Set the supported systems.
Definition
ecosystemcombobox.cpp:37
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:38
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
QComboBox(QWidget *parent)
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)
QObject::parent
QObject * parent() const const
QWidget::QWidget
QWidget(QWidget *parent, Qt::WindowFlags f)
Generated on
for swift by
1.15.0