some gui tweaks concerning android package
This commit is contained in:
+38
-23
@@ -1,25 +1,40 @@
|
||||
<?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">
|
||||
<application android:name="org.kde.necessitas.origo.QtApplication" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
<activity android:name="org.kde.necessitas.origo.QtActivity" android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden" android:screenOrientation="landscape" android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<meta-data android:name="android.app.lib_name" android:value="pokerth"/>
|
||||
<!-- 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>
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="false"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<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: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.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>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.lib_name" android:value="pokerth"/>
|
||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||
<!-- 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>
|
||||
|
||||
Binary file not shown.
@@ -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