Fixes #225 fix am/pm for timestamps
This commit is contained in:
@@ -161,7 +161,16 @@ void SplitHeader::updateModerationModeIcon()
|
||||
? resourceManager.moderationmode_enabled->getPixmap()
|
||||
: resourceManager.moderationmode_disabled->getPixmap());
|
||||
|
||||
// this->moderationButton->setVisible(this->split->channel->hasModRights());
|
||||
bool modButtonVisible = false;
|
||||
SharedChannel channel = this->split->getChannel();
|
||||
|
||||
twitch::TwitchChannel *tc = dynamic_cast<twitch::TwitchChannel *>(channel.get());
|
||||
|
||||
if (tc != nullptr && tc->hasModRights()) {
|
||||
modButtonVisible = true;
|
||||
}
|
||||
|
||||
this->moderationButton->setVisible(modButtonVisible);
|
||||
}
|
||||
|
||||
void SplitHeader::paintEvent(QPaintEvent *)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
#include <boost/signals2/connection.hpp>
|
||||
#include <pajlada/settings/setting.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
#define SCROLL_SMOOTH "Enable smooth scrolling"
|
||||
#define SCROLL_NEWMSG "Enable smooth scrolling for new messages"
|
||||
|
||||
#define TIMESTAMP_FORMATS "hh:mm a", "h:mm a", "HH:mm", "H:mm"
|
||||
// clang-format off
|
||||
#define TIMESTAMP_FORMATS "hh:mm a", "h:mm a", "hh:mm:ss a", "h:mm:ss a", "HH:mm", "H:mm", "HH:mm:ss", "H:mm:ss"
|
||||
// clang-format on
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
@@ -55,7 +57,7 @@ AppearancePage::AppearancePage()
|
||||
messages.append(this->createCheckBox("Show timestamp", settings.showTimestamps));
|
||||
auto tbox = messages.emplace<QHBoxLayout>();
|
||||
{
|
||||
tbox.emplace<QLabel>("timestamp format:");
|
||||
tbox.emplace<QLabel>("timestamp format (a = am/pm):");
|
||||
tbox.append(this->createComboBox({TIMESTAMP_FORMATS}, settings.timestampFormat));
|
||||
}
|
||||
messages.append(this->createCheckBox("Show badges", settings.showBadges));
|
||||
|
||||
@@ -27,9 +27,7 @@ ModerationPage::ModerationPage()
|
||||
|
||||
auto text = layout.emplace<QTextEdit>().getElement();
|
||||
|
||||
settings.moderationActions.connect([=](const QString &str, auto) {
|
||||
text->setPlainText(str); //
|
||||
});
|
||||
text->setPlainText(settings.moderationActions);
|
||||
|
||||
QObject::connect(text, &QTextEdit::textChanged, this,
|
||||
[this] { this->itemsChangedTimer.start(200); });
|
||||
|
||||
@@ -123,6 +123,8 @@ Split::Split(SplitContainer *parent, const std::string &_uuid)
|
||||
Split::~Split()
|
||||
{
|
||||
this->channelNameUpdated("");
|
||||
this->usermodeChangedConnection.disconnect();
|
||||
this->channelIDChangedConnection.disconnect();
|
||||
}
|
||||
|
||||
const std::string &Split::getUUID() const
|
||||
@@ -144,8 +146,19 @@ void Split::setChannel(SharedChannel _newChannel)
|
||||
{
|
||||
this->view.setChannel(_newChannel);
|
||||
|
||||
this->usermodeChangedConnection.disconnect();
|
||||
|
||||
this->channel = _newChannel;
|
||||
|
||||
twitch::TwitchChannel *tc = dynamic_cast<twitch::TwitchChannel *>(_newChannel.get());
|
||||
|
||||
if (tc != nullptr) {
|
||||
this->usermodeChangedConnection =
|
||||
tc->userStateChanged.connect([this] { this->header.updateModerationModeIcon(); });
|
||||
}
|
||||
|
||||
this->header.updateModerationModeIcon();
|
||||
|
||||
this->channelChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class Split : public BaseWidget
|
||||
|
||||
public:
|
||||
Split(SplitContainer *parent, const std::string &_uuid);
|
||||
~Split();
|
||||
virtual ~Split();
|
||||
|
||||
pajlada::Settings::Setting<std::string> channelName;
|
||||
boost::signals2::signal<void()> channelChanged;
|
||||
@@ -94,6 +94,7 @@ private:
|
||||
bool moderationMode;
|
||||
|
||||
boost::signals2::connection channelIDChangedConnection;
|
||||
boost::signals2::connection usermodeChangedConnection;
|
||||
|
||||
void setChannel(SharedChannel newChannel);
|
||||
void doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user);
|
||||
|
||||
Reference in New Issue
Block a user