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 showLastMessageIndicator = {"/appearance/messages/showLastMessageIndicator", false};
IntSetting lastMessagePattern = {"/appearance/messages/lastMessagePattern", Qt::VerPattern};
BoolSetting hideEmptyInput = {"/appearance/hideEmptyInputBox", false};
BoolSetting showEmptyInput = {"/appearance/showEmptyInputBox", true};
BoolSetting showMessageLength = {"/appearance/messages/showMessageLength", false};
BoolSetting separateMessages = {"/appearance/messages/separateMessages", false};
// BoolSetting collapseLongMessages = {"/appearance/messages/collapseLongMessages", false};

View file

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

View file

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

View file

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

View file

@ -8,14 +8,9 @@
#include <QLabel>
#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 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"
@ -29,10 +24,12 @@ FeelPage::FeelPage()
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();
{
form->addRow("Window:", this->createCheckBox(WINDOW_TOPMOST, app->settings->windowTopMost));
form->addRow("Messages:", this->createCheckBox(INPUT_EMPTY, app->settings->hideEmptyInput));
form->addRow(
"", this->createCheckBox("Show which users joined the channel (up to 1000 chatters)",
app->settings->showJoins));
@ -40,47 +37,6 @@ FeelPage::FeelPage()
"", this->createCheckBox("Show which users parted the channel (up to 1000 chatters)",
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:",
this->createCheckBox(PAUSE_HOVERING, app->settings->pauseChatHover));

View file

@ -17,21 +17,31 @@
#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_USER "User button"
#define SCROLL_SMOOTH "Smooth scrolling"
#define SCROLL_NEWMSG "Smooth scrolling for new messages"
// 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
#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 {
LookPage::LookPage()
: SettingsPage("Look", ":/images/theme.svg")
{
this->initializeUi();
}
void LookPage::initializeUi()
{
LayoutCreator<LookPage> layoutCreator(this);
@ -72,10 +82,15 @@ void LookPage::addInterfaceTab(LayoutCreator<QVBoxLayout> layout)
// ui scale
{
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
box.emplace<QLabel>("Scale: ");
box.emplace<QLabel>("Window scale: ");
box.append(this->createUiScaleSlider());
}
layout.append(this->createCheckBox(WINDOW_TOPMOST, getSettings()->windowTopMost));
// --
layout.emplace<Line>(false);
// tab x
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));
#endif
// scrolling
layout.append(this->createCheckBox(SCROLL_SMOOTH, getSettings()->enableSmoothScrolling));
// empty input
layout.append(this->createCheckBox(INPUT_EMPTY, getSettings()->showEmptyInput));
layout.append(
this->createCheckBox(SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages));
this->createCheckBox("Show message length while typing", getSettings()->showMessageLength));
layout->addStretch(1);
}
@ -102,13 +117,12 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
layout.emplace<Line>(false);
// timestamps
layout.append(this->createCheckBox("Show timestamps", getSettings()->showTimestamps));
// auto tbox = layout.emplace<QHBoxLayout>().withoutMargin();
// {
// tbox.emplace<QLabel>("Timestamp format (a = am/pm):");
// tbox.append(this->createComboBox({TIMESTAMP_FORMATS},
// getSettings()->timestampFormat)); tbox->addStretch(1);
// }
{
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
box.append(this->createCheckBox("Show timestamps", getSettings()->showTimestamps));
box.append(this->createComboBox({TIMESTAMP_FORMATS}, getSettings()->timestampFormat));
box->addStretch(1);
}
// badges
layout.append(this->createCheckBox("Show badges", getSettings()->showBadges));
@ -156,6 +170,9 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
hbox.emplace<QLabel>("lines");
}
// last read message
this->addLastReadMessageIndicatorPatternSelector(layout);
// --
layout->addStretch(1);
}
@ -216,6 +233,43 @@ void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
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()
{
auto channel = ChannelPtr(new Channel("preview", Channel::Misc));
@ -226,7 +280,7 @@ ChannelPtr LookPage::createPreviewChannel()
MessageElement::BadgeChannelAuthority));
message->addElement(new ImageElement(getApp()->resources->badgeSubscriber,
MessageElement::BadgeSubscription));
message->addElement(new TimestampElement());
message->addElement(new TimestampElement(QTime(8, 13, 42)));
message->addElement(new TextElement("username1:", MessageElement::Username,
QColor("#0094FF"), FontStyle::ChatMediumBold));
message->addElement(new TextElement("This is a preview message :)", MessageElement::Text));
@ -236,7 +290,7 @@ ChannelPtr LookPage::createPreviewChannel()
auto message = MessagePtr(new Message());
message->addElement(new ImageElement(getApp()->resources->badgePremium,
MessageElement::BadgeChannelAuthority));
message->addElement(new TimestampElement());
message->addElement(new TimestampElement(QTime(8, 15, 21)));
message->addElement(new TextElement("username2:", MessageElement::Username,
QColor("#FF6A00"), FontStyle::ChatMediumBold));
message->addElement(new TextElement("This is another one :)", MessageElement::Text));

View file

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

View file

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