fix Qt Database error message when close the app
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1694
-1686
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
connectToServerDialogImpl* getMyConnectToServerDialog() const { return myConnectToServerDialog; }
|
||||
|
||||
// void keyPressEvent( QKeyEvent *);
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
signals:
|
||||
void signalShowClientDialog();
|
||||
|
||||
Reference in New Issue
Block a user