extended infobox system
This commit is contained in:
@@ -48,7 +48,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
||||
myQtToolsInterface = CreateQtToolsWrapper();
|
||||
|
||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||
configRev = 81;
|
||||
configRev = 82;
|
||||
|
||||
//standard defaults
|
||||
logOnOffDefault = "1";
|
||||
@@ -270,8 +270,8 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
||||
configList.push_back(ConfigInfo("InternetLoginMode", CONFIG_TYPE_INT, "0"));
|
||||
configList.push_back(ConfigInfo("InternetLoginPassword", CONFIG_TYPE_STRING, ""));
|
||||
configList.push_back(ConfigInfo("InternetSavePassword", CONFIG_TYPE_INT, "0"));
|
||||
configList.push_back(ConfigInfo("IfInfoMessageShowList", CONFIG_TYPE_STRING_LIST, "Msg"));
|
||||
|
||||
|
||||
//fill tempList firstTime
|
||||
configBufferList = configList;
|
||||
|
||||
|
||||
@@ -3064,26 +3064,21 @@ void gameTableImpl::leaveCurrentNetworkGame() {
|
||||
|
||||
if (myStartWindow->getSession()->isNetworkClientRunning()) {
|
||||
|
||||
if(myConfig->readConfigInt("DisableBackToLobbyWarning")) {
|
||||
|
||||
assert(myStartWindow->getSession());
|
||||
myStartWindow->getSession()->sendLeaveCurrentGame();
|
||||
// T O D O !!!!!!! anzeigen? aus myMessageDialog auslesen per Config!!!!!!! T O D O
|
||||
|
||||
myMessageDialogImpl dialog(myConfig, this);
|
||||
|
||||
if(!dialog.checkIfMesssageWillBeDisplayed(1)) {
|
||||
|
||||
assert(myStartWindow->getSession());
|
||||
myStartWindow->getSession()->sendLeaveCurrentGame();
|
||||
}
|
||||
else {
|
||||
myMessageDialogImpl dialog(this);
|
||||
dialog.setWindowTitle(tr("PokerTH - Internet Game Message"));
|
||||
dialog.label_icon->setPixmap(QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/logoChip3D.png")).scaled(50,50,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
dialog.label->setText(tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"));
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted ) {
|
||||
|
||||
if(dialog.checkBox->isChecked()) {
|
||||
myConfig->writeConfigInt("DisableBackToLobbyWarning",1);
|
||||
myConfig->writeBuffer();
|
||||
}
|
||||
assert(myStartWindow->getSession());
|
||||
myStartWindow->getSession()->sendLeaveCurrentGame();
|
||||
}
|
||||
if (dialog.exec(1, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), "PokerTH - Internet Game Message", QPixmap(":/gfx/logoChip3D.png")) == QDialog::Accepted ) {
|
||||
assert(myStartWindow->getSession());
|
||||
myStartWindow->getSession()->sendLeaveCurrentGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,18 @@
|
||||
***************************************************************************/
|
||||
#include "mymessagedialogimpl.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include "configfile.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
|
||||
myMessageDialogImpl::myMessageDialogImpl(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
using namespace std;
|
||||
|
||||
|
||||
myMessageDialogImpl::myMessageDialogImpl(ConfigFile *c, QWidget *parent)
|
||||
: QDialog(parent), myConfig(c), currentMsgId(0)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
setWindowModality(Qt::ApplicationModal);
|
||||
@@ -29,3 +38,104 @@ myMessageDialogImpl::myMessageDialogImpl(QWidget *parent)
|
||||
#endif
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap pix)
|
||||
{
|
||||
bool show = false;
|
||||
bool found = false;
|
||||
|
||||
currentMsgId = messageId;
|
||||
|
||||
currentMsgShowList = myConfig->readConfigStringList("IfInfoMessageShowList");
|
||||
list<std::string>::iterator it1;
|
||||
for(it1= currentMsgShowList.begin(); it1 != currentMsgShowList.end(); it1++) {
|
||||
|
||||
QString tmpString = QString::fromUtf8(it1->c_str());
|
||||
if(QString("%1").arg(messageId) == tmpString.split(",").at(1)) {
|
||||
|
||||
found = true;
|
||||
show = tmpString.split(",").at(0).toInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
currentMsgShowList.push_back(QString("1,%1").arg(messageId).toUtf8().constData());
|
||||
myConfig->writeConfigStringList("IfInfoMessageShowList", currentMsgShowList);
|
||||
myConfig->writeBuffer();
|
||||
}
|
||||
|
||||
if(!found || show) {
|
||||
|
||||
setWindowTitle(title);
|
||||
label_icon->setPixmap(pix.scaled(50,50,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
label->setText(msg);
|
||||
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void myMessageDialogImpl::accept()
|
||||
{
|
||||
writeConfig();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void myMessageDialogImpl::reject()
|
||||
{
|
||||
writeConfig();
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void myMessageDialogImpl::writeConfig()
|
||||
{
|
||||
qDebug() << "jo1";
|
||||
if(checkBox->isChecked()) {
|
||||
|
||||
list<std::string>::iterator it1;
|
||||
for(it1= currentMsgShowList.begin(); it1 != currentMsgShowList.end(); it1++) {
|
||||
|
||||
QString tmpString = QString::fromUtf8(it1->c_str());
|
||||
if(QString("%1").arg(currentMsgId) == tmpString.split(",").at(1)) {
|
||||
|
||||
qDebug() << "jo2" << QString("0,%1").arg(currentMsgId).toUtf8().constData();
|
||||
(*it1) = QString("0,%1").arg(currentMsgId).toUtf8().constData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
myConfig->writeConfigStringList("IfInfoMessageShowList", currentMsgShowList);
|
||||
myConfig->writeBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
bool myMessageDialogImpl::checkIfMesssageWillBeDisplayed(int id)
|
||||
{
|
||||
bool found = false;
|
||||
bool show = true;
|
||||
|
||||
currentMsgShowList = myConfig->readConfigStringList("IfInfoMessageShowList");
|
||||
list<std::string>::iterator it1;
|
||||
for(it1= currentMsgShowList.begin(); it1 != currentMsgShowList.end(); it1++) {
|
||||
|
||||
QString tmpString = QString::fromUtf8(it1->c_str());
|
||||
if(QString("%1").arg(id) == tmpString.split(",").at(1)) {
|
||||
|
||||
found = true;
|
||||
show = tmpString.split(",").at(0).toInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
currentMsgShowList.push_back(QString("1,%1").arg(id).toUtf8().constData());
|
||||
myConfig->writeConfigStringList("IfInfoMessageShowList", currentMsgShowList);
|
||||
myConfig->writeBuffer();
|
||||
}
|
||||
|
||||
return show;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,27 @@
|
||||
|
||||
#include "ui_mymessagedialog.h"
|
||||
|
||||
class ConfigFile;
|
||||
|
||||
class myMessageDialogImpl: public QDialog, public Ui::myMessageDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
myMessageDialogImpl(QWidget *parent = 0);
|
||||
|
||||
myMessageDialogImpl(ConfigFile *, QWidget *parent = 0);
|
||||
|
||||
public slots:
|
||||
|
||||
bool checkIfMesssageWillBeDisplayed(int id);
|
||||
int exec(int messageId, QString msg, QString title, QPixmap pix);
|
||||
void accept();
|
||||
void reject();
|
||||
void writeConfig();
|
||||
|
||||
private:
|
||||
|
||||
ConfigFile *myConfig;
|
||||
int currentMsgId;
|
||||
std::list<std::string> currentMsgShowList;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -40,6 +40,7 @@
|
||||
<file>list-remove.png</file>
|
||||
<file>transform-rotate.png</file>
|
||||
<file>player_play.png</file>
|
||||
<file>logoChip3D.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/cflags">
|
||||
<file>cflags/ad.png</file>
|
||||
|
||||
Reference in New Issue
Block a user