add a new show-cards-button, change styles handling in settings dialog

This commit is contained in:
doitux
2010-07-08 22:01:07 +00:00
parent 3b4c57d24f
commit 6104acc011
16 changed files with 326 additions and 143 deletions
@@ -4,8 +4,8 @@
<StyleDescription value="danuxi table design" /> <StyleDescription value="danuxi table design" />
<StyleMaintainerName value="Daniel Hammer" /> <StyleMaintainerName value="Daniel Hammer" />
<StyleMaintainerEMail value="webmaster@pokerth.net" /> <StyleMaintainerEMail value="webmaster@pokerth.net" />
<StyleCreateDate value="06.04.2009" /> <StyleCreateDate value="08.07.2010" />
<PokerTHStyleFileVersion value="1" /> <PokerTHStyleFileVersion value="2" />
<Preview value="preview.png" /> <Preview value="preview.png" />
<IfFixedWindowSize value="1" /> <IfFixedWindowSize value="1" />
<FixedWindowWidth value="1024" /> <FixedWindowWidth value="1024" />
@@ -49,6 +49,8 @@
<Table value="table.png" /> <Table value="table.png" />
<ToolBoxBackground value="toolboxbg.png" /> <ToolBoxBackground value="toolboxbg.png" />
<HandRanking value="handranking.png" /> <HandRanking value="handranking.png" />
<ShowMyCardsButtonDefault value="playeraction_purple.png" />
<ShowMyCardsButtonHover value="playeraction_purple_hover.png" />
<ActionAllInI18NPic value="NULL" /> <ActionAllInI18NPic value="NULL" />
<ActionRaiseI18NPic value="NULL" /> <ActionRaiseI18NPic value="NULL" />
<ActionBetI18NPic value="NULL" /> <ActionBetI18NPic value="NULL" />
@@ -122,6 +124,7 @@
<BetSpeedSliderGrooveBorderColor value="142568" /> <BetSpeedSliderGrooveBorderColor value="142568" />
<BetSpeedSliderHandleBgColor value="A1B4FF" /> <BetSpeedSliderHandleBgColor value="A1B4FF" />
<BetSpeedSliderHandleBorderColor value="00177D" /> <BetSpeedSliderHandleBorderColor value="00177D" />
<ShowMyCardsButtonTextColor value="F0F0F0" />
<ChatLogTextSize value="11" /> <ChatLogTextSize value="11" />
</TableStyle> </TableStyle>
</PokerTH> </PokerTH>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -4,8 +4,8 @@
<StyleDescription value="PokerTH default table style" /><!-- This string will be shown in settings/game table style list --> <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 --> <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. If you dont like to post your mail address here please write value="NULL". --> <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--> <StyleCreateDate value="08.07.2010" /> <!-- 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 --> <PokerTHStyleFileVersion value="2" /> <!-- 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. --> <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. -->
<!-- Windows Settings --> <!-- Windows Settings -->
@@ -53,6 +53,8 @@
<Table value="table.png" /> <!-- minimal size width:height in px [1024:600] --> <Table value="table.png" /> <!-- minimal size width:height in px [1024:600] -->
<ToolBoxBackground value="toolboxbg.png" /> <!-- minimal size width:height in px [260:188] --> <ToolBoxBackground value="toolboxbg.png" /> <!-- minimal size width:height in px [260:188] -->
<HandRanking value="handranking.png" /> <!-- minimal size width:height in px [240:153] --> <HandRanking value="handranking.png" /> <!-- minimal size width:height in px [240:153] -->
<ShowMyCardsButtonDefault value="playeraction_purple.png" /> <!-- optimal size width:height in px [100:25] -->
<ShowMyCardsButtonHover value="playeraction_purple_hover.png" /> <!-- optimal size width:height in px [100:25] -->
<!-- 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. --> <!-- 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] --> <ActionAllInI18NPic value="NULL" /> <!-- optimal size width:height in px [100:40] -->
@@ -132,6 +134,7 @@
<BetSpeedSliderGrooveBorderColor value="286400" /> <BetSpeedSliderGrooveBorderColor value="286400" />
<BetSpeedSliderHandleBgColor value="99D500" /> <BetSpeedSliderHandleBgColor value="99D500" />
<BetSpeedSliderHandleBorderColor value="286400" /> <BetSpeedSliderHandleBorderColor value="286400" />
<ShowMyCardsButtonTextColor value="F0F0F0" />
<!-- Table Font Sizes - values should be set in px --> <!-- Table Font Sizes - values should be set in px -->
<ChatLogTextSize value="11" /> <ChatLogTextSize value="11" />
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+1 -1
View File
@@ -35,7 +35,7 @@
#define POKERTH_BETA_REVISION 0 #define POKERTH_BETA_REVISION 0
#define POKERTH_BETA_RELEASE_STRING "0.8-svn" #define POKERTH_BETA_RELEASE_STRING "0.8-svn"
#define POKERTH_GT_STYLE_FILE_VERSION 1 #define POKERTH_GT_STYLE_FILE_VERSION 2
#define POKERTH_CD_STYLE_FILE_VERSION 1 #define POKERTH_CD_STYLE_FILE_VERSION 1
enum ServerMode { enum ServerMode {
+13
View File
@@ -2450,6 +2450,19 @@
<string/> <string/>
</property> </property>
</widget> </widget>
<widget class="MyActionButton" name="pushButton_showMyCards">
<property name="geometry">
<rect>
<x>72</x>
<y>72</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>uncover!</string>
</property>
</widget>
</widget> </widget>
</item> </item>
<item> <item>
+17 -1
View File
@@ -337,6 +337,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
holeCardsArray[9][0] = pixmapLabel_card9a; holeCardsArray[9][0] = pixmapLabel_card9a;
holeCardsArray[9][1] = pixmapLabel_card9b; holeCardsArray[9][1] = pixmapLabel_card9b;
pushButton_showMyCards->hide();
//style Game Table //style Game Table
refreshGameTableStyle(); refreshGameTableStyle();
@@ -466,6 +468,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect( pushButton_voteOnKickYes, SIGNAL( clicked() ), this, SLOT( voteOnKickYes() ) ); connect( pushButton_voteOnKickYes, SIGNAL( clicked() ), this, SLOT( voteOnKickYes() ) );
connect( pushButton_voteOnKickNo, SIGNAL( clicked() ), this, SLOT( voteOnKickNo() ) ); connect( pushButton_voteOnKickNo, SIGNAL( clicked() ), this, SLOT( voteOnKickNo() ) );
connect( pushButton_showMyCards, SIGNAL( clicked() ), this, SLOT( sendShowMyCardsSignal() ) );
//Nachrichten Thread-Save //Nachrichten Thread-Save
connect(this, SIGNAL(signalInitGui(int)), this, SLOT(initGui(int))); connect(this, SIGNAL(signalInitGui(int)), this, SLOT(initGui(int)));
connect(this, SIGNAL(signalRefreshSet()), this, SLOT(refreshSet())); connect(this, SIGNAL(signalRefreshSet()), this, SLOT(refreshSet()));
@@ -2664,7 +2668,7 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) {
else { keyUpDownChatCounter = 0; } else { keyUpDownChatCounter = 0; }
//TESTING UNIT //TESTING UNIT
//if (event->key() == Qt::Key_M) { startVoteOnKick(3,60, 6); } if (event->key() == Qt::Key_M) { showShowMyCardsButton(); }
} }
void gameTableImpl::changePlayingMode() { void gameTableImpl::changePlayingMode() {
@@ -3324,6 +3328,7 @@ void gameTableImpl::refreshGameTableStyle()
} }
//Human player button //Human player button
myGameTableStyle->setButtonsStyle(pushButton_BetRaise, pushButton_CallCheck, pushButton_Fold, pushButton_AllIn, 0); myGameTableStyle->setButtonsStyle(pushButton_BetRaise, pushButton_CallCheck, pushButton_Fold, pushButton_AllIn, 0);
myGameTableStyle->setShowMyCardsButtonStyle(pushButton_showMyCards);
myGameTableStyle->setBetValueInputStyle(lineEdit_betValue); myGameTableStyle->setBetValueInputStyle(lineEdit_betValue);
myGameTableStyle->setSliderStyle(horizontalSlider_bet); myGameTableStyle->setSliderStyle(horizontalSlider_bet);
@@ -3435,3 +3440,14 @@ void gameTableImpl::guestUserMode()
lineEdit_ChatInput->setDisabled(true); lineEdit_ChatInput->setDisabled(true);
guestMode = true; guestMode = true;
} }
void gameTableImpl::showShowMyCardsButton()
{
pushButton_showMyCards->show();
pushButton_showMyCards->raise();
}
void gameTableImpl::sendShowMyCardsSignal()
{
pushButton_showMyCards->hide();
}
+3
View File
@@ -306,6 +306,9 @@ public slots:
void registeredUserMode(); void registeredUserMode();
void guestUserMode(); void guestUserMode();
void showShowMyCardsButton();
void sendShowMyCardsSignal();
private: private:
boost::shared_ptr<GuiInterface> myServerGuiInterface; boost::shared_ptr<GuiInterface> myServerGuiInterface;
+91 -8
View File
@@ -310,9 +310,6 @@
<string>Game Table</string> <string>Game Table</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_13"> <layout class="QGridLayout" name="gridLayout_13">
<item row="0" column="0">
<widget class="QListWidget" name="listWidget_gameTableStyles"/>
</item>
<item row="0" column="1"> <item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@@ -399,6 +396,55 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QTreeWidget" name="treeWidget_gameTableStyles">
<property name="indentation">
<number>5</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>3</number>
</property>
<attribute name="headerCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>Maintainer</string>
</property>
</column>
<column>
<property name="text">
<string>State</string>
</property>
</column>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_4"> <widget class="QWidget" name="tab_4">
@@ -406,9 +452,6 @@ p, li { white-space: pre-wrap; }
<string>Card Deck</string> <string>Card Deck</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_14"> <layout class="QGridLayout" name="gridLayout_14">
<item row="0" column="0">
<widget class="QListWidget" name="listWidget_cardDeckStyles"/>
</item>
<item row="0" column="1"> <item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
@@ -495,6 +538,46 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QTreeWidget" name="treeWidget_cardDeckStyles">
<property name="indentation">
<number>5</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>Maintainer</string>
</property>
</column>
<column>
<property name="text">
<string>State</string>
</property>
</column>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
@@ -3538,10 +3621,10 @@ p, li { white-space: pre-wrap; }
<tabstop>checkBox_dontTranslatePokerStrings</tabstop> <tabstop>checkBox_dontTranslatePokerStrings</tabstop>
<tabstop>checkBox_enableBetInputFocusSwitch</tabstop> <tabstop>checkBox_enableBetInputFocusSwitch</tabstop>
<tabstop>tabWidget</tabstop> <tabstop>tabWidget</tabstop>
<tabstop>listWidget_gameTableStyles</tabstop> <tabstop>treeWidget_gameTableStyles</tabstop>
<tabstop>pushButton_addGameTableStyle</tabstop> <tabstop>pushButton_addGameTableStyle</tabstop>
<tabstop>pushButton_removeGameTableStyle</tabstop> <tabstop>pushButton_removeGameTableStyle</tabstop>
<tabstop>listWidget_cardDeckStyles</tabstop> <tabstop>treeWidget_cardDeckStyles</tabstop>
<tabstop>pushButton_addCardDeckStyle</tabstop> <tabstop>pushButton_addCardDeckStyle</tabstop>
<tabstop>pushButton_removeCardDeckStyle</tabstop> <tabstop>pushButton_removeCardDeckStyle</tabstop>
<tabstop>groupBox_playSoundEffects</tabstop> <tabstop>groupBox_playSoundEffects</tabstop>
@@ -11,8 +11,8 @@
// //
#include "mystylelistitem.h" #include "mystylelistitem.h"
MyStyleListItem::MyStyleListItem(QString s, QListWidget *w) MyStyleListItem::MyStyleListItem(QStringList s, QTreeWidget *w)
: QListWidgetItem(s, w, QListWidgetItem::UserType) : QTreeWidgetItem(w, s, QTreeWidgetItem::UserType)
{ {
} }
@@ -20,8 +20,8 @@ MyStyleListItem::~MyStyleListItem()
{ {
} }
bool MyStyleListItem::operator<( const QListWidgetItem &other ) const bool MyStyleListItem::operator<( const QTreeWidgetItem &other ) const
{ {
return text().toLower() < other.text().toLower(); return text(0).toLower() < other.text(0).toLower();
} }
+3 -3
View File
@@ -10,12 +10,12 @@
#include <QtGui> #include <QtGui>
#include <QtCore> #include <QtCore>
class MyStyleListItem : public QListWidgetItem { class MyStyleListItem : public QTreeWidgetItem {
public: public:
MyStyleListItem(QString, QListWidget * =0); MyStyleListItem(QStringList, QTreeWidget *);
~MyStyleListItem(); ~MyStyleListItem();
virtual bool operator<( const QListWidgetItem &) const; virtual bool operator<( const QTreeWidgetItem &) const;
}; };
#endif // MYSTYLELISTITEM_H #endif // MYSTYLELISTITEM_H
+155 -120
View File
@@ -111,11 +111,11 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
connect(groupBox_automaticServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxAutomaticServerConfig(bool))); connect(groupBox_automaticServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxAutomaticServerConfig(bool)));
connect(groupBox_manualServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxManualServerConfig(bool))); connect(groupBox_manualServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxManualServerConfig(bool)));
connect( listWidget_gameTableStyles, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*) ), this, SLOT ( showCurrentGameTableStylePreview() )); connect( treeWidget_gameTableStyles, SIGNAL( currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*) ), this, SLOT ( showCurrentGameTableStylePreview() ));
connect( pushButton_addGameTableStyle, SIGNAL( clicked() ), this, SLOT( addGameTableStyle()) ); connect( pushButton_addGameTableStyle, SIGNAL( clicked() ), this, SLOT( addGameTableStyle()) );
connect( pushButton_removeGameTableStyle, SIGNAL( clicked() ), this, SLOT( removeGameTableStyle()) ); connect( pushButton_removeGameTableStyle, SIGNAL( clicked() ), this, SLOT( removeGameTableStyle()) );
connect( listWidget_cardDeckStyles, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*) ), this, SLOT ( showCurrentCardDeckStylePreview() )); connect( treeWidget_cardDeckStyles, SIGNAL( currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*) ), this, SLOT ( showCurrentCardDeckStylePreview() ));
connect( pushButton_addCardDeckStyle, SIGNAL( clicked() ), this, SLOT( addCardDeckStyle()) ); connect( pushButton_addCardDeckStyle, SIGNAL( clicked() ), this, SLOT( addCardDeckStyle()) );
connect( pushButton_removeCardDeckStyle, SIGNAL( clicked() ), this, SLOT( removeCardDeckStyle()) ); connect( pushButton_removeCardDeckStyle, SIGNAL( clicked() ), this, SLOT( removeCardDeckStyle()) );
connect( pushButton_internetGameRemoveIgnoredPlayer, SIGNAL( clicked()), this, SLOT( removePlayerFromIgnoredPlayersList())); connect( pushButton_internetGameRemoveIgnoredPlayer, SIGNAL( clicked()), this, SLOT( removePlayerFromIgnoredPlayersList()));
@@ -244,24 +244,28 @@ void settingsDialogImpl::exec() {
//S t y l e //S t y l e
//TABLE //TABLE
// define PokerTH default GameTableStyle // define PokerTH default GameTableStyle
listWidget_gameTableStyles->clear(); treeWidget_gameTableStyles->clear();
GameTableStyleReader defaultTableStyle(myConfig, this); GameTableStyleReader defaultTableStyle(myConfig, this);
defaultTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); defaultTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml");
if(defaultTableStyle.getLoadedSuccessfull()) { if(defaultTableStyle.getLoadedSuccessfull()) {
MyStyleListItem *defaultTableItem = new MyStyleListItem(defaultTableStyle.getStyleDescription(),listWidget_gameTableStyles); QStringList tempStringList1;
defaultTableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); tempStringList1 << defaultTableStyle.getStyleDescription() << defaultTableStyle.getStyleMaintainerName();
defaultTableItem->setData(16, POKERTH_DISTRIBUTED_STYLE); MyStyleListItem *defaultTableItem = new MyStyleListItem(tempStringList1, treeWidget_gameTableStyles);
defaultTableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); defaultTableItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml");
defaultTableItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE);
defaultTableItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml");
} }
//add danuxi table //add danuxi table
GameTableStyleReader danuxi1TableStyle(myConfig, this); GameTableStyleReader danuxi1TableStyle(myConfig, this);
danuxi1TableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); danuxi1TableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml");
if(danuxi1TableStyle.getLoadedSuccessfull()) { if(danuxi1TableStyle.getLoadedSuccessfull()) {
MyStyleListItem *danuxi1TableItem = new MyStyleListItem(danuxi1TableStyle.getStyleDescription(),listWidget_gameTableStyles); QStringList tempStringList2;
danuxi1TableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); tempStringList2 << danuxi1TableStyle.getStyleDescription() << danuxi1TableStyle.getStyleMaintainerName();
danuxi1TableItem->setData(16, POKERTH_DISTRIBUTED_STYLE); MyStyleListItem *danuxi1TableItem = new MyStyleListItem(tempStringList2, treeWidget_gameTableStyles);
danuxi1TableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); danuxi1TableItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml");
danuxi1TableItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE);
danuxi1TableItem->setData(0, 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)
@@ -271,14 +275,16 @@ void settingsDialogImpl::exec() {
GameTableStyleReader nextStyle(myConfig, this); GameTableStyleReader nextStyle(myConfig, this);
nextStyle.readStyleFile(QString::fromUtf8(it1->c_str())); nextStyle.readStyleFile(QString::fromUtf8(it1->c_str()));
if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) { if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) {
MyStyleListItem *nextItem = new MyStyleListItem(nextStyle.getStyleDescription()); QStringList tempStringList1;
nextItem->setData(15,QString::fromUtf8(it1->c_str())); tempStringList1 << nextStyle.getStyleDescription() << nextStyle.getStyleMaintainerName();
nextItem->setData(16, ADDITIONAL_STYLE); MyStyleListItem *nextItem = new MyStyleListItem(tempStringList1, treeWidget_gameTableStyles);
nextItem->setData(Qt::ToolTipRole,QString::fromUtf8(it1->c_str())); nextItem->setData(0, 15,QString::fromUtf8(it1->c_str()));
listWidget_gameTableStyles->addItem(nextItem); nextItem->setData(0, 16, ADDITIONAL_STYLE);
nextItem->setData(0, Qt::ToolTipRole,QString::fromUtf8(it1->c_str()));
treeWidget_gameTableStyles->addTopLevelItem(nextItem);
} }
} }
listWidget_gameTableStyles->sortItems(Qt::AscendingOrder); treeWidget_gameTableStyles->sortItems(0, Qt::AscendingOrder);
//set current Game Table Style from config file or fallback to first entry //set current Game Table Style from config file or fallback to first entry
GameTableStyleReader currentGameTableStyle(myConfig, this); GameTableStyleReader currentGameTableStyle(myConfig, this);
@@ -286,30 +292,30 @@ void settingsDialogImpl::exec() {
if(currentGameTableStyle.getLoadedSuccessfull()) { if(currentGameTableStyle.getLoadedSuccessfull()) {
int i; int i;
bool currentGameTableFound(FALSE); bool currentGameTableFound(FALSE);
for(i=0; i < listWidget_gameTableStyles->count(); i++) { for(i=0; i < treeWidget_gameTableStyles->topLevelItemCount(); i++) {
QListWidgetItem *item = listWidget_gameTableStyles->item(i); QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(i);
if(item->data(15) == currentGameTableStyle.getCurrentFileName()) { if(item->data(0, 15) == currentGameTableStyle.getCurrentFileName()) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
listWidget_gameTableStyles->setCurrentItem(item); treeWidget_gameTableStyles->setCurrentItem(item);
currentGameTableFound=TRUE; currentGameTableFound=TRUE;
} }
else item->setIcon(QIcon()); else item->setIcon(0, QIcon());
} }
if(!currentGameTableFound) { if(!currentGameTableFound) {
qDebug() << "Config ERROR: current game table style file not found in List. Try to mark default as selected."; qDebug() << "Config ERROR: current game table style file not found in List. Try to mark default as selected.";
QListWidgetItem *item = listWidget_gameTableStyles->item(0); QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(0);
if(item) { if(item) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
listWidget_gameTableStyles->setCurrentItem(item); treeWidget_gameTableStyles->setCurrentItem(item);
} }
} }
} }
else { else {
qDebug() << "Config ERROR: current game table style file could not be loaded. Try to mark default as selected."; qDebug() << "Config ERROR: current game table style file could not be loaded. Try to mark default as selected.";
QListWidgetItem *item = listWidget_gameTableStyles->item(0); QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(0);
if(item) { if(item) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
listWidget_gameTableStyles->setCurrentItem(item); treeWidget_gameTableStyles->setCurrentItem(item);
} }
} }
@@ -318,23 +324,27 @@ void settingsDialogImpl::exec() {
//CARDS //CARDS
//define PokerTH default CardDeck //define PokerTH default CardDeck
listWidget_cardDeckStyles->clear(); treeWidget_cardDeckStyles->clear();
CardDeckStyleReader defaultCardStyle(myConfig, this); CardDeckStyleReader defaultCardStyle(myConfig, this);
defaultCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); defaultCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
if(defaultCardStyle.getLoadedSuccessfull()) { if(defaultCardStyle.getLoadedSuccessfull()) {
MyStyleListItem *defaultCardItem = new MyStyleListItem(defaultCardStyle.getStyleDescription(),listWidget_cardDeckStyles); QStringList tempStringList1;
defaultCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); tempStringList1 << defaultCardStyle.getStyleDescription() << defaultCardStyle.getStyleMaintainerName();
defaultCardItem->setData(16, POKERTH_DISTRIBUTED_STYLE); MyStyleListItem *defaultCardItem = new MyStyleListItem(tempStringList1, treeWidget_cardDeckStyles);
defaultCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); defaultCardItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
defaultCardItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE);
defaultCardItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
} }
//define PokerTH default CardDeck4c //define PokerTH default CardDeck4c
CardDeckStyleReader default4cCardStyle(myConfig, this); CardDeckStyleReader default4cCardStyle(myConfig, this);
default4cCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); default4cCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
if(default4cCardStyle.getLoadedSuccessfull()) { if(default4cCardStyle.getLoadedSuccessfull()) {
MyStyleListItem *default4cCardItem = new MyStyleListItem(default4cCardStyle.getStyleDescription(),listWidget_cardDeckStyles); QStringList tempStringList1;
default4cCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); tempStringList1 << default4cCardStyle.getStyleDescription() << default4cCardStyle.getStyleMaintainerName();
default4cCardItem->setData(16, POKERTH_DISTRIBUTED_STYLE); MyStyleListItem *default4cCardItem = new MyStyleListItem(tempStringList1, treeWidget_cardDeckStyles);
default4cCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); default4cCardItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
default4cCardItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE);
default4cCardItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
} }
//load secondary card styles into list (if fallback no entry) //load secondary card styles into list (if fallback no entry)
@@ -344,14 +354,16 @@ void settingsDialogImpl::exec() {
CardDeckStyleReader nextStyle(myConfig, this); CardDeckStyleReader nextStyle(myConfig, this);
nextStyle.readStyleFile(QString::fromUtf8(it2->c_str())); nextStyle.readStyleFile(QString::fromUtf8(it2->c_str()));
if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) { if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) {
MyStyleListItem *nextItem = new MyStyleListItem(nextStyle.getStyleDescription()); QStringList tempStringList1;
nextItem->setData(15,QString::fromUtf8(it2->c_str())); tempStringList1 << nextStyle.getStyleDescription() << nextStyle.getStyleMaintainerName();
nextItem->setData(16, ADDITIONAL_STYLE); MyStyleListItem *nextItem = new MyStyleListItem(tempStringList1, treeWidget_cardDeckStyles);
nextItem->setData(Qt::ToolTipRole,QString::fromUtf8(it2->c_str())); nextItem->setData(0, 15,QString::fromUtf8(it2->c_str()));
listWidget_cardDeckStyles->addItem(nextItem); nextItem->setData(0, 16, ADDITIONAL_STYLE);
nextItem->setData(0, Qt::ToolTipRole,QString::fromUtf8(it2->c_str()));
treeWidget_cardDeckStyles->addTopLevelItem(nextItem);
} }
} }
listWidget_cardDeckStyles->sortItems(Qt::AscendingOrder); treeWidget_cardDeckStyles->sortItems(0, Qt::AscendingOrder);
//set current card deck style from config file //set current card deck style from config file
CardDeckStyleReader currentCardDeckStyle(myConfig, this); CardDeckStyleReader currentCardDeckStyle(myConfig, this);
@@ -359,36 +371,45 @@ void settingsDialogImpl::exec() {
if(currentCardDeckStyle.getLoadedSuccessfull()) { if(currentCardDeckStyle.getLoadedSuccessfull()) {
int j; int j;
bool currentCardDeckFound(FALSE); bool currentCardDeckFound(FALSE);
for(j=0; j < listWidget_cardDeckStyles->count(); j++) { for(j=0; j < treeWidget_cardDeckStyles->topLevelItemCount(); j++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(j); QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(j);
if(item->data(15) == currentCardDeckStyle.getCurrentFileName()) { if(item->data(0, 15) == currentCardDeckStyle.getCurrentFileName()) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
listWidget_cardDeckStyles->setCurrentItem(item); treeWidget_cardDeckStyles->setCurrentItem(item);
currentCardDeckFound=TRUE; currentCardDeckFound=TRUE;
} }
else item->setIcon(QIcon()); else item->setIcon(0, QIcon());
} }
if(!currentCardDeckFound) { if(!currentCardDeckFound) {
qDebug() << "Config ERROR: current card deck style file not found in List. Try to mark default as selected."; qDebug() << "Config ERROR: current card deck style file not found in List. Try to mark default as selected.";
QListWidgetItem *item = listWidget_cardDeckStyles->item(0); QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(0);
if(item) { if(item) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
listWidget_cardDeckStyles->setCurrentItem(item); treeWidget_cardDeckStyles->setCurrentItem(item);
} }
} }
} }
else { else {
qDebug() << "Config ERROR: current card deck style file could not be loaded. Try to mark default as selected."; qDebug() << "Config ERROR: current card deck style file could not be loaded. Try to mark default as selected.";
QListWidgetItem *item = listWidget_cardDeckStyles->item(0); QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(0);
if(item) { if(item) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
listWidget_cardDeckStyles->setCurrentItem(item); treeWidget_cardDeckStyles->setCurrentItem(item);
} }
} }
// refresh Card Deck Style Preview // refresh Card Deck Style Preview
showCurrentCardDeckStylePreview(); showCurrentCardDeckStylePreview();
//adjust column sizes for styles treeWidgets
treeWidget_gameTableStyles->resizeColumnToContents(0);
treeWidget_gameTableStyles->resizeColumnToContents(1);
treeWidget_gameTableStyles->resizeColumnToContents(2);
treeWidget_cardDeckStyles->resizeColumnToContents(0);
treeWidget_cardDeckStyles->resizeColumnToContents(1);
treeWidget_cardDeckStyles->resizeColumnToContents(2);
radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux")); radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux"));
radioButton_flipsideOwn->setChecked(myConfig->readConfigInt("FlipsideOwn")); radioButton_flipsideOwn->setChecked(myConfig->readConfigInt("FlipsideOwn"));
if(radioButton_flipsideOwn->isChecked()) { if(radioButton_flipsideOwn->isChecked()) {
@@ -591,35 +612,35 @@ void settingsDialogImpl::isAccepted() {
//save game table styles list //save game table styles list
myGameTableStylesList.clear(); myGameTableStylesList.clear();
int i; int i;
for(i=0; i < listWidget_gameTableStyles->count(); i++) { for(i=0; i < treeWidget_gameTableStyles->topLevelItemCount(); i++) {
QListWidgetItem *item = listWidget_gameTableStyles->item(i); QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(i);
if(item->data(16).toInt() == ADDITIONAL_STYLE) { if(item->data(0, 16).toInt() == ADDITIONAL_STYLE) {
myGameTableStylesList.push_back(item->data(15).toString().toUtf8().constData()); myGameTableStylesList.push_back(item->data(0, 15).toString().toUtf8().constData());
} }
} }
myConfig->writeConfigStringList("GameTableStylesList", myGameTableStylesList); myConfig->writeConfigStringList("GameTableStylesList", myGameTableStylesList);
//save current game table style //save current game table style
for(i=0; i < listWidget_gameTableStyles->count(); i++) { for(i=0; i < treeWidget_gameTableStyles->topLevelItemCount(); i++) {
QListWidgetItem *item = listWidget_gameTableStyles->item(i); QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(i);
if(!item->icon().isNull()) if(!item->icon(0).isNull())
myConfig->writeConfigString("CurrentGameTableStyle", item->data(15).toString().toUtf8().constData()); myConfig->writeConfigString("CurrentGameTableStyle", item->data(0, 15).toString().toUtf8().constData());
} }
// CARDS // CARDS
//save card deck styles list //save card deck styles list
myCardDeckStylesList.clear(); myCardDeckStylesList.clear();
int j; int j;
for(j=0; j < listWidget_cardDeckStyles->count(); j++) { for(j=0; j < treeWidget_cardDeckStyles->topLevelItemCount(); j++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(j); QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(j);
if(item->data(16).toInt() == ADDITIONAL_STYLE) { if(item->data(0, 16).toInt() == ADDITIONAL_STYLE) {
myCardDeckStylesList.push_back(item->data(15).toString().toUtf8().constData()); myCardDeckStylesList.push_back(item->data(0, 15).toString().toUtf8().constData());
} }
} }
myConfig->writeConfigStringList("CardDeckStylesList", myCardDeckStylesList); myConfig->writeConfigStringList("CardDeckStylesList", myCardDeckStylesList);
//save current card deck style //save current card deck style
for(j=0; j < listWidget_cardDeckStyles->count(); j++) { for(j=0; j < treeWidget_cardDeckStyles->topLevelItemCount(); j++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(j); QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(j);
if(!item->icon().isNull()) if(!item->icon(0).isNull())
myConfig->writeConfigString("CurrentCardDeckStyle", item->data(15).toString().toUtf8().constData()); myConfig->writeConfigString("CurrentCardDeckStyle", item->data(0, 15).toString().toUtf8().constData());
} }
//Sound //Sound
@@ -936,10 +957,10 @@ void settingsDialogImpl::toggleGroupBoxManualServerConfig(bool toggleState) {
void settingsDialogImpl::showCurrentGameTableStylePreview() void settingsDialogImpl::showCurrentGameTableStylePreview()
{ {
QListWidgetItem* item = listWidget_gameTableStyles->currentItem(); QTreeWidgetItem* item = treeWidget_gameTableStyles->currentItem();
if(item) { if(item) {
GameTableStyleReader style(myConfig, this); GameTableStyleReader style(myConfig, this);
style.readStyleFile(item->data(15).toString()); style.readStyleFile(item->data(0, 15).toString());
QPixmap preview(style.getPreview()); QPixmap preview(style.getPreview());
if(preview.height() > 160 || preview.width() > 120) label_gameTableStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation)); if(preview.height() > 160 || preview.width() > 120) label_gameTableStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation));
else label_gameTableStylePreview->setPixmap(preview); else label_gameTableStylePreview->setPixmap(preview);
@@ -973,7 +994,7 @@ void settingsDialogImpl::showCurrentGameTableStylePreview()
setSelectedGameTableStyleActivated(); setSelectedGameTableStyleActivated();
//disable remove button for distributed styles //disable remove button for distributed styles
if(item->data(16).toInt() == POKERTH_DISTRIBUTED_STYLE) { pushButton_removeGameTableStyle->setDisabled(TRUE); } if(item->data(0, 16).toInt() == POKERTH_DISTRIBUTED_STYLE) { pushButton_removeGameTableStyle->setDisabled(TRUE); }
else { pushButton_removeGameTableStyle->setDisabled(FALSE); } else { pushButton_removeGameTableStyle->setDisabled(FALSE); }
} }
@@ -981,15 +1002,15 @@ void settingsDialogImpl::showCurrentGameTableStylePreview()
void settingsDialogImpl::setSelectedGameTableStyleActivated() void settingsDialogImpl::setSelectedGameTableStyleActivated()
{ {
QListWidgetItem* selectedItem = listWidget_gameTableStyles->currentItem(); QTreeWidgetItem* selectedItem = treeWidget_gameTableStyles->currentItem();
if(selectedItem) { if(selectedItem) {
int i; int i;
for(i=0; i < listWidget_gameTableStyles->count(); i++) { for(i=0; i < treeWidget_gameTableStyles->topLevelItemCount(); i++) {
QListWidgetItem *item = listWidget_gameTableStyles->item(i); QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(i);
if(item == selectedItem) { if(item == selectedItem) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
} }
else item->setIcon(QIcon()); else item->setIcon(0, QIcon());
} }
} }
} }
@@ -1010,9 +1031,9 @@ void settingsDialogImpl::addGameTableStyle()
int i; int i;
bool fileNameAlreadyFound(FALSE); bool fileNameAlreadyFound(FALSE);
for(i=0; i < listWidget_gameTableStyles->count(); i++) { for(i=0; i < treeWidget_gameTableStyles->topLevelItemCount(); i++) {
QListWidgetItem *item = listWidget_gameTableStyles->item(i); QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(i);
if(item->data(15).toString() == fileName) if(item->data(0, 15).toString() == fileName)
fileNameAlreadyFound = TRUE; fileNameAlreadyFound = TRUE;
} }
@@ -1025,13 +1046,15 @@ void settingsDialogImpl::addGameTableStyle()
GameTableStyleReader newStyle(myConfig, this); GameTableStyleReader newStyle(myConfig, this);
newStyle.readStyleFile(fileName); newStyle.readStyleFile(fileName);
if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) { if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) {
MyStyleListItem *newItem = new MyStyleListItem(newStyle.getStyleDescription()); QStringList tempStringList1;
newItem->setData(15,fileName); tempStringList1 << newStyle.getStyleDescription() << newStyle.getStyleMaintainerName();
newItem->setData(16, ADDITIONAL_STYLE); MyStyleListItem *newItem = new MyStyleListItem(tempStringList1, treeWidget_gameTableStyles);
newItem->setData(Qt::ToolTipRole,fileName); newItem->setData(0, 15,fileName);
listWidget_gameTableStyles->addItem(newItem); newItem->setData(0, 16, ADDITIONAL_STYLE);
listWidget_gameTableStyles->setCurrentItem(newItem); newItem->setData(0, Qt::ToolTipRole,fileName);
listWidget_gameTableStyles->sortItems(Qt::AscendingOrder); treeWidget_gameTableStyles->addTopLevelItem(newItem);
treeWidget_gameTableStyles->setCurrentItem(newItem);
treeWidget_gameTableStyles->sortItems(0, Qt::AscendingOrder);
} }
else { else {
QMessageBox::warning(this, tr("Game Table Style File Error"), QMessageBox::warning(this, tr("Game Table Style File Error"),
@@ -1041,30 +1064,36 @@ void settingsDialogImpl::addGameTableStyle()
} }
//save current filepath //save current filepath
myConfig->writeConfigString("LastGameTableStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData()); myConfig->writeConfigString("LastGameTableStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData());
//adjust column sizes for styles treeWidgets
treeWidget_gameTableStyles->resizeColumnToContents(0);
treeWidget_gameTableStyles->resizeColumnToContents(1);
treeWidget_gameTableStyles->resizeColumnToContents(2);
} }
} }
void settingsDialogImpl::removeGameTableStyle() void settingsDialogImpl::removeGameTableStyle()
{ {
QListWidgetItem* selectedItem = listWidget_gameTableStyles->currentItem(); QTreeWidgetItem* selectedItem = treeWidget_gameTableStyles->currentItem();
//never delete PokerTH defaullt Styles //never delete PokerTH defaullt Styles
if(selectedItem && selectedItem->data(16).toInt() == ADDITIONAL_STYLE) { if(selectedItem && selectedItem->data(0, 16).toInt() == ADDITIONAL_STYLE) {
// if selected is activated --> swith activation to first default // if selected is activated --> swith activation to first default
if(!selectedItem->icon().isNull()) { if(!selectedItem->icon(0).isNull()) {
QListWidgetItem* firstItem = listWidget_gameTableStyles->item(0); QTreeWidgetItem* firstItem = treeWidget_gameTableStyles->topLevelItem(0);
firstItem->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); firstItem->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
} }
//remove from List //remove from List
listWidget_gameTableStyles->takeItem(listWidget_gameTableStyles->currentRow()); treeWidget_gameTableStyles->takeTopLevelItem(treeWidget_gameTableStyles->currentIndex().row());
} }
} }
void settingsDialogImpl::showCurrentCardDeckStylePreview() void settingsDialogImpl::showCurrentCardDeckStylePreview()
{ {
QListWidgetItem* item = listWidget_cardDeckStyles->currentItem(); QTreeWidgetItem* item = treeWidget_cardDeckStyles->currentItem();
if(item) { if(item) {
CardDeckStyleReader style(myConfig, this); CardDeckStyleReader style(myConfig, this);
style.readStyleFile(item->data(15).toString()); style.readStyleFile(item->data(0, 15).toString());
QPixmap preview(style.getPreview()); QPixmap preview(style.getPreview());
if(preview.height() > 160 || preview.width() > 120) label_cardDeckStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation)); if(preview.height() > 160 || preview.width() > 120) label_cardDeckStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation));
else label_cardDeckStylePreview->setPixmap(preview); else label_cardDeckStylePreview->setPixmap(preview);
@@ -1083,22 +1112,22 @@ void settingsDialogImpl::showCurrentCardDeckStylePreview()
setSelectedCardDeckStyleActivated(); setSelectedCardDeckStyleActivated();
//disable remove button for distributed styles //disable remove button for distributed styles
if(item->data(16).toInt() == POKERTH_DISTRIBUTED_STYLE) { pushButton_removeCardDeckStyle->setDisabled(TRUE); } if(item->data(0, 16).toInt() == POKERTH_DISTRIBUTED_STYLE) { pushButton_removeCardDeckStyle->setDisabled(TRUE); }
else { pushButton_removeCardDeckStyle->setDisabled(FALSE); } else { pushButton_removeCardDeckStyle->setDisabled(FALSE); }
} }
} }
void settingsDialogImpl::setSelectedCardDeckStyleActivated() void settingsDialogImpl::setSelectedCardDeckStyleActivated()
{ {
QListWidgetItem* selectedItem = listWidget_cardDeckStyles->currentItem(); QTreeWidgetItem* selectedItem = treeWidget_cardDeckStyles->currentItem();
if(selectedItem) { if(selectedItem) {
int i; int i;
for(i=0; i < listWidget_cardDeckStyles->count(); i++) { for(i=0; i < treeWidget_cardDeckStyles->topLevelItemCount(); i++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(i); QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(i);
if(item == selectedItem) { if(item == selectedItem) {
item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
} }
else item->setIcon(QIcon()); else item->setIcon(0, QIcon());
} }
} }
} }
@@ -1119,9 +1148,9 @@ void settingsDialogImpl::addCardDeckStyle()
int i; int i;
bool fileNameAlreadyFound(FALSE); bool fileNameAlreadyFound(FALSE);
for(i=0; i < listWidget_cardDeckStyles->count(); i++) { for(i=0; i < treeWidget_cardDeckStyles->topLevelItemCount(); i++) {
QListWidgetItem *item = listWidget_cardDeckStyles->item(i); QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(i);
if(item->data(15).toString() == fileName) if(item->data(0, 15).toString() == fileName)
fileNameAlreadyFound = TRUE; fileNameAlreadyFound = TRUE;
} }
@@ -1134,13 +1163,15 @@ void settingsDialogImpl::addCardDeckStyle()
CardDeckStyleReader newStyle(myConfig, this); CardDeckStyleReader newStyle(myConfig, this);
newStyle.readStyleFile(fileName); newStyle.readStyleFile(fileName);
if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) { if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) {
MyStyleListItem *newItem = new MyStyleListItem(newStyle.getStyleDescription()); QStringList tempStringList1;
newItem->setData(15,fileName); tempStringList1 << newStyle.getStyleDescription() << newStyle.getStyleMaintainerName();
newItem->setData(16, ADDITIONAL_STYLE); MyStyleListItem *newItem = new MyStyleListItem(tempStringList1, treeWidget_cardDeckStyles);
newItem->setData(Qt::ToolTipRole,fileName); newItem->setData(0, 15,fileName);
listWidget_cardDeckStyles->addItem(newItem); newItem->setData(0, 16, ADDITIONAL_STYLE);
listWidget_cardDeckStyles->setCurrentItem(newItem); newItem->setData(0, Qt::ToolTipRole,fileName);
listWidget_cardDeckStyles->sortItems(Qt::AscendingOrder); treeWidget_cardDeckStyles->addTopLevelItem(newItem);
treeWidget_cardDeckStyles->setCurrentItem(newItem);
treeWidget_cardDeckStyles->sortItems(0, Qt::AscendingOrder);
} }
else { else {
QMessageBox::warning(this, tr("Card Deck Style File Error"), QMessageBox::warning(this, tr("Card Deck Style File Error"),
@@ -1150,21 +1181,25 @@ void settingsDialogImpl::addCardDeckStyle()
} }
//save current filepath //save current filepath
myConfig->writeConfigString("LastCardDeckStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData()); myConfig->writeConfigString("LastCardDeckStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData());
treeWidget_cardDeckStyles->resizeColumnToContents(0);
treeWidget_cardDeckStyles->resizeColumnToContents(1);
treeWidget_cardDeckStyles->resizeColumnToContents(2);
} }
} }
void settingsDialogImpl::removeCardDeckStyle() void settingsDialogImpl::removeCardDeckStyle()
{ {
QListWidgetItem* selectedItem = listWidget_cardDeckStyles->currentItem(); QTreeWidgetItem* selectedItem = treeWidget_cardDeckStyles->currentItem();
//never delete PokerTH defaullt Styles //never delete PokerTH defaullt Styles
if(selectedItem && selectedItem->data(16).toInt() == ADDITIONAL_STYLE) { if(selectedItem && selectedItem->data(0, 16).toInt() == ADDITIONAL_STYLE) {
// if selected is activated --> swith activation to first default // if selected is activated --> swith activation to first default
if(!selectedItem->icon().isNull()) { if(!selectedItem->icon(0).isNull()) {
QListWidgetItem* firstItem = listWidget_cardDeckStyles->item(0); QTreeWidgetItem* firstItem = treeWidget_cardDeckStyles->topLevelItem(0);
firstItem->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); firstItem->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png"));
} }
//remove from List //remove from List
listWidget_cardDeckStyles->takeItem(listWidget_cardDeckStyles->currentRow()); treeWidget_cardDeckStyles->takeTopLevelItem(treeWidget_cardDeckStyles->currentIndex().row());
} }
} }
+23 -1
View File
@@ -171,6 +171,8 @@ void GameTableStyleReader::readStyleFile(QString file) {
else if (itemsList->ValueStr() == "Table") { Table = currentDir+QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "Table") { Table = currentDir+QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "HandRanking") { HandRanking = currentDir+QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "HandRanking") { HandRanking = currentDir+QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "ToolBoxBackground") { ToolBoxBackground = currentDir+QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "ToolBoxBackground") { ToolBoxBackground = currentDir+QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "ShowMyCardsButtonDefault") { ShowMyCardsButtonDefault = currentDir+QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "ShowMyCardsButtonHover") { ShowMyCardsButtonHover = currentDir+QString::fromUtf8(tempString1.c_str()); }
//I18N ACTION STRINGS //I18N ACTION STRINGS
else if (itemsList->ValueStr() == "ActionAllInI18NString") { ActionAllInI18NString = QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "ActionAllInI18NString") { ActionAllInI18NString = QString::fromUtf8(tempString1.c_str()); }
@@ -241,6 +243,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
else if (itemsList->ValueStr() == "BetSpeedSliderGrooveBorderColor") { BetSpeedSliderGrooveBorderColor = QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "BetSpeedSliderGrooveBorderColor") { BetSpeedSliderGrooveBorderColor = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "BetSpeedSliderHandleBgColor") { BetSpeedSliderHandleBgColor = QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "BetSpeedSliderHandleBgColor") { BetSpeedSliderHandleBgColor = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "BetSpeedSliderHandleBorderColor") { BetSpeedSliderHandleBorderColor = QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "BetSpeedSliderHandleBorderColor") { BetSpeedSliderHandleBorderColor = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "ShowMyCardsButtonTextColor") { ShowMyCardsButtonTextColor = QString::fromUtf8(tempString1.c_str()); }
// SIZES // SIZES
else if (itemsList->ValueStr() == "ChatLogTextSize") { ChatLogTextSize = QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "ChatLogTextSize") { ChatLogTextSize = QString::fromUtf8(tempString1.c_str()); }
} }
@@ -391,6 +394,13 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(ToolBoxBackground == "") { leftItems << "ToolBoxBackground"; } if(ToolBoxBackground == "") { leftItems << "ToolBoxBackground"; }
else if(ToolBoxBackground != QString(currentDir+"NULL") && !QFile(ToolBoxBackground).exists()) { itemPicsLeft << "ToolBoxBackground = "+ToolBoxBackground; } else if(ToolBoxBackground != QString(currentDir+"NULL") && !QFile(ToolBoxBackground).exists()) { itemPicsLeft << "ToolBoxBackground = "+ToolBoxBackground; }
if(ShowMyCardsButtonDefault == "") { leftItems << "ShowMyCardsButtonDefault"; }
else if(ShowMyCardsButtonDefault != QString(currentDir+"NULL") && !QFile(ShowMyCardsButtonDefault).exists()) { itemPicsLeft << "ShowMyCardsButtonDefault = "+ShowMyCardsButtonDefault; }
if(ShowMyCardsButtonHover == "") { leftItems << "ShowMyCardsButtonHover"; }
else if(ShowMyCardsButtonHover != QString(currentDir+"NULL") && !QFile(ShowMyCardsButtonHover).exists()) { itemPicsLeft << "ShowMyCardsButtonHover = "+ShowMyCardsButtonHover; }
//I18N ACTION STRINGS //I18N ACTION STRINGS
if(ActionAllInI18NString == "") { leftItems << "ActionAllInI18NString"; } if(ActionAllInI18NString == "") { leftItems << "ActionAllInI18NString"; }
if(ActionRaiseI18NString == "") { leftItems << "ActionRaiseI18NString"; } if(ActionRaiseI18NString == "") { leftItems << "ActionRaiseI18NString"; }
@@ -460,6 +470,8 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(BetSpeedSliderGrooveBorderColor == "") { leftItems << "BetSpeedSliderGrooveBorderColor"; } if(BetSpeedSliderGrooveBorderColor == "") { leftItems << "BetSpeedSliderGrooveBorderColor"; }
if(BetSpeedSliderHandleBgColor == "") { leftItems << "BetSpeedSliderHandleBgColor"; } if(BetSpeedSliderHandleBgColor == "") { leftItems << "BetSpeedSliderHandleBgColor"; }
if(BetSpeedSliderHandleBorderColor == "") { leftItems << "BetSpeedSliderHandleBorderColor"; } if(BetSpeedSliderHandleBorderColor == "") { leftItems << "BetSpeedSliderHandleBorderColor"; }
if(ShowMyCardsButtonTextColor == "") { leftItems << "ShowMyCardsButtonTextColor"; }
// SIZE // SIZE
if(ChatLogTextSize == "") { leftItems << "ChatLogTextSize"; } if(ChatLogTextSize == "") { leftItems << "ChatLogTextSize"; }
@@ -698,7 +710,7 @@ void GameTableStyleReader::setButtonsStyle(MyActionButton *br, MyActionButton *c
br->setMyStyle(this); br->setMyStyle(this);
cc->setMyStyle(this); cc->setMyStyle(this);
f->setMyStyle(this); f->setMyStyle(this);
a->setMyStyle(this); a->setMyStyle(this);
switch(state) { switch(state) {
//default //default
@@ -735,6 +747,16 @@ void GameTableStyleReader::setButtonsStyle(MyActionButton *br, MyActionButton *c
} }
break; break;
} }
}
void GameTableStyleReader::setShowMyCardsButtonStyle( MyActionButton *sc)
{
sc->setMyStyle(this);
//Show My Cards Button has same look and feel all the time
sc->setStyleSheet("QPushButton { border:none; background-image: url(\""+ShowMyCardsButtonDefault+"\"); "+ font2String +" font-size: "+humanPlayerButtonFontSize+"px; font-weight: bold; color: #"+ShowMyCardsButtonTextColor+";} QPushButton:unchecked { background-image: url(\""+ShowMyCardsButtonDefault+"\"); } QPushButton:checked { background-image: url(\""+BetRaiseButtonDefault+"\");} QPushButton:hover { background-image: url(\""+ShowMyCardsButtonHover+"\"); } QPushButton:checked:hover { background-image: url(\""+ShowMyCardsButtonHover+"\");}");
} }
void GameTableStyleReader::setToolBoxBackground(QGroupBox* gb) void GameTableStyleReader::setToolBoxBackground(QGroupBox* gb)
+6 -1
View File
@@ -104,7 +104,8 @@ public:
void setWindowsGeometry(gameTableImpl*); void setWindowsGeometry(gameTableImpl*);
//set pics and fonts and colors //set pics and fonts and colors
void setButtonsStyle(MyActionButton*, MyActionButton*, MyActionButton*, MyActionButton*, int); void setButtonsStyle(MyActionButton*, MyActionButton*, MyActionButton*, MyActionButton*, int);
void setShowMyCardsButtonStyle( MyActionButton *sc);
void setAwayRadioButtonsStyle(QRadioButton*); void setAwayRadioButtonsStyle(QRadioButton*);
QString getActionAllInI18NString() const { return ActionAllInI18NString; } QString getActionAllInI18NString() const { return ActionAllInI18NString; }
@@ -183,6 +184,8 @@ private:
QString Table; QString Table;
QString HandRanking; QString HandRanking;
QString ToolBoxBackground; QString ToolBoxBackground;
QString ShowMyCardsButtonDefault;
QString ShowMyCardsButtonHover;
// I18N ACTION STRINGS // I18N ACTION STRINGS
QString ActionAllInI18NString; QString ActionAllInI18NString;
@@ -253,6 +256,8 @@ private:
QString BetSpeedSliderGrooveBorderColor; QString BetSpeedSliderGrooveBorderColor;
QString BetSpeedSliderHandleBgColor; QString BetSpeedSliderHandleBgColor;
QString BetSpeedSliderHandleBorderColor; QString BetSpeedSliderHandleBorderColor;
QString ShowMyCardsButtonTextColor;
// SIZES // SIZES
QString ChatLogTextSize; QString ChatLogTextSize;