File indexing completed on 2024-04-14 04:01:53

0001 /* This file is part of KsirK.
0002    Copyright (C) 2008 Guillaume Pelouas <pelouas@hotmail.fr>
0003 
0004    KsirK is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, either version 2
0007    of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; if not, write to the Free Software
0016    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017    02110-1301, USA
0018 */
0019 
0020 /* begin                : Fri  21 2007 */
0021 
0022 #include "mainMenu.h"
0023 #include "GameLogic/gameautomaton.h"
0024 #include "GameLogic/onu.h"
0025 #include "kgamewin.h"
0026 
0027 
0028 #include <KLocalizedString>
0029 
0030 mainMenu::mainMenu(Ksirk::KGameWindow* game, QWidget* parent) : QWidget(parent)
0031 {
0032   qCDebug(KSIRK_LOG);
0033   setupUi(this);
0034 #if HAVE_JABBER_SUPPORT
0035     pbJabberGame = new QPushButton(this);
0036     pbJabberGame->setObjectName(QString::fromUtf8("pbJabberGame"));
0037     pbJabberGame->setText(i18n("Play KsirK over Jabber Network"));
0038 
0039     verticalLayout->insertWidget(verticalLayout->indexOf(pbNewSocketGame), pbJabberGame);
0040 #endif
0041 
0042   // Load image
0043   QString imageFileName;
0044   QPixmap imag1, imag2;
0045   
0046   imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "skins/default/Images/logoRight.png");
0047   imag1.load(imageFileName);
0048   imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "skins/default/Images/logoLeft.png");
0049   imag2.load(imageFileName);
0050   
0051   lImage1->setPixmap(imag1.scaled(100,100,Qt::KeepAspectRatioByExpanding));
0052   lImage2->setPixmap(imag2.scaled(100,100,Qt::KeepAspectRatioByExpanding));
0053 
0054   connect(pbNewGame, &QAbstractButton::clicked, game, &Ksirk::KGameWindow::slotNewGame);
0055 #if HAVE_JABBER_SUPPORT
0056   connect(pbJabberGame, &QAbstractButton::clicked, game, &Ksirk::KGameWindow::slotJabberGame);
0057 #endif
0058   connect(pbNewSocketGame, &QAbstractButton::clicked, game, &Ksirk::KGameWindow::slotNewSocketGame);
0059   connect(pbJoin, &QAbstractButton::clicked, game, &Ksirk::KGameWindow::slotJoinNetworkGame);
0060   connect(pbLoad, &QAbstractButton::clicked, game, &Ksirk::KGameWindow::slotOpenGame);
0061   connect(pbQuit, &QAbstractButton::clicked, game, &QWidget::close);
0062 }
0063 
0064 void mainMenu::init(Ksirk::GameLogic::ONU* /*theWorld*/)
0065 {
0066 }
0067 
0068 #include "moc_mainMenu.cpp"