subsurface/desktop-widgets/notificationwidget.h
Berthold Stoeger a25f54e3c2 Use queued connection to thread-safe MainWindow error handling
Up to now, errors produced by threads were not directly shown in
the MainWindow. Code running in the GUI thread had to manually
show the errors.

This can be simplified by using Qt's queued connection as message
passing facility.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31 14:47:26 +01:00

35 lines
694 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef NOTIFICATIONWIDGET_H
#define NOTIFICATIONWIDGET_H
#include <QWidget>
#include <QFutureWatcher>
#include "desktop-widgets/kmessagewidget.h"
namespace Ui {
class NotificationWidget;
}
class NotificationWidget : public KMessageWidget {
Q_OBJECT
public:
explicit NotificationWidget(QWidget *parent = 0);
void setFuture(const QFuture<void> &future);
void showNotification(QString message, KMessageWidget::MessageType type);
void hideNotification();
QString getNotificationText();
public
slots:
void showError(QString message);
private:
QFutureWatcher<void> future_watcher;
private
slots:
void finish();
};
#endif // NOTIFICATIONWIDGET_H