next steps skinning implementation (config ready)

This commit is contained in:
doitux
2009-03-30 13:12:44 +00:00
parent a2827fb4bc
commit da05707b26
13 changed files with 425 additions and 136 deletions
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<PokerTH>
<CardDeck>
<StyleDescription value="default card deck" />
<PreviewPicture value="preview.png" />
</CardDeck>
</PokerTH>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<PokerTH>
<CardDeck>
<StyleDescription value="PokerTH default card deck" />
<StyleMaintainerEMail value="webmaster@pokerth.net" />
<Preview value="preview.png" />
</CardDeck>
</PokerTH>
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

+2
View File
@@ -178,6 +178,7 @@ HEADERS += \
src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h \
src/gui/qt/startwindow/startwindowimpl.h \
src/gui/qt/styles/gametablestylereader.h \
src/gui/qt/styles/carddeckstylereader.h \
src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.h \
src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.h \
src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h \
@@ -242,6 +243,7 @@ SOURCES += \
src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp \
src/gui/qt/startwindow/startwindowimpl.cpp \
src/gui/qt/styles/gametablestylereader.cpp \
src/gui/qt/styles/carddeckstylereader.cpp \
src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.cpp \
src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp \
src/gui/qt/mymessagedialog/mymessagedialogimpl.cpp \
+3 -3
View File
@@ -48,7 +48,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
myQtToolsInterface = CreateQtToolsWrapper();
// !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 61;
configRev = 62;
//standard defaults
logOnOffDefault = "1";
@@ -148,8 +148,8 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
configList.push_back(ConfigInfo("FlipsideOwnFile", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("GameTableStylesList", CONFIG_TYPE_STRING_LIST, "GameTableStyles"));
configList.push_back(ConfigInfo("CurrentGameTableStyle", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("CardDecksList", CONFIG_TYPE_STRING_LIST, "CardDecks"));
configList.push_back(ConfigInfo("CurrentCardDeck", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("CardDeckStylesList", CONFIG_TYPE_STRING_LIST, "CardDeckStyles"));
configList.push_back(ConfigInfo("CurrentCardDeckStyle", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("PlaySoundEffects", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("SoundVolume", CONFIG_TYPE_INT, "8"));
configList.push_back(ConfigInfo("PlayGameActions", CONFIG_TYPE_INT, "1"));
+2 -2
View File
@@ -3496,7 +3496,7 @@
</property>
<widget class="QMenu" name="menuView">
<property name="title">
<string>View</string>
<string>&amp;View</string>
</property>
<addaction name="actionFullScreen"/>
<addaction name="actionShowHideChat"/>
@@ -3508,7 +3508,7 @@
</widget>
<widget class="QMenu" name="menuSettings">
<property name="title">
<string>Settings</string>
<string>&amp;Settings</string>
</property>
<addaction name="actionConfigure_PokerTH"/>
</widget>
+6 -6
View File
@@ -481,13 +481,13 @@ p, li { white-space: pre-wrap; }
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_12">
<property name="title">
<string>Card Decks</string>
<string>Card Deck Styles</string>
</property>
<layout class="QGridLayout" name="gridLayout_14">
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="pushButton_activateCardDeck">
<widget class="QPushButton" name="pushButton_activateCardDeckStyle">
<property name="text">
<string>Activate</string>
</property>
@@ -507,14 +507,14 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_addCardDeck">
<widget class="QPushButton" name="pushButton_addCardDeckStyle">
<property name="text">
<string>Add ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_removeCardDeck">
<widget class="QPushButton" name="pushButton_removeCardDeckStyle">
<property name="text">
<string>Remove</string>
</property>
@@ -529,7 +529,7 @@ p, li { white-space: pre-wrap; }
</property>
<layout class="QGridLayout" name="gridLayout_16">
<item row="0" column="0">
<widget class="QLabel" name="label_cardDeckPreview">
<widget class="QLabel" name="label_cardDeckStylePreview">
<property name="minimumSize">
<size>
<width>160</width>
@@ -551,7 +551,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="0" column="0">
<widget class="QListWidget" name="listWidget_2"/>
<widget class="QListWidget" name="listWidget_cardDeckStyles"/>
</item>
</layout>
</widget>
+155 -12
View File
@@ -20,11 +20,13 @@
#include "settingsdialogimpl.h"
#include "myavatarlistitem.h"
#include "gametablestylereader.h"
#include "carddeckstylereader.h"
#include "configfile.h"
#include <net/socket_startup.h>
#define POKERTH_DISTRIBUTED_GAME_TABLE_STYLES 1
#define POKERTH_DISTRIBUTED_CARD_DECK_STYLES 1
using namespace std;
@@ -110,8 +112,10 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
connect( pushButton_addGameTableStyle, SIGNAL( clicked() ), this, SLOT( addGameTableStyle()) );
connect( pushButton_removeGameTableStyle, SIGNAL( clicked() ), this, SLOT( removeGameTableStyle()) );
connect( listWidget_cardDeckStyles, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*) ), this, SLOT ( showCurrentCardDeckStylePreview() ));
connect( pushButton_activateCardDeckStyle, SIGNAL( clicked() ), this, SLOT( setSelectedCardDeckStyleActivated()) );
connect( pushButton_addCardDeckStyle, SIGNAL( clicked() ), this, SLOT( addCardDeckStyle()) );
connect( pushButton_removeCardDeckStyle, SIGNAL( clicked() ), this, SLOT( removeCardDeckStyle()) );
}
void settingsDialogImpl::exec() {
@@ -235,13 +239,14 @@ void settingsDialogImpl::exec() {
lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
//S t y l e
//TABLE
// define PokerTH default GameTableStyle
listWidget_gameTableStyles->clear();
GameTableStyleReader defaultStyle(myConfig);
defaultStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/table/default/defaulttablestyle.xml");
QListWidgetItem *defaultItem = new QListWidgetItem(defaultStyle.getStyleDescription(),listWidget_gameTableStyles);
defaultItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/table/default/defaulttablestyle.xml");
GameTableStyleReader defaultTableStyle(myConfig);
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");
//load secondary styles into list (if fallback no entry)
myGameTableStylesList = myConfig->readConfigStringList("GameTableStylesList");
@@ -260,17 +265,17 @@ void settingsDialogImpl::exec() {
GameTableStyleReader currentGameTableStyle(myConfig);
currentGameTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentGameTableStyle").c_str()));
int i;
bool currentFound(FALSE);
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);
currentFound=TRUE;
currentGameTableFound=TRUE;
}
else item->setIcon(QIcon());
}
if(!currentFound) {
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"));
@@ -279,11 +284,51 @@ void settingsDialogImpl::exec() {
//refresh Game Table Style Preview
showCurrentGameTableStylePreview();
//CARDS
//define PokerTH default CardDeck
// defaultCardDeck = myQtToolsInterface->getDataPathStdString(myArgv0)+"gfx/cards/default/defaultcarddeck.xml";
listWidget_cardDeckStyles->clear();
CardDeckStyleReader defaultCardStyle(myConfig);
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");
//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);
nextStyle.readStyleFile(QString::fromUtf8(it2->c_str()));
if(!nextStyle.getFallBack()) {
QListWidgetItem *nextItem = new QListWidgetItem(nextStyle.getStyleDescription());
nextItem->setData(15,QString::fromUtf8(it2->c_str()));
listWidget_cardDeckStyles->addItem(nextItem);
}
}
//set current card deck style from config file
CardDeckStyleReader currentCardDeckStyle(myConfig);
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);
}
// refresh Card Deck Style Preview
showCurrentCardDeckStylePreview();
//Sound
groupBox_playSoundEffects->setChecked(myConfig->readConfigInt("PlaySoundEffects"));
@@ -469,6 +514,7 @@ void settingsDialogImpl::isAccepted() {
}
//S T Y L E
// TABLE
//save game table styles list
myGameTableStylesList.clear();
int i;
@@ -483,7 +529,22 @@ void settingsDialogImpl::isAccepted() {
if(!item->icon().isNull())
myConfig->writeConfigString("CurrentGameTableStyle", item->data(15).toString().toUtf8().constData());
}
// CARDS
//save card deck styles list
myCardDeckStylesList.clear();
int j;
for(j=POKERTH_DISTRIBUTED_CARD_DECK_STYLES; j < listWidget_cardDeckStyles->count(); j++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(j);
myCardDeckStylesList.push_back(item->data(15).toString().toUtf8().constData());
}
myConfig->writeConfigStringList("CardDeckStylesList", myCardDeckStylesList);
//save current card deck style
for(j=0; j < listWidget_cardDeckStyles->count(); j++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(j);
if(!item->icon().isNull())
myConfig->writeConfigString("CurrentCardDeckStyle", item->data(15).toString().toUtf8().constData());
}
//Sound
myConfig->writeConfigInt("PlaySoundEffects", groupBox_playSoundEffects->isChecked());
myConfig->writeConfigInt("SoundVolume", horizontalSlider_soundVolume->value());
@@ -865,3 +926,85 @@ void settingsDialogImpl::removeGameTableStyle()
}
}
void settingsDialogImpl::showCurrentCardDeckStylePreview()
{
QListWidgetItem* item = listWidget_cardDeckStyles->currentItem();
if(item) {
CardDeckStyleReader style(myConfig);
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));
else label_cardDeckStylePreview->setPixmap(preview);
}
}
void settingsDialogImpl::setSelectedCardDeckStyleActivated()
{
QListWidgetItem* selectedItem = listWidget_cardDeckStyles->currentItem();
if(selectedItem) {
int i;
for(i=0; i < listWidget_cardDeckStyles->count(); i++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(i);
if(item == selectedItem) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
}
else item->setIcon(QIcon());
}
}
}
void settingsDialogImpl::addCardDeckStyle()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your card deck style"),
QDir::home().absolutePath(),
tr("PokerTH card deck styles (*.xml)"));
if (!fileName.isEmpty()) {
int i;
bool fileNameAlreadyFound(FALSE);
for(i=0; i < listWidget_cardDeckStyles->count(); i++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(i);
if(item->data(15).toString() == fileName)
fileNameAlreadyFound = TRUE;
}
if(fileNameAlreadyFound) {
QMessageBox::warning(this, tr("Card Deck Style Error"),
tr("Selected card deck style file is already in the list. \nPlease select another one to add!"),
QMessageBox::Ok);
}
else {
CardDeckStyleReader newStyle(myConfig);
newStyle.readStyleFile(fileName);
if(!newStyle.getFallBack()) {
QListWidgetItem *newItem = new QListWidgetItem(newStyle.getStyleDescription());
newItem->setData(15,fileName);
listWidget_cardDeckStyles->addItem(newItem);
}
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!"),
QMessageBox::Ok);
}
}
}
}
void settingsDialogImpl::removeCardDeckStyle()
{
//never delete PokerTH defaullt Styles
if(listWidget_cardDeckStyles->currentRow() >= POKERTH_DISTRIBUTED_CARD_DECK_STYLES) {
QListWidgetItem* selectedItem = listWidget_cardDeckStyles->currentItem();
if(selectedItem) {
// if selected is activated --> swith activation to first default
if(!selectedItem->icon().isNull()) {
QListWidgetItem* firstItem = listWidget_cardDeckStyles->item(0);
firstItem->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
}
//remove from List
listWidget_cardDeckStyles->takeItem(listWidget_cardDeckStyles->currentRow());
}
}
}
@@ -85,6 +85,11 @@ public slots:
void addGameTableStyle();
void removeGameTableStyle();
void setSelectedCardDeckStyleActivated();
void showCurrentCardDeckStylePreview();
void addCardDeckStyle();
void removeCardDeckStyle();
private:
bool playerNickIsChanged;
@@ -101,7 +106,7 @@ private:
std::list<int> myManualBlindsList;
std::list<int> myNetManualBlindsList;
std::list<std::string> myGameTableStylesList;
std::list<std::string> myCardDecksList;
std::list<std::string> myCardDeckStylesList;
ConfigFile* myConfig;
boost::shared_ptr<selectAvatarDialogImpl> mySelectAvatarDialogImpl;
+102 -101
View File
@@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>startWindow</class>
<widget class="QMainWindow" name="startWindow" >
<property name="geometry" >
<widget class="QMainWindow" name="startWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -9,29 +10,29 @@
<height>350</height>
</rect>
</property>
<property name="minimumSize" >
<property name="minimumSize">
<size>
<width>450</width>
<height>350</height>
</size>
</property>
<property name="maximumSize" >
<property name="maximumSize">
<size>
<width>450</width>
<height>350</height>
</size>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>PokerTH 0.6.3 - The Open-Source Texas Holdem Engine</string>
</property>
<widget class="QWidget" name="centralwidget" >
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="1" >
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>95</height>
@@ -39,12 +40,12 @@
</property>
</spacer>
</item>
<item row="1" column="0" >
<item row="1" column="0">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>63</width>
<height>20</height>
@@ -52,24 +53,24 @@
</property>
</spacer>
</item>
<item row="1" column="1" >
<layout class="QVBoxLayout" name="verticalLayout" >
<property name="spacing" >
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="pushButtonStart_Local_Game" >
<property name="focusPolicy" >
<widget class="QPushButton" name="pushButtonStart_Local_Game">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text" >
<property name="text">
<string>&amp;1 Start Local Game</string>
</property>
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/swbuttonlocalgame.png</normaloff>:/gfx/swbuttonlocalgame.png</iconset>
</property>
<property name="iconSize" >
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
@@ -78,18 +79,18 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonInternet_Game" >
<property name="focusPolicy" >
<widget class="QPushButton" name="pushButtonInternet_Game">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text" >
<property name="text">
<string>&amp;2 Internet Game</string>
</property>
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/swbuttoninternetgame.png</normaloff>:/gfx/swbuttoninternetgame.png</iconset>
</property>
<property name="iconSize" >
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
@@ -98,18 +99,18 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_Create_Network_Game" >
<property name="focusPolicy" >
<widget class="QPushButton" name="pushButton_Create_Network_Game">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text" >
<property name="text">
<string>&amp;3 Create Network Game</string>
</property>
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/swbuttoncreatenetworkgame.png</normaloff>:/gfx/swbuttoncreatenetworkgame.png</iconset>
</property>
<property name="iconSize" >
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
@@ -118,18 +119,18 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_Join_Network_Game" >
<property name="focusPolicy" >
<widget class="QPushButton" name="pushButton_Join_Network_Game">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text" >
<property name="text">
<string>&amp;4 Join Network Game</string>
</property>
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/swbuttonjoinnetworkgame.png</normaloff>:/gfx/swbuttonjoinnetworkgame.png</iconset>
</property>
<property name="iconSize" >
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
@@ -139,12 +140,12 @@
</item>
</layout>
</item>
<item row="1" column="2" >
<item row="1" column="2">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>63</width>
<height>20</height>
@@ -152,12 +153,12 @@
</property>
</spacer>
</item>
<item row="2" column="1" >
<item row="2" column="1">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>95</height>
@@ -167,113 +168,113 @@
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>23</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuPokerTH" >
<property name="title" >
<string>PokerTH</string>
<widget class="QMenu" name="menuPokerTH">
<property name="title">
<string>&amp;PokerTH</string>
</property>
<widget class="QMenu" name="menuNetwork_Game" >
<property name="title" >
<widget class="QMenu" name="menuNetwork_Game">
<property name="title">
<string>Network Game</string>
</property>
<addaction name="actionCreate_Network_Game" />
<addaction name="actionJoin_Network_Game" />
<addaction name="actionCreate_Network_Game"/>
<addaction name="actionJoin_Network_Game"/>
</widget>
<addaction name="actionStart_Local_Game" />
<addaction name="menuNetwork_Game" />
<addaction name="actionInternet_Game" />
<addaction name="actionAbout_PokerTH" />
<addaction name="actionQuit" />
<addaction name="actionStart_Local_Game"/>
<addaction name="menuNetwork_Game"/>
<addaction name="actionInternet_Game"/>
<addaction name="actionAbout_PokerTH"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuSettings" >
<property name="title" >
<string>Settings</string>
<widget class="QMenu" name="menuSettings">
<property name="title">
<string>&amp;Settings</string>
</property>
<addaction name="actionConfigure_PokerTH" />
<addaction name="actionConfigure_PokerTH"/>
</widget>
<addaction name="menuPokerTH" />
<addaction name="menuSettings" />
<addaction name="menuPokerTH"/>
<addaction name="menuSettings"/>
</widget>
<widget class="QStatusBar" name="statusbar" />
<action name="actionStart_Local_Game" >
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<widget class="QStatusBar" name="statusbar"/>
<action name="actionStart_Local_Game">
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/swbuttonlocalgame.png</normaloff>:/gfx/swbuttonlocalgame.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Start Local Game ...</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="actionInternet_Game" >
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<action name="actionInternet_Game">
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/swbuttoninternetgame.png</normaloff>:/gfx/swbuttoninternetgame.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Internet Game ...</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+I</string>
</property>
</action>
<action name="actionAbout_PokerTH" >
<property name="text" >
<action name="actionAbout_PokerTH">
<property name="text">
<string>About PokerTH</string>
</property>
</action>
<action name="actionConfigure_PokerTH" >
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<action name="actionConfigure_PokerTH">
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/systemsettings.png</normaloff>:/gfx/systemsettings.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Configure PokerTH ...</string>
</property>
</action>
<action name="actionQuit" >
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<action name="actionQuit">
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/application_exit.png</normaloff>:/gfx/application_exit.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Quit</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionCreate_Network_Game" >
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<action name="actionCreate_Network_Game">
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/swbuttoncreatenetworkgame.png</normaloff>:/gfx/swbuttoncreatenetworkgame.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Create Network Game ...</string>
</property>
</action>
<action name="actionJoin_Network_Game" >
<property name="icon" >
<iconset resource="resources/pokerth.qrc" >
<action name="actionJoin_Network_Game">
<property name="icon">
<iconset resource="resources/pokerth.qrc">
<normaloff>:/gfx/swbuttonjoinnetworkgame.png</normaloff>:/gfx/swbuttonjoinnetworkgame.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Join Network Game ...</string>
</property>
</action>
</widget>
<resources>
<include location="resources/pokerth.qrc" />
<include location="resources/pokerth.qrc"/>
</resources>
<connections>
<connection>
@@ -282,11 +283,11 @@
<receiver>startWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>221</x>
<y>168</y>
</hint>
+82
View File
@@ -0,0 +1,82 @@
/***************************************************************************
* Copyright (C) 2006 by Felix Hammer *
* f.hammer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "carddeckstylereader.h"
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <fstream>
using namespace std;
CardDeckStyleReader::CardDeckStyleReader(ConfigFile *c, gameTableImpl *w) : myConfig(c), myW(w), fallBack(0)
{
}
CardDeckStyleReader::~CardDeckStyleReader()
{
}
void CardDeckStyleReader::readStyleFile(QString file) {
string tinyFileName;
//if style file failed --> default style fallback
if(QFile(file).exists()) {
currentFileName = QFile(file).fileName();
tinyFileName = currentFileName.toUtf8().constData();
}
else {
currentFileName = QFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/cards/default/defaultdeckstyle.xml").fileName();
tinyFileName = currentFileName.toUtf8().constData();
fallBack = 1;
}
QFileInfo info(currentFileName);
currentFileDir = info.absolutePath();
//start reading the file and fill vars
string tempString1("");
TiXmlDocument doc(tinyFileName);
if(doc.LoadFile()) {
TiXmlHandle docHandle( &doc );
TiXmlElement* itemsList = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).FirstChild().ToElement();
for( ; itemsList; itemsList=itemsList->NextSiblingElement()) {
const char *tmpStr1 = itemsList->Attribute("value");
if (tmpStr1) {
tempString1 = tmpStr1;
if(itemsList->ValueStr() == "StyleDescription") { StyleDescription = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "Preview") { Preview = QString::fromUtf8(tempString1.c_str()); }
}
}
}
else { qDebug() << "could not load card deck file: " << tinyFileName.c_str(); }
}
QString CardDeckStyleReader::getPreview()
{
return QString(currentFileDir+"/"+Preview);
}
+58
View File
@@ -0,0 +1,58 @@
/***************************************************************************
* Copyright (C) 2009 by Felix Hammer *
* f.hammer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef CARDDECKSTYLEREADER_H
#define CARDDECKSTYLEREADER_H
#include "tinyxml.h"
#include "gametableimpl.h"
#include "configfile.h"
#include <string>
#include <QtCore>
#include <QtGui>
class CardDeckStyleReader : public QObject {
Q_OBJECT
public:
CardDeckStyleReader(ConfigFile *c, gameTableImpl *w =0 );
~CardDeckStyleReader();
void readStyleFile(QString);
QString getStyleDescription() const { return StyleDescription; }
QString getCurrentFileName() const { return currentFileName; }
QString getPreview();
bool getFallBack() const { return fallBack; }
private:
QString StyleDescription;
QString Preview;
QString currentFileName;
QString currentFileDir;
ConfigFile *myConfig;
gameTableImpl *myW;
bool fallBack;
};
#endif
+1 -4
View File
@@ -41,10 +41,7 @@ public:
QString getCurrentFileName() const { return currentFileName; }
QString getPreview();
bool getFallBack() const { return fallBack; }
bool getFallBack() const { return fallBack; }
private: