diff --git a/data/gfx/stylesheet.xml b/data/gfx/stylesheet.xml new file mode 100644 index 00000000..ce4d9ad3 --- /dev/null +++ b/data/gfx/stylesheet.xml @@ -0,0 +1,9 @@ + + + + + + + +
+
\ No newline at end of file diff --git a/pokerth_game.pro b/pokerth_game.pro index a3fedb05..6d149919 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -48,7 +48,8 @@ INCLUDEPATH += . \ src/gui/qt/changecompleteblindsdialog \ src/gui/qt/mymessagedialog \ src/gui/qt/gamelobbydialog \ - src/gui/qt/gamelobbydialog/lobbychat + src/gui/qt/gamelobbydialog/lobbychat \ + src/gui/qt/stylesheetreader DEPENDPATH += . \ src \ @@ -85,7 +86,8 @@ DEPENDPATH += . \ src/gui/qt/changecompleteblindsdialog \ src/gui/qt/mymessagedialog \ src/gui/qt/gamelobbydialog \ - src/gui/qt/gamelobbydialog/lobbychat + src/gui/qt/gamelobbydialog/lobbychat \ + src/gui/qt/stylesheetreader # Input HEADERS += \ @@ -170,6 +172,7 @@ HEADERS += \ src/gui/qttoolsinterface.h \ src/gui/qt/qttools/qttoolswrapper.h \ src/gui/qt/qttools/qthelper/qthelper.h \ + src/gui/qt/stylesheetreader/stylesheetreader.h \ src/gui/generic/serverguiwrapper.h FORMS += \ @@ -224,6 +227,7 @@ SOURCES += \ src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp \ src/gui/qt/gamelobbydialog/mygamelisttreewidget.cpp \ src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp \ + src/gui/qt/stylesheetreader/stylesheetreader.cpp \ src/net/common/net_helper_client.cpp \ src/core/common/loghelper_client.cpp @@ -234,14 +238,14 @@ TRANSLATIONS = \ ts/pokerth_ru.ts \ ts/pokerth_no.ts \ ts/pokerth_sk.ts \ - ts/pokerth_eo.ts \ ts/pokerth_hu.ts \ ts/pokerth_pl.ts \ ts/pokerth_ptbr.ts \ ts/pokerth_it.ts \ ts/pokerth_tr.ts \ ts/pokerth_sv.ts \ - ts/pokerth_nl.ts + ts/pokerth_nl.ts \ + ts/pokerth_START_HERE.ts win32{ DEPENDPATH += src/net/win32/ src/core/win32 diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 2d3c7c59..0f58842b 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -48,6 +48,7 @@ #include "configfile.h" #include "sdlplayer.h" +#include "stylesheetreader.h" #include #include @@ -81,6 +82,9 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) //Sound mySDLPlayer = new SDLPlayer(myConfig); + //styleSheetReader + myStyleSheetReader = new StyleSheetReader(QString(myAppDataPath+"gfx/stylesheet.xml").toStdString()); + //Player0 pixmapCardsLabel needs Myw pixmapLabel_card0b->setMyW(this); pixmapLabel_card0a->setMyW(this); @@ -330,8 +334,8 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) #endif - textBrowser_Log->setStyleSheet("QTextBrowser { "+ font1String +" font-size: "+textBrowserFontsize+"px; color: #F0F0F0; background-color: #1D3B00; border:none; } QScrollBar:vertical { border: 1px solid #104600; background: #135000; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #1B7200; background: #176400; min-height: 20px; } QScrollBar::add-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 1px; border-top-left-radius: 1px; border: 1px solid #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: bottom; subcontrol-origin: margin; } QScrollBar::sub-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px; border-top-right-radius: 2px; border-top-left-radius: 2px; border: 1px solid #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #208A00; height: 3px; width: 3px; background: #27A800; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); - textBrowser_Chat->setStyleSheet("QTextBrowser { "+ font1String +" font-size: "+textBrowserFontsize+"px; color: #F0F0F0; background-color: #1D3B00; border:none; } QScrollBar:vertical { border: 1px solid #104600; background: #135000; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #1B7200; background: #176400; min-height: 20px; } QScrollBar::add-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 1px; border-top-left-radius: 1px; border: 1px solid #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: bottom; subcontrol-origin: margin; } QScrollBar::sub-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px; border-top-right-radius: 2px; border-top-left-radius: 2px; border: 1px solid #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #208A00; height: 3px; width: 3px; background: #27A800; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); + textBrowser_Log->setStyleSheet("QTextBrowser { "+ font1String +" font-size: "+textBrowserFontsize+"px; color: #"+QString::fromUtf8(myStyleSheetReader->readColorString("TextBrowserLogFont").c_str())+"; background-color: #1D3B00; border:none; } QScrollBar:vertical { border: 1px solid #104600; background: #135000; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #1B7200; background: #176400; min-height: 20px; } QScrollBar::add-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 1px; border-top-left-radius: 1px; border: 1px solid #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: bottom; subcontrol-origin: margin; } QScrollBar::sub-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px; border-top-right-radius: 2px; border-top-left-radius: 2px; border: 1px solid #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #208A00; height: 3px; width: 3px; background: #27A800; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); + textBrowser_Chat->setStyleSheet("QTextBrowser { "+ font1String +" font-size: "+textBrowserFontsize+"px; color: #"+QString::fromUtf8(myStyleSheetReader->readColorString("TextBrowserChatFont").c_str())+"; background-color: #1D3B00; border:none; } QScrollBar:vertical { border: 1px solid #104600; background: #135000; width: 15px; margin: 17px -1px 17px 0px; } QScrollBar::handle:vertical { border-radius: 1px; border: 1px solid #1B7200; background: #176400; min-height: 20px; } QScrollBar::add-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 1px; border-top-left-radius: 1px; border: 1px solid #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: bottom; subcontrol-origin: margin; } QScrollBar::sub-line:vertical { margin-right: 0px; margin-left: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px; border-top-right-radius: 2px; border-top-left-radius: 2px; border: 1px solid #1E7F00; background: #1A6F00; height: 15px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 1px solid #208A00; height: 3px; width: 3px; background: #27A800; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); lineEdit_ChatInput->setStyleSheet("QLineEdit { "+ font1String +" font-size: "+textBrowserFontsize+"px; color: #F0F0F0; background-color: #1D3B00; border-top: 2px solid #286400; }"); diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index 34a7966a..3fe077bd 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -53,6 +53,7 @@ class gameLobbyDialogImpl; class QColor; class SDLPlayer; +class StyleSheetReader; class mainWindowImpl: public QMainWindow, public Ui::mainWindow { @@ -457,7 +458,8 @@ private: int keyUpDownChatCounter; int myLastPreActionBetValue; - + + StyleSheetReader *myStyleSheetReader; friend class GuiWrapper; }; diff --git a/src/gui/qt/stylesheetreader/stylesheetreader.cpp b/src/gui/qt/stylesheetreader/stylesheetreader.cpp new file mode 100644 index 00000000..1eb644d1 --- /dev/null +++ b/src/gui/qt/stylesheetreader/stylesheetreader.cpp @@ -0,0 +1,79 @@ +/*************************************************************************** + * 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 "stylesheetreader.h" +#include +#include +#include +#include + + +using namespace std; + +StyleSheetReader::StyleSheetReader(std::string f) : styleSheetFileName(f) +{ + fillBuffer(); +} + + +StyleSheetReader::~StyleSheetReader() +{ +} + +void StyleSheetReader::fillBuffer() { + + boost::recursive_mutex::scoped_lock lock(m_configMutex); + + string tempString1(""); + + TiXmlDocument doc(styleSheetFileName); + + if(doc.LoadFile()) { + TiXmlHandle docHandle( &doc ); + + TiXmlElement* colorList = docHandle.FirstChild( "PokerTH" ).FirstChild( "Table" ).FirstChild( "Colors" ).FirstChild().ToElement(); + + for( ; colorList; colorList=colorList->NextSiblingElement()) { + const char *tmpStr1 = colorList->Attribute("value"); + if (tmpStr1) { + tempString1 = tmpStr1; + colorsBufferList.push_back(Colors(colorList->ValueStr(), tempString1)); +// cout << colorList->ValueStr() << " : " << tempString1 << endl; + } + } + } +} + + +string StyleSheetReader::readColorString(string varName) const +{ + boost::recursive_mutex::scoped_lock lock(m_configMutex); + + size_t i; + string tempString(""); + + for (i=0; i +#include + +#include + + +class StyleSheetReader{ +public: + StyleSheetReader(std::string f); + ~StyleSheetReader(); + + void fillBuffer(); + + std::string readColorString(std::string varName) const; + +private: + + mutable boost::recursive_mutex m_configMutex; + + struct Colors + { + Colors(const std::string &n, const std::string &v) : name(n), value(v) {} + std::string name; + std::string value; + }; + + std::vector colorsBufferList; + + std::string styleSheetFileName; +}; + +#endif