mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added custom window frame title
This commit is contained in:
parent
fa3c812697
commit
1290d28b1a
|
@ -19,6 +19,7 @@
|
||||||
#include <gdiplus.h>
|
#include <gdiplus.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
#pragma comment(lib, "Dwmapi.lib")
|
||||||
|
#pragma comment(lib, "Gdi32.lib")
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
@ -70,11 +71,14 @@ void BaseWindow::init()
|
||||||
layout->addLayout(buttonLayout);
|
layout->addLayout(buttonLayout);
|
||||||
|
|
||||||
// title
|
// title
|
||||||
// QLabel *title = new QLabel(" Chatterino");
|
QLabel *title = new QLabel(" Chatterino");
|
||||||
QLabel *title = new QLabel("");
|
QObject::connect(this, &QWidget::windowTitleChanged,
|
||||||
QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
[title](const QString &text) { title->setText(" " + text); });
|
||||||
|
|
||||||
|
QSizePolicy policy(QSizePolicy::Ignored, QSizePolicy::Preferred);
|
||||||
policy.setHorizontalStretch(1);
|
policy.setHorizontalStretch(1);
|
||||||
title->setBaseSize(0, 0);
|
// title->setBaseSize(0, 0);
|
||||||
|
title->setScaledContents(true);
|
||||||
title->setSizePolicy(policy);
|
title->setSizePolicy(policy);
|
||||||
buttonLayout->addWidget(title);
|
buttonLayout->addWidget(title);
|
||||||
this->ui.titleLabel = title;
|
this->ui.titleLabel = title;
|
||||||
|
@ -106,7 +110,7 @@ void BaseWindow::init()
|
||||||
this->ui.buttons.push_back(_maxButton);
|
this->ui.buttons.push_back(_maxButton);
|
||||||
this->ui.buttons.push_back(_exitButton);
|
this->ui.buttons.push_back(_exitButton);
|
||||||
|
|
||||||
buttonLayout->addStretch(1);
|
// buttonLayout->addStretch(1);
|
||||||
buttonLayout->addWidget(_minButton);
|
buttonLayout->addWidget(_minButton);
|
||||||
buttonLayout->addWidget(_maxButton);
|
buttonLayout->addWidget(_maxButton);
|
||||||
buttonLayout->addWidget(_exitButton);
|
buttonLayout->addWidget(_exitButton);
|
||||||
|
@ -167,6 +171,11 @@ void BaseWindow::themeRefreshEvent()
|
||||||
palette.setColor(QPalette::Foreground, this->themeManager.window.text);
|
palette.setColor(QPalette::Foreground, this->themeManager.window.text);
|
||||||
this->setPalette(palette);
|
this->setPalette(palette);
|
||||||
|
|
||||||
|
QPalette palette_title;
|
||||||
|
palette_title.setColor(QPalette::Foreground,
|
||||||
|
this->themeManager.isLightTheme() ? "#333" : "#ccc");
|
||||||
|
this->ui.titleLabel->setPalette(palette_title);
|
||||||
|
|
||||||
for (RippleEffectButton *button : this->ui.buttons) {
|
for (RippleEffectButton *button : this->ui.buttons) {
|
||||||
button->setMouseEffectColor(this->themeManager.window.text);
|
button->setMouseEffectColor(this->themeManager.window.text);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +194,7 @@ void BaseWindow::addTitleBarButton(const TitleBarButton::Style &style,
|
||||||
button->setScaleIndependantSize(30, 30);
|
button->setScaleIndependantSize(30, 30);
|
||||||
|
|
||||||
this->ui.buttons.push_back(button);
|
this->ui.buttons.push_back(button);
|
||||||
this->ui.titlebarBox->insertWidget(2, button);
|
this->ui.titlebarBox->insertWidget(1, button);
|
||||||
button->setButtonStyle(style);
|
button->setButtonStyle(style);
|
||||||
|
|
||||||
QObject::connect(button, &TitleBarButton::clicked, this, [onClicked] { onClicked(); });
|
QObject::connect(button, &TitleBarButton::clicked, this, [onClicked] { onClicked(); });
|
||||||
|
@ -197,7 +206,7 @@ RippleEffectLabel *BaseWindow::addTitleBarLabel(std::function<void()> onClicked)
|
||||||
button->setScaleIndependantHeight(30);
|
button->setScaleIndependantHeight(30);
|
||||||
|
|
||||||
this->ui.buttons.push_back(button);
|
this->ui.buttons.push_back(button);
|
||||||
this->ui.titlebarBox->insertWidget(2, button);
|
this->ui.titlebarBox->insertWidget(1, button);
|
||||||
|
|
||||||
QObject::connect(button, &RippleEffectLabel::clicked, this, [onClicked] { onClicked(); });
|
QObject::connect(button, &RippleEffectLabel::clicked, this, [onClicked] { onClicked(); });
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ EmotePopup::EmotePopup(singletons::ThemeManager &themeManager)
|
||||||
|
|
||||||
void EmotePopup::loadChannel(ChannelPtr _channel)
|
void EmotePopup::loadChannel(ChannelPtr _channel)
|
||||||
{
|
{
|
||||||
|
this->setWindowTitle("Emotes from " + _channel->name);
|
||||||
|
|
||||||
TwitchChannel *channel = dynamic_cast<TwitchChannel *>(_channel.get());
|
TwitchChannel *channel = dynamic_cast<TwitchChannel *>(_channel.get());
|
||||||
|
|
||||||
if (channel == nullptr) {
|
if (channel == nullptr) {
|
||||||
|
|
|
@ -342,7 +342,9 @@ void NotebookTab2::leaveEvent(QEvent *)
|
||||||
|
|
||||||
void NotebookTab2::dragEnterEvent(QDragEnterEvent *)
|
void NotebookTab2::dragEnterEvent(QDragEnterEvent *)
|
||||||
{
|
{
|
||||||
this->notebook->select(this->page);
|
if (this->notebook->getAllowUserTabManagement()) {
|
||||||
|
this->notebook->select(this->page);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookTab2::mouseMoveEvent(QMouseEvent *event)
|
void NotebookTab2::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
|
|
@ -19,6 +19,8 @@ SelectChannelDialog::SelectChannelDialog()
|
||||||
: BaseWindow((QWidget *)nullptr, true)
|
: BaseWindow((QWidget *)nullptr, true)
|
||||||
, selectedChannel(Channel::getEmpty())
|
, selectedChannel(Channel::getEmpty())
|
||||||
{
|
{
|
||||||
|
this->setWindowTitle("Select a channel to join");
|
||||||
|
|
||||||
this->tabFilter.dialog = this;
|
this->tabFilter.dialog = this;
|
||||||
|
|
||||||
util::LayoutCreator<QWidget> layoutWidget(this->getLayoutContainer());
|
util::LayoutCreator<QWidget> layoutWidget(this->getLayoutContainer());
|
||||||
|
|
|
@ -100,6 +100,8 @@ Window::Window(singletons::ThemeManager &_themeManager, WindowType _type)
|
||||||
// static int index = 0;
|
// static int index = 0;
|
||||||
// ircManager.addFakeMessage(cheerMessages[index++ % cheerMessages.size()]);
|
// ircManager.addFakeMessage(cheerMessages[index++ % cheerMessages.size()]);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
this->setWindowTitle("Chatterino 2 Development Build");
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::WindowType Window::getType()
|
Window::WindowType Window::getType()
|
||||||
|
|
Loading…
Reference in a new issue