| 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 "matchinvitedialog.h"cxx . . $ `<file>/src/network/matchinvitedialog.h`/ |
| 25 | |
| 26 | MatchInviteDialogcxx . . $ MatchInviteDialog#::MatchInviteDialogcxx . . $ MatchInviteDialog#MatchInviteDialog(1262106ee45454b8).(QStringcxx . . $ QString# name, QStringcxx . . $ QString# rank, bool canRefuseFuture) |
| 27 | { |
| 28 | int horiz_pos = 0; |
| 29 | secondscxx . . $ MatchInviteDialog#seconds. = 20; //does it? |
| 30 | |
| 31 | /* FIXME, we need to center this text, make the font larger, or |
| 32 | * bold, etc.. */ |
| 33 | namelabelcxx . . $ MatchInviteDialog#namelabel. = new QLabelcxx . . $ QLabel#(trcxx . . $ MatchInviteDialog#tr(75d9f1c324b4579d).("%1 %2").argcxx . . $ QString#arg(bc823072288cbbb5).(name).argcxx . . $ QString#arg(bc823072288cbbb5).(rank)); |
| 34 | dialoglabelcxx . . $ MatchInviteDialog#dialoglabel. = new QLabelcxx . . $ QLabel#(trcxx . . $ MatchInviteDialog#tr(75d9f1c324b4579d).("wants to play a match...")); |
| 35 | timelabelcxx . . $ MatchInviteDialog#timelabel. = new QLabelcxx . . $ QLabel#(trcxx . . $ MatchInviteDialog#tr(75d9f1c324b4579d).("%1 seconds").argcxx . . $ QString#arg(64ab2ed17cc11715).(secondscxx . . $ MatchInviteDialog#seconds.)); |
| 36 | |
| 37 | acceptButtoncxx . . $ MatchInviteDialog#acceptButton. = new QPushButtoncxx . . $ QPushButton#QPushButton(90d5708627041e22).(trcxx . . $ MatchInviteDialog#tr(75d9f1c324b4579d).("&Accept")); |
| 38 | acceptButtoncxx . . $ MatchInviteDialog#acceptButton.->setDefaultcxx . . $ QPushButton#setDefault(b45ddcbc8423892c).(true); |
| 39 | |
| 40 | declineButtoncxx . . $ MatchInviteDialog#declineButton. = new QPushButtoncxx . . $ QPushButton#QPushButton(90d5708627041e22).(trcxx . . $ MatchInviteDialog#tr(75d9f1c324b4579d).("&Decline")); |
| 41 | if(canRefuseFuture) |
| 42 | refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB. = new QCheckBoxcxx . . $ QCheckBox#(trcxx . . $ MatchInviteDialog#tr(75d9f1c324b4579d).("Refuse Invites from %1").argcxx . . $ QString#arg(bc823072288cbbb5).(name)); |
| 43 | else |
| 44 | refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB. = 0; |
| 45 | buttonBoxcxx . . $ MatchInviteDialog#buttonBox. = new QDialogButtonBoxcxx . . $ QDialogButtonBox#(Qtcxx . . $ Qt/::Horizontalcxx . . $ Qt/Horizontal.); |
| 46 | buttonBoxcxx . . $ MatchInviteDialog#buttonBox.->addButtoncxx . . $ QDialogButtonBox#addButton(7ed195453ac96140).(acceptButtoncxx . . $ MatchInviteDialog#acceptButton., QDialogButtonBoxcxx . . $ QDialogButtonBox#::ActionRolecxx . . $ QDialogButtonBox#ActionRole.); |
| 47 | buttonBoxcxx . . $ MatchInviteDialog#buttonBox.->addButtoncxx . . $ QDialogButtonBox#addButton(7ed195453ac96140).(declineButtoncxx . . $ MatchInviteDialog#declineButton., QDialogButtonBoxcxx . . $ QDialogButtonBox#::ActionRolecxx . . $ QDialogButtonBox#ActionRole.); |
| 48 | |
| 49 | connectcxx . . $ QObject#connect(835f87066c895669).(acceptButtoncxx . . $ MatchInviteDialog#acceptButton., &QPushButtoncxx . . $ QPushButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &MatchInviteDialogcxx . . $ MatchInviteDialog#::slot_acceptcxx . . $ MatchInviteDialog#slot_accept(49f6e7a06ebc5aa8).); |
| 50 | connectcxx . . $ QObject#connect(835f87066c895669).(declineButtoncxx . . $ MatchInviteDialog#declineButton., &QPushButtoncxx . . $ QPushButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &MatchInviteDialogcxx . . $ MatchInviteDialog#::slot_declinecxx . . $ MatchInviteDialog#slot_decline(49f6e7a06ebc5aa8).); |
| 51 | if(refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB.) |
| 52 | connectcxx . . $ QObject#connect(835f87066c895669).(refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB., &QCheckBoxcxx . . $ QCheckBox#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &MatchInviteDialogcxx . . $ MatchInviteDialog#::slot_refuseFutureCBcxx . . $ MatchInviteDialog#slot_refuseFutureCB(b45ddcbc8423892c).); |
| 53 | |
| 54 | QGridLayoutcxx . . $ QGridLayout# * mainLayout = new QGridLayoutcxx . . $ QGridLayout#; |
| 55 | mainLayout->setSizeConstraintcxx . . $ QLayout#setSizeConstraint(2d278d641bf12a66).(QLayoutcxx . . $ QLayout#::SetFixedSizecxx . . $ QLayout#SetFixedSize.); |
| 56 | mainLayout->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(namelabelcxx . . $ MatchInviteDialog#namelabel., horiz_pos++, 0); |
| 57 | mainLayout->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(dialoglabelcxx . . $ MatchInviteDialog#dialoglabel., horiz_pos++, 0); |
| 58 | mainLayout->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(timelabelcxx . . $ MatchInviteDialog#timelabel., horiz_pos++, 0); |
| 59 | if(refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB.) |
| 60 | mainLayout->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB., horiz_pos++, 0); |
| 61 | mainLayout->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(buttonBoxcxx . . $ MatchInviteDialog#buttonBox., horiz_pos++, 0); |
| 62 | setLayoutcxx . . $ QWidget#setLayout(23396b1058755fec).(mainLayout); |
| 63 | |
| 64 | setWindowTitlecxx . . $ QWidget#setWindowTitle(3520e46b33348bf6).(trcxx . . $ MatchInviteDialog#tr(75d9f1c324b4579d).("Match Invite!")); |
| 65 | |
| 66 | startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(1000); |
| 67 | } |
| 68 | |
| 69 | void MatchInviteDialogcxx . . $ MatchInviteDialog#::timerEventcxx . . $ MatchInviteDialog#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent#*) |
| 70 | { |
| 71 | secondscxx . . $ MatchInviteDialog#seconds.--; |
| 72 | if(secondscxx . . $ MatchInviteDialog#seconds. == -1) |
| 73 | donecxx . . $ QDialog#done(d4f767463ce0a6b3).(-1); //does this return 0? |
| 74 | timelabelcxx . . $ MatchInviteDialog#timelabel.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ MatchInviteDialog#tr(75d9f1c324b4579d).("%1 seconds").argcxx . . $ QString#arg(64ab2ed17cc11715).(secondscxx . . $ MatchInviteDialog#seconds.)); |
| 75 | } |
| 76 | |
| 77 | MatchInviteDialogcxx . . $ MatchInviteDialog#::~cxx . . $ MatchInviteDialog#`~MatchInviteDialog`(ced63f7c635d850d).MatchInviteDialogcxx . . $ MatchInviteDialog#() |
| 78 | { |
| 79 | delete acceptButtoncxx . . $ MatchInviteDialog#acceptButton.; |
| 80 | delete declineButtoncxx . . $ MatchInviteDialog#declineButton.; |
| 81 | delete refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB.; |
| 82 | delete buttonBoxcxx . . $ MatchInviteDialog#buttonBox.; |
| 83 | } |
| 84 | |
| 85 | /* I'm assuming here that a close by time returns 0 */ |
| 86 | void MatchInviteDialogcxx . . $ MatchInviteDialog#::slot_acceptcxx . . $ MatchInviteDialog#slot_accept(49f6e7a06ebc5aa8).(void) |
| 87 | { |
| 88 | donecxx . . $ QDialog#done(d4f767463ce0a6b3).(1); |
| 89 | } |
| 90 | |
| 91 | void MatchInviteDialogcxx . . $ MatchInviteDialog#::slot_declinecxx . . $ MatchInviteDialog#slot_decline(49f6e7a06ebc5aa8).(void) |
| 92 | { |
| 93 | if(refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB. && refuseFutureCBcxx . . $ MatchInviteDialog#refuseFutureCB.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).()) |
| 94 | donecxx . . $ QDialog#done(d4f767463ce0a6b3).(-2); |
| 95 | else |
| 96 | donecxx . . $ QDialog#done(d4f767463ce0a6b3).(-1); |
| 97 | } |
| 98 | |
| 99 | void MatchInviteDialogcxx . . $ MatchInviteDialog#::slot_refuseFutureCBcxx . . $ MatchInviteDialog#slot_refuseFutureCB(b45ddcbc8423892c).(bool b) |
| 100 | { |
| 101 | if(b) |
| 102 | { |
| 103 | acceptButtoncxx . . $ MatchInviteDialog#acceptButton.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 104 | } |
| 105 | else |
| 106 | acceptButtoncxx . . $ MatchInviteDialog#acceptButton.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 107 | } |