mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
removed the chrome style tabs
This commit is contained in:
parent
dca11406b9
commit
05335c6440
|
@ -117,7 +117,7 @@ void MessageLayout::actuallyLayout(int width, MessageElement::Flags flags)
|
|||
this->deleteBuffer();
|
||||
}
|
||||
|
||||
this->container.finish();
|
||||
this->container.end();
|
||||
this->height = this->container.getHeight();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ void MessageLayoutContainer::breakLine()
|
|||
}
|
||||
|
||||
this->lineStart = this->elements.size();
|
||||
this->currentX = 0;
|
||||
this->currentX = (int)(this->scale * 8);
|
||||
this->currentY += this->lineHeight;
|
||||
this->height = this->currentY + (this->margin.bottom * this->scale);
|
||||
this->lineHeight = 0;
|
||||
|
@ -158,7 +158,7 @@ bool MessageLayoutContainer::fitsInLine(int _width)
|
|||
return this->currentX + _width <= this->width - this->margin.left - this->margin.right;
|
||||
}
|
||||
|
||||
void MessageLayoutContainer::finish()
|
||||
void MessageLayoutContainer::end()
|
||||
{
|
||||
if (!this->atStartOfLine()) {
|
||||
this->breakLine();
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
// methods
|
||||
void begin(int width, float scale, Message::MessageFlags flags);
|
||||
void finish();
|
||||
void end();
|
||||
|
||||
void clear();
|
||||
void addElement(MessageLayoutElement *element);
|
||||
|
|
|
@ -89,7 +89,7 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier)
|
|||
|
||||
// tabs
|
||||
// text, {regular, hover, unfocused}
|
||||
this->windowBg = "#ccc";
|
||||
// this->windowBg = "#ccc";
|
||||
|
||||
this->tabs.border = "#999";
|
||||
this->tabs.regular = {tabFg, {windowBg, blendColors(windowBg, "#999", 0.5), windowBg}};
|
||||
|
@ -107,7 +107,7 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier)
|
|||
{blendColors(themeColor, windowBg, 0.7), blendColors(themeColor, windowBg, 0.5),
|
||||
blendColors(themeColorNoSat, windowBg, 0.7)}};
|
||||
|
||||
this->windowBg = "#fff";
|
||||
// this->windowBg = "#fff";
|
||||
|
||||
// Split
|
||||
bool flat = isLight;
|
||||
|
|
|
@ -83,12 +83,12 @@ void NotebookTab::updateSize()
|
|||
|
||||
QString qTitle(qS(this->title));
|
||||
if (singletons::SettingManager::getInstance().hideTabX) {
|
||||
width = (int)((fontMetrics().width(qTitle) + 16 + 16) * scale);
|
||||
width = (int)((fontMetrics().width(qTitle) + 16 /*+ 16*/) * scale);
|
||||
} else {
|
||||
width = (int)((fontMetrics().width(qTitle) + 8 + 24 + 16) * scale);
|
||||
width = (int)((fontMetrics().width(qTitle) + 8 + 24 /*+ 16*/) * scale);
|
||||
}
|
||||
|
||||
this->resize(std::min((int)(150 * scale), width), (int)(48 * scale));
|
||||
this->resize(std::min((int)(150 * scale), width), (int)(24 * scale));
|
||||
|
||||
if (this->parent() != nullptr) {
|
||||
(static_cast<Notebook *>(this->parent()))->performLayout(true);
|
||||
|
@ -176,7 +176,7 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||
float scale = this->getScale();
|
||||
|
||||
int height = (int)(scale * 24);
|
||||
int fullHeight = (int)(scale * 48);
|
||||
// int fullHeight = (int)(scale * 48);
|
||||
|
||||
// select the right tab colors
|
||||
singletons::ThemeManager::TabColors colors;
|
||||
|
@ -199,35 +199,47 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||
: (windowFocused ? colors.backgrounds.regular
|
||||
: colors.backgrounds.unfocused);
|
||||
|
||||
if (false) {
|
||||
if (true) {
|
||||
painter.fillRect(rect(), this->mouseOver ? regular.backgrounds.hover
|
||||
: (windowFocused ? regular.backgrounds.regular
|
||||
: regular.backgrounds.unfocused));
|
||||
|
||||
// fill the tab background
|
||||
painter.fillRect(rect(), tabBackground);
|
||||
} else {
|
||||
|
||||
// draw border
|
||||
painter.setPen(QPen("#ccc"));
|
||||
QPainterPath path(QPointF(0, height));
|
||||
path.lineTo(8 * scale, 0);
|
||||
path.lineTo(this->width() - 8 * scale, 0);
|
||||
path.lineTo(this->width(), height);
|
||||
painter.fillPath(path, this->mouseOver ? regular.backgrounds.hover
|
||||
: (windowFocused ? regular.backgrounds.regular
|
||||
: regular.backgrounds.unfocused));
|
||||
|
||||
// fill the tab background
|
||||
painter.fillPath(path, tabBackground);
|
||||
painter.setPen(QColor("#FFF"));
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
path.lineTo(0, 0);
|
||||
path.lineTo(this->width() - 1, 0);
|
||||
path.lineTo(this->width() - 1, this->height() - 1);
|
||||
path.lineTo(0, this->height() - 1);
|
||||
painter.drawPath(path);
|
||||
// painter.setBrush(QColor("#000"));
|
||||
} else {
|
||||
// QPainterPath path(QPointF(0, height));
|
||||
// path.lineTo(8 * scale, 0);
|
||||
// path.lineTo(this->width() - 8 * scale, 0);
|
||||
// path.lineTo(this->width(), height);
|
||||
// painter.fillPath(path, this->mouseOver ? regular.backgrounds.hover
|
||||
// : (windowFocused ?
|
||||
// regular.backgrounds.regular
|
||||
// :
|
||||
// regular.backgrounds.unfocused));
|
||||
|
||||
QLinearGradient gradient(0, height, 0, fullHeight);
|
||||
gradient.setColorAt(0, tabBackground.color());
|
||||
gradient.setColorAt(1, "#fff");
|
||||
// // fill the tab background
|
||||
// painter.fillPath(path, tabBackground);
|
||||
// painter.setPen(QColor("#FFF"));
|
||||
// painter.setRenderHint(QPainter::Antialiasing);
|
||||
// painter.drawPath(path);
|
||||
// // painter.setBrush(QColor("#000"));
|
||||
|
||||
QBrush brush(gradient);
|
||||
painter.fillRect(0, height, this->width(), fullHeight - height, brush);
|
||||
// QLinearGradient gradient(0, height, 0, fullHeight);
|
||||
// gradient.setColorAt(0, tabBackground.color());
|
||||
// gradient.setColorAt(1, "#fff");
|
||||
|
||||
// QBrush brush(gradient);
|
||||
// painter.fillRect(0, height, this->width(), fullHeight - height,
|
||||
// brush);
|
||||
}
|
||||
|
||||
// set the pen color
|
||||
|
@ -238,14 +250,20 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||
QRect rect(0, 0, this->width() - rectW, height);
|
||||
|
||||
// draw text
|
||||
if (false) { // legacy
|
||||
painter.drawText(rect, this->getTitle(), QTextOption(Qt::AlignCenter));
|
||||
} else {
|
||||
if (true) { // legacy
|
||||
// painter.drawText(rect, this->getTitle(), QTextOption(Qt::AlignCenter));
|
||||
int offset = (int)(scale * 8);
|
||||
QRect textRect(offset, 0, this->width() - offset - offset, height);
|
||||
|
||||
QTextOption option(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
option.setWrapMode(QTextOption::NoWrap);
|
||||
int offset = (int)(scale * 16);
|
||||
QRect textRect(offset, 0, this->width() - offset - offset, height);
|
||||
painter.drawText(textRect, this->getTitle(), option);
|
||||
} else {
|
||||
// QTextOption option(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
// option.setWrapMode(QTextOption::NoWrap);
|
||||
// int offset = (int)(scale * 16);
|
||||
// QRect textRect(offset, 0, this->width() - offset - offset, height);
|
||||
// painter.drawText(textRect, this->getTitle(), option);
|
||||
}
|
||||
|
||||
// draw close x
|
||||
|
@ -264,7 +282,7 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||
painter.drawLine(xRect.topLeft() + QPoint(a, a), xRect.bottomRight() + QPoint(-a, -a));
|
||||
painter.drawLine(xRect.topRight() + QPoint(-a, a), xRect.bottomLeft() + QPoint(a, -a));
|
||||
}
|
||||
}
|
||||
} // namespace widgets
|
||||
|
||||
void NotebookTab::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
|
|
|
@ -162,7 +162,7 @@ SplitContainer *Notebook::tabAt(QPoint point, int &index, int maxWidth)
|
|||
|
||||
for (auto *page : this->pages) {
|
||||
QRect rect = page->getTab()->getDesiredRect();
|
||||
rect.setHeight((int)(this->getScale() * 22));
|
||||
rect.setHeight((int)(this->getScale() * 24));
|
||||
|
||||
rect.setWidth(std::min(maxWidth, rect.width()));
|
||||
|
||||
|
@ -244,8 +244,8 @@ void Notebook::performLayout(bool animated)
|
|||
for (auto &i : this->pages) {
|
||||
if (!first &&
|
||||
(i == this->pages.last() ? tabHeight : 0) + x + i->getTab()->width() > width()) {
|
||||
// y += i->getTab()->height();
|
||||
y += 20;
|
||||
y += i->getTab()->height() - 1;
|
||||
// y += 20;
|
||||
i->getTab()->moveAnimated(QPoint(0, y), animated);
|
||||
x = i->getTab()->width();
|
||||
} else {
|
||||
|
@ -253,15 +253,19 @@ void Notebook::performLayout(bool animated)
|
|||
x += i->getTab()->width();
|
||||
}
|
||||
|
||||
x -= (int)(8 * scale);
|
||||
// x -= (int)(8 * scale);
|
||||
x += 1;
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
x += (int)(8 * scale);
|
||||
// x += (int)(8 * scale);
|
||||
// x += 1;
|
||||
|
||||
this->addButton.move(x, y);
|
||||
|
||||
y -= 1;
|
||||
|
||||
for (auto &i : this->pages) {
|
||||
i->getTab()->raise();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue