auto activate new styles after adding; new toolbox background for better

readable speed string
This commit is contained in:
doitux
2009-05-21 22:40:16 +00:00
parent c51e746579
commit 97246d347e
4 changed files with 29 additions and 25 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 724 B

+1 -1
View File
@@ -659,7 +659,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) {
//blind buttons refresh //blind buttons refresh
if(myStartWindow->getSession()->getCurrentGame()) { if(myStartWindow->getSession()->getCurrentGame()) {
refreshButton(); refreshButton();
refreshGroupbox(); refreshGroupbox();
provideMyActions(); provideMyActions();
} }
@@ -944,18 +944,18 @@ void settingsDialogImpl::setSelectedGameTableStyleActivated()
void settingsDialogImpl::addGameTableStyle() void settingsDialogImpl::addGameTableStyle()
{ {
QDir dir(QString::fromUtf8(myConfig->readConfigString("LastGameTableStyleDir").c_str())); QDir dir(QString::fromUtf8(myConfig->readConfigString("LastGameTableStyleDir").c_str()));
QString dirString; QString dirString;
if(dir.exists()) dirString = dir.absolutePath(); if(dir.exists()) dirString = dir.absolutePath();
else dirString = QDir::home().absolutePath(); else dirString = QDir::home().absolutePath();
QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your game table style"), QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your game table style"),
dirString, dirString,
tr("PokerTH game table styles (*.xml)")); tr("PokerTH game table styles (*.xml)"));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
int i; int i;
bool fileNameAlreadyFound(FALSE); bool fileNameAlreadyFound(FALSE);
for(i=0; i < listWidget_gameTableStyles->count(); i++) { for(i=0; i < listWidget_gameTableStyles->count(); i++) {
@@ -963,29 +963,31 @@ void settingsDialogImpl::addGameTableStyle()
if(item->data(15).toString() == fileName) if(item->data(15).toString() == fileName)
fileNameAlreadyFound = TRUE; fileNameAlreadyFound = TRUE;
} }
if(fileNameAlreadyFound) { if(fileNameAlreadyFound) {
QMessageBox::warning(this, tr("Game Table Style Error"), QMessageBox::warning(this, tr("Game Table Style Error"),
tr("Selected game table style file is already in the list. \nPlease select another one to add!"), tr("Selected game table style file is already in the list. \nPlease select another one to add!"),
QMessageBox::Ok); QMessageBox::Ok);
} }
else { else {
GameTableStyleReader newStyle(myConfig, this); GameTableStyleReader newStyle(myConfig, this);
newStyle.readStyleFile(fileName); newStyle.readStyleFile(fileName);
if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) { if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) {
QListWidgetItem *newItem = new QListWidgetItem(newStyle.getStyleDescription()); QListWidgetItem *newItem = new QListWidgetItem(newStyle.getStyleDescription());
newItem->setData(15,fileName); newItem->setData(15,fileName);
newItem->setData(Qt::ToolTipRole,fileName); newItem->setData(Qt::ToolTipRole,fileName);
listWidget_gameTableStyles->addItem(newItem); listWidget_gameTableStyles->addItem(newItem);
listWidget_gameTableStyles->setCurrentItem(newItem);
pushButton_activateGameTableStyle->click();
} }
else { else {
QMessageBox::warning(this, tr("Game Table Style File Error"), QMessageBox::warning(this, tr("Game Table Style File Error"),
tr("Could not load game table style file correctly. \nStyle will not be placed into list!"), tr("Could not load game table style file correctly. \nStyle will not be placed into list!"),
QMessageBox::Ok); QMessageBox::Ok);
} }
} }
//save current filepath //save current filepath
myConfig->writeConfigString("LastGameTableStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData()); myConfig->writeConfigString("LastGameTableStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData());
} }
} }
@@ -1047,17 +1049,17 @@ void settingsDialogImpl::setSelectedCardDeckStyleActivated()
void settingsDialogImpl::addCardDeckStyle() void settingsDialogImpl::addCardDeckStyle()
{ {
QDir dir(QString::fromUtf8(myConfig->readConfigString("LastCardDeckStyleDir").c_str())); QDir dir(QString::fromUtf8(myConfig->readConfigString("LastCardDeckStyleDir").c_str()));
QString dirString; QString dirString;
if(dir.exists()) dirString = dir.absolutePath(); if(dir.exists()) dirString = dir.absolutePath();
else dirString = QDir::home().absolutePath(); else dirString = QDir::home().absolutePath();
QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your card deck style"), QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your card deck style"),
dirString, dirString,
tr("PokerTH card deck styles (*.xml)")); tr("PokerTH card deck styles (*.xml)"));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
int i; int i;
bool fileNameAlreadyFound(FALSE); bool fileNameAlreadyFound(FALSE);
@@ -1073,13 +1075,15 @@ void settingsDialogImpl::addCardDeckStyle()
QMessageBox::Ok); QMessageBox::Ok);
} }
else { else {
CardDeckStyleReader newStyle(myConfig, this); CardDeckStyleReader newStyle(myConfig, this);
newStyle.readStyleFile(fileName); newStyle.readStyleFile(fileName);
if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) { if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) {
QListWidgetItem *newItem = new QListWidgetItem(newStyle.getStyleDescription()); QListWidgetItem *newItem = new QListWidgetItem(newStyle.getStyleDescription());
newItem->setData(15,fileName); newItem->setData(15,fileName);
newItem->setData(Qt::ToolTipRole,fileName); newItem->setData(Qt::ToolTipRole,fileName);
listWidget_cardDeckStyles->addItem(newItem); listWidget_cardDeckStyles->addItem(newItem);
listWidget_cardDeckStyles->setCurrentItem(newItem);
pushButton_activateCardDeckStyle->click();
} }
else { else {
QMessageBox::warning(this, tr("Card Deck Style File Error"), QMessageBox::warning(this, tr("Card Deck Style File Error"),