mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
refs #911, utility class to easily enable class for load indicator
and used it with CDbLoadOverviewComponent
This commit is contained in:
committed by
Mathew Sutcliffe
parent
cc1fd0e868
commit
24af0f044f
@@ -24,7 +24,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CDbLoadOverviewComponent::CDbLoadOverviewComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
QFrame(parent), CLoadIndicatorEnabled(this),
|
||||
ui(new Ui::CDbLoadOverviewComponent)
|
||||
{
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "missing sGui");
|
||||
@@ -105,16 +105,6 @@ namespace BlackGui
|
||||
QFrame::resizeEvent(event);
|
||||
}
|
||||
|
||||
bool CDbLoadOverviewComponent::isShowingLoadIndicator() const
|
||||
{
|
||||
return m_loadIndicator && this->isVisible() && m_loadIndicator->isAnimated();
|
||||
}
|
||||
|
||||
bool CDbLoadOverviewComponent::isLoadInProgress() const
|
||||
{
|
||||
return m_loadInProgress;
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::showVisibleLoadAllButtons(bool shared, bool db)
|
||||
{
|
||||
const bool widget = shared || db;
|
||||
@@ -133,13 +123,6 @@ namespace BlackGui
|
||||
this->triggerLoadingFromSharedFiles(CEntityFlags::AllDbEntitiesNoInfoObjects);
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::centerLoadIndicator()
|
||||
{
|
||||
if (!m_loadIndicator) { return; }
|
||||
const QPoint middle = this->visibleRegion().boundingRect().center();
|
||||
this->m_loadIndicator->centerLoadIndicator(middle);
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::ps_setValues()
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
@@ -212,18 +195,7 @@ namespace BlackGui
|
||||
ui->lbl_SharedUrls->setMinimumHeight(10 + (18 * sharedUrls.size()));
|
||||
|
||||
// Indicator
|
||||
if (this->m_loadIndicator) { this->m_loadIndicator->stopAnimation(); }
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::showLoading()
|
||||
{
|
||||
if (!this->m_loadIndicator)
|
||||
{
|
||||
this->m_loadIndicator = new CLoadIndicator(64, 64, this);
|
||||
}
|
||||
|
||||
this->centerLoadIndicator();
|
||||
this->m_loadIndicator->startAnimation(true);
|
||||
this->hideLoading();
|
||||
}
|
||||
|
||||
bool CDbLoadOverviewComponent::isInitialized() const
|
||||
|
||||
@@ -27,7 +27,8 @@ namespace BlackGui
|
||||
/*!
|
||||
* Overview about load state of DB data
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbLoadOverviewComponent : public QFrame
|
||||
class BLACKGUI_EXPORT CDbLoadOverviewComponent :
|
||||
public QFrame, public BlackGui::CLoadIndicatorEnabled
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -50,12 +51,6 @@ namespace BlackGui
|
||||
//! Show load all buttons
|
||||
void showVisibleLoadAllButtons(bool shared, bool db);
|
||||
|
||||
//! Showing load indicator?
|
||||
bool isShowingLoadIndicator() const;
|
||||
|
||||
//! Loading in progress?
|
||||
bool isLoadInProgress() const;
|
||||
|
||||
//! Load all from DB
|
||||
void loadAllFromDb();
|
||||
|
||||
@@ -71,12 +66,8 @@ namespace BlackGui
|
||||
//! \copydoc QWidget::resizeEvent
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
//! Center load indicator
|
||||
void centerLoadIndicator();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbLoadOverviewComponent> ui;
|
||||
BlackGui::CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
||||
BlackMisc::CDigestSignal m_dsTriggerGuiUpdate { this, &CDbLoadOverviewComponent::ps_triggerDigestGuiUpdate, &CDbLoadOverviewComponent::ps_setValues, 750, 4 };
|
||||
bool m_loadInProgress = false; //!< data loading in progress
|
||||
|
||||
@@ -86,9 +77,6 @@ namespace BlackGui
|
||||
//! Trigger loading from shared files
|
||||
void triggerLoadingFromSharedFiles(BlackMisc::Network::CEntityFlags::Entity entities);
|
||||
|
||||
//! Show loading
|
||||
void showLoading();
|
||||
|
||||
//! Values at least set once
|
||||
bool isInitialized() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user