aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/dialogs/restartdialog.cpp
blob: 93d5519350b22a06e8f080642bb379cd4c75e91e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "restartdialog.h"

#include <coreplugin/icore.h>

#include <QPushButton>

namespace Core {

RestartDialog::RestartDialog(QWidget *parent, const QString &text)
    : QMessageBox(parent)
{
    setWindowTitle(tr("Restart Required"));
    setText(text);
    setIcon(QMessageBox::Information);
    addButton(tr("Later"), QMessageBox::NoRole);
    addButton(tr("Restart Now"), QMessageBox::YesRole);

    connect(this, &QDialog::accepted, ICore::instance(), &ICore::restart, Qt::QueuedConnection);
}

} // namespace Core