Debian Codegraph @

src/network/codecwarndialog.cpp

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2009 by The qGo Project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 #include <QtWidgets>
24 #include "codecwarndialog.h"
25 #include "../defines.h"
26
27 CodecWarnDialog::CodecWarnDialog(const char * encoding)
28 {
29 if(!preferences.warn_about_codecs)
30 {
31 deleteLater();
32 done(0);
33 }
34 /* FIXME okayButton should be on lower right and window should be slightly
35 * larger, more warning like, maybe with padding around text, some kind of
36 * layout. */
37 okayButton = new QPushButton(tr("Okay"));
38 okayButton->setMaximumWidth(80);
39 okayButton->setDefault(true);
40
41 dontwarnCB = new QCheckBox(tr("Don't warn me again"));
42
43 textLabel = new QLabel(tr("Can't find font codec \"%1\"\nUsing default").arg(encoding));
44
45 connect(okayButton, &QPushButton::clicked, this, &CodecWarnDialog::slot_okay);
46
47 QGridLayout * mainLayout = new QGridLayout;
48 //mainLayout->setSizeConstraint(QLayout::SetFixedSize);
49 mainLayout->addWidget(textLabel, 0, 0);
50 mainLayout->addWidget(dontwarnCB, 1, 0);
51 mainLayout->addWidget(okayButton, 2, 0);
52 setLayout(mainLayout);
53
54 setWindowTitle(tr("Missing Codec!"));
55 show();
56 }
57
58 CodecWarnDialog::~CodecWarnDialog()
59 {
60 if(dontwarnCB->isChecked())
61 preferences.warn_about_codecs = 0;
62 delete okayButton;
63 delete dontwarnCB;
64 }
65
66 void CodecWarnDialog::slot_okay(void)
67 {
68 /* Why does this need to be here as well as above? FIXME,
69 * why doesn't it suffice solely in deconstructor */
70 if(dontwarnCB->isChecked())
71 preferences.warn_about_codecs = 0;
72 deleteLater();
73 done(0);
74 }