mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs#325, made simulator component CDockWidgetInfoAreaComponent compliant, finetuning with resizing in some components
* updates can be skipped, when widget is invisible * current tab? only current tab updates * reduced resize frequency in some cases
This commit is contained in:
@@ -27,6 +27,7 @@ namespace BlackGui
|
||||
ui(new Ui::CAircraftComponent), m_timerComponent(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->tvp_AirportsInRange->setResizeMode(CAirportView::ResizingOnce);
|
||||
m_timerComponent = new CTimerBasedComponent(SLOT(update()), this);
|
||||
|
||||
connect(this->ui->tvp_AircraftsInRange, &CAircraftView::countChanged, this, &CAircraftComponent::ps_countChanged);
|
||||
@@ -58,7 +59,8 @@ namespace BlackGui
|
||||
|
||||
if (this->getIContextNetwork()->isConnected())
|
||||
{
|
||||
if (this->countAircrafts() < 1 || this->isVisibleWidget())
|
||||
bool visible = (this->isVisibleWidget() && this->currentWidget() == this->ui->tb_AircraftsInRange);
|
||||
if (this->countAircrafts() < 1 || visible)
|
||||
{
|
||||
this->ui->tvp_AircraftsInRange->updateContainer(this->getIContextNetwork()->getAircraftsInRange());
|
||||
}
|
||||
@@ -70,7 +72,8 @@ namespace BlackGui
|
||||
}
|
||||
if (this->getIContextSimulator()->isConnected())
|
||||
{
|
||||
if (this->countAirportsInRange() < 1 || this->isVisibleWidget())
|
||||
bool visible = (this->isVisibleWidget() && this->currentWidget() == this->ui->tb_AirportsInRange);
|
||||
if (this->countAirportsInRange() < 1 || visible)
|
||||
{
|
||||
this->ui->tvp_AirportsInRange->updateContainer(this->getIContextSimulator()->getAirportsInRange());
|
||||
}
|
||||
@@ -111,6 +114,5 @@ namespace BlackGui
|
||||
this->tabBar()->setTabText(ap, aps);
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace BlackGui
|
||||
QFrame(parent), ui(new Ui::CLogComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->tvp_StatusMessages->setAutoResizeFrequency(3);
|
||||
}
|
||||
|
||||
CLogComponent::~CLogComponent()
|
||||
|
||||
@@ -16,10 +16,13 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CSimulatorComponent::CSimulatorComponent(QWidget *parent) :
|
||||
QTabWidget(parent), ui(new Ui::CSimulatorComponent)
|
||||
QTabWidget(parent),
|
||||
CDockWidgetInfoAreaComponent(this),
|
||||
ui(new Ui::CSimulatorComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->tvp_LiveData->setIconMode(true);
|
||||
this->ui->tvp_LiveData->setAutoResizeFrequency(10); // only resize every n-th time
|
||||
this->addOrUpdateByName("info", "no data yet", CIcons::StandardIconWarning16);
|
||||
}
|
||||
|
||||
@@ -30,7 +33,8 @@ namespace BlackGui
|
||||
|
||||
void CSimulatorComponent::addOrUpdateByName(const QString &name, const QString &value, const CIcon &icon)
|
||||
{
|
||||
this->ui->tvp_LiveData->addOrUpdateByName(name, value, icon);
|
||||
bool resize = this->currentWidget() == this->ui->tb_LiveData; // simulator live data selected?
|
||||
this->ui->tvp_LiveData->addOrUpdateByName(name, value, icon, resize, false);
|
||||
}
|
||||
|
||||
void CSimulatorComponent::addOrUpdateByName(const QString &name, const QString &value, CIcons::IconIndex iconIndex)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "runtimebasedcomponent.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackgui/components/dockwidgetinfoareacomponent.h"
|
||||
#include <QTabWidget>
|
||||
|
||||
namespace Ui { class CSimulatorComponent; }
|
||||
@@ -23,7 +24,10 @@ namespace BlackGui
|
||||
{
|
||||
|
||||
//! Simulator component
|
||||
class CSimulatorComponent : public QTabWidget, public CRuntimeBasedComponent
|
||||
class CSimulatorComponent :
|
||||
public QTabWidget,
|
||||
public CDockWidgetInfoAreaComponent,
|
||||
public CRuntimeBasedComponent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -443,6 +443,8 @@ void MainWindow::updateSimulatorData()
|
||||
{
|
||||
CSimulatorComponent *simComp = this->ui->comp_MainInfoArea->getSimulatorComponent();
|
||||
Q_ASSERT(simComp);
|
||||
|
||||
if (!simComp->isVisibleWidget()) return; // no updates on invisible widgets
|
||||
if (!this->getIContextSimulator()->isConnected())
|
||||
{
|
||||
simComp->clear();
|
||||
|
||||
Reference in New Issue
Block a user