fixed mac stuff and added more debug code

This commit is contained in:
nuuls
2018-05-24 22:58:07 +02:00
committed by fourtf
parent 835b6d80da
commit 6ee4945715
7 changed files with 51 additions and 13 deletions
+4 -4
View File
@@ -177,7 +177,7 @@ void ChannelView::actuallyLayoutMessages(bool causedByScrollbar)
{
auto app = getApp();
// BENCH(timer)
BENCH(timer)
auto messagesSnapshot = this->getMessagesSnapshot();
if (messagesSnapshot.getLength() == 0) {
@@ -264,7 +264,7 @@ void ChannelView::actuallyLayoutMessages(bool causedByScrollbar)
this->messageWasAdded = false;
}
// MARK(timer);
MARK(timer);
if (redrawRequired) {
this->queueUpdate();
@@ -580,7 +580,7 @@ bool ChannelView::isPaused()
void ChannelView::paintEvent(QPaintEvent * /*event*/)
{
// BENCH(timer);
BENCH(timer);
QPainter painter(this);
@@ -589,7 +589,7 @@ void ChannelView::paintEvent(QPaintEvent * /*event*/)
// draw messages
this->drawMessages(painter);
// MARK(timer);
MARK(timer);
}
// if overlays is false then it draws the message, if true then it draws things such as the grey
+4 -4
View File
@@ -86,7 +86,7 @@ void NotebookTab::updateSize()
float scale = getScale();
int width;
QFontMetrics metrics = getApp()->fonts->getFontMetrics(FontStyle::UiTabs, this->getScale());
QFontMetrics metrics = getApp()->fonts->getFontMetrics(FontStyle::UiTabs, this->getScale() * this->devicePixelRatioF());
if (this->hasXButton()) {
width = (int)((metrics.width(this->title) + 32) * scale);
@@ -188,7 +188,7 @@ void NotebookTab::paintEvent(QPaintEvent *)
QPainter painter(this);
float scale = this->getScale();
painter.setFont(getApp()->fonts->getFont(FontStyle::UiTabs, scale));
painter.setFont(getApp()->fonts->getFont(FontStyle::UiTabs, scale * this->devicePixelRatioF()));
int height = (int)(scale * NOTEBOOK_TAB_HEIGHT);
// int fullHeight = (int)(scale * 48);
@@ -248,13 +248,13 @@ void NotebookTab::paintEvent(QPaintEvent *)
if (true) { // legacy
// painter.drawText(rect, this->getTitle(), QTextOption(Qt::AlignCenter));
int offset = (int)(scale * 8);
QRect textRect(offset, this->selected ? 0 : 1, this->width() - offset - offset, height);
QRect textRect(offset, this->selected ? 1 : 2, this->width() - offset - offset, height);
if (this->shouldDrawXButton()) {
textRect.setRight(textRect.right() - this->height() / 2);
}
QTextOption option(Qt::AlignLeft | Qt::AlignVCenter);
QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter);
option.setWrapMode(QTextOption::NoWrap);
painter.drawText(textRect, this->getTitle(), option);
} else {