external stylesheet file for easier gui skinning introduced
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<PokerTH>
|
||||||
|
<Table>
|
||||||
|
<Colors>
|
||||||
|
<TextBrowserChatFont value="F0F0F0" />
|
||||||
|
<TextBrowserLogFont value="F0F0F0" />
|
||||||
|
</Colors>
|
||||||
|
</Table>
|
||||||
|
</PokerTH>
|
||||||
+8
-4
@@ -48,7 +48,8 @@ INCLUDEPATH += . \
|
|||||||
src/gui/qt/changecompleteblindsdialog \
|
src/gui/qt/changecompleteblindsdialog \
|
||||||
src/gui/qt/mymessagedialog \
|
src/gui/qt/mymessagedialog \
|
||||||
src/gui/qt/gamelobbydialog \
|
src/gui/qt/gamelobbydialog \
|
||||||
src/gui/qt/gamelobbydialog/lobbychat
|
src/gui/qt/gamelobbydialog/lobbychat \
|
||||||
|
src/gui/qt/stylesheetreader
|
||||||
|
|
||||||
DEPENDPATH += . \
|
DEPENDPATH += . \
|
||||||
src \
|
src \
|
||||||
@@ -85,7 +86,8 @@ DEPENDPATH += . \
|
|||||||
src/gui/qt/changecompleteblindsdialog \
|
src/gui/qt/changecompleteblindsdialog \
|
||||||
src/gui/qt/mymessagedialog \
|
src/gui/qt/mymessagedialog \
|
||||||
src/gui/qt/gamelobbydialog \
|
src/gui/qt/gamelobbydialog \
|
||||||
src/gui/qt/gamelobbydialog/lobbychat
|
src/gui/qt/gamelobbydialog/lobbychat \
|
||||||
|
src/gui/qt/stylesheetreader
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
@@ -170,6 +172,7 @@ HEADERS += \
|
|||||||
src/gui/qttoolsinterface.h \
|
src/gui/qttoolsinterface.h \
|
||||||
src/gui/qt/qttools/qttoolswrapper.h \
|
src/gui/qt/qttools/qttoolswrapper.h \
|
||||||
src/gui/qt/qttools/qthelper/qthelper.h \
|
src/gui/qt/qttools/qthelper/qthelper.h \
|
||||||
|
src/gui/qt/stylesheetreader/stylesheetreader.h \
|
||||||
src/gui/generic/serverguiwrapper.h
|
src/gui/generic/serverguiwrapper.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
@@ -224,6 +227,7 @@ SOURCES += \
|
|||||||
src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp \
|
src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp \
|
||||||
src/gui/qt/gamelobbydialog/mygamelisttreewidget.cpp \
|
src/gui/qt/gamelobbydialog/mygamelisttreewidget.cpp \
|
||||||
src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp \
|
src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp \
|
||||||
|
src/gui/qt/stylesheetreader/stylesheetreader.cpp \
|
||||||
src/net/common/net_helper_client.cpp \
|
src/net/common/net_helper_client.cpp \
|
||||||
src/core/common/loghelper_client.cpp
|
src/core/common/loghelper_client.cpp
|
||||||
|
|
||||||
@@ -234,14 +238,14 @@ TRANSLATIONS = \
|
|||||||
ts/pokerth_ru.ts \
|
ts/pokerth_ru.ts \
|
||||||
ts/pokerth_no.ts \
|
ts/pokerth_no.ts \
|
||||||
ts/pokerth_sk.ts \
|
ts/pokerth_sk.ts \
|
||||||
ts/pokerth_eo.ts \
|
|
||||||
ts/pokerth_hu.ts \
|
ts/pokerth_hu.ts \
|
||||||
ts/pokerth_pl.ts \
|
ts/pokerth_pl.ts \
|
||||||
ts/pokerth_ptbr.ts \
|
ts/pokerth_ptbr.ts \
|
||||||
ts/pokerth_it.ts \
|
ts/pokerth_it.ts \
|
||||||
ts/pokerth_tr.ts \
|
ts/pokerth_tr.ts \
|
||||||
ts/pokerth_sv.ts \
|
ts/pokerth_sv.ts \
|
||||||
ts/pokerth_nl.ts
|
ts/pokerth_nl.ts \
|
||||||
|
ts/pokerth_START_HERE.ts
|
||||||
|
|
||||||
win32{
|
win32{
|
||||||
DEPENDPATH += src/net/win32/ src/core/win32
|
DEPENDPATH += src/net/win32/ src/core/win32
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "sdlplayer.h"
|
#include "sdlplayer.h"
|
||||||
|
#include "stylesheetreader.h"
|
||||||
|
|
||||||
#include <gamedata.h>
|
#include <gamedata.h>
|
||||||
#include <generic/serverguiwrapper.h>
|
#include <generic/serverguiwrapper.h>
|
||||||
@@ -81,6 +82,9 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
//Sound
|
//Sound
|
||||||
mySDLPlayer = new SDLPlayer(myConfig);
|
mySDLPlayer = new SDLPlayer(myConfig);
|
||||||
|
|
||||||
|
//styleSheetReader
|
||||||
|
myStyleSheetReader = new StyleSheetReader(QString(myAppDataPath+"gfx/stylesheet.xml").toStdString());
|
||||||
|
|
||||||
//Player0 pixmapCardsLabel needs Myw
|
//Player0 pixmapCardsLabel needs Myw
|
||||||
pixmapLabel_card0b->setMyW(this);
|
pixmapLabel_card0b->setMyW(this);
|
||||||
pixmapLabel_card0a->setMyW(this);
|
pixmapLabel_card0a->setMyW(this);
|
||||||
@@ -330,8 +334,8 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
#endif
|
#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_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: #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: #"+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; }");
|
lineEdit_ChatInput->setStyleSheet("QLineEdit { "+ font1String +" font-size: "+textBrowserFontsize+"px; color: #F0F0F0; background-color: #1D3B00; border-top: 2px solid #286400; }");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class gameLobbyDialogImpl;
|
|||||||
|
|
||||||
class QColor;
|
class QColor;
|
||||||
class SDLPlayer;
|
class SDLPlayer;
|
||||||
|
class StyleSheetReader;
|
||||||
|
|
||||||
|
|
||||||
class mainWindowImpl: public QMainWindow, public Ui::mainWindow {
|
class mainWindowImpl: public QMainWindow, public Ui::mainWindow {
|
||||||
@@ -457,7 +458,8 @@ private:
|
|||||||
|
|
||||||
int keyUpDownChatCounter;
|
int keyUpDownChatCounter;
|
||||||
int myLastPreActionBetValue;
|
int myLastPreActionBetValue;
|
||||||
|
|
||||||
|
StyleSheetReader *myStyleSheetReader;
|
||||||
|
|
||||||
friend class GuiWrapper;
|
friend class GuiWrapper;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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 <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
|
||||||
|
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<colorsBufferList.size(); i++) {
|
||||||
|
|
||||||
|
if (colorsBufferList[i].name == varName) {
|
||||||
|
tempString = colorsBufferList[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempString;
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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. *
|
||||||
|
***************************************************************************/
|
||||||
|
#ifndef STYLESHEETREADER_H
|
||||||
|
#define STYLESHEETREADER_H
|
||||||
|
|
||||||
|
#include "tinyxml.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
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<Colors> colorsBufferList;
|
||||||
|
|
||||||
|
std::string styleSheetFileName;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user