mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +08:00
refs #855, re-center load indicator when resizing load overview
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c2861b792c
commit
1177cd862a
@@ -31,7 +31,7 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(sGui->getWebDataServices(), Q_FUNC_INFO, "no data services");
|
Q_ASSERT_X(sGui->getWebDataServices(), Q_FUNC_INFO, "no data services");
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
admitCaches(); // in background
|
this->admitCaches(); // in background
|
||||||
|
|
||||||
ui->lbl_DatabaseUrl->setTextFormat(Qt::RichText);
|
ui->lbl_DatabaseUrl->setTextFormat(Qt::RichText);
|
||||||
ui->lbl_DatabaseUrl->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
ui->lbl_DatabaseUrl->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
@@ -92,6 +92,28 @@ namespace BlackGui
|
|||||||
ui->tb_SharedReloadDistributors->setVisible(visible);
|
ui->tb_SharedReloadDistributors->setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDbLoadOverviewComponent::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
if (this->isShowingLoadIndicator())
|
||||||
|
{
|
||||||
|
// re-center
|
||||||
|
this->centerLoadIndicator();
|
||||||
|
}
|
||||||
|
QFrame::resizeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDbLoadOverviewComponent::isShowingLoadIndicator() const
|
||||||
|
{
|
||||||
|
return m_loadIndicator && this->isVisible() && m_loadIndicator->isAnimated();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDbLoadOverviewComponent::centerLoadIndicator()
|
||||||
|
{
|
||||||
|
if (!m_loadIndicator) { return; }
|
||||||
|
const QPoint middle = this->visibleRegion().boundingRect().center();
|
||||||
|
this->m_loadIndicator->centerLoadIndicator(middle);
|
||||||
|
}
|
||||||
|
|
||||||
void CDbLoadOverviewComponent::ps_setValues()
|
void CDbLoadOverviewComponent::ps_setValues()
|
||||||
{
|
{
|
||||||
if (!sGui) { return; }
|
if (!sGui) { return; }
|
||||||
@@ -172,8 +194,8 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
this->m_loadIndicator = new CLoadIndicator(64, 64, this);
|
this->m_loadIndicator = new CLoadIndicator(64, 64, this);
|
||||||
}
|
}
|
||||||
const QPoint middle = this->rect().center();
|
|
||||||
this->m_loadIndicator->centerLoadIndicator(middle);
|
this->centerLoadIndicator();
|
||||||
this->m_loadIndicator->startAnimation(true);
|
this->m_loadIndicator->startAnimation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,11 +47,21 @@ namespace BlackGui
|
|||||||
//! Visible shared refresh buttons
|
//! Visible shared refresh buttons
|
||||||
void setVisibleSharedRefreshButtons(bool visible);
|
void setVisibleSharedRefreshButtons(bool visible);
|
||||||
|
|
||||||
|
//! Showing load indicator?
|
||||||
|
bool isShowingLoadIndicator() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Trigger GUI update
|
//! Trigger GUI update
|
||||||
//! \private
|
//! \private
|
||||||
void ps_triggerDigestGuiUpdate();
|
void ps_triggerDigestGuiUpdate();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \copydoc QWidget::resizeEvent
|
||||||
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
|
//! Center load indicator
|
||||||
|
void centerLoadIndicator();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbLoadOverviewComponent> ui;
|
QScopedPointer<Ui::CDbLoadOverviewComponent> ui;
|
||||||
BlackGui::CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
BlackGui::CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
||||||
|
|||||||
Reference in New Issue
Block a user