Merge branch 'master' into git_is_pepega
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#include "common/Common.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "debug/Benchmark.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
#include "messages/LimitedQueueSnapshot.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
@@ -29,6 +28,7 @@
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/TooltipPreviewImage.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/Clipboard.hpp"
|
||||
#include "util/DistanceBetweenPoints.hpp"
|
||||
#include "util/IncognitoBrowser.hpp"
|
||||
#include "widgets/Scrollbar.hpp"
|
||||
@@ -65,9 +65,8 @@ namespace {
|
||||
if (!image->isEmpty())
|
||||
{
|
||||
copyMenu->addAction(
|
||||
QString(scale) + "x link", [url = image->url()] {
|
||||
QApplication::clipboard()->setText(url.string);
|
||||
});
|
||||
QString(scale) + "x link",
|
||||
[url = image->url()] { crossPlatformCopy(url.string); });
|
||||
openMenu->addAction(
|
||||
QString(scale) + "x link", [url = image->url()] {
|
||||
QDesktopServices::openUrl(QUrl(url.string));
|
||||
@@ -85,9 +84,8 @@ namespace {
|
||||
openMenu->addSeparator();
|
||||
|
||||
copyMenu->addAction(
|
||||
"Copy " + name + " emote link", [url = emote.homePage] {
|
||||
QApplication::clipboard()->setText(url.string); //
|
||||
});
|
||||
"Copy " + name + " emote link",
|
||||
[url = emote.homePage] { crossPlatformCopy(url.string); });
|
||||
openMenu->addAction(
|
||||
"Open " + name + " emote link", [url = emote.homePage] {
|
||||
QDesktopServices::openUrl(QUrl(url.string)); //
|
||||
@@ -125,9 +123,8 @@ ChannelView::ChannelView(BaseWidget *parent)
|
||||
});
|
||||
|
||||
auto shortcut = new QShortcut(QKeySequence("Ctrl+C"), this);
|
||||
QObject::connect(shortcut, &QShortcut::activated, [this] {
|
||||
QGuiApplication::clipboard()->setText(this->getSelectedText());
|
||||
});
|
||||
QObject::connect(shortcut, &QShortcut::activated,
|
||||
[this] { crossPlatformCopy(this->getSelectedText()); });
|
||||
|
||||
this->clickTimer_ = new QTimer(this);
|
||||
this->clickTimer_->setSingleShot(true);
|
||||
@@ -651,7 +648,8 @@ void ChannelView::messageAppended(MessagePtr &message,
|
||||
|
||||
if (!messageFlags->has(MessageFlag::DoNotTriggerNotification))
|
||||
{
|
||||
if (messageFlags->has(MessageFlag::Highlighted))
|
||||
if (messageFlags->has(MessageFlag::Highlighted) &&
|
||||
!messageFlags->has(MessageFlag::Subscription))
|
||||
{
|
||||
this->tabHighlightRequested.invoke(HighlightState::Highlighted);
|
||||
}
|
||||
@@ -740,9 +738,8 @@ void ChannelView::messageReplaced(size_t index, MessagePtr &replacement)
|
||||
auto snapshot = this->messages_.getSnapshot();
|
||||
if (index >= snapshot.size())
|
||||
{
|
||||
log("Tried to replace out of bounds message. Index: {}. "
|
||||
"Length: {}",
|
||||
index, snapshot.size());
|
||||
qDebug() << "Tried to replace out of bounds message. Index:" << index
|
||||
<< ". Length:" << snapshot.size();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1554,8 +1551,7 @@ void ChannelView::addContextMenuItems(
|
||||
menu->addAction("Open link incognito",
|
||||
[url] { openLinkIncognito(url); });
|
||||
}
|
||||
menu->addAction("Copy link",
|
||||
[url] { QApplication::clipboard()->setText(url); });
|
||||
menu->addAction("Copy link", [url] { crossPlatformCopy(url); });
|
||||
|
||||
menu->addSeparator();
|
||||
}
|
||||
@@ -1563,9 +1559,8 @@ void ChannelView::addContextMenuItems(
|
||||
// Copy actions
|
||||
if (!this->selection_.isEmpty())
|
||||
{
|
||||
menu->addAction("Copy selection", [this] {
|
||||
QGuiApplication::clipboard()->setText(this->getSelectedText());
|
||||
});
|
||||
menu->addAction("Copy selection",
|
||||
[this] { crossPlatformCopy(this->getSelectedText()); });
|
||||
}
|
||||
|
||||
menu->addAction("Copy message", [layout] {
|
||||
@@ -1573,14 +1568,14 @@ void ChannelView::addContextMenuItems(
|
||||
layout->addSelectionText(copyString, 0, INT_MAX,
|
||||
CopyMode::OnlyTextAndEmotes);
|
||||
|
||||
QGuiApplication::clipboard()->setText(copyString);
|
||||
crossPlatformCopy(copyString);
|
||||
});
|
||||
|
||||
menu->addAction("Copy full message", [layout] {
|
||||
QString copyString;
|
||||
layout->addSelectionText(copyString);
|
||||
|
||||
QGuiApplication::clipboard()->setText(copyString);
|
||||
crossPlatformCopy(copyString);
|
||||
});
|
||||
|
||||
// Open in new split.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "widgets/helper/ColorButton.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
ColorButton::ColorButton(const QColor &color, QWidget *parent)
|
||||
: QPushButton(parent)
|
||||
, color_(color)
|
||||
{
|
||||
this->setColor(color_);
|
||||
}
|
||||
|
||||
const QColor &ColorButton::color() const
|
||||
{
|
||||
return this->color_;
|
||||
}
|
||||
|
||||
void ColorButton::setColor(QColor color)
|
||||
{
|
||||
this->color_ = color;
|
||||
this->setStyleSheet("background-color: " + color.name(QColor::HexArgb));
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class ColorButton : public QPushButton
|
||||
{
|
||||
public:
|
||||
ColorButton(const QColor &color, QWidget *parent = nullptr);
|
||||
|
||||
const QColor &color() const;
|
||||
|
||||
void setColor(QColor color);
|
||||
|
||||
private:
|
||||
QColor color_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Common.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "singletons/Fonts.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
|
||||
@@ -0,0 +1,290 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "widgets/helper/QColorPicker.hpp"
|
||||
|
||||
#include <qdrawutil.h>
|
||||
|
||||
/*
|
||||
* These classes are literally copied from the Qt source.
|
||||
* Unfortunately, they are private to the QColorDialog class so we cannot use
|
||||
* them directly.
|
||||
* If they become public at any point in the future, it should be possible to
|
||||
* replace every include of this header with the respective includes for the
|
||||
* QColorPicker, QColorLuminancePicker, and QColSpinBox classes.
|
||||
*/
|
||||
namespace chatterino {
|
||||
|
||||
int QColorLuminancePicker::y2val(int y)
|
||||
{
|
||||
int d = height() - 2 * coff - 1;
|
||||
return 255 - (y - coff) * 255 / d;
|
||||
}
|
||||
|
||||
int QColorLuminancePicker::val2y(int v)
|
||||
{
|
||||
int d = height() - 2 * coff - 1;
|
||||
return coff + (255 - v) * d / 255;
|
||||
}
|
||||
|
||||
QColorLuminancePicker::QColorLuminancePicker(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
hue = 100;
|
||||
val = 100;
|
||||
sat = 100;
|
||||
pix = 0;
|
||||
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
}
|
||||
|
||||
QColorLuminancePicker::~QColorLuminancePicker()
|
||||
{
|
||||
delete pix;
|
||||
}
|
||||
|
||||
void QColorLuminancePicker::mouseMoveEvent(QMouseEvent *m)
|
||||
{
|
||||
setVal(y2val(m->y()));
|
||||
}
|
||||
|
||||
void QColorLuminancePicker::mousePressEvent(QMouseEvent *m)
|
||||
{
|
||||
setVal(y2val(m->y()));
|
||||
}
|
||||
|
||||
void QColorLuminancePicker::setVal(int v)
|
||||
{
|
||||
if (val == v)
|
||||
return;
|
||||
val = qMax(0, qMin(v, 255));
|
||||
delete pix;
|
||||
pix = 0;
|
||||
repaint();
|
||||
emit newHsv(hue, sat, val);
|
||||
}
|
||||
|
||||
//receives from a hue,sat chooser and relays.
|
||||
void QColorLuminancePicker::setCol(int h, int s)
|
||||
{
|
||||
setCol(h, s, val);
|
||||
emit newHsv(h, s, val);
|
||||
}
|
||||
|
||||
QSize QColorLuminancePicker::sizeHint() const
|
||||
{
|
||||
return QSize(LUMINANCE_PICKER_WIDTH, LUMINANCE_PICKER_HEIGHT);
|
||||
}
|
||||
|
||||
void QColorLuminancePicker::paintEvent(QPaintEvent *)
|
||||
{
|
||||
int w = width() - 5;
|
||||
QRect r(0, foff, w, height() - 2 * foff);
|
||||
int wi = r.width() - 2;
|
||||
int hi = r.height() - 2;
|
||||
if (!pix || pix->height() != hi || pix->width() != wi)
|
||||
{
|
||||
delete pix;
|
||||
QImage img(wi, hi, QImage::Format_RGB32);
|
||||
int y;
|
||||
uint *pixel = (uint *)img.scanLine(0);
|
||||
for (y = 0; y < hi; y++)
|
||||
{
|
||||
uint *end = pixel + wi;
|
||||
std::fill(pixel, end,
|
||||
QColor::fromHsv(hue, sat, y2val(y + coff)).rgb());
|
||||
pixel = end;
|
||||
}
|
||||
pix = new QPixmap(QPixmap::fromImage(img));
|
||||
}
|
||||
QPainter p(this);
|
||||
p.drawPixmap(1, coff, *pix);
|
||||
const QPalette &g = palette();
|
||||
qDrawShadePanel(&p, r, g, true);
|
||||
p.setPen(g.windowText().color());
|
||||
p.setBrush(g.windowText());
|
||||
QPolygon a;
|
||||
int y = val2y(val);
|
||||
a.setPoints(3, w, y, w + 5, y + 5, w + 5, y - 5);
|
||||
p.eraseRect(w, 0, 5, height());
|
||||
p.drawPolygon(a);
|
||||
}
|
||||
|
||||
void QColorLuminancePicker::setCol(int h, int s, int v)
|
||||
{
|
||||
val = v;
|
||||
hue = h;
|
||||
sat = s;
|
||||
delete pix;
|
||||
pix = 0;
|
||||
repaint();
|
||||
}
|
||||
|
||||
QPoint QColorPicker::colPt()
|
||||
{
|
||||
QRect r = contentsRect();
|
||||
return QPoint((360 - hue) * (r.width() - 1) / 360,
|
||||
(255 - sat) * (r.height() - 1) / 255);
|
||||
}
|
||||
|
||||
int QColorPicker::huePt(const QPoint &pt)
|
||||
{
|
||||
QRect r = contentsRect();
|
||||
return 360 - pt.x() * 360 / (r.width() - 1);
|
||||
}
|
||||
|
||||
int QColorPicker::satPt(const QPoint &pt)
|
||||
{
|
||||
QRect r = contentsRect();
|
||||
return 255 - pt.y() * 255 / (r.height() - 1);
|
||||
}
|
||||
|
||||
void QColorPicker::setCol(const QPoint &pt)
|
||||
{
|
||||
setCol(huePt(pt), satPt(pt));
|
||||
}
|
||||
|
||||
QColorPicker::QColorPicker(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
, crossVisible(true)
|
||||
{
|
||||
hue = 0;
|
||||
sat = 0;
|
||||
setCol(150, 255);
|
||||
setAttribute(Qt::WA_NoSystemBackground);
|
||||
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
}
|
||||
|
||||
QColorPicker::~QColorPicker()
|
||||
{
|
||||
}
|
||||
|
||||
void QColorPicker::setCrossVisible(bool visible)
|
||||
{
|
||||
if (crossVisible != visible)
|
||||
{
|
||||
crossVisible = visible;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QSize QColorPicker::sizeHint() const
|
||||
{
|
||||
return QSize(COLOR_PICKER_WIDTH, COLOR_PICKER_HEIGHT);
|
||||
}
|
||||
|
||||
void QColorPicker::setCol(int h, int s)
|
||||
{
|
||||
int nhue = qMin(qMax(0, h), 359);
|
||||
int nsat = qMin(qMax(0, s), 255);
|
||||
if (nhue == hue && nsat == sat)
|
||||
return;
|
||||
QRect r(colPt(), QSize(20, 20));
|
||||
hue = nhue;
|
||||
sat = nsat;
|
||||
r = r.united(QRect(colPt(), QSize(20, 20)));
|
||||
r.translate(contentsRect().x() - 9, contentsRect().y() - 9);
|
||||
repaint(r);
|
||||
}
|
||||
|
||||
void QColorPicker::mouseMoveEvent(QMouseEvent *m)
|
||||
{
|
||||
QPoint p = m->pos() - contentsRect().topLeft();
|
||||
setCol(p);
|
||||
emit newCol(hue, sat);
|
||||
}
|
||||
|
||||
void QColorPicker::mousePressEvent(QMouseEvent *m)
|
||||
{
|
||||
QPoint p = m->pos() - contentsRect().topLeft();
|
||||
setCol(p);
|
||||
emit newCol(hue, sat);
|
||||
}
|
||||
|
||||
void QColorPicker::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawFrame(&p);
|
||||
QRect r = contentsRect();
|
||||
p.drawPixmap(r.topLeft(), pix);
|
||||
if (crossVisible)
|
||||
{
|
||||
QPoint pt = colPt() + r.topLeft();
|
||||
p.setPen(Qt::black);
|
||||
p.fillRect(pt.x() - 9, pt.y(), 20, 2, Qt::black);
|
||||
p.fillRect(pt.x(), pt.y() - 9, 2, 20, Qt::black);
|
||||
}
|
||||
}
|
||||
|
||||
void QColorPicker::resizeEvent(QResizeEvent *ev)
|
||||
{
|
||||
QFrame::resizeEvent(ev);
|
||||
int w = width() - frameWidth() * 2;
|
||||
int h = height() - frameWidth() * 2;
|
||||
QImage img(w, h, QImage::Format_RGB32);
|
||||
int x, y;
|
||||
uint *pixel = (uint *)img.scanLine(0);
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
const uint *end = pixel + w;
|
||||
x = 0;
|
||||
while (pixel < end)
|
||||
{
|
||||
QPoint p(x, y);
|
||||
QColor c;
|
||||
c.setHsv(huePt(p), satPt(p), 200);
|
||||
*pixel = c.rgb();
|
||||
++pixel;
|
||||
++x;
|
||||
}
|
||||
}
|
||||
pix = QPixmap::fromImage(img);
|
||||
}
|
||||
|
||||
QColSpinBox::QColSpinBox(QWidget *parent)
|
||||
: QSpinBox(parent)
|
||||
{
|
||||
this->setRange(0, 255);
|
||||
}
|
||||
|
||||
void QColSpinBox::setValue(int i)
|
||||
{
|
||||
const QSignalBlocker blocker(this);
|
||||
QSpinBox::setValue(i);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -0,0 +1,130 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <QSpinBox>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
/*
|
||||
* These classes are literally copied from the Qt source.
|
||||
* Unfortunately, they are private to the QColorDialog class so we cannot use
|
||||
* them directly.
|
||||
* If they become public at any point in the future, it should be possible to
|
||||
* replace every include of this header with the respective includes for the
|
||||
* QColorPicker, QColorLuminancePicker, and QColSpinBox classes.
|
||||
*/
|
||||
class QColorPicker : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QColorPicker(QWidget *parent);
|
||||
~QColorPicker();
|
||||
void setCrossVisible(bool visible);
|
||||
|
||||
public slots:
|
||||
void setCol(int h, int s);
|
||||
|
||||
signals:
|
||||
void newCol(int h, int s);
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const override;
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *) override;
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
private:
|
||||
int hue;
|
||||
int sat;
|
||||
QPoint colPt();
|
||||
int huePt(const QPoint &pt);
|
||||
int satPt(const QPoint &pt);
|
||||
void setCol(const QPoint &pt);
|
||||
QPixmap pix;
|
||||
bool crossVisible;
|
||||
};
|
||||
|
||||
static const int COLOR_PICKER_WIDTH = 220;
|
||||
static const int COLOR_PICKER_HEIGHT = 200;
|
||||
|
||||
class QColorLuminancePicker : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QColorLuminancePicker(QWidget *parent = 0);
|
||||
~QColorLuminancePicker();
|
||||
|
||||
public slots:
|
||||
void setCol(int h, int s, int v);
|
||||
void setCol(int h, int s);
|
||||
|
||||
signals:
|
||||
void newHsv(int h, int s, int v);
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const override;
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *) override;
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
|
||||
private:
|
||||
enum { foff = 3, coff = 4 }; //frame and contents offset
|
||||
int val;
|
||||
int hue;
|
||||
int sat;
|
||||
int y2val(int y);
|
||||
int val2y(int val);
|
||||
void setVal(int v);
|
||||
QPixmap *pix;
|
||||
};
|
||||
|
||||
static const int LUMINANCE_PICKER_WIDTH = 25;
|
||||
static const int LUMINANCE_PICKER_HEIGHT = COLOR_PICKER_HEIGHT;
|
||||
|
||||
class QColSpinBox : public QSpinBox
|
||||
{
|
||||
public:
|
||||
QColSpinBox(QWidget *parent);
|
||||
|
||||
void setValue(int i);
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -1,24 +1,27 @@
|
||||
#include "widgets/helper/ScrollbarHighlight.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "widgets/Scrollbar.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
ScrollbarHighlight::ScrollbarHighlight()
|
||||
: color_(Color::Highlight)
|
||||
: color_(std::make_shared<QColor>())
|
||||
, style_(Style::None)
|
||||
{
|
||||
}
|
||||
|
||||
ScrollbarHighlight::ScrollbarHighlight(Color color, Style style)
|
||||
ScrollbarHighlight::ScrollbarHighlight(const std::shared_ptr<QColor> color,
|
||||
Style style)
|
||||
: color_(color)
|
||||
, style_(style)
|
||||
{
|
||||
}
|
||||
|
||||
ScrollbarHighlight::Color ScrollbarHighlight::getColor() const
|
||||
QColor ScrollbarHighlight::getColor() const
|
||||
{
|
||||
return this->color_;
|
||||
return *this->color_;
|
||||
}
|
||||
|
||||
ScrollbarHighlight::Style ScrollbarHighlight::getStyle() const
|
||||
|
||||
@@ -6,17 +6,25 @@ class ScrollbarHighlight
|
||||
{
|
||||
public:
|
||||
enum Style : char { None, Default, Line };
|
||||
enum Color : char { Highlight, Subscription };
|
||||
|
||||
/**
|
||||
* @brief Constructs an invalid ScrollbarHighlight.
|
||||
*
|
||||
* A highlight constructed this way will not show on the scrollbar.
|
||||
* For these, use the static ScrollbarHighlight::newSubscription and
|
||||
* ScrollbarHighlight::newHighlight methods.
|
||||
*/
|
||||
ScrollbarHighlight();
|
||||
ScrollbarHighlight(Color color, Style style = Default);
|
||||
|
||||
Color getColor() const;
|
||||
ScrollbarHighlight(const std::shared_ptr<QColor> color,
|
||||
Style style = Default);
|
||||
|
||||
QColor getColor() const;
|
||||
Style getStyle() const;
|
||||
bool isNull() const;
|
||||
|
||||
private:
|
||||
Color color_;
|
||||
std::shared_ptr<QColor> color_;
|
||||
Style style_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user