refs #911, utility class to easily enable class for load indicator

and used it with CDbLoadOverviewComponent
This commit is contained in:
Klaus Basan
2017-03-22 18:31:31 +01:00
committed by Mathew Sutcliffe
parent cc1fd0e868
commit 24af0f044f
4 changed files with 93 additions and 44 deletions

View File

@@ -73,6 +73,10 @@ namespace BlackGui
//! Center this load indicator
void centerLoadIndicator(const QPoint &middle);
signals:
//! Timed out
void timedOut();
public slots:
//! Starts the spin animation.
//! \sa stopAnimation isAnimated
@@ -116,6 +120,41 @@ namespace BlackGui
bool m_displayedWhenStopped = false;
QColor m_color = Qt::blue;
};
/**
* Enable widgte class for load indicator
*/
class BLACKGUI_EXPORT CLoadIndicatorEnabled
{
public:
//! Ctor
CLoadIndicatorEnabled(QWidget *usingWidget);
//! Showing load indicator?
bool isShowingLoadIndicator() const;
//! Show load indicator
void showLoading(int timeoutMs = -1, bool processEvents = true);
//! Hide load indicator
void hideLoading();
//! Loading in progress?
bool isLoadInProgress() const;
protected:
//! Center load indicator
void centerLoadIndicator();
//! Indicator timed out
//! \remark override for usage
void virtual indicatorTimedOut();
QWidget *m_usingWidget = nullptr; //!< widget which uses load indicator
CLoadIndicator *m_loadIndicator = nullptr; //!< indicator itself
bool m_loadInProgress = false; //!< flag indicating loading
int m_indicatorId = -1; //!< last indicator id returned
};
} // ns
#endif