mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
Merge e9600b5ea1 into ca73033aea
This commit is contained in:
commit
3c841fe03b
13 changed files with 59 additions and 19 deletions
|
|
@ -410,6 +410,11 @@ void TabGame::closeRequest(bool forced)
|
|||
close();
|
||||
}
|
||||
|
||||
QString TabGame::getCurrentInGameTime() const
|
||||
{
|
||||
return QTime::fromMSecsSinceStartOfDay(secondsElapsed * 1000).toString("[hh:mm:ss] ");
|
||||
}
|
||||
|
||||
void TabGame::replayNextEvent(Player::EventProcessingOptions options)
|
||||
{
|
||||
processGameEventContainer(replay->event_list(timelineWidget->getCurrentEvent()), nullptr, options);
|
||||
|
|
@ -448,15 +453,8 @@ void TabGame::replayRewind()
|
|||
|
||||
void TabGame::incrementGameTime()
|
||||
{
|
||||
int seconds = ++secondsElapsed;
|
||||
int minutes = seconds / 60;
|
||||
seconds -= minutes * 60;
|
||||
int hours = minutes / 60;
|
||||
minutes -= hours * 60;
|
||||
|
||||
timeElapsedLabel->setText(QString::number(hours).rightJustified(2, '0') + ":" +
|
||||
QString::number(minutes).rightJustified(2, '0') + ":" +
|
||||
QString::number(seconds).rightJustified(2, '0'));
|
||||
++secondsElapsed;
|
||||
timeElapsedLabel->setText(getCurrentInGameTime());
|
||||
}
|
||||
|
||||
void TabGame::adminLockChanged(bool lock)
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ private:
|
|||
QCompleter *completer;
|
||||
QStringList autocompleteUserList;
|
||||
QStackedWidget *mainWidget;
|
||||
bool showInGameTime;
|
||||
|
||||
// Replay related members
|
||||
GameReplay *replay;
|
||||
|
|
@ -224,6 +225,7 @@ public:
|
|||
void retranslateUi() override;
|
||||
void updatePlayerListDockTitle();
|
||||
void closeRequest(bool forced = false) override;
|
||||
QString getCurrentInGameTime() const;
|
||||
const QMap<int, Player *> &getPlayers() const
|
||||
{
|
||||
return players;
|
||||
|
|
|
|||
|
|
@ -1138,6 +1138,9 @@ MessagesSettingsPage::MessagesSettingsPage()
|
|||
connect(&messagePopups, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setShowMessagePopups);
|
||||
|
||||
localTimeCheckBox.setChecked(SettingsCache::instance().getLocalTime());
|
||||
connect(&localTimeCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(), &SettingsCache::setLocalTime);
|
||||
|
||||
mentionPopups.setChecked(SettingsCache::instance().getShowMentionPopup());
|
||||
connect(&mentionPopups, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setShowMentionPopups);
|
||||
|
|
@ -1160,6 +1163,7 @@ MessagesSettingsPage::MessagesSettingsPage()
|
|||
chatGrid->addWidget(&messagePopups, 4, 0);
|
||||
chatGrid->addWidget(&mentionPopups, 5, 0);
|
||||
chatGrid->addWidget(&roomHistory, 6, 0);
|
||||
chatGrid->addWidget(&localTimeCheckBox, 7, 0);
|
||||
chatGroupBox = new QGroupBox;
|
||||
chatGroupBox->setLayout(chatGrid);
|
||||
|
||||
|
|
@ -1342,6 +1346,7 @@ void MessagesSettingsPage::retranslateUi()
|
|||
aAdd->setText(tr("Add New Message"));
|
||||
aEdit->setText(tr("Edit Message"));
|
||||
aRemove->setText(tr("Remove Message"));
|
||||
localTimeCheckBox.setText(tr("Use Room Time over Real-Life Time"));
|
||||
}
|
||||
|
||||
SoundSettingsPage::SoundSettingsPage()
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ private:
|
|||
QCheckBox invertHighlightForeground;
|
||||
QCheckBox ignoreUnregUsersMainChat;
|
||||
QCheckBox ignoreUnregUserMessages;
|
||||
QCheckBox localTimeCheckBox;
|
||||
QCheckBox messagePopups;
|
||||
QCheckBox mentionPopups;
|
||||
QCheckBox roomHistory;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ ChatView::ChatView(TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTime
|
|||
setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
|
||||
setOpenLinks(false);
|
||||
connect(this, &ChatView::anchorClicked, this, &ChatView::openLink);
|
||||
showInGameTime = SettingsCache::instance().getLocalTime();
|
||||
}
|
||||
|
||||
void ChatView::retranslateUi()
|
||||
|
|
@ -102,10 +103,9 @@ void ChatView::appendHtml(const QString &html)
|
|||
void ChatView::appendHtmlServerMessage(const QString &html, bool optionalIsBold, QString optionalFontColor)
|
||||
{
|
||||
bool atBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum();
|
||||
|
||||
QString htmlText =
|
||||
"<font color=" + ((optionalFontColor.size() > 0) ? optionalFontColor : serverMessageColor.name()) + ">" +
|
||||
QDateTime::currentDateTime().toString("[hh:mm:ss] ") + html + "</font>";
|
||||
getCurrentTime() + html + "</font>";
|
||||
|
||||
if (optionalIsBold)
|
||||
htmlText = "<b>" + htmlText + "</b>";
|
||||
|
|
@ -168,7 +168,7 @@ void ChatView::appendMessage(QString message,
|
|||
timeFormat.setForeground(serverMessageColor);
|
||||
timeFormat.setFontWeight(QFont::Bold);
|
||||
cursor.setCharFormat(timeFormat);
|
||||
cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm:ss] "));
|
||||
cursor.insertText(getCurrentTime());
|
||||
}
|
||||
|
||||
// nickname
|
||||
|
|
@ -457,6 +457,15 @@ bool ChatView::isModeratorSendingGlobal(QFlags<ServerInfo_User::UserLevelFlag> u
|
|||
(userLevel & ServerInfo_User::IsModerator || userLevel & ServerInfo_User::IsAdmin));
|
||||
}
|
||||
|
||||
QString ChatView::getCurrentTime() const
|
||||
{
|
||||
if (game && showInGameTime) {
|
||||
return game->getCurrentInGameTime();
|
||||
} else {
|
||||
return QDateTime::currentDateTime().toString("[hh:mm:ss] ");
|
||||
}
|
||||
}
|
||||
|
||||
void ChatView::actMessageClicked()
|
||||
{
|
||||
emit messageClickedSignal();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef CHATVIEW_H
|
||||
#define CHATVIEW_H
|
||||
|
||||
#include "../../client/tabs/tab_game.h"
|
||||
#include "../../client/tabs/tab_supervisor.h"
|
||||
#include "../user/user_list_widget.h"
|
||||
#include "room_message_type.h"
|
||||
|
|
@ -16,7 +17,6 @@ class QTextTable;
|
|||
class QMouseEvent;
|
||||
class UserContextMenu;
|
||||
class UserListProxy;
|
||||
class TabGame;
|
||||
|
||||
class UserMessagePosition
|
||||
{
|
||||
|
|
@ -56,6 +56,7 @@ private:
|
|||
QStringList highlightedWords;
|
||||
bool evenNumber;
|
||||
bool showTimestamps;
|
||||
bool showInGameTime;
|
||||
HoveredItemType hoveredItemType;
|
||||
QString hoveredContent;
|
||||
QAction *messageClicked;
|
||||
|
|
@ -77,7 +78,6 @@ private:
|
|||
QColor otherUserColor = QColor(0, 65, 255); // dark blue
|
||||
QColor serverMessageColor = QColor(0x85, 0x15, 0x15);
|
||||
QColor linkColor;
|
||||
|
||||
private slots:
|
||||
void openLink(const QUrl &link);
|
||||
void actMessageClicked();
|
||||
|
|
@ -106,6 +106,7 @@ protected:
|
|||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
QString getCurrentTime() const;
|
||||
signals:
|
||||
void openMessageDialog(const QString &userName, bool focus);
|
||||
void cardNameHovered(QString cardName);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
const QString MessageLogWidget::getCurrentTime()
|
||||
{
|
||||
return ChatView::getCurrentTime();
|
||||
}
|
||||
|
||||
const QString &MessageLogWidget::tableConstant() const
|
||||
{
|
||||
static const QString constant("table");
|
||||
|
|
@ -615,14 +620,13 @@ void MessageLogWidget::logSetActivePhase(int phaseNumber)
|
|||
|
||||
soundEngine->playSound(phase.soundFileName);
|
||||
|
||||
appendHtml("<font color=\"" + phase.color + "\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") +
|
||||
phase.getName() + "</b></font>");
|
||||
appendHtml("<font color=\"" + phase.color + "\"><b>" + getCurrentTime() + phase.getName() + "</b></font>");
|
||||
}
|
||||
|
||||
void MessageLogWidget::logSetActivePlayer(Player *player)
|
||||
{
|
||||
appendHtml("<br><font color=\"green\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") +
|
||||
QString(tr("%1's turn.")).arg(player->getName()) + "</b></font><br>");
|
||||
appendHtml("<br><font color=\"green\"><b>" + getCurrentTime() + QString(tr("%1's turn.")).arg(player->getName()) +
|
||||
"</b></font><br>");
|
||||
}
|
||||
|
||||
void MessageLogWidget::logSetAnnotation(Player *player, CardItem *card, QString newAnnotation)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ private:
|
|||
MessageContext currentContext;
|
||||
QString messagePrefix, messageSuffix;
|
||||
|
||||
const QString getCurrentTime();
|
||||
const QString &tableConstant() const;
|
||||
const QString &graveyardConstant() const;
|
||||
const QString &exileConstant() const;
|
||||
|
|
|
|||
|
|
@ -342,6 +342,7 @@ SettingsCache::SettingsCache()
|
|||
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
||||
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
|
||||
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
|
||||
localTime = settings->value("chat/localtime", false).toBool();
|
||||
}
|
||||
|
||||
void SettingsCache::setUseTearOffMenus(bool _useTearOffMenus)
|
||||
|
|
@ -431,6 +432,12 @@ void SettingsCache::setRoomHistory(const QT_STATE_CHANGED_T _roomHistory)
|
|||
settings->setValue("chat/roomhistory", roomHistory);
|
||||
}
|
||||
|
||||
void SettingsCache::setLocalTime(const QT_STATE_CHANGED_T _localTime)
|
||||
{
|
||||
localTime = (bool)_localTime;
|
||||
settings->setValue("chat/localtime", localTime);
|
||||
}
|
||||
|
||||
void SettingsCache::setLang(const QString &_lang)
|
||||
{
|
||||
lang = _lang;
|
||||
|
|
|
|||
|
|
@ -215,6 +215,7 @@ private:
|
|||
bool rememberGameSettings;
|
||||
QList<ReleaseChannel *> releaseChannels;
|
||||
bool isPortableBuild;
|
||||
bool localTime;
|
||||
bool roundCardCorners;
|
||||
|
||||
public:
|
||||
|
|
@ -602,6 +603,10 @@ public:
|
|||
{
|
||||
return showMessagePopups;
|
||||
}
|
||||
bool getLocalTime() const
|
||||
{
|
||||
return localTime;
|
||||
}
|
||||
bool getShowMentionPopup() const
|
||||
{
|
||||
return showMentionPopups;
|
||||
|
|
@ -865,6 +870,7 @@ public slots:
|
|||
void setCardScaling(const QT_STATE_CHANGED_T _scaleCards);
|
||||
void setStackCardOverlapPercent(const int _verticalCardOverlapPercent);
|
||||
void setShowMessagePopups(const QT_STATE_CHANGED_T _showMessagePopups);
|
||||
void setLocalTime(const QT_STATE_CHANGED_T _showMessagePopups);
|
||||
void setShowMentionPopups(const QT_STATE_CHANGED_T _showMentionPopups);
|
||||
void setRoomHistory(const QT_STATE_CHANGED_T _roomHistory);
|
||||
void setLeftJustified(const QT_STATE_CHANGED_T _leftJustified);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@ void SettingsCache::setStackCardOverlapPercent(const int /* _verticalCardOverlap
|
|||
void SettingsCache::setShowMessagePopups(const QT_STATE_CHANGED_T /* _showMessagePopups */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setLocalTime(const QT_STATE_CHANGED_T /*_LocalTime*/)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setShowMentionPopups(const QT_STATE_CHANGED_T /* _showMentionPopus */)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,6 +311,9 @@ void SettingsCache::setZoneViewGroupByIndex(int /* _zoneViewGroupByIndex */)
|
|||
void SettingsCache::setZoneViewSortByIndex(int /* _zoneViewSortByIndex */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setLocalTime(const QT_STATE_CHANGED_T /*_LocalTime*/)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T /* _zoneViewPileView */)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
2
vcpkg
2
vcpkg
|
|
@ -1 +1 @@
|
|||
Subproject commit c63619856b89f0af4d77ba2049396039e4985418
|
||||
Subproject commit 6f29f12e82a8293156836ad81cc9bf5af41fe836
|
||||
Loading…
Add table
Add a link
Reference in a new issue