swift
interpolationcomponent.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #include "ui_interpolationcomponent.h"
7 
9 #include "gui/guiapplication.h"
11 
12 using namespace swift::misc;
13 using namespace swift::misc::aviation;
14 using namespace swift::gui::views;
15 
16 namespace swift::gui::components
17 {
18  CInterpolationComponent::CInterpolationComponent(QWidget *parent)
19  : QFrame(parent), ui(new Ui::CInterpolationComponent)
20  {
21  ui->setupUi(this);
22  ui->tw_InterpolationSetup->setCurrentIndex(0);
23 
24  connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validChangedCallsignEntered, this,
25  &CInterpolationComponent::displayInterpolationMessages);
26  connect(ui->pb_ReloadInterpolationMessages, &QPushButton::released, this,
27  &CInterpolationComponent::displayInterpolationMessages);
28  }
29 
31 
32  void CInterpolationComponent::displayInterpolationMessages()
33  {
34  if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
35  const CCallsign cs = ui->comp_CallsignCompleter->getCallsign();
36  if (!cs.isValid()) { return; }
37 
39  ui->tvp_InterpolationMessages->updateContainerMaybeAsync(messages);
40  }
41 } // namespace swift::gui::components
bool isShuttingDown() const
Is application shutting down?
const context::IContextSimulator * getIContextSimulator() const
Direct access to contexts if a CCoreFacade has been initialized.
virtual swift::misc::CStatusMessageList getInterpolationMessages(const swift::misc::aviation::CCallsign &callsign) const =0
Interpolation messages.
void validChangedCallsignEntered()
Changed callsign entered.
Status messages, e.g. from Core -> GUI.
Value object encapsulating information of a callsign.
Definition: callsign.h:30
bool isValid() const
Valid callsign?
Definition: callsign.cpp:359
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
High level reusable GUI components.
Definition: aboutdialog.cpp:13
Views, mainly QTableView.
Free functions in swift::misc.