swift
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 
15 using namespace swift::misc;
16 using namespace swift::gui;
17 
18 namespace swift::gui::components
19 {
20  CMainInfoAreaComponent::CMainInfoAreaComponent(QWidget *parent)
21  : CInfoArea(parent), ui(new Ui::CMainInfoAreaComponent)
22  {
23  ui->setupUi(this);
24  CInfoArea::initInfoArea(); // init base class
25  this->setWindowIcon(CIcons::swift64());
28  }
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 
66  const Qt::KeyboardModifiers km = QGuiApplication::queryKeyboardModifiers();
67  const bool shift = km.testFlag(Qt::ShiftModifier);
68  if (!shift) { return; }
69 
70  // pressing shift will go to overview
71  if (infoArea == InfoAreaSettings) { ui->comp_Settings->setSettingsOverviewTab(); }
72  else if (infoArea == InfoAreaAircraft) { ui->comp_Aircraft->setTab(CAircraftComponent::TabAircraftInRange); }
73  else if (infoArea == InfoAreaAtc) { ui->comp_AtcStations->setTab(CAtcStationComponent::TabAtcOnline); }
74  else if (infoArea == InfoAreaMapping) { ui->comp_Mappings->setTab(CMappingComponent::TabRenderedAircraft); }
75  }
76 
77  void CMainInfoAreaComponent::selectLog() { this->selectArea(InfoAreaLog); }
78 
80  {
81  const InfoArea area = static_cast<InfoArea>(areaIndex);
82  switch (area)
83  {
84  case InfoAreaCockpit:
85  case InfoAreaAircraft:
86  case InfoAreaAtc:
87  case InfoAreaUsers:
88  case InfoAreaLog:
89  case InfoAreaSimulator:
90  case InfoAreaMapping:
91  case InfoAreaInterpolation:
92  case InfoAreaSettings:
93  case InfoAreaTextMessages:
94  case InfoAreaRadar: return QSize(600, 400);
95  case InfoAreaFlightPlan: return QSize(800, 600);
96  default: return QSize(600, 400);
97  }
98  }
99 
101  {
102  this->selectArea(InfoAreaSettings);
103  ui->comp_Settings->setTab(static_cast<CSettingsComponent::SettingTab>(index));
104  }
105 
107  {
108  this->getCockpitComponent()->showAudio();
109  this->selectArea(CMainInfoAreaComponent::InfoAreaCockpit);
110  }
111 
112  const QPixmap &CMainInfoAreaComponent::indexToPixmap(int areaIndex) const
113  {
114  const InfoArea area = static_cast<InfoArea>(areaIndex);
115  switch (area)
116  {
117  case InfoAreaCockpit: return CIcons::appCockpit16();
118  case InfoAreaUsers: return CIcons::appUsers16();
119  case InfoAreaAtc: return CIcons::appAtc16();
120  case InfoAreaAircraft: return CIcons::appAircraft16();
121  case InfoAreaSettings: return CIcons::appSettings16();
122  case InfoAreaFlightPlan: return CIcons::appFlightPlan16();
123  case InfoAreaSimulator: return CIcons::appSimulator16();
124  case InfoAreaMapping: return CIcons::appMappings16();
125  case InfoAreaLog: return CIcons::appLog16();
126  case InfoAreaRadar: return CIcons::appRadar16();
127  case InfoAreaTextMessages: return CIcons::appTextMessages16();
128  case InfoAreaInterpolation: return CIcons::appInterpolation16();
129  default: return CIcons::empty();
130  }
131  }
132 } // namespace swift::gui::components
Info area, hosting dockable widgets.
Definition: infoarea.h:41
void selectArea(int areaIndex)
Select area.
Definition: infoarea.cpp:396
void initInfoArea()
Init area after(!) GUI is initialized.
Definition: infoarea.cpp:47
Cockpit component: COM unit, show / hide bar, voice rooms.
GUI displaying log and status messages.
Definition: logcomponent.h:45
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.
void selectArea(InfoArea infoArea)
Select area.
virtual QSize getPreferredSizeWhenFloating(int areaIndex) const
Preferred size when floating (size hint)
CUserComponent * getUserComponent()
User component.
CFlightPlanComponent * getFlightPlanComponent()
Flight plan.
CAircraftComponent * getAircraftComponent()
Aircrafts.
CSettingsComponent * getSettingsComponent()
Settings.
CInterpolationComponent * getInterpolationComponent()
Interpolation.
CTextMessageComponent * getTextMessageComponent()
Text messages.
virtual 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)
Definition: usercomponent.h:29
High level reusable GUI components.
Definition: aboutdialog.cpp:13
GUI related classes.
Free functions in swift::misc.