fix Qt Database error message when close the app

This commit is contained in:
doitux
2010-07-13 19:13:38 +00:00
parent a78a9e80ea
commit b34dcdc597
8 changed files with 1724 additions and 1693 deletions
+5 -5
View File
@@ -22,9 +22,9 @@
Replay::Replay() : replaySqliteLogDb(0)
{
replaySqliteLogDb = new QSqlDatabase();
*replaySqliteLogDb = QSqlDatabase::addDatabase("QSQLITE");
// replaySqliteLogDb = new QSqlDatabase();
//
// *replaySqliteLogDb = QSqlDatabase::addDatabase("QSQLITE");
//replaySqliteLogDb->setDatabaseName(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".pdb");
//if(!mySqliteLogDb->open()) {
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
@@ -35,7 +35,7 @@ Replay::Replay() : replaySqliteLogDb(0)
Replay::~Replay()
{
replaySqliteLogDb->close();
delete replaySqliteLogDb;
// replaySqliteLogDb->close();
// delete replaySqliteLogDb;
}
+1
View File
@@ -37,6 +37,7 @@ public:
void setSession(boost::shared_ptr<Session> session);
gameTableImpl* getMyW() const {return NULL;}
Log* getMyLog() const {return NULL;}
void refreshSet() const;
void refreshCash() const;
+3 -1
View File
@@ -27,7 +27,7 @@
#include <string>
#include <boost/shared_ptr.hpp>
class Log;
class Session;
class gameTableImpl;
@@ -41,6 +41,8 @@ public:
virtual void setSession(boost::shared_ptr<Session> session) =0;
virtual gameTableImpl *getMyW() const=0;
virtual Log* getMyLog() const=0;
//refresh-Funktionen
virtual void refreshSet() const=0;
File diff suppressed because it is too large Load Diff
+2
View File
@@ -40,6 +40,8 @@ public:
~Log();
public slots:
bool closeLogDb();
void logPlayerActionMsg(QString playerName, int playerID, int action, int setValue);
void logNewGameHandMsg(int gameID, int handID);
void logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName);
+2 -1
View File
@@ -43,7 +43,8 @@ public:
boost::shared_ptr<Session> getSession();
void setSession(boost::shared_ptr<Session> session);
gameTableImpl* getMyW() const { return myW; }
gameTableImpl* getMyW() const { return myW; }
Log* getMyLog() const { return myLog; }
void refreshSet() const;
void refreshCash() const;
@@ -26,6 +26,7 @@
#include <net/socket_msg.h>
#include "tools.h"
#include "log.h"
#include "session.h"
#include "game.h"
#include "guiwrapper.h"
@@ -68,6 +69,7 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
// #endif
setupUi(this);
this->setWindowTitle(QString(tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
this->installEventFilter(this);
//Widgets Grafiken per Stylesheets setzen
QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
@@ -936,3 +938,17 @@ QString startWindowImpl::checkForFirstStartAfterUpdated()
return QString();
}
bool startWindowImpl::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::Close) {
event->ignore();
myGuiInterface->getMyLog()->closeLogDb();
return QMainWindow::eventFilter(obj, event);
}
else {
// pass the event on to the parent class
return QMainWindow::eventFilter(obj, event);
}
}
+1
View File
@@ -58,6 +58,7 @@ public:
connectToServerDialogImpl* getMyConnectToServerDialog() const { return myConnectToServerDialog; }
// void keyPressEvent( QKeyEvent *);
bool eventFilter(QObject *obj, QEvent *event);
signals:
void signalShowClientDialog();