2011-07-02 23:03:18 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
|
* PokerTH - The open source texas holdem engine *
|
|
|
|
|
* Copyright (C) 2006-2011 Felix Hammer, Florian Thauer, Lothar May *
|
|
|
|
|
* *
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU Affero General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
2011-07-03 19:45:08 +00:00
|
|
|
*****************************************************************************/
|
|
|
|
|
#include "changecompleteblindsdialogimpl.h"
|
2012-05-17 01:35:59 +02:00
|
|
|
#include "mymessagebox.h"
|
2007-09-27 00:35:30 +00:00
|
|
|
#include "configfile.h"
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changeCompleteBlindsDialogImpl::changeCompleteBlindsDialogImpl(QWidget *parent, ConfigFile *c)
|
2011-02-11 20:02:08 +00:00
|
|
|
: QDialog(parent), myConfig(c), settingsCorrect(TRUE)
|
2007-09-27 00:35:30 +00:00
|
|
|
{
|
2007-12-04 01:37:43 +00:00
|
|
|
#ifdef __APPLE__
|
2007-11-28 22:00:42 +00:00
|
|
|
setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
2011-02-11 20:02:08 +00:00
|
|
|
#endif
|
2007-11-28 22:00:42 +00:00
|
|
|
setupUi(this);
|
2007-09-27 00:35:30 +00:00
|
|
|
|
|
|
|
|
connect( pushButton_add, SIGNAL( clicked() ), this, SLOT( addBlindValueToList() ) );
|
|
|
|
|
connect( pushButton_delete, SIGNAL( clicked() ), this, SLOT( removeBlindFromList() ) );
|
2007-11-05 22:22:34 +00:00
|
|
|
connect( spinBox_firstSmallBlind, SIGNAL( valueChanged(int) ), this, SLOT( updateSpinBoxInputMinimum(int) ) );
|
2011-02-11 20:02:08 +00:00
|
|
|
|
2007-09-27 00:35:30 +00:00
|
|
|
}
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
void changeCompleteBlindsDialogImpl::exec()
|
|
|
|
|
{
|
2007-09-27 00:35:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
QDialog::exec();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
void changeCompleteBlindsDialogImpl::updateSpinBoxInputMinimum(int value)
|
|
|
|
|
{
|
|
|
|
|
spinBox_input->setMinimum(value+1);
|
|
|
|
|
}
|
2007-09-27 00:35:30 +00:00
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
void changeCompleteBlindsDialogImpl::addBlindValueToList()
|
|
|
|
|
{
|
2007-09-27 00:35:30 +00:00
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
if(listWidget_blinds->count() == 30) {
|
2012-05-17 01:35:59 +02:00
|
|
|
MyMessageBox::warning(this, tr("Manual Blinds Order"),
|
2011-02-11 20:02:08 +00:00
|
|
|
tr("You cannot set more than 30 manual blinds."),
|
|
|
|
|
QMessageBox::Close);
|
|
|
|
|
} else {
|
2007-09-30 00:45:21 +00:00
|
|
|
listWidget_blinds->addItem(QString::number(spinBox_input->value(),10));
|
|
|
|
|
sortBlindsList();
|
|
|
|
|
}
|
2007-09-27 00:35:30 +00:00
|
|
|
}
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
void changeCompleteBlindsDialogImpl::removeBlindFromList()
|
|
|
|
|
{
|
2007-09-27 00:35:30 +00:00
|
|
|
|
|
|
|
|
listWidget_blinds->takeItem(listWidget_blinds->currentRow());
|
|
|
|
|
sortBlindsList();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
void changeCompleteBlindsDialogImpl::sortBlindsList()
|
|
|
|
|
{
|
2007-09-27 00:35:30 +00:00
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
QList<int> tempIntList;
|
|
|
|
|
QStringList tempStringList;
|
|
|
|
|
bool ok = TRUE;
|
2011-02-11 20:02:08 +00:00
|
|
|
|
2007-09-27 00:35:30 +00:00
|
|
|
for(i=0; i<listWidget_blinds->count(); i++) {
|
|
|
|
|
// std::cout << listWidget_blinds->item(i)->text().toInt(&ok,10) << "\n";
|
2011-02-11 20:02:08 +00:00
|
|
|
tempIntList << listWidget_blinds->item(i)->text().toInt(&ok,10);
|
2007-09-27 00:35:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qStableSort(tempIntList.begin(), tempIntList.end());
|
2011-02-11 20:02:08 +00:00
|
|
|
//
|
2007-09-27 00:35:30 +00:00
|
|
|
for(i=0; i<tempIntList.count(); i++) {
|
2011-02-11 20:02:08 +00:00
|
|
|
//
|
2007-09-27 00:35:30 +00:00
|
|
|
// std::cout << tempIntList[i] << "\n";
|
|
|
|
|
tempStringList << QString::number(tempIntList[i],10);
|
|
|
|
|
}
|
2011-02-11 20:02:08 +00:00
|
|
|
//
|
2007-09-27 00:35:30 +00:00
|
|
|
listWidget_blinds->clear();
|
|
|
|
|
listWidget_blinds->addItems(tempStringList);
|
|
|
|
|
}
|