mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
* context menu * timer based component can fire directly * View base class (non templated) so it can use Q_OBJECT
This commit is contained in:
@@ -100,9 +100,10 @@ namespace BlackGui
|
||||
Q_ASSERT(this->getIContextNetwork());
|
||||
|
||||
QObject *sender = QObject::sender();
|
||||
if (sender == this->ui->pb_ReloadAtcStationsBooked && this->getIContextNetwork())
|
||||
if (sender == this->ui->tvp_AtcStationsBooked && this->getIContextNetwork())
|
||||
{
|
||||
// trigger new read, which takes some time. A signal will be received when this is done
|
||||
this->sendStatusMessage(CStatusMessage::getInfoMessage("Requested new bookings", CStatusMessage::TypeTrafficNetwork));
|
||||
this->getIContextNetwork()->readAtcBookingsFromSource();
|
||||
}
|
||||
else
|
||||
@@ -199,7 +200,9 @@ namespace BlackGui
|
||||
if (this->currentWidget() == this->ui->tb_AtcStationsOnline)
|
||||
{
|
||||
if (this->m_timestampLastReadBookedStations.isNull())
|
||||
{
|
||||
this->ps_reloadAtcStationsBooked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,13 +277,6 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_ReloadAtcStationsBooked">
|
||||
<property name="text">
|
||||
<string>Reload</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -16,8 +16,12 @@ namespace BlackGui
|
||||
CTimerBasedComponent::CTimerBasedComponent(const char *slot, QObject *parent) :
|
||||
QObject(parent), m_timer(nullptr)
|
||||
{
|
||||
Q_ASSERT(parent);
|
||||
this->m_timer = new QTimer(this);
|
||||
this->m_timerSingleShot = new QTimer(this);
|
||||
this->m_timerSingleShot->setSingleShot(true);
|
||||
this->connect(this->m_timer, SIGNAL(timeout()), parent, slot);
|
||||
this->connect(this->m_timerSingleShot, SIGNAL(timeout()), parent, slot);
|
||||
}
|
||||
|
||||
CTimerBasedComponent::~CTimerBasedComponent()
|
||||
@@ -38,5 +42,11 @@ namespace BlackGui
|
||||
if (!this->m_timer->isActive()) this->m_timer->start();
|
||||
}
|
||||
}
|
||||
|
||||
void CTimerBasedComponent::fireTimer()
|
||||
{
|
||||
Q_ASSERT(this->m_timerSingleShot);
|
||||
this->m_timerSingleShot->start(10);
|
||||
}
|
||||
}
|
||||
} // guard
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace BlackGui
|
||||
//! Timer based componenet
|
||||
class CTimerBasedComponent: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CTimerBasedComponent(const char *slot, QObject *parent);
|
||||
@@ -46,8 +48,12 @@ namespace BlackGui
|
||||
//! Stop timer
|
||||
void stopTimer() { this->setUpdateInterval(-1); }
|
||||
|
||||
//! Fire the timer straight away
|
||||
void fireTimer();
|
||||
|
||||
private:
|
||||
QTimer *m_timer;
|
||||
QTimer *m_timerSingleShot;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user