File indexing completed on 2024-05-12 04:04:15
0001 /* 0002 This file is part of Knights, a chess board for KDE SC 4. 0003 SPDX-FileCopyrightText: 2009, 2010, 2011 Miha Čančula <miha@noughmad.eu> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #include "localprotocol.h" 0009 #include "gamemanager.h" 0010 0011 #include <KUser> 0012 0013 using namespace Knights; 0014 0015 void LocalProtocol::init ( ) { 0016 KUser user; 0017 if ( user.isValid() ) { 0018 QVariant fullName = user.property(KUser::FullName); 0019 setPlayerName ( ( QVariant() == fullName ) ? user.loginName() : fullName.toString() ); 0020 } else 0021 setPlayerName ( colorName ( color() ) ); 0022 initComplete(); 0023 } 0024 0025 void LocalProtocol::startGame() { 0026 0027 } 0028 0029 void LocalProtocol::move ( const Move& m ) { 0030 Q_UNUSED(m) 0031 } 0032 0033 LocalProtocol::LocalProtocol ( QObject* parent ) : Protocol ( parent ) { 0034 } 0035 0036 LocalProtocol::~LocalProtocol() = default; 0037 0038 bool LocalProtocol::isLocal() { 0039 return true; 0040 } 0041 0042 Protocol::Features LocalProtocol::supportedFeatures() { 0043 return Pause | Undo | TimeLimit; 0044 } 0045 0046 void LocalProtocol::makeOffer(const Offer& offer) { 0047 offer.accept(); 0048 } 0049 0050 void LocalProtocol::acceptOffer(const Offer& offer) { 0051 Q_UNUSED(offer); 0052 } 0053 0054 void LocalProtocol::declineOffer(const Offer& offer) { 0055 Q_UNUSED(offer); 0056 } 0057 0058 #include "moc_localprotocol.cpp"