| 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 "talk.h"cxx . . $ `<file>/src/network/talk.h`/ |
| 24 | #include "networkconnection.h"cxx . . $ `<file>/src/network/networkconnection.h`/ |
| 25 | #include "gamedialog.h"cxx . . $ `<file>/src/network/gamedialog.h`/ |
| 26 | #include "messages.h"cxx . . $ `<file>/src/network/messages.h`/ |
| 27 | #include "playergamelistings.h"cxx . . $ `<file>/src/network/playergamelistings.h`/ |
| 28 | #include "connectionwidget.h"cxx . . $ `<file>/src/connectionwidget.h`/ |
| 29 | #include "room.h"cxx . . $ `<file>/src/network/room.h`/ |
| 30 | /* I wonder if we could somehow generalize this class to handle |
| 31 | * all message/windows even if they're part of larger windows. |
| 32 | * We could even do it for the console, specifying a special |
| 33 | * "opponent" and for the room, with the room name as the |
| 34 | * opponent. And then it could handle all the sendText |
| 35 | * messages that would otherwise be spread around all |
| 36 | * the dispatches, cluttering up their otherwise |
| 37 | * specific calls.*/ |
| 38 | |
| 39 | Talkcxx . . $ Talk#::Talkcxx . . $ Talk#Talk(77742c7bccc24af4).(NetworkConnectioncxx . . $ NetworkConnection# * conn, PlayerListingcxx . . $ PlayerListing# *player, Roomcxx . . $ Room# * r) : TalkGuicxx . . $ Ui/TalkGui#(), connectioncxx . . $ Talk#connection.(conn), opponentcxx . . $ Talk#opponent.(player), roomcxx . . $ Talk#room.(r) |
| 40 | { |
| 41 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Creating Talk for %s", opponentcxx . . $ Talk#opponent.->namecxx . . $ PlayerListing#name..toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 42 | uicxx . . $ Talk#ui..setupUicxx . . $ Ui_TalkGui#setupUi(d194de0c0f68c28b).(this); |
| 43 | opponentcxx . . $ Talk#opponent.->dialog_openedcxx . . $ PlayerListing#dialog_opened. = true; |
| 44 | conversationOpenedcxx . . $ Talk#conversationOpened. = false; |
| 45 | |
| 46 | /* |
| 47 | // do not add a button for shouts* or channels tab |
| 48 | if ( (name.find('*') != -1) || (!isplayer)) |
| 49 | { |
| 50 | delete pb_releaseTalkTab; |
| 51 | delete pb_match; |
| 52 | delete stats_layout; |
| 53 | } |
| 54 | */ |
| 55 | connectcxx . . $ QObject#connect(835f87066c895669).(uicxx . . $ Talk#ui..pb_releaseTalkTabcxx . . $ Ui_TalkGui#pb_releaseTalkTab., &QPushButtoncxx . . $ QPushButton#::pressedcxx . . $ QAbstractButton#pressed(49f6e7a06ebc5aa8)., this, &Talkcxx . . $ Talk#::slot_pbRelTabcxx . . $ Talk#slot_pbRelTab(49f6e7a06ebc5aa8).); |
| 56 | connectcxx . . $ QObject#connect(835f87066c895669).(uicxx . . $ Talk#ui..pb_matchcxx . . $ Ui_TalkGui#pb_match., &QPushButtoncxx . . $ QPushButton#::pressedcxx . . $ QAbstractButton#pressed(49f6e7a06ebc5aa8)., this, &Talkcxx . . $ Talk#::slot_matchcxx . . $ Talk#slot_match(49f6e7a06ebc5aa8).); |
| 57 | connectcxx . . $ QObject#connect(835f87066c895669).(uicxx . . $ Talk#ui..LineEdit1cxx . . $ Ui_TalkGui#LineEdit1., &QLineEditcxx . . $ QLineEdit#::returnPressedcxx . . $ QLineEdit#returnPressed(49f6e7a06ebc5aa8)., this, &Talkcxx . . $ Talk#::slot_returnPressedcxx . . $ Talk#slot_returnPressed(49f6e7a06ebc5aa8).); |
| 58 | } |
| 59 | |
| 60 | Talkcxx . . $ Talk#::~cxx . . $ Talk#`~Talk`(ced63f7c635d850d).Talkcxx . . $ Talk#() |
| 61 | { |
| 62 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Talk destroyed"); |
| 63 | opponentcxx . . $ Talk#opponent.->dialog_openedcxx . . $ PlayerListing#dialog_opened. = false; |
| 64 | } |
| 65 | |
| 66 | void Talkcxx . . $ Talk#::closeEventcxx . . $ Talk#closeEvent(642e80679aeb34f8).(QCloseEventcxx . . $ QCloseEvent# *) |
| 67 | { |
| 68 | if(roomcxx . . $ Talk#room.) |
| 69 | roomcxx . . $ Talk#room.->closeTalkcxx . . $ Room#closeTalk(cac334474c82cf3a).(opponentcxx . . $ Talk#opponent.); |
| 70 | } |
| 71 | |
| 72 | QStringcxx . . $ QString# Talkcxx . . $ Talk#::get_namecxx . . $ Talk#get_name(6ef7b6c27b00b43d).() const |
| 73 | { return opponentcxx . . $ QString#QString(132dd6869045752b).->namecxx . . $ PlayerListing#name.; } |
| 74 | |
| 75 | // release current Tab |
| 76 | void Talkcxx . . $ Talk#::slot_pbRelTabcxx . . $ Talk#slot_pbRelTab(49f6e7a06ebc5aa8).() |
| 77 | { |
| 78 | roomcxx . . $ Talk#room.->closeTalkcxx . . $ Room#closeTalk(cac334474c82cf3a).(opponentcxx . . $ Talk#opponent.); |
| 79 | } |
| 80 | |
| 81 | void Talkcxx . . $ Talk#::slot_returnPressedcxx . . $ Talk#slot_returnPressed(49f6e7a06ebc5aa8).() |
| 82 | { |
| 83 | // read tab |
| 84 | QStringcxx . . $ QString# txt = uicxx . . $ Talk#ui..LineEdit1cxx . . $ Ui_TalkGui#LineEdit1.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).(); |
| 85 | connectioncxx . . $ Talk#connection.->sendMsgcxx . . $ NetworkConnection#sendMsg(c3abbc2f7b873519).(opponentcxx . . $ Talk#opponent., txtcxx . . $ QString#QString(132dd6869045752b).); |
| 86 | uicxx . . $ Talk#ui..MultiLineEdit1cxx . . $ Ui_TalkGui#MultiLineEdit1.->appendcxx . . $ QTextEdit#append(3520e46b33348bf6).(connectioncxx . . $ Talk#connection.->getUsernamecxx . . $ NetworkConnection#getUsername(a2fb7a6ce195d51).() +cxx . . $ operator+(3d22f08efddf8107). ": " +cxx . . $ operator+(fab9b4f80031f353). txt); |
| 87 | uicxx . . $ Talk#ui..LineEdit1cxx . . $ Ui_TalkGui#LineEdit1.->clearcxx . . $ QLineEdit#clear(49f6e7a06ebc5aa8).(); |
| 88 | } |
| 89 | |
| 90 | void Talkcxx . . $ Talk#::slot_matchcxx . . $ Talk#slot_match(49f6e7a06ebc5aa8).() |
| 91 | { |
| 92 | connectioncxx . . $ Talk#connection.->sendMatchInvitecxx . . $ NetworkConnection#sendMatchInvite(cac334474c82cf3a).(opponentcxx . . $ Talk#opponent.); |
| 93 | } |
| 94 | |
| 95 | void Talkcxx . . $ Talk#::recvTalkcxx . . $ Talk#recvTalk(7df51288a9ebd664).(QStringcxx . . $ QString# text) |
| 96 | { |
| 97 | uicxx . . $ Talk#ui..MultiLineEdit1cxx . . $ Ui_TalkGui#MultiLineEdit1.->appendcxx . . $ QTextEdit#append(3520e46b33348bf6).(opponentcxx . . $ Talk#opponent.->namecxx . . $ PlayerListing#name. +cxx . . $ operator+(3d22f08efddf8107). ": " +cxx . . $ operator+(fab9b4f80031f353). text); |
| 98 | } |
| 99 | |
| 100 | void Talkcxx . . $ Talk#::updatePlayerListingcxx . . $ Talk#updatePlayerListing(49f6e7a06ebc5aa8).(void) |
| 101 | { |
| 102 | if (opponentcxx . . $ Talk#opponent. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 103 | return; |
| 104 | |
| 105 | uicxx . . $ Talk#ui..stats_ratingcxx . . $ Ui_TalkGui#stats_rating.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(opponentcxx . . $ Talk#opponent.->rankcxx . . $ PlayerListing#rank.); |
| 106 | uicxx . . $ Talk#ui..stats_infocxx . . $ Ui_TalkGui#stats_info.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(opponentcxx . . $ Talk#opponent.->infocxx . . $ PlayerListing#info.); |
| 107 | uicxx . . $ Talk#ui..stats_defaultcxx . . $ Ui_TalkGui#stats_default.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(opponentcxx . . $ Talk#opponent.->extInfocxx . . $ PlayerListing#extInfo.); |
| 108 | uicxx . . $ Talk#ui..stats_winscxx . . $ Ui_TalkGui#stats_wins.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(opponentcxx . . $ Talk#opponent.->winscxx . . $ PlayerListing#wins.) +cxx . . $ operator+(3d22f08efddf8107). " /"); |
| 109 | uicxx . . $ Talk#ui..stats_losscxx . . $ Ui_TalkGui#stats_loss.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(opponentcxx . . $ Talk#opponent.->lossescxx . . $ PlayerListing#losses.) ); |
| 110 | uicxx . . $ Talk#ui..stats_countrycxx . . $ Ui_TalkGui#stats_country.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(opponentcxx . . $ Talk#opponent.->countrycxx . . $ PlayerListing#country.); |
| 111 | uicxx . . $ Talk#ui..stats_playingcxx . . $ Ui_TalkGui#stats_playing.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(opponentcxx . . $ Talk#opponent.->playingcxx . . $ PlayerListing#playing.)); |
| 112 | //ui.stats_rated->setText(p->rated); |
| 113 | uicxx . . $ Talk#ui..stats_addresscxx . . $ Ui_TalkGui#stats_address.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(opponentcxx . . $ Talk#opponent.->email_addresscxx . . $ PlayerListing#email_address.); |
| 114 | |
| 115 | // stored either idle time or last access |
| 116 | uicxx . . $ Talk#ui..stats_idlecxx . . $ Ui_TalkGui#stats_idle.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(opponentcxx . . $ Talk#opponent.->idletimecxx . . $ PlayerListing#idletime.); |
| 117 | if (!opponentcxx . . $ Talk#opponent.->idletimecxx . . $ PlayerListing#idletime..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 118 | uicxx . . $ Talk#ui..Label_Idlecxx . . $ Ui_TalkGui#Label_Idle.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(opponentcxx . . $ QString#QString(85c52e162fed56f9).->idletimecxx . . $ PlayerListing#idletime..atcxx . . $ QString#at(13af7ae5a875439e).(0).isDigitcxx . . $ QChar#isDigit(3482b152b9333168).() ? "Idle :": "Last log :"); |
| 119 | } |