Move more settings over to pajlada settings system
This commit is contained in:
@@ -22,7 +22,7 @@ NotebookTab::NotebookTab(Notebook *_notebook)
|
||||
|
||||
this->positionChangedAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
|
||||
|
||||
this->hideXConnection = SettingsManager::getInstance().hideTabX.valueChanged.connect(
|
||||
this->hideXConnection = SettingsManager::getInstance().hideTabX.getValueChangedSignal().connect(
|
||||
boost::bind(&NotebookTab::hideTabXChanged, this, _1));
|
||||
|
||||
this->setMouseTracking(true);
|
||||
@@ -62,14 +62,15 @@ NotebookTab::NotebookTab(Notebook *_notebook)
|
||||
|
||||
NotebookTab::~NotebookTab()
|
||||
{
|
||||
this->hideXConnection.disconnect();
|
||||
SettingsManager::getInstance().hideTabX.getValueChangedSignal().disconnect(
|
||||
this->hideXConnection);
|
||||
}
|
||||
|
||||
void NotebookTab::calcSize()
|
||||
{
|
||||
float scale = getDpiMultiplier();
|
||||
|
||||
if (SettingsManager::getInstance().hideTabX.get()) {
|
||||
if (SettingsManager::getInstance().hideTabX) {
|
||||
this->resize(static_cast<int>((fontMetrics().width(title) + 16) * scale),
|
||||
static_cast<int>(24 * scale));
|
||||
} else {
|
||||
@@ -184,12 +185,12 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
painter.setPen(fg);
|
||||
|
||||
float scale = this->getDpiMultiplier();
|
||||
int rectW = (SettingsManager::getInstance().hideTabX.get() ? 0 : static_cast<int>(16) * scale);
|
||||
int rectW = (SettingsManager::getInstance().hideTabX ? 0 : static_cast<int>(16) * scale);
|
||||
QRect rect(0, 0, this->width() - rectW, this->height());
|
||||
|
||||
painter.drawText(rect, title, QTextOption(Qt::AlignCenter));
|
||||
|
||||
if (!SettingsManager::getInstance().hideTabX.get() && (mouseOver || selected)) {
|
||||
if (!SettingsManager::getInstance().hideTabX && (mouseOver || selected)) {
|
||||
QRect xRect = this->getXRect();
|
||||
if (mouseOverX) {
|
||||
painter.fillRect(xRect, QColor(0, 0, 0, 64));
|
||||
@@ -231,7 +232,7 @@ void NotebookTab::mouseReleaseEvent(QMouseEvent *event)
|
||||
this->notebook->removePage(this->page);
|
||||
}
|
||||
} else {
|
||||
if (!SettingsManager::getInstance().hideTabX.get() && this->mouseDownX &&
|
||||
if (!SettingsManager::getInstance().hideTabX && this->mouseDownX &&
|
||||
this->getXRect().contains(event->pos())) {
|
||||
this->mouseDownX = false;
|
||||
|
||||
@@ -264,7 +265,7 @@ void NotebookTab::dragEnterEvent(QDragEnterEvent *)
|
||||
|
||||
void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (!SettingsManager::getInstance().hideTabX.get()) {
|
||||
if (!SettingsManager::getInstance().hideTabX) {
|
||||
bool overX = this->getXRect().contains(event->pos());
|
||||
|
||||
if (overX != this->mouseOverX) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/signals2.hpp>
|
||||
#include <boost/signals2/connection.hpp>
|
||||
#include <pajlada/signals/signal.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -57,7 +58,7 @@ protected:
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
boost::signals2::connection hideXConnection;
|
||||
pajlada::Signals::Signal<const bool &>::Connection hideXConnection;
|
||||
|
||||
QPropertyAnimation positionChangedAnimation;
|
||||
bool positionChangedAnimationRunning = false;
|
||||
|
||||
@@ -67,7 +67,7 @@ SplitInput::SplitInput(Split *_chatWidget, EmoteManager &emoteManager, WindowMan
|
||||
connect(&textInput, &ResizingTextEdit::textChanged, this, &SplitInput::editTextChanged);
|
||||
|
||||
this->refreshTheme();
|
||||
textLengthLabel.setHidden(!SettingsManager::getInstance().showMessageLength.get());
|
||||
textLengthLabel.setHidden(!SettingsManager::getInstance().showMessageLength);
|
||||
|
||||
auto completer = new QCompleter(
|
||||
this->chatWidget->completionManager.createModel(this->chatWidget->channelName));
|
||||
@@ -181,7 +181,7 @@ SplitInput::SplitInput(Split *_chatWidget, EmoteManager &emoteManager, WindowMan
|
||||
});
|
||||
|
||||
this->textLengthVisibleChangedConnection =
|
||||
SettingsManager::getInstance().showMessageLength.valueChanged.connect(
|
||||
SettingsManager::getInstance().showMessageLength.getValueChangedSignal().connect(
|
||||
[this](const bool &value) { this->textLengthLabel.setHidden(!value); });
|
||||
|
||||
QObject::connect(&this->textInput, &QTextEdit::copyAvailable, [this](bool available) {
|
||||
@@ -193,7 +193,8 @@ SplitInput::SplitInput(Split *_chatWidget, EmoteManager &emoteManager, WindowMan
|
||||
|
||||
SplitInput::~SplitInput()
|
||||
{
|
||||
this->textLengthVisibleChangedConnection.disconnect();
|
||||
SettingsManager::getInstance().showMessageLength.getValueChangedSignal().disconnect(
|
||||
this->textLengthVisibleChangedConnection);
|
||||
}
|
||||
|
||||
void SplitInput::clearSelection()
|
||||
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
EmoteManager &emoteManager;
|
||||
WindowManager &windowManager;
|
||||
|
||||
boost::signals2::connection textLengthVisibleChangedConnection;
|
||||
pajlada::Signals::Signal<const bool &>::Connection textLengthVisibleChangedConnection;
|
||||
QHBoxLayout hbox;
|
||||
QVBoxLayout vbox;
|
||||
QHBoxLayout editContainer;
|
||||
|
||||
Reference in New Issue
Block a user