multiple changes (like backbutton handling fixes) for android releases 1.1.1

This commit is contained in:
doitux
2014-05-27 08:04:47 +02:00
parent f3c86990c9
commit c1d7266e50
10 changed files with 77 additions and 22 deletions
+1 -1
View File
@@ -35,7 +35,7 @@
#ifdef ANDROID
#ifndef ANDROID_TEST
#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h"
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
#include <jni.h>
#endif
#endif
@@ -133,7 +133,7 @@ bool changeCompleteBlindsDialogImpl::eventFilter(QObject *obj, QEvent *event)
event->ignore();
return false;
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
this->reject();
event->ignore();
return true;
} else {
// pass the event on to the parent class
@@ -139,7 +139,7 @@ bool changeContentDialogImpl::eventFilter(QObject *obj, QEvent *event)
event->ignore();
return false;
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
this->reject();
event->ignore();
return true;
} else {
// pass the event on to the parent class
@@ -284,8 +284,7 @@ bool createInternetGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
event->ignore();
this->reject();
return false;
return true;
} else {
// pass the event on to the parent class
return QDialog::eventFilter(obj, event);
@@ -160,8 +160,7 @@ bool createNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
return false;
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
event->ignore();
this->reject();
return false;
return true;
} else {
// pass the event on to the parent class
return QDialog::eventFilter(obj, event);
@@ -1412,8 +1412,7 @@ bool gameLobbyDialogImpl::eventFilter(QObject *obj, QEvent *event)
return QDialog::eventFilter(obj, event);
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
event->ignore();
this->reject();
return false;
return true;
} else {
// pass the event on to the parent class
return QDialog::eventFilter(obj, event);
+39 -12
View File
@@ -155,10 +155,18 @@ void LogFileDialog::exportLogToHtml()
if(selectedItem) {
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"),
QDir::homePath()+"/"+fi.baseName()+".html",
tr("PokerTH HTML log (*.html)"));
QFileDialog dlg(this, tr("Export PokerTH log file to HTML"),
QDir::homePath()+"/"+fi.baseName()+".html",
tr("PokerTH HTML log (*.html)"));
dlg.setFileMode(QFileDialog::AnyFile);
dlg.setAcceptMode(QFileDialog::AcceptSave);
#ifdef ANDROID
dlg.setWindowState(Qt::WindowFullScreen);
#endif
QString fileName;
if(dlg.exec()) {
fileName = dlg.selectedFiles().first();
}
if(!fileName.isEmpty()) {
myGuiLog->exportLogPdbToHtml(selectedItem->data(0, Qt::UserRole).toString(),fileName);
}
@@ -171,10 +179,18 @@ void LogFileDialog::exportLogToTxt()
if(selectedItem) {
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"),
QDir::homePath()+"/"+fi.baseName()+".txt",
tr("PokerTH plain text log (*.txt)"));
QFileDialog dlg(this, tr("Export PokerTH log file to plain text"),
QDir::homePath()+"/"+fi.baseName()+".txt",
tr("PokerTH plain text log (*.txt)"));
dlg.setFileMode(QFileDialog::AnyFile);
dlg.setAcceptMode(QFileDialog::AcceptSave);
#ifdef ANDROID
dlg.setWindowState(Qt::WindowFullScreen);
#endif
QString fileName;
if(dlg.exec()) {
fileName = dlg.selectedFiles().first();
}
if(!fileName.isEmpty()) {
myGuiLog->exportLogPdbToTxt(selectedItem->data(0, Qt::UserRole).toString(),fileName);
}
@@ -187,10 +203,18 @@ void LogFileDialog::saveLogFileAs()
if(selectedItem) {
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
QString fileName = QFileDialog::getSaveFileName(this, tr("Save PokerTH log file"),
QDir::homePath()+"/"+fi.baseName()+".pdb",
tr("PokerTH SQL log (*.pdb)"));
QFileDialog dlg(this, tr("Save PokerTH log file"),
QDir::homePath()+"/"+fi.baseName()+".pdb",
tr("PokerTH SQL log (*.pdb)"));
dlg.setFileMode(QFileDialog::AnyFile);
dlg.setAcceptMode(QFileDialog::AcceptSave);
#ifdef ANDROID
dlg.setWindowState(Qt::WindowFullScreen);
#endif
QString fileName;
if(dlg.exec()) {
fileName = dlg.selectedFiles().first();
}
if(!fileName.isEmpty()) {
QFile::copy(selectedItem->data(0, Qt::UserRole).toString(), fileName);
}
@@ -228,6 +252,9 @@ void LogFileDialog::keyPressEvent ( QKeyEvent * event )
ui->pushButton_deleteLog->click();
}
}
else {
QDialog::keyPressEvent(event);
}
}
void LogFileDialog::uploadFile()
@@ -240,6 +240,7 @@ void startNetworkGameDialogImpl::keyPressEvent ( QKeyEvent * event )
} else {
keyUpDownChatCounter = 0;
}
QDialog::keyPressEvent(event);
}
bool startNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
+1 -1
View File
@@ -1332,7 +1332,7 @@ void GameTableStyleReader::showOutdatedErrorMessage()
void GameTableStyleReader::setTableBackground(gameTableImpl *gt)
{
gt->setStyleSheet("QMainWindow { background-image: url(\""+Table+"\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
gt->centralWidget()->setStyleSheet(".QWidget { background-image: url(\""+Table+"\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
}
void GameTableStyleReader::setChatLogStyle(QTextBrowser *tb)
+30
View File
@@ -75,6 +75,13 @@
#define ENABLE_LEAK_CHECK()
#endif
// #ifdef ANDROID
// #ifndef ANDROID_TEST
// // #include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
// // #include <jni.h>
// #endif
// #endif
using namespace std;
class startWindowImpl;
@@ -246,6 +253,29 @@ int main( int argc, char **argv )
startWindowImpl mainWin(myConfig,myLog);
#ifdef ANDROID
// //Do not start if API is smaller than x
// int api = -2;
// #ifndef ANDROID_TEST
// JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForIntegration("JavaVM");
// JNIEnv* env;
// if (currVM->AttachCurrentThread(&env, NULL)<0) {
// qCritical()<<"AttachCurrentThread failed";
// } else {
// jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION");
// if (jclassApplicationClass) {
// api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I"));
// }
// currVM->DetachCurrentThread();
// }
// #endif
// Test api and maybe do not start for further android releases
// if(api < 14) {
// QMessageBox box(QMessageBox::Critical, "PokerTH Error", "Sorry, PokerTH needs Android version 4.0 or above to start", QMessageBox::Ok);
// box.show();
// }
// else {
// mainWin.show();
// }
mainWin.show();
#else
a.setActivationWindow(&mainWin, true);