mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 17:43:24 +00:00
Make future_watcher a subobject of NotificationWidget
This was a raw pointer. No point in doing error-prone manual memory management. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5a9faf2fea
commit
1704e08012
2 changed files with 3 additions and 10 deletions
|
@ -3,8 +3,7 @@
|
|||
|
||||
NotificationWidget::NotificationWidget(QWidget *parent) : KMessageWidget(parent)
|
||||
{
|
||||
future_watcher = new QFutureWatcher<void>();
|
||||
connect(future_watcher, SIGNAL(finished()), this, SLOT(finish()));
|
||||
connect(&future_watcher, SIGNAL(finished()), this, SLOT(finish()));
|
||||
}
|
||||
|
||||
void NotificationWidget::showNotification(QString message, KMessageWidget::MessageType type)
|
||||
|
@ -29,15 +28,10 @@ QString NotificationWidget::getNotificationText()
|
|||
|
||||
void NotificationWidget::setFuture(const QFuture<void> &future)
|
||||
{
|
||||
future_watcher->setFuture(future);
|
||||
future_watcher.setFuture(future);
|
||||
}
|
||||
|
||||
void NotificationWidget::finish()
|
||||
{
|
||||
hideNotification();
|
||||
}
|
||||
|
||||
NotificationWidget::~NotificationWidget()
|
||||
{
|
||||
delete future_watcher;
|
||||
}
|
||||
|
|
|
@ -20,10 +20,9 @@ public:
|
|||
void showNotification(QString message, KMessageWidget::MessageType type);
|
||||
void hideNotification();
|
||||
QString getNotificationText();
|
||||
~NotificationWidget();
|
||||
|
||||
private:
|
||||
QFutureWatcher<void> *future_watcher;
|
||||
QFutureWatcher<void> future_watcher;
|
||||
|
||||
private
|
||||
slots:
|
||||
|
|
Loading…
Add table
Reference in a new issue