swift
Loading...
Searching...
No Matches
maininfoareacomponent.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#include <QGuiApplication>
7#include <QIcon>
8
9#include "ui_maininfoareacomponent.h"
10
13#include "misc/icons.h"
14
15using namespace swift::misc;
16using namespace swift::gui;
17
19{
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57 {
58 ui->comp_Log->displayLog();
59 this->selectArea(InfoAreaLog);
60 }
61
63 {
64 CInfoArea::selectArea(static_cast<int>(infoArea));
65
67 const bool shift = km.testFlag(Qt::ShiftModifier);
68 if (!shift)
69 {
70 return;
71 }
72
73 // pressing shift will go to overview
74 if (infoArea == InfoAreaSettings)
75 {
76 ui->comp_Settings->setSettingsOverviewTab();
77 }
78 else if (infoArea == InfoAreaAircraft)
79 {
80 ui->comp_Aircraft->setTab(CAircraftComponent::TabAircraftInRange);
81 }
82 else if (infoArea == InfoAreaAtc)
83 {
84 ui->comp_AtcStations->setTab(CAtcStationComponent::TabAtcOnline);
85 }
86 else if (infoArea == InfoAreaMapping)
87 {
88 ui->comp_Mappings->setTab(CMappingComponent::TabRenderedAircraft);
89 }
90 }
91
92 void CMainInfoAreaComponent::selectLog() { this->selectArea(InfoAreaLog); }
93
95 {
96 const auto area = static_cast<InfoArea>(areaIndex);
97 switch (area)
98 {
99 case InfoAreaCockpit:
100 case InfoAreaAircraft:
101 case InfoAreaAtc:
102 case InfoAreaUsers:
103 case InfoAreaLog:
104 case InfoAreaSimulator:
105 case InfoAreaMapping:
106 case InfoAreaInterpolation:
107 case InfoAreaSettings:
108 case InfoAreaTextMessages:
109 case InfoAreaRadar: return { 600, 400 };
110 case InfoAreaFlightPlan: return { 800, 600 };
111 default: return { 600, 400 };
112 }
113 }
114
116 {
117 this->selectArea(InfoAreaSettings);
118 ui->comp_Settings->setTab(static_cast<CSettingsComponent::SettingTab>(index));
119 }
120
122 {
124 this->selectArea(CMainInfoAreaComponent::InfoAreaCockpit);
125 }
126
128 {
129 const auto area = static_cast<InfoArea>(areaIndex);
130 switch (area)
131 {
132 case InfoAreaCockpit: return CIcons::appCockpit16();
133 case InfoAreaUsers: return CIcons::appUsers16();
134 case InfoAreaAtc: return CIcons::appAtc16();
135 case InfoAreaAircraft: return CIcons::appAircraft16();
136 case InfoAreaSettings: return CIcons::appSettings16();
137 case InfoAreaFlightPlan: return CIcons::appFlightPlan16();
138 case InfoAreaSimulator: return CIcons::appSimulator16();
140 case InfoAreaLog: return CIcons::appLog16();
141 case InfoAreaRadar: return CIcons::appRadar16();
142 case InfoAreaTextMessages: return CIcons::appTextMessages16();
143 case InfoAreaInterpolation: return CIcons::appInterpolation16();
144 default: return CIcons::empty();
145 }
146 }
147} // namespace swift::gui::components
CInfoArea(QWidget *parent=nullptr)
Constructor.
Definition infoarea.cpp:38
void selectArea(int areaIndex)
Select area.
Definition infoarea.cpp:460
void initInfoArea()
Init area after(!) GUI is initialized.
Definition infoarea.cpp:45
Cockpit component: COM unit, show / hide bar, voice rooms.
GUI displaying log and status messages.
void requestAttention()
Make me visible.
void showFilterDialog()
Show filter dialog and disable bar.
CAtcStationComponent * getAtcStationComponent()
ATC stations.
void selectSettingsTab(int index)
Select settings with given area.
QSize getPreferredSizeWhenFloating(int areaIndex) const
Preferred size when floating (size hint).
CFlightPlanComponent * getFlightPlanComponent()
Flight plan.
CAircraftComponent * getAircraftComponent()
Aircrafts.
CMainInfoAreaComponent(QWidget *parent=nullptr)
Constructor.
CInterpolationComponent * getInterpolationComponent()
Interpolation.
CTextMessageComponent * getTextMessageComponent()
Text messages.
const QPixmap & indexToPixmap(int areaIndex) const
Info area (index) to icon.
CSimulatorComponent * getSimulatorComponent()
Simulator.
GUI displaying a radar like view with aircrafts nearby.
User componenet (users, clients).
static const QPixmap & swift64()
swift icon
static const QPixmap & appCockpit16()
Application cockpit.
static const QPixmap & appAircraft16()
Application aircrafts.
static const QPixmap & appSettings16()
Application settings.
static const QPixmap & appMappings16()
Application mappings.
static const QPixmap & empty()
Empty icon.
static const QPixmap & appSimulator16()
Application simulator.
static const QPixmap & appFlightPlan16()
Application flight plan.
static const QPixmap & appLog16()
Application log/status messages.
static const QPixmap & appRadar16()
Radar.
static const QPixmap & appTextMessages16()
Application text messages.
static const QPixmap & appAtc16()
Application ATC.
static const QPixmap & appInterpolation16()
Application interpolation.
static const QPixmap & appUsers16()
Application users.
High level reusable GUI components.
GUI related classes.
Free functions in swift::misc.
Qt::KeyboardModifiers queryKeyboardModifiers()
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
typedef KeyboardModifiers
QWidget(QWidget *parent, Qt::WindowFlags f)
void setWindowIcon(const QIcon &icon)