diff --git a/pokerth.pro b/pokerth.pro index b63a1c81..181b1e2d 100755 --- a/pokerth.pro +++ b/pokerth.pro @@ -6,3 +6,33 @@ SUBDIRS = pokerth_protocol.pro pokerth_db.pro pokerth_lib.pro pokerth_game.pro SUBDIRS += pokerth_server.pro chatcleaner.pro } CONFIG += ordered + +OTHER_FILES += \ + android/src/org/kde/necessitas/ministro/IMinistro.aidl \ + android/src/org/kde/necessitas/ministro/IMinistroCallback.aidl \ + android/src/org/qtproject/qt5/android/bindings/QtActivity.java \ + android/src/org/qtproject/qt5/android/bindings/QtApplication.java \ + android/res/values-pl/strings.xml \ + android/res/values-es/strings.xml \ + android/res/values-it/strings.xml \ + android/res/values-ru/strings.xml \ + android/res/values-et/strings.xml \ + android/res/values-rs/strings.xml \ + android/res/values-ja/strings.xml \ + android/res/values-fa/strings.xml \ + android/res/values-ro/strings.xml \ + android/res/values-zh-rTW/strings.xml \ + android/res/values-nl/strings.xml \ + android/res/values-zh-rCN/strings.xml \ + android/res/values-pt-rBR/strings.xml \ + android/res/values-el/strings.xml \ + android/res/layout/splash.xml \ + android/res/values-fr/strings.xml \ + android/res/values-id/strings.xml \ + android/res/values-ms/strings.xml \ + android/res/values-de/strings.xml \ + android/res/values-nb/strings.xml \ + android/res/values/strings.xml \ + android/res/values/libs.xml \ + android/version.xml \ + android/AndroidManifest.xml diff --git a/pokerth_game.pro b/pokerth_game.pro index d579c643..09f47258 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -18,6 +18,7 @@ CONFIG += qt \ warn_on include(src/third_party/qtsingleapplication/qtsingleapplication.pri) QT += sql +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets UI_DIR = uics MOC_DIR = mocs OBJECTS_DIR = obj @@ -412,8 +413,8 @@ unix:!mac { $${PREFIX}/lib64 } android{ - LIBPATH += $${PREFIX}/lib/armv5 - LIB_DIRS = $${PREFIX}/lib/armv5 + LIBPATH += $${PREFIX}/lib/armv7 + LIB_DIRS = $${PREFIX}/lib/armv7 } BOOST_FS = boost_filesystem \ boost_filesystem-mt @@ -635,7 +636,7 @@ gui_800x480 { android{ # Use old boost::filesystem, because the new version requires std::wstring. - DEFINES += BOOST_FILESYSTEM_VERSION=2 + DEFINES += BOOST_FILESYSTEM_VERSION=3 # sqlite3 is included directly. INCLUDEPATH += src/third_party/sqlite3 diff --git a/pokerth_lib.pro b/pokerth_lib.pro index 213976fc..f58b9199 100644 --- a/pokerth_lib.pro +++ b/pokerth_lib.pro @@ -255,7 +255,7 @@ mac{ android{ # Use old boost::filesystem, because the new version requires std::wstring. - DEFINES += BOOST_FILESYSTEM_VERSION=2 + DEFINES += BOOST_FILESYSTEM_VERSION=3 # sqlite3 is included directly. INCLUDEPATH += src/third_party/sqlite3 SOURCES += src/third_party/sqlite3/sqlite3.c diff --git a/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp b/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp index 8c945413..316f3a0c 100755 --- a/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp +++ b/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp @@ -35,7 +35,7 @@ #ifdef ANDROID #ifndef ANDROID_TEST - #include + #include "QtGui/5.1.0/QtGui/qpa/qplatformnativeinterface.h" #include #endif #endif @@ -72,7 +72,7 @@ aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c) #ifdef ANDROID int api = -2; #ifndef ANDROID_TEST - JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0); + JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForIntegration("JavaVM"); JNIEnv* env; if (currVM->AttachCurrentThread(&env, NULL)<0) { qCritical()<<"AttachCurrentThread failed"; diff --git a/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp b/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp index 2b2d5aca..c75dc6bf 100644 --- a/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp +++ b/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp @@ -35,7 +35,7 @@ changeCompleteBlindsDialogImpl::changeCompleteBlindsDialogImpl(QWidget *parent, ConfigFile *c) - : QDialog(parent), myConfig(c), settingsCorrect(TRUE) + : QDialog(parent), myConfig(c), settingsCorrect(true) { #ifdef __APPLE__ setWindowModality(Qt::ApplicationModal); @@ -50,11 +50,9 @@ changeCompleteBlindsDialogImpl::changeCompleteBlindsDialogImpl(QWidget *parent, } -void changeCompleteBlindsDialogImpl::exec() +int changeCompleteBlindsDialogImpl::exec() { - - - QDialog::exec(); + return QDialog::exec(); } void changeCompleteBlindsDialogImpl::updateSpinBoxInputMinimum(int value) @@ -88,7 +86,7 @@ void changeCompleteBlindsDialogImpl::sortBlindsList() int i; QList tempIntList; QStringList tempStringList; - bool ok = TRUE; + bool ok = true; for(i=0; icount(); i++) { // std::cout << listWidget_blinds->item(i)->text().toInt(&ok,10) << "\n"; diff --git a/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.h b/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.h index 37fd4c96..3dd465a8 100644 --- a/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.h +++ b/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.h @@ -48,7 +48,7 @@ class changeCompleteBlindsDialogImpl: public QDialog, public Ui::changeCompleteB public: changeCompleteBlindsDialogImpl(QWidget *parent = 0, ConfigFile *c = 0); - void exec(); + int exec(); bool eventFilter(QObject *obj, QEvent *event); public slots: diff --git a/src/gui/qt/chattools/chattools.h b/src/gui/qt/chattools/chattools.h index 2fde45e1..a5391e88 100644 --- a/src/gui/qt/chattools/chattools.h +++ b/src/gui/qt/chattools/chattools.h @@ -33,6 +33,7 @@ #include #include +#include #include #include diff --git a/src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.cpp b/src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.cpp index 19dae39e..c4714d21 100644 --- a/src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.cpp +++ b/src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.cpp @@ -41,12 +41,12 @@ connectToServerDialogImpl::connectToServerDialogImpl(QWidget *parent) setupUi(this); } -void connectToServerDialogImpl::exec() +int connectToServerDialogImpl::exec() { label_actionMessage->setText(""); progressBar->setValue(0); - QDialog::exec(); + return QDialog::exec(); } void connectToServerDialogImpl::refresh(int actionID) diff --git a/src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.h b/src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.h index 1d47e0aa..801a13ee 100644 --- a/src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.h +++ b/src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.h @@ -47,7 +47,7 @@ class connectToServerDialogImpl: public QDialog, public Ui::connectToServerDialo public: connectToServerDialogImpl(QWidget *parent = 0); - void exec(); + int exec(); public slots: diff --git a/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp b/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp index bd5dd387..0ae6fe04 100644 --- a/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp +++ b/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp @@ -143,7 +143,7 @@ void createInternetGameDialogImpl::callChangeBlindsDialog(bool show) myChangeCompleteBlindsDialog->exec(); if(myChangeCompleteBlindsDialog->result() == QDialog::Accepted ) {} else { - radioButton_useSavedBlindsSettings->setChecked(TRUE); + radioButton_useSavedBlindsSettings->setChecked(true); } } @@ -155,9 +155,9 @@ void createInternetGameDialogImpl::gameTypeChanged() switch (comboBox_gameType->currentIndex()) { case GAME_TYPE_NORMAL-1: { - checkBox_Password->setDisabled(FALSE); - spinBox_startCash->setDisabled(FALSE); - spinBox_quantityPlayers->setDisabled(FALSE); + checkBox_Password->setDisabled(false); + spinBox_startCash->setDisabled(false); + spinBox_quantityPlayers->setDisabled(false); spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers")); spinBox_startCash->setValue(myConfig->readConfigInt("NetStartCash")); radioButton_useSavedBlindsSettings->show(); @@ -168,9 +168,9 @@ void createInternetGameDialogImpl::gameTypeChanged() break; case GAME_TYPE_REGISTERED_ONLY-1: { - checkBox_Password->setDisabled(FALSE); - spinBox_startCash->setDisabled(FALSE); - spinBox_quantityPlayers->setDisabled(FALSE); + checkBox_Password->setDisabled(false); + spinBox_startCash->setDisabled(false); + spinBox_quantityPlayers->setDisabled(false); spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers")); spinBox_startCash->setValue(myConfig->readConfigInt("NetStartCash")); radioButton_useSavedBlindsSettings->show(); @@ -180,10 +180,10 @@ void createInternetGameDialogImpl::gameTypeChanged() } break; case GAME_TYPE_INVITE_ONLY-1: { - checkBox_Password->setChecked(FALSE); - checkBox_Password->setDisabled(TRUE); - spinBox_startCash->setDisabled(FALSE); - spinBox_quantityPlayers->setDisabled(FALSE); + checkBox_Password->setChecked(false); + checkBox_Password->setDisabled(true); + spinBox_startCash->setDisabled(false); + spinBox_quantityPlayers->setDisabled(false); spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers")); spinBox_startCash->setValue(myConfig->readConfigInt("NetStartCash")); radioButton_useSavedBlindsSettings->show(); @@ -194,13 +194,13 @@ void createInternetGameDialogImpl::gameTypeChanged() } break; case GAME_TYPE_RANKING-1: { - checkBox_Password->setChecked(FALSE); - checkBox_Password->setDisabled(TRUE); + checkBox_Password->setChecked(false); + checkBox_Password->setDisabled(true); spinBox_startCash->setValue(RANKING_GAME_START_CASH); - spinBox_startCash->setDisabled(TRUE); + spinBox_startCash->setDisabled(true); spinBox_quantityPlayers->setValue(RANKING_GAME_NUMBER_OF_PLAYERS); - spinBox_quantityPlayers->setDisabled(TRUE); + spinBox_quantityPlayers->setDisabled(true); radioButton_useSavedBlindsSettings->hide(); radioButton_changeBlindsSettings->hide(); startBlind->show(); @@ -213,11 +213,11 @@ void createInternetGameDialogImpl::gameTypeChanged() if(comboBox_gameType->currentIndex() == GAME_TYPE_RANKING-1) { //set static values myChangeCompleteBlindsDialog->spinBox_firstSmallBlind->setValue(RANKING_GAME_START_SBLIND); - myChangeCompleteBlindsDialog->radioButton_raiseBlindsAtHands->setChecked(TRUE); - myChangeCompleteBlindsDialog->radioButton_raiseBlindsAtMinutes->setChecked(FALSE); + myChangeCompleteBlindsDialog->radioButton_raiseBlindsAtHands->setChecked(true); + myChangeCompleteBlindsDialog->radioButton_raiseBlindsAtMinutes->setChecked(false); myChangeCompleteBlindsDialog->spinBox_raiseSmallBlindEveryHands->setValue(11); - myChangeCompleteBlindsDialog->radioButton_alwaysDoubleBlinds->setChecked(TRUE); - myChangeCompleteBlindsDialog->radioButton_manualBlindsOrder->setChecked(FALSE); + myChangeCompleteBlindsDialog->radioButton_alwaysDoubleBlinds->setChecked(true); + myChangeCompleteBlindsDialog->radioButton_manualBlindsOrder->setChecked(false); myChangeCompleteBlindsDialog->listWidget_blinds->clear(); } else { //read config values diff --git a/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp b/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp index 6dd80cec..634d2609 100644 --- a/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp +++ b/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp @@ -56,10 +56,10 @@ createNetworkGameDialogImpl::createNetworkGameDialogImpl(QWidget *parent, Config } -void createNetworkGameDialogImpl::exec() +int createNetworkGameDialogImpl::exec() { fillFormular(); - QDialog::exec(); + return QDialog::exec(); } void createNetworkGameDialogImpl::createGame() @@ -131,7 +131,7 @@ void createNetworkGameDialogImpl::callChangeBlindsDialog(bool show) myChangeCompleteBlindsDialog->exec(); if(myChangeCompleteBlindsDialog->result() == QDialog::Accepted ) {} else { - radioButton_useSavedBlindsSettings->setChecked(TRUE); + radioButton_useSavedBlindsSettings->setChecked(true); } } diff --git a/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.h b/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.h index e6022753..c53acec1 100644 --- a/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.h +++ b/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.h @@ -51,7 +51,7 @@ class createNetworkGameDialogImpl: public QDialog, public Ui::createNetworkGameD public: createNetworkGameDialogImpl(QWidget *parent = 0, ConfigFile *c = 0); - void exec(); + int exec(); changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog() { return myChangeCompleteBlindsDialog; } diff --git a/src/gui/qt/gamelobbydialog.ui b/src/gui/qt/gamelobbydialog.ui index 7a7cf556..0ea2d2f6 100644 --- a/src/gui/qt/gamelobbydialog.ui +++ b/src/gui/qt/gamelobbydialog.ui @@ -20,15 +20,24 @@ Internet Game Lobby + + 5 + + + 5 + + + 5 + + + 5 + 7 4 - - 5 - @@ -88,6 +97,281 @@ + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + true + + + + + + + + + + 400 + 0 + + + + Qt::CustomContextMenu + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + false + + + 5 + + + false + + + true + + + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Join &any game + + + + :/gfx/transform-rotate.png:/gfx/transform-rotate.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 181 + 20 + + + + + + + + &Create Game + + + + :/gfx/list_add.png:/gfx/list_add.png + + + + + + + &Join Game + + + + :/gfx/go-next-view.png:/gfx/go-next-view.png + + + + + + + + + + 400 + 223 + + + + + 16777215 + 230 + + + + Lobby-Chat + + + + 7 + + + 2 + + + 7 + + + 7 + + + 0 + + + + + true + + + + + + + + + + + + + + Sort alphabetically + + + + + Sort by country + + + + + Display idle players + + + + + + + + + 0 + 0 + + + + + 165 + 0 + + + + + 165 + 16777215 + + + + Qt::CustomContextMenu + + + QAbstractItemView::NoEditTriggers + + + false + + + true + + + @@ -114,53 +398,122 @@ Game Info - - - 3 - + - 7 + 6 2 - 7 + 6 6 - - - - - 221 - 237 - + + 0 + + + 1 + + + + + 0 - - Qt::CustomContextMenu - - - 1 - - - - 25 - 26 - - - - 15 - - - - Connected Players - - + + + Players + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 221 + 100 + + + + Qt::CustomContextMenu + + + 1 + + + + 25 + 26 + + + + 15 + + + false + + + + Connected Players + + + + + + + + + Spectators + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + false + + + + 1 + + + + + + - + @@ -176,20 +529,29 @@ 0 0 - 246 - 168 + 250 + 200 - + + + 4 + + + 4 + + + 4 + + + 4 + - -1 + 6 2 - - 4 - @@ -405,7 +767,7 @@ - + @@ -442,7 +804,7 @@ - + 3 @@ -532,7 +894,7 @@ - + 0 @@ -587,272 +949,6 @@ - - - - - 400 - 0 - - - - Qt::CustomContextMenu - - - Qt::ScrollBarAlwaysOff - - - QAbstractItemView::NoEditTriggers - - - false - - - 5 - - - false - - - true - - - - - - - 6 - - - 0 - - - - - Join &any game - - - - :/gfx/transform-rotate.png:/gfx/transform-rotate.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 181 - 20 - - - - - - - - &Create Game - - - - :/gfx/list_add.png:/gfx/list_add.png - - - - - - - &Join Game - - - - :/gfx/go-next-view.png:/gfx/go-next-view.png - - - - - - - - - - 400 - 223 - - - - - 16777215 - 230 - - - - Lobby-Chat - - - - 7 - - - 2 - - - 7 - - - 7 - - - 0 - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - true - - - - - - - - - - 0 - 0 - - - - - 165 - 0 - - - - - 165 - 16777215 - - - - Qt::CustomContextMenu - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - - - - - - Sort alphabetically - - - - - Sort by country - - - - - Display idle players - - - - diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index 817ca377..152d48bf 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -90,13 +90,13 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) label_rankings->setText(clickToRanking); waitStartGameMsgBoxTimer = new QTimer(this); - waitStartGameMsgBoxTimer->setSingleShot(TRUE); + waitStartGameMsgBoxTimer->setSingleShot(true); blinkingButtonAnimationTimer = new QTimer(this); blinkingButtonAnimationTimer->setInterval(1000); autoStartTimer = new QTimer(this); autoStartTimer->setInterval(1000); showInfoMsgBoxTimer = new QTimer(this); - showInfoMsgBoxTimer->setSingleShot(TRUE); + showInfoMsgBoxTimer->setSingleShot(true); //fetch button colors for blinking groupBox_GameInfo->setEnabled(true); @@ -111,12 +111,12 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) //prepare overlay autoStartTimerOverlay = new QLabel(scrollArea_gameInfos); autoStartTimerOverlay->hide(); - autoStartTimerOverlay->setWordWrap(TRUE); + autoStartTimerOverlay->setWordWrap(true); autoStartTimerOverlay->setMaximumWidth(190); autoStartTimerOverlay->setMinimumWidth(190); autoStartTimerOverlay->setTextFormat(Qt::RichText); autoStartTimerOverlay->setAlignment(Qt::AlignCenter); - autoStartTimerOverlay->setAutoFillBackground(TRUE); + autoStartTimerOverlay->setAutoFillBackground(true); autoStartTimerOverlay->setFrameStyle(QFrame::StyledPanel); QPalette p; p.setColor(QPalette::Background, QColor(255, 255, 255, 210)); @@ -126,7 +126,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) myGameListModel = new QStandardItemModel(this); myGameListSortFilterProxyModel = new MyGameListSortFilterProxyModel(this); myGameListSortFilterProxyModel->setSourceModel(myGameListModel); - myGameListSortFilterProxyModel->setDynamicSortFilter(TRUE); + myGameListSortFilterProxyModel->setDynamicSortFilter(true); treeView_GameList->setModel(myGameListSortFilterProxyModel); myGameListSelectionModel = treeView_GameList->selectionModel(); @@ -174,12 +174,12 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) treeView_GameList->setStyleSheet("QTreeView {background-color: white; background-image: url(\""+myAppDataPath +"gfx/gui/misc/background_gamelist.png\"); background-attachment: fixed; background-position: top center ; background-repeat: no-repeat;}"); #endif - treeView_GameList->setAutoFillBackground(TRUE); + treeView_GameList->setAutoFillBackground(true); myNickListModel = new QStandardItemModel(this); myNickListSortFilterProxyModel = new MyNickListSortFilterProxyModel(this); myNickListSortFilterProxyModel->setSourceModel(myNickListModel); - myNickListSortFilterProxyModel->setDynamicSortFilter(TRUE); + myNickListSortFilterProxyModel->setDynamicSortFilter(true); myNickListSortFilterProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); treeView_NickList->setModel(myNickListSortFilterProxyModel); @@ -256,7 +256,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) } -void gameLobbyDialogImpl::exec() +int gameLobbyDialogImpl::exec() { if(myConfig->readConfigInt("UseLobbyChat")) { @@ -276,10 +276,11 @@ void gameLobbyDialogImpl::exec() #ifdef ANDROID this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); #endif - QDialog::exec(); - + int ret = QDialog::exec(); waitStartGameMsgBoxTimer->stop(); closeAllChildDialogs(); + + return ret; } @@ -328,7 +329,7 @@ void gameLobbyDialogImpl::createGame() gameData.raiseMode = MANUAL_BLINDS_ORDER; std::list tempBlindList; int i; - bool ok = TRUE; + bool ok = true; for(i=0; igetChangeCompleteBlindsDialog()->listWidget_blinds->count(); i++) { tempBlindList.push_back(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->listWidget_blinds->item(i)->text().toInt(&ok,10)); } @@ -376,15 +377,11 @@ void gameLobbyDialogImpl::createGame() break; } - showGameDescription(TRUE); + showGameDescription(true); label_SmallBlind->setText(QString("%L1").arg(gameData.firstSmallBlind)); label_StartCash->setText(QString("%L1").arg(gameData.startMoney)); - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players - max. %1").arg(gameData.maxNumberOfPlayers)); - header->setData(0, Qt::UserRole, gameData.maxNumberOfPlayers); - updateDialogBlinds(gameData); label_GameTiming->setText(QString::number(gameData.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(gameData.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); @@ -422,7 +419,7 @@ void gameLobbyDialogImpl::joinAnyGame() if(comboBox_gameListFilter->currentIndex() != 3 && comboBox_gameListFilter->currentIndex() != 0 && comboBox_gameListFilter->currentIndex() != 5) comboBox_gameListFilter->setCurrentIndex(0); - bool found = FALSE; + bool found = false; int it = 0; int gameToJoinId = 0; @@ -437,7 +434,7 @@ void gameLobbyDialogImpl::joinAnyGame() mostConnectedPlayers = players; gameToJoinId = it; } - found = TRUE; + found = true; } it++; } @@ -550,7 +547,7 @@ void gameLobbyDialogImpl::gameSelected(const QModelIndex &index) break; } - showGameDescription(TRUE); + showGameDescription(true); label_SmallBlind->setText(QString("%L1").arg(info.data.firstSmallBlind)); label_StartCash->setText(QString("%L1").arg(info.data.startMoney)); // label_MaximumNumberOfPlayers->setText(QString::number(info.data.maxNumberOfPlayers));s @@ -568,9 +565,6 @@ void gameLobbyDialogImpl::gameSelected(const QModelIndex &index) ++i; } - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players - Max. %1").arg(info.data.maxNumberOfPlayers)); - header->setData(0, Qt::UserRole, info.data.maxNumberOfPlayers); #ifdef __APPLE__ // Dirty workaround for a Qt redraw bug on Mac OS. treeWidget_connectedPlayers->setFocus(); @@ -743,8 +737,8 @@ void gameLobbyDialogImpl::refreshGameStats() ++it; } - label_openGamesCounter->setText("| "+tr("running games: %1").arg(runningGamesCounter)); - label_runningGamesCounter->setText("| "+tr("open games: %1").arg(openGamesCounter)); + label_openGamesCounter->setText(" | "+tr("running games: %1").arg(runningGamesCounter)); + label_runningGamesCounter->setText(" | "+tr("open games: %1").arg(openGamesCounter)); //refresh joinAnyGameButton state joinAnyGameButtonRefresh(); @@ -796,6 +790,11 @@ void gameLobbyDialogImpl::gameAddPlayer(unsigned gameId, unsigned playerId) } } +void gameLobbyDialogImpl::gameAddSpectator(unsigned, unsigned) +{ + qDebug("jojo GameADDSpecator"); +} + void gameLobbyDialogImpl::gameRemovePlayer(unsigned gameId, unsigned playerId) { if (!inGame) { @@ -832,6 +831,11 @@ void gameLobbyDialogImpl::gameRemovePlayer(unsigned gameId, unsigned playerId) } } +void gameLobbyDialogImpl::gameRemoveSpectator(unsigned, unsigned) +{ + qDebug("jojo GameRemoveSpecator"); +} + void gameLobbyDialogImpl::updateStats(ServerStats /*stats*/) { refreshPlayerStats(); @@ -843,11 +847,7 @@ void gameLobbyDialogImpl::clearDialog() groupBox_GameInfo->setEnabled(false); currentGameName = ""; - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players")); - header->setData(0, Qt::UserRole, 0); - - showGameDescription(FALSE); + showGameDescription(false); label_typeIcon->setText(" "); label_typeText->setText(" "); label_SmallBlind->setText(""); @@ -911,17 +911,18 @@ void gameLobbyDialogImpl::clearDialog() isGameAdministrator = false; myPlayerId = 0; - showGameDescription(FALSE); + showGameDescription(false); label_connectedPlayersCounter->setText(tr("connected players: %1").arg(0)); - label_openGamesCounter->setText("| "+tr("running games: %1").arg(0)); - label_runningGamesCounter->setText("| "+tr("open games: %1").arg(0)); + label_openGamesCounter->setText(" | "+tr("running games: %1").arg(0)); + label_runningGamesCounter->setText(" | "+tr("open games: %1").arg(0)); readDialogSettings(); } void gameLobbyDialogImpl::checkPlayerQuantity() { + tabWidget_playerSpectators->setTabText(0, tr("Players (%1)").arg(treeWidget_connectedPlayers->topLevelItemCount())); assert(mySession); GameInfo info(mySession->getClientGameInfo(mySession->getClientCurrentGameId())); @@ -935,7 +936,7 @@ void gameLobbyDialogImpl::checkPlayerQuantity() if (treeWidget_connectedPlayers->topLevelItemCount() >= 2) { pushButton_StartGame->setEnabled(true); - if(treeWidget_connectedPlayers->topLevelItemCount() == treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) { + if(treeWidget_connectedPlayers->topLevelItemCount() == info.data.maxNumberOfPlayers) { blinkingButtonAnimationTimer->start(); } else { blinkingButtonAnimationTimer->stop(); @@ -951,7 +952,7 @@ void gameLobbyDialogImpl::checkPlayerQuantity() } //general actions - if(treeWidget_connectedPlayers->topLevelItemCount() < treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) { + if(treeWidget_connectedPlayers->topLevelItemCount() < info.data.maxNumberOfPlayers) { autoStartTimerOverlay->hide(); autoStartTimer->stop(); } @@ -1040,6 +1041,17 @@ void gameLobbyDialogImpl::addConnectedPlayer(unsigned playerId, QString playerNa refreshConnectedPlayerAvatars(); } +void gameLobbyDialogImpl::addConnectedSpectator(unsigned spectatorId, QString spectatorName) { + + qDebug("JOJO add spect"); + QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_connectedSpectators, 0); + item->setData(0, Qt::UserRole, spectatorId); + item->setData(0, Qt::DisplayRole, spectatorName); + tabWidget_playerSpectators->setTabText(1, tr("Spectators (%1)").arg(treeWidget_connectedSpectators->topLevelItemCount())); +// if (inGame) +// refreshConnectedSpecatatorAvatars(); +} + void gameLobbyDialogImpl::updatePlayer(unsigned playerId, QString newPlayerName) { @@ -1095,7 +1107,7 @@ void gameLobbyDialogImpl::updatePlayer(unsigned playerId, QString newPlayerName) void gameLobbyDialogImpl::removePlayer(unsigned playerId, QString) { - + qDebug("JOJO remove player"); QTreeWidgetItemIterator it(treeWidget_connectedPlayers); while (*it) { if ((*it)->data(0, Qt::UserRole) == playerId) { @@ -1104,9 +1116,22 @@ void gameLobbyDialogImpl::removePlayer(unsigned playerId, QString) } ++it; } - checkPlayerQuantity(); +} + +void gameLobbyDialogImpl::removeSpectator(unsigned spectatorId, QString) +{ + qDebug("JOJO remove spect"); + QTreeWidgetItemIterator it(treeWidget_connectedSpectators); + while (*it) { + if ((*it)->data(0, Qt::UserRole) == spectatorId) { + treeWidget_connectedSpectators->takeTopLevelItem(treeWidget_connectedSpectators->indexOfTopLevelItem(*it)); + break; + } + ++it; + } + tabWidget_playerSpectators->setTabText(1, tr("Spectators (%1)").arg(treeWidget_connectedSpectators->topLevelItemCount())); } void gameLobbyDialogImpl::playerLeftLobby(unsigned playerId) @@ -1237,15 +1262,12 @@ void gameLobbyDialogImpl::joinedGameDialogUpdate() break; } - showGameDescription(TRUE); + showGameDescription(true); label_SmallBlind->setText(QString("%L1").arg(info.data.firstSmallBlind)); label_StartCash->setText(QString("%L1").arg(info.data.startMoney)); updateDialogBlinds(info.data); label_GameTiming->setText(QString::number(info.data.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(info.data.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players - Max. %1").arg(info.data.maxNumberOfPlayers)); - header->setData(0, Qt::UserRole, info.data.maxNumberOfPlayers); } void gameLobbyDialogImpl::leftGameDialogUpdate() @@ -1258,11 +1280,7 @@ void gameLobbyDialogImpl::leftGameDialogUpdate() groupBox_GameInfo->setEnabled(false); currentGameName = ""; - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players")); - header->setData(0, Qt::UserRole, 0); - - showGameDescription(FALSE); + showGameDescription(false); label_typeIcon->setText(" "); label_typeText->setText(" "); label_SmallBlind->setText(""); @@ -1436,6 +1454,7 @@ void gameLobbyDialogImpl::showGameDescription(bool show) label_gameDesc5->show(); label_gameDesc6->show(); label_gameDesc7->show(); + checkPlayerQuantity(); } else { label_gameType->hide(); label_gameDesc2->hide(); @@ -1444,6 +1463,9 @@ void gameLobbyDialogImpl::showGameDescription(bool show) label_gameDesc5->hide(); label_gameDesc6->hide(); label_gameDesc7->hide(); + tabWidget_playerSpectators->setTabText(0, tr("Players (%1)").arg(0)); + tabWidget_playerSpectators->setTabText(1, tr("Spectators (%1)").arg(0)); + } } @@ -1480,8 +1502,8 @@ void gameLobbyDialogImpl::joinAnyGameButtonRefresh() ++it; } - if(openNonPrivateNonFullGamesCounter) pushButton_joinAnyGame->setEnabled(TRUE); - else pushButton_joinAnyGame->setEnabled(FALSE); + if(openNonPrivateNonFullGamesCounter) pushButton_joinAnyGame->setEnabled(true); + else pushButton_joinAnyGame->setEnabled(false); } void gameLobbyDialogImpl::reject() diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h index 2b7f39b7..dbf6b3f6 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h @@ -64,7 +64,7 @@ public: ~gameLobbyDialogImpl(); - void exec(); + int exec(); ChatTools *getMyChat() { return myChat; @@ -162,6 +162,10 @@ public slots: void reportBadGameName(); void adminActionCloseGame(); void adminActionTotalKickBan(); + void addConnectedSpectator(unsigned spectatorId, QString spectatorName); + void removeSpectator(unsigned spectatorId, QString); + void gameAddSpectator(unsigned, unsigned); + void gameRemoveSpectator(unsigned, unsigned); private: diff --git a/src/gui/qt/gamelobbydialog/mygamelisttreewidget.h b/src/gui/qt/gamelobbydialog/mygamelisttreewidget.h index e46d4b81..f97647e9 100644 --- a/src/gui/qt/gamelobbydialog/mygamelisttreewidget.h +++ b/src/gui/qt/gamelobbydialog/mygamelisttreewidget.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class MyGameListTreeWidget : public QTreeWidget { diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 885ddec0..23a5bcf3 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -71,7 +71,7 @@ using namespace std; gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) - : QMainWindow(parent), myChat(NULL), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), pushButtonBetRaiseIsChecked(FALSE), pushButtonCallCheckIsChecked(FALSE), pushButtonFoldIsChecked(FALSE), pushButtonAllInIsChecked(FALSE), myButtonsAreCheckable(FALSE), breakAfterCurrentHand(FALSE), currentGameOver(FALSE), betSliderChangedByInput(FALSE), guestMode(FALSE), myLastPreActionBetValue(0) + : QMainWindow(parent), myChat(NULL), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), pushButtonBetRaiseIsChecked(false), pushButtonCallCheckIsChecked(false), pushButtonFoldIsChecked(false), pushButtonAllInIsChecked(false), myButtonsAreCheckable(false), breakAfterCurrentHand(false), currentGameOver(false), betSliderChangedByInput(false), guestMode(false), myLastPreActionBetValue(0) { int i; @@ -123,7 +123,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) } //Flipside Animation noch nicht erledigt - flipHolecardsAllInAlreadyDone = FALSE; + flipHolecardsAllInAlreadyDone = false; #ifndef GUI_800x480 //Toolboxen verstecken? @@ -193,38 +193,38 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) voteOnKickTimeoutTimer = new QTimer(this); enableCallCheckPushButtonTimer = new QTimer(this); - dealFlopCards0Timer->setSingleShot(TRUE); - dealFlopCards1Timer->setSingleShot(TRUE); - dealFlopCards2Timer->setSingleShot(TRUE); - dealFlopCards3Timer->setSingleShot(TRUE); - dealFlopCards4Timer->setSingleShot(TRUE); - dealFlopCards5Timer->setSingleShot(TRUE); - dealFlopCards6Timer->setSingleShot(TRUE); - dealTurnCards0Timer->setSingleShot(TRUE); - dealTurnCards1Timer->setSingleShot(TRUE); - dealTurnCards2Timer->setSingleShot(TRUE); - dealRiverCards0Timer->setSingleShot(TRUE); - dealRiverCards1Timer->setSingleShot(TRUE); - dealRiverCards2Timer->setSingleShot(TRUE); + dealFlopCards0Timer->setSingleShot(true); + dealFlopCards1Timer->setSingleShot(true); + dealFlopCards2Timer->setSingleShot(true); + dealFlopCards3Timer->setSingleShot(true); + dealFlopCards4Timer->setSingleShot(true); + dealFlopCards5Timer->setSingleShot(true); + dealFlopCards6Timer->setSingleShot(true); + dealTurnCards0Timer->setSingleShot(true); + dealTurnCards1Timer->setSingleShot(true); + dealTurnCards2Timer->setSingleShot(true); + dealRiverCards0Timer->setSingleShot(true); + dealRiverCards1Timer->setSingleShot(true); + dealRiverCards2Timer->setSingleShot(true); - nextPlayerAnimationTimer->setSingleShot(TRUE); - preflopAnimation1Timer->setSingleShot(TRUE); - preflopAnimation2Timer->setSingleShot(TRUE); - flopAnimation1Timer->setSingleShot(TRUE); - flopAnimation2Timer->setSingleShot(TRUE); - turnAnimation1Timer->setSingleShot(TRUE); - turnAnimation2Timer->setSingleShot(TRUE); - riverAnimation1Timer->setSingleShot(TRUE); - riverAnimation2Timer->setSingleShot(TRUE); + nextPlayerAnimationTimer->setSingleShot(true); + preflopAnimation1Timer->setSingleShot(true); + preflopAnimation2Timer->setSingleShot(true); + flopAnimation1Timer->setSingleShot(true); + flopAnimation2Timer->setSingleShot(true); + turnAnimation1Timer->setSingleShot(true); + turnAnimation2Timer->setSingleShot(true); + riverAnimation1Timer->setSingleShot(true); + riverAnimation2Timer->setSingleShot(true); - postRiverAnimation1Timer->setSingleShot(TRUE); - postRiverRunAnimation1Timer->setSingleShot(TRUE); - postRiverRunAnimation2Timer->setSingleShot(TRUE); - postRiverRunAnimation3Timer->setSingleShot(TRUE); - postRiverRunAnimation5Timer->setSingleShot(TRUE); - postRiverRunAnimation6Timer->setSingleShot(TRUE); + postRiverAnimation1Timer->setSingleShot(true); + postRiverRunAnimation1Timer->setSingleShot(true); + postRiverRunAnimation2Timer->setSingleShot(true); + postRiverRunAnimation3Timer->setSingleShot(true); + postRiverRunAnimation5Timer->setSingleShot(true); + postRiverRunAnimation6Timer->setSingleShot(true); - enableCallCheckPushButtonTimer->setSingleShot(TRUE); + enableCallCheckPushButtonTimer->setSingleShot(true); playerStarsArray[1][0]=label_Star10; playerStarsArray[2][0]=label_Star20; @@ -756,7 +756,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent7Name->text().toUtf8().constData()); (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent8Name->text().toUtf8().constData()); (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent9Name->text().toUtf8().constData()); - mySettingsDialog->setPlayerNickIsChanged(FALSE); + mySettingsDialog->setPlayerNickIsChanged(false); refreshPlayerName(); } @@ -789,15 +789,15 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) if(currentState >= GAME_STATE_FLOP && currentState <= GAME_STATE_POST_RIVER) for(int i=0; i<3; i++) { QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[i], 10)+".png")); - boardCardsArray[i]->setPixmap(card, FALSE); + boardCardsArray[i]->setPixmap(card, false); } if(currentState >= GAME_STATE_TURN && currentState <= GAME_STATE_POST_RIVER) { QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[3], 10)+".png")); - boardCardsArray[3]->setPixmap(card, FALSE); + boardCardsArray[3]->setPixmap(card, false); } if(currentState == GAME_STATE_RIVER || currentState == GAME_STATE_POST_RIVER) { QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[4], 10)+".png")); - boardCardsArray[4]->setPixmap(card, FALSE); + boardCardsArray[4]->setPixmap(card, false); } } @@ -811,7 +811,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) for (j=1; jgetIsFlipside()) { - holeCardsArray[j][k]->setPixmap(flipside, TRUE); + holeCardsArray[j][k]->setPixmap(flipside, true); } } } @@ -827,17 +827,17 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) humanPlayer->getMyCards(tempCardsIntArray); if(myConfig->readConfigInt("AntiPeekMode")) { - holeCardsArray[0][0]->setPixmap(flipside, TRUE); + holeCardsArray[0][0]->setPixmap(flipside, true); tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png")); holeCardsArray[0][0]->setHiddenFrontPixmap(tempCardsPixmapArray[0]); - holeCardsArray[0][1]->setPixmap(flipside, TRUE); + holeCardsArray[0][1]->setPixmap(flipside, true); tempCardsPixmapArray[1]= QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[1], 10)+".png")); holeCardsArray[0][1]->setHiddenFrontPixmap(tempCardsPixmapArray[1]); } else { tempCardsPixmapArray[0]= QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png")); - holeCardsArray[0][0]->setPixmap(tempCardsPixmapArray[0],FALSE); + holeCardsArray[0][0]->setPixmap(tempCardsPixmapArray[0],false); tempCardsPixmapArray[1]= QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[1], 10)+".png")); - holeCardsArray[0][1]->setPixmap(tempCardsPixmapArray[1],FALSE); + holeCardsArray[0][1]->setPixmap(tempCardsPixmapArray[1],false); } } } @@ -893,8 +893,8 @@ void gameTableImpl::initGui(int speed) label_Sets->setText(BetsString); label_Total->setText(TotalString); - tabs.groupBox_RightToolBox->setDisabled(FALSE); - tabs.groupBox_LeftToolBox->setDisabled(FALSE); + tabs.groupBox_RightToolBox->setDisabled(false); + tabs.groupBox_LeftToolBox->setDisabled(false); //set minimum gui speed to prevent gui lags on fast inet games if( myStartWindow->getSession()->isNetworkClientRunning() ) { @@ -912,8 +912,8 @@ void gameTableImpl::initGui(int speed) label_Pot->setText(PotString); label_Total->setText(TotalString+":"); label_Sets->setText(BetsString+":"); - groupBox_RightToolBox->setDisabled(FALSE); - groupBox_LeftToolBox->setDisabled(FALSE); + groupBox_RightToolBox->setDisabled(false); + groupBox_LeftToolBox->setDisabled(false); //set minimum gui speed to prevent gui lags on fast inet games if( myStartWindow->getSession()->isNetworkClientRunning() ) { @@ -1036,15 +1036,15 @@ void gameTableImpl::refreshPlayerName() switch(getCurrentSeatState((*it_c))) { case SEAT_ACTIVE: { - playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, FALSE, guest, computerPlayer ); + playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, false, guest, computerPlayer ); } break; case SEAT_AUTOFOLD: { - playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, TRUE, guest, computerPlayer ); + playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, true, guest, computerPlayer ); } break; case SEAT_STAYONTABLE: { - playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, TRUE, guest, computerPlayer ); + playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, true, guest, computerPlayer ); } break; case SEAT_CLEAR: { @@ -1097,12 +1097,12 @@ void gameTableImpl::refreshPlayerAvatar() break; case SEAT_AUTOFOLD: { // qDebug() << seatPlace << "AVATAR AUTOFOLD"; - playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE); + playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, true); } break; case SEAT_STAYONTABLE: { // qDebug() << seatPlace << "AVATAR STAYONTABLE"; - playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE); + playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, true); } break; case SEAT_CLEAR: { @@ -1165,8 +1165,8 @@ void gameTableImpl::refreshAction(int playerID, int playerAction) if ((*it_c)->getMyAction()==1) { if((*it_c)->getMyID() != 0) { - holeCardsArray[(*it_c)->getMyID()][0]->setPixmap(onePix, FALSE); - holeCardsArray[(*it_c)->getMyID()][1]->setPixmap(onePix, FALSE); + holeCardsArray[(*it_c)->getMyID()][0]->setPixmap(onePix, false); + holeCardsArray[(*it_c)->getMyID()][1]->setPixmap(onePix, false); } } } @@ -1190,8 +1190,8 @@ void gameTableImpl::refreshAction(int playerID, int playerAction) holeCardsArray[0][0]->startFadeOut(10); holeCardsArray[0][1]->startFadeOut(10); } else { - holeCardsArray[playerID][0]->setPixmap(onePix, FALSE); - holeCardsArray[playerID][1]->setPixmap(onePix, FALSE); + holeCardsArray[playerID][0]->setPixmap(onePix, false); + holeCardsArray[playerID][1]->setPixmap(onePix, false); } } } @@ -1270,8 +1270,8 @@ void gameTableImpl::refreshGroupbox(int playerID, int status) userWidgetsArray[j]->hide(); } //disable anti-peek front after player is out - holeCardsArray[0][0]->signalFastFlipCards(FALSE); - holeCardsArray[0][1]->signalFastFlipCards(FALSE); + holeCardsArray[0][0]->signalFastFlipCards(false); + holeCardsArray[0][1]->signalFastFlipCards(false); } myGameTableStyle->setPlayerSeatInactiveStyle(groupBoxArray[(*it_c)->getMyID()]); } @@ -1288,8 +1288,8 @@ void gameTableImpl::refreshGroupbox(int playerID, int status) userWidgetsArray[j]->hide(); } //disable anti-peek front after player is out - holeCardsArray[0][0]->signalFastFlipCards(FALSE); - holeCardsArray[0][1]->signalFastFlipCards(FALSE); + holeCardsArray[0][0]->signalFastFlipCards(false); + holeCardsArray[0][1]->signalFastFlipCards(false); } myGameTableStyle->setPlayerSeatInactiveStyle(groupBoxArray[playerID]); } @@ -1412,7 +1412,7 @@ void gameTableImpl::dealHoleCards() int i,k; for (i=0; isetFadeOutAction(FALSE); + holeCardsArray[i][k]->setFadeOutAction(false); holeCardsArray[i][k]->stopFlipCardsAnimation(); } } @@ -1436,26 +1436,26 @@ void gameTableImpl::dealHoleCards() if (( (*it_c)->getMyID() == 0)/* || DEBUG_MODE*/) { tempCardsPixmapArray[j].load(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[j], 10)+".png"); if(myConfig->readConfigInt("AntiPeekMode")) { - holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(flipside, TRUE); + holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(flipside, true); holeCardsArray[(*it_c)->getMyID()][j]->setFront(flipside); holeCardsArray[(*it_c)->getMyID()][j]->setHiddenFrontPixmap(tempCardsPixmapArray[j]); } else { - holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(tempCardsPixmapArray[j],FALSE); + holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(tempCardsPixmapArray[j],false); holeCardsArray[(*it_c)->getMyID()][j]->setFront(tempCardsPixmapArray[j]); } } else { - holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(flipside, TRUE); + holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(flipside, true); holeCardsArray[(*it_c)->getMyID()][j]->setFlipsidePix(flipside); } } else { - holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(onePix, FALSE); + holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(onePix, false); } } } //fix press mouse button during bankrupt with anti-peek-mode - this->mouseOverFlipCards(FALSE); + this->mouseOverFlipCards(false); //refresh CardsChanceMonitor Tool refreshCardsChance(GAME_STATE_PREFLOP); @@ -1465,12 +1465,12 @@ void gameTableImpl::dealBeRoCards(int myBeRoID) { uncheckMyButtons(); - myButtonsCheckable(FALSE); + myButtonsCheckable(false); resetMyButtonsCheckStateMemory(); clearMyButtons(); - horizontalSlider_bet->setDisabled(TRUE); - spinBox_betValue->setDisabled(TRUE); + horizontalSlider_bet->setDisabled(true); + spinBox_betValue->setDisabled(true); switch(myBeRoID) { @@ -1501,21 +1501,21 @@ void gameTableImpl::dealFlopCards0() void gameTableImpl::dealFlopCards1() { - boardCardsArray[0]->setPixmap(flipside, TRUE); + boardCardsArray[0]->setPixmap(flipside, true); dealFlopCards1Timer->start(dealCardsSpeed); } void gameTableImpl::dealFlopCards2() { - boardCardsArray[1]->setPixmap(flipside, TRUE); + boardCardsArray[1]->setPixmap(flipside, true); dealFlopCards2Timer->start(dealCardsSpeed); } void gameTableImpl::dealFlopCards3() { - boardCardsArray[2]->setPixmap(flipside, TRUE); + boardCardsArray[2]->setPixmap(flipside, true); dealFlopCards3Timer->start(dealCardsSpeed); } @@ -1534,7 +1534,7 @@ void gameTableImpl::dealFlopCards4() } else { //without Eye-Candy boardCardsArray[0]->setFront(card); - boardCardsArray[0]->setPixmap(card, FALSE); + boardCardsArray[0]->setPixmap(card, false); } dealFlopCards4Timer->start(dealCardsSpeed); } @@ -1553,7 +1553,7 @@ void gameTableImpl::dealFlopCards5() } else { //without Eye-Candy boardCardsArray[1]->setFront(card); - boardCardsArray[1]->setPixmap(card, FALSE); + boardCardsArray[1]->setPixmap(card, false); } dealFlopCards5Timer->start(dealCardsSpeed); } @@ -1572,7 +1572,7 @@ void gameTableImpl::dealFlopCards6() } else { //without Eye-Candy boardCardsArray[2]->setFront(card); - boardCardsArray[2]->setPixmap(card, FALSE); + boardCardsArray[2]->setPixmap(card, false); } // stable @@ -1598,7 +1598,7 @@ void gameTableImpl::dealTurnCards0() void gameTableImpl::dealTurnCards1() { - boardCardsArray[3]->setPixmap(flipside, TRUE); + boardCardsArray[3]->setPixmap(flipside, true); dealTurnCards1Timer->start(dealCardsSpeed); } @@ -1616,7 +1616,7 @@ void gameTableImpl::dealTurnCards2() } else { //without Eye-Candy boardCardsArray[3]->setFront(card); - boardCardsArray[3]->setPixmap(card, FALSE); + boardCardsArray[3]->setPixmap(card, false); } // stable @@ -1641,7 +1641,7 @@ void gameTableImpl::dealRiverCards0() void gameTableImpl::dealRiverCards1() { - boardCardsArray[4]->setPixmap(flipside, TRUE); + boardCardsArray[4]->setPixmap(flipside, true); // QTimer::singleShot(dealCardsSpeed, this, SLOT( dealRiverCards2() )); dealRiverCards1Timer->start(dealCardsSpeed); @@ -1661,7 +1661,7 @@ void gameTableImpl::dealRiverCards2() } else { //without Eye-Candy boardCardsArray[4]->setFront(card); - boardCardsArray[4]->setPixmap(card, FALSE); + boardCardsArray[4]->setPixmap(card, false); } // stable @@ -1700,15 +1700,15 @@ void gameTableImpl::provideMyActions(int mode) pushButton_Fold->setText(""); pushButton_AllIn->setText(""); - horizontalSlider_bet->setDisabled(TRUE); - spinBox_betValue->setDisabled(TRUE); + horizontalSlider_bet->setDisabled(true); + spinBox_betValue->setDisabled(true); - myButtonsCheckable(FALSE); + myButtonsCheckable(false); refreshActionButtonFKeyIndicator(1); } else { - horizontalSlider_bet->setEnabled(TRUE); - spinBox_betValue->setEnabled(TRUE); + horizontalSlider_bet->setEnabled(true); + spinBox_betValue->setEnabled(true); //show available actions on buttons if(currentHand->getCurrentRound() == 0) { // preflop @@ -1766,10 +1766,10 @@ void gameTableImpl::provideMyActions(int mode) pushButtonCallCheckString = ""; pushButtonFoldString = ""; pushButtonAllInString = ""; - horizontalSlider_bet->setDisabled(TRUE); - spinBox_betValue->setDisabled(TRUE); + horizontalSlider_bet->setDisabled(true); + spinBox_betValue->setDisabled(true); - myButtonsCheckable(FALSE); + myButtonsCheckable(false); } } @@ -1792,8 +1792,8 @@ void gameTableImpl::provideMyActions(int mode) if(pushButtonBetRaiseString == "") { - horizontalSlider_bet->setDisabled(TRUE); - spinBox_betValue->setDisabled(TRUE); + horizontalSlider_bet->setDisabled(true); + spinBox_betValue->setDisabled(true); } pushButton_Fold->setText(pushButtonFoldString); @@ -1859,10 +1859,10 @@ void gameTableImpl::provideMyActions(int mode) void gameTableImpl::meInAction() { - myButtonsCheckable(FALSE); + myButtonsCheckable(false); - horizontalSlider_bet->setEnabled(TRUE); - spinBox_betValue->setEnabled(TRUE); + horizontalSlider_bet->setEnabled(true); + spinBox_betValue->setEnabled(true); #ifdef GUI_800x480 if((myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) && tabs.lineEdit_ChatInput->text() == "" && myConfig->readConfigInt("EnableBetInputFocusSwitch")) { @@ -1911,11 +1911,11 @@ void gameTableImpl::meInAction() //do remembered action if( pushButtonBetRaiseIsChecked ) { pushButton_BetRaise->click(); - pushButtonBetRaiseIsChecked = FALSE; + pushButtonBetRaiseIsChecked = false; } if( pushButtonCallCheckIsChecked ) { pushButton_CallCheck->click(); - pushButtonCallCheckIsChecked = FALSE; + pushButtonCallCheckIsChecked = false; } if( pushButtonFoldIsChecked ) { if(lastPushButtonFoldString == CheckString+" /\n"+FoldString && pushButton_CallCheck->text() == CheckString) { @@ -1923,11 +1923,11 @@ void gameTableImpl::meInAction() } else { pushButton_Fold->click(); } - pushButtonFoldIsChecked = FALSE; + pushButtonFoldIsChecked = false; } if( pushButtonAllInIsChecked ) { pushButton_AllIn->click(); - pushButtonAllInIsChecked = FALSE; + pushButtonAllInIsChecked = false; } //automatic mode @@ -1953,9 +1953,9 @@ void gameTableImpl::startTimeoutAnimation(int playerId, int timeoutSec) //beep for player 0 if(playerId) { - timeoutLabelArray[playerId]->startTimeOutAnimation(timeoutSec, FALSE); + timeoutLabelArray[playerId]->startTimeOutAnimation(timeoutSec, false); } else { - timeoutLabelArray[playerId]->startTimeOutAnimation(timeoutSec, TRUE); + timeoutLabelArray[playerId]->startTimeOutAnimation(timeoutSec, true); } } @@ -1973,8 +1973,8 @@ void gameTableImpl::disableMyButtons() clearMyButtons(); //clear userWidgets - horizontalSlider_bet->setDisabled(TRUE); - spinBox_betValue->setDisabled(TRUE); + horizontalSlider_bet->setDisabled(true); + spinBox_betValue->setDisabled(true); horizontalSlider_bet->setMinimum(0); horizontalSlider_bet->setMaximum(humanPlayer->getMyCash()); spinBox_betValue->setMinimum(0); @@ -2219,15 +2219,15 @@ void gameTableImpl::pushButtonBetRaiseClicked(bool checked) if (pushButton_BetRaise->isCheckable()) { if(checked) { - pushButton_CallCheck->setChecked(FALSE); - pushButton_Fold->setChecked(FALSE); - pushButton_AllIn->setChecked(FALSE); + pushButton_CallCheck->setChecked(false); + pushButton_Fold->setChecked(false); + pushButton_AllIn->setChecked(false); - pushButtonCallCheckIsChecked = FALSE; - pushButtonFoldIsChecked = FALSE; - pushButtonAllInIsChecked = FALSE; + pushButtonCallCheckIsChecked = false; + pushButtonFoldIsChecked = false; + pushButtonAllInIsChecked = false; - pushButtonBetRaiseIsChecked = TRUE; + pushButtonBetRaiseIsChecked = true; #ifdef GUI_800x480 if(!tabs.radioButton_manualAction->isChecked()) @@ -2239,7 +2239,7 @@ void gameTableImpl::pushButtonBetRaiseClicked(bool checked) // myLastPreActionBetValue = spinBox_betValue->value(); } else { - pushButtonBetRaiseIsChecked = FALSE; + pushButtonBetRaiseIsChecked = false; myLastPreActionBetValue = 0; } } else { @@ -2252,15 +2252,15 @@ void gameTableImpl::pushButtonCallCheckClicked(bool checked) if (pushButton_CallCheck->isCheckable()) { if(checked) { - pushButton_Fold->setChecked(FALSE); - pushButton_BetRaise->setChecked(FALSE); - pushButton_AllIn->setChecked(FALSE); + pushButton_Fold->setChecked(false); + pushButton_BetRaise->setChecked(false); + pushButton_AllIn->setChecked(false); - pushButtonAllInIsChecked = FALSE; - pushButtonFoldIsChecked = FALSE; - pushButtonBetRaiseIsChecked = FALSE; + pushButtonAllInIsChecked = false; + pushButtonFoldIsChecked = false; + pushButtonBetRaiseIsChecked = false; - pushButtonCallCheckIsChecked = TRUE; + pushButtonCallCheckIsChecked = true; #ifdef GUI_800x480 if(!tabs.radioButton_manualAction->isChecked()) @@ -2270,7 +2270,7 @@ void gameTableImpl::pushButtonCallCheckClicked(bool checked) radioButton_manualAction->click(); #endif } else { - pushButtonCallCheckIsChecked = FALSE; + pushButtonCallCheckIsChecked = false; } } else { myCallCheck(); @@ -2282,15 +2282,15 @@ void gameTableImpl::pushButtonFoldClicked(bool checked) if (pushButton_Fold->isCheckable()) { if(checked) { - pushButton_CallCheck->setChecked(FALSE); - pushButton_BetRaise->setChecked(FALSE); - pushButton_AllIn->setChecked(FALSE); + pushButton_CallCheck->setChecked(false); + pushButton_BetRaise->setChecked(false); + pushButton_AllIn->setChecked(false); - pushButtonAllInIsChecked = FALSE; - pushButtonCallCheckIsChecked = FALSE; - pushButtonBetRaiseIsChecked = FALSE; + pushButtonAllInIsChecked = false; + pushButtonCallCheckIsChecked = false; + pushButtonBetRaiseIsChecked = false; - pushButtonFoldIsChecked = TRUE; + pushButtonFoldIsChecked = true; #ifdef GUI_800x480 if(!tabs.radioButton_manualAction->isChecked()) @@ -2300,7 +2300,7 @@ void gameTableImpl::pushButtonFoldClicked(bool checked) radioButton_manualAction->click(); #endif } else { - pushButtonFoldIsChecked = FALSE; + pushButtonFoldIsChecked = false; } } else { myFold(); @@ -2312,15 +2312,15 @@ void gameTableImpl::pushButtonAllInClicked(bool checked) if (pushButton_AllIn->isCheckable()) { if(checked) { - pushButton_CallCheck->setChecked(FALSE); - pushButton_BetRaise->setChecked(FALSE); - pushButton_Fold->setChecked(FALSE); + pushButton_CallCheck->setChecked(false); + pushButton_BetRaise->setChecked(false); + pushButton_Fold->setChecked(false); - pushButtonFoldIsChecked = FALSE; - pushButtonCallCheckIsChecked = FALSE; - pushButtonBetRaiseIsChecked = FALSE; + pushButtonFoldIsChecked = false; + pushButtonCallCheckIsChecked = false; + pushButtonBetRaiseIsChecked = false; - pushButtonAllInIsChecked = TRUE; + pushButtonAllInIsChecked = true; #ifdef GUI_800x480 if(!tabs.radioButton_manualAction->isChecked()) @@ -2330,7 +2330,7 @@ void gameTableImpl::pushButtonAllInClicked(bool checked) radioButton_manualAction->click(); #endif } else { - pushButtonAllInIsChecked = FALSE; + pushButtonAllInIsChecked = false; } } else { myAllIn(); @@ -2499,12 +2499,12 @@ void gameTableImpl::postRiverRunAnimation2() { uncheckMyButtons(); - myButtonsCheckable(FALSE); + myButtonsCheckable(false); clearMyButtons(); resetMyButtonsCheckStateMemory(); - horizontalSlider_bet->setDisabled(TRUE); - spinBox_betValue->setDisabled(TRUE); + horizontalSlider_bet->setDisabled(true); + spinBox_betValue->setDisabled(true); boost::shared_ptr currentGame = myStartWindow->getSession()->getCurrentGame(); @@ -2535,7 +2535,7 @@ void gameTableImpl::postRiverRunAnimation2() } } //Wenn einmal umgedreht dann fertig!! - flipHolecardsAllInAlreadyDone = TRUE; + flipHolecardsAllInAlreadyDone = true; } else { for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { @@ -2589,70 +2589,70 @@ void gameTableImpl::postRiverRunAnimation3() int bestHandPos[5]; (*it_c)->getMyBestHandPosition(bestHandPos); - bool index0 = TRUE; + bool index0 = true; for(j=0; j<5; j++) { if (bestHandPos[j] == 0 ) { - index0 = FALSE; + index0 = false; } } if (index0) { holeCardsArray[(*it_c)->getMyID()][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/ } //index 1 testen - bool index1 = TRUE; + bool index1 = true; for(j=0; j<5; j++) { if (bestHandPos[j] == 1 ) { - index1 = FALSE; + index1 = false; } } if (index1) { holeCardsArray[(*it_c)->getMyID()][1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index1" << endl;*/ } //index 2 testen - bool index2 = TRUE; + bool index2 = true; for(j=0; j<5; j++) { if (bestHandPos[j] == 2 ) { - index2 = FALSE; + index2 = false; } } if (index2) { boardCardsArray[0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index2" << endl;*/ } //index 3 testen - bool index3 = TRUE; + bool index3 = true; for(j=0; j<5; j++) { if (bestHandPos[j] == 3 ) { - index3 = FALSE; + index3 = false; } } if (index3) { boardCardsArray[1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index3" << endl;*/ } //index 4 testen - bool index4 = TRUE; + bool index4 = true; for(j=0; j<5; j++) { if (bestHandPos[j] == 4 ) { - index4 = FALSE; + index4 = false; } } if (index4) { boardCardsArray[2]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index4" << endl;*/ } //index 5 testen - bool index5 = TRUE; + bool index5 = true; for(j=0; j<5; j++) { if (bestHandPos[j] == 5 ) { - index5 = FALSE; + index5 = false; } } if (index5) { boardCardsArray[3]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index5" << endl;*/ } //index 6 testen - bool index6 = TRUE; + bool index6 = true; for(j=0; j<5; j++) { if (bestHandPos[j] == 6 ) { - index6 = FALSE; + index6 = false; } } if (index6) { @@ -2798,11 +2798,11 @@ void gameTableImpl::postRiverRunAnimation6() if( !DEBUG_MODE ) { if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) { - currentGameOver = TRUE; + currentGameOver = true; #ifdef GUI_800x480 - tabs.pushButton_break->setDisabled(FALSE); + tabs.pushButton_break->setDisabled(false); #else - pushButton_break->setDisabled(FALSE); + pushButton_break->setDisabled(false); #endif QFontMetrics tempMetrics = this->fontMetrics(); int width = tempMetrics.width(tr("Start")); @@ -2846,7 +2846,7 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn) holeCardsArray[(*it_c)->getMyID()][j]->startFlipCards(guiGameSpeed, QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[j], 10)+".png")), flipside); } else { //without Eye-Candy tempCardsPixmapArray[j] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[j], 10)+".png")); - holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(tempCardsPixmapArray[j], FALSE); + holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(tempCardsPixmapArray[j], false); } } //set Player value (logging) @@ -2883,7 +2883,7 @@ void gameTableImpl::flipHolecardsAllIn() } //Wenn einmal umgedreht dann fertig!! - flipHolecardsAllInAlreadyDone = TRUE; + flipHolecardsAllInAlreadyDone = true; } } @@ -2898,9 +2898,9 @@ void gameTableImpl::startNewHand() if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) { #ifdef GUI_800x480 - tabs.pushButton_break->setDisabled(FALSE); + tabs.pushButton_break->setDisabled(false); #else - pushButton_break->setDisabled(FALSE); + pushButton_break->setDisabled(false); #endif QFontMetrics tempMetrics = this->fontMetrics(); @@ -2913,7 +2913,7 @@ void gameTableImpl::startNewHand() pushButton_break->setText(tr("Start")); #endif - breakAfterCurrentHand=FALSE; + breakAfterCurrentHand=false; blinkingStartButtonAnimationTimer->start(500); } @@ -2933,15 +2933,15 @@ void gameTableImpl::nextRoundCleanGui() // GUI bereinigen - Bilder löschen, Animationen unterbrechen QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png")); for (i=0; i<5; i++ ) { - boardCardsArray[i]->setPixmap(onePix, FALSE); - boardCardsArray[i]->setFadeOutAction(FALSE); + boardCardsArray[i]->setPixmap(onePix, false); + boardCardsArray[i]->setFadeOutAction(false); boardCardsArray[i]->stopFlipCardsAnimation(); } for (i=0; istopTimeOutAnimation(); for ( j=0; j<=1; j++ ) { - holeCardsArray[i][j]->setFadeOutAction(FALSE); + holeCardsArray[i][j]->setFadeOutAction(false); holeCardsArray[i][j]->stopFlipCardsAnimation(); } } @@ -2955,10 +2955,10 @@ void gameTableImpl::nextRoundCleanGui() refreshAll(); - flipHolecardsAllInAlreadyDone = FALSE; + flipHolecardsAllInAlreadyDone = false; //Wenn Pause zwischen den Hands in der Konfiguration steht den Stop Button drücken! - if (myConfig->readConfigInt("PauseBetweenHands") /*&& blinkingStartButtonAnimationTimer->isActive() == FALSE*/ && myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) { + if (myConfig->readConfigInt("PauseBetweenHands") /*&& blinkingStartButtonAnimationTimer->isActive() == false*/ && myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) { #ifdef GUI_800x480 tabs.pushButton_break->click(); #else @@ -2967,11 +2967,11 @@ void gameTableImpl::nextRoundCleanGui() } else { //FIX STRG+N Bug #ifdef GUI_800x480 - tabs.pushButton_break->setEnabled(TRUE); + tabs.pushButton_break->setEnabled(true); #else - pushButton_break->setEnabled(TRUE); + pushButton_break->setEnabled(true); #endif - breakAfterCurrentHand=FALSE; + breakAfterCurrentHand=false; } //Clean breakbutton @@ -2997,13 +2997,13 @@ void gameTableImpl::nextRoundCleanGui() // statusBar()->clearMessage(); //fix press mouse button during bankrupt with anti-peek-mode - this->mouseOverFlipCards(FALSE); + this->mouseOverFlipCards(false); - horizontalSlider_bet->setDisabled(TRUE); - spinBox_betValue->setDisabled(TRUE); + horizontalSlider_bet->setDisabled(true); + spinBox_betValue->setDisabled(true); uncheckMyButtons(); - myButtonsCheckable(FALSE); + myButtonsCheckable(false); resetMyButtonsCheckStateMemory(); clearMyButtons(); pushButton_showMyCards->hide(); @@ -3067,8 +3067,8 @@ void gameTableImpl::breakButtonClicked() #ifdef GUI_800x480 if (tabs.pushButton_break->text() == tr("Stop")) { - tabs.pushButton_break->setDisabled(TRUE); - breakAfterCurrentHand=TRUE; + tabs.pushButton_break->setDisabled(true); + breakAfterCurrentHand=true; } else if (tabs.pushButton_break->text() == tr("Lobby")) { tabsButtonClose(); leaveCurrentNetworkGame(); @@ -3084,8 +3084,8 @@ void gameTableImpl::breakButtonClicked() tabs.pushButton_break->setText(tr("Stop")); #else if (pushButton_break->text() == tr("Stop")) { - pushButton_break->setDisabled(TRUE); - breakAfterCurrentHand=TRUE; + pushButton_break->setDisabled(true); + breakAfterCurrentHand=true; } else if (pushButton_break->text() == tr("Lobby")) { leaveCurrentNetworkGame(); } else if (pushButton_break->text() == tr("Start")) { @@ -3104,7 +3104,7 @@ void gameTableImpl::breakButtonClicked() //let the SoundEventHandler know that there is a new game mySoundEventHandler->newGameStarts(); - currentGameOver = FALSE; + currentGameOver = false; myStartWindow->callNewGameDialog(); //Bei Cancel nichts machen!!! } else { @@ -3118,7 +3118,7 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) // cout << event->key() << endl; - //bool ctrlPressed = FALSE; + //bool ctrlPressed = false; if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return ) { /*ENTER*/ if(spinBox_betValue->hasFocus()) { @@ -3171,7 +3171,7 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) if (event->key() == Qt::Key_Shift) { if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) { pushButton_break->click(); - //ctrlPressed = TRUE; + //ctrlPressed = true; } } // if (event->key() == Qt::Key_Escape && (myActionIsBet || myActionIsRaise)) { @@ -3502,7 +3502,7 @@ void gameTableImpl::localGameModification() int i; for (i=0; istopTimeOutAnimation(); - playerAvatarLabelArray[i]->setEnabledContextMenu(FALSE); + playerAvatarLabelArray[i]->setEnabledContextMenu(false); } #ifdef GUI_800x480 @@ -3560,9 +3560,9 @@ void gameTableImpl::networkGameModification() int i; for (i=0; isetEnabledContextMenu(TRUE); - playerAvatarLabelArray[i]->setVoteOnKickContextMenuEnabled(TRUE); - playerAvatarLabelArray[i]->setVoteRunning(FALSE); + playerAvatarLabelArray[i]->setEnabledContextMenu(true); + playerAvatarLabelArray[i]->setVoteOnKickContextMenuEnabled(true); + playerAvatarLabelArray[i]->setVoteRunning(false); } if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) { @@ -3635,11 +3635,11 @@ void gameTableImpl::updateMyButtonsState(int mode) boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); if(currentHand->getPreviousPlayerID() == 0) { - myButtonsCheckable(FALSE); + myButtonsCheckable(false); clearMyButtons(); } else { if(currentHand->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_ALLIN) { // dont show pre-actions after flip cards when allin - myButtonsCheckable(TRUE); + myButtonsCheckable(true); provideMyActions(mode); } } @@ -3648,20 +3648,20 @@ void gameTableImpl::updateMyButtonsState(int mode) void gameTableImpl::uncheckMyButtons() { - pushButton_BetRaise->setChecked(FALSE); - pushButton_CallCheck->setChecked(FALSE); - pushButton_Fold->setChecked(FALSE); - pushButton_AllIn->setChecked(FALSE); + pushButton_BetRaise->setChecked(false); + pushButton_CallCheck->setChecked(false); + pushButton_Fold->setChecked(false); + pushButton_AllIn->setChecked(false); } void gameTableImpl::resetMyButtonsCheckStateMemory() { - pushButtonCallCheckIsChecked = FALSE; - pushButtonFoldIsChecked = FALSE; - pushButtonAllInIsChecked = FALSE; - pushButtonBetRaiseIsChecked = FALSE; + pushButtonCallCheckIsChecked = false; + pushButtonFoldIsChecked = false; + pushButtonAllInIsChecked = false; + pushButtonBetRaiseIsChecked = false; } void gameTableImpl::clearMyButtons() @@ -3685,23 +3685,23 @@ void gameTableImpl::myButtonsCheckable(bool state) // exception: full bet rule if(!currentHand->getCurrentBeRo()->getFullBetRule()) { - pushButton_BetRaise->setCheckable(TRUE); + pushButton_BetRaise->setCheckable(true); } - pushButton_CallCheck->setCheckable(TRUE); - pushButton_Fold->setCheckable(TRUE); - pushButton_AllIn->setCheckable(TRUE); + pushButton_CallCheck->setCheckable(true); + pushButton_Fold->setCheckable(true); + pushButton_AllIn->setCheckable(true); //design myGameTableStyle->setButtonsStyle(pushButton_BetRaise, pushButton_CallCheck, pushButton_Fold, pushButton_AllIn, 2); - myButtonsAreCheckable = TRUE; + myButtonsAreCheckable = true; } else { //not checkable - pushButton_BetRaise->setCheckable(FALSE); - pushButton_CallCheck->setCheckable(FALSE); - pushButton_Fold->setCheckable(FALSE); - pushButton_AllIn->setCheckable(FALSE); + pushButton_BetRaise->setCheckable(false); + pushButton_CallCheck->setCheckable(false); + pushButton_Fold->setCheckable(false); + pushButton_AllIn->setCheckable(false); QString hover; if(pushButton_AllIn->text()==AllInString) { @@ -3710,7 +3710,7 @@ void gameTableImpl::myButtonsCheckable(bool state) myGameTableStyle->setButtonsStyle(pushButton_BetRaise, pushButton_CallCheck, pushButton_Fold, pushButton_AllIn, 1); } - myButtonsAreCheckable = FALSE; + myButtonsAreCheckable = false; } } @@ -3760,7 +3760,7 @@ void gameTableImpl::changeSpinBoxBetValue(int value) { if(betSliderChangedByInput) { //prevent interval cutting of spinBox_betValue input from code below - betSliderChangedByInput = FALSE; + betSliderChangedByInput = false; } else { if(horizontalSlider_bet->value() == horizontalSlider_bet->maximum()) { @@ -3798,16 +3798,16 @@ void gameTableImpl::spinBoxBetValueChanged(int value) if(value > horizontalSlider_bet->maximum()) { // print the maximum pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(horizontalSlider_bet->maximum())); - betSliderChangedByInput = TRUE; + betSliderChangedByInput = true; horizontalSlider_bet->setValue(horizontalSlider_bet->maximum()); } else { // really print the value pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(value)); - betSliderChangedByInput = TRUE; + betSliderChangedByInput = true; horizontalSlider_bet->setValue(value); } } else { // print the minimum pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(horizontalSlider_bet->minimum())); - betSliderChangedByInput = TRUE; + betSliderChangedByInput = true; horizontalSlider_bet->setValue(horizontalSlider_bet->minimum()); } } @@ -3882,7 +3882,7 @@ void gameTableImpl::startVoteOnKick(unsigned playerId, unsigned voteStarterPlaye int i; for (i=0; isetVoteRunning(TRUE); + playerAvatarLabelArray[i]->setVoteRunning(true); } } @@ -3924,7 +3924,7 @@ void gameTableImpl::endVoteOnKick() int i; for (i=0; isetVoteRunning(FALSE); + playerAvatarLabelArray[i]->setVoteRunning(false); } } diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 1f1a00ea..bea8e5f9 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -44,6 +44,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class guiLog; class ChatTools; diff --git a/src/gui/qt/gametable/log/guilog.h b/src/gui/qt/gametable/log/guilog.h index 3b7c338e..41cdca5a 100644 --- a/src/gui/qt/gametable/log/guilog.h +++ b/src/gui/qt/gametable/log/guilog.h @@ -41,6 +41,9 @@ #include #include #include +#if QT_VERSION >= 0x050000 + #include +#endif struct result_struct { char **result_Session; diff --git a/src/gui/qt/gametable/myactionbutton.h b/src/gui/qt/gametable/myactionbutton.h index 6a377051..b92a862e 100644 --- a/src/gui/qt/gametable/myactionbutton.h +++ b/src/gui/qt/gametable/myactionbutton.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class GameTableStyleReader; diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index 7af36483..363e4057 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -42,7 +42,7 @@ using namespace std; MyAvatarLabel::MyAvatarLabel(QGroupBox* parent) - : QLabel(parent), voteRunning(FALSE), transparent(FALSE) + : QLabel(parent), voteRunning(false), transparent(false) { myContextMenu = new QMenu; @@ -86,9 +86,9 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) GameInfo info(myW->getSession()->getClientGameInfo(myW->getSession()->getClientCurrentGameId())); if(activePlayerCounter > 2 && !voteRunning && info.data.gameType != GAME_TYPE_RANKING && !myW->getGuestMode()) { - setVoteOnKickContextMenuEnabled(TRUE); + setVoteOnKickContextMenuEnabled(true); } else { - setVoteOnKickContextMenuEnabled(FALSE); + setVoteOnKickContextMenuEnabled(false); } action_IgnorePlayer->setEnabled(true); @@ -110,9 +110,9 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) } if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !((*it_c)->getMyAvatar().empty()) ) { - action_ReportBadAvatar->setVisible(TRUE); + action_ReportBadAvatar->setVisible(true); } else { - action_ReportBadAvatar->setVisible(FALSE); + action_ReportBadAvatar->setVisible(false); } } j++; @@ -214,7 +214,7 @@ void MyAvatarLabel::refreshStars() for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) { for(int i=1; i<=5; i++)myW->playerStarsArray[i][seatPlace]->setText(""); if(myW->myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER) { - if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyName()!="" && seatPlace!=0) { + if((*it_c)->getMyStayOnTableStatus() == true && (*it_c)->getMyName()!="" && seatPlace!=0) { int playerStars=getPlayerRating(QString::fromUtf8((*it_c)->getMyName().c_str())); for(int i=1; i<=5; i++) { myW->playerStarsArray[i][seatPlace]->setText(""); @@ -234,7 +234,7 @@ void MyAvatarLabel::refreshTooltips() int seatPlace; PlayerList seatsList = currentGame->getSeatsList(); for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) { - if((*it_c)->getMyStayOnTableStatus() == TRUE || (*it_c)->getMyActiveStatus()) { + if((*it_c)->getMyStayOnTableStatus() == true || (*it_c)->getMyActiveStatus()) { bool computerPlayer = false; if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) { computerPlayer = true; diff --git a/src/gui/qt/gametable/myavatarlabel.h b/src/gui/qt/gametable/myavatarlabel.h index 25db41b9..1065e923 100644 --- a/src/gui/qt/gametable/myavatarlabel.h +++ b/src/gui/qt/gametable/myavatarlabel.h @@ -35,6 +35,9 @@ #include "startwindowimpl.h" #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class gameTableImpl; class startWindowImpl; @@ -65,8 +68,8 @@ public slots: void setVoteRunning ( bool theValue ) { voteRunning = theValue; } - void setPixmap ( const QPixmap &, const bool = FALSE); - void setPixmapAndCountry ( const QPixmap &, QString country, int seatPlace, const bool = FALSE); + void setPixmap ( const QPixmap &, const bool = false); + void setPixmapAndCountry ( const QPixmap &, QString country, int seatPlace, const bool = false); void setPixmapPath ( const QString theValue) { myPath = theValue; } diff --git a/src/gui/qt/gametable/mycardspixmaplabel.cpp b/src/gui/qt/gametable/mycardspixmaplabel.cpp index 1543bf0b..4fdbb5a3 100755 --- a/src/gui/qt/gametable/mycardspixmaplabel.cpp +++ b/src/gui/qt/gametable/mycardspixmaplabel.cpp @@ -36,18 +36,18 @@ MyCardsPixmapLabel::MyCardsPixmapLabel(QGroupBox* parent) : QLabel(parent), myW(NULL) { - this->setMouseTracking(TRUE); + this->setMouseTracking(true); - fadeOutAction = FALSE; - flipCardsAction1 = FALSE; - flipCardsAction2 = FALSE; + fadeOutAction = false; + flipCardsAction1 = false; + flipCardsAction2 = false; - mousePress = FALSE; - fastFlipCardsFront = FALSE; + mousePress = false; + fastFlipCardsFront = false; // rotationIntervall = 0.03; - isFlipside = FALSE; + isFlipside = false; fadeOutTimer = new QTimer; connect(fadeOutTimer, SIGNAL(timeout()), this, SLOT(nextFadeOutFrame())); @@ -78,7 +78,7 @@ void MyCardsPixmapLabel::startFadeOut(int speed) } if(speed != 11) { - fadeOutAction = TRUE; + fadeOutAction = true; frameOpacity = 1.0; fadeOutTimer->start(40); } @@ -89,7 +89,7 @@ void MyCardsPixmapLabel::stopFadeOut() { fadeOutTimer->stop(); - fadeOutAction = FALSE; + fadeOutAction = false; frameOpacity = 1.0; update(); } @@ -105,7 +105,7 @@ void MyCardsPixmapLabel::nextFadeOutFrame() } else { fadeOutTimer->stop(); -// fadeOutAction = FALSE; +// fadeOutAction = false; } } @@ -115,8 +115,8 @@ void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, cons stopFadeOut(); - stopFlipCards = FALSE; - isFlipside = FALSE; + stopFlipCards = false; + isFlipside = false; QLabel::setPixmap(frontPix); @@ -140,7 +140,7 @@ void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, cons } if(speed != 11) { - flipCardsAction1 = TRUE; + flipCardsAction1 = true; flipCardsTimer->start(40); } @@ -150,9 +150,9 @@ void MyCardsPixmapLabel::stopFlipCardsAnimation() { flipCardsTimer->stop(); - flipCardsAction1 = FALSE; - flipCardsAction2 = FALSE; - stopFlipCards = TRUE; + flipCardsAction1 = false; + flipCardsAction2 = false; + stopFlipCards = true; update(); } @@ -165,15 +165,15 @@ void MyCardsPixmapLabel::nextFlipCardsFrame() update(); } else { if(flipCardsAction1) { - flipCardsAction1 = FALSE; - flipCardsAction2 = TRUE; + flipCardsAction1 = false; + flipCardsAction2 = true; } else { //dann front vergrößern if (frameFlipCardsAction2Size < 0.95 ) { frameFlipCardsAction2Size += flipCardsScaleIntervall; update(); } else { - flipCardsAction2 = FALSE; + flipCardsAction2 = false; flipCardsTimer->stop(); } @@ -243,10 +243,10 @@ void MyCardsPixmapLabel::fastFlipCards(bool front) { if (front) { - fastFlipCardsFront = TRUE; + fastFlipCardsFront = true; update(); } else { - fastFlipCardsFront = FALSE; + fastFlipCardsFront = false; update(); } } @@ -255,8 +255,8 @@ void MyCardsPixmapLabel::mousePressEvent(QMouseEvent * event) { if (!mousePress && objectName().contains("pixmapLabel_card0")) { - mousePress = TRUE; - myW->mouseOverFlipCards(TRUE); + mousePress = true; + myW->mouseOverFlipCards(true); } @@ -267,8 +267,8 @@ void MyCardsPixmapLabel::mouseReleaseEvent(QMouseEvent * event) { if (mousePress && objectName().contains("pixmapLabel_card0")) { - mousePress = FALSE; - myW->mouseOverFlipCards(FALSE); + mousePress = false; + myW->mouseOverFlipCards(false); } QLabel::mouseReleaseEvent(event); diff --git a/src/gui/qt/gametable/mycardspixmaplabel.h b/src/gui/qt/gametable/mycardspixmaplabel.h index de1f2e96..5cbd4272 100755 --- a/src/gui/qt/gametable/mycardspixmaplabel.h +++ b/src/gui/qt/gametable/mycardspixmaplabel.h @@ -35,6 +35,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class gameTableImpl; diff --git a/src/gui/qt/gametable/mycashlabel.h b/src/gui/qt/gametable/mycashlabel.h index 05ddf46f..3ae3cf05 100644 --- a/src/gui/qt/gametable/mycashlabel.h +++ b/src/gui/qt/gametable/mycashlabel.h @@ -35,6 +35,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class gameTableImpl; diff --git a/src/gui/qt/gametable/mychancelabel.h b/src/gui/qt/gametable/mychancelabel.h index 41f40177..120ab6ed 100644 --- a/src/gui/qt/gametable/mychancelabel.h +++ b/src/gui/qt/gametable/mychancelabel.h @@ -35,6 +35,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class gameTableImpl; class GameTableStyleReader; diff --git a/src/gui/qt/gametable/mylefttabwidget.h b/src/gui/qt/gametable/mylefttabwidget.h index 288ea889..2397a51e 100755 --- a/src/gui/qt/gametable/mylefttabwidget.h +++ b/src/gui/qt/gametable/mylefttabwidget.h @@ -33,7 +33,9 @@ #include #include - +#if QT_VERSION >= 0x050000 + #include +#endif class MyLeftTabWidget : public QTabWidget { diff --git a/src/gui/qt/gametable/mymenubar.h b/src/gui/qt/gametable/mymenubar.h index 01e14588..4b588905 100644 --- a/src/gui/qt/gametable/mymenubar.h +++ b/src/gui/qt/gametable/mymenubar.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class MyMenuBar : public QMenuBar { diff --git a/src/gui/qt/gametable/mynamelabel.h b/src/gui/qt/gametable/mynamelabel.h index 895a963e..9d62021c 100644 --- a/src/gui/qt/gametable/mynamelabel.h +++ b/src/gui/qt/gametable/mynamelabel.h @@ -35,6 +35,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class gameTableImpl; @@ -51,7 +54,7 @@ public: public slots: - void setText ( const QString &, bool = FALSE, bool = FALSE, bool = FALSE); + void setText ( const QString &, bool = false, bool = false, bool = false); private: QString myText; diff --git a/src/gui/qt/gametable/myrighttabwidget.h b/src/gui/qt/gametable/myrighttabwidget.h index aa7e89df..a822c88e 100755 --- a/src/gui/qt/gametable/myrighttabwidget.h +++ b/src/gui/qt/gametable/myrighttabwidget.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class MyRightTabWidget : public QTabWidget { diff --git a/src/gui/qt/gametable/mysetlabel.h b/src/gui/qt/gametable/mysetlabel.h index 0fd2f891..67491d85 100644 --- a/src/gui/qt/gametable/mysetlabel.h +++ b/src/gui/qt/gametable/mysetlabel.h @@ -35,6 +35,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class gameTableImpl; diff --git a/src/gui/qt/gametable/myslider.h b/src/gui/qt/gametable/myslider.h index b1abda3c..fdaa984d 100644 --- a/src/gui/qt/gametable/myslider.h +++ b/src/gui/qt/gametable/myslider.h @@ -32,6 +32,10 @@ #define MYSLIDER_H #include +#if QT_VERSION >= 0x050000 +#include +#endif + /* * This QSlider Extension was sponsored by: AZEVEDO Filipe aka Nox P@sNox * http://pasnox.tuxfamily.org diff --git a/src/gui/qt/gametable/mystatuslabel.cpp b/src/gui/qt/gametable/mystatuslabel.cpp index 1828669f..10ef9eb4 100755 --- a/src/gui/qt/gametable/mystatuslabel.cpp +++ b/src/gui/qt/gametable/mystatuslabel.cpp @@ -37,7 +37,7 @@ MyStatusLabel::MyStatusLabel(QGroupBox* parent) : QLabel(parent), myW(NULL), mousePress(false) { - mousePress = FALSE; + mousePress = false; } @@ -49,8 +49,8 @@ void MyStatusLabel::mousePressEvent(QMouseEvent * event) { if (!mousePress && objectName().contains("textLabel_Status0")) { - mousePress = TRUE; - myW->mouseOverFlipCards(TRUE); + mousePress = true; + myW->mouseOverFlipCards(true); } @@ -61,8 +61,8 @@ void MyStatusLabel::mouseReleaseEvent(QMouseEvent * event) { if (mousePress && objectName().contains("textLabel_Status0")) { - mousePress = FALSE; - myW->mouseOverFlipCards(FALSE); + mousePress = false; + myW->mouseOverFlipCards(false); } QLabel::mouseReleaseEvent(event); diff --git a/src/gui/qt/gametable/mystatuslabel.h b/src/gui/qt/gametable/mystatuslabel.h index 2fae6606..673b48c2 100755 --- a/src/gui/qt/gametable/mystatuslabel.h +++ b/src/gui/qt/gametable/mystatuslabel.h @@ -35,6 +35,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class gameTableImpl; diff --git a/src/gui/qt/gametable/mytimeoutlabel.cpp b/src/gui/qt/gametable/mytimeoutlabel.cpp index c5e78e38..04133c25 100644 --- a/src/gui/qt/gametable/mytimeoutlabel.cpp +++ b/src/gui/qt/gametable/mytimeoutlabel.cpp @@ -35,7 +35,7 @@ using namespace std; MyTimeoutLabel::MyTimeoutLabel(QGroupBox* parent) - : QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0), isBeep(0), isBeepPlayed(0) + : QLabel(parent), timeOutAnimation(false), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0), isBeep(0), isBeepPlayed(0) { timeOutAnimationTimer = new QTimer; @@ -52,7 +52,7 @@ void MyTimeoutLabel::startTimeOutAnimation(int secs, bool beep) { if (secs >= 4) { // smaller timeouts may lead to errors/endless loops below - isBeepPlayed = FALSE; + isBeepPlayed = false; isBeep = beep; timeOutValue = secs; @@ -80,7 +80,7 @@ void MyTimeoutLabel::startTimeOutAnimation(int secs, bool beep) realTimer.start(); // std::cout << timerIntervall << endl; - timeOutAnimation = TRUE; + timeOutAnimation = true; timeOutAnimationTimer->start(timerIntervall); } } @@ -88,7 +88,7 @@ void MyTimeoutLabel::startTimeOutAnimation(int secs, bool beep) void MyTimeoutLabel::startTimeOutAnimationNow() { - timeOutAnimation = TRUE; + timeOutAnimation = true; timeOutAnimationTimer->start(83); } @@ -98,7 +98,7 @@ void MyTimeoutLabel::stopTimeOutAnimation() // timeOutAnimationKickOnTimer->stop(); timeOutAnimationTimer->stop(); - timeOutAnimation = FALSE; + timeOutAnimation = false; update(); } @@ -110,7 +110,7 @@ void MyTimeoutLabel::nextTimeOutAnimationFrame() //play beep after waitFrames one time if(isBeep && !isBeepPlayed) { myW->getMySoundEventHandler()->playSound("yourturn",0); - isBeepPlayed = TRUE; + isBeepPlayed = true; } //save gfx ressources and never play more the 10 pps unsigned int realTimerValue = realTimer.elapsed().total_milliseconds(); diff --git a/src/gui/qt/gametable/mytimeoutlabel.h b/src/gui/qt/gametable/mytimeoutlabel.h index a1dce5c3..05f29596 100644 --- a/src/gui/qt/gametable/mytimeoutlabel.h +++ b/src/gui/qt/gametable/mytimeoutlabel.h @@ -36,6 +36,9 @@ #include #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class gameTableImpl; diff --git a/src/gui/qt/gametable/startsplash/startsplash.h b/src/gui/qt/gametable/startsplash/startsplash.h index 377d3518..0d24b14c 100755 --- a/src/gui/qt/gametable/startsplash/startsplash.h +++ b/src/gui/qt/gametable/startsplash/startsplash.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class StartSplash : public QSplashScreen diff --git a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp index 4052469e..8b8552df 100644 --- a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp +++ b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp @@ -94,7 +94,7 @@ void internetGameLoginDialogImpl::guestUserToggled(bool b) okButtonCheck(); } -void internetGameLoginDialogImpl::exec() +int internetGameLoginDialogImpl::exec() { if(myConfig->readConfigInt("InternetLoginMode") == 0) { @@ -117,7 +117,7 @@ void internetGameLoginDialogImpl::exec() lineEdit_password->setFocus(); } - QDialog::exec(); + return QDialog::exec(); } void internetGameLoginDialogImpl::accept() diff --git a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.h b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.h index 99620bcb..395ead4d 100644 --- a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.h +++ b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.h @@ -46,7 +46,7 @@ class internetGameLoginDialogImpl : public QDialog, public Ui::internetGameLogin public: internetGameLoginDialogImpl(QWidget *parent = 0, ConfigFile *c =0); - void exec(); + int exec(); void accept(); bool eventFilter(QObject *obj, QEvent *event); diff --git a/src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.cpp b/src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.cpp index 7aa05a8c..d735bfbb 100644 --- a/src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.cpp +++ b/src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.cpp @@ -51,9 +51,9 @@ joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent, ConfigFile if (myConfig->readConfigInt("CLA_NoWriteAccess")) { - pushButton_save->setDisabled(TRUE); - pushButton_delete->setDisabled(TRUE); - treeWidget->setDisabled(TRUE); + pushButton_save->setDisabled(true); + pushButton_delete->setDisabled(true); + treeWidget->setDisabled(true); } connect( lineEdit_ipAddress, SIGNAL( editingFinished()), this, SLOT( checkIp() ) ); @@ -67,7 +67,7 @@ joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent, ConfigFile } -void joinNetworkGameDialogImpl::exec() +int joinNetworkGameDialogImpl::exec() { bool toIntTrue; @@ -79,7 +79,7 @@ void joinNetworkGameDialogImpl::exec() QValidator *validator = new QRegExpValidator(rx, this); lineEdit_profileName->setValidator(validator); - pushButton_delete->setDisabled(TRUE); + pushButton_delete->setDisabled(true); lineEdit_ipAddress->setFocus(); @@ -114,7 +114,7 @@ void joinNetworkGameDialogImpl::exec() connectButtonTest(); - QDialog::exec(); + return QDialog::exec(); } @@ -126,14 +126,12 @@ void joinNetworkGameDialogImpl::startClient() void joinNetworkGameDialogImpl::fillServerProfileList() { - - treeWidget->clear(); TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString()); if(!doc.LoadFile()) { MyMessageBox::warning(this, tr("Load Server-Profile-File Error"), - tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), + tr("Could not load server-profiles-file:\n%1").arg(QString::fromUtf8(myServerProfilesFile.c_str())), QMessageBox::Close); } TiXmlHandle docHandle( &doc ); @@ -184,7 +182,7 @@ void joinNetworkGameDialogImpl::itemFillForm (QTreeWidgetItem* item, int /*colum TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString()); if(!doc.LoadFile()) { MyMessageBox::warning(this, tr("Load Server-Profile-File Error"), - tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), + tr("Could not load server-profiles-file:\n%1").arg(QString::fromUtf8(myServerProfilesFile.c_str())), QMessageBox::Close); } TiXmlHandle docHandle( &doc ); @@ -200,7 +198,7 @@ void joinNetworkGameDialogImpl::itemFillForm (QTreeWidgetItem* item, int /*colum } - pushButton_delete->setEnabled(TRUE); + pushButton_delete->setEnabled(true); } void joinNetworkGameDialogImpl::saveServerProfile() @@ -211,7 +209,7 @@ void joinNetworkGameDialogImpl::saveServerProfile() TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString()); if(!doc.LoadFile()) { MyMessageBox::warning(this, tr("Load Server-Profile-File Error"), - tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), + tr("Could not load server-profiles-file:\n%1").arg(QString::fromUtf8(myServerProfilesFile.c_str())), QMessageBox::Close); } TiXmlHandle docHandle( &doc ); @@ -268,7 +266,7 @@ void joinNetworkGameDialogImpl::saveServerProfile() if(!doc.SaveFile()) { MyMessageBox::warning(this, tr("Save Server-Profile-File Error"), - tr("Could not save server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), + tr("Could not save server-profiles-file:\n%1").arg(QString::fromUtf8(myServerProfilesFile.c_str())), QMessageBox::Close); } @@ -281,7 +279,7 @@ void joinNetworkGameDialogImpl::deleteServerProfile() TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString()); if(!doc.LoadFile()) { MyMessageBox::warning(this, tr("Load Server-Profile-File Error"), - tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), + tr("Could not load server-profiles-file:\n%1").arg(QString::fromUtf8(myServerProfilesFile.c_str())), QMessageBox::Close); } else { TiXmlHandle docHandle( &doc ); @@ -294,7 +292,7 @@ void joinNetworkGameDialogImpl::deleteServerProfile() if(!doc.SaveFile()) { MyMessageBox::warning(this, tr("Save Server-Profile-File Error"), - tr("Could not save server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), + tr("Could not save server-profiles-file:\n%1").arg(QString::fromUtf8(myServerProfilesFile.c_str())), QMessageBox::Close); } @@ -302,7 +300,7 @@ void joinNetworkGameDialogImpl::deleteServerProfile() fillServerProfileList(); } - pushButton_delete->setDisabled(TRUE); + pushButton_delete->setDisabled(true); } void joinNetworkGameDialogImpl::keyPressEvent ( QKeyEvent * event ) @@ -327,8 +325,8 @@ void joinNetworkGameDialogImpl::connectButtonTest() { if(lineEdit_ipAddress->text().isEmpty()) { - pushButton_connect->setDisabled(TRUE); + pushButton_connect->setDisabled(true); } else { - pushButton_connect->setDisabled(FALSE); + pushButton_connect->setDisabled(false); } } diff --git a/src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.h b/src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.h index 9a1708e6..30eb727d 100644 --- a/src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.h +++ b/src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.h @@ -54,7 +54,7 @@ public: ConfigFile *myConfig; std::string myServerProfilesFile; - void exec(); + int exec(); public slots: diff --git a/src/gui/qt/logfiledialog/logfiledialog.cpp b/src/gui/qt/logfiledialog/logfiledialog.cpp index ce36a540..913b560b 100644 --- a/src/gui/qt/logfiledialog/logfiledialog.cpp +++ b/src/gui/qt/logfiledialog/logfiledialog.cpp @@ -70,13 +70,14 @@ LogFileDialog::~LogFileDialog() delete ui; } -void LogFileDialog::exec() +int LogFileDialog::exec() { uploader->Run(); refreshLogFileList(); - QDialog::exec(); + int ret = QDialog::exec(); uploader->SignalTermination(); uploader->Join(THREAD_WAIT_INFINITE); + return ret; } void LogFileDialog::UploadCompleted(const std::string &filename, const std::string &returnMessage) @@ -99,7 +100,7 @@ void LogFileDialog::refreshLogFileList() QFileInfo currentSqliteLogFile(QString::fromStdString(myGuiLog->getMySqliteLogFileName())); - ui->treeWidget_logFiles->blockSignals(TRUE); + ui->treeWidget_logFiles->blockSignals(true); ui->treeWidget_logFiles->clear(); int i; for (i=0; i < dbFilesList.size(); i++) { @@ -119,7 +120,7 @@ void LogFileDialog::refreshLogFileList() ui->treeWidget_logFiles->addTopLevelItem(item); } ui->treeWidget_logFiles->sortItems(0, Qt::DescendingOrder); - ui->treeWidget_logFiles->blockSignals(FALSE); + ui->treeWidget_logFiles->blockSignals(false); ui->treeWidget_logFiles->setCurrentItem(ui->treeWidget_logFiles->topLevelItem(0)); } @@ -200,14 +201,14 @@ void LogFileDialog::showLogFilePreview(ShowLogMode mode) QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); if(mode == INIT_VIEW) { - ui->comboBox->blockSignals(TRUE); + ui->comboBox->blockSignals(true); ui->comboBox->clear(); QList gameIds = myGuiLog->getGameList(selectedItem->data(0, Qt::UserRole).toString()); QList::const_iterator it; for (it = gameIds.constBegin(); it != gameIds.constEnd(); ++it) { ui->comboBox->addItem(QString::number(*it)); } - ui->comboBox->blockSignals(FALSE); + ui->comboBox->blockSignals(false); } if(selectedItem) { @@ -249,7 +250,7 @@ void LogFileDialog::uploadFile() void LogFileDialog::uploadInProgressAnimationStart() { //const QString buttonText(tr("Upload in progress")); - ui->pushButton_analyseLogfile->setDisabled(TRUE); + ui->pushButton_analyseLogfile->setDisabled(true); QMovie *movie = new QMovie(":/gfx/loader.gif"); ui->label_animation->setMovie(movie); @@ -261,7 +262,7 @@ void LogFileDialog::uploadInProgressAnimationStart() void LogFileDialog::uploadInProgressAnimationStop() { - ui->pushButton_analyseLogfile->setDisabled(FALSE); + ui->pushButton_analyseLogfile->setDisabled(false); ui->label_animation->setMaximumWidth(0); ui->horizontalLayout_animation->setSpacing(0); diff --git a/src/gui/qt/logfiledialog/logfiledialog.h b/src/gui/qt/logfiledialog/logfiledialog.h index d53493d8..c542a499 100644 --- a/src/gui/qt/logfiledialog/logfiledialog.h +++ b/src/gui/qt/logfiledialog/logfiledialog.h @@ -61,7 +61,7 @@ public: void setGuiLog(guiLog *g) { myGuiLog = g; } - void exec(); + int exec(); virtual void UploadCompleted(const std::string &filename, const std::string &returnMessage); virtual void UploadError(const std::string &filename, const std::string &errorMessage); diff --git a/src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp b/src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp index d19a0068..1d2d4f94 100755 --- a/src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp +++ b/src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp @@ -47,7 +47,7 @@ newGameDialogImpl::newGameDialogImpl(QMainWindow *parent, ConfigFile *c) } -void newGameDialogImpl::exec() +int newGameDialogImpl::exec() { spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NumberOfPlayers")); @@ -79,7 +79,7 @@ void newGameDialogImpl::exec() myChangeCompleteBlindsDialog->spinBox_afterThisAlwaysRaiseValue->setValue(myConfig->readConfigInt("AfterMBAlwaysRaiseValue")); myChangeCompleteBlindsDialog->radioButton_afterThisStayAtLastBlind->setChecked(myConfig->readConfigInt("AfterMBStayAtLastBlind")); - QDialog::exec(); + return QDialog::exec(); } void newGameDialogImpl::callChangeBlindsDialog(bool show) @@ -89,7 +89,7 @@ void newGameDialogImpl::callChangeBlindsDialog(bool show) myChangeCompleteBlindsDialog->exec(); if(myChangeCompleteBlindsDialog->result() == QDialog::Accepted ) {} else { - radioButton_useSavedBlindsSettings->setChecked(TRUE); + radioButton_useSavedBlindsSettings->setChecked(true); } } diff --git a/src/gui/qt/newlocalgamedialog/newgamedialogimpl.h b/src/gui/qt/newlocalgamedialog/newgamedialogimpl.h index 71b17b49..3faf1e2d 100755 --- a/src/gui/qt/newlocalgamedialog/newgamedialogimpl.h +++ b/src/gui/qt/newlocalgamedialog/newgamedialogimpl.h @@ -39,7 +39,9 @@ #include #include - +#if QT_VERSION >= 0x050000 + #include +#endif class ConfigFile; class changeCompleteBlindsDialogImpl; @@ -50,7 +52,7 @@ class newGameDialogImpl: public QDialog, public Ui::newGameDialog public: newGameDialogImpl(QMainWindow *parent = 0, ConfigFile* = 0); - void exec(); + int exec(); changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog() { return myChangeCompleteBlindsDialog; } diff --git a/src/gui/qt/serverlistdialog/serverlistdialogimpl.cpp b/src/gui/qt/serverlistdialog/serverlistdialogimpl.cpp index 41c76608..d99814aa 100644 --- a/src/gui/qt/serverlistdialog/serverlistdialogimpl.cpp +++ b/src/gui/qt/serverlistdialog/serverlistdialogimpl.cpp @@ -50,10 +50,9 @@ serverListDialogImpl::serverListDialogImpl(startWindowImpl *sw, QMainWindow *par connect( this, SIGNAL( rejected() ), this, SLOT( closeNetworkClient() )); } -void serverListDialogImpl::exec() +int serverListDialogImpl::exec() { - - QDialog::exec(); + return QDialog::exec(); } void serverListDialogImpl::clearList() diff --git a/src/gui/qt/serverlistdialog/serverlistdialogimpl.h b/src/gui/qt/serverlistdialog/serverlistdialogimpl.h index ee034296..6ff6826f 100644 --- a/src/gui/qt/serverlistdialog/serverlistdialogimpl.h +++ b/src/gui/qt/serverlistdialog/serverlistdialogimpl.h @@ -39,7 +39,9 @@ #include #include - +#if QT_VERSION >= 0x050000 + #include +#endif class ConfigFile; class startWindowImpl; @@ -52,7 +54,7 @@ public: public slots: - void exec(); + int exec(); void clearList(); void addServerItem(unsigned); void connectToServer(); @@ -66,4 +68,4 @@ private: }; #endif -void exec(); +int exec(); diff --git a/src/gui/qt/settingsdialog/manualblindsorderdialog/manualblindsorderdialogimpl.cpp b/src/gui/qt/settingsdialog/manualblindsorderdialog/manualblindsorderdialogimpl.cpp index d08820df..b3e676e3 100644 --- a/src/gui/qt/settingsdialog/manualblindsorderdialog/manualblindsorderdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/manualblindsorderdialog/manualblindsorderdialogimpl.cpp @@ -35,7 +35,7 @@ manualBlindsOrderDialogImpl::manualBlindsOrderDialogImpl(QWidget *parent, ConfigFile *c) - : QDialog(parent), myConfig(c), settingsCorrect(TRUE) + : QDialog(parent), myConfig(c), settingsCorrect(true) { #ifdef __APPLE__ setWindowModality(Qt::ApplicationModal); @@ -48,11 +48,9 @@ manualBlindsOrderDialogImpl::manualBlindsOrderDialogImpl(QWidget *parent, Config } -void manualBlindsOrderDialogImpl::exec() +int manualBlindsOrderDialogImpl::exec() { - - - QDialog::exec(); + return QDialog::exec(); } @@ -82,7 +80,7 @@ void manualBlindsOrderDialogImpl::sortBlindsList() int i; QList tempIntList; QStringList tempStringList; - bool ok = TRUE; + bool ok = true; for(i=0; icount(); i++) { // std::cout << listWidget_blinds->item(i)->text().toInt(&ok,10) << "\n"; diff --git a/src/gui/qt/settingsdialog/manualblindsorderdialog/manualblindsorderdialogimpl.h b/src/gui/qt/settingsdialog/manualblindsorderdialog/manualblindsorderdialogimpl.h index 381bf7a8..3aabbd2c 100644 --- a/src/gui/qt/settingsdialog/manualblindsorderdialog/manualblindsorderdialogimpl.h +++ b/src/gui/qt/settingsdialog/manualblindsorderdialog/manualblindsorderdialogimpl.h @@ -48,7 +48,7 @@ class manualBlindsOrderDialogImpl: public QDialog, public Ui::manualBlindsOrderD public: manualBlindsOrderDialogImpl(QWidget *parent = 0, ConfigFile *c = 0); - void exec(); + int exec(); public slots: diff --git a/src/gui/qt/settingsdialog/myavatarbutton.h b/src/gui/qt/settingsdialog/myavatarbutton.h index bb347cfd..bff9a920 100644 --- a/src/gui/qt/settingsdialog/myavatarbutton.h +++ b/src/gui/qt/settingsdialog/myavatarbutton.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class MyAvatarButton : public QPushButton { diff --git a/src/gui/qt/settingsdialog/myhpavatarbutton.h b/src/gui/qt/settingsdialog/myhpavatarbutton.h index fe30b001..e2a79ffb 100644 --- a/src/gui/qt/settingsdialog/myhpavatarbutton.h +++ b/src/gui/qt/settingsdialog/myhpavatarbutton.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class MyHPAvatarButton : public QPushButton { diff --git a/src/gui/qt/settingsdialog/mystylelistitem.h b/src/gui/qt/settingsdialog/mystylelistitem.h index 33e37b16..08dfcc38 100644 --- a/src/gui/qt/settingsdialog/mystylelistitem.h +++ b/src/gui/qt/settingsdialog/mystylelistitem.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class MyStyleListItem : public QTreeWidgetItem { diff --git a/src/gui/qt/settingsdialog/selectavatardialog/myavatarlistitem.h b/src/gui/qt/settingsdialog/selectavatardialog/myavatarlistitem.h index 5de166e2..f0ee6b04 100644 --- a/src/gui/qt/settingsdialog/selectavatardialog/myavatarlistitem.h +++ b/src/gui/qt/settingsdialog/selectavatardialog/myavatarlistitem.h @@ -33,6 +33,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif class MyAvatarListItem : public QListWidgetItem { diff --git a/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp b/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp index fcbf59da..75a132fc 100644 --- a/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp +++ b/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp @@ -36,7 +36,7 @@ selectAvatarDialogImpl::selectAvatarDialogImpl(QWidget *parent, ConfigFile *c) - : QDialog(parent), myConfig(c), settingsCorrect(TRUE), avatarDir("") + : QDialog(parent), myConfig(c), settingsCorrect(true), avatarDir("") { #ifdef __APPLE__ setWindowModality(Qt::ApplicationModal); @@ -56,7 +56,7 @@ selectAvatarDialogImpl::selectAvatarDialogImpl(QWidget *parent, ConfigFile *c) // listWidget->setFlow(QListView::TopToBottom); // listWidget->setWrapping(true); listWidget->setSpacing(20); - listWidget->setDragEnabled(FALSE); + listWidget->setDragEnabled(false); listWidget->setResizeMode(QListView::Adjust); @@ -174,14 +174,12 @@ selectAvatarDialogImpl::selectAvatarDialogImpl(QWidget *parent, ConfigFile *c) } -void selectAvatarDialogImpl::exec() +int selectAvatarDialogImpl::exec() { - //clear lineEdit->setText(""); refreshAvatarView(); - - QDialog::exec(); + return QDialog::exec(); } void selectAvatarDialogImpl::refreshAvatarView() @@ -217,12 +215,12 @@ void selectAvatarDialogImpl::refreshAvatarView() void selectAvatarDialogImpl::toggleGroupBox1(bool /*toggleState*/) { - if(groupBox->isChecked()) groupBox_2->setChecked(FALSE); + if(groupBox->isChecked()) groupBox_2->setChecked(false); } void selectAvatarDialogImpl::toggleGroupBox2(bool /*toggleState*/) { - if(groupBox_2->isChecked()) groupBox->setChecked(FALSE); + if(groupBox_2->isChecked()) groupBox->setChecked(false); } QString selectAvatarDialogImpl::getAvatarLink() @@ -247,15 +245,15 @@ void selectAvatarDialogImpl::isAccepted() QList myItemList = listWidget->selectedItems(); - settingsCorrect = TRUE; + settingsCorrect = true; if(groupBox->isChecked()) { if(myItemList.size() == 0) { MyMessageBox::warning(this, tr("Avatar File Error"), tr("Please select an avatar from the list!"), QMessageBox::Ok); - settingsCorrect = FALSE; - } else settingsCorrect = TRUE;; + settingsCorrect = false; + } else settingsCorrect = true;; } if(groupBox_2->isChecked()) { @@ -264,13 +262,13 @@ void selectAvatarDialogImpl::isAccepted() if(lineEditFile.size() <= 30720 ) { externalAvatar = lineEdit->text(); - settingsCorrect = TRUE; + settingsCorrect = true; } else { MyMessageBox::warning(this, tr("Avatar File Error"), tr("The file size of the chosen picture is too big. (max. 30KB)\n" "Please choose a smaller picture!"), QMessageBox::Ok); - settingsCorrect = FALSE; + settingsCorrect = false; externalAvatar = ""; } @@ -279,7 +277,7 @@ void selectAvatarDialogImpl::isAccepted() tr("The entered avatar picture doesn't exist.\n" "Please enter an valid picture!"), QMessageBox::Ok); - settingsCorrect = FALSE; + settingsCorrect = false; externalAvatar = ""; } } @@ -292,7 +290,7 @@ void selectAvatarDialogImpl::isAccepted() void selectAvatarDialogImpl::isRejected() { - settingsCorrect = FALSE; + settingsCorrect = false; } void selectAvatarDialogImpl::setExternalAvatar() diff --git a/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h b/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h index 55e88342..7fe52a2a 100644 --- a/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h +++ b/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h @@ -36,7 +36,9 @@ #else #include "ui_selectavatardialog.h" #endif - +#if QT_VERSION >= 0x050000 + #include +#endif #include #include @@ -49,7 +51,7 @@ class selectAvatarDialogImpl: public QDialog, public Ui::selectAvatarDialog public: selectAvatarDialogImpl(QWidget *parent = 0, ConfigFile *c = 0); - void exec(); + int exec(); public slots: diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index 6bedb319..f764530a 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -65,7 +65,7 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva pushButton_openLogDir->setIcon(QIcon(QPixmap(myAppDataPath+"gfx/gui/misc/fileopen16.png"))); if (myConfig->readConfigInt("CLA_NoWriteAccess")) { - groupBox_logOnOff->setDisabled(TRUE); + groupBox_logOnOff->setDisabled(true); } comboBox_switchLanguage->addItem(QString(tr("Afrikaans")+" "+QString::fromUtf8("(Afrikaans)")),"af"); @@ -165,7 +165,7 @@ settingsDialogImpl::~settingsDialogImpl() void settingsDialogImpl::prepareDialog() { - playerNickIsChanged = FALSE; + playerNickIsChanged = false; //Player Nicks lineEdit_HumanPlayerName->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str())); @@ -247,10 +247,10 @@ void settingsDialogImpl::prepareDialog() if(myConfig->readConfigInt("UseAvatarServer")) { lineEdit_avatarServerAddress->setText(QString::fromUtf8(myConfig->readConfigString("AvatarServerAddress").c_str())); checkBox_useAvatarServer->setCheckState(Qt::Checked); - lineEdit_avatarServerAddress->setEnabled(TRUE); + lineEdit_avatarServerAddress->setEnabled(true); } else { checkBox_useAvatarServer->setCheckState(Qt::Unchecked); - lineEdit_avatarServerAddress->setEnabled(FALSE); + lineEdit_avatarServerAddress->setEnabled(false); } checkBox_UseInternetGamePassword->setChecked(myConfig->readConfigInt("UseInternetGamePassword")); if(myConfig->readConfigInt("UseInternetGamePassword")) { @@ -261,9 +261,9 @@ void settingsDialogImpl::prepareDialog() comboBox_internetGameType->setCurrentIndex(myConfig->readConfigInt("InternetGameType")); lineEdit_internetGameName->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str())); if(myConfig->readConfigInt("InternetServerConfigMode")) { - groupBox_manualServerConfig->setChecked(TRUE); + groupBox_manualServerConfig->setChecked(true); } else { - groupBox_automaticServerConfig->setChecked(TRUE); + groupBox_automaticServerConfig->setChecked(true); } std::list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); @@ -379,13 +379,13 @@ void settingsDialogImpl::prepareDialog() currentGameTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentGameTableStyle").c_str())); if(currentGameTableStyle.getLoadedSuccessfull()) { int i; - bool currentGameTableFound(FALSE); + bool currentGameTableFound(false); for(i=0; i < treeWidget_gameTableStyles->topLevelItemCount(); i++) { QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(i); if(item->data(0, 15) == currentGameTableStyle.getCurrentFileName()) { item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); treeWidget_gameTableStyles->setCurrentItem(item); - currentGameTableFound=TRUE; + currentGameTableFound=true; } else item->setIcon(0, QIcon()); } if(!currentGameTableFound) { @@ -480,13 +480,13 @@ void settingsDialogImpl::prepareDialog() currentCardDeckStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentCardDeckStyle").c_str())); if(currentCardDeckStyle.getLoadedSuccessfull()) { int j; - bool currentCardDeckFound(FALSE); + bool currentCardDeckFound(false); for(j=0; j < treeWidget_cardDeckStyles->topLevelItemCount(); j++) { QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(j); if(item->data(0, 15) == currentCardDeckStyle.getCurrentFileName()) { item->setIcon(0, QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); treeWidget_cardDeckStyles->setCurrentItem(item); - currentCardDeckFound=TRUE; + currentCardDeckFound=true; } else item->setIcon(0, QIcon()); } if(!currentCardDeckFound) { @@ -521,8 +521,8 @@ void settingsDialogImpl::prepareDialog() radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux")); radioButton_flipsideOwn->setChecked(myConfig->readConfigInt("FlipsideOwn")); if(radioButton_flipsideOwn->isChecked()) { - lineEdit_OwnFlipsideFilename->setEnabled(TRUE); - pushButton_openFlipsidePicture->setEnabled(TRUE); + lineEdit_OwnFlipsideFilename->setEnabled(true); + pushButton_openFlipsidePicture->setEnabled(true); } lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str())); @@ -564,7 +564,7 @@ void settingsDialogImpl::prepareDialog() setFirstSmallBlindMargin(); //set this AFTER switch combobox like config-settings. This IS a currentIndexChanged() ;-) - languageIsChanged = FALSE; + languageIsChanged = false; //disable reset config button when dialog is called from ingame if(calledIngame) { @@ -587,7 +587,7 @@ void settingsDialogImpl::exec(bool in_game) void settingsDialogImpl::isAccepted() { - settingsCorrect = TRUE; + settingsCorrect = true; // Player Nicks //check if all player nicks are unique --> otherwise dont save @@ -608,7 +608,7 @@ void settingsDialogImpl::isAccepted() tr("The opponent names are not unique.\n" "Please choose different names for each Opponent!"), QMessageBox::Ok); - settingsCorrect = FALSE; + settingsCorrect = false; } else { //save nicks and avatars myConfig->writeConfigString("MyName", lineEdit_HumanPlayerName->text().trimmed().toUtf8().constData()); @@ -689,7 +689,7 @@ void settingsDialogImpl::isAccepted() tr("The entered server list address is not a valid URL.\n" "Please enter a valid server list address!"), QMessageBox::Ok); - settingsCorrect = FALSE; + settingsCorrect = false; } } if(groupBox_manualServerConfig->isChecked()) { @@ -755,7 +755,7 @@ void settingsDialogImpl::isAccepted() tr("The entered flipside picture doesn't exist.\n" "Please enter an valid picture!"), QMessageBox::Ok); - settingsCorrect = FALSE; + settingsCorrect = false; } } @@ -815,7 +815,7 @@ void settingsDialogImpl::isAccepted() tr("The log file directory doesn't exist.\n" "Please select an valid directory!"), QMessageBox::Ok); - settingsCorrect = FALSE; + settingsCorrect = false; } myConfig->writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value()); @@ -1021,7 +1021,7 @@ void settingsDialogImpl::callManualBlindsOrderDialog() myManualBlindsOrderDialog->exec(); if(myManualBlindsOrderDialog->result() == QDialog::Accepted) { - bool ok = TRUE; + bool ok = true; int i; myManualBlindsList.clear(); for(i=0; ilistWidget_blinds->count(); i++) { @@ -1057,7 +1057,7 @@ void settingsDialogImpl::callNetManualBlindsOrderDialog() myManualBlindsOrderDialog->exec(); if(myManualBlindsOrderDialog->result() == QDialog::Accepted) { - bool ok = TRUE; + bool ok = true; int i; myNetManualBlindsList.clear(); for(i=0; ilistWidget_blinds->count(); i++) { @@ -1113,21 +1113,21 @@ void settingsDialogImpl::setFirstSmallBlindMargin() void settingsDialogImpl::setLanguageChanged(int index) { - languageIsChanged = TRUE; + languageIsChanged = true; changedLanguageIndex = index; } void settingsDialogImpl::toggleGroupBoxAutomaticServerConfig(bool toggleState) { - if(toggleState) groupBox_manualServerConfig->setChecked(FALSE); - else groupBox_manualServerConfig->setChecked(TRUE); + if(toggleState) groupBox_manualServerConfig->setChecked(false); + else groupBox_manualServerConfig->setChecked(true); } void settingsDialogImpl::toggleGroupBoxManualServerConfig(bool toggleState) { - if(toggleState) groupBox_automaticServerConfig->setChecked(FALSE); - else groupBox_automaticServerConfig->setChecked(TRUE); + if(toggleState) groupBox_automaticServerConfig->setChecked(false); + else groupBox_automaticServerConfig->setChecked(true); } void settingsDialogImpl::showCurrentGameTableStylePreview() @@ -1163,7 +1163,7 @@ void settingsDialogImpl::showCurrentGameTableStylePreview() maintainerEMailString = ""+MaintainerEMail+": "+style.getStyleMaintainerEMail()+"
"; } - label_gameTableStyleInfo->setWordWrap(TRUE); + label_gameTableStyleInfo->setWordWrap(true); label_gameTableStyleInfo->setText(""+MaintainerName+": "+style.getStyleMaintainerName()+"
"+maintainerEMailString+""+CreateDate+": "+style.getStyleCreateDate()+"
"+windowsSubString+"
"+State+": "+style.getMyStateToolTipInfo()); //active the current selected item directly @@ -1171,9 +1171,9 @@ void settingsDialogImpl::showCurrentGameTableStylePreview() //disable remove button for distributed styles if(item->data(0, 16).toInt() == POKERTH_DISTRIBUTED_STYLE) { - pushButton_removeGameTableStyle->setDisabled(TRUE); + pushButton_removeGameTableStyle->setDisabled(true); } else { - pushButton_removeGameTableStyle->setDisabled(FALSE); + pushButton_removeGameTableStyle->setDisabled(false); } } @@ -1208,11 +1208,11 @@ void settingsDialogImpl::addGameTableStyle() if (!fileName.isEmpty()) { int i; - bool fileNameAlreadyFound(FALSE); + bool fileNameAlreadyFound(false); for(i=0; i < treeWidget_gameTableStyles->topLevelItemCount(); i++) { QTreeWidgetItem *item = treeWidget_gameTableStyles->topLevelItem(i); if(item->data(0, 15).toString() == fileName) - fileNameAlreadyFound = TRUE; + fileNameAlreadyFound = true; } if(fileNameAlreadyFound) { @@ -1290,7 +1290,7 @@ void settingsDialogImpl::showCurrentCardDeckStylePreview() } #ifdef GUI_800x480 - label_cardDeckStyleInfo->setWordWrap(TRUE); + label_cardDeckStyleInfo->setWordWrap(true); #endif label_cardDeckStyleInfo->setText(""+MaintainerName+": "+style.getStyleMaintainerName()+"
"+maintainerEMailString+""+CreateDate+": "+style.getStyleCreateDate()+""); //active the current selected item directly @@ -1298,9 +1298,9 @@ void settingsDialogImpl::showCurrentCardDeckStylePreview() //disable remove button for distributed styles if(item->data(0, 16).toInt() == POKERTH_DISTRIBUTED_STYLE) { - pushButton_removeCardDeckStyle->setDisabled(TRUE); + pushButton_removeCardDeckStyle->setDisabled(true); } else { - pushButton_removeCardDeckStyle->setDisabled(FALSE); + pushButton_removeCardDeckStyle->setDisabled(false); } } } @@ -1334,11 +1334,11 @@ void settingsDialogImpl::addCardDeckStyle() if (!fileName.isEmpty()) { int i; - bool fileNameAlreadyFound(FALSE); + bool fileNameAlreadyFound(false); for(i=0; i < treeWidget_cardDeckStyles->topLevelItemCount(); i++) { QTreeWidgetItem *item = treeWidget_cardDeckStyles->topLevelItem(i); if(item->data(0, 15).toString() == fileName) - fileNameAlreadyFound = TRUE; + fileNameAlreadyFound = true; } if(fileNameAlreadyFound) { diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.h b/src/gui/qt/settingsdialog/settingsdialogimpl.h index 6dbe6b8b..6c588a7d 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.h +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.h @@ -41,6 +41,9 @@ #include #include +#if QT_VERSION >= 0x050000 + #include +#endif #include #include @@ -83,7 +86,7 @@ public slots: void isAccepted(); void playerNickChanged() { - setPlayerNickIsChanged(TRUE); + setPlayerNickIsChanged(true); }; void setFlipsidePicFileName(); void setLogDir(); diff --git a/src/gui/qt/sound/androidaudio.cpp b/src/gui/qt/sound/androidaudio.cpp index 7af8c3c2..014adda0 100644 --- a/src/gui/qt/sound/androidaudio.cpp +++ b/src/gui/qt/sound/androidaudio.cpp @@ -35,7 +35,7 @@ #include AndroidAudio::AndroidAudio(ConfigFile *c, QObject *parent) : - QObject(parent), mEngineObject(NULL), mEngineEngine(NULL), mOutputMixObject(NULL), mSounds(), mSoundCount(0), mPlayerObject(NULL), myConfig(c), audioEnabled(FALSE) + QObject(parent), mEngineObject(NULL), mEngineEngine(NULL), mOutputMixObject(NULL), mSounds(), mSoundCount(0), mPlayerObject(NULL), myConfig(c), audioEnabled(false) { initAudio(); } @@ -50,7 +50,7 @@ void AndroidAudio::initAudio() if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) { createEngine(); startSoundPlayer(); - audioEnabled = TRUE; + audioEnabled = true; } } @@ -63,7 +63,7 @@ void AndroidAudio::closeAudio() for (int32_t i = 0; i < mSoundCount; ++i) { qDeleteAll(mSounds); } - audioEnabled = FALSE; + audioEnabled = false; } } @@ -82,7 +82,7 @@ void AndroidAudio::createEngine() Q_ASSERT(SL_RESULT_SUCCESS == result); // realize the engine - result = (*mEngineObject)->Realize(mEngineObject, SL_BOOLEAN_FALSE); + result = (*mEngineObject)->Realize(mEngineObject, SL_BOOLEAN_false); Q_ASSERT(SL_RESULT_SUCCESS == result); // get the engine interface, which is needed in order to create other objects @@ -96,7 +96,7 @@ void AndroidAudio::createEngine() Q_ASSERT(SL_RESULT_SUCCESS == result); // realize the output mix - result = (*mOutputMixObject)->Realize(mOutputMixObject, SL_BOOLEAN_FALSE); + result = (*mOutputMixObject)->Realize(mOutputMixObject, SL_BOOLEAN_false); Q_ASSERT(SL_RESULT_SUCCESS == result); qDebug() << "Created Android Audio Engine"; @@ -171,7 +171,7 @@ void AndroidAudio::startSoundPlayer() //Create the sound player const SLuint32 lSoundPlayerIIDCount = 2; const SLInterfaceID lSoundPlayerIIDs[] = { SL_IID_PLAY, SL_IID_BUFFERQUEUE }; - const SLboolean lSoundPlayerReqs[] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE }; + const SLboolean lSoundPlayerReqs[] = { SL_BOOLEAN_true, SL_BOOLEAN_true }; // qDebug() << "Configured Sound Player"; @@ -180,7 +180,7 @@ void AndroidAudio::startSoundPlayer() // qDebug() << "Created Sound Player"; - lRes = (*mPlayerObject)->Realize(mPlayerObject, SL_BOOLEAN_FALSE); + lRes = (*mPlayerObject)->Realize(mPlayerObject, SL_BOOLEAN_false); Q_ASSERT(SL_RESULT_SUCCESS == lRes); qDebug() << "Realised Sound Player"; diff --git a/src/gui/qt/sound/sdlplayer.cpp b/src/gui/qt/sound/sdlplayer.cpp index f03370c9..5d0d8e90 100644 --- a/src/gui/qt/sound/sdlplayer.cpp +++ b/src/gui/qt/sound/sdlplayer.cpp @@ -39,7 +39,7 @@ using namespace std; SDLPlayer::SDLPlayer(ConfigFile *c) - : sound(NULL), soundData(NULL), currentChannel(0), audioEnabled(FALSE), myConfig(c) + : sound(NULL), soundData(NULL), currentChannel(0), audioEnabled(false), myConfig(c) { myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); SDL_Init(SDL_INIT_AUDIO); diff --git a/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp b/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp index 4d31368e..ba5005d2 100644 --- a/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp +++ b/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp @@ -62,10 +62,9 @@ startNetworkGameDialogImpl::startNetworkGameDialogImpl(startWindowImpl *parent, clearDialog(); } -void startNetworkGameDialogImpl::exec() +int startNetworkGameDialogImpl::exec() { - - QDialog::exec(); + return QDialog::exec(); } void startNetworkGameDialogImpl::startGame() diff --git a/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h b/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h index 7c9868a1..b748cb28 100644 --- a/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h +++ b/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h @@ -92,7 +92,7 @@ public slots: return maxPlayerNumber; } - void exec(); + int exec(); private: diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index aca45629..63fac6e0 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -61,7 +61,7 @@ #ifdef ANDROID #ifndef ANDROID_TEST - #include + #include "QtGui/5.1.0/QtGui/qpa/qplatformnativeinterface.h" #include #endif #endif @@ -114,7 +114,7 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l) } this->showFullScreen(); - //TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(TRUE) + //TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(true) // #ifndef ANDROID_TEST // JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0); // JNIEnv* env; @@ -215,8 +215,8 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l) connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, bool)), myGameLobbyDialog, SLOT(addConnectedPlayer(unsigned, QString, bool))); connect(this, SIGNAL(signalNetClientPlayerChanged(unsigned, QString)), myGameLobbyDialog, SLOT(updatePlayer(unsigned, QString))); connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned, QString)), myGameLobbyDialog, SLOT(removePlayer(unsigned, QString))); - // TODO connect(this, SIGNAL(signalNetClientSpectatorJoined(unsigned, QString)), myGameLobbyDialog, SLOT(addConnectedSpectator(unsigned, QString))); - // TODO connect(this, SIGNAL(signalNetClientSpectatorLeft(unsigned, QString)), myGameLobbyDialog, SLOT(removeSpectator(unsigned, QString))); + connect(this, SIGNAL(signalNetClientSpectatorJoined(unsigned, QString)), myGameLobbyDialog, SLOT(addConnectedSpectator(unsigned, QString))); + connect(this, SIGNAL(signalNetClientSpectatorLeft(unsigned, QString)), myGameLobbyDialog, SLOT(removeSpectator(unsigned, QString))); connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myGameLobbyDialog, SLOT(newGameAdmin(unsigned, QString))); connect(this, SIGNAL(signalNetClientGameListNew(unsigned)), myGameLobbyDialog, SLOT(addGame(unsigned))); @@ -225,8 +225,8 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l) connect(this, SIGNAL(signalNetClientGameListUpdateAdmin(unsigned, unsigned)), myGameLobbyDialog, SLOT(updateGameAdmin(unsigned, unsigned))); connect(this, SIGNAL(signalNetClientGameListPlayerJoined(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameAddPlayer(unsigned, unsigned))); connect(this, SIGNAL(signalNetClientGameListPlayerLeft(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameRemovePlayer(unsigned, unsigned))); - // TODO connect(this, SIGNAL(signalNetClientGameListSpectatorJoined(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameAddSpectator(unsigned, unsigned))); - // TODO connect(this, SIGNAL(signalNetClientGameListSpectatorLeft(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameRemoveSpectator(unsigned, unsigned))); + connect(this, SIGNAL(signalNetClientGameListSpectatorJoined(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameAddSpectator(unsigned, unsigned))); + connect(this, SIGNAL(signalNetClientGameListSpectatorLeft(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameRemoveSpectator(unsigned, unsigned))); connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), myGameLobbyDialog, SLOT(removedFromGame(int))); connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog, SLOT(updateStats(ServerStats))); @@ -320,7 +320,7 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v) gameData.raiseMode = MANUAL_BLINDS_ORDER; list tempBlindList; int i; - bool ok = TRUE; + bool ok = true; for(i=0; igetChangeCompleteBlindsDialog()->listWidget_blinds->count(); i++) { tempBlindList.push_back(v->getChangeCompleteBlindsDialog()->listWidget_blinds->item(i)->text().toInt(&ok,10)); } @@ -534,7 +534,7 @@ void startWindowImpl::callCreateNetworkGameDialog() gameData.raiseMode = MANUAL_BLINDS_ORDER; std::list tempBlindList; int i; - bool ok = TRUE; + bool ok = true; for(i=0; igetChangeCompleteBlindsDialog()->listWidget_blinds->count(); i++) { tempBlindList.push_back(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->listWidget_blinds->item(i)->text().toInt(&ok,10)); } diff --git a/src/gui/qt/styles/carddeckstylereader.cpp b/src/gui/qt/styles/carddeckstylereader.cpp index 47f83cf3..d0f2a7e0 100644 --- a/src/gui/qt/styles/carddeckstylereader.cpp +++ b/src/gui/qt/styles/carddeckstylereader.cpp @@ -148,7 +148,7 @@ void CardDeckStyleReader::readStyleFile(QString file) cardsLeft << "flipside.png"; } - // set loadedSuccessfull TRUE if everything works + // set loadedSuccessfull true if everything works if(leftItems.isEmpty() && cardsLeft.isEmpty() && PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() == POKERTH_CD_STYLE_FILE_VERSION) { myState = CD_STYLE_OK; } else { diff --git a/src/gui/qt/styles/gametablestylereader.cpp b/src/gui/qt/styles/gametablestylereader.cpp index 76b5b1a3..d1829d6c 100644 --- a/src/gui/qt/styles/gametablestylereader.cpp +++ b/src/gui/qt/styles/gametablestylereader.cpp @@ -1245,7 +1245,7 @@ void GameTableStyleReader::readStyleFile(QString file) leftItems << "ChatLogTextSize"; } - //set loadedSuccessfull TRUE if everything works + //set loadedSuccessfull true if everything works // qDebug() << "leftitem is empty: " << leftItems.isEmpty() << "pics left is empty: " << itemPicsLeft.isEmpty() << "stylefileversion is: " << PokerTHStyleFileVersion; if(leftItems.isEmpty() && itemPicsLeft.isEmpty() && PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() == POKERTH_GT_STYLE_FILE_VERSION) { myState = GT_STYLE_OK; @@ -1637,9 +1637,9 @@ void GameTableStyleReader::setWindowsGeometry(gameTableImpl *gt) int availableWidth = dw.screenGeometry().width(); int availableHeight = dw.screenGeometry().height(); if(availableWidth == FixedWindowWidth.toInt() && availableHeight == FixedWindowHeight.toInt()) { - gt->actionFullScreen->setEnabled(TRUE); + gt->actionFullScreen->setEnabled(true); } else { - gt->actionFullScreen->setDisabled(TRUE); + gt->actionFullScreen->setDisabled(true); if(gt->isFullScreen()) { gt->showNormal(); gt->move(50,50); @@ -1656,9 +1656,9 @@ void GameTableStyleReader::setWindowsGeometry(gameTableImpl *gt) int availableWidth = dw.screenGeometry().width(); int availableHeight = dw.screenGeometry().height(); if(availableWidth <= MaximumWindowWidth.toInt() && availableHeight <= MaximumWindowHeight.toInt()) { - gt->actionFullScreen->setEnabled(TRUE); + gt->actionFullScreen->setEnabled(true); } else { - gt->actionFullScreen->setDisabled(TRUE); + gt->actionFullScreen->setDisabled(true); if(gt->isFullScreen()) { gt->showNormal(); gt->move(50,50); diff --git a/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.h b/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.h index 931c4485..c296cb07 100644 --- a/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.h +++ b/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.h @@ -34,6 +34,9 @@ #include #include #include +#if QT_VERSION >= 0x050000 + #include +#endif #include #include "game_defs.h" diff --git a/src/pokerth.cpp b/src/pokerth.cpp index dc3bd03e..d5e7c5c2 100755 --- a/src/pokerth.cpp +++ b/src/pokerth.cpp @@ -33,6 +33,8 @@ #include #include #include + +#include #include #include @@ -84,7 +86,7 @@ int main( int argc, char **argv ) curl_global_init(CURL_GLOBAL_NOTHING); /////// can be removed for non-qt-guis //////////// - QtSingleApplication a( argc, argv ); + SharedTools::QtSingleApplication a( "PokerTH", argc, argv ); if (a.sendMessage("Wake up!")) { return 0; @@ -103,7 +105,9 @@ int main( int argc, char **argv ) Log *myLog = new Log(myConfig); // set PlastiqueStyle even for mac-version to prevent artefacts on styled widgets +#if QT_VERSION < 0x050000 a.setStyle(new QPlastiqueStyle); +#endif QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); //set QApplication default font diff --git a/src/third_party/qtlockedfile/README.txt b/src/third_party/qtlockedfile/README.txt new file mode 100644 index 00000000..6fcf2fd2 --- /dev/null +++ b/src/third_party/qtlockedfile/README.txt @@ -0,0 +1,10 @@ +This is the src directory of the QtLockedFile +solution integrated over from addons/main/utils/qtlockedfile/src . + +namespace.patch was applied to introduce the SharedTools namespace. + +It is required by the QtSingleApplication solution. + +History: + +16.05.2008 Integrated diff --git a/src/third_party/qtlockedfile/namespace.patch b/src/third_party/qtlockedfile/namespace.patch new file mode 100644 index 00000000..eb894a37 --- /dev/null +++ b/src/third_party/qtlockedfile/namespace.patch @@ -0,0 +1,70 @@ + +--- qtlockedfile.cpp 1970-01-01 01:00:00.000000000 ++++ qtlockedfile.cpp 2008/05/16 10:51:19.000000000 +@@ -1,5 +1,7 @@ + #include "qtlockedfile.h" + ++namespace SharedTools { ++ + /*! + \class QtLockedFile + +@@ -123,3 +125,5 @@ + + Destroys the \e QtLockedFile object. If any locks were held, they are released. + */ ++ ++} + +--- qtlockedfile.h 1970-01-01 01:00:00.000000000 ++++ qtlockedfile.h 2008/05/16 10:51:19.000000000 +@@ -19,6 +19,8 @@ + # define QT_QTLOCKEDFILE_EXPORT + #endif + ++namespace SharedTools { ++ + class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile + { + public: +@@ -41,4 +43,6 @@ + LockMode m_lock_mode; + }; + ++} ++ + #endif + +--- qtlockedfile_unix.cpp 1970-01-01 01:00:00.000000000 ++++ qtlockedfile_unix.cpp 2008/05/16 10:51:19.000000000 +@@ -5,6 +5,8 @@ + + #include "qtlockedfile.h" + ++namespace SharedTools { ++ + bool QtLockedFile::lock(LockMode mode, bool block) + { + if (!isOpen()) { +@@ -73,3 +75,4 @@ + unlock(); + } + ++} + +--- qtlockedfile_win.cpp 1970-01-01 01:00:00.000000000 ++++ qtlockedfile_win.cpp 2008/05/16 10:51:19.000000000 +@@ -2,6 +2,8 @@ + #include + #include + ++namespace SharedTools { ++ + #define SEMAPHORE_PREFIX "QtLockedFile semaphore " + #define MUTEX_PREFIX "QtLockedFile mutex " + #define SEMAPHORE_MAX 100 +@@ -168,3 +170,4 @@ + } + } + ++} diff --git a/src/third_party/qtsingleapplication/qtlockedfile.cpp b/src/third_party/qtlockedfile/qtlockedfile.cpp similarity index 50% rename from src/third_party/qtsingleapplication/qtlockedfile.cpp rename to src/third_party/qtlockedfile/qtlockedfile.cpp index d4fad753..b3ac9688 100644 --- a/src/third_party/qtsingleapplication/qtlockedfile.cpp +++ b/src/third_party/qtlockedfile/qtlockedfile.cpp @@ -1,17 +1,18 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software @@ -19,38 +20,21 @@ ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ****************************************************************************/ #include "qtlockedfile.h" +namespace SharedTools { + /*! \class QtLockedFile - \brief The QtLockedFile class extends QFile with advisory locking - functions. + \brief The QtLockedFile class extends QFile with advisory locking functions. A file may be locked in read or write mode. Multiple instances of \e QtLockedFile, created in multiple processes running on the same @@ -62,7 +46,7 @@ another process from manipulating a locked file using QFile or file system functions offered by the OS. Serialization is only guaranteed if all processes that access the file use - QLockedFile. Also, while holding a lock on a file, a process + QtLockedFile. Also, while holding a lock on a file, a process must not open the same file again (through any API), or locks can be unexpectedly lost. @@ -81,8 +65,8 @@ */ /*! - Constructs an unlocked \e QtLockedFile object. This constructor - behaves in the same way as \e QFile::QFile(). + Constructs an unlocked \e QtLockedFile object. This constructor behaves in the same way + as \e QFile::QFile(). \sa QFile::QFile() */ @@ -90,16 +74,15 @@ QtLockedFile::QtLockedFile() : QFile() { #ifdef Q_OS_WIN - wmutex = 0; - rmutex = 0; + m_semaphore_hnd = 0; + m_mutex_hnd = 0; #endif m_lock_mode = NoLock; } /*! - Constructs an unlocked QtLockedFile object with file \a name. This - constructor behaves in the same way as \e QFile::QFile(const - QString&). + Constructs an unlocked QtLockedFile object with file \a name. This constructor behaves in + the same way as \e QFile::QFile(const QString&). \sa QFile::QFile() */ @@ -107,34 +90,12 @@ QtLockedFile::QtLockedFile(const QString &name) : QFile(name) { #ifdef Q_OS_WIN - wmutex = 0; - rmutex = 0; + m_semaphore_hnd = 0; + m_mutex_hnd = 0; #endif m_lock_mode = NoLock; } -/*! - Opens the file in OpenMode \a mode. - - This is identical to QFile::open(), with the one exception that the - Truncate mode flag is disallowed. Truncation would conflict with the - advisory file locking, since the file would be modified before the - write lock is obtained. If truncation is required, use resize(0) - after obtaining the write lock. - - Returns true if successful; otherwise false. - - \sa QFile::open(), QFile::resize() -*/ -bool QtLockedFile::open(OpenMode mode) -{ - if (mode & QIODevice::Truncate) { - qWarning("QtLockedFile::open(): Truncate mode not allowed."); - return false; - } - return QFile::open(mode); -} - /*! Returns \e true if this object has a in read or write lock; otherwise returns \e false. @@ -147,8 +108,7 @@ bool QtLockedFile::isLocked() const } /*! - Returns the type of lock currently held by this object, or \e - QtLockedFile::NoLock. + Returns the type of lock currently held by this object, or \e QtLockedFile::NoLock. \sa isLocked() */ @@ -160,20 +120,18 @@ QtLockedFile::LockMode QtLockedFile::lockMode() const /*! \fn bool QtLockedFile::lock(LockMode mode, bool block = true) - Obtains a lock of type \a mode. The file must be opened before it - can be locked. + Obtains a lock of type \a mode. - If \a block is true, this function will block until the lock is - aquired. If \a block is false, this function returns \e false - immediately if the lock cannot be aquired. + If \a block is true, this + function will block until the lock is acquired. If \a block is + false, this function returns \e false immediately if the lock cannot + be acquired. - If this object already has a lock of type \a mode, this function - returns \e true immediately. If this object has a lock of a - different type than \a mode, the lock is first released and then a - new lock is obtained. + If this object already has a lock of type \a mode, this function returns \e true immediately. If this object has a lock of a different type than \a mode, the lock + is first released and then a new lock is obtained. - This function returns \e true if, after it executes, the file is - locked by this object, and \e false otherwise. + This function returns \e true if, after it executes, the file is locked by this object, + and \e false otherwise. \sa unlock(), isLocked(), lockMode() */ @@ -185,8 +143,8 @@ QtLockedFile::LockMode QtLockedFile::lockMode() const If the object has no lock, this function returns immediately. - This function returns \e true if, after it executes, the file is - not locked by this object, and \e false otherwise. + This function returns \e true if, after it executes, the file is not locked by + this object, and \e false otherwise. \sa lock(), isLocked(), lockMode() */ @@ -194,6 +152,7 @@ QtLockedFile::LockMode QtLockedFile::lockMode() const /*! \fn QtLockedFile::~QtLockedFile() - Destroys the \e QtLockedFile object. If any locks were held, they - are released. + Destroys the \e QtLockedFile object. If any locks were held, they are released. */ + +} // namespace SharedTools diff --git a/src/third_party/qtlockedfile/qtlockedfile.h b/src/third_party/qtlockedfile/qtlockedfile.h new file mode 100644 index 00000000..0bbaac97 --- /dev/null +++ b/src/third_party/qtlockedfile/qtlockedfile.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QTLOCKEDFILE_H +#define QTLOCKEDFILE_H + +#include + +#if defined(Q_OS_WIN) +# if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT) +# define QT_QTLOCKEDFILE_EXPORT +# elif defined(QT_QTLOCKEDFILE_IMPORT) +# if defined(QT_QTLOCKEDFILE_EXPORT) +# undef QT_QTLOCKEDFILE_EXPORT +# endif +# define QT_QTLOCKEDFILE_EXPORT __declspec(dllimport) +# elif defined(QT_QTLOCKEDFILE_EXPORT) +# undef QT_QTLOCKEDFILE_EXPORT +# define QT_QTLOCKEDFILE_EXPORT __declspec(dllexport) +# endif +#else +# define QT_QTLOCKEDFILE_EXPORT +#endif + +namespace SharedTools { + +class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile +{ +public: + enum LockMode { NoLock = 0, ReadLock, WriteLock }; + + QtLockedFile(); + QtLockedFile(const QString &name); + ~QtLockedFile(); + + bool lock(LockMode mode, bool block = true); + bool unlock(); + bool isLocked() const; + LockMode lockMode() const; + +private: +#ifdef Q_OS_WIN + Qt::HANDLE m_semaphore_hnd; + Qt::HANDLE m_mutex_hnd; +#endif + LockMode m_lock_mode; +}; + +} // namespace SharedTools + +#endif // QTLOCKEDFILE_H diff --git a/src/third_party/qtlockedfile/qtlockedfile.pri b/src/third_party/qtlockedfile/qtlockedfile.pri new file mode 100644 index 00000000..46d1f1a1 --- /dev/null +++ b/src/third_party/qtlockedfile/qtlockedfile.pri @@ -0,0 +1,13 @@ +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD +HEADERS += $$PWD/qtlockedfile.h +SOURCES += $$PWD/qtlockedfile.cpp + +unix:SOURCES += $$PWD/qtlockedfile_unix.cpp +win32:SOURCES += $$PWD/qtlockedfile_win.cpp + +win32:contains(TEMPLATE, lib):contains(CONFIG, shared) { + DEFINES += QT_QTLOCKEDFILE_EXPORT=__declspec(dllexport) +} + + diff --git a/src/third_party/qtsingleapplication/qtlockedfile_unix.cpp b/src/third_party/qtlockedfile/qtlockedfile_unix.cpp similarity index 55% rename from src/third_party/qtsingleapplication/qtlockedfile_unix.cpp rename to src/third_party/qtlockedfile/qtlockedfile_unix.cpp index f5997ba4..02e65a81 100644 --- a/src/third_party/qtsingleapplication/qtlockedfile_unix.cpp +++ b/src/third_party/qtlockedfile/qtlockedfile_unix.cpp @@ -1,17 +1,18 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software @@ -19,37 +20,21 @@ ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ****************************************************************************/ +#include "qtlockedfile.h" + #include #include #include #include -#include "qtlockedfile.h" +namespace SharedTools { bool QtLockedFile::lock(LockMode mode, bool block) { @@ -57,10 +42,10 @@ bool QtLockedFile::lock(LockMode mode, bool block) qWarning("QtLockedFile::lock(): file is not opened"); return false; } - + if (mode == NoLock) return unlock(); - + if (mode == m_lock_mode) return true; @@ -74,14 +59,14 @@ bool QtLockedFile::lock(LockMode mode, bool block) fl.l_type = (mode == ReadLock) ? F_RDLCK : F_WRLCK; int cmd = block ? F_SETLKW : F_SETLK; int ret = fcntl(handle(), cmd, &fl); - + if (ret == -1) { if (errno != EINTR && errno != EAGAIN) qWarning("QtLockedFile::lock(): fcntl: %s", strerror(errno)); return false; } - + m_lock_mode = mode; return true; } @@ -103,13 +88,14 @@ bool QtLockedFile::unlock() fl.l_len = 0; fl.l_type = F_UNLCK; int ret = fcntl(handle(), F_SETLKW, &fl); - + if (ret == -1) { qWarning("QtLockedFile::lock(): fcntl: %s", strerror(errno)); return false; } - + m_lock_mode = NoLock; + remove(); return true; } @@ -119,3 +105,4 @@ QtLockedFile::~QtLockedFile() unlock(); } +} // namespace SharedTools diff --git a/src/third_party/qtlockedfile/qtlockedfile_win.cpp b/src/third_party/qtlockedfile/qtlockedfile_win.cpp new file mode 100644 index 00000000..b1500b09 --- /dev/null +++ b/src/third_party/qtlockedfile/qtlockedfile_win.cpp @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qtlockedfile.h" + +#include +#include + +namespace SharedTools { + +#define SEMAPHORE_PREFIX "QtLockedFile semaphore " +#define MUTEX_PREFIX "QtLockedFile mutex " +#define SEMAPHORE_MAX 100 + +static QString errorCodeToString(DWORD errorCode) +{ + QString result; + char *data = 0; + FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + 0, errorCode, 0, + (char*)&data, 0, 0); + result = QString::fromLocal8Bit(data); + if (data != 0) + LocalFree(data); + + if (result.endsWith(QLatin1Char('\n'))) + result.truncate(result.length() - 1); + + return result; +} + +bool QtLockedFile::lock(LockMode mode, bool block) +{ + if (!isOpen()) { + qWarning("QtLockedFile::lock(): file is not opened"); + return false; + } + + if (mode == m_lock_mode) + return true; + + if (m_lock_mode != 0) + unlock(); + + if (m_semaphore_hnd == 0) { + QFileInfo fi(*this); + QString sem_name = QString::fromLatin1(SEMAPHORE_PREFIX) + + fi.absoluteFilePath().toLower(); + + m_semaphore_hnd = CreateSemaphoreW(0, SEMAPHORE_MAX, SEMAPHORE_MAX, + (TCHAR*)sem_name.utf16()); + + if (m_semaphore_hnd == 0) { + qWarning("QtLockedFile::lock(): CreateSemaphore: %s", + errorCodeToString(GetLastError()).toLatin1().constData()); + return false; + } + } + + bool gotMutex = false; + int decrement; + if (mode == ReadLock) { + decrement = 1; + } else { + decrement = SEMAPHORE_MAX; + if (m_mutex_hnd == 0) { + QFileInfo fi(*this); + QString mut_name = QString::fromLatin1(MUTEX_PREFIX) + + fi.absoluteFilePath().toLower(); + + m_mutex_hnd = CreateMutexW(NULL, false, (TCHAR*)mut_name.utf16()); + + if (m_mutex_hnd == 0) { + qWarning("QtLockedFile::lock(): CreateMutex: %s", + errorCodeToString(GetLastError()).toLatin1().constData()); + return false; + } + } + DWORD res = WaitForSingleObject(m_mutex_hnd, block ? INFINITE : 0); + if (res == WAIT_TIMEOUT) + return false; + if (res == WAIT_FAILED) { + qWarning("QtLockedFile::lock(): WaitForSingleObject (mutex): %s", + errorCodeToString(GetLastError()).toLatin1().constData()); + return false; + } + gotMutex = true; + } + + for (int i = 0; i < decrement; ++i) { + DWORD res = WaitForSingleObject(m_semaphore_hnd, block ? INFINITE : 0); + if (res == WAIT_TIMEOUT) { + if (i) { + // A failed nonblocking rw locking. Undo changes to semaphore. + if (ReleaseSemaphore(m_semaphore_hnd, i, NULL) == 0) { + qWarning("QtLockedFile::unlock(): ReleaseSemaphore: %s", + errorCodeToString(GetLastError()).toLatin1().constData()); + // Fall through + } + } + if (gotMutex) + ReleaseMutex(m_mutex_hnd); + return false; + } + if (res != WAIT_OBJECT_0) { + if (gotMutex) + ReleaseMutex(m_mutex_hnd); + qWarning("QtLockedFile::lock(): WaitForSingleObject (semaphore): %s", + errorCodeToString(GetLastError()).toLatin1().constData()); + return false; + } + } + + m_lock_mode = mode; + if (gotMutex) + ReleaseMutex(m_mutex_hnd); + return true; +} + +bool QtLockedFile::unlock() +{ + if (!isOpen()) { + qWarning("QtLockedFile::unlock(): file is not opened"); + return false; + } + + if (!isLocked()) + return true; + + int increment; + if (m_lock_mode == ReadLock) + increment = 1; + else + increment = SEMAPHORE_MAX; + + DWORD ret = ReleaseSemaphore(m_semaphore_hnd, increment, 0); + if (ret == 0) { + qWarning("QtLockedFile::unlock(): ReleaseSemaphore: %s", + errorCodeToString(GetLastError()).toLatin1().constData()); + return false; + } + + m_lock_mode = QtLockedFile::NoLock; + remove(); + return true; +} + +QtLockedFile::~QtLockedFile() +{ + if (isOpen()) + unlock(); + if (m_mutex_hnd != 0) { + DWORD ret = CloseHandle(m_mutex_hnd); + if (ret == 0) { + qWarning("QtLockedFile::~QtLockedFile(): CloseHandle (mutex): %s", + errorCodeToString(GetLastError()).toLatin1().constData()); + } + m_mutex_hnd = 0; + } + if (m_semaphore_hnd != 0) { + DWORD ret = CloseHandle(m_semaphore_hnd); + if (ret == 0) { + qWarning("QtLockedFile::~QtLockedFile(): CloseHandle (semaphore): %s", + errorCodeToString(GetLastError()).toLatin1().constData()); + } + m_semaphore_hnd = 0; + } +} + +} // namespace SharedTools diff --git a/src/third_party/qtsingleapplication/LGPL_EXCEPTION.txt b/src/third_party/qtsingleapplication/LGPL_EXCEPTION.txt deleted file mode 100644 index 0b56ff1e..00000000 --- a/src/third_party/qtsingleapplication/LGPL_EXCEPTION.txt +++ /dev/null @@ -1,10 +0,0 @@ -Nokia Qt LGPL Exception version 1.0 - -As a special exception to the GNU Lesser General Public License -version 2.1, the object code form of a "work that uses the Library" -may incorporate material from a header file that is part of the -Library. You may distribute such object code under terms of your -choice, provided that the incorporated material (i) does not exceed -more than 5% of the total size of the Library; and (ii) is limited to -numerical parameters, data structure layouts, accessors, macros, -inline functions and templates. diff --git a/src/third_party/qtsingleapplication/LICENSE.GPL3 b/src/third_party/qtsingleapplication/LICENSE.GPL3 deleted file mode 100644 index 94a9ed02..00000000 --- a/src/third_party/qtsingleapplication/LICENSE.GPL3 +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/src/third_party/qtsingleapplication/LICENSE.LGPL b/src/third_party/qtsingleapplication/LICENSE.LGPL deleted file mode 100644 index 5ab7695a..00000000 --- a/src/third_party/qtsingleapplication/LICENSE.LGPL +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/src/third_party/qtsingleapplication/QtLockedFile b/src/third_party/qtsingleapplication/QtLockedFile deleted file mode 100644 index 16b48ba9..00000000 --- a/src/third_party/qtsingleapplication/QtLockedFile +++ /dev/null @@ -1 +0,0 @@ -#include "qtlockedfile.h" diff --git a/src/third_party/qtsingleapplication/QtSingleApplication b/src/third_party/qtsingleapplication/QtSingleApplication deleted file mode 100644 index d111bf72..00000000 --- a/src/third_party/qtsingleapplication/QtSingleApplication +++ /dev/null @@ -1 +0,0 @@ -#include "qtsingleapplication.h" diff --git a/src/third_party/qtsingleapplication/README.txt b/src/third_party/qtsingleapplication/README.txt new file mode 100644 index 00000000..1909a33f --- /dev/null +++ b/src/third_party/qtsingleapplication/README.txt @@ -0,0 +1,10 @@ +This is the src directory of the QtSingleApplication solution +integrated over from addons/main/utils/qtsingleapplication/src . + +namespace.patch was applied to introduce the SharedTools namespace. + +It additionally requires the QtLockedFile solution. + +History: + +16.05.2008 Integrated diff --git a/src/third_party/qtsingleapplication/namespace.patch b/src/third_party/qtsingleapplication/namespace.patch new file mode 100644 index 00000000..2876e3a3 --- /dev/null +++ b/src/third_party/qtsingleapplication/namespace.patch @@ -0,0 +1,133 @@ + +--- qtlocalpeer.cpp 1970-01-01 01:00:00.000000000 ++++ qtlocalpeer.cpp 2008/05/16 10:36:53.000000000 +@@ -13,6 +13,8 @@ + #include + #endif + ++namespace SharedTools { ++ + const char* QtLocalPeer::ack = "ack"; + + QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) +@@ -139,3 +141,5 @@ + delete socket; + emit messageReceived(message); // ##(might take a long time to return) + } ++ ++} + +--- qtlocalpeer.h 1970-01-01 01:00:00.000000000 ++++ qtlocalpeer.h 2008/05/16 10:36:53.000000000 +@@ -1,9 +1,11 @@ + ++ + #include + #include + #include + #include + ++namespace SharedTools { + + class QtLocalPeer : public QObject + { +@@ -31,3 +33,5 @@ + private: + static const char* ack; + }; ++ ++} // SharedTools + +--- qtsingleapplication.cpp 1970-01-01 01:00:00.000000000 ++++ qtsingleapplication.cpp 2008/05/16 10:36:53.000000000 +@@ -3,6 +3,8 @@ + #include "qtlocalpeer.h" + #include + ++namespace SharedTools { ++ + void QtSingleApplication::sysInit(const QString &appId) + { + actWin = 0; +@@ -95,3 +97,5 @@ + actWin->activateWindow(); + } + } ++ ++} + +--- qtsingleapplication.h 1970-01-01 01:00:00.000000000 ++++ qtsingleapplication.h 2008/05/16 10:36:53.000000000 +@@ -1,6 +1,8 @@ + + #include + ++namespace SharedTools { ++ + class QtLocalPeer; + + class QtSingleApplication : public QApplication +@@ -47,3 +49,5 @@ + QtLocalPeer *peer; + QWidget *actWin; + }; ++ ++} + +--- qtsingleapplication.pri 1970-01-01 01:00:00.000000000 ++++ qtsingleapplication.pri 2008/05/16 10:36:53.000000000 +@@ -6,7 +6,7 @@ + QT *= network + + gotqtlockedfile = $$find(HEADERS, .*qtlockedfile.h) +-isEmpty(gotqtlockedfile):include(../../qtlockedfile/src/qtlockedfile.pri) ++isEmpty(gotqtlockedfile):include(../qtlockedfile/qtlockedfile.pri) + + + win32:contains(TEMPLATE, lib):contains(CONFIG, shared) { + +--- qtsinglecoreapplication.cpp 1970-01-01 01:00:00.000000000 ++++ qtsinglecoreapplication.cpp 2008/05/16 10:36:53.000000000 +@@ -2,6 +2,7 @@ + #include "qtsinglecoreapplication.h" + #include "qtlocalpeer.h" + ++namespace SharedTools { + + QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv) + : QCoreApplication(argc, argv) +@@ -36,3 +37,4 @@ + return peer->applicationId(); + } + ++} + +--- qtsinglecoreapplication.h 1970-01-01 01:00:00.000000000 ++++ qtsinglecoreapplication.h 2008/05/16 10:36:53.000000000 +@@ -1,6 +1,8 @@ + + #include + ++namespace SharedTools { ++ + class QtLocalPeer; + + class QtSingleCoreApplication : public QCoreApplication +@@ -25,3 +27,5 @@ + private: + QtLocalPeer* peer; + }; ++ ++} + +--- qtsinglecoreapplication.pri 1970-01-01 01:00:00.000000000 ++++ qtsinglecoreapplication.pri 2008/05/16 10:36:53.000000000 +@@ -6,7 +6,7 @@ + QT *= network + + gotqtlockedfile = $$find(HEADERS, .*qtlockedfile.h) +-isEmpty(gotqtlockedfile):include(../../qtlockedfile/src/qtlockedfile.pri) ++isEmpty(gotqtlockedfile):include(../qtlockedfile/qtlockedfile.pri) + + + win32:contains(TEMPLATE, lib):contains(CONFIG, shared) { diff --git a/src/third_party/qtsingleapplication/qtlocalpeer.cpp b/src/third_party/qtsingleapplication/qtlocalpeer.cpp index 57ac9699..43e6bf42 100644 --- a/src/third_party/qtsingleapplication/qtlocalpeer.cpp +++ b/src/third_party/qtsingleapplication/qtlocalpeer.cpp @@ -1,17 +1,18 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software @@ -19,91 +20,65 @@ ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ****************************************************************************/ - #include "qtlocalpeer.h" -#include -#include + +#include +#include #if defined(Q_OS_WIN) -#include -#include +#include +#include typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*); static PProcessIdToSessionId pProcessIdToSessionId = 0; #endif + #if defined(Q_OS_UNIX) #include #include #endif -namespace QtLP_Private { -#include "qtlockedfile.cpp" -#if defined(Q_OS_WIN) -#include "qtlockedfile_win.cpp" -#else -#include "qtlockedfile_unix.cpp" -#endif -} +namespace SharedTools { -const char* QtLocalPeer::ack = "ack"; +static const char ack[] = "ack"; -QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) - : QObject(parent), id(appId) +QString QtLocalPeer::appSessionId(const QString &appId) { - QString prefix = id; - if (id.isEmpty()) { - id = QCoreApplication::applicationFilePath(); -#if defined(Q_OS_WIN) - id = id.toLower(); -#endif - prefix = id.section(QLatin1Char('/'), -1); - } - prefix.remove(QRegExp("[^a-zA-Z]")); - prefix.truncate(6); - - QByteArray idc = id.toUtf8(); + QByteArray idc = appId.toUtf8(); quint16 idNum = qChecksum(idc.constData(), idc.size()); - socketName = QLatin1String("qtsingleapp-") + prefix - + QLatin1Char('-') + QString::number(idNum, 16); + //### could do: two 16bit checksums over separate halves of id, for a 32bit result - improved uniqeness probability. Every-other-char split would be best. + QString res = QLatin1String("qtsingleapplication-") + + QString::number(idNum, 16); #if defined(Q_OS_WIN) if (!pProcessIdToSessionId) { - QLibrary lib("kernel32"); + QLibrary lib(QLatin1String("kernel32")); pProcessIdToSessionId = (PProcessIdToSessionId)lib.resolve("ProcessIdToSessionId"); } if (pProcessIdToSessionId) { DWORD sessionId = 0; pProcessIdToSessionId(GetCurrentProcessId(), &sessionId); - socketName += QLatin1Char('-') + QString::number(sessionId, 16); + res += QLatin1Char('-') + QString::number(sessionId, 16); } #else - socketName += QLatin1Char('-') + QString::number(::getuid(), 16); + res += QLatin1Char('-') + QString::number(::getuid(), 16); #endif + return res; +} +QtLocalPeer::QtLocalPeer(QObject *parent, const QString &appId) + : QObject(parent), id(appId) +{ + if (id.isEmpty()) + id = QCoreApplication::applicationFilePath(); //### On win, check if this returns .../argv[0] without casefolding; .\MYAPP == .\myapp on Win + + socketName = appSessionId(id); server = new QLocalServer(this); QString lockName = QDir(QDir::tempPath()).absolutePath() + QLatin1Char('/') + socketName @@ -112,39 +87,31 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) lockFile.open(QIODevice::ReadWrite); } - - bool QtLocalPeer::isClient() { if (lockFile.isLocked()) return false; - if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false)) + if (!lockFile.lock(QtLockedFile::WriteLock, false)) return true; + if (!QLocalServer::removeServer(socketName)) + qWarning("QtSingleCoreApplication: could not cleanup socket"); bool res = server->listen(socketName); -#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) - // ### Workaround - if (!res && server->serverError() == QAbstractSocket::AddressInUseError) { - QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName); - res = server->listen(socketName); - } -#endif if (!res) qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString())); QObject::connect(server, SIGNAL(newConnection()), SLOT(receiveConnection())); return false; } - -bool QtLocalPeer::sendMessage(const QString &message, int timeout) +bool QtLocalPeer::sendMessage(const QString &message, int timeout, bool block) { if (!isClient()) return false; QLocalSocket socket; bool connOk = false; - for(int i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { // Try twice, in case the other instance is just starting up socket.connectToServer(socketName); connOk = socket.waitForConnected(timeout/2); @@ -165,24 +132,25 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout) QDataStream ds(&socket); ds.writeBytes(uMsg.constData(), uMsg.size()); bool res = socket.waitForBytesWritten(timeout); - if (res) { - res &= socket.waitForReadyRead(timeout); // wait for ack - if (res) { - res &= (socket.read(qstrlen(ack)) == ack); - } - } + res &= socket.waitForReadyRead(timeout); // wait for ack + res &= (socket.read(qstrlen(ack)) == ack); + if (block) // block until peer disconnects + socket.waitForDisconnected(-1); return res; } - void QtLocalPeer::receiveConnection() { QLocalSocket* socket = server->nextPendingConnection(); if (!socket) return; - while (socket->bytesAvailable() < (int)sizeof(quint32)) - socket->waitForReadyRead(); + // Why doesn't Qt have a blocking stream that takes care of this shait??? + while (socket->bytesAvailable() < static_cast(sizeof(quint32))) { + if (!socket->isValid()) // stale request + return; + socket->waitForReadyRead(1000); + } QDataStream ds(socket); QByteArray uMsg; quint32 remaining; @@ -190,19 +158,24 @@ void QtLocalPeer::receiveConnection() uMsg.resize(remaining); int got = 0; char* uMsgBuf = uMsg.data(); + //qDebug() << "RCV: remaining" << remaining; do { got = ds.readRawData(uMsgBuf, remaining); remaining -= got; uMsgBuf += got; + //qDebug() << "RCV: got" << got << "remaining" << remaining; } while (remaining && got >= 0 && socket->waitForReadyRead(2000)); + //### error check: got<0 if (got < 0) { qWarning() << "QtLocalPeer: Message reception failed" << socket->errorString(); delete socket; return; } - QString message(QString::fromUtf8(uMsg)); + // ### async this + QString message = QString::fromUtf8(uMsg.constData(), uMsg.size()); socket->write(ack, qstrlen(ack)); socket->waitForBytesWritten(1000); - delete socket; - emit messageReceived(message); //### (might take a long time to return) + emit messageReceived(message, socket); // ##(might take a long time to return) } + +} // namespace SharedTools diff --git a/src/third_party/qtsingleapplication/qtlocalpeer.h b/src/third_party/qtsingleapplication/qtlocalpeer.h index 1169e1fb..afff3929 100644 --- a/src/third_party/qtsingleapplication/qtlocalpeer.h +++ b/src/third_party/qtsingleapplication/qtlocalpeer.h @@ -1,17 +1,18 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software @@ -19,53 +20,35 @@ ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ****************************************************************************/ - -#include -#include -#include - -namespace QtLP_Private { #include "qtlockedfile.h" -} + +#include +#include +#include + +namespace SharedTools { class QtLocalPeer : public QObject { Q_OBJECT public: - QtLocalPeer(QObject *parent = 0, const QString &appId = QString()); + explicit QtLocalPeer(QObject *parent = 0, const QString &appId = QString()); bool isClient(); - bool sendMessage(const QString &message, int timeout); + bool sendMessage(const QString &message, int timeout, bool block); QString applicationId() const { return id; } + static QString appSessionId(const QString &appId); Q_SIGNALS: - void messageReceived(const QString &message); + void messageReceived(const QString &message, QObject *socket); protected Q_SLOTS: void receiveConnection(); @@ -74,8 +57,7 @@ protected: QString id; QString socketName; QLocalServer* server; - QtLP_Private::QtLockedFile lockFile; - -private: - static const char* ack; + QtLockedFile lockFile; }; + +} // namespace SharedTools diff --git a/src/third_party/qtsingleapplication/qtlockedfile.h b/src/third_party/qtsingleapplication/qtlockedfile.h deleted file mode 100644 index e229484d..00000000 --- a/src/third_party/qtsingleapplication/qtlockedfile.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - -#ifndef QTLOCKEDFILE_H -#define QTLOCKEDFILE_H - -#include -#ifdef Q_OS_WIN -#include -#endif - -#if defined(Q_WS_WIN) -# if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT) -# define QT_QTLOCKEDFILE_EXPORT -# elif defined(QT_QTLOCKEDFILE_IMPORT) -# if defined(QT_QTLOCKEDFILE_EXPORT) -# undef QT_QTLOCKEDFILE_EXPORT -# endif -# define QT_QTLOCKEDFILE_EXPORT __declspec(dllimport) -# elif defined(QT_QTLOCKEDFILE_EXPORT) -# undef QT_QTLOCKEDFILE_EXPORT -# define QT_QTLOCKEDFILE_EXPORT __declspec(dllexport) -# endif -#else -# define QT_QTLOCKEDFILE_EXPORT -#endif - -class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile -{ -public: - enum LockMode { NoLock = 0, ReadLock, WriteLock }; - - QtLockedFile(); - QtLockedFile(const QString &name); - ~QtLockedFile(); - - bool open(OpenMode mode); - - bool lock(LockMode mode, bool block = true); - bool unlock(); - bool isLocked() const; - LockMode lockMode() const; - -private: -#ifdef Q_OS_WIN - Qt::HANDLE wmutex; - Qt::HANDLE rmutex; - QVector rmutexes; - QString mutexname; - - Qt::HANDLE getMutexHandle(int idx, bool doCreate); - bool waitMutex(Qt::HANDLE mutex, bool doBlock); - -#endif - LockMode m_lock_mode; -}; - -#endif diff --git a/src/third_party/qtsingleapplication/qtlockedfile_win.cpp b/src/third_party/qtsingleapplication/qtlockedfile_win.cpp deleted file mode 100644 index 8bbaa53b..00000000 --- a/src/third_party/qtsingleapplication/qtlockedfile_win.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/**************************************************************************** -** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ - -#include "qtlockedfile.h" -#include -#include - -#define MUTEX_PREFIX "QtLockedFile mutex " -// Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS -#define MAX_READERS MAXIMUM_WAIT_OBJECTS - -Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) -{ - if (mutexname.isEmpty()) { - QFileInfo fi(*this); - mutexname = QString::fromLatin1(MUTEX_PREFIX) - + fi.absoluteFilePath().toLower(); - } - QString mname(mutexname); - if (idx >= 0) - mname += QString::number(idx); - - Qt::HANDLE mutex; - if (doCreate) { - QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); }, - { mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } ); - if (!mutex) { - qErrnoWarning("QtLockedFile::lock(): CreateMutex failed"); - return 0; - } - } - else { - QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); }, - { mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } ); - if (!mutex) { - if (GetLastError() != ERROR_FILE_NOT_FOUND) - qErrnoWarning("QtLockedFile::lock(): OpenMutex failed"); - return 0; - } - } - return mutex; -} - -bool QtLockedFile::waitMutex(Qt::HANDLE mutex, bool doBlock) -{ - Q_ASSERT(mutex); - DWORD res = WaitForSingleObject(mutex, doBlock ? INFINITE : 0); - switch (res) { - case WAIT_OBJECT_0: - case WAIT_ABANDONED: - return true; - break; - case WAIT_TIMEOUT: - break; - default: - qErrnoWarning("QtLockedFile::lock(): WaitForSingleObject failed"); - } - return false; -} - - - -bool QtLockedFile::lock(LockMode mode, bool block) -{ - if (!isOpen()) { - qWarning("QtLockedFile::lock(): file is not opened"); - return false; - } - - if (mode == NoLock) - return unlock(); - - if (mode == m_lock_mode) - return true; - - if (m_lock_mode != NoLock) - unlock(); - - if (!wmutex && !(wmutex = getMutexHandle(-1, true))) - return false; - - if (!waitMutex(wmutex, block)) - return false; - - if (mode == ReadLock) { - int idx = 0; - for (; idx < MAX_READERS; idx++) { - rmutex = getMutexHandle(idx, false); - if (!rmutex || waitMutex(rmutex, false)) - break; - CloseHandle(rmutex); - } - bool ok = true; - if (idx >= MAX_READERS) { - qWarning("QtLockedFile::lock(): too many readers"); - rmutex = 0; - ok = false; - } - else if (!rmutex) { - rmutex = getMutexHandle(idx, true); - if (!rmutex || !waitMutex(rmutex, false)) - ok = false; - } - if (!ok && rmutex) { - CloseHandle(rmutex); - rmutex = 0; - } - ReleaseMutex(wmutex); - if (!ok) - return false; - } - else { - Q_ASSERT(rmutexes.isEmpty()); - for (int i = 0; i < MAX_READERS; i++) { - Qt::HANDLE mutex = getMutexHandle(i, false); - if (mutex) - rmutexes.append(mutex); - } - if (rmutexes.size()) { - DWORD res = WaitForMultipleObjects(rmutexes.size(), rmutexes.constData(), - TRUE, block ? INFINITE : 0); - if (res != WAIT_OBJECT_0 && res != WAIT_ABANDONED) { - if (res != WAIT_TIMEOUT) - qErrnoWarning("QtLockedFile::lock(): WaitForMultipleObjects failed"); - m_lock_mode = WriteLock; // trick unlock() to clean up - semiyucky - unlock(); - return false; - } - } - } - - m_lock_mode = mode; - return true; -} - -bool QtLockedFile::unlock() -{ - if (!isOpen()) { - qWarning("QtLockedFile::unlock(): file is not opened"); - return false; - } - - if (!isLocked()) - return true; - - if (m_lock_mode == ReadLock) { - ReleaseMutex(rmutex); - CloseHandle(rmutex); - rmutex = 0; - } - else { - foreach(Qt::HANDLE mutex, rmutexes) { - ReleaseMutex(mutex); - CloseHandle(mutex); - } - rmutexes.clear(); - ReleaseMutex(wmutex); - } - - m_lock_mode = QtLockedFile::NoLock; - return true; -} - -QtLockedFile::~QtLockedFile() -{ - if (isOpen()) - unlock(); - if (wmutex) - CloseHandle(wmutex); -} diff --git a/src/third_party/qtsingleapplication/qtsingleapplication.cpp b/src/third_party/qtsingleapplication/qtsingleapplication.cpp index 2ab0bbd9..692dd844 100644 --- a/src/third_party/qtsingleapplication/qtsingleapplication.cpp +++ b/src/third_party/qtsingleapplication/qtsingleapplication.cpp @@ -1,17 +1,18 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software @@ -19,311 +20,167 @@ ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ****************************************************************************/ - #include "qtsingleapplication.h" #include "qtlocalpeer.h" -#include +#include -/*! - \class QtSingleApplication qtsingleapplication.h - \brief The QtSingleApplication class provides an API to detect and - communicate with running instances of an application. +#include +#include +#include +#include - This class allows you to create applications where only one - instance should be running at a time. I.e., if the user tries to - launch another instance, the already running instance will be - activated instead. Another usecase is a client-server system, - where the first started instance will assume the role of server, - and the later instances will act as clients of that server. +namespace SharedTools { - By default, the full path of the executable file is used to - determine whether two processes are instances of the same - application. You can also provide an explicit identifier string - that will be compared instead. +static const int instancesSize = 1024; - The application should create the QtSingleApplication object early - in the startup phase, and call isRunning() or sendMessage() to - find out if another instance of this application is already - running. Startup parameters (e.g. the name of the file the user - wanted this new instance to open) can be passed to the running - instance in the sendMessage() function. - - If isRunning() or sendMessage() returns false, it means that no - other instance is running, and this instance has assumed the role - as the running instance. The application should continue with the - initialization of the application user interface before entering - the event loop with exec(), as normal. The messageReceived() - signal will be emitted when the application receives messages from - another instance of the same application. - - If isRunning() or sendMessage() returns true, another instance is - already running, and the application should terminate or enter - client mode. - - If a message is received it might be helpful to the user to raise - the application so that it becomes visible. To facilitate this, - QtSingleApplication provides the setActivationWindow() function - and the activateWindow() slot. - - Here's an example that shows how to convert an existing - application to use QtSingleApplication. It is very simple and does - not make use of all QtSingleApplication's functionality (see the - examples for that). - - \code - // Original - int main(int argc, char **argv) - { - QApplication app(argc, argv); - - MyMainWidget mmw; - - mmw.show(); - return app.exec(); - } - - // Single instance - int main(int argc, char **argv) - { - QtSingleApplication app(argc, argv); - - if (app.isRunning()) - return 0; - - MyMainWidget mmw; - - app.setActivationWindow(&mmw); - - mmw.show(); - return app.exec(); - } - \endcode - - Once this QtSingleApplication instance is destroyed(for example, - when the user quits), when the user next attempts to run the - application this instance will not, of course, be encountered. The - next instance to call isRunning() or sendMessage() will assume the - role as the new running instance. - - For console (non-GUI) applications, QtSingleCoreApplication may be - used instead of this class, to avoid the dependency on the QtGui - library. - - \sa QtSingleCoreApplication -*/ - - -void QtSingleApplication::sysInit(const QString &appId) +static QString instancesLockFilename(const QString &appSessionId) { - actWin = 0; - peer = new QtLocalPeer(this, appId); - connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); + const QChar slash(QLatin1Char('/')); + QString res = QDir::tempPath(); + if (!res.endsWith(slash)) + res += slash; + return res + appSessionId + QLatin1String("-instances"); } - -/*! - Creates a QtSingleApplication object. The application identifier - will be QCoreApplication::applicationFilePath(). \a argc, \a - argv, and \a GUIenabled are passed on to the QAppliation constructor. - - If you are creating a console application (i.e. setting \a - GUIenabled to false), you may consider using - QtSingleCoreApplication instead. -*/ - -QtSingleApplication::QtSingleApplication(int &argc, char **argv, bool GUIenabled) - : QApplication(argc, argv, GUIenabled) -{ - sysInit(); -} - - -/*! - Creates a QtSingleApplication object with the application - identifier \a appId. \a argc and \a argv are passed on to the - QAppliation constructor. -*/ - QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv) - : QApplication(argc, argv) + : QApplication(argc, argv), + firstPeer(-1), + pidPeer(0) { - sysInit(appId); + this->appId = appId; + + const QString appSessionId = QtLocalPeer::appSessionId(appId); + + // This shared memory holds a zero-terminated array of active (or crashed) instances + instances = new QSharedMemory(appSessionId, this); + actWin = 0; + block = false; + + // First instance creates the shared memory, later instances attach to it + const bool created = instances->create(instancesSize); + if (!created) { + if (!instances->attach()) { + qWarning() << "Failed to initialize instances shared memory: " + << instances->errorString(); + delete instances; + instances = 0; + return; + } + } + + // QtLockedFile is used to workaround QTBUG-10364 + QtLockedFile lockfile(instancesLockFilename(appSessionId)); + + lockfile.open(QtLockedFile::ReadWrite); + lockfile.lock(QtLockedFile::WriteLock); + qint64 *pids = static_cast(instances->data()); + if (!created) { + // Find the first instance that it still running + // The whole list needs to be iterated in order to append to it + for (; *pids; ++pids) { + if (firstPeer == -1 && isRunning(*pids)) + firstPeer = *pids; + } + } + // Add current pid to list and terminate it + *pids++ = QCoreApplication::applicationPid(); + *pids = 0; + pidPeer = new QtLocalPeer(this, appId + QLatin1Char('-') + + QString::number(QCoreApplication::applicationPid())); + connect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), SIGNAL(messageReceived(QString,QObject*))); + pidPeer->isClient(); + lockfile.unlock(); } - -/*! - Creates a QtSingleApplication object. The application identifier - will be QCoreApplication::applicationFilePath(). \a argc, \a - argv, and \a type are passed on to the QAppliation constructor. -*/ -QtSingleApplication::QtSingleApplication(int &argc, char **argv, Type type) - : QApplication(argc, argv, type) +QtSingleApplication::~QtSingleApplication() { - sysInit(); + if (!instances) + return; + const qint64 appPid = QCoreApplication::applicationPid(); + QtLockedFile lockfile(instancesLockFilename(QtLocalPeer::appSessionId(appId))); + lockfile.open(QtLockedFile::ReadWrite); + lockfile.lock(QtLockedFile::WriteLock); + // Rewrite array, removing current pid and previously crashed ones + qint64 *pids = static_cast(instances->data()); + qint64 *newpids = pids; + for (; *pids; ++pids) { + if (*pids != appPid && isRunning(*pids)) + *newpids++ = *pids; + } + *newpids = 0; + lockfile.unlock(); } - -#if defined(Q_WS_X11) -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be QCoreApplication::applicationFilePath(). \a dpy, \a visual, - and \a cmap are passed on to the QApplication constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, visual, cmap) +bool QtSingleApplication::event(QEvent *event) { - sysInit(); + if (event->type() == QEvent::FileOpen) { + QFileOpenEvent *foe = static_cast(event); + emit fileOpenRequest(foe->file()); + return true; + } + return QApplication::event(event); } -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be QCoreApplication::applicationFilePath(). \a dpy, \a argc, \a - argv, \a visual, and \a cmap are passed on to the QApplication - constructor. -*/ -QtSingleApplication::QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, argc, argv, visual, cmap) +bool QtSingleApplication::isRunning(qint64 pid) { - sysInit(); + if (pid == -1) { + pid = firstPeer; + if (pid == -1) + return false; + } + + QtLocalPeer peer(this, appId + QLatin1Char('-') + QString::number(pid, 10)); + return peer.isClient(); } -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be \a appId. \a dpy, \a argc, \a - argv, \a visual, and \a cmap are passed on to the QApplication - constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, argc, argv, visual, cmap) +bool QtSingleApplication::sendMessage(const QString &message, int timeout, qint64 pid) { - sysInit(appId); -} -#endif + if (pid == -1) { + pid = firstPeer; + if (pid == -1) + return false; + } - -/*! - Returns true if another instance of this application is running; - otherwise false. - - This function does not find instances of this application that are - being run by a different user (on Windows: that are running in - another session). - - \sa sendMessage() -*/ - -bool QtSingleApplication::isRunning() -{ - return peer->isClient(); + QtLocalPeer peer(this, appId + QLatin1Char('-') + QString::number(pid, 10)); + return peer.sendMessage(message, timeout, block); } - -/*! - Tries to send the text \a message to the currently running - instance. The QtSingleApplication object in the running instance - will emit the messageReceived() signal when it receives the - message. - - This function returns true if the message has been sent to, and - processed by, the current instance. If there is no instance - currently running, or if the running instance fails to process the - message within \a timeout milliseconds, this function return false. - - \sa isRunning(), messageReceived() -*/ -bool QtSingleApplication::sendMessage(const QString &message, int timeout) +QString QtSingleApplication::applicationId() const { - return peer->sendMessage(message, timeout); + return appId; } - -/*! - Returns the application identifier. Two processes with the same - identifier will be regarded as instances of the same application. -*/ -QString QtSingleApplication::id() const +void QtSingleApplication::setBlock(bool value) { - return peer->applicationId(); + block = value; } - -/*! - Sets the activation window of this application to \a aw. The - activation window is the widget that will be activated by - activateWindow(). This is typically the application's main window. - - If \a activateOnMessage is true (the default), the window will be - activated automatically every time a message is received, just prior - to the messageReceived() signal being emitted. - - \sa activateWindow(), messageReceived() -*/ - -void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage) +void QtSingleApplication::setActivationWindow(QWidget *aw, bool activateOnMessage) { actWin = aw; + if (!pidPeer) + return; if (activateOnMessage) - connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow())); + connect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), this, SLOT(activateWindow())); else - disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow())); + disconnect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), this, SLOT(activateWindow())); } -/*! - Returns the applications activation window if one has been set by - calling setActivationWindow(), otherwise returns 0. - - \sa setActivationWindow() -*/ QWidget* QtSingleApplication::activationWindow() const { return actWin; } -/*! - De-minimizes, raises, and activates this application's activation window. - This function does nothing if no activation window has been set. - - This is a convenience function to show the user that this - application instance has been activated when he has tried to start - another instance. - - This function should typically be called in response to the - messageReceived() signal. By default, that will happen - automatically, if an activation window has been set. - - \sa setActivationWindow(), messageReceived(), initialize() -*/ void QtSingleApplication::activateWindow() { if (actWin) { @@ -333,19 +190,4 @@ void QtSingleApplication::activateWindow() } } - -/*! - \fn void QtSingleApplication::messageReceived(const QString& message) - - This signal is emitted when the current instance receives a \a - message from another instance of this application. - - \sa sendMessage(), setActivationWindow(), activateWindow() -*/ - - -/*! - \fn void QtSingleApplication::initialize(bool dummy = true) - - \obsolete -*/ +} // namespace SharedTools diff --git a/src/third_party/qtsingleapplication/qtsingleapplication.h b/src/third_party/qtsingleapplication/qtsingleapplication.h index b73f5d66..7ba2f1ea 100644 --- a/src/third_party/qtsingleapplication/qtsingleapplication.h +++ b/src/third_party/qtsingleapplication/qtsingleapplication.h @@ -1,17 +1,18 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software @@ -19,87 +20,55 @@ ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ****************************************************************************/ +#include -#include +QT_FORWARD_DECLARE_CLASS(QSharedMemory) + +namespace SharedTools { class QtLocalPeer; -#if defined(Q_WS_WIN) -# if !defined(QT_QTSINGLEAPPLICATION_EXPORT) && !defined(QT_QTSINGLEAPPLICATION_IMPORT) -# define QT_QTSINGLEAPPLICATION_EXPORT -# elif defined(QT_QTSINGLEAPPLICATION_IMPORT) -# if defined(QT_QTSINGLEAPPLICATION_EXPORT) -# undef QT_QTSINGLEAPPLICATION_EXPORT -# endif -# define QT_QTSINGLEAPPLICATION_EXPORT __declspec(dllimport) -# elif defined(QT_QTSINGLEAPPLICATION_EXPORT) -# undef QT_QTSINGLEAPPLICATION_EXPORT -# define QT_QTSINGLEAPPLICATION_EXPORT __declspec(dllexport) -# endif -#else -# define QT_QTSINGLEAPPLICATION_EXPORT -#endif - -class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication +class QtSingleApplication : public QApplication { Q_OBJECT public: - QtSingleApplication(int &argc, char **argv, bool GUIenabled = true); QtSingleApplication(const QString &id, int &argc, char **argv); - QtSingleApplication(int &argc, char **argv, Type type); -#if defined(Q_WS_X11) - QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); - QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); - QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); -#endif + ~QtSingleApplication(); - bool isRunning(); - QString id() const; + bool isRunning(qint64 pid = -1); void setActivationWindow(QWidget* aw, bool activateOnMessage = true); QWidget* activationWindow() const; + bool event(QEvent *event); - // Obsolete: - void initialize(bool dummy = true) - { isRunning(); Q_UNUSED(dummy) } + QString applicationId() const; + void setBlock(bool value); public Q_SLOTS: - bool sendMessage(const QString &message, int timeout = 5000); + bool sendMessage(const QString &message, int timeout = 5000, qint64 pid = -1); void activateWindow(); - Q_SIGNALS: - void messageReceived(const QString &message); - + void messageReceived(const QString &message, QObject *socket); + void fileOpenRequest(const QString &file); private: - void sysInit(const QString &appId = QString()); - QtLocalPeer *peer; + QString instancesFileName(const QString &appId); + + qint64 firstPeer; + QSharedMemory *instances; + QtLocalPeer *pidPeer; QWidget *actWin; + QString appId; + bool block; }; + +} // namespace SharedTools diff --git a/src/third_party/qtsingleapplication/qtsingleapplication.pri b/src/third_party/qtsingleapplication/qtsingleapplication.pri index 5909f049..c807763d 100644 --- a/src/third_party/qtsingleapplication/qtsingleapplication.pri +++ b/src/third_party/qtsingleapplication/qtsingleapplication.pri @@ -1,16 +1,15 @@ -include(../common.pri) -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD +HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h +SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp + QT *= network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -qtsingleapplication-uselib:!qtsingleapplication-buildlib { - LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME -} else { - SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp - HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h -} +gotqtlockedfile = $$find(HEADERS, .*qtlockedfile.h) +isEmpty(gotqtlockedfile):include(../qtlockedfile/qtlockedfile.pri) -win32 { - contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT - else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT + +win32:contains(TEMPLATE, lib):contains(CONFIG, shared) { + DEFINES += QT_QTSINGLEAPPLICATION_EXPORT=__declspec(dllexport) } diff --git a/src/third_party/qtsingleapplication/qtsinglecoreapplication.cpp b/src/third_party/qtsingleapplication/qtsinglecoreapplication.cpp index 9b7fc40b..ff22fdba 100644 --- a/src/third_party/qtsingleapplication/qtsinglecoreapplication.cpp +++ b/src/third_party/qtsingleapplication/qtsinglecoreapplication.cpp @@ -1,17 +1,18 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software @@ -19,137 +20,49 @@ ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ****************************************************************************/ - #include "qtsinglecoreapplication.h" #include "qtlocalpeer.h" -/*! - \class QtSingleCoreApplication qtsinglecoreapplication.h - \brief A variant of the QtSingleApplication class for non-GUI applications. - - This class is a variant of QtSingleApplication suited for use in - console (non-GUI) applications. It is an extension of - QCoreApplication (instead of QApplication). It does not require - the QtGui library. - - The API and usage is identical to QtSingleApplication, except that - functions relating to the "activation window" are not present, for - obvious reasons. Please refer to the QtSingleApplication - documentation for explanation of the usage. - - A QtSingleCoreApplication instance can communicate to a - QtSingleApplication instance if they share the same application - id. Hence, this class can be used to create a light-weight - command-line tool that sends commands to a GUI application. - - \sa QtSingleApplication -*/ - -/*! - Creates a QtSingleCoreApplication object. The application identifier - will be QCoreApplication::applicationFilePath(). \a argc and \a - argv are passed on to the QCoreAppliation constructor. -*/ +namespace SharedTools { QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv) : QCoreApplication(argc, argv) { peer = new QtLocalPeer(this); - connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); + connect(peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString))); } -/*! - Creates a QtSingleCoreApplication object with the application - identifier \a appId. \a argc and \a argv are passed on to the - QCoreAppliation constructor. -*/ QtSingleCoreApplication::QtSingleCoreApplication(const QString &appId, int &argc, char **argv) : QCoreApplication(argc, argv) { peer = new QtLocalPeer(this, appId); - connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); + connect(peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString))); } -/*! - Returns true if another instance of this application is running; - otherwise false. - - This function does not find instances of this application that are - being run by a different user (on Windows: that are running in - another session). - - \sa sendMessage() -*/ - bool QtSingleCoreApplication::isRunning() { return peer->isClient(); } -/*! - Tries to send the text \a message to the currently running - instance. The QtSingleCoreApplication object in the running instance - will emit the messageReceived() signal when it receives the - message. - - This function returns true if the message has been sent to, and - processed by, the current instance. If there is no instance - currently running, or if the running instance fails to process the - message within \a timeout milliseconds, this function return false. - - \sa isRunning(), messageReceived() -*/ - bool QtSingleCoreApplication::sendMessage(const QString &message, int timeout) { return peer->sendMessage(message, timeout); } -/*! - Returns the application identifier. Two processes with the same - identifier will be regarded as instances of the same application. -*/ - QString QtSingleCoreApplication::id() const { return peer->applicationId(); } - -/*! - \fn void QtSingleCoreApplication::messageReceived(const QString& message) - - This signal is emitted when the current instance receives a \a - message from another instance of this application. - - \sa sendMessage() -*/ +} // namespace SharedTools diff --git a/src/third_party/qtsingleapplication/qtsinglecoreapplication.h b/src/third_party/qtsingleapplication/qtsinglecoreapplication.h index f4738d5d..5b888681 100644 --- a/src/third_party/qtsingleapplication/qtsinglecoreapplication.h +++ b/src/third_party/qtsingleapplication/qtsinglecoreapplication.h @@ -1,17 +1,18 @@ /**************************************************************************** ** -** This file is part of a Qt Solutions component. -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Solutions Commercial License Agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and Nokia. -** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software @@ -19,33 +20,16 @@ ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** Please note Third Party Software included with Qt Solutions may impose -** additional restrictions and it is the user's responsibility to ensure -** that they have met the licensing requirements of the GPL, LGPL, or Qt -** Solutions Commercial license and the relevant license of the Third -** Party Software they are using. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** ****************************************************************************/ +#include -#include +namespace SharedTools { class QtLocalPeer; @@ -71,3 +55,5 @@ Q_SIGNALS: private: QtLocalPeer* peer; }; + +} // namespace SharedTools diff --git a/src/third_party/qtsingleapplication/qtsinglecoreapplication.pri b/src/third_party/qtsingleapplication/qtsinglecoreapplication.pri index d2d6cc3e..3d6301b2 100644 --- a/src/third_party/qtsingleapplication/qtsinglecoreapplication.pri +++ b/src/third_party/qtsingleapplication/qtsinglecoreapplication.pri @@ -5,6 +5,10 @@ SOURCES += $$PWD/qtsinglecoreapplication.cpp $$PWD/qtlocalpeer.cpp QT *= network +gotqtlockedfile = $$find(HEADERS, .*qtlockedfile.h) +isEmpty(gotqtlockedfile):include(../qtlockedfile/qtlockedfile.pri) + + win32:contains(TEMPLATE, lib):contains(CONFIG, shared) { DEFINES += QT_QTSINGLECOREAPPLICATION_EXPORT=__declspec(dllexport) }