1 /*
2  *  Copyright (C) 2013-2018 Ofer Kashayov <oferkv@live.com>
3  *  This file is part of Phototonic Image Viewer.
4  *
5  *  Phototonic is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  Phototonic is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with Phototonic.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include "ProgressDialog.h"
20 
ProgressDialog(QWidget * parent)21 ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent) {
22     opLabel = new QLabel("");
23     abortOp = false;
24 
25     cancelButton = new QPushButton(tr("Cancel"));
26     cancelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
27     connect(cancelButton, SIGNAL(clicked()), this, SLOT(abort()));
28 
29     QHBoxLayout *topLayout = new QHBoxLayout;
30     topLayout->addWidget(opLabel);
31 
32     QHBoxLayout *buttonsLayout = new QHBoxLayout;
33     buttonsLayout->addWidget(cancelButton);
34 
35     QVBoxLayout *mainLayout = new QVBoxLayout;
36     mainLayout->addLayout(topLayout);
37     mainLayout->addLayout(buttonsLayout, Qt::AlignRight);
38     setLayout(mainLayout);
39 }
40 
abort()41 void ProgressDialog::abort() {
42     abortOp = true;
43 }
44