mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added username in the titlebar
This commit is contained in:
parent
9b1300212a
commit
6b483640cd
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "singletons/settingsmanager.hpp"
|
#include "singletons/settingsmanager.hpp"
|
||||||
#include "util/nativeeventhelper.hpp"
|
#include "util/nativeeventhelper.hpp"
|
||||||
|
#include "widgets/helper/rippleeffectlabel.hpp"
|
||||||
#include "widgets/tooltipwidget.hpp"
|
#include "widgets/tooltipwidget.hpp"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -149,7 +150,6 @@ bool BaseWindow::hasCustomWindowFrame()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return this->enableCustomFrame;
|
return this->enableCustomFrame;
|
||||||
// return false;
|
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -182,6 +182,19 @@ void BaseWindow::addTitleBarButton(const TitleBarButton::Style &style,
|
||||||
QObject::connect(button, &TitleBarButton::clicked, this, [onClicked] { onClicked(); });
|
QObject::connect(button, &TitleBarButton::clicked, this, [onClicked] { onClicked(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RippleEffectLabel *BaseWindow::addTitleBarLabel(std::function<void()> onClicked)
|
||||||
|
{
|
||||||
|
RippleEffectLabel *button = new RippleEffectLabel;
|
||||||
|
button->setScaleIndependantHeight(30);
|
||||||
|
|
||||||
|
this->buttons.push_back(button);
|
||||||
|
this->titlebarBox->insertWidget(2, button);
|
||||||
|
|
||||||
|
QObject::connect(button, &RippleEffectLabel::clicked, this, [onClicked] { onClicked(); });
|
||||||
|
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
void BaseWindow::changeEvent(QEvent *)
|
void BaseWindow::changeEvent(QEvent *)
|
||||||
{
|
{
|
||||||
TooltipWidget::getInstance()->hide();
|
TooltipWidget::getInstance()->hide();
|
||||||
|
|
|
@ -10,6 +10,7 @@ class QHBoxLayout;
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
class RippleEffectButton;
|
class RippleEffectButton;
|
||||||
|
class RippleEffectLabel;
|
||||||
class TitleBarButton;
|
class TitleBarButton;
|
||||||
|
|
||||||
class BaseWindow : public BaseWidget
|
class BaseWindow : public BaseWidget
|
||||||
|
@ -23,6 +24,7 @@ public:
|
||||||
QWidget *getLayoutContainer();
|
QWidget *getLayoutContainer();
|
||||||
bool hasCustomWindowFrame();
|
bool hasCustomWindowFrame();
|
||||||
void addTitleBarButton(const TitleBarButton::Style &style, std::function<void()> onClicked);
|
void addTitleBarButton(const TitleBarButton::Style &style, std::function<void()> onClicked);
|
||||||
|
RippleEffectLabel *addTitleBarLabel(std::function<void()> onClicked);
|
||||||
|
|
||||||
void setStayInScreenRect(bool value);
|
void setStayInScreenRect(bool value);
|
||||||
bool getStayInScreenRect() const;
|
bool getStayInScreenRect() const;
|
||||||
|
|
|
@ -39,9 +39,14 @@ Window::Window(const QString &windowName, singletons::ThemeManager &_themeManage
|
||||||
this->addTitleBarButton(TitleBarButton::Settings, [] {
|
this->addTitleBarButton(TitleBarButton::Settings, [] {
|
||||||
singletons::WindowManager::getInstance().showSettingsDialog();
|
singletons::WindowManager::getInstance().showSettingsDialog();
|
||||||
});
|
});
|
||||||
this->addTitleBarButton(TitleBarButton::User, [this] {
|
auto user = this->addTitleBarLabel([this] {
|
||||||
singletons::WindowManager::getInstance().showAccountSelectPopup(QCursor::pos());
|
singletons::WindowManager::getInstance().showAccountSelectPopup(QCursor::pos());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
singletons::AccountManager::getInstance().Twitch.userChanged.connect([this, user] {
|
||||||
|
user->getLabel().setText(
|
||||||
|
singletons::AccountManager::getInstance().Twitch.getCurrent()->getUserName());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
|
|
Loading…
Reference in a new issue