From a569a1b8b1e81551ecf9fb04babbee4e5be39f0e Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Wed, 3 Aug 2011 01:19:57 +0200 Subject: [PATCH] changed chat indentation, allow leftclick for CardInfoWidget in ChatView, changed GameSelector indentation --- cockatrice/src/chatview.cpp | 24 +++++++++++------------- cockatrice/src/gameselector.cpp | 3 ++- cockatrice/src/gamesmodel.cpp | 8 ++++---- common/server_game.cpp | 3 ++- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cockatrice/src/chatview.cpp b/cockatrice/src/chatview.cpp index c5cdf06f..3694fb0b 100644 --- a/cockatrice/src/chatview.cpp +++ b/cockatrice/src/chatview.cpp @@ -47,12 +47,9 @@ void ChatView::appendMessage(QString sender, QString message, QColor playerColor QTextCursor cursor = prepareBlock(sameSender); lastSender = sender; - if (showTimestamps) { + if (showTimestamps && !sameSender) { QTextCharFormat timeFormat; - if (sameSender) - timeFormat.setForeground(Qt::transparent); - else - timeFormat.setForeground(Qt::black); + timeFormat.setForeground(Qt::black); cursor.setCharFormat(timeFormat); cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm] ")); } @@ -69,12 +66,13 @@ void ChatView::appendMessage(QString sender, QString message, QColor playerColor if (playerBold) senderFormat.setFontWeight(QFont::Bold); } - if (sameSender) - senderFormat.setForeground(Qt::transparent); - cursor.setCharFormat(senderFormat); - if (!sender.isEmpty()) - sender.append(": "); - cursor.insertText(sender); + if (!sameSender) { + cursor.setCharFormat(senderFormat); + if (!sender.isEmpty()) + sender.append(": "); + cursor.insertText(sender); + } else + cursor.insertText(" "); QTextCharFormat messageFormat; if (sender.isEmpty()) @@ -179,7 +177,7 @@ void ChatView::mouseMoveEvent(QMouseEvent *event) void ChatView::mousePressEvent(QMouseEvent *event) { - if (event->button() == Qt::MidButton) { + if ((event->button() == Qt::MidButton) || (event->button() == Qt::LeftButton)) { QString cardName = getCardNameUnderMouse(event->pos()); if (!cardName.isEmpty()) emit showCardInfoPopup(event->globalPos(), cardName); @@ -190,7 +188,7 @@ void ChatView::mousePressEvent(QMouseEvent *event) void ChatView::mouseReleaseEvent(QMouseEvent *event) { - if (event->button() == Qt::MidButton) + if ((event->button() == Qt::MidButton) || (event->button() == Qt::LeftButton)) emit deleteCardInfoPopup(QString("_")); QTextBrowser::mouseReleaseEvent(event); diff --git a/cockatrice/src/gameselector.cpp b/cockatrice/src/gameselector.cpp index 1feb63d0..6d3ee6a3 100644 --- a/cockatrice/src/gameselector.cpp +++ b/cockatrice/src/gameselector.cpp @@ -23,8 +23,9 @@ GameSelector::GameSelector(AbstractClient *_client, TabRoom *_room, const QMapsetModel(gameListProxyModel); gameListView->setSortingEnabled(true); gameListView->setAlternatingRowColors(true); + gameListView->setRootIsDecorated(true); if (_room) - gameListView->header()->hideSection(0); + gameListView->header()->hideSection(1); gameListView->header()->setResizeMode(1, QHeaderView::ResizeToContents); showFullGamesCheckBox = new QCheckBox; diff --git a/cockatrice/src/gamesmodel.cpp b/cockatrice/src/gamesmodel.cpp index fc8e7d55..031c4207 100644 --- a/cockatrice/src/gamesmodel.cpp +++ b/cockatrice/src/gamesmodel.cpp @@ -30,8 +30,8 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const ServerInfo_Game *g = gameList[index.row()]; switch (index.column()) { - case 0: return rooms.value(g->getRoomId()); - case 1: return g->getDescription(); + case 0: return g->getDescription(); + case 1: return rooms.value(g->getRoomId()); case 2: return g->getCreatorInfo()->getName(); case 3: { QStringList result; @@ -61,8 +61,8 @@ QVariant GamesModel::headerData(int section, Qt::Orientation orientation, int ro if ((role != Qt::DisplayRole) || (orientation != Qt::Horizontal)) return QVariant(); switch (section) { - case 0: return tr("Room"); - case 1: return tr("Description"); + case 0: return tr("Description"); + case 1: return tr("Room"); case 2: return tr("Creator"); case 3: return tr("Game type"); case 4: return tr("Password"); diff --git a/common/server_game.cpp b/common/server_game.cpp index 47457869..65e91797 100644 --- a/common/server_game.cpp +++ b/common/server_game.cpp @@ -75,7 +75,8 @@ void Server_Game::pingClockTimeout() int pingTime; if (player->getProtocolHandler()) { pingTime = player->getProtocolHandler()->getLastCommandTime(); - allPlayersInactive = false; + if (!player->getSpectator()) + allPlayersInactive = false; } else pingTime = -1; pingList.append(new ServerInfo_PlayerPing(player->getPlayerId(), pingTime));