mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #288, first version of login screen
* login component * preparation of main window for new component
This commit is contained in:
committed by
Roland Winklmeier
parent
49be1c2bb7
commit
86167e14c5
140
src/blackgui/components/logincomponent.h
Normal file
140
src/blackgui/components/logincomponent.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_LOGINCOMPONENT_H
|
||||
#define BLACKGUI_LOGINCOMPONENT_H
|
||||
|
||||
#include "enableforruntime.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
#include "blackmisc/nwserver.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CLoginComponent; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
//! Login component
|
||||
class CLoginComponent :
|
||||
public QFrame,
|
||||
public CEnableForRuntime
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CLoginComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CLoginComponent();
|
||||
|
||||
signals:
|
||||
//! Login
|
||||
void loginOrLogoffSuccessful();
|
||||
|
||||
//! Cancelled
|
||||
void loginOrLogoffCancelled();
|
||||
|
||||
//! Request network settings
|
||||
void requestNetworkSettings();
|
||||
|
||||
public slots:
|
||||
//! Main info area chnaged
|
||||
void mainInfoAreaChanged(const QWidget *currentWidget);
|
||||
|
||||
protected:
|
||||
//! \copydoc CEnableForRuntime::runtimeHasBeenSet
|
||||
virtual void runtimeHasBeenSet() override;
|
||||
|
||||
private slots:
|
||||
//! Login cancelled
|
||||
void ps_loginCancelled();
|
||||
|
||||
//! Login requested
|
||||
void ps_toggleNetworkConnection();
|
||||
|
||||
//! VATSIM data file was loaded
|
||||
void ps_onVatsimDataFileLoaded();
|
||||
|
||||
//! Validate aircaft
|
||||
bool ps_validateAircraftValues();
|
||||
|
||||
//! Validate VATSIM credentials
|
||||
bool ps_validateVatsimValues();
|
||||
|
||||
//! Settings have been changed
|
||||
void ps_onSettingsChanged(uint settingsType);
|
||||
|
||||
private:
|
||||
|
||||
//! GUI aircraft values, formatted
|
||||
struct CGuiAircraftValues
|
||||
{
|
||||
QString ownCallsign;
|
||||
QString ownAircraftIcaoTypeDesignator;
|
||||
QString ownAircraftIcaoAirline;
|
||||
QString ownAircraftCombinedType;
|
||||
QString ownAircraftSimulatorModel;
|
||||
};
|
||||
|
||||
//! VATSIM login data
|
||||
struct CVatsimValues
|
||||
{
|
||||
QString vatsimId;
|
||||
QString vatsimPassword;
|
||||
QString vatsimRealName;
|
||||
QString vatsimHomeAirport;
|
||||
};
|
||||
|
||||
//! GUI values from aircraft
|
||||
void setGuiValuesFromAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft);
|
||||
|
||||
//! Load from settings
|
||||
void loadFromSettings();
|
||||
|
||||
//! Values from GUI
|
||||
CGuiAircraftValues getAircraftValuesFromGui() const;
|
||||
|
||||
//! Values from GUI
|
||||
CVatsimValues getVatsimValuesFromGui() const;
|
||||
|
||||
//! User from VATSIM data
|
||||
BlackMisc::Network::CUser getUserFromVatsimGuiValues() const;
|
||||
|
||||
//! Callsign from GUI
|
||||
BlackMisc::Aviation::CCallsign getCallsignFromGui() const;
|
||||
|
||||
//! Selected server (VATSIM)
|
||||
BlackMisc::Network::CServer getCurrentVatsimServer() const;
|
||||
|
||||
//! Selected server (others)
|
||||
BlackMisc::Network::CServer getCurrentOtherServer() const;
|
||||
|
||||
//! Set OK button string
|
||||
void setOkButtonString(bool connected);
|
||||
|
||||
//! Show/hide elements as appropriate
|
||||
void setGuiVisibility(bool connected);
|
||||
|
||||
//! Identifies sender of cockpit updates
|
||||
static const QString &loginOriginator();
|
||||
|
||||
bool m_visible = false; //!< is this component selected?
|
||||
QScopedPointer<Ui::CLoginComponent> ui;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user