mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
Also allow to use SHIFT + button for models, aircraft
* added setTab functions * shift can be used to reset to first tab
This commit is contained in:
@@ -116,6 +116,12 @@ namespace BlackGui
|
|||||||
m_updateCounter++;
|
m_updateCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAircraftComponent::setTab(CAircraftComponent::AircraftTab tab)
|
||||||
|
{
|
||||||
|
const int tabIndex = static_cast<int>(tab);
|
||||||
|
this->setCurrentIndex(tabIndex);
|
||||||
|
}
|
||||||
|
|
||||||
void CAircraftComponent::onInfoAreaTabBarChanged(int index)
|
void CAircraftComponent::onInfoAreaTabBarChanged(int index)
|
||||||
{
|
{
|
||||||
// ignore in those cases
|
// ignore in those cases
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
namespace Aviation { class CCallsign; }
|
namespace Aviation { class CCallsign; }
|
||||||
@@ -44,11 +42,19 @@ namespace BlackGui
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
//! Tab
|
||||||
|
//! \remark needs to be in sync with tab order
|
||||||
|
enum AircraftTab
|
||||||
|
{
|
||||||
|
TabAircraftInRange = 0,
|
||||||
|
TabAirportsInRange
|
||||||
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CAircraftComponent(QWidget *parent = nullptr);
|
explicit CAircraftComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CAircraftComponent();
|
virtual ~CAircraftComponent() override;
|
||||||
|
|
||||||
//! Aircraft in range
|
//! Aircraft in range
|
||||||
int countAircraftInView() const;
|
int countAircraftInView() const;
|
||||||
@@ -62,6 +68,9 @@ namespace BlackGui
|
|||||||
//! Update aircraft/airport view
|
//! Update aircraft/airport view
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
//! Set tab
|
||||||
|
void setTab(AircraftTab tab);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Request a text message
|
//! Request a text message
|
||||||
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|||||||
@@ -112,14 +112,23 @@ namespace BlackGui
|
|||||||
void CMainInfoAreaComponent::selectArea(CMainInfoAreaComponent::InfoArea infoArea)
|
void CMainInfoAreaComponent::selectArea(CMainInfoAreaComponent::InfoArea infoArea)
|
||||||
{
|
{
|
||||||
CInfoArea::selectArea(static_cast<int>(infoArea));
|
CInfoArea::selectArea(static_cast<int>(infoArea));
|
||||||
|
|
||||||
|
const Qt::KeyboardModifiers km = QGuiApplication::queryKeyboardModifiers();
|
||||||
|
const bool shift = km.testFlag(Qt::ShiftModifier);
|
||||||
|
if (!shift) { return; }
|
||||||
|
|
||||||
|
// pressing shift will go to overview
|
||||||
if (infoArea == InfoAreaSettings)
|
if (infoArea == InfoAreaSettings)
|
||||||
{
|
{
|
||||||
// pressing shift will go to overview
|
ui->comp_Settings->setSettingsOverviewTab();
|
||||||
const Qt::KeyboardModifiers km = QGuiApplication::queryKeyboardModifiers();
|
}
|
||||||
if (km.testFlag(Qt::ShiftModifier))
|
else if (infoArea == InfoAreaAircraft)
|
||||||
{
|
{
|
||||||
ui->comp_Settings->setSettingsOverviewTab();
|
ui->comp_Aircraft->setTab(CAircraftComponent::TabAircraftInRange);
|
||||||
}
|
}
|
||||||
|
else if (infoArea == InfoAreaMapping)
|
||||||
|
{
|
||||||
|
ui->comp_Mappings->setTab(CMappingComponent::TabRenderedAircraft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +165,7 @@ namespace BlackGui
|
|||||||
void CMainInfoAreaComponent::selectSettingsTab(int index)
|
void CMainInfoAreaComponent::selectSettingsTab(int index)
|
||||||
{
|
{
|
||||||
this->selectArea(InfoAreaSettings);
|
this->selectArea(InfoAreaSettings);
|
||||||
ui->comp_Settings->setSettingsTab(static_cast<CSettingsComponent::SettingTab>(index));
|
ui->comp_Settings->setTab(static_cast<CSettingsComponent::SettingTab>(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainInfoAreaComponent::selectAudioTab()
|
void CMainInfoAreaComponent::selectAudioTab()
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
|||||||
explicit CMainInfoAreaComponent(QWidget *parent = nullptr);
|
explicit CMainInfoAreaComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CMainInfoAreaComponent();
|
virtual ~CMainInfoAreaComponent() override;
|
||||||
|
|
||||||
//! Info areas
|
//! Info areas
|
||||||
enum InfoArea
|
enum InfoArea
|
||||||
|
|||||||
@@ -104,13 +104,13 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
QPushButton *senderButton = static_cast<QPushButton *>(QObject::sender());
|
QPushButton *senderButton = static_cast<QPushButton *>(QObject::sender());
|
||||||
Q_ASSERT_X(senderButton, Q_FUNC_INFO, "No sender button");
|
Q_ASSERT_X(senderButton, Q_FUNC_INFO, "No sender button");
|
||||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
|
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||||
if (!senderButton) { return; }
|
if (!senderButton) { return; }
|
||||||
const CMainInfoAreaComponent::InfoArea ia = buttonToMainInfoArea(senderButton);
|
const CMainInfoAreaComponent::InfoArea infoArea = buttonToMainInfoArea(senderButton);
|
||||||
if (ia != CMainInfoAreaComponent::InfoAreaNone)
|
if (infoArea != CMainInfoAreaComponent::InfoAreaNone)
|
||||||
{
|
{
|
||||||
Q_ASSERT(senderButton->isCheckable());
|
Q_ASSERT(senderButton->isCheckable());
|
||||||
emit this->selectedMainInfoAreaDockWidget(ia);
|
emit this->selectedMainInfoAreaDockWidget(infoArea);
|
||||||
senderButton->setChecked(true); // re-check if got unchecked, we use checked buttons like normal buttons
|
senderButton->setChecked(true); // re-check if got unchecked, we use checked buttons like normal buttons
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -137,11 +137,11 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else if (senderButton == ui->pb_Connect)
|
else if (senderButton == ui->pb_Connect)
|
||||||
{
|
{
|
||||||
emit connectPressed();
|
emit this->connectPressed();
|
||||||
}
|
}
|
||||||
else if (senderButton == ui->pb_Audio)
|
else if (senderButton == ui->pb_Audio)
|
||||||
{
|
{
|
||||||
emit audioPressed();
|
emit this->audioPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ namespace BlackGui
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CMainKeypadAreaComponent();
|
virtual ~CMainKeypadAreaComponent();
|
||||||
|
|
||||||
|
//! Main info area changed
|
||||||
|
void onMainInfoAreaChanged(int currentTabIndex, QList<int> dockedIndexes, QList<int> floatingIndexes);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Button to select main info area has been pressed
|
//! Button to select main info area has been pressed
|
||||||
//! \sa CMainInfoAreaComponent
|
//! \sa CMainInfoAreaComponent
|
||||||
@@ -68,10 +71,6 @@ namespace BlackGui
|
|||||||
//! Request audio
|
//! Request audio
|
||||||
void audioPressed();
|
void audioPressed();
|
||||||
|
|
||||||
public slots:
|
|
||||||
//! Main info area changed
|
|
||||||
void onMainInfoAreaChanged(int currentTabIndex, QList<int> dockedIndexes, QList<int> floatingIndexes);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Button was clicked
|
//! Button was clicked
|
||||||
void buttonSelected();
|
void buttonSelected();
|
||||||
|
|||||||
@@ -176,6 +176,12 @@ namespace BlackGui
|
|||||||
return ui->tvp_AircraftModels->rowCount();
|
return ui->tvp_AircraftModels->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::setTab(CMappingComponent::TabWidget tab)
|
||||||
|
{
|
||||||
|
const int tabIndex = static_cast<int>(tab);
|
||||||
|
ui->tw_SpecializedViews->setCurrentIndex(tabIndex);
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftModelList CMappingComponent::findModelsStartingWith(const QString modelName, Qt::CaseSensitivity cs)
|
CAircraftModelList CMappingComponent::findModelsStartingWith(const QString modelName, Qt::CaseSensitivity cs)
|
||||||
{
|
{
|
||||||
Q_ASSERT(ui->tvp_AircraftModels);
|
Q_ASSERT(ui->tvp_AircraftModels);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//! Tab widget
|
//! Tab widget
|
||||||
|
//! \remark needs to be in sync with tab order
|
||||||
enum TabWidget
|
enum TabWidget
|
||||||
{
|
{
|
||||||
TabRenderedAircraft = 0,
|
TabRenderedAircraft = 0,
|
||||||
@@ -65,21 +66,24 @@ namespace BlackGui
|
|||||||
TabPartsLog
|
TabPartsLog
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Log categories
|
||||||
|
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CMappingComponent(QWidget *parent = nullptr);
|
explicit CMappingComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CMappingComponent();
|
virtual ~CMappingComponent();
|
||||||
|
|
||||||
//! Log categories
|
|
||||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
|
||||||
|
|
||||||
//! Number of current mappings
|
//! Number of current mappings
|
||||||
int countCurrentMappings() const;
|
int countCurrentMappings() const;
|
||||||
|
|
||||||
//! Numer of models
|
//! Numer of models
|
||||||
int countAircraftModels() const;
|
int countAircraftModels() const;
|
||||||
|
|
||||||
|
//! Set tab
|
||||||
|
void setTab(TabWidget tab);
|
||||||
|
|
||||||
//! Find models starting with
|
//! Find models starting with
|
||||||
BlackMisc::Simulation::CAircraftModelList findModelsStartingWith(const QString modelName, Qt::CaseSensitivity cs);
|
BlackMisc::Simulation::CAircraftModelList findModelsStartingWith(const QString modelName, Qt::CaseSensitivity cs);
|
||||||
|
|
||||||
|
|||||||
@@ -141,14 +141,14 @@ namespace BlackGui
|
|||||||
return ui->comp_SettingsSimulatorBasics->getSimulatorSettings(simulator);
|
return ui->comp_SettingsSimulatorBasics->getSimulatorSettings(simulator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsComponent::setSettingsTab(CSettingsComponent::SettingTab tab)
|
void CSettingsComponent::setTab(CSettingsComponent::SettingTab tab)
|
||||||
{
|
{
|
||||||
this->setCurrentIndex(static_cast<int>(tab));
|
this->setCurrentIndex(static_cast<int>(tab));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsComponent::setSettingsOverviewTab()
|
void CSettingsComponent::setSettingsOverviewTab()
|
||||||
{
|
{
|
||||||
this->setSettingsTab(SettingTabOverview);
|
this->setTab(SettingTabOverview);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsComponent::setGuiOpacity(double value)
|
void CSettingsComponent::setGuiOpacity(double value)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace BlackGui
|
|||||||
BlackMisc::Simulation::Settings::CSpecializedSimulatorSettings getSimulatorSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
BlackMisc::Simulation::Settings::CSpecializedSimulatorSettings getSimulatorSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||||
|
|
||||||
//! Set the tab
|
//! Set the tab
|
||||||
void setSettingsTab(SettingTab tab);
|
void setTab(SettingTab tab);
|
||||||
|
|
||||||
//! Set the overview tab
|
//! Set the overview tab
|
||||||
void setSettingsOverviewTab();
|
void setSettingsOverviewTab();
|
||||||
@@ -96,7 +96,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
QScopedPointer<Ui::CSettingsComponent> ui;
|
QScopedPointer<Ui::CSettingsComponent> ui;
|
||||||
};
|
};
|
||||||
}
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ void SwiftGuiStd::initGuiSignals()
|
|||||||
connect(ui->comp_Login, &CLoginComponent::requestNetworkSettings, [ this ]()
|
connect(ui->comp_Login, &CLoginComponent::requestNetworkSettings, [ this ]()
|
||||||
{
|
{
|
||||||
this->setMainPageInfoArea(CMainInfoAreaComponent::InfoAreaSettings);
|
this->setMainPageInfoArea(CMainInfoAreaComponent::InfoAreaSettings);
|
||||||
ui->comp_MainInfoArea->getSettingsComponent()->setSettingsTab(CSettingsComponent::SettingTabServers);
|
ui->comp_MainInfoArea->getSettingsComponent()->setTab(CSettingsComponent::SettingTabServers);
|
||||||
});
|
});
|
||||||
connect(this, &SwiftGuiStd::currentMainInfoAreaChanged, ui->comp_Login, &CLoginComponent::mainInfoAreaChanged);
|
connect(this, &SwiftGuiStd::currentMainInfoAreaChanged, ui->comp_Login, &CLoginComponent::mainInfoAreaChanged);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user