diff options
author | RJ Ryan <rryan@mixxx.org> | 2015-12-22 17:34:55 -0500 |
---|---|---|
committer | RJ Ryan <rryan@mixxx.org> | 2015-12-22 17:34:55 -0500 |
commit | 745a2d643b1c1fee4d08ffbeceb4b14febd4f65b (patch) | |
tree | ef2a5b2eb7ddca3ed5d2c17d11e418bd55e0f4a2 /src/errordialoghandler.cpp | |
parent | 608d346a60cef90a288ed4c9d6e8e18827a2147c (diff) |
Disable ErrorDialogHandler when running tests.
Diffstat (limited to 'src/errordialoghandler.cpp')
-rw-r--r-- | src/errordialoghandler.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/errordialoghandler.cpp b/src/errordialoghandler.cpp index 640e238c5d..c0888fbfab 100644 --- a/src/errordialoghandler.cpp +++ b/src/errordialoghandler.cpp @@ -67,6 +67,12 @@ void ErrorDialogProperties::addButton(QMessageBox::StandardButton button) { // ---------- ErrorDialogHandler begins here ---------- ErrorDialogHandler* ErrorDialogHandler::s_pInstance = NULL; +bool ErrorDialogHandler::s_bEnabled = true; + +// static +void ErrorDialogHandler::setEnabled(bool enabled) { + s_bEnabled = enabled; +} ErrorDialogHandler::ErrorDialogHandler() : m_signalMapper(this) { @@ -88,6 +94,9 @@ ErrorDialogProperties* ErrorDialogHandler::newDialogProperties() { bool ErrorDialogHandler::requestErrorDialog(DialogType type, QString message, bool shouldQuit) { + if (!s_bEnabled) { + return false; + } ErrorDialogProperties* props = newDialogProperties(); props->setType(type); props->setText(message); @@ -109,9 +118,15 @@ bool ErrorDialogHandler::requestErrorDialog(DialogType type, QString message, } bool ErrorDialogHandler::requestErrorDialog(ErrorDialogProperties* props) { + if (!s_bEnabled) { + delete props; + return false; + } + // Make sure the minimum items are set QString text = props->getText(); DEBUG_ASSERT_AND_HANDLE(!text.isEmpty()) { + delete props; return false; } |