some gui tweaks concerning android package
This commit is contained in:
+38
-23
@@ -1,25 +1,40 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<manifest android:versionCode="1" package="org.kde.necessitas.example.pokerth" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0">
|
<manifest package="org.qtproject.example" android:versionName="1.1" xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="1">
|
||||||
<application android:name="org.kde.necessitas.origo.QtApplication" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/icon" android:label="@string/app_name">
|
<application android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="PokerTH" android:icon="@drawable/icon">
|
||||||
<activity android:name="org.kde.necessitas.origo.QtActivity" android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden" android:screenOrientation="landscape" android:label="@string/app_name">
|
<activity android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="PokerTH" android:screenOrientation="landscape" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
<meta-data android:name="android.app.lib_name" android:value="pokerth"/>
|
||||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||||
<meta-data android:name="android.app.lib_name" android:value="pokerth"/>
|
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||||
<!-- Messages maps -->
|
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||||
<meta-data android:name="android.app.ministro_not_found_msg" android:value="@string/ministro_not_found_msg"/>
|
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||||
<meta-data android:name="android.app.ministro_needed_msg" android:value="@string/ministro_needed_msg"/>
|
<!-- Deploy Qt libs as part of package -->
|
||||||
<meta-data android:name="android.app.fatal_error_msg" android:value="@string/fatal_error_msg"/>
|
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||||
<!-- Messages maps -->
|
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||||
<!-- Splash screen -->
|
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||||
<meta-data android:name="android.app.splash_screen" android:resource="@layout/splash"/>
|
<!-- Run with local libs -->
|
||||||
<!-- Splash screen -->
|
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||||
</activity>
|
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||||
</application>
|
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
||||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="false"/>
|
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<!-- Messages maps -->
|
||||||
|
<meta-data android:name="android.app.ministro_not_found_msg" android:value="@string/ministro_not_found_msg"/>
|
||||||
|
<meta-data android:name="android.app.ministro_needed_msg" android:value="@string/ministro_needed_msg"/>
|
||||||
|
<meta-data android:name="android.app.fatal_error_msg" android:value="@string/fatal_error_msg"/>
|
||||||
|
<!-- Messages maps -->
|
||||||
|
<!-- Splash screen -->
|
||||||
|
<meta-data android:name="android.app.splash_screen" android:resource="@layout/splash"/>
|
||||||
|
<!-- Splash screen -->
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19"/>
|
||||||
|
<supports-screens android:smallScreens="true" android:anyDensity="true" android:largeScreens="true" android:normalScreens="true"/>
|
||||||
|
<!-- %%INSERT_PERMISSIONS -->
|
||||||
|
<!-- %%INSERT_FEATURES -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
Binary file not shown.
@@ -67,6 +67,13 @@
|
|||||||
#define FORMATLEFT(X) "<p align='center'>(X)"
|
#define FORMATLEFT(X) "<p align='center'>(X)"
|
||||||
#define FORMATRIGHT(X) "(X)</p>"
|
#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;
|
using namespace std;
|
||||||
|
|
||||||
gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||||
@@ -499,16 +506,6 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
// QString windowIconString();
|
// QString windowIconString();
|
||||||
this->setWindowIcon(QIcon(myAppDataPath+"gfx/gui/misc/windowicon.png"));
|
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
|
// Dialogs
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myChat = new ChatTools(tabs.lineEdit_ChatInput, myConfig, INGAME_CHAT, tabs.textBrowser_Chat);
|
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
|
//hide left and right icon and menubar from maemo gui for ANDROID
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
fullscreenButton->hide();
|
fullscreenButton->hide();
|
||||||
menubar->hide();
|
this->setMenuBar(0);
|
||||||
// tabsButton->hide();
|
#else
|
||||||
|
tabs.pushButton_settings->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Connects
|
//Connects
|
||||||
@@ -575,14 +573,20 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
connect(voteOnKickTimeoutTimer, SIGNAL(timeout()), this, SLOT(nextVoteOnKickTimeoutAnimationFrame()));
|
connect(voteOnKickTimeoutTimer, SIGNAL(timeout()), this, SLOT(nextVoteOnKickTimeoutAnimationFrame()));
|
||||||
connect(enableCallCheckPushButtonTimer, SIGNAL(timeout()), this, SLOT(enableCallCheckPushButton()));
|
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() ) );
|
connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
connect( actionClose, SIGNAL( triggered() ), this, SLOT( closeGameTable()) );
|
connect( actionClose, SIGNAL( triggered() ), this, SLOT( closeGameTable()) );
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
connect( fullscreenButton, SIGNAL( clicked() ), this, SLOT( switchFullscreen() ) );
|
connect( fullscreenButton, SIGNAL( clicked() ), this, SLOT( switchFullscreen() ) );
|
||||||
#else
|
#else
|
||||||
connect( actionFullScreen, SIGNAL( triggered() ), this, SLOT( switchFullscreen() ) );
|
connect( actionFullScreen, SIGNAL( triggered() ), this, SLOT( switchFullscreen() ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect( actionShowHideChat, SIGNAL( triggered() ), this, SLOT( switchChatWindow() ) );
|
connect( actionShowHideChat, SIGNAL( triggered() ), this, SLOT( switchChatWindow() ) );
|
||||||
connect( actionShowHideHelp, SIGNAL( triggered() ), this, SLOT( switchHelpWindow() ) );
|
connect( actionShowHideHelp, SIGNAL( triggered() ), this, SLOT( switchHelpWindow() ) );
|
||||||
connect( actionShowHideLog, SIGNAL( triggered() ), this, SLOT( switchLogWindow() ) );
|
connect( actionShowHideLog, SIGNAL( triggered() ), this, SLOT( switchLogWindow() ) );
|
||||||
@@ -4305,6 +4309,15 @@ void gameTableImpl::restoreGameTableGeometry()
|
|||||||
this->resize(myConfig->readConfigInt("GameTableWidthSave"), myConfig->readConfigInt("GameTableHeightSave"));
|
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*/)
|
void gameTableImpl::netClientPlayerLeft(unsigned /*playerId*/)
|
||||||
@@ -4501,3 +4514,23 @@ void gameTableImpl::pingUpdate(unsigned minPing, unsigned avgPing, unsigned maxP
|
|||||||
label_Avatar0->refreshPing(minPing, avgPing, maxPing);
|
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
|
#endif
|
||||||
void refreshSpectatorsDisplay();
|
void refreshSpectatorsDisplay();
|
||||||
void pingUpdate(unsigned, unsigned, unsigned);
|
void pingUpdate(unsigned, unsigned, unsigned);
|
||||||
|
int getAndroidApiVersion();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ myMessageDialogImpl::myMessageDialogImpl(ConfigFile *c, QWidget *parent)
|
|||||||
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
||||||
#endif
|
#endif
|
||||||
setupUi(this);
|
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)
|
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
|
#endif
|
||||||
|
|
||||||
/////// can be removed for non-qt-guis ////////////
|
/////// can be removed for non-qt-guis ////////////
|
||||||
|
#ifdef ANDROID
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
a.setApplicationName("PokerTH");
|
||||||
|
#else
|
||||||
SharedTools::QtSingleApplication a( "PokerTH", argc, argv );
|
SharedTools::QtSingleApplication a( "PokerTH", argc, argv );
|
||||||
|
|
||||||
if (a.sendMessage("Wake up!")) {
|
if (a.sendMessage("Wake up!")) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//create defaultconfig
|
//create defaultconfig
|
||||||
ConfigFile *myConfig = new ConfigFile(argv[0], false);
|
ConfigFile *myConfig = new ConfigFile(argv[0], false);
|
||||||
@@ -116,8 +120,6 @@ int main( int argc, char **argv )
|
|||||||
//set QApplication default font
|
//set QApplication default font
|
||||||
|
|
||||||
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/n019003l.pfb");
|
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");
|
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/DejaVuSans-Bold.ttf");
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -132,7 +134,7 @@ int main( int argc, char **argv )
|
|||||||
p.setColor(QPalette::Base, QColor::fromRgb(80,80,80));
|
p.setColor(QPalette::Base, QColor::fromRgb(80,80,80));
|
||||||
p.setColor(QPalette::Window, QColor::fromRgb(50,50,50));
|
p.setColor(QPalette::Window, QColor::fromRgb(50,50,50));
|
||||||
p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255));
|
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::WindowText, QColor::fromRgb(255,255,255));
|
||||||
p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100));
|
p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100));
|
||||||
p.setColor(QPalette::Text, QColor::fromRgb(255,255,255));
|
p.setColor(QPalette::Text, QColor::fromRgb(255,255,255));
|
||||||
@@ -230,7 +232,6 @@ int main( int argc, char **argv )
|
|||||||
QTranslator qtTranslator;
|
QTranslator qtTranslator;
|
||||||
qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language")));
|
qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language")));
|
||||||
a.installTranslator(&qtTranslator);
|
a.installTranslator(&qtTranslator);
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
translator.load(QString(myAppDataPath +"translations/pokerth_") + QString::fromStdString(myConfig->readConfigString("Language")));
|
translator.load(QString(myAppDataPath +"translations/pokerth_") + QString::fromStdString(myConfig->readConfigString("Language")));
|
||||||
a.installTranslator(&translator);
|
a.installTranslator(&translator);
|
||||||
@@ -242,14 +243,13 @@ int main( int argc, char **argv )
|
|||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
startWindowImpl mainWin(myConfig,myLog);
|
startWindowImpl mainWin(myConfig,myLog);
|
||||||
|
#ifdef ANDROID
|
||||||
|
mainWin.show();
|
||||||
|
#else
|
||||||
a.setActivationWindow(&mainWin, true);
|
a.setActivationWindow(&mainWin, true);
|
||||||
|
#endif
|
||||||
int retVal = a.exec();
|
int retVal = a.exec();
|
||||||
|
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
socket_cleanup();
|
socket_cleanup();
|
||||||
|
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user