Ilya Moiseenko | 18c8a13 | 2013-10-24 01:52:52 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * @copyright See LICENCE for copyright and license information. |
| 4 | * |
| 5 | * @author Ilya Moiseenko <iliamo@ucla.edu> |
| 6 | */ |
| 7 | |
| 8 | #include "quit-dialog.h" |
| 9 | #include <QVBoxLayout> |
| 10 | #include <QApplication> |
| 11 | |
| 12 | QuitDialog::QuitDialog(QWidget *parent) |
| 13 | : QDialog(parent) |
| 14 | { |
| 15 | question = new QLabel(tr("Shutdown NDN daemon as well?")); |
| 16 | information = new QLabel(tr("All NDN operations will become unavailable.")); |
| 17 | |
| 18 | confirmButton = new QPushButton(tr("Yes")); |
| 19 | noButton = new QPushButton(tr("No")); |
| 20 | cancelButton = new QPushButton(tr("Cancel")); |
| 21 | cancelButton->setDefault(true); |
| 22 | |
| 23 | buttonBox = new QDialogButtonBox(Qt::Horizontal); |
| 24 | buttonBox->addButton(cancelButton, QDialogButtonBox::ActionRole); |
| 25 | buttonBox->addButton(noButton, QDialogButtonBox::ActionRole); |
| 26 | buttonBox->addButton(confirmButton, QDialogButtonBox::ActionRole); |
| 27 | |
| 28 | connect(confirmButton,SIGNAL(pressed()), parent, SLOT(terminateDaemonAndClose())); |
| 29 | connect(noButton,SIGNAL(pressed()), qApp, SLOT(quit())); |
| 30 | connect(cancelButton,SIGNAL(pressed()), this, SLOT(hide())); |
| 31 | |
| 32 | QVBoxLayout *layout = new QVBoxLayout; |
| 33 | layout->addWidget(question); |
| 34 | layout->addWidget(information); |
| 35 | layout->addWidget(buttonBox); |
| 36 | |
| 37 | setLayout(layout); |
| 38 | |
| 39 | setWindowTitle(tr("NDNx Control Center")); |
| 40 | } |