some gui tweaks concerning android package
This commit is contained in:
@@ -67,6 +67,13 @@
|
||||
#define FORMATLEFT(X) "<p align='center'>(X)"
|
||||
#define FORMATRIGHT(X) "(X)</p>"
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifndef ANDROID_TEST
|
||||
#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include <jni.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
@@ -499,16 +506,6 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
// QString windowIconString();
|
||||
this->setWindowIcon(QIcon(myAppDataPath+"gfx/gui/misc/windowicon.png"));
|
||||
|
||||
//Statusbar
|
||||
if(myConfig->readConfigInt("ShowStatusbarMessages")) {
|
||||
|
||||
#ifdef __APPLE__
|
||||
// statusBar()->showMessage(tr("Cmd+N to start a new game"));
|
||||
#else
|
||||
// statusBar()->showMessage(tr("Ctrl+N to start a new game"));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Dialogs
|
||||
#ifdef GUI_800x480
|
||||
myChat = new ChatTools(tabs.lineEdit_ChatInput, myConfig, INGAME_CHAT, tabs.textBrowser_Chat);
|
||||
@@ -529,8 +526,9 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
//hide left and right icon and menubar from maemo gui for ANDROID
|
||||
#ifdef ANDROID
|
||||
fullscreenButton->hide();
|
||||
menubar->hide();
|
||||
// tabsButton->hide();
|
||||
this->setMenuBar(0);
|
||||
#else
|
||||
tabs.pushButton_settings->hide();
|
||||
#endif
|
||||
|
||||
//Connects
|
||||
@@ -575,14 +573,20 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
connect(voteOnKickTimeoutTimer, SIGNAL(timeout()), this, SLOT(nextVoteOnKickTimeoutAnimationFrame()));
|
||||
connect(enableCallCheckPushButtonTimer, SIGNAL(timeout()), this, SLOT(enableCallCheckPushButton()));
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
connect( tabs.pushButton_settings, SIGNAL( clicked() ), this, SLOT( callSettingsDialog() ) );
|
||||
#else
|
||||
connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) );
|
||||
#endif
|
||||
|
||||
connect( actionClose, SIGNAL( triggered() ), this, SLOT( closeGameTable()) );
|
||||
|
||||
#ifdef GUI_800x480
|
||||
connect( fullscreenButton, SIGNAL( clicked() ), this, SLOT( switchFullscreen() ) );
|
||||
#else
|
||||
connect( actionFullScreen, SIGNAL( triggered() ), this, SLOT( switchFullscreen() ) );
|
||||
#endif
|
||||
|
||||
connect( actionShowHideChat, SIGNAL( triggered() ), this, SLOT( switchChatWindow() ) );
|
||||
connect( actionShowHideHelp, SIGNAL( triggered() ), this, SLOT( switchHelpWindow() ) );
|
||||
connect( actionShowHideLog, SIGNAL( triggered() ), this, SLOT( switchLogWindow() ) );
|
||||
@@ -4305,6 +4309,15 @@ void gameTableImpl::restoreGameTableGeometry()
|
||||
this->resize(myConfig->readConfigInt("GameTableWidthSave"), myConfig->readConfigInt("GameTableHeightSave"));
|
||||
}
|
||||
}
|
||||
#ifdef ANDROID
|
||||
if(getAndroidApiVersion() == 10) {
|
||||
QDesktopWidget dw;
|
||||
int availableWidth = dw.screenGeometry().width();
|
||||
int availableHeight = dw.screenGeometry().height();
|
||||
this->showNormal();
|
||||
this->setGeometry(0,0,availableWidth, availableHeight);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void gameTableImpl::netClientPlayerLeft(unsigned /*playerId*/)
|
||||
@@ -4501,3 +4514,23 @@ void gameTableImpl::pingUpdate(unsigned minPing, unsigned avgPing, unsigned maxP
|
||||
label_Avatar0->refreshPing(minPing, avgPing, maxPing);
|
||||
}
|
||||
|
||||
int gameTableImpl::getAndroidApiVersion()
|
||||
{
|
||||
int api = -1;
|
||||
#ifdef ANDROID
|
||||
#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
|
||||
#endif
|
||||
return api;
|
||||
}
|
||||
|
||||
@@ -377,6 +377,7 @@ public slots:
|
||||
#endif
|
||||
void refreshSpectatorsDisplay();
|
||||
void pingUpdate(unsigned, unsigned, unsigned);
|
||||
int getAndroidApiVersion();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -47,6 +47,10 @@ myMessageDialogImpl::myMessageDialogImpl(ConfigFile *c, QWidget *parent)
|
||||
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
||||
#endif
|
||||
setupUi(this);
|
||||
|
||||
#ifdef ANDROID
|
||||
this->setWindowState(Qt::WindowFullScreen);
|
||||
#endif
|
||||
}
|
||||
|
||||
int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons, bool showCheckBox)
|
||||
|
||||
+10
-10
@@ -97,11 +97,15 @@ int main( int argc, char **argv )
|
||||
#endif
|
||||
|
||||
/////// can be removed for non-qt-guis ////////////
|
||||
#ifdef ANDROID
|
||||
QApplication a(argc, argv);
|
||||
a.setApplicationName("PokerTH");
|
||||
#else
|
||||
SharedTools::QtSingleApplication a( "PokerTH", argc, argv );
|
||||
|
||||
if (a.sendMessage("Wake up!")) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//create defaultconfig
|
||||
ConfigFile *myConfig = new ConfigFile(argv[0], false);
|
||||
@@ -116,8 +120,6 @@ int main( int argc, char **argv )
|
||||
//set QApplication default font
|
||||
|
||||
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/n019003l.pfb");
|
||||
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/VeraBd.ttf");
|
||||
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/c059013l.pfb");
|
||||
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/DejaVuSans-Bold.ttf");
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -132,7 +134,7 @@ int main( int argc, char **argv )
|
||||
p.setColor(QPalette::Base, QColor::fromRgb(80,80,80));
|
||||
p.setColor(QPalette::Window, QColor::fromRgb(50,50,50));
|
||||
p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255));
|
||||
p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(100,100,100));
|
||||
p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(130,130,130));
|
||||
p.setColor(QPalette::WindowText, QColor::fromRgb(255,255,255));
|
||||
p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100));
|
||||
p.setColor(QPalette::Text, QColor::fromRgb(255,255,255));
|
||||
@@ -230,7 +232,6 @@ int main( int argc, char **argv )
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language")));
|
||||
a.installTranslator(&qtTranslator);
|
||||
|
||||
QTranslator translator;
|
||||
translator.load(QString(myAppDataPath +"translations/pokerth_") + QString::fromStdString(myConfig->readConfigString("Language")));
|
||||
a.installTranslator(&translator);
|
||||
@@ -242,14 +243,13 @@ int main( int argc, char **argv )
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
startWindowImpl mainWin(myConfig,myLog);
|
||||
#ifdef ANDROID
|
||||
mainWin.show();
|
||||
#else
|
||||
a.setActivationWindow(&mainWin, true);
|
||||
|
||||
#endif
|
||||
int retVal = a.exec();
|
||||
|
||||
curl_global_cleanup();
|
||||
socket_cleanup();
|
||||
|
||||
|
||||
return retVal;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user