Reformatting code using Kernighan & Ritchie style, tabs, tab width=4.

Command line: astyle --style=kr --indent=force-tab=4 --lineend=linux -n -r <file names>
This commit is contained in:
lotodore
2011-02-11 20:02:08 +00:00
parent 29dca1846e
commit 02518c67b2
232 changed files with 22743 additions and 21044 deletions
File diff suppressed because it is too large Load Diff
+126 -112
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: gamelobbydialogimpl
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <webmaster@pokerth.net>, (C) 2007
@@ -35,134 +35,148 @@ class MyNickListSortFilterProxyModel;
@author FThauer FHammer <webmaster@pokerth.net>
*/
class gameLobbyDialogImpl: public QDialog, public Ui::gameLobbyDialog {
Q_OBJECT
class gameLobbyDialogImpl: public QDialog, public Ui::gameLobbyDialog
{
Q_OBJECT
public:
gameLobbyDialogImpl(startWindowImpl *parent = 0, ConfigFile* = 0);
gameLobbyDialogImpl(startWindowImpl *parent = 0, ConfigFile* = 0);
~gameLobbyDialogImpl();
~gameLobbyDialogImpl();
void exec();
void exec();
ChatTools *getMyChat() { return myChat; }
ChatTools *getMyChat() {
return myChat;
}
void setSession(boost::shared_ptr<Session> session);
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
void setSession(boost::shared_ptr<Session> session);
boost::shared_ptr<Session> getSession() {
assert(mySession.get());
return mySession;
}
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
void setMyW ( gameTableImpl* theValue ) {
myW = theValue;
}
public slots:
void createGame();
void joinGame();
void joinAnyGame();
void gameSelected(const QModelIndex &);
void updateGameItem(QList <QStandardItem*>, unsigned gameId);
void addGame(unsigned gameId);
void updateGameMode(unsigned gameId, int newMode);
void updateGameAdmin(unsigned gameId, unsigned adminPlayerId);
void removeGame(unsigned gameId);
void gameAddPlayer(unsigned gameId, unsigned playerId);
void gameRemovePlayer(unsigned gameId, unsigned playerId);
void playerJoinedLobby(unsigned playerId, QString playerName);
void playerLeftLobby(unsigned playerId);
void updateStats(ServerStats stats);
void refreshGameStats();
void refreshPlayerStats();
void setCurrentGameName ( const QString& theValue ) { currentGameName = theValue; }
QString getCurrentGameName() const { return currentGameName; }
gameTableImpl* getMyW() const { return myW; }
void checkPlayerQuantity();
void blinkingStartButtonAnimation();
void joinedNetworkGame(unsigned, QString, bool);
void addConnectedPlayer(unsigned, QString, bool);
void updatePlayer(unsigned, QString);
void removePlayer(unsigned, QString);
void newGameAdmin(unsigned, QString);
void refreshConnectedPlayerAvatars();
void playerSelected(QTreeWidgetItem*, QTreeWidgetItem*);
void refresh(int actionID);
void removedFromGame(int reason);
void startGame();
void leaveGame();
void kickPlayer();
void joinedGameDialogUpdate();
void leftGameDialogUpdate();
void updateDialogBlinds(const GameData &gameData);
void clearDialog();
void keyPressEvent(QKeyEvent * keyEvent);
bool event(QEvent * event);
void showGameDescription(bool show);
void showWaitStartGameMsgBox();
void joinAnyGameButtonRefresh();
void reject();
void closeEvent(QCloseEvent *event);
void writeDialogSettings(int);
void readDialogSettings();
void changeGameListFilter(int);
void changeNickListFilter(int);
void changeGameListSorting();
void registeredUserMode();
void guestUserMode();
void showNickListContextMenu(QPoint);
void invitePlayerToCurrentGame();
void showInfoMsgBox();
void showInvitationDialog(unsigned gameId, unsigned playerIdFrom);
void chatInfoPlayerInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
void chatInfoPlayerRejectedInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
void putPlayerOnIgnoreList();
bool playerIsOnIgnoreList(unsigned playerid);
void searchForPlayerRegExpChanged();
void showAutoStartTimer();
void updateAutoStartTimer();
void createGame();
void joinGame();
void joinAnyGame();
void gameSelected(const QModelIndex &);
void updateGameItem(QList <QStandardItem*>, unsigned gameId);
void addGame(unsigned gameId);
void updateGameMode(unsigned gameId, int newMode);
void updateGameAdmin(unsigned gameId, unsigned adminPlayerId);
void removeGame(unsigned gameId);
void gameAddPlayer(unsigned gameId, unsigned playerId);
void gameRemovePlayer(unsigned gameId, unsigned playerId);
void playerJoinedLobby(unsigned playerId, QString playerName);
void playerLeftLobby(unsigned playerId);
void updateStats(ServerStats stats);
void refreshGameStats();
void refreshPlayerStats();
void setCurrentGameName ( const QString& theValue ) {
currentGameName = theValue;
}
QString getCurrentGameName() const {
return currentGameName;
}
gameTableImpl* getMyW() const {
return myW;
}
void checkPlayerQuantity();
void blinkingStartButtonAnimation();
void joinedNetworkGame(unsigned, QString, bool);
void addConnectedPlayer(unsigned, QString, bool);
void updatePlayer(unsigned, QString);
void removePlayer(unsigned, QString);
void newGameAdmin(unsigned, QString);
void refreshConnectedPlayerAvatars();
void playerSelected(QTreeWidgetItem*, QTreeWidgetItem*);
void refresh(int actionID);
void removedFromGame(int reason);
void startGame();
void leaveGame();
void kickPlayer();
void joinedGameDialogUpdate();
void leftGameDialogUpdate();
void updateDialogBlinds(const GameData &gameData);
void clearDialog();
void keyPressEvent(QKeyEvent * keyEvent);
bool event(QEvent * event);
void showGameDescription(bool show);
void showWaitStartGameMsgBox();
void joinAnyGameButtonRefresh();
void reject();
void closeEvent(QCloseEvent *event);
void writeDialogSettings(int);
void readDialogSettings();
void changeGameListFilter(int);
void changeNickListFilter(int);
void changeGameListSorting();
void registeredUserMode();
void guestUserMode();
void showNickListContextMenu(QPoint);
void invitePlayerToCurrentGame();
void showInfoMsgBox();
void showInvitationDialog(unsigned gameId, unsigned playerIdFrom);
void chatInfoPlayerInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
void chatInfoPlayerRejectedInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
void putPlayerOnIgnoreList();
bool playerIsOnIgnoreList(unsigned playerid);
void searchForPlayerRegExpChanged();
void showAutoStartTimer();
void updateAutoStartTimer();
private:
gameTableImpl* myW;
startWindowImpl* myStartWindow;
ConfigFile *myConfig;
boost::shared_ptr<Session> mySession;
createInternetGameDialogImpl *myCreateInternetGameDialog;
QString currentGameName;
unsigned myPlayerId;
bool isGameAdministrator;
bool inGame;
bool guestMode;
gameTableImpl* myW;
startWindowImpl* myStartWindow;
ConfigFile *myConfig;
boost::shared_ptr<Session> mySession;
createInternetGameDialogImpl *myCreateInternetGameDialog;
QString currentGameName;
unsigned myPlayerId;
bool isGameAdministrator;
bool inGame;
bool guestMode;
QString myAppDataPath;
QMessageBox *waitStartGameMsgBox;
QTimer *waitStartGameMsgBoxTimer;
QTimer *blinkingButtonAnimationTimer;
QTimer *showInfoMsgBoxTimer;
QTimer *autoStartTimer;
bool blinkingButtonAnimationState;
QColor defaultStartButtonColor;
QColor defaultStartButtonTextColor;
QColor disabledStartButtonColor;
QColor disabledStartButtonTextColor;
ChatTools *myChat;
int keyUpCounter;
QStandardItemModel *myGameListModel;
QItemSelectionModel *myGameListSelectionModel;
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
QMenu *nickListContextMenu;
QAction *nickListInviteAction;
QAction *nickListIgnorePlayerAction;
QMenu *nickListPlayerInfoSubMenu;
QAction *nickListPlayerInGameInfo;
int infoMsgToShowId;
int currentInvitationGameId;
bool inviteDialogIsCurrentlyShown;
QString myAppDataPath;
QMessageBox *waitStartGameMsgBox;
QTimer *waitStartGameMsgBoxTimer;
QTimer *blinkingButtonAnimationTimer;
QTimer *showInfoMsgBoxTimer;
QTimer *autoStartTimer;
bool blinkingButtonAnimationState;
QColor defaultStartButtonColor;
QColor defaultStartButtonTextColor;
QColor disabledStartButtonColor;
QColor disabledStartButtonTextColor;
ChatTools *myChat;
int keyUpCounter;
QStandardItemModel *myGameListModel;
QItemSelectionModel *myGameListSelectionModel;
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
QMenu *nickListContextMenu;
QAction *nickListInviteAction;
QAction *nickListIgnorePlayerAction;
QMenu *nickListPlayerInfoSubMenu;
QAction *nickListPlayerInGameInfo;
int infoMsgToShowId;
int currentInvitationGameId;
bool inviteDialogIsCurrentlyShown;
QStandardItemModel *myNickListModel;
QItemSelectionModel *myNickListSelectionModel;
MyNickListSortFilterProxyModel *myNickListSortFilterProxyModel;
QStandardItemModel *myNickListModel;
QItemSelectionModel *myNickListSelectionModel;
MyNickListSortFilterProxyModel *myNickListSortFilterProxyModel;
QLabel *autoStartTimerOverlay;
int autoStartTimerCounter;
QLabel *autoStartTimerOverlay;
int autoStartTimerCounter;
protected:
bool eventFilter(QObject *obj, QEvent *event);
bool eventFilter(QObject *obj, QEvent *event);
};
@@ -3,21 +3,22 @@
#include <QtCore>
MyGameListSortFilterProxyModel::MyGameListSortFilterProxyModel(QObject *parent)
: QSortFilterProxyModel(parent)
: QSortFilterProxyModel(parent)
{
}
bool MyGameListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
bool MyGameListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent);
QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent);
QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent);
return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp)
&& sourceModel()->data(index2, 16).toString().contains(column2RegExp)
&& sourceModel()->data(index3, 16).toString().contains(column3RegExp)
&& sourceModel()->data(index4, 16).toString().contains(column4RegExp)) || sourceModel()->data(index0, 16) == "MeInThisGame");
return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp)
&& sourceModel()->data(index2, 16).toString().contains(column2RegExp)
&& sourceModel()->data(index3, 16).toString().contains(column3RegExp)
&& sourceModel()->data(index4, 16).toString().contains(column4RegExp)) || sourceModel()->data(index0, 16) == "MeInThisGame");
}
@@ -4,24 +4,32 @@
#include <QSortFilterProxyModel>
class MyGameListSortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
{
Q_OBJECT
public:
MyGameListSortFilterProxyModel(QObject *parent = 0);
void setColumn1RegExp(QRegExp column1) { column1RegExp = column1; }
void setColumn2RegExp(QRegExp column2) { column2RegExp = column2; }
void setColumn3RegExp(QRegExp column3) { column3RegExp = column3; }
void setColumn4RegExp(QRegExp column4) { column4RegExp = column4; }
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
public:
MyGameListSortFilterProxyModel(QObject *parent = 0);
void setColumn1RegExp(QRegExp column1) {
column1RegExp = column1;
}
void setColumn2RegExp(QRegExp column2) {
column2RegExp = column2;
}
void setColumn3RegExp(QRegExp column3) {
column3RegExp = column3;
}
void setColumn4RegExp(QRegExp column4) {
column4RegExp = column4;
}
private:
QRegExp column1RegExp;
QRegExp column2RegExp;
QRegExp column3RegExp;
QRegExp column4RegExp;
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
private:
QRegExp column1RegExp;
QRegExp column2RegExp;
QRegExp column3RegExp;
QRegExp column4RegExp;
};
@@ -1,7 +1,7 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -16,9 +16,9 @@
using namespace std;
MyGameListTreeWidget::MyGameListTreeWidget(QDialog* parent)
: QTreeWidget(parent)
: QTreeWidget(parent)
{
//set the pixmap cache size in the main function only one time
QPixmapCache::setCacheLimit(1024);
}
@@ -28,13 +28,14 @@ MyGameListTreeWidget::~MyGameListTreeWidget()
{
}
void MyGameListTreeWidget::setGameListBackgroundImage(QString pmString) {
void MyGameListTreeWidget::setGameListBackgroundImage(QString pmString)
{
gameListBGPixmap.load(pmString);
}
// void MyGameListTreeWidget::paintEvent(QPaintEvent *event) {
//
//
// /* QPainter painter(viewport());
// QVector<QRect> rects = event->region().rects();
// for (int i = 0; i < rects.count(); i++) {
@@ -46,16 +47,17 @@ void MyGameListTreeWidget::setGameListBackgroundImage(QString pmString) {
// }
// painter.end();
// QTreeWidget::paintEvent(event);*/
//
//
// QPainter painter(viewport());
// painter.drawPixmap(50, 5, gameListBGPixmap);
//
//
// QTreeWidget::paintEvent(event);
// }
void MyGameListTreeWidget::scrollContentsBy ( int dx, int dy ) {
void MyGameListTreeWidget::scrollContentsBy ( int dx, int dy )
{
viewport()->update();
QTreeWidget::scrollContentsBy ( dx,dy );
}
@@ -1,7 +1,7 @@
//
// C++ Interface: MyGameListTreeWidget
//
// Description:
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
@@ -17,20 +17,20 @@
class MyGameListTreeWidget : public QTreeWidget
{
Q_OBJECT
Q_OBJECT
public:
MyGameListTreeWidget(QDialog*);
MyGameListTreeWidget(QDialog*);
~MyGameListTreeWidget();
~MyGameListTreeWidget();
public slots:
// void paintEvent(QPaintEvent *);
void setGameListBackgroundImage(QString pmString);
void scrollContentsBy ( int dx, int dy );
private:
private:
QPixmap gameListBGPixmap;
@@ -3,59 +3,59 @@
#include <QtCore>
MyNickListSortFilterProxyModel::MyNickListSortFilterProxyModel(QObject *parent)
: QSortFilterProxyModel(parent), filterState(0)
: QSortFilterProxyModel(parent), filterState(0)
{
}
bool MyNickListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
switch(filterState) {
switch(filterState) {
case 0: {
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
}
break;
case 1: {
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
}
break;
case 2: {
QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
return sourceModel()->data(index0, 34).toString().contains("idle") && QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
}
break;
case 0: {
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
}
break;
case 1: {
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
}
break;
case 2: {
QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
return sourceModel()->data(index0, 34).toString().contains("idle") && QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
}
break;
}
}
return false;
return false;
}
bool MyNickListSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
switch(filterState) {
switch(filterState) {
case 0: {
return QSortFilterProxyModel::lessThan(left, right);
}
break;
case 1: {
QString leftCountryAndName(sourceModel()->data(left, 33).toString().toUpper()+sourceModel()->data(left, Qt::DisplayRole).toString().toLower());
QString rightCountryAndName(sourceModel()->data(right, 33).toString().toUpper()+sourceModel()->data(right, Qt::DisplayRole).toString().toLower());
return leftCountryAndName < rightCountryAndName;
}
break;
case 2: {
return QSortFilterProxyModel::lessThan(left, right);
}
break;
}
case 0: {
return QSortFilterProxyModel::lessThan(left, right);
}
break;
case 1: {
QString leftCountryAndName(sourceModel()->data(left, 33).toString().toUpper()+sourceModel()->data(left, Qt::DisplayRole).toString().toLower());
QString rightCountryAndName(sourceModel()->data(right, 33).toString().toUpper()+sourceModel()->data(right, Qt::DisplayRole).toString().toLower());
return leftCountryAndName < rightCountryAndName;
}
break;
case 2: {
return QSortFilterProxyModel::lessThan(left, right);
}
break;
}
return false;
return false;
}
void MyNickListSortFilterProxyModel::setFilterState(int state)
{
filterState = state;
filterState = state;
}
@@ -4,21 +4,21 @@
#include <QSortFilterProxyModel>
class MyNickListSortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
{
Q_OBJECT
public:
MyNickListSortFilterProxyModel(QObject *parent = 0);
MyNickListSortFilterProxyModel(QObject *parent = 0);
void setFilterState(int state);
void setFilterState(int state);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
private:
int filterState;
int filterState;
};