more error handling for styles
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
<CardDeck>
|
||||
<StyleDescription value="PokerTH default card deck" /> <!-- This string will be shown in settings/game table style list -->
|
||||
<StyleMaintainerName value="PokerTH Development Team" /> <!-- This string should contain the name of the style maintainer and will be shown in style information -->
|
||||
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <!-- This string will be shown in error message if there is a problem with the style -->
|
||||
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <!-- This string should contain the email address of the style maintainer and will be shown in style information and also in error message if there is a problem with the style. If you dont like to post your mail address here please write value="NULL". -->
|
||||
<StyleCreateDate value="04.04.2009" /> <!-- This string should contain the create date or last date of modification and will be shown in style information-->
|
||||
<PokerTHStyleFileVersion value="1" /> <!-- This number matches the current PokerTH internal version that is supported, you should not change it unless PokerTH tells you to update the style -->
|
||||
<Preview value="preview.png" /> <!-- This preview picture will be shown in settings/card deck style if this style is selected. The value should contain a filename of the preview picture which have to be stored in the same folder as this xml file. -->
|
||||
</CardDeck>
|
||||
</PokerTH>
|
||||
</PokerTH>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<CardDeck>
|
||||
<StyleDescription value="PokerTH default card deck (4 color)" /> <!-- This string will be shown in settings/game table style list -->
|
||||
<StyleMaintainerName value="PokerTH Development Team" /> <!-- This string should contain the name of the style maintainer and will be shown in style information -->
|
||||
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <!-- This string will be shown in error message if there is a problem with the style -->
|
||||
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <!-- This string should contain the email address of the style maintainer and will be shown in style information and also in error message if there is a problem with the style. If you dont like to post your mail address here please write value="NULL". -->
|
||||
<StyleCreateDate value="04.04.2009" /> <!-- This string should contain the create date or last date of modification and will be shown in style information-->
|
||||
<PokerTHStyleFileVersion value="1" /> <!-- This number matches the current PokerTH internal version that is supported, you should not change it unless PokerTH tells you to update the style -->
|
||||
<Preview value="preview.png" /> <!-- This preview picture will be shown in settings/card deck style if this style is selected. The value should contain a filename of the preview picture which have to be stored in the same folder as this xml file. -->
|
||||
</CardDeck>
|
||||
</PokerTH>
|
||||
</PokerTH>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<PokerTH>
|
||||
<TableStyle>
|
||||
<StyleDescription value="danuxi table design" /> <!-- This string will be shown in settings/game table style list -->
|
||||
<StyleDescription value="danuxi table design" />
|
||||
<StyleMaintainerName value="Daniel Hammer" />
|
||||
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <!-- This string will be shown in error message if there is a problem with the style -->
|
||||
<StyleMaintainerEMail value="webmaster@pokerth.net" />
|
||||
<StyleCreateDate value="06.04.2009" />
|
||||
<PokerTHStyleFileVersion value="1" />
|
||||
<Preview value="preview.png" />
|
||||
<IfFixedWindowSize value="1" /> <!-- value [1,0] 1 = fixed window size, 0 = resizeable window -->
|
||||
<IfFixedWindowSize value="1" />
|
||||
<FixedWindowWidth value="1024" />
|
||||
<FixedWindowHeight value="600" />
|
||||
<MinimumWindowWidth value="1024" />
|
||||
@@ -49,17 +49,13 @@
|
||||
<Table value="table.png" />
|
||||
<ToolBoxBackground value="toolboxbg.png" />
|
||||
<HandRanking value="handranking.png" />
|
||||
|
||||
<!-- Action*I18NPic: If you wanna set action pics with specific language strings you can set them here. If you wanna use the default english strings just write "NULL" instead of picture files names. PokerTH will automatically display the english ones. -->
|
||||
<ActionAllInI18NPic value="NULL" /> <!-- optimal size width:height in px [100:40] -->
|
||||
<ActionRaiseI18NPic value="NULL" /> <!-- optimal size width:height in px [100:40] -->
|
||||
<ActionBetI18NPic value="NULL" /> <!-- optimal size width:height in px [100:40] -->
|
||||
<ActionCallI18NPic value="NULL" /> <!-- optimal size width:height in px [100:40] -->
|
||||
<ActionCheckI18NPic value="NULL" /> <!-- optimal size width:height in px [100:40] -->
|
||||
<ActionFoldI18NPic value="NULL" /> <!-- optimal size width:height in px [100:40] -->
|
||||
<ActionWinnerI18NPic value="NULL" /> <!-- optimal size width:height in px [100:40] -->
|
||||
|
||||
<!-- I18NString: If you wanna set specific language strings for poker actions like call, check, raise etc. which will be shown on human players buttons for this style, and some other game strings you can define them here, If you wanna use the default english strings just write value="NULL". PokerTH will automatically display the english ones. -->
|
||||
<ActionAllInI18NPic value="NULL" />
|
||||
<ActionRaiseI18NPic value="NULL" />
|
||||
<ActionBetI18NPic value="NULL" />
|
||||
<ActionCallI18NPic value="NULL" />
|
||||
<ActionCheckI18NPic value="NULL" />
|
||||
<ActionFoldI18NPic value="NULL" />
|
||||
<ActionWinnerI18NPic value="NULL" />
|
||||
<ActionAllInI18NString value="NULL" />
|
||||
<ActionRaiseI18NString value="NULL" />
|
||||
<ActionBetI18NString value="NULL" />
|
||||
@@ -75,7 +71,6 @@
|
||||
<FlopI18NString value="NULL" />
|
||||
<TurnI18NString value="NULL" />
|
||||
<RiverI18NString value="NULL" />
|
||||
|
||||
<FKeyIndicatorColor value="FFFFFF" />
|
||||
<ChanceLabelPossibleColor value="A1B4FF" />
|
||||
<ChanceLabelImpossibleColor value="252C50" />
|
||||
@@ -129,4 +124,4 @@
|
||||
<BetSpeedSliderHandleBorderColor value="00177D" />
|
||||
<ChatLogTextSize value="11" />
|
||||
</TableStyle>
|
||||
</PokerTH>
|
||||
</PokerTH>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<TableStyle>
|
||||
<StyleDescription value="PokerTH default table style" /><!-- This string will be shown in settings/game table style list -->
|
||||
<StyleMaintainerName value="PokerTH Development Team" /> <!-- This string should contain the name of the style maintainer and will be shown in style information -->
|
||||
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <!-- This string should contain the email address of the style maintainer and will be shown in style information and also in error message if there is a problem with the style -->
|
||||
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <!-- This string should contain the email address of the style maintainer and will be shown in style information and also in error message if there is a problem with the style. If you dont like to post your mail address here please write value="NULL". -->
|
||||
<StyleCreateDate value="04.04.2009" /> <!-- This string should contain the create date or last date of modification and will be shown in style information-->
|
||||
<PokerTHStyleFileVersion value="1" /> <!-- This number matches the current PokerTH internal version that is supported, you should not change it unless PokerTH tells you to update the style -->
|
||||
<Preview value="preview.png" /> <!-- This preview picture will be shown in settings/game table style if this style is selected. The value should contain a filename of the preview picture which have to be stored in the same folder as this xml file. -->
|
||||
@@ -136,4 +136,4 @@
|
||||
<!-- Table Font Sizes - values should be set in px -->
|
||||
<ChatLogTextSize value="11" />
|
||||
</TableStyle>
|
||||
</PokerTH>
|
||||
</PokerTH>
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@
|
||||
#define POKERTH_BETA_REVISION 0
|
||||
#define POKERTH_BETA_RELEASE_STRING "0.7-beta1"
|
||||
|
||||
#define PokerTH_STYLE_FILE_VERSION 1
|
||||
#define POKERTH_GT_STYLE_FILE_VERSION 1
|
||||
#define POKERTH_CD_STYLE_FILE_VERSION 1
|
||||
|
||||
enum ServerNetworkMode {
|
||||
NETWORK_MODE_TCP = 1,
|
||||
|
||||
@@ -242,25 +242,29 @@ void settingsDialogImpl::exec() {
|
||||
// define PokerTH default GameTableStyle
|
||||
listWidget_gameTableStyles->clear();
|
||||
|
||||
GameTableStyleReader defaultTableStyle(myConfig);
|
||||
GameTableStyleReader defaultTableStyle(myConfig, this);
|
||||
defaultTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml");
|
||||
QListWidgetItem *defaultTableItem = new QListWidgetItem(defaultTableStyle.getStyleDescription(),listWidget_gameTableStyles);
|
||||
defaultTableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml");
|
||||
defaultTableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml");
|
||||
if(defaultTableStyle.getLoadedSuccessfull()) {
|
||||
QListWidgetItem *defaultTableItem = new QListWidgetItem(defaultTableStyle.getStyleDescription(),listWidget_gameTableStyles);
|
||||
defaultTableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml");
|
||||
defaultTableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml");
|
||||
}
|
||||
//add danuxi table
|
||||
GameTableStyleReader danuxi1TableStyle(myConfig);
|
||||
GameTableStyleReader danuxi1TableStyle(myConfig, this);
|
||||
danuxi1TableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml");
|
||||
QListWidgetItem *danuxi1TableItem = new QListWidgetItem(danuxi1TableStyle.getStyleDescription(),listWidget_gameTableStyles);
|
||||
danuxi1TableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml");
|
||||
danuxi1TableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml");
|
||||
if(danuxi1TableStyle.getLoadedSuccessfull()) {
|
||||
QListWidgetItem *danuxi1TableItem = new QListWidgetItem(danuxi1TableStyle.getStyleDescription(),listWidget_gameTableStyles);
|
||||
danuxi1TableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml");
|
||||
danuxi1TableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml");
|
||||
}
|
||||
|
||||
//load secondary styles into list (if fallback no entry)
|
||||
//load secondary styles into list (if fallback no entry)
|
||||
myGameTableStylesList = myConfig->readConfigStringList("GameTableStylesList");
|
||||
list<std::string>::iterator it1;
|
||||
for(it1= myGameTableStylesList.begin(); it1 != myGameTableStylesList.end(); it1++) {
|
||||
GameTableStyleReader nextStyle(myConfig);
|
||||
GameTableStyleReader nextStyle(myConfig, this);
|
||||
nextStyle.readStyleFile(QString::fromUtf8(it1->c_str()));
|
||||
if(!nextStyle.getFallBack()) {
|
||||
if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) {
|
||||
QListWidgetItem *nextItem = new QListWidgetItem(nextStyle.getStyleDescription());
|
||||
nextItem->setData(15,QString::fromUtf8(it1->c_str()));
|
||||
nextItem->setData(Qt::ToolTipRole,QString::fromUtf8(it1->c_str()));
|
||||
@@ -268,26 +272,38 @@ void settingsDialogImpl::exec() {
|
||||
}
|
||||
}
|
||||
|
||||
//set current Game Table Style from config file
|
||||
GameTableStyleReader currentGameTableStyle(myConfig);
|
||||
//set current Game Table Style from config file or fallback to first entry
|
||||
GameTableStyleReader currentGameTableStyle(myConfig, this);
|
||||
currentGameTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentGameTableStyle").c_str()));
|
||||
int i;
|
||||
bool currentGameTableFound(FALSE);
|
||||
for(i=0; i < listWidget_gameTableStyles->count(); i++) {
|
||||
QListWidgetItem *item = listWidget_gameTableStyles->item(i);
|
||||
if(item->data(15) == currentGameTableStyle.getCurrentFileName()) {
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_gameTableStyles->setCurrentItem(item);
|
||||
currentGameTableFound=TRUE;
|
||||
}
|
||||
else item->setIcon(QIcon());
|
||||
}
|
||||
if(!currentGameTableFound) {
|
||||
qDebug() << "Config ERROR: current game table style file not found in List. Mark default as selected.";
|
||||
QListWidgetItem *item = listWidget_gameTableStyles->item(0);
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_gameTableStyles->setCurrentItem(item);
|
||||
}
|
||||
if(currentGameTableStyle.getLoadedSuccessfull()) {
|
||||
int i;
|
||||
bool currentGameTableFound(FALSE);
|
||||
for(i=0; i < listWidget_gameTableStyles->count(); i++) {
|
||||
QListWidgetItem *item = listWidget_gameTableStyles->item(i);
|
||||
if(item->data(15) == currentGameTableStyle.getCurrentFileName()) {
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_gameTableStyles->setCurrentItem(item);
|
||||
currentGameTableFound=TRUE;
|
||||
}
|
||||
else item->setIcon(QIcon());
|
||||
}
|
||||
if(!currentGameTableFound) {
|
||||
qDebug() << "Config ERROR: current game table style file not found in List. Try to mark default as selected.";
|
||||
QListWidgetItem *item = listWidget_gameTableStyles->item(0);
|
||||
if(item) {
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_gameTableStyles->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Config ERROR: current game table style file could not be loaded. Try to mark default as selected.";
|
||||
QListWidgetItem *item = listWidget_gameTableStyles->item(0);
|
||||
if(item) {
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_gameTableStyles->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
//refresh Game Table Style Preview
|
||||
showCurrentGameTableStylePreview();
|
||||
@@ -295,25 +311,29 @@ void settingsDialogImpl::exec() {
|
||||
//CARDS
|
||||
//define PokerTH default CardDeck
|
||||
listWidget_cardDeckStyles->clear();
|
||||
CardDeckStyleReader defaultCardStyle(myConfig);
|
||||
CardDeckStyleReader defaultCardStyle(myConfig, this);
|
||||
defaultCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
|
||||
QListWidgetItem *defaultCardItem = new QListWidgetItem(defaultCardStyle.getStyleDescription(),listWidget_cardDeckStyles);
|
||||
defaultCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
|
||||
defaultCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
|
||||
if(defaultCardStyle.getLoadedSuccessfull()) {
|
||||
QListWidgetItem *defaultCardItem = new QListWidgetItem(defaultCardStyle.getStyleDescription(),listWidget_cardDeckStyles);
|
||||
defaultCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
|
||||
defaultCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
|
||||
}
|
||||
//define PokerTH default CardDeck4c
|
||||
CardDeckStyleReader default4cCardStyle(myConfig);
|
||||
CardDeckStyleReader default4cCardStyle(myConfig, this);
|
||||
default4cCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
|
||||
QListWidgetItem *default4cCardItem = new QListWidgetItem(default4cCardStyle.getStyleDescription(),listWidget_cardDeckStyles);
|
||||
default4cCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
|
||||
default4cCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
|
||||
if(default4cCardStyle.getLoadedSuccessfull()) {
|
||||
QListWidgetItem *default4cCardItem = new QListWidgetItem(default4cCardStyle.getStyleDescription(),listWidget_cardDeckStyles);
|
||||
default4cCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
|
||||
default4cCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
|
||||
}
|
||||
|
||||
//load secondary card styles into list (if fallback no entry)
|
||||
myCardDeckStylesList = myConfig->readConfigStringList("CardDeckStylesList");
|
||||
list<std::string>::iterator it2;
|
||||
for(it2= myCardDeckStylesList.begin(); it2 != myCardDeckStylesList.end(); it2++) {
|
||||
CardDeckStyleReader nextStyle(myConfig);
|
||||
CardDeckStyleReader nextStyle(myConfig, this);
|
||||
nextStyle.readStyleFile(QString::fromUtf8(it2->c_str()));
|
||||
if(!nextStyle.getFallBack()) {
|
||||
if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) {
|
||||
QListWidgetItem *nextItem = new QListWidgetItem(nextStyle.getStyleDescription());
|
||||
nextItem->setData(15,QString::fromUtf8(it2->c_str()));
|
||||
nextItem->setData(Qt::ToolTipRole,QString::fromUtf8(it2->c_str()));
|
||||
@@ -322,25 +342,37 @@ void settingsDialogImpl::exec() {
|
||||
}
|
||||
|
||||
//set current card deck style from config file
|
||||
CardDeckStyleReader currentCardDeckStyle(myConfig);
|
||||
CardDeckStyleReader currentCardDeckStyle(myConfig, this);
|
||||
currentCardDeckStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentCardDeckStyle").c_str()));
|
||||
int j;
|
||||
bool currentCardDeckFound(FALSE);
|
||||
for(j=0; j < listWidget_cardDeckStyles->count(); j++) {
|
||||
QListWidgetItem *item = listWidget_cardDeckStyles->item(j);
|
||||
if(item->data(15) == currentCardDeckStyle.getCurrentFileName()) {
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_cardDeckStyles->setCurrentItem(item);
|
||||
currentCardDeckFound=TRUE;
|
||||
}
|
||||
else item->setIcon(QIcon());
|
||||
}
|
||||
if(!currentCardDeckFound) {
|
||||
qDebug() << "Config ERROR: current card deck style file not found in List. Mark default as selected.";
|
||||
QListWidgetItem *item = listWidget_cardDeckStyles->item(0);
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_cardDeckStyles->setCurrentItem(item);
|
||||
}
|
||||
if(currentCardDeckStyle.getLoadedSuccessfull()) {
|
||||
int j;
|
||||
bool currentCardDeckFound(FALSE);
|
||||
for(j=0; j < listWidget_cardDeckStyles->count(); j++) {
|
||||
QListWidgetItem *item = listWidget_cardDeckStyles->item(j);
|
||||
if(item->data(15) == currentCardDeckStyle.getCurrentFileName()) {
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_cardDeckStyles->setCurrentItem(item);
|
||||
currentCardDeckFound=TRUE;
|
||||
}
|
||||
else item->setIcon(QIcon());
|
||||
}
|
||||
if(!currentCardDeckFound) {
|
||||
qDebug() << "Config ERROR: current card deck style file not found in List. Try to mark default as selected.";
|
||||
QListWidgetItem *item = listWidget_cardDeckStyles->item(0);
|
||||
if(item) {
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_cardDeckStyles->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Config ERROR: current card deck style file could not be loaded. Try to mark default as selected.";
|
||||
QListWidgetItem *item = listWidget_cardDeckStyles->item(0);
|
||||
if(item) {
|
||||
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
|
||||
listWidget_cardDeckStyles->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
// refresh Card Deck Style Preview
|
||||
showCurrentCardDeckStylePreview();
|
||||
@@ -612,7 +644,7 @@ void settingsDialogImpl::isAccepted() {
|
||||
}
|
||||
|
||||
void settingsDialogImpl::setFlipsidePicFileName()
|
||||
{
|
||||
{
|
||||
QDir flipSideDir(QDir::homePath());
|
||||
QFile flipSideFile(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
||||
if(flipSideFile.exists()) {
|
||||
@@ -861,7 +893,7 @@ void settingsDialogImpl::showCurrentGameTableStylePreview()
|
||||
{
|
||||
QListWidgetItem* item = listWidget_gameTableStyles->currentItem();
|
||||
if(item) {
|
||||
GameTableStyleReader style(myConfig);
|
||||
GameTableStyleReader style(myConfig, this);
|
||||
style.readStyleFile(item->data(15).toString());
|
||||
QPixmap preview(style.getPreview());
|
||||
if(preview.height() > 160 || preview.width() > 120) label_gameTableStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
@@ -885,7 +917,12 @@ void settingsDialogImpl::showCurrentGameTableStylePreview()
|
||||
windowsSubString = "<b>"+WindowBehaviour+":</b> "+scaleable+"<br><b>"+MinimumSize+":</b> "+style.getMinimumWindowWidth()+"x"+style.getMinimumWindowHeight()+"<br><b>"+MaximumSize+":</b> "+style.getMaximumWindowWidth()+"x"+style.getMaximumWindowHeight();
|
||||
}
|
||||
|
||||
label_gameTableStyleInfo->setText("<b>"+MaintainerName+":</b> "+style.getStyleMaintainerName()+"<br><b>"+MaintainerEMail+":</b> "+style.getStyleMaintainerEMail()+"<br><b>"+CreateDate+":</b> "+style.getStyleCreateDate()+"<br>"+windowsSubString);
|
||||
QString maintainerEMailString;
|
||||
if(style.getStyleMaintainerEMail() != "NULL" && style.getStyleMaintainerEMail() != "") {
|
||||
maintainerEMailString = "<b>"+MaintainerEMail+":</b> "+style.getStyleMaintainerEMail()+"<br>";
|
||||
}
|
||||
|
||||
label_gameTableStyleInfo->setText("<b>"+MaintainerName+":</b> "+style.getStyleMaintainerName()+"<br>"+maintainerEMailString+"<b>"+CreateDate+":</b> "+style.getStyleCreateDate()+"<br>"+windowsSubString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -926,9 +963,9 @@ void settingsDialogImpl::addGameTableStyle()
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
else {
|
||||
GameTableStyleReader newStyle(myConfig);
|
||||
GameTableStyleReader newStyle(myConfig, this);
|
||||
newStyle.readStyleFile(fileName);
|
||||
if(!newStyle.getFallBack()) {
|
||||
if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) {
|
||||
QListWidgetItem *newItem = new QListWidgetItem(newStyle.getStyleDescription());
|
||||
newItem->setData(15,fileName);
|
||||
newItem->setData(Qt::ToolTipRole,fileName);
|
||||
@@ -936,7 +973,7 @@ void settingsDialogImpl::addGameTableStyle()
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Game Table Style File Error"),
|
||||
tr("Could not read game table style file. \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);
|
||||
}
|
||||
}
|
||||
@@ -965,7 +1002,7 @@ void settingsDialogImpl::showCurrentCardDeckStylePreview()
|
||||
{
|
||||
QListWidgetItem* item = listWidget_cardDeckStyles->currentItem();
|
||||
if(item) {
|
||||
CardDeckStyleReader style(myConfig);
|
||||
CardDeckStyleReader style(myConfig, this);
|
||||
style.readStyleFile(item->data(15).toString());
|
||||
QPixmap preview(style.getPreview());
|
||||
if(preview.height() > 160 || preview.width() > 120) label_cardDeckStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
@@ -975,7 +1012,12 @@ void settingsDialogImpl::showCurrentCardDeckStylePreview()
|
||||
QString MaintainerEMail = tr("Maintainer EMail");
|
||||
QString CreateDate = tr("Create Date");
|
||||
|
||||
label_cardDeckStyleInfo->setText("<b>"+MaintainerName+":</b> "+style.getStyleMaintainerName()+"<br><b>"+MaintainerEMail+":</b> "+style.getStyleMaintainerEMail()+"<br><b>"+CreateDate+":</b> "+style.getStyleCreateDate()+"");
|
||||
QString maintainerEMailString;
|
||||
if(style.getStyleMaintainerEMail() != "NULL" && style.getStyleMaintainerEMail() != "") {
|
||||
maintainerEMailString = "<b>"+MaintainerEMail+":</b> "+style.getStyleMaintainerEMail()+"<br>";
|
||||
}
|
||||
|
||||
label_cardDeckStyleInfo->setText("<b>"+MaintainerName+":</b> "+style.getStyleMaintainerName()+"<br>"+maintainerEMailString+"<b>"+CreateDate+":</b> "+style.getStyleCreateDate()+"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1016,9 +1058,9 @@ void settingsDialogImpl::addCardDeckStyle()
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
else {
|
||||
CardDeckStyleReader newStyle(myConfig);
|
||||
CardDeckStyleReader newStyle(myConfig, this);
|
||||
newStyle.readStyleFile(fileName);
|
||||
if(!newStyle.getFallBack()) {
|
||||
if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) {
|
||||
QListWidgetItem *newItem = new QListWidgetItem(newStyle.getStyleDescription());
|
||||
newItem->setData(15,fileName);
|
||||
newItem->setData(Qt::ToolTipRole,fileName);
|
||||
@@ -1026,7 +1068,7 @@ void settingsDialogImpl::addCardDeckStyle()
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Card Deck Style File Error"),
|
||||
tr("Could not read card deck style file. \nStyle will not be placed into list!"),
|
||||
tr("Could not load card deck style file correctly. \nStyle will not be placed into list!"),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
|
||||
#include "game_defs.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
CardDeckStyleReader::CardDeckStyleReader(ConfigFile *c, gameTableImpl *w) : myConfig(c), myW(w), fallBack(0)
|
||||
CardDeckStyleReader::CardDeckStyleReader(ConfigFile *c, QWidget *w) : myConfig(c), myW(w), fallBack(0), loadedSuccessfull(0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -74,52 +74,75 @@ void CardDeckStyleReader::readStyleFile(QString file) {
|
||||
else if (itemsList->ValueStr() == "Preview") { Preview = currentDir+QString::fromUtf8(tempString1.c_str()); }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else { qDebug() << "could not load card deck file: " << tinyFileName.c_str(); }
|
||||
//check if style items are left and show warning
|
||||
leftItems.clear();
|
||||
|
||||
//check if style items are left and show warning
|
||||
leftItems.clear();
|
||||
if(StyleDescription == "") { leftItems << "StyleDescription"; }
|
||||
if(StyleMaintainerName == "") { leftItems << "StyleMaintainerName"; }
|
||||
if(StyleMaintainerEMail == "") { leftItems << "StyleMaintainerEMail"; }
|
||||
if(StyleCreateDate == "") { leftItems << "StyleCreateDate"; }
|
||||
if(PokerTHStyleFileVersion == "") { leftItems << "PokerTHStyleFileVersion"; }
|
||||
|
||||
if(StyleDescription == "") { leftItems << "StyleDescription"; }
|
||||
if(StyleMaintainerName == "") { leftItems << "StyleMaintainerName"; }
|
||||
if(StyleMaintainerEMail == "") { leftItems << "StyleMaintainerEMail"; }
|
||||
if(StyleCreateDate == "") { leftItems << "StyleCreateDate"; }
|
||||
if(PokerTHStyleFileVersion == "") { leftItems << "PokerTHStyleFileVersion"; }
|
||||
//check if all files are there
|
||||
cardsLeft.clear();
|
||||
int i;
|
||||
for(i=0; i<52; i++) {
|
||||
QString cardString(QString::number(i)+".png");
|
||||
if(!QDir(currentDir).exists(cardString)) {
|
||||
cardsLeft << cardString;
|
||||
}
|
||||
}
|
||||
if(!QDir(currentDir).exists("flipside.png")) {
|
||||
cardsLeft << "flipside.png";
|
||||
}
|
||||
|
||||
// set loadedSuccessfull TRUE if everything works
|
||||
if(leftItems.isEmpty() && cardsLeft.isEmpty() && PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() == POKERTH_CD_STYLE_FILE_VERSION)
|
||||
loadedSuccessfull = 1;
|
||||
else
|
||||
loadedSuccessfull = 0;
|
||||
|
||||
if(!leftItems.isEmpty() && myW != 0) showLeftItemsErrorMessage(StyleDescription, leftItems, StyleMaintainerEMail);
|
||||
else {
|
||||
if(!cardsLeft.isEmpty() && myW != 0) showCardsLeftErrorMessage(StyleDescription, cardsLeft, StyleMaintainerEMail);
|
||||
//check for style file version
|
||||
if(PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() != POKERTH_CD_STYLE_FILE_VERSION) {
|
||||
QString EMail;
|
||||
if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail;
|
||||
QMessageBox::warning(myW, tr("Card Deck Style Error"),
|
||||
tr("Selected card deck style \"%1\" seems to be outdated. \n The current PokerTH card deck style version is \"%2\", but this style has version \"%3\" set. \n\nPlease contact the game table style builder %4.").arg(StyleDescription).arg(POKERTH_CD_STYLE_FILE_VERSION).arg(PokerTHStyleFileVersion).arg(EMail),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
loadedSuccessfull = 0;
|
||||
QMessageBox::warning(myW, tr("Card Deck Style Error"),
|
||||
tr("Can not load card deck style file: %1 \n\nPlease check the style file or choose another style!").arg(tinyFileName.c_str()),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
//check if all files are there
|
||||
cardsLeft.clear();
|
||||
int i;
|
||||
for(i=0; i<52; i++) {
|
||||
QString cardString(QString::number(i)+".png");
|
||||
if(!QDir(currentDir).exists(cardString)) {
|
||||
cardsLeft << cardString;
|
||||
}
|
||||
}
|
||||
if(!QDir(currentDir).exists("flipside.png")) {
|
||||
cardsLeft << "flipside.png";
|
||||
}
|
||||
|
||||
if(!leftItems.isEmpty() && myW != 0) showLeftItemsErrorMessage(StyleDescription, leftItems, StyleMaintainerEMail);
|
||||
else {
|
||||
if(!cardsLeft.isEmpty() && myW != 0) showCardsLeftErrorMessage(StyleDescription, cardsLeft, StyleMaintainerEMail);
|
||||
}
|
||||
}
|
||||
|
||||
void CardDeckStyleReader::showLeftItemsErrorMessage(QString style, QStringList failedItems, QString email)
|
||||
{
|
||||
QString items = failedItems.join(", ");
|
||||
QString EMail;
|
||||
if(email != "NULL") EMail = email;
|
||||
|
||||
QMessageBox::warning(myW, tr("Card Deck Style Error"),
|
||||
tr("Selected card deck style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of \"%2\" is/are missing. \n\nPlease contact the game table style builder %3.").arg(style).arg(items).arg(email),
|
||||
tr("Selected card deck style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of \"%2\" is/are missing. \n\nPlease contact the game table style builder %3.").arg(style).arg(items).arg(EMail),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
void CardDeckStyleReader::showCardsLeftErrorMessage(QString style, QStringList failedItems, QString email)
|
||||
{
|
||||
QString items = failedItems.join(", ");
|
||||
QString EMail;
|
||||
if(email != "NULL") EMail = email;
|
||||
|
||||
QMessageBox::warning(myW, tr("Card Deck Style Error"),
|
||||
tr("Selected card deck style \"%1\" seems to be incomplete or defective. \nThe card picture(s) \"%2\" is/are not available. \n\nPlease contact the card deck style builder %3.").arg(style).arg(items).arg(email),
|
||||
tr("Selected card deck style \"%1\" seems to be incomplete or defective. \nThe card picture(s) \"%2\" is/are not available. \n\nPlease contact the card deck style builder %3.").arg(style).arg(items).arg(EMail),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define CARDDECKSTYLEREADER_H
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include "gametableimpl.h"
|
||||
#include "configfile.h"
|
||||
#include <string>
|
||||
#include <QtCore>
|
||||
@@ -30,7 +29,7 @@
|
||||
class CardDeckStyleReader : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CardDeckStyleReader(ConfigFile *c, gameTableImpl *w =0 );
|
||||
CardDeckStyleReader(ConfigFile *c, QWidget *w );
|
||||
~CardDeckStyleReader();
|
||||
|
||||
void readStyleFile(QString);
|
||||
@@ -46,6 +45,8 @@ public:
|
||||
QString getPreview() const { return Preview; }
|
||||
|
||||
bool getFallBack() const { return fallBack; }
|
||||
bool getLoadedSuccessfull() const { return loadedSuccessfull; }
|
||||
|
||||
void showLeftItemsErrorMessage(QString, QStringList, QString);
|
||||
void showCardsLeftErrorMessage(QString, QStringList, QString);
|
||||
|
||||
@@ -65,9 +66,10 @@ private:
|
||||
QStringList leftItems;
|
||||
|
||||
ConfigFile *myConfig;
|
||||
gameTableImpl *myW;
|
||||
QWidget *myW;
|
||||
|
||||
bool fallBack;
|
||||
bool loadedSuccessfull;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
GameTableStyleReader::GameTableStyleReader(ConfigFile *c, gameTableImpl *w) : myConfig(c), myW(w), fallBack(0)
|
||||
GameTableStyleReader::GameTableStyleReader(ConfigFile *c, QWidget *w) : myConfig(c), myW(w), fallBack(0), loadedSuccessfull(0)
|
||||
{
|
||||
|
||||
//set fonts and font sizes
|
||||
@@ -454,20 +454,30 @@ void GameTableStyleReader::readStyleFile(QString file) {
|
||||
// SIZE
|
||||
if(ChatLogTextSize == "") { leftItems << "ChatLogTextSize"; }
|
||||
|
||||
//set loadedSuccessfull TRUE if everything works
|
||||
if(leftItems.isEmpty() && itemPicsLeft.isEmpty() && PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() == POKERTH_GT_STYLE_FILE_VERSION)
|
||||
loadedSuccessfull = 1;
|
||||
else
|
||||
loadedSuccessfull = 0;
|
||||
|
||||
//if one or more items are left show detailed error message
|
||||
if(!leftItems.isEmpty() && myW != 0) showLeftItemsErrorMessage(StyleDescription, leftItems, StyleMaintainerEMail);
|
||||
else {
|
||||
//if one or more pictures where not found show detailed error message
|
||||
if(!itemPicsLeft.isEmpty() && myW != 0) showItemPicsLeftErrorMessage(StyleDescription, itemPicsLeft, StyleMaintainerEMail);
|
||||
//check for style file version
|
||||
if(!PokerTHStyleFileVersion.isEmpty() && PokerTHStyleFileVersion.toInt() != PokerTH_STYLE_FILE_VERSION) {
|
||||
if(PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() != POKERTH_GT_STYLE_FILE_VERSION) {
|
||||
QString EMail;
|
||||
if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail;
|
||||
QMessageBox::warning(myW, tr("Game Table Style Error"),
|
||||
tr("Selected game table style \"%1\" seems to be outdated. \n The current PokerTH game table style version is \"%2\", but this style has version \"%3\" set. \n\nPlease contact the game table style builder %4.").arg(StyleDescription).arg(PokerTH_STYLE_FILE_VERSION).arg(PokerTHStyleFileVersion).arg(StyleMaintainerEMail),
|
||||
tr("Selected game table style \"%1\" seems to be outdated. \n The current PokerTH game table style version is \"%2\", but this style has version \"%3\" set. \n\nPlease contact the game table style builder %4.").arg(StyleDescription).arg(POKERTH_GT_STYLE_FILE_VERSION).arg(PokerTHStyleFileVersion).arg(EMail),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { QMessageBox::warning(myW, tr("Game Table Style Error"),
|
||||
else {
|
||||
loadedSuccessfull = 0;
|
||||
QMessageBox::warning(myW, tr("Game Table Style Error"),
|
||||
tr("Can not load game table style file: %1 \n\nPlease check the style file or choose another style!").arg(tinyFileName.c_str()),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
@@ -476,18 +486,22 @@ void GameTableStyleReader::readStyleFile(QString file) {
|
||||
void GameTableStyleReader::showLeftItemsErrorMessage(QString style, QStringList failedItems, QString email)
|
||||
{
|
||||
QString items = failedItems.join(", ");
|
||||
QString EMail;
|
||||
if(email != "NULL") EMail = email;
|
||||
|
||||
QMessageBox::warning(myW, tr("Game Table Style Error"),
|
||||
tr("Selected game table style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of \"%2\" is/are missing. \n\nPlease contact the game table style builder %3.").arg(style).arg(items).arg(email),
|
||||
tr("Selected game table style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of \"%2\" is/are missing. \n\nPlease contact the game table style builder %3.").arg(style).arg(items).arg(EMail),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
void GameTableStyleReader::showItemPicsLeftErrorMessage(QString style, QStringList picsLeft, QString email)
|
||||
{
|
||||
QString pics = picsLeft.join("\n");
|
||||
QString pics = picsLeft.join("\n");
|
||||
QString EMail;
|
||||
if(email != "NULL") EMail = email;
|
||||
|
||||
QMessageBox::warning(myW, tr("Game Table Style Error"),
|
||||
tr("One or more pictures from current game table style \"%1\" where not found: \n\n\"%2\" \n\nPlease contact the game table style builder %3.").arg(style).arg(pics).arg(email),
|
||||
tr("One or more pictures from current game table style \"%1\" where not found: \n\n\"%2\" \n\nPlease contact the game table style builder %3.").arg(style).arg(pics).arg(EMail),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#define GAMETABLESTYLEREADER_H
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include "gametableimpl.h"
|
||||
#include "configfile.h"
|
||||
#include "gametableimpl.h"
|
||||
#include <string>
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@@ -32,7 +32,7 @@ class gameTableImpl;
|
||||
class GameTableStyleReader : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GameTableStyleReader(ConfigFile *c, gameTableImpl *w =0 );
|
||||
GameTableStyleReader(ConfigFile *c, QWidget *w);
|
||||
~GameTableStyleReader();
|
||||
|
||||
void readStyleFile(QString);
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
QString getIfFixedWindowSize() const { return IfFixedWindowSize; }
|
||||
|
||||
bool getFallBack() const { return fallBack; }
|
||||
bool getLoadedSuccessfull() const { return loadedSuccessfull; }
|
||||
|
||||
//set pictures
|
||||
void setTableBackground(gameTableImpl*);
|
||||
@@ -277,9 +278,10 @@ private:
|
||||
QStringList itemPicsLeft;
|
||||
|
||||
ConfigFile *myConfig;
|
||||
gameTableImpl *myW;
|
||||
QWidget *myW;
|
||||
|
||||
bool fallBack;
|
||||
bool fallBack;
|
||||
bool loadedSuccessfull;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user