68 lines
1.3 KiB
C++
68 lines
1.3 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
#include "lts_widgets_export.h"
|
|
|
|
#include <QObject>
|
|
|
|
class QTimer;
|
|
class QWidget;
|
|
|
|
namespace LtsWidgets
|
|
{
|
|
class LtsDialog;
|
|
class LtsOverlayLoading;
|
|
class LtsProgressDialogHelper;
|
|
|
|
class LTSWIDGETS_EXPORT LtsGlobalWaitDialog : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
static LtsGlobalWaitDialog* getInstance();
|
|
void wait(QWidget* parent, const QString& customText = QString());
|
|
|
|
void wait(const QString& customText = QString())
|
|
{
|
|
wait(nullptr, customText);
|
|
}
|
|
|
|
void done();
|
|
void setVisible(bool visible = true);
|
|
void setCustomText(const QString& customText = QString());
|
|
void unarm();
|
|
void rearm();
|
|
|
|
private:
|
|
friend struct LtsGlobalWaitDialogHandler;
|
|
|
|
LtsGlobalWaitDialog();
|
|
~LtsGlobalWaitDialog();
|
|
static void cleanupGwdInstance();
|
|
|
|
void showIt();
|
|
void hideIt();
|
|
|
|
int m_waitingCount;
|
|
bool m_visible;
|
|
bool m_armed{true};
|
|
LtsProgressDialogHelper* m_progressDialog;
|
|
QTimer* m_hideTimer;
|
|
};
|
|
|
|
} // namespace LtsWidgets
|
|
|
|
class LTSWIDGETS_EXPORT Waiter
|
|
{
|
|
public:
|
|
explicit Waiter(const QString& customText = {});
|
|
explicit Waiter(LtsWidgets::LtsDialog* parent, const QString& customText = {});
|
|
~Waiter();
|
|
|
|
private:
|
|
LtsWidgets::LtsOverlayLoading* m_loadingOverlay{nullptr};
|
|
LtsWidgets::LtsDialog* m_parent{nullptr};
|
|
bool m_oldClosableState{false};
|
|
};
|