additional fix for settingsdialog, new Logs button also for desktops

This commit is contained in:
doitux
2012-12-24 11:28:00 +01:00
parent 3ae4ded536
commit 59e329789a
3 changed files with 61 additions and 44 deletions
@@ -83,7 +83,7 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
comboBox_switchLanguage->addItem(QString(tr("Turkish")+" "+QString::fromUtf8("(Tϋrkçe)")),"tr");
#ifdef ANDROID
connect( pushButton_ok, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
connect( pushButton_ok, SIGNAL( clicked() ), this, SLOT( isAccepted() ) );
#else
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
#endif
+19 -2
View File
@@ -162,6 +162,23 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="pushButton_Logs">
<property name="text">
<string>&amp;5 Logs</string>
</property>
<property name="icon">
<iconset resource="resources/pokerth_android.qrc">
<normaloff>:/gfx/text-x-log.png</normaloff>:/gfx/text-x-log.png</iconset>
</property>
<property name="iconSize">
<size>
<width>37</width>
<height>32</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
@@ -198,7 +215,7 @@
<x>0</x>
<y>0</y>
<width>450</width>
<height>24</height>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuPokerTH">
@@ -215,7 +232,6 @@
<addaction name="actionStart_Local_Game"/>
<addaction name="actionInternet_Game"/>
<addaction name="menuNetwork_Game"/>
<addaction name="actionLogs"/>
<addaction name="actionAbout_PokerTH"/>
<addaction name="actionQuit"/>
</widget>
@@ -309,6 +325,7 @@
</widget>
<resources>
<include location="resources/pokerth.qrc"/>
<include location="resources/pokerth_android.qrc"/>
</resources>
<connections>
<connection>
+41 -41
View File
@@ -83,49 +83,50 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
this->setStatusBar(0);
#ifdef GUI_800x480
#ifdef ANDROID
this->menubar->hide();
#ifdef ANDROID
this->menubar->hide();
//check if custom background picture for the resolution is there. Otherwise create it!
QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str());
QDesktopWidget dw;
int screenWidth = dw.screenGeometry().width();
int screenHeight = dw.screenGeometry().height();
QString customStartWindowBgFileString(UserDataDir+"/startwindowbg_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
QFile customStartWindowBgFile(customStartWindowBgFileString);
if(customStartWindowBgFile.exists()) {
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
} else {
QPixmap pix(":/android/android-data/gfx/gui/misc/startwindowbg_800x480.png");
pix = pix.scaled(screenWidth, screenHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if(pix.save(customStartWindowBgFileString)) {
//check if custom background picture for the resolution is there. Otherwise create it!
QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str());
QDesktopWidget dw;
int screenWidth = dw.screenGeometry().width();
int screenHeight = dw.screenGeometry().height();
QString customStartWindowBgFileString(UserDataDir+"/startwindowbg_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
QFile customStartWindowBgFile(customStartWindowBgFileString);
if(customStartWindowBgFile.exists()) {
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
} else {
centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg_800x480.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
}
QPixmap pix(":/android/android-data/gfx/gui/misc/startwindowbg_800x480.png");
pix = pix.scaled(screenWidth, screenHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if(pix.save(customStartWindowBgFileString)) {
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
} else {
centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg_800x480.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
}
}
this->showFullScreen();
//TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(TRUE)
#ifndef ANDROID_TEST
JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
JNIEnv* env;
if (currVM->AttachCurrentThread(&env, NULL)<0) {
qCritical()<<"AttachCurrentThread failed";
} else {
// jclass jclassApplicationClass = env->FindClass("android/view/View");
// if (jclassApplicationClass) {
// env->SetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"KEEP_SCREEN_ON", "I"), 1);
// }
currVM->DetachCurrentThread();
}
this->showFullScreen();
//TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(TRUE)
#ifndef ANDROID_TEST
JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
JNIEnv* env;
if (currVM->AttachCurrentThread(&env, NULL)<0) {
qCritical()<<"AttachCurrentThread failed";
} else {
// jclass jclassApplicationClass = env->FindClass("android/view/View");
// if (jclassApplicationClass) {
// env->SetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"KEEP_SCREEN_ON", "I"), 1);
// }
currVM->DetachCurrentThread();
}
#endif
#else
// Maemo
this->menubar->hide();
centralwidget->setStyleSheet(".QWidget { background-image: url(\""+myAppDataPath+"gfx/gui/misc/startwindowbg_800x480.png\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
#endif
#else
// this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:20px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }");
this->menubar->hide();
centralwidget->setStyleSheet(".QWidget { background-image: url(\""+myAppDataPath+"gfx/gui/misc/startwindowbg_800x480.png\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
#endif
// All mobile GUI's
pushButtonStart_Local_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
pushButtonInternet_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
pushButton_Create_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
@@ -136,23 +137,22 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
connect( pushButton_about, SIGNAL( clicked() ), this, SLOT( callAboutPokerthDialog() ) );
connect( pushButton_configure, SIGNAL( clicked() ), this, SLOT( callSettingsDialogFromStartwindow() ) );
connect( pushButton_Logs, SIGNAL( clicked() ), this, SLOT( callLogFileDialog() ) );
#else
//Desktop
this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:12px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }");
centralwidget->setStyleSheet(".QWidget { background-image: url(\""+myAppDataPath+"gfx/gui/misc/startwindowbg.png\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
pushButtonStart_Local_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}");
pushButtonInternet_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}");
pushButton_Create_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}");
pushButton_Join_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}");
pushButton_Logs->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}");
connect( actionAbout_PokerTH, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) );
connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialogFromStartwindow() ) );
#endif
// Dialogs
myNewGameDialog = new newGameDialogImpl(this, myConfig);
mySelectAvatarDialog = new selectAvatarDialogImpl(this, myConfig);
@@ -182,7 +182,7 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
connect( pushButton_Create_Network_Game, SIGNAL( clicked() ), this, SLOT( callCreateNetworkGameDialog() ) );
connect( actionJoin_Network_Game, SIGNAL( triggered() ), this, SLOT( callJoinNetworkGameDialog() ) );
connect( pushButton_Join_Network_Game, SIGNAL( clicked() ), this, SLOT( callJoinNetworkGameDialog() ) );
connect( actionLogs, SIGNAL( triggered() ), this, SLOT( callLogFileDialog() ) );
connect( pushButton_Logs, SIGNAL( clicked() ), this, SLOT( callLogFileDialog() ) );
connect(this, SIGNAL(signalShowClientDialog()), this, SLOT(showClientDialog()));