mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refactor: Remove unused LoginOverviewComponent
This commit is contained in:
@@ -331,7 +331,6 @@ add_library(gui SHARED
|
||||
components/settingsxswiftbuscomponent.ui
|
||||
components/selcalcodeselector.cpp
|
||||
components/audionotificationcomponent.h
|
||||
components/loginoverviewcomponent.h
|
||||
components/updateinfodialog.ui
|
||||
components/aircraftpartshistory.ui
|
||||
components/autopublishdialog.ui
|
||||
@@ -415,7 +414,6 @@ add_library(gui SHARED
|
||||
components/aircraftmodelvalidationcomponent.cpp
|
||||
components/settingsguicomponent.h
|
||||
components/dbaircrafticaocomponent.cpp
|
||||
components/loginoverviewcomponent.ui
|
||||
components/setuploadingdialog.ui
|
||||
components/dbmappingcomponent.ui
|
||||
components/mappingcomponent.cpp
|
||||
@@ -639,7 +637,6 @@ add_library(gui SHARED
|
||||
components/copymodelsfromotherswiftversionscomponent.cpp
|
||||
components/settingssimulatormessagescomponent.cpp
|
||||
components/dbaircraftcategorycomponent.ui
|
||||
components/loginoverviewcomponent.cpp
|
||||
components/cockpitcomtransmissioncomponent.ui
|
||||
components/interpolationlogdisplay.cpp
|
||||
components/dblogincomponent.cpp
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "ui_loginoverviewcomponent.h"
|
||||
#include "loginoverviewcomponent.h"
|
||||
#include "blackgui/components/serverlistselector.h"
|
||||
#include "blackgui/editors/serverform.h"
|
||||
#include "blackgui/editors/pilotform.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/loginmodebuttons.h"
|
||||
#include "blackgui/ticklabel.h"
|
||||
#include "blackgui/uppercasevalidator.h"
|
||||
#include "blackcore/context/contextaudio.h"
|
||||
#include "blackcore/context/contextownaircraft.h"
|
||||
#include "blackcore/context/contextsimulator.h"
|
||||
#include "blackcore/context/contextnetwork.h"
|
||||
#include "blackcore/data/globalsetup.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/simulation/simulatorinternals.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/aviation/aircrafticaocode.h"
|
||||
#include "blackmisc/aviation/airlineicaocode.h"
|
||||
#include "blackmisc/aviation/airporticaocode.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/network/serverlist.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/crashhandler.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QMessageBox>
|
||||
#include <QGroupBox>
|
||||
#include <QIntValidator>
|
||||
#include <QLineEdit>
|
||||
#include <QProgressBar>
|
||||
#include <QPushButton>
|
||||
#include <QTabWidget>
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
#include <QStringBuilder>
|
||||
#include <QtGlobal>
|
||||
#include <QPointer>
|
||||
#include <QPair>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Data;
|
||||
using namespace BlackCore::Context;
|
||||
using namespace BlackGui;
|
||||
|
||||
namespace BlackGui::Components
|
||||
{
|
||||
const QStringList &CLoginOverviewComponent::getLogCategories()
|
||||
{
|
||||
static const QStringList cats { CLogCategories::guiComponent() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
CLoginOverviewComponent::CLoginOverviewComponent(QWidget *parent) : COverlayMessagesFrame(parent),
|
||||
ui(new Ui::CLoginOverviewComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CLoginOverviewComponent::cancel, Qt::QueuedConnection);
|
||||
connect(ui->pb_Disconnect, &QPushButton::clicked, this, &CLoginOverviewComponent::toggleNetworkConnection, Qt::QueuedConnection);
|
||||
|
||||
// overlay
|
||||
this->setOverlaySizeFactors(0.8, 0.5);
|
||||
this->setReducedInfo(true);
|
||||
this->setForceSmall(true);
|
||||
this->showKillButton(false);
|
||||
|
||||
// forms
|
||||
ui->form_Pilot->setReadOnly(true);
|
||||
ui->form_Server->setReadOnly(true);
|
||||
|
||||
// inital setup, if data already available
|
||||
ui->form_Pilot->validate();
|
||||
}
|
||||
|
||||
CLoginOverviewComponent::~CLoginOverviewComponent()
|
||||
{}
|
||||
|
||||
void CLoginOverviewComponent::cancel()
|
||||
{
|
||||
this->closeOverlay();
|
||||
emit this->closeOverview();
|
||||
}
|
||||
|
||||
void CLoginOverviewComponent::toggleNetworkConnection()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
if (!sGui->getIContextNetwork() || !sGui->getIContextAudio()) { return; }
|
||||
|
||||
const bool isConnected = sGui && sGui->getIContextNetwork()->isConnected();
|
||||
|
||||
CStatusMessage msg;
|
||||
if (!isConnected)
|
||||
{
|
||||
// void
|
||||
}
|
||||
else
|
||||
{
|
||||
// disconnect from network
|
||||
sGui->setExtraWindowTitle("");
|
||||
msg = sGui->getIContextNetwork()->disconnectFromNetwork();
|
||||
}
|
||||
|
||||
// log message and trigger events
|
||||
msg.addCategories(this);
|
||||
CLogMessage::preformatted(msg);
|
||||
if (msg.isSuccess())
|
||||
{
|
||||
emit loginOrLogoffSuccessful();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void CLoginOverviewComponent::showCurrentValues()
|
||||
{
|
||||
if (!this->hasValidContexts()) { return; }
|
||||
const CServer server = sGui->getIContextNetwork()->getConnectedServer();
|
||||
ui->form_Server->setServer(server);
|
||||
ui->form_Server->resetToFirstTab();
|
||||
ui->form_Pilot->setUser(server.getUser());
|
||||
ui->le_LoginMode->setText(sGui->getIContextNetwork()->getLoginModeAsString());
|
||||
ui->le_PartnerCallsign->setText(sGui->getIContextNetwork()->getPartnerCallsign().asString());
|
||||
ui->comp_NetworkAircraft->showValues();
|
||||
}
|
||||
|
||||
bool CLoginOverviewComponent::hasValidContexts() const
|
||||
{
|
||||
if (!sGui || !sGui->supportsContexts()) { return false; }
|
||||
if (sGui->isShuttingDown()) { return false; }
|
||||
if (!sGui->getIContextSimulator()) { return false; }
|
||||
if (!sGui->getIContextNetwork()) { return false; }
|
||||
if (!sGui->getIContextOwnAircraft()) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -1,88 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_COMPONENTS_LOGINOVERVIEWCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_LOGINOVERVIEWCOMPONENT_H
|
||||
|
||||
#include "blackcore/vatsim/vatsimsettings.h"
|
||||
#include "blackcore/data/networksetup.h"
|
||||
#include "blackgui/settings/guisettings.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/simulation/data/lastmodel.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/network/server.h"
|
||||
#include "blackmisc/network/user.h"
|
||||
#include "blackmisc/digestsignal.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QIcon>
|
||||
#include <QTimer>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
#include <QString>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CLoginOverviewComponent;
|
||||
}
|
||||
namespace BlackMisc::Simulation
|
||||
{
|
||||
class CAircraftModel;
|
||||
class CSimulatedAircraft;
|
||||
}
|
||||
namespace BlackGui::Components
|
||||
{
|
||||
/*!
|
||||
* Login component to flight network
|
||||
*/
|
||||
class BLACKGUI_EXPORT CLoginOverviewComponent : public COverlayMessagesFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
explicit CLoginOverviewComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CLoginOverviewComponent() override;
|
||||
|
||||
//! Login requested
|
||||
void toggleNetworkConnection();
|
||||
|
||||
//! Show current values
|
||||
void showCurrentValues();
|
||||
|
||||
signals:
|
||||
//! Login
|
||||
void loginOrLogoffSuccessful();
|
||||
|
||||
//! Cancelled
|
||||
void closeOverview();
|
||||
|
||||
private:
|
||||
// -------------- others -----------------
|
||||
|
||||
//! Login cancelled
|
||||
void cancel();
|
||||
|
||||
//! Has contexts?
|
||||
bool hasValidContexts() const;
|
||||
|
||||
static constexpr int OverlayMessageMs = 5000;
|
||||
static constexpr int LogoffIntervalSeconds = 20; //!< time before logoff
|
||||
|
||||
QScopedPointer<Ui::CLoginOverviewComponent> ui;
|
||||
BlackCore::Data::CNetworkSetup m_networkSetup; //!< servers last used
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
@@ -1,315 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CLoginOverviewComponent</class>
|
||||
<widget class="QFrame" name="CLoginOverviewComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>295</width>
|
||||
<height>316</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Login component</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="hl_LoginAdvComponent">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_Server">
|
||||
<property name="title">
|
||||
<string>Server</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_Network">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Editors::CServerForm" name="form_Server">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_LoginMode">
|
||||
<property name="title">
|
||||
<string>Login mode / partner callsign</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_LoginMode">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_LoginMode">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="lbl_PartnerCallsign">
|
||||
<property name="text">
|
||||
<string>Partner</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_LoginMode">
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="le_PartnerCallsign">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_MatchingLog">
|
||||
<property name="title">
|
||||
<string>Matching log.</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_MatchingLogConnected">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CModelMatcherLogEnable" name="comp_MatchingLog">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_PilotsDetails">
|
||||
<property name="title">
|
||||
<string>Pilot's info</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_PilotIngoGroupBox">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="BlackGui::Editors::CPilotForm" name="form_Pilot">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_OwnAircraft">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Own aircraft</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_OwnAircraft">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CNetworkAircraftValuesComponent" name="comp_NetworkAircraft">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vs_LoginAdvComponent">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignBottom">
|
||||
<widget class="QFrame" name="fr_Buttons">
|
||||
<layout class="QGridLayout" name="gl_Buttons">
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<spacer name="hs_Buttons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pb_Cancel">
|
||||
<property name="text">
|
||||
<string>cancel</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Esc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pb_Disconnect">
|
||||
<property name="text">
|
||||
<string>disconnect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CModelMatcherLogEnable</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/modelmatcherlogenable.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CPilotForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/pilotform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CServerForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/serverform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CNetworkAircraftValuesComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/networkaircraftvaluescomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>le_LoginMode</tabstop>
|
||||
<tabstop>le_PartnerCallsign</tabstop>
|
||||
<tabstop>gb_OwnAircraft</tabstop>
|
||||
<tabstop>pb_Disconnect</tabstop>
|
||||
<tabstop>pb_Cancel</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user