mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Cockpit UI improvements
* private slots -> private * Stylesheet update for readonly
This commit is contained in:
@@ -28,7 +28,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->m_minHeightInfoArea = ui->comp_CockpitInfoArea->minimumHeight();
|
this->m_minHeightInfoArea = ui->comp_CockpitInfoArea->minimumHeight();
|
||||||
connect(ui->wip_CockpitComPanelShowHideBar, &BlackGui::CShowHideBar::toggleShowHide, this, &CCockpitComponent::ps_onToggleShowHideDetails);
|
connect(ui->wip_CockpitComPanelShowHideBar, &BlackGui::CShowHideBar::toggleShowHide, this, &CCockpitComponent::onToggleShowHideDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCockpitComponent::~CCockpitComponent()
|
CCockpitComponent::~CCockpitComponent()
|
||||||
@@ -40,7 +40,7 @@ namespace BlackGui
|
|||||||
bool ok = CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(parentDockableWidget);
|
bool ok = CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(parentDockableWidget);
|
||||||
if (ok && parentDockableWidget)
|
if (ok && parentDockableWidget)
|
||||||
{
|
{
|
||||||
ok = connect(parentDockableWidget, &QDockWidget::topLevelChanged, this, &CCockpitComponent::ps_onToggleFloating);
|
ok = connect(parentDockableWidget, &QDockWidget::topLevelChanged, this, &CCockpitComponent::onToggleFloating);
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ namespace BlackGui
|
|||||||
ui->comp_CockpitInfoArea->selectArea(CCockpitInfoAreaComponent::InfoAreaAudio);
|
ui->comp_CockpitInfoArea->selectArea(CCockpitInfoAreaComponent::InfoAreaAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCockpitComponent::ps_onToggleShowHideDetails(bool show)
|
void CCockpitComponent::onToggleShowHideDetails(bool show)
|
||||||
{
|
{
|
||||||
// use the toggle method to set the sizes
|
// use the toggle method to set the sizes
|
||||||
this->toggleShowHideDetails(show, true);
|
this->toggleShowHideDetails(show, true);
|
||||||
@@ -116,7 +116,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCockpitComponent::ps_onToggleFloating(bool floating)
|
void CCockpitComponent::onToggleFloating(bool floating)
|
||||||
{
|
{
|
||||||
ui->wip_CockpitComPanelShowHideBar->setVisible(floating);
|
ui->wip_CockpitComPanelShowHideBar->setVisible(floating);
|
||||||
if (floating)
|
if (floating)
|
||||||
|
|||||||
@@ -53,14 +53,13 @@ namespace BlackGui
|
|||||||
//! Show the audio ui
|
//! Show the audio ui
|
||||||
void showAudio();
|
void showAudio();
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
//! Show or hide cockpit details
|
//! Show or hide cockpit details
|
||||||
void ps_onToggleShowHideDetails(bool show);
|
void onToggleShowHideDetails(bool show);
|
||||||
|
|
||||||
//! Toggle floating
|
//! Toggle floating
|
||||||
void ps_onToggleFloating(bool floating);
|
void onToggleFloating(bool floating);
|
||||||
|
|
||||||
private:
|
|
||||||
// toggle area on show/hide details
|
// toggle area on show/hide details
|
||||||
void toggleShowHideDetails(bool show, bool considerCurrentSize);
|
void toggleShowHideDetails(bool show, bool considerCurrentSize);
|
||||||
|
|
||||||
|
|||||||
@@ -7,16 +7,18 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "ui_voiceroomscomponent.h"
|
||||||
|
#include "blackgui/components/voiceroomscomponent.h"
|
||||||
|
#include "blackgui/views/userview.h"
|
||||||
|
#include "blackgui/guiapplication.h"
|
||||||
|
#include "blackgui/guiutility.h"
|
||||||
#include "blackcore/context/contextaudio.h"
|
#include "blackcore/context/contextaudio.h"
|
||||||
#include "blackcore/context/contextownaircraft.h"
|
#include "blackcore/context/contextownaircraft.h"
|
||||||
#include "blackgui/components/voiceroomscomponent.h"
|
|
||||||
#include "blackgui/guiapplication.h"
|
|
||||||
#include "blackgui/views/userview.h"
|
|
||||||
#include "blackmisc/audio/notificationsounds.h"
|
#include "blackmisc/audio/notificationsounds.h"
|
||||||
#include "blackmisc/audio/voiceroom.h"
|
#include "blackmisc/audio/voiceroom.h"
|
||||||
#include "blackmisc/aviation/comsystem.h"
|
#include "blackmisc/aviation/comsystem.h"
|
||||||
#include "blackmisc/sequence.h"
|
#include "blackmisc/sequence.h"
|
||||||
#include "ui_voiceroomscomponent.h"
|
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@@ -37,25 +39,25 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->setVoiceRoomUrlFieldsReadOnlyState();
|
this->setVoiceRoomUrlFieldsReadOnlyState();
|
||||||
connect(ui->cb_CockpitVoiceRoom1Override, &QCheckBox::toggled, this, &CVoiceRoomsComponent::ps_onVoiceRoomOverrideChanged);
|
connect(ui->cb_CockpitVoiceRoom1Override, &QCheckBox::toggled, this, &CVoiceRoomsComponent::onVoiceRoomOverrideChanged);
|
||||||
connect(ui->cb_CockpitVoiceRoom2Override, &QCheckBox::toggled, this, &CVoiceRoomsComponent::ps_onVoiceRoomOverrideChanged);
|
connect(ui->cb_CockpitVoiceRoom2Override, &QCheckBox::toggled, this, &CVoiceRoomsComponent::onVoiceRoomOverrideChanged);
|
||||||
connect(ui->le_CockpitVoiceRoomCom1, &QLineEdit::returnPressed, this, &CVoiceRoomsComponent::ps_onVoiceRoomUrlsReturnPressed);
|
connect(ui->le_CockpitVoiceRoomCom1, &QLineEdit::returnPressed, this, &CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed);
|
||||||
connect(ui->le_CockpitVoiceRoomCom2, &QLineEdit::returnPressed, this, &CVoiceRoomsComponent::ps_onVoiceRoomUrlsReturnPressed);
|
connect(ui->le_CockpitVoiceRoomCom2, &QLineEdit::returnPressed, this, &CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed);
|
||||||
connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRooms, this, &CVoiceRoomsComponent::ps_updateAudioVoiceRoomsFromContext);
|
connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRooms, this, &CVoiceRoomsComponent::updateAudioVoiceRoomsFromContext);
|
||||||
connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRoomMembers, this, &CVoiceRoomsComponent::ps_updateVoiceRoomMembers);
|
connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRoomMembers, this, &CVoiceRoomsComponent::updateVoiceRoomMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
CVoiceRoomsComponent::~CVoiceRoomsComponent()
|
CVoiceRoomsComponent::~CVoiceRoomsComponent()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void CVoiceRoomsComponent::ps_onVoiceRoomOverrideChanged(bool checked)
|
void CVoiceRoomsComponent::onVoiceRoomOverrideChanged(bool checked)
|
||||||
{
|
{
|
||||||
Q_UNUSED(checked);
|
Q_UNUSED(checked);
|
||||||
this->setVoiceRoomUrlFieldsReadOnlyState();
|
this->setVoiceRoomUrlFieldsReadOnlyState();
|
||||||
this->ps_onVoiceRoomUrlsReturnPressed(); // use this function to update voicerooms
|
this->onVoiceRoomUrlsReturnPressed(); // use this function to update voicerooms
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoiceRoomsComponent::ps_onVoiceRoomUrlsReturnPressed()
|
void CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed()
|
||||||
{
|
{
|
||||||
Q_ASSERT(sGui->getIContextOwnAircraft()); // voice room resolution is part of own aircraft
|
Q_ASSERT(sGui->getIContextOwnAircraft()); // voice room resolution is part of own aircraft
|
||||||
QString url1;
|
QString url1;
|
||||||
@@ -71,9 +73,10 @@ namespace BlackGui
|
|||||||
bool c2 = ui->cb_CockpitVoiceRoom2Override->isChecked();
|
bool c2 = ui->cb_CockpitVoiceRoom2Override->isChecked();
|
||||||
ui->le_CockpitVoiceRoomCom1->setReadOnly(!c1);
|
ui->le_CockpitVoiceRoomCom1->setReadOnly(!c1);
|
||||||
ui->le_CockpitVoiceRoomCom2->setReadOnly(!c2);
|
ui->le_CockpitVoiceRoomCom2->setReadOnly(!c2);
|
||||||
|
CGuiUtility::forceStyleSheetUpdate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoiceRoomsComponent::ps_updateAudioVoiceRoomsFromContext(const CVoiceRoomList &selectedVoiceRooms, bool connected)
|
void CVoiceRoomsComponent::updateAudioVoiceRoomsFromContext(const CVoiceRoomList &selectedVoiceRooms, bool connected)
|
||||||
{
|
{
|
||||||
Q_ASSERT(selectedVoiceRooms.size() == 2);
|
Q_ASSERT(selectedVoiceRooms.size() == 2);
|
||||||
CVoiceRoom room1 = selectedVoiceRooms[0];
|
CVoiceRoom room1 = selectedVoiceRooms[0];
|
||||||
@@ -108,7 +111,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
if (changedUrl1 || changedUrl2)
|
if (changedUrl1 || changedUrl2)
|
||||||
{
|
{
|
||||||
this->ps_updateVoiceRoomMembers();
|
this->updateVoiceRoomMembers();
|
||||||
|
|
||||||
// notify
|
// notify
|
||||||
if (sGui->getIContextAudio())
|
if (sGui->getIContextAudio())
|
||||||
@@ -121,7 +124,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoiceRoomsComponent::ps_updateVoiceRoomMembers()
|
void CVoiceRoomsComponent::updateVoiceRoomMembers()
|
||||||
{
|
{
|
||||||
if (!sGui->getIContextAudio()) { return; }
|
if (!sGui->getIContextAudio()) { return; }
|
||||||
if (!ui->le_CockpitVoiceRoomCom1->text().trimmed().isEmpty())
|
if (!ui->le_CockpitVoiceRoomCom1->text().trimmed().isEmpty())
|
||||||
|
|||||||
@@ -38,22 +38,21 @@ namespace BlackGui
|
|||||||
explicit CVoiceRoomsComponent(QWidget *parent = nullptr);
|
explicit CVoiceRoomsComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CVoiceRoomsComponent();
|
virtual ~CVoiceRoomsComponent();
|
||||||
|
|
||||||
private slots:
|
|
||||||
//! Override for voice was changed
|
|
||||||
void ps_onVoiceRoomOverrideChanged(bool checked);
|
|
||||||
|
|
||||||
//! Return pressed
|
|
||||||
void ps_onVoiceRoomUrlsReturnPressed();
|
|
||||||
|
|
||||||
//! Set the voice room url fields (checkboxes, line edits)
|
|
||||||
void ps_updateAudioVoiceRoomsFromContext(const BlackMisc::Audio::CVoiceRoomList &selectedVoiceRooms, bool connected);
|
|
||||||
|
|
||||||
//! Update voice room views
|
|
||||||
void ps_updateVoiceRoomMembers();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
//! Override for voice was changed
|
||||||
|
void onVoiceRoomOverrideChanged(bool checked);
|
||||||
|
|
||||||
|
//! Return pressed
|
||||||
|
void onVoiceRoomUrlsReturnPressed();
|
||||||
|
|
||||||
|
//! Set the voice room url fields (checkboxes, line edits)
|
||||||
|
void updateAudioVoiceRoomsFromContext(const BlackMisc::Audio::CVoiceRoomList &selectedVoiceRooms, bool connected);
|
||||||
|
|
||||||
|
//! Update voice room views
|
||||||
|
void updateVoiceRoomMembers();
|
||||||
|
|
||||||
//! Set the URL fields
|
//! Set the URL fields
|
||||||
void setVoiceRoomUrlFieldsReadOnlyState();
|
void setVoiceRoomUrlFieldsReadOnlyState();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user