switched up the settings pages

This commit is contained in:
fourtf
2018-04-25 20:35:32 +02:00
parent 98be8aaeff
commit b176dc5295
15 changed files with 163 additions and 50 deletions
+39 -17
View File
@@ -5,20 +5,24 @@
#include <QGroupBox>
#include <QLabel>
#include <QPushButton>
#include <QScrollArea>
#include <QSlider>
#include <QVBoxLayout>
#include "util/layoutcreator.hpp"
#include "util/removescrollareabackground.hpp"
#define THEME_ITEMS "White", "Light", "Dark", "Black"
#define TAB_X "Hide tab x"
#define TAB_X "Show close button"
#define TAB_PREF "Hide preferences button (ctrl+p to show)"
#define TAB_USER "Hide user button"
#define SCROLL_SMOOTH "Enable smooth scrolling"
#define SCROLL_NEWMSG "Enable smooth scrolling for new messages"
#define LAST_MSG "Mark the last message you read (dotted line)"
// 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
@@ -28,11 +32,16 @@ namespace widgets {
namespace settingspages {
AppearancePage::AppearancePage()
: SettingsPage("Appearance", ":/images/theme.svg")
: SettingsPage("Look", ":/images/theme.svg")
{
singletons::SettingManager &settings = singletons::SettingManager::getInstance();
util::LayoutCreator<AppearancePage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
auto scroll = layoutCreator.emplace<QScrollArea>();
auto widget = scroll.emplaceScrollAreaWidget();
util::removeScrollAreaBackground(*scroll, *widget);
auto layout = widget.setLayoutType<QVBoxLayout>();
auto application =
layout.emplace<QGroupBox>("Application").emplace<QVBoxLayout>().withoutMargin();
@@ -40,37 +49,50 @@ AppearancePage::AppearancePage()
auto form = application.emplace<QFormLayout>();
// clang-format off
form->addRow("Theme:", this->createComboBox({THEME_ITEMS}, singletons::ThemeManager::getInstance().themeName));
form->addRow("Theme color:", this->createThemeColorChanger());
form->addRow("Font:", this->createFontChanger());
form->addRow("Theme:", this->createComboBox({THEME_ITEMS}, singletons::ThemeManager::getInstance().themeName));
form->addRow("Theme color:", this->createThemeColorChanger());
form->addRow("Font:", this->createFontChanger());
form->addRow("Tab bar:", this->createCheckBox(TAB_X, settings.hideTabX));
#ifndef USEWINSDK
form->addRow("", this->createCheckBox(TAB_PREF, settings.hidePreferencesButton));
form->addRow("", this->createCheckBox(TAB_USER, settings.hideUserButton));
#endif
form->addRow("Tabs:", this->createCheckBox(TAB_X, settings.hideTabX));
#ifndef USEWINSDK
form->addRow("", this->createCheckBox(TAB_PREF, settings.hidePreferencesButton));
form->addRow("", this->createCheckBox(TAB_USER, settings.hideUserButton));
#endif
form->addRow("Scrolling:", this->createCheckBox(SCROLL_SMOOTH, settings.enableSmoothScrolling));
form->addRow("", this->createCheckBox(SCROLL_NEWMSG, settings.enableSmoothScrollingNewMessages));
form->addRow("Scrolling:", this->createCheckBox(SCROLL_SMOOTH, settings.enableSmoothScrolling));
form->addRow("", this->createCheckBox(SCROLL_NEWMSG, settings.enableSmoothScrollingNewMessages));
// clang-format on
}
auto messages = layout.emplace<QGroupBox>("Messages").emplace<QVBoxLayout>().withoutMargin();
auto messages = layout.emplace<QGroupBox>("Messages").emplace<QVBoxLayout>();
{
messages.append(this->createCheckBox("Show timestamp", settings.showTimestamps));
auto tbox = messages.emplace<QHBoxLayout>();
auto tbox = messages.emplace<QHBoxLayout>().withoutMargin();
{
tbox.emplace<QLabel>("timestamp format (a = am/pm):");
tbox.append(this->createComboBox({TIMESTAMP_FORMATS}, settings.timestampFormat));
tbox->addStretch(1);
}
auto checkbox = this->createCheckBox("Show badges", settings.showBadges);
messages.append(this->createCheckBox("Show badges", settings.showBadges));
auto checkbox = this->createCheckBox("Seperate messages", settings.seperateMessages);
checkbox->setEnabled(false);
messages.append(checkbox);
messages.append(this->createCheckBox("Seperate messages", settings.seperateMessages));
messages.append(
this->createCheckBox("Show message length while typing", settings.showMessageLength));
messages.append(this->createCheckBox(LAST_MSG, settings.showLastMessageIndicator));
}
auto emotes = layout.emplace<QGroupBox>("Emotes").setLayoutType<QVBoxLayout>();
{
emotes.append(this->createCheckBox("Enable Twitch emotes", settings.enableTwitchEmotes));
emotes.append(
this->createCheckBox("Enable BetterTTV emotes for Twitch", settings.enableBttvEmotes));
emotes.append(this->createCheckBox("Enable FrankerFaceZ emotes for Twitch",
settings.enableFfzEmotes));
emotes.append(this->createCheckBox("Enable emojis", settings.enableEmojis));
emotes.append(this->createCheckBox("Enable animations", settings.enableGifAnimations));
}
layout->addStretch(1);