blob: 98e993fcb488efeffab1cbac742fb6f8fc32ece9 [file] [log] [blame]
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2013-2014, Regents of the University of California,
4 *
5 * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD
6 * authors and contributors.
7 *
8 * NFD Control Center is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with NFD
17 * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * \author Ilya Moiseenko <iliamo@ucla.edu>
20 */
21
22#include "quit-dialog.hpp"
23
24#include <QVBoxLayout>
25#include <QApplication>
26
27QuitDialog::QuitDialog(QWidget *parent)
28 : QDialog(parent)
29{
30 question = new QLabel(tr("Shutdown NDN daemon as well?"));
31 information = new QLabel(tr("All NDN operations will become unavailable."));
32
33 confirmButton = new QPushButton(tr("Yes"));
34 noButton = new QPushButton(tr("No"));
35 cancelButton = new QPushButton(tr("Cancel"));
36 cancelButton->setDefault(true);
37
38 buttonBox = new QDialogButtonBox(Qt::Horizontal);
39 buttonBox->addButton(cancelButton, QDialogButtonBox::ActionRole);
40 buttonBox->addButton(noButton, QDialogButtonBox::ActionRole);
41 buttonBox->addButton(confirmButton, QDialogButtonBox::ActionRole);
42
43 connect(confirmButton,SIGNAL(pressed()), parent, SLOT(terminateDaemonAndClose()));
44 connect(noButton,SIGNAL(pressed()), qApp, SLOT(quit()));
45 connect(cancelButton,SIGNAL(pressed()), this, SLOT(hide()));
46
47 QVBoxLayout *layout = new QVBoxLayout;
48 layout->addWidget(question);
49 layout->addWidget(information);
50 layout->addWidget(buttonBox);
51
52 setLayout(layout);
53
54 setWindowTitle(tr("NDNx Control Center"));
55}
56
57#if WAF
58#include "quit-dialog.moc"
59#include "quit-dialog.cpp.moc"
60#endif