153
159
connect(parser, SIGNAL(signal_addToObservationList(int)), SLOT(slot_addToObservationList(int)));
154
160
connect(parser, SIGNAL(signal_channelinfo(int, const QString&)), SLOT(slot_channelinfo(int, const QString&)));
155
161
connect(parser, SIGNAL(signal_matchrequest(const QString&, bool)), this, SLOT(slot_matchrequest(const QString&, bool)));
156
connect(parser, SIGNAL(signal_matchCanceled(const QString&)), this, SLOT(slot_matchCanceled(const QString&)));
162
connect(parser, SIGNAL(signal_matchCanceled(const QString&)), this, SLOT(slot_removeMatchDialog(const QString&)));
157
163
connect(parser, SIGNAL(signal_shout(const QString&, const QString&)), SLOT(slot_shout(const QString&, const QString&)));
164
connect(parser, SIGNAL(signal_room(const QString&, bool)),SLOT(slot_room(const QString&, bool)));
165
connect(parser, SIGNAL(signal_addSeekCondition(const QString&,const QString&, const QString&, const QString&, const QString&)),this,
166
SLOT(slot_addSeekCondition(const QString&, const QString&, const QString&, const QString&, const QString&)));
167
connect(parser, SIGNAL(signal_clearSeekCondition()),this,SLOT(slot_clearSeekCondition()));
168
connect(parser, SIGNAL(signal_cancelSeek()),this,SLOT(slot_cancelSeek()));
169
connect(parser, SIGNAL(signal_SeekList(const QString&, const QString&)),this,SLOT(slot_SeekList(const QString&, const QString&)));
170
connect(parser, SIGNAL(signal_refresh(int)),this, SLOT(slot_refresh(int)));
159
172
// connect mouse to games table/player table
160
173
connect(ListView_games, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)),
278
292
userButtonGroup->hide();
279
293
connect( userButtonGroup, SIGNAL(clicked(int)), SLOT(slotUserButtonClicked(int)) );
281
while ((s = setting->readEntry("USER" + QString::number(++i) + "_1")) != NULL)
283
b=new QToolButton(UserToolbar) ;
284
b->setText(setting->readEntry("USER" + QString::number(i) + "_1")); //label of the button : for display
285
b->setTextLabel(setting->readEntry("USER" + QString::number(i) + "_1")); //duplicated for storage
286
b->setCaption(setting->readEntry("USER" + QString::number(i) + "_2")); //dirty but handy
287
QToolTip::add(b,setting->readEntry("USER" + QString::number(i) + "_3"));
288
b->setIconText(setting->readEntry("USER" + QString::number(i) + "_4")); //dirty but handy
289
b->setMinimumWidth(25);
290
if (p.load(b->iconText()))
292
userButtonGroup->insert(b,-1);
295
while ((s = setting->readEntry("USER" + QString::number(++i) + "_1")) != NULL)
297
b=new QToolButton(UserToolbar) ;
298
b->setText(setting->readEntry("USER" + QString::number(i) + "_1")); //label of the button : for display
299
b->setTextLabel(setting->readEntry("USER" + QString::number(i) + "_1")); //duplicated for storage
300
b->setCaption(setting->readEntry("USER" + QString::number(i) + "_2")); //dirty but handy
301
QToolTip::add(b,setting->readEntry("USER" + QString::number(i) + "_3"));
302
b->setIconText(setting->readEntry("USER" + QString::number(i) + "_4")); //dirty but handy
303
b->setMinimumWidth(25);
304
if (p.load(b->iconText()))
306
userButtonGroup->insert(b,-1);
295
309
//restore players list filters
296
310
whoBox1->setCurrentItem(setting->readIntEntry("WHO_1"));
951
963
set_sessionparameter("client", true);
953
// set quiet false; refresh players, games
965
// set quiet true; refresh players, games
954
966
//if (myAccount->get_status() == GUEST)
955
set_sessionparameter("quiet", false);
967
set_sessionparameter("quiet", true);
957
// set id - only available if registerd; who knows why...
958
sendcommand("id qGo " + QString(VERSION), true);
969
// set id - only available if registerd; who knows why...
970
sendcommand("id qGo " + QString(VERSION), true);
971
sendcommand("toggle newrating");
972
// if (setting->readBoolEntry("USE_NMATCH"))
974
// we wanted to allow user to disable 'nmatch', but IGS disables 'seek' with nmatch
975
sendcommand("toggle nmatch");
977
//temporaary settings to prevent use of Koryo BY on IGS (as opposed to canadian)
978
sendcommand("nmatchrange BWN 0-9 19-19 60-60 60-3600 25-25 0 0 0-0",false);
980
sendcommand("toggle newundo");
981
sendcommand("toggle seek");
982
sendcommand("seek config_list ");
960
985
slot_refresh(11);
961
986
slot_refresh(10);
1568
1594
prepare_tables(WHO);
1570
1596
// send "WHO" command
1571
//set the params of "who command"
1572
if ((whoBox1->currentItem() >1) || (whoBox2->currentItem() >1))
1574
wparam.append(whoBox1->currentItem()==1 ? "9p" : whoBox1->currentText());
1575
if ((whoBox1->currentItem()) && (whoBox2->currentItem()))
1577
wparam.append(whoBox2->currentItem()==1 ? "9p" : whoBox2->currentText());
1579
else if ((whoBox1->currentItem()) || (whoBox2->currentItem()))
1580
wparam.append("1p-9p");
1583
if (whoOpenCheck->isChecked())
1584
wparam.append(" o");
1587
if (myAccount->get_gsname() == IGS && extUserInfo)
1588
sendcommand(wparam.prepend("user "));
1597
//set the params of "who command"
1598
if ((whoBox1->currentItem() >1) || (whoBox2->currentItem() >1))
1600
wparam.append(whoBox1->currentItem()==1 ? "9p" : whoBox1->currentText());
1601
if ((whoBox1->currentItem()) && (whoBox2->currentItem()))
1604
wparam.append(whoBox2->currentItem()==1 ? "9p" : whoBox2->currentText());
1606
else if ((whoBox1->currentItem()) || (whoBox2->currentItem()))
1607
wparam.append("1p-9p");
1609
wparam.append(((myAccount->get_gsname() == IGS) ? "9p-BC" : " "));
1612
if (whoOpenCheck->isChecked())
1613
wparam.append(((myAccount->get_gsname() == WING) ? "O" : "o"));//wparam.append(" o");
1615
if (myAccount->get_gsname() == IGS )//&& extUserInfo)
1616
sendcommand(wparam.prepend("userlist "));
1590
1618
sendcommand(wparam.prepend("who "));
1592
prepare_tables(WHO);
1620
prepare_tables(WHO);
1866
1912
QString rk = element(line, 1, " ");
1869
dlg->playerWhiteEdit->setText(myAccount->acc_name);
1915
/*dlg->playerWhiteEdit->setText(myAccount->acc_name);
1870
1916
dlg->playerWhiteEdit->setReadOnly(true);
1871
1917
dlg->playerBlackEdit->setText(opponent);
1872
1918
dlg->playerBlackEdit->setReadOnly(false);
1920
dlg->playerOpponentEdit->setText(opponent);
1921
dlg->playerOpponentEdit->setReadOnly(true);
1922
dlg->set_myName( myAccount->acc_name);
1874
1924
// set my and opponent's rank for suggestion
1875
1925
dlg->set_oppRk(rk);
1876
dlg->playerBlackRkEdit->setText(rk);
1926
dlg->playerOpponentRkEdit->setText(rk);
1877
1927
rk = myAccount->get_rank();
1878
1928
dlg->set_myRk(rk);
1879
dlg->playerWhiteRkEdit->setText(rk);
1929
//dlg->playerWhiteRkEdit->setText(rk);
1880
1930
dlg->set_gsName(myAccount->get_gsname());
1931
dlg->handicapSpin->setEnabled(false);
1882
1933
dlg->buttonDecline->setDisabled(true);
1884
1935
// my request: free/rated game is also requested
1885
1936
//dlg->cb_free->setChecked(true);
1887
1938
// teaching game:
1888
if (dlg->playerWhiteEdit->text() == dlg->playerBlackEdit->text())
1939
if (dlg->playerOpponentEdit->text() == myAccount->acc_name)
1889
1940
dlg->buttonOffer->setText(tr("Teaching"));
1942
//nmatch settings from opponent
1943
bool is_nmatch = (lv_popupPlayer->nmatch)&&setting->readBoolEntry("USE_NMATCH");
1944
dlg->set_is_nmatch(is_nmatch);
1946
if ( (is_nmatch) && (lv_popupPlayer->nmatch_settings ))
1948
dlg->timeSpin->setRange((int)(lv_popupPlayer->nmatch_timeMin/60), (int)(lv_popupPlayer->nmatch_timeMax/60));
1949
dlg->byoTimeSpin->setRange((int)(lv_popupPlayer->nmatch_BYMin/60), (int)(lv_popupPlayer->nmatch_BYMax/60));
1950
dlg->handicapSpin->setRange(lv_popupPlayer->nmatch_handicapMin,lv_popupPlayer->nmatch_handicapMax);
1954
dlg->timeSpin->setRange(0,60);
1955
dlg->byoTimeSpin->setRange(0,60);
1956
dlg->handicapSpin->setRange(0,9);
1958
//no handicap with usual game requests
1959
dlg->handicapSpin->setEnabled(lv_popupPlayer->nmatch);
1960
dlg->play_nigiri_button->setEnabled(lv_popupPlayer->nmatch);
1891
1962
//default settings
1892
1963
dlg->boardSizeSpin->setValue(setting->readIntEntry("DEFAULT_SIZE"));
1893
1964
dlg->timeSpin->setValue(setting->readIntEntry("DEFAULT_TIME"));
1894
1965
dlg->byoTimeSpin->setValue(setting->readIntEntry("DEFAULT_BY"));
1895
1966
dlg->komiSpin->setValue(setting->readIntEntry("DEFAULT_KOMI")*10+5);
1968
dlg->slot_pbsuggest();
1899
1972
// match xxxx B 19 1 10 - using this line means: I am black!
1900
1973
bool opp_plays_white = (element(line, 2, " ") == "B");//QString(tr("B")));
1901
QString size = element(line, 3, " ");
1902
QString time = element(line, 4, " ");
1903
QString byotime = element(line, 5, " ");
1974
bool opp_plays_nigiri = (element(line, 2, " ") == "N");
1976
QString handicap, size, time,byotime, byostones ;
1978
if (line.contains("nmatch"))
1980
//specific behavior here : IGS nmatch not totally supported
1981
// disputes are hardly supported
1982
dlg->set_is_nmatch(true);
1983
handicap = element(line,3 , " ");
1984
size = element(line, 4, " ");
1985
time = element(line, 5, " ");
1986
byotime = element(line, 6, " ");
1987
byostones = element(line, 7, " ");
1988
dlg->timeSpin->setRange(0,100);
1989
dlg->timeSpin->setValue(time.toInt()/60);
1990
dlg->byoTimeSpin->setRange(0,100);
1991
dlg->byoTimeSpin->setValue(byotime.toInt()/60);
1992
dlg->BY_label->setText(tr(" Byoyomi Time : (")+byostones+ tr(" stones)"));
1993
dlg->handicapSpin->setRange(0,9);
1994
dlg->handicapSpin->setValue(handicap.toInt());
1995
dlg->boardSizeSpin->setRange(1,19);
1996
dlg->boardSizeSpin->setValue(size.toInt());
2000
dlg->set_is_nmatch(false);
2001
size = element(line, 3, " ");
2002
time = element(line, 4, " ");
2003
byotime = element(line, 5, " ");
2004
dlg->timeSpin->setRange(0,1000);
2005
dlg->timeSpin->setValue(time.toInt());
2006
dlg->byoTimeSpin->setRange(0,100);
2007
dlg->byoTimeSpin->setValue(byotime.toInt());
2008
dlg->handicapSpin->setEnabled(false);
2009
dlg->play_nigiri_button->setEnabled(false);
2010
dlg->boardSizeSpin->setRange(1,19);
2011
dlg->boardSizeSpin->setValue(size.toInt());
1905
2015
QString rk = getPlayerRk(opponent);
1906
2016
dlg->set_oppRk(rk);
1907
2017
QString myrk = myAccount->get_rank();
1908
2018
dlg->set_myRk(myrk);
2020
dlg->playerOpponentEdit->setText(opponent);
2021
dlg->playerOpponentEdit->setReadOnly(true);
2022
dlg->playerOpponentRkEdit->setText(rk);
2023
dlg->set_myName( myAccount->acc_name);
1910
2025
if (opp_plays_white)
1912
dlg->playerBlackEdit->setText(myAccount->acc_name);
2027
/* dlg->playerBlackEdit->setText(myAccount->acc_name);
1913
2028
dlg->playerBlackEdit->setReadOnly(true);
1914
2029
dlg->playerBlackRkEdit->setText(myAccount->get_rank());
1915
2030
dlg->playerWhiteEdit->setText(opponent);
1916
2031
dlg->playerWhiteEdit->setReadOnly(false);
1917
2032
dlg->playerWhiteRkEdit->setText(rk);
2034
dlg->play_black_button->setChecked(true);
2038
else if (opp_plays_nigiri)
1921
dlg->playerWhiteEdit->setText(myAccount->acc_name);
2040
/* dlg->playerWhiteEdit->setText(myAccount->acc_name);
1922
2041
dlg->playerWhiteEdit->setReadOnly(true);
1923
2042
dlg->playerWhiteRkEdit->setText(myAccount->get_rank());
1924
2043
dlg->playerBlackEdit->setText(opponent);
1925
2044
dlg->playerBlackEdit->setReadOnly(false);
1926
2045
dlg->playerBlackRkEdit->setText(rk);
2047
dlg->play_nigiri_button->setChecked(true);
2050
dlg->play_white_button->setChecked(true);
1929
2052
dlg->buttonDecline->setEnabled(true);
1930
2053
dlg->buttonOffer->setText(tr("Accept"));
1931
2054
dlg->buttonCancel->setDisabled(true);
1932
dlg->boardSizeSpin->setValue(size.toInt());
1933
dlg->timeSpin->setValue(time.toInt());
1934
dlg->byoTimeSpin->setValue(byotime.toInt());
1937
2058
dlg->slot_changed();
2151
2279
void ClientWindow::slot_menu_players(QListViewItem *lv, const QPoint& pt, int)
2153
2281
// emulate right button
2154
slot_mouse_players(2, lv, pt, 0);
2283
slot_mouse_players(2, lv, pt, 0);
2156
2285
// mouse click on ListView_players
2157
void ClientWindow::slot_mouse_players(int button, QListViewItem *lv, const QPoint& pt, int /*column*/)
2286
void ClientWindow::slot_mouse_players(int button, QListViewItem *lv, const QPoint& /*pt */, int /*column*/)
2159
2288
static QPopupMenu *puw = 0;
2289
lv_popupPlayer = static_cast<PlayerTableItem*>(lv);
2161
2290
// create popup window
2164
2293
puw = new QPopupMenu(0, 0);
2165
2294
puw->insertItem(tr("match"), this, SLOT(slot_playerPopup(int)), 0, 1);
2295
puw->insertItem(tr("match within his prefs"), this, SLOT(slot_playerPopup(int)), 0, 11);
2166
2296
puw->insertItem(tr("talk"), this, SLOT(slot_playerPopup(int)), 0, 2);
2167
2297
puw->insertSeparator();
2168
2298
puw->insertItem(tr("stats"), this, SLOT(slot_playerPopup(int)), 0, 3);
2289
2423
talklist.insert(0, new Talk(name, 0, isplayer));
2290
2424
dlg = talklist.current();
2291
2425
connect(dlg, SIGNAL(signal_talkto(QString&, QString&)), this, SLOT(slot_talkto(QString&, QString&)));
2292
connect(dlg, SIGNAL(signal_matchrequest(const QString&,bool)), this, SLOT(slot_matchrequest(const QString&,bool)));
2426
connect(dlg, SIGNAL(signal_matchrequest(const QString&,bool)), this, SLOT(slot_matchrequest(const QString&,bool)));
2294
2428
// make new multiline field
2295
//mainTable->TabWidget_mini_2->addTab(dlg->get_tabWidget(), dlg->get_name());
2296
TabWidget_mini_2->addTab(dlg->get_tabWidget(), dlg->get_name());
2297
TabWidget_mini_2->showPage(dlg->get_tabWidget());
2429
TabWidget_mini_2->addTab(dlg->get_tabWidget(), dlg->get_name());
2431
if (name != tr("Shouts*"))
2432
TabWidget_mini_2->showPage(dlg->get_tabWidget());
2298
2434
dlg->pageActive = true;
2299
2435
connect(dlg->get_le(), SIGNAL(returnPressed()), dlg, SLOT(slot_returnPressed()));
2300
2436
connect(dlg, SIGNAL(signal_pbRelOneTab(QWidget*)), this, SLOT(slot_pbRelOneTab(QWidget*)));
2763
2904
QToolButton *tb;
2766
connect( cb_connect, SIGNAL( activated(const QString&) ), this, SLOT( slot_cbconnect(const QString&) ) );
2907
//connect( cb_connect, SIGNAL( activated(const QString&) ), this, SLOT( slot_cbconnect(const QString&) ) );
2768
// toolConnect->setText(tr("Connect with") + " " + cb_connect->currentText());
2769
connect( toolConnect, SIGNAL( toggled(bool) ), this, SLOT( slot_connect(bool) ) ); //end add eb 5
2909
// toolConnect->setText(tr("Connect with") + " " + cb_connect->currentText());
2910
//connect( toolConnect, SIGNAL( toggled(bool) ), this, SLOT( slot_connect(bool) ) ); //end add eb 5
2772
QIconSet OIC,OIC2 ;//= new QIconSet;
2913
QIconSet OIC,OIC2, OIC3 ;//= new QIconSet;
2775
2915
OIC.setPixmap ( NotOpenIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
2776
2916
OIC.setPixmap ( OpenIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::On );
2778
2918
setOpenMode->setIconSet(OIC);
2781
2920
OIC2.setPixmap (NotLookingIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
2782
2921
OIC2.setPixmap (LookingIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::On );
2783
2922
setLookingMode->setIconSet(OIC2);
2786
2924
OIC.setPixmap ( NotQuietIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
2787
2925
OIC.setPixmap ( QuietIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
2788
2926
setQuietMode->setIconSet(OIC);
2928
OIC3.setPixmap ( NotSeekingIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
2929
OIC3.setPixmap ( seekingIcon[0], QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
2931
toolSeek->setIconSet(OIC3);
2932
seekMenu = new QPopupMenu();
2933
toolSeek->setPopup(seekMenu);
2934
toolSeek->setPopupDelay(1);
2790
2936
tb = QWhatsThis::whatsThisButton(Toolbar);
2791
2937
//tb->setProperty( "geometry", QRect(0, 0, 20, 20));
3139
void ClientWindow::slot_room(const QString& room, bool b)
3141
//do we already have the same room number in list ?
3142
if (RoomList->findItem(room.left(3), Qt::BeginsWith ))
3144
//so far, we just create the room if it is open
3146
RoomList->insertItem (room, -1 );
3148
//RoomList->item(RoomList->count()-1)->setSelectable(!b);
3151
void ClientWindow::slot_enterRoom(const QString& room)
3154
sendcommand("join " + room);
3157
statusBar()->message(tr("rooms left"));
3159
statusBar()->message(tr("Room ")+ room);
3161
//refresh the players table
3165
void ClientWindow::slot_leaveRoom()
3167
slot_enterRoom("0");
3171
void ClientWindow::slot_RoomListClicked(QListBoxItem *qli)
3173
slot_enterRoom(qli->text().section(":",0,0));
3176
void ClientWindow::slot_addSeekCondition(const QString& a, const QString& b, const QString& c, const QString& d, const QString& )
3178
QString time_condition ;
3180
time_condition = QString::number(int(b.toInt() / 60)) + " min + " + QString::number(int(c.toInt() / 60)) + " min / " + d + " stones";
3182
seekMenu->insertItem(time_condition, this, SLOT(slot_seek(int)), 0, a.toInt());
3186
void ClientWindow::slot_clearSeekCondition()
3191
void ClientWindow::slot_seek(bool b)
3193
//qDebug("seek button pressed : status %i", (int)b);
3195
//if the button was just pressed on, we have already used the popup menu : nothing to do
3199
sendcommand("seek entry_cancel",false);
3202
void ClientWindow::slot_cancelSeek()
3205
toolSeek->setOn(false);
3206
toolSeek->setPopup(seekMenu);
3207
toolSeek->setPopupDelay(1);
3208
toolSeek->setIconSet(QIconSet::QIconSet(NotSeekingIcon));
3209
killTimer(seekButtonTimer);
3210
seekButtonTimer = 0;
3213
void ClientWindow::slot_seek(int i)
3216
toolSeek->setOn(true);
3217
toolSeek->setPopup(NULL);
3219
//seek entry 1 19 5 3 0
3220
QString send_seek = "seek entry " +
3221
QString::number(i) +
3224
//childish, but we want to have an animated icon there
3225
seekButtonTimer = startTimer(200);
3227
switch (cb_seek_handicap->currentItem())
3230
send_seek.append("1 1 0");
3234
send_seek.append("2 2 0");
3238
send_seek.append("5 5 0");
3242
send_seek.append("9 9 0");
3246
send_seek.append("0 9 0");
3250
send_seek.append("9 0 0");
3254
sendcommand(send_seek,false);
3258
void ClientWindow::slot_SeekList(const QString& player, const QString& condition)
3260
QString Rk = getPlayerRk(player);
3261
QString hop = Rk.right(1);
3262
if ((Rk.right(1) != "?") && (Rk.right(1) != "+"))
3265
slot_message(player.leftJustify(15,' ',true) + Rk.rightJustify(5) + " : " + condition);