~ubuntu-branches/ubuntu/vivid/qgo/vivid-proposed

« back to all changes in this revision

Viewing changes to src/network/createroomdialog.cpp

  • Committer: Package Import Robot
  • Author(s): Yann Dirson
  • Date: 2012-05-19 19:05:05 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20120519190505-b23f5tzx7y8cu946
Tags: 2~svn764-1
* The "Raise dead" release (Closes: #673520), new maintainer.
* New upstream snapshot with Qt4 support (Closes: #604589), adjusted
  build-deps.
* Switched to source format "3.0 (quilt)", adjusted build-deps.
* Switched to dh and debhelper compat level 9, adjusted build-deps.
* Build with -fpermissive.
* New build-dep libasound2-dev, remove obsolete build-dep on libxinerama-dev.
* Refreshed patches 01_gnugo and 04_desktop, leaving 20_kfreebsd away
  for this release, and removing the remaining ones, now obsolete.
* Added patch 02_usrgames for FHS-correct install location.
* Adjusted icon names in menu file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 <QtGui>
 
24
#include "createroomdialog.h"
 
25
#include "networkconnection.h"
 
26
/* CreateRoomDialog requires qformlayout.h which is a Qt 4.4 file
 
27
 * not even in Qt 4.3, so I am temporarily removing it since its
 
28
 * not made use of anyway. FIXME */
 
29
 
 
30
CreateRoomDialog::CreateRoomDialog(NetworkConnection * conn) : connection(conn)
 
31
{
 
32
#ifdef THISISQT44ONLY
 
33
        ui.setupUi(this);
 
34
        ui.roomTypeTab->removeTab(5);                   //specialty versions
 
35
        ui.roomTypeTab->setTabEnabled(3, false);        //review
 
36
        ui.roomTypeTab->setTabEnabled(4, false);        //multi
 
37
        
 
38
        /*namelabel = new QLabel(tr("%1 %2").arg(name).arg(rank));
 
39
        dialoglabel = new QLabel(tr("wants to play a match..."));
 
40
        timelabel = new QLabel(tr("%1 seconds").arg(seconds));
 
41
        
 
42
        createButton = new QPushButton(tr("&Create"));
 
43
        createButton->setDefault(true);
 
44
        
 
45
        cancelButton = new QPushButton(tr("&Cancel"));
 
46
        
 
47
        buttonBox = new QDialogButtonBox(Qt::Horizontal);
 
48
        buttonBox->addButton(createButton, QDialogButtonBox::ActionRole);
 
49
        buttonBox->addButton(cancelButton, QDialogButtonBox::ActionRole);
 
50
        
 
51
        connect(createButton, SIGNAL(clicked()), this, SLOT(slot_create()));
 
52
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(slot_cancel()));
 
53
        
 
54
        QGridLayout * mainLayout = new QGridLayout;
 
55
        mainLayout->setSizeConstraint(QLayout::SetFixedSize);
 
56
        mainLayout->addWidget(namelabel, 0, 0);
 
57
        mainLayout->addWidget(dialoglabel, 1, 0);
 
58
        mainLayout->addWidget(timelabel, 2, 0);
 
59
        mainLayout->addWidget(buttonBox, 3, 0);
 
60
        setLayout(mainLayout);
 
61
        
 
62
        setWindowTitle(tr("Create Room"));*/
 
63
        
 
64
        connect(ui.createButton, SIGNAL(clicked()), this, SLOT(slot_create()));
 
65
        connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(slot_cancel()));
 
66
        
 
67
        connect(ui.privateCB, SIGNAL(clicked(bool)), this, SLOT(slot_privateCB(bool)));
 
68
        
 
69
        connect(ui.roomTypeTab, SIGNAL(currentChanged(int)), SLOT(slot_roomTypeTab(int)));
 
70
        
 
71
        connect(ui.opponentStrongerRB, SIGNAL(clicked()), this, SLOT(slot_opponentStrongerRB()));
 
72
        connect(ui.opponentEvenRB, SIGNAL(clicked()), this, SLOT(slot_opponentEvenRB()));
 
73
        connect(ui.opponentWeakerRB, SIGNAL(clicked()), this, SLOT(slot_opponentWeakerRB()));
 
74
        connect(ui.opponentAnyRB, SIGNAL(clicked()), this, SLOT(slot_opponentAnyRB()));
 
75
        
 
76
        connect(ui.timeQuickRB, SIGNAL(clicked()), this, SLOT(slot_timeQuickRB()));
 
77
        connect(ui.timeNormalRB, SIGNAL(clicked()), this, SLOT(slot_timeNormalRB()));
 
78
        connect(ui.timePonderousRB, SIGNAL(clicked()), this, SLOT(slot_timePonderousRB()));
 
79
        connect(ui.timeAnyRB, SIGNAL(clicked()), this, SLOT(slot_timeAnyRB()));
 
80
        
 
81
        connect(ui.oneOnOneRB, SIGNAL(clicked()), this, SLOT(slot_oneOnOneRB()));
 
82
        connect(ui.pairRB, SIGNAL(clicked()), this, SLOT(slot_pairRB()));
 
83
        ui.pairRB->setEnabled(false);
 
84
        
 
85
        
 
86
        connect(ui.teachingRB, SIGNAL(clicked()), this, SLOT(slot_teachingRB()));
 
87
        connect(ui.liveRB, SIGNAL(clicked()), this, SLOT(slot_liveRB()));
 
88
#endif //THISISQT44ONLY
 
89
}
 
90
 
 
91
void CreateRoomDialog::slot_privateCB(bool checked)
 
92
{
 
93
        checked = false; //for the warning
 
94
#ifdef THISISQT44ONLY
 
95
        ui.passwordLabel->setEnabled(checked);
 
96
        ui.passwordEdit->setEnabled(checked);
 
97
        if(!checked)
 
98
                ui.passwordEdit->clear();
 
99
#endif //THISISQT44ONLY
 
100
}
 
101
                
 
102
void CreateRoomDialog::slot_roomTypeTab(void)
 
103
{
 
104
}
 
105
void CreateRoomDialog::slot_opponentStrongerRB(void)
 
106
{
 
107
}
 
108
void CreateRoomDialog::slot_opponentEvenRB(void)
 
109
{
 
110
}
 
111
void CreateRoomDialog::slot_opponentWeakerRB(void)
 
112
{
 
113
}
 
114
void CreateRoomDialog::slot_opponentAnyRB(void)
 
115
{
 
116
}
 
117
 
 
118
void CreateRoomDialog::slot_timeQuickRB(void)
 
119
{
 
120
}
 
121
void CreateRoomDialog::slot_timeNormalRB(void)
 
122
{
 
123
}
 
124
void CreateRoomDialog::slot_timePonderousRB(void)
 
125
{
 
126
}
 
127
void CreateRoomDialog::slot_timeAnyRB(void)
 
128
{
 
129
}
 
130
void CreateRoomDialog::slot_oneOnOneRB(void)
 
131
{
 
132
}
 
133
void CreateRoomDialog::slot_pairRB(void)
 
134
{
 
135
}
 
136
void CreateRoomDialog::slot_teachingRB(void)
 
137
{
 
138
}
 
139
void CreateRoomDialog::slot_liveRB(void)
 
140
{
 
141
}
 
142
 
 
143
CreateRoomDialog::~CreateRoomDialog()
 
144
{
 
145
        
 
146
}
 
147
 
 
148
void CreateRoomDialog::slot_create(void)
 
149
{
 
150
        done(0);                //FIXME
 
151
#ifdef THISISQT44ONLY
 
152
        RoomCreate * room = new RoomCreate();
 
153
        /* FIXME This could be problematic if the index
 
154
         * can change when we remove tabs, but that's
 
155
         * a ways away right now.*/
 
156
        room->type = (RoomCreate::roomType)ui.roomTypeTab->currentIndex();
 
157
        switch(ui.roomTypeTab->currentIndex())
 
158
        {
 
159
                case RoomCreate::GAME:
 
160
                        break;
 
161
                case RoomCreate::GOMOKU:
 
162
                        break;
 
163
                case RoomCreate::CHAT:
 
164
                        break;
 
165
                case RoomCreate::REVIEW:
 
166
                        done(0);
 
167
                        break;
 
168
                case RoomCreate::MULTI:
 
169
                        done(0);
 
170
                        break;
 
171
                case RoomCreate::VARIATION:
 
172
                        done(0);
 
173
                        break;
 
174
        }
 
175
        connection->sendCreateRoom(room);
 
176
        done(1);
 
177
#endif //THISISQT44ONLY
 
178
}
 
179
 
 
180
void CreateRoomDialog::slot_cancel(void)
 
181
{
 
182
        done(0);
 
183
}