diff --git a/cockatrice/src/dialogs/dlg_settings.cpp b/cockatrice/src/dialogs/dlg_settings.cpp index 058455069..079a5749e 100644 --- a/cockatrice/src/dialogs/dlg_settings.cpp +++ b/cockatrice/src/dialogs/dlg_settings.cpp @@ -1100,6 +1100,10 @@ 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); @@ -1112,6 +1116,9 @@ MessagesSettingsPage::MessagesSettingsPage() connect(customAlertString, SIGNAL(textChanged(QString)), &SettingsCache::instance(), SLOT(setHighlightWords(QString))); + + + auto *chatGrid = new QGridLayout; chatGrid->addWidget(&chatMentionCheckBox, 0, 0); chatGrid->addWidget(&invertMentionForeground, 0, 1); @@ -1123,6 +1130,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); @@ -1305,6 +1313,7 @@ void MessagesSettingsPage::retranslateUi() aAdd->setText(tr("Add New Message")); aEdit->setText(tr("Edit Message")); aRemove->setText(tr("Remove Message")); + localTimeCheckBox.setText(tr("Enable In-Game Time")); } SoundSettingsPage::SoundSettingsPage() diff --git a/cockatrice/src/dialogs/dlg_settings.h b/cockatrice/src/dialogs/dlg_settings.h index 6ebe47307..d70478d31 100644 --- a/cockatrice/src/dialogs/dlg_settings.h +++ b/cockatrice/src/dialogs/dlg_settings.h @@ -239,6 +239,7 @@ private: QCheckBox invertHighlightForeground; QCheckBox ignoreUnregUsersMainChat; QCheckBox ignoreUnregUserMessages; + QCheckBox localTimeCheckBox; QCheckBox messagePopups; QCheckBox mentionPopups; QCheckBox roomHistory; @@ -252,7 +253,7 @@ private: QLabel hexHighlightLabel; QLabel customAlertStringLabel; QLabel explainMessagesLabel; - + void storeSettings(); void updateMentionPreview(); void updateHighlightPreview(); diff --git a/cockatrice/src/settings/cache_settings.cpp b/cockatrice/src/settings/cache_settings.cpp index 0dc082f0d..87ff3709d 100644 --- a/cockatrice/src/settings/cache_settings.cpp +++ b/cockatrice/src/settings/cache_settings.cpp @@ -420,6 +420,12 @@ void SettingsCache::setRoomHistory(const QT_STATE_CHANGED_T _roomHistory) settings->setValue("chat/roomhistory", roomHistory); } +void SettingsCache::setLocalTime(const QT_STATE_CHANGED_T _showMessagePopups) +{ + localTime = (bool)_showMessagePopups; + settings->setValue("chat/localtime", localTime); +} + void SettingsCache::setLang(const QString &_lang) { lang = _lang; diff --git a/cockatrice/src/settings/cache_settings.h b/cockatrice/src/settings/cache_settings.h index eaecdf73c..28f77f1b0 100644 --- a/cockatrice/src/settings/cache_settings.h +++ b/cockatrice/src/settings/cache_settings.h @@ -200,6 +200,7 @@ private: bool rememberGameSettings; QList releaseChannels; bool isPortableBuild; + bool localTime; public: SettingsCache(); @@ -558,6 +559,10 @@ public: { return showMessagePopups; } + bool getLocalTime() const + { + return localTime; + } bool getShowMentionPopup() const { return showMentionPopups; @@ -810,6 +815,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); diff --git a/dbconverter/src/mocks.cpp b/dbconverter/src/mocks.cpp index e2f6ed4df..e6861c460 100644 --- a/dbconverter/src/mocks.cpp +++ b/dbconverter/src/mocks.cpp @@ -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 _showMessagePopups /*_LocalTime*/) +{ +} void SettingsCache::setShowMentionPopups(const QT_STATE_CHANGED_T /* _showMentionPopus */) { }