File indexing completed on 2024-04-14 04:02:25

0001 /*
0002     This file is part of the KDE games lskat program
0003     SPDX-FileCopyrightText: 2006 Martin Heni <kde@heni-online.de>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "namedialogwidget.h"
0009 
0010 // Qt includes
0011 #include <QWidget>
0012 
0013 // KF includes
0014 
0015 // Constructor for the widget
0016 NameDialogWidget::NameDialogWidget(QWidget *parent)
0017                   : QDialog(parent)
0018 {
0019     ui.setupUi(this);
0020 }
0021 
0022 // Set a default names to the widget
0023 void NameDialogWidget::setName(int pos, const QString &name)
0024 {
0025     if (pos == 0)
0026     {
0027         ui.editPlayer1->setText(name);
0028     }
0029     else
0030     {
0031         ui.editPlayer2->setText(name);
0032     }
0033 }
0034 
0035 // Retrieve the name from the widget.
0036 QString NameDialogWidget::name(int pos)
0037 {
0038     if (pos == 0)
0039     {
0040         return ui.editPlayer1->text();
0041     }
0042     else
0043     {
0044         return ui.editPlayer2->text();
0045     }
0046 }
0047 
0048 #include "moc_namedialogwidget.cpp"