minor changes

This commit is contained in:
fourtf 2018-07-05 18:17:12 +02:00
parent 42550129e7
commit eeb514c444
8 changed files with 98 additions and 81 deletions

View file

@ -28,7 +28,7 @@ public:
BoolSetting showBadges = {"/appearance/messages/showBadges", true}; BoolSetting showBadges = {"/appearance/messages/showBadges", true};
BoolSetting showLastMessageIndicator = {"/appearance/messages/showLastMessageIndicator", false}; BoolSetting showLastMessageIndicator = {"/appearance/messages/showLastMessageIndicator", false};
IntSetting lastMessagePattern = {"/appearance/messages/lastMessagePattern", Qt::VerPattern}; IntSetting lastMessagePattern = {"/appearance/messages/lastMessagePattern", Qt::VerPattern};
BoolSetting hideEmptyInput = {"/appearance/hideEmptyInputBox", false}; BoolSetting showEmptyInput = {"/appearance/showEmptyInputBox", true};
BoolSetting showMessageLength = {"/appearance/messages/showMessageLength", false}; BoolSetting showMessageLength = {"/appearance/messages/showMessageLength", false};
BoolSetting separateMessages = {"/appearance/messages/separateMessages", false}; BoolSetting separateMessages = {"/appearance/messages/separateMessages", false};
// BoolSetting collapseLongMessages = {"/appearance/messages/collapseLongMessages", false}; // BoolSetting collapseLongMessages = {"/appearance/messages/collapseLongMessages", false};

View file

@ -25,13 +25,14 @@ void initUpdateButton(RippleEffectButton &button, std::unique_ptr<UpdateDialog>
case UpdateDialog::Dismiss: { case UpdateDialog::Dismiss: {
button.hide(); button.hide();
} break; } break;
case UpdateDialog::Install: {
Updates::getInstance().installUpdates();
} break;
} }
}); });
#ifdef Q_OS_WIN // handle.reset(dialog);
handle.reset(dialog); // dialog->closing.connect([&handle] { handle.release(); });
dialog->closing.connect([&handle] { handle.release(); });
#endif
}); });
// update image when state changes // update image when state changes

View file

@ -40,7 +40,8 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
switch (status) { switch (status) {
case Updates::UpdateAvailable: { case Updates::UpdateAvailable: {
this->ui_.label->setText(QString("An update (%1) is available.") this->ui_.label->setText(
QString("An update (%1) is available.\n\nDo you want to download and install it?")
.arg(Updates::getInstance().getOnlineVersion())); .arg(Updates::getInstance().getOnlineVersion()));
} break; } break;
@ -49,8 +50,8 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
} break; } break;
case Updates::Downloading: { case Updates::Downloading: {
this->ui_.label->setText("Downloading updates."); this->ui_.label->setText("Downloading updates.\n\nChatterino will restart "
// this->setActionOnFocusLoss(BaseWindow::Nothing); "automatically when the download is done.");
} break; } break;
case Updates::DownloadFailed: { case Updates::DownloadFailed: {

View file

@ -12,7 +12,7 @@ namespace chatterino {
class UpdateDialog : public BaseWindow class UpdateDialog : public BaseWindow
{ {
public: public:
enum Button { Dismiss }; enum Button { Dismiss, Install };
UpdateDialog(); UpdateDialog();

View file

@ -8,14 +8,9 @@
#include <QLabel> #include <QLabel>
#include <QVBoxLayout> #include <QVBoxLayout>
#ifdef USEWINSDK
#define WINDOW_TOPMOST "Window always on top"
#else
#define WINDOW_TOPMOST "Window always on top (requires restart)"
#endif
#define INPUT_EMPTY "Hide input box when empty"
#define PAUSE_HOVERING "When hovering" #define PAUSE_HOVERING "When hovering"
#define LAST_MSG "Mark the last message you read (dotted line)" #define SCROLL_SMOOTH "Smooth scrolling"
#define SCROLL_NEWMSG "Smooth scrolling for new messages"
#define LIMIT_CHATTERS_FOR_SMALLER_STREAMERS "Only fetch chatters list for viewers under X viewers" #define LIMIT_CHATTERS_FOR_SMALLER_STREAMERS "Only fetch chatters list for viewers under X viewers"
@ -29,10 +24,12 @@ FeelPage::FeelPage()
auto layout = layoutCreator.setLayoutType<QVBoxLayout>(); auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
layout.append(this->createCheckBox(SCROLL_SMOOTH, getSettings()->enableSmoothScrolling));
layout.append(
this->createCheckBox(SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages));
auto form = layout.emplace<QFormLayout>().withoutMargin(); auto form = layout.emplace<QFormLayout>().withoutMargin();
{ {
form->addRow("Window:", this->createCheckBox(WINDOW_TOPMOST, app->settings->windowTopMost));
form->addRow("Messages:", this->createCheckBox(INPUT_EMPTY, app->settings->hideEmptyInput));
form->addRow( form->addRow(
"", this->createCheckBox("Show which users joined the channel (up to 1000 chatters)", "", this->createCheckBox("Show which users joined the channel (up to 1000 chatters)",
app->settings->showJoins)); app->settings->showJoins));
@ -40,47 +37,6 @@ FeelPage::FeelPage()
"", this->createCheckBox("Show which users parted the channel (up to 1000 chatters)", "", this->createCheckBox("Show which users parted the channel (up to 1000 chatters)",
app->settings->showParts)); app->settings->showParts));
form->addRow("", this->createCheckBox("Show message length while typing",
getSettings()->showMessageLength));
form->addRow("", this->createCheckBox(LAST_MSG, getSettings()->showLastMessageIndicator));
{
auto *combo = new QComboBox(this);
combo->addItems({"Dotted", "Solid"});
const auto currentIndex = []() -> int {
switch (getApp()->settings->lastMessagePattern.getValue()) {
case Qt::SolidLine: {
return 1;
}
default:
case Qt::VerPattern: {
return 0;
}
}
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(combo,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[](int index) {
Qt::BrushStyle brush;
switch (index) {
case 1:
brush = Qt::SolidPattern;
break;
default:
case 0:
brush = Qt::VerPattern;
break;
}
getSettings()->lastMessagePattern = brush;
});
auto hbox = form.emplace<QHBoxLayout>().withoutMargin();
hbox.emplace<QLabel>("Last message indicator pattern");
hbox.append(combo);
}
form->addRow("Pause chat:", form->addRow("Pause chat:",
this->createCheckBox(PAUSE_HOVERING, app->settings->pauseChatHover)); this->createCheckBox(PAUSE_HOVERING, app->settings->pauseChatHover));

View file

@ -17,21 +17,31 @@
#define THEME_ITEMS "White", "Light", "Dark", "Black" #define THEME_ITEMS "White", "Light", "Dark", "Black"
#define TAB_X "Tab close button" #define TAB_X "Show tab close button"
#define TAB_PREF "Preferences button (ctrl+p to show)" #define TAB_PREF "Preferences button (ctrl+p to show)"
#define TAB_USER "User button" #define TAB_USER "User button"
#define SCROLL_SMOOTH "Smooth scrolling"
#define SCROLL_NEWMSG "Smooth scrolling for new messages"
// clang-format off // 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" #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 // clang-format on
#ifdef USEWINSDK
#define WINDOW_TOPMOST "Window always on top"
#else
#define WINDOW_TOPMOST "Window always on top (requires restart)"
#endif
#define INPUT_EMPTY "Show input box when empty"
#define LAST_MSG "Mark the last message you read"
namespace chatterino { namespace chatterino {
LookPage::LookPage() LookPage::LookPage()
: SettingsPage("Look", ":/images/theme.svg") : SettingsPage("Look", ":/images/theme.svg")
{
this->initializeUi();
}
void LookPage::initializeUi()
{ {
LayoutCreator<LookPage> layoutCreator(this); LayoutCreator<LookPage> layoutCreator(this);
@ -72,10 +82,15 @@ void LookPage::addInterfaceTab(LayoutCreator<QVBoxLayout> layout)
// ui scale // ui scale
{ {
auto box = layout.emplace<QHBoxLayout>().withoutMargin(); auto box = layout.emplace<QHBoxLayout>().withoutMargin();
box.emplace<QLabel>("Scale: "); box.emplace<QLabel>("Window scale: ");
box.append(this->createUiScaleSlider()); box.append(this->createUiScaleSlider());
} }
layout.append(this->createCheckBox(WINDOW_TOPMOST, getSettings()->windowTopMost));
// --
layout.emplace<Line>(false);
// tab x // tab x
layout.append(this->createCheckBox(TAB_X, getSettings()->showTabCloseButton)); layout.append(this->createCheckBox(TAB_X, getSettings()->showTabCloseButton));
@ -85,10 +100,10 @@ void LookPage::addInterfaceTab(LayoutCreator<QVBoxLayout> layout)
layout.append(this->createCheckBox(TAB_USER, getSettings()->hideUserButton)); layout.append(this->createCheckBox(TAB_USER, getSettings()->hideUserButton));
#endif #endif
// scrolling // empty input
layout.append(this->createCheckBox(SCROLL_SMOOTH, getSettings()->enableSmoothScrolling)); layout.append(this->createCheckBox(INPUT_EMPTY, getSettings()->showEmptyInput));
layout.append( layout.append(
this->createCheckBox(SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages)); this->createCheckBox("Show message length while typing", getSettings()->showMessageLength));
layout->addStretch(1); layout->addStretch(1);
} }
@ -102,13 +117,12 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
layout.emplace<Line>(false); layout.emplace<Line>(false);
// timestamps // timestamps
layout.append(this->createCheckBox("Show timestamps", getSettings()->showTimestamps)); {
// auto tbox = layout.emplace<QHBoxLayout>().withoutMargin(); auto box = layout.emplace<QHBoxLayout>().withoutMargin();
// { box.append(this->createCheckBox("Show timestamps", getSettings()->showTimestamps));
// tbox.emplace<QLabel>("Timestamp format (a = am/pm):"); box.append(this->createComboBox({TIMESTAMP_FORMATS}, getSettings()->timestampFormat));
// tbox.append(this->createComboBox({TIMESTAMP_FORMATS}, box->addStretch(1);
// getSettings()->timestampFormat)); tbox->addStretch(1); }
// }
// badges // badges
layout.append(this->createCheckBox("Show badges", getSettings()->showBadges)); layout.append(this->createCheckBox("Show badges", getSettings()->showBadges));
@ -156,6 +170,9 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
hbox.emplace<QLabel>("lines"); hbox.emplace<QLabel>("lines");
} }
// last read message
this->addLastReadMessageIndicatorPatternSelector(layout);
// -- // --
layout->addStretch(1); layout->addStretch(1);
} }
@ -216,6 +233,43 @@ void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
layout->addStretch(1); layout->addStretch(1);
} }
void LookPage::addLastReadMessageIndicatorPatternSelector(LayoutCreator<QVBoxLayout> layout)
{
// combo
auto *combo = new QComboBox(this);
combo->addItems({"Dotted line", "Solid line"});
const auto currentIndex = []() -> int {
switch (getApp()->settings->lastMessagePattern.getValue()) {
case Qt::SolidLine:
return 1;
case Qt::VerPattern:
default:
return 0;
}
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[](int index) {
getSettings()->lastMessagePattern = [&] {
switch (index) {
case 1:
return Qt::SolidPattern;
case 0:
default:
return Qt::VerPattern;
}
}();
});
// layout
auto hbox = layout.emplace<QHBoxLayout>().withoutMargin();
hbox.append(this->createCheckBox(LAST_MSG, getSettings()->showLastMessageIndicator));
hbox.append(combo);
hbox->addStretch(1);
}
ChannelPtr LookPage::createPreviewChannel() ChannelPtr LookPage::createPreviewChannel()
{ {
auto channel = ChannelPtr(new Channel("preview", Channel::Misc)); auto channel = ChannelPtr(new Channel("preview", Channel::Misc));
@ -226,7 +280,7 @@ ChannelPtr LookPage::createPreviewChannel()
MessageElement::BadgeChannelAuthority)); MessageElement::BadgeChannelAuthority));
message->addElement(new ImageElement(getApp()->resources->badgeSubscriber, message->addElement(new ImageElement(getApp()->resources->badgeSubscriber,
MessageElement::BadgeSubscription)); MessageElement::BadgeSubscription));
message->addElement(new TimestampElement()); message->addElement(new TimestampElement(QTime(8, 13, 42)));
message->addElement(new TextElement("username1:", MessageElement::Username, message->addElement(new TextElement("username1:", MessageElement::Username,
QColor("#0094FF"), FontStyle::ChatMediumBold)); QColor("#0094FF"), FontStyle::ChatMediumBold));
message->addElement(new TextElement("This is a preview message :)", MessageElement::Text)); message->addElement(new TextElement("This is a preview message :)", MessageElement::Text));
@ -236,7 +290,7 @@ ChannelPtr LookPage::createPreviewChannel()
auto message = MessagePtr(new Message()); auto message = MessagePtr(new Message());
message->addElement(new ImageElement(getApp()->resources->badgePremium, message->addElement(new ImageElement(getApp()->resources->badgePremium,
MessageElement::BadgeChannelAuthority)); MessageElement::BadgeChannelAuthority));
message->addElement(new TimestampElement()); message->addElement(new TimestampElement(QTime(8, 15, 21)));
message->addElement(new TextElement("username2:", MessageElement::Username, message->addElement(new TextElement("username2:", MessageElement::Username,
QColor("#FF6A00"), FontStyle::ChatMediumBold)); QColor("#FF6A00"), FontStyle::ChatMediumBold));
message->addElement(new TextElement("This is another one :)", MessageElement::Text)); message->addElement(new TextElement("This is another one :)", MessageElement::Text));

View file

@ -16,10 +16,15 @@ class LookPage : public SettingsPage
public: public:
LookPage(); LookPage();
private:
void initializeUi();
void addInterfaceTab(LayoutCreator<QVBoxLayout> layout); void addInterfaceTab(LayoutCreator<QVBoxLayout> layout);
void addMessageTab(LayoutCreator<QVBoxLayout> layout); void addMessageTab(LayoutCreator<QVBoxLayout> layout);
void addEmoteTab(LayoutCreator<QVBoxLayout> layout); void addEmoteTab(LayoutCreator<QVBoxLayout> layout);
void addLastReadMessageIndicatorPatternSelector(LayoutCreator<QVBoxLayout> layout);
QLayout *createThemeColorChanger(); QLayout *createThemeColorChanger();
QLayout *createFontChanger(); QLayout *createFontChanger();
QLayout *createUiScaleSlider(); QLayout *createUiScaleSlider();

View file

@ -103,7 +103,7 @@ Split::Split(QWidget *parent)
}); });
this->input.textChanged.connect([=](const QString &newText) { this->input.textChanged.connect([=](const QString &newText) {
if (!app->settings->hideEmptyInput) { if (app->settings->showEmptyInput) {
return; return;
} }
@ -114,9 +114,9 @@ Split::Split(QWidget *parent)
} }
}); });
app->settings->hideEmptyInput.connect( app->settings->showEmptyInput.connect(
[this](const bool &hideEmptyInput, auto) { [this](const bool &showEmptyInput, auto) {
if (hideEmptyInput && this->input.getInputText().length() == 0) { if (!showEmptyInput && this->input.getInputText().length() == 0) {
this->input.hide(); this->input.hide();
} else { } else {
this->input.show(); this->input.show();