mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
improved splits
This commit is contained in:
parent
c1a3764f44
commit
27cd953c8c
10 changed files with 336 additions and 363 deletions
13
src/widgets/helper/dropoverlay.cpp
Normal file
13
src/widgets/helper/dropoverlay.cpp
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
//#include "dropoverlay.hpp"
|
||||||
|
|
||||||
|
// namespace chatterino {
|
||||||
|
// namespace widgets {
|
||||||
|
// namespace helper {
|
||||||
|
|
||||||
|
// DropOverlay::DropOverlay()
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
|
||||||
|
//} // namespace helper
|
||||||
|
//} // namespace widgets
|
||||||
|
//} // namespace chatterino
|
11
src/widgets/helper/dropoverlay.hpp
Normal file
11
src/widgets/helper/dropoverlay.hpp
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
//#pragma once
|
||||||
|
|
||||||
|
//#include "widgets/helper/splitnode.hpp"
|
||||||
|
|
||||||
|
// namespace chatterino {
|
||||||
|
// namespace widgets {
|
||||||
|
// namespace helper {
|
||||||
|
|
||||||
|
//} // namespace helper
|
||||||
|
//} // namespace widgets
|
||||||
|
//} // namespace chatterino
|
6
src/widgets/helper/splitnode.cpp
Normal file
6
src/widgets/helper/splitnode.cpp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include "splitnode.hpp"
|
||||||
|
|
||||||
|
SplitNode::SplitNode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
11
src/widgets/helper/splitnode.hpp
Normal file
11
src/widgets/helper/splitnode.hpp
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef SPLITNODE_HPP
|
||||||
|
#define SPLITNODE_HPP
|
||||||
|
|
||||||
|
|
||||||
|
class SplitNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SplitNode();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SPLITNODE_HPP
|
|
@ -19,6 +19,7 @@ SplitOverlay::SplitOverlay(Split *parent)
|
||||||
, split(parent)
|
, split(parent)
|
||||||
{
|
{
|
||||||
QGridLayout *layout = new QGridLayout(this);
|
QGridLayout *layout = new QGridLayout(this);
|
||||||
|
this->_layout = layout;
|
||||||
layout->setMargin(1);
|
layout->setMargin(1);
|
||||||
layout->setSpacing(1);
|
layout->setSpacing(1);
|
||||||
|
|
||||||
|
@ -28,10 +29,11 @@ SplitOverlay::SplitOverlay(Split *parent)
|
||||||
layout->setColumnStretch(3, 1);
|
layout->setColumnStretch(3, 1);
|
||||||
|
|
||||||
QPushButton *move = new QPushButton(getApp()->resources->split.move, QString());
|
QPushButton *move = new QPushButton(getApp()->resources->split.move, QString());
|
||||||
QPushButton *left = new QPushButton(getApp()->resources->split.left, QString());
|
QPushButton *left = this->_left = new QPushButton(getApp()->resources->split.left, QString());
|
||||||
QPushButton *right = new QPushButton(getApp()->resources->split.right, QString());
|
QPushButton *right = this->_right =
|
||||||
QPushButton *up = new QPushButton(getApp()->resources->split.up, QString());
|
new QPushButton(getApp()->resources->split.right, QString());
|
||||||
QPushButton *down = new QPushButton(getApp()->resources->split.down, QString());
|
QPushButton *up = this->_up = new QPushButton(getApp()->resources->split.up, QString());
|
||||||
|
QPushButton *down = this->_down = new QPushButton(getApp()->resources->split.down, QString());
|
||||||
|
|
||||||
move->setGraphicsEffect(new QGraphicsOpacityEffect(this));
|
move->setGraphicsEffect(new QGraphicsOpacityEffect(this));
|
||||||
left->setGraphicsEffect(new QGraphicsOpacityEffect(this));
|
left->setGraphicsEffect(new QGraphicsOpacityEffect(this));
|
||||||
|
@ -108,6 +110,18 @@ void SplitOverlay::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplitOverlay::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
float scale = this->getScale();
|
||||||
|
bool wideEnough = event->size().width() > 150 * scale;
|
||||||
|
bool highEnough = event->size().height() > 150 * scale;
|
||||||
|
|
||||||
|
this->_left->setVisible(wideEnough);
|
||||||
|
this->_right->setVisible(wideEnough);
|
||||||
|
this->_up->setVisible(highEnough);
|
||||||
|
this->_down->setVisible(highEnough);
|
||||||
|
}
|
||||||
|
|
||||||
SplitOverlay::ButtonEventFilter::ButtonEventFilter(SplitOverlay *_parent, HoveredElement _element)
|
SplitOverlay::ButtonEventFilter::ButtonEventFilter(SplitOverlay *_parent, HoveredElement _element)
|
||||||
: QObject(_parent)
|
: QObject(_parent)
|
||||||
, parent(_parent)
|
, parent(_parent)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "pajlada/signals/signalholder.hpp"
|
#include "pajlada/signals/signalholder.hpp"
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
|
|
||||||
|
@ -15,12 +18,18 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// fourtf: !!! preserve the order of left, up, right and down
|
// fourtf: !!! preserve the order of left, up, right and down
|
||||||
enum HoveredElement { None, SplitMove, SplitLeft, SplitUp, SplitRight, SplitDown };
|
enum HoveredElement { None, SplitMove, SplitLeft, SplitUp, SplitRight, SplitDown };
|
||||||
HoveredElement hoveredElement = None;
|
HoveredElement hoveredElement = None;
|
||||||
Split *split;
|
Split *split;
|
||||||
|
QGridLayout *_layout;
|
||||||
|
QPushButton *_left;
|
||||||
|
QPushButton *_up;
|
||||||
|
QPushButton *_right;
|
||||||
|
QPushButton *_down;
|
||||||
|
|
||||||
class ButtonEventFilter : public QObject
|
class ButtonEventFilter : public QObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,8 +39,8 @@ using namespace chatterino::messages;
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
pajlada::Signals::Signal<bool> Split::altPressedStatusChanged;
|
pajlada::Signals::Signal<Qt::KeyboardModifiers> Split::modifierStatusChanged;
|
||||||
bool Split::altPressesStatus = false;
|
Qt::KeyboardModifiers Split::modifierStatus = Qt::NoModifier;
|
||||||
|
|
||||||
Split::Split(SplitContainer *parent)
|
Split::Split(SplitContainer *parent)
|
||||||
: Split((QWidget *)parent)
|
: Split((QWidget *)parent)
|
||||||
|
@ -128,15 +128,14 @@ Split::Split(QWidget *parent)
|
||||||
|
|
||||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
this->managedConnect(altPressedStatusChanged, [this](bool status) {
|
this->managedConnect(modifierStatusChanged, [this](Qt::KeyboardModifiers status) {
|
||||||
// if (status && this->isMouseOver) {
|
if ((status == Qt::AltModifier || status == (Qt::AltModifier | Qt::ControlModifier)) &&
|
||||||
// this->overlay->show();
|
this->isMouseOver) {
|
||||||
// } else {
|
this->overlay->show();
|
||||||
// this->overlay->hide();
|
} else {
|
||||||
// }
|
this->overlay->hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->setAcceptDrops(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Split::~Split()
|
Split::~Split()
|
||||||
|
@ -161,6 +160,11 @@ bool Split::isInContainer() const
|
||||||
return this->container != nullptr;
|
return this->container != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Split::setContainer(SplitContainer *_container)
|
||||||
|
{
|
||||||
|
this->container = _container;
|
||||||
|
}
|
||||||
|
|
||||||
IndirectChannel Split::getIndirectChannel()
|
IndirectChannel Split::getIndirectChannel()
|
||||||
{
|
{
|
||||||
return this->channel;
|
return this->channel;
|
||||||
|
@ -299,7 +303,11 @@ void Split::resizeEvent(QResizeEvent *event)
|
||||||
void Split::enterEvent(QEvent *event)
|
void Split::enterEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
this->isMouseOver = true;
|
this->isMouseOver = true;
|
||||||
if (altPressesStatus) {
|
|
||||||
|
auto a = modifierStatus;
|
||||||
|
|
||||||
|
if (modifierStatus == Qt::AltModifier ||
|
||||||
|
modifierStatus == (Qt::AltModifier | Qt::ControlModifier)) {
|
||||||
this->overlay->show();
|
this->overlay->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,18 +320,23 @@ void Split::leaveEvent(QEvent *event)
|
||||||
|
|
||||||
void Split::handleModifiers(QEvent *event, Qt::KeyboardModifiers modifiers)
|
void Split::handleModifiers(QEvent *event, Qt::KeyboardModifiers modifiers)
|
||||||
{
|
{
|
||||||
if (modifiers == Qt::AltModifier) {
|
if (modifierStatus != modifiers) {
|
||||||
if (!altPressesStatus) {
|
modifierStatus = modifiers;
|
||||||
altPressesStatus = true;
|
modifierStatusChanged.invoke(modifiers);
|
||||||
altPressedStatusChanged.invoke(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (altPressesStatus) {
|
|
||||||
altPressesStatus = false;
|
|
||||||
altPressedStatusChanged.invoke(false);
|
|
||||||
}
|
|
||||||
this->setCursor(Qt::ArrowCursor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (modifiers == Qt::AltModifier) {
|
||||||
|
// if (!modifierStatus) {
|
||||||
|
// modifierStatus = true;
|
||||||
|
// modifierStatusChanged.invoke(true);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (modifierStatus) {
|
||||||
|
// modifierStatus = false;
|
||||||
|
// modifierStatusChanged.invoke(false);
|
||||||
|
// }
|
||||||
|
// this->setCursor(Qt::ArrowCursor);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split::dragEnterEvent(QDragEnterEvent *event)
|
void Split::dragEnterEvent(QDragEnterEvent *event)
|
||||||
|
|
|
@ -69,8 +69,10 @@ public:
|
||||||
|
|
||||||
bool isInContainer() const;
|
bool isInContainer() const;
|
||||||
|
|
||||||
static pajlada::Signals::Signal<bool> altPressedStatusChanged;
|
void setContainer(SplitContainer *container);
|
||||||
static bool altPressesStatus;
|
|
||||||
|
static pajlada::Signals::Signal<Qt::KeyboardModifiers> modifierStatusChanged;
|
||||||
|
static Qt::KeyboardModifiers modifierStatus;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "widgets/splitcontainer.hpp"
|
#include "widgets/splitcontainer.hpp"
|
||||||
|
#include "application.hpp"
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "singletons/thememanager.hpp"
|
#include "singletons/thememanager.hpp"
|
||||||
#include "util/helpers.hpp"
|
#include "util/helpers.hpp"
|
||||||
|
@ -30,25 +31,29 @@ SplitContainer::SplitContainer(Notebook *parent, NotebookTab *_tab)
|
||||||
: BaseWidget(parent)
|
: BaseWidget(parent)
|
||||||
, tab(_tab)
|
, tab(_tab)
|
||||||
, dropPreview(this)
|
, dropPreview(this)
|
||||||
|
, mouseOverPoint(-10000, -10000)
|
||||||
|
, overlay(this)
|
||||||
{
|
{
|
||||||
this->tab->page = this;
|
this->tab->page = this;
|
||||||
|
|
||||||
// this->setLayout(&this->ui.parentLayout);
|
|
||||||
|
|
||||||
// this->setHidden(true);
|
|
||||||
// this->setAcceptDrops(true);
|
|
||||||
|
|
||||||
// this->ui.parentLayout.addSpacing(1);
|
|
||||||
// this->ui.parentLayout.addLayout(&this->ui.hbox);
|
|
||||||
// this->ui.parentLayout.setMargin(0);
|
|
||||||
|
|
||||||
// this->ui.hbox.setSpacing(1);
|
|
||||||
// this->ui.hbox.setMargin(0);
|
|
||||||
|
|
||||||
this->refreshTabTitle();
|
this->refreshTabTitle();
|
||||||
|
|
||||||
this->managedConnect(Split::altPressedStatusChanged, [this](auto) { this->layout(); });
|
this->managedConnect(Split::modifierStatusChanged, [this](auto) {
|
||||||
|
// fourtf: maybe optimize
|
||||||
|
this->layout();
|
||||||
|
});
|
||||||
|
|
||||||
|
this->setCursor(Qt::PointingHandCursor);
|
||||||
|
this->setAcceptDrops(true);
|
||||||
|
|
||||||
|
this->managedConnect(this->overlay.dragEnded, [this]() {
|
||||||
|
this->isDragging = false;
|
||||||
|
this->layout();
|
||||||
|
});
|
||||||
|
|
||||||
|
this->overlay.hide();
|
||||||
|
|
||||||
|
this->setMouseTracking(true);
|
||||||
this->setAcceptDrops(true);
|
this->setAcceptDrops(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +96,8 @@ void SplitContainer::insertSplit(Split *split, Direction direction, Split *relat
|
||||||
|
|
||||||
void SplitContainer::insertSplit(Split *split, Direction direction, Node *relativeTo)
|
void SplitContainer::insertSplit(Split *split, Direction direction, Node *relativeTo)
|
||||||
{
|
{
|
||||||
|
split->setContainer(this);
|
||||||
|
|
||||||
if (relativeTo == nullptr) {
|
if (relativeTo == nullptr) {
|
||||||
if (this->baseNode.type == Node::EmptyRoot) {
|
if (this->baseNode.type == Node::EmptyRoot) {
|
||||||
this->baseNode.setSplit(split);
|
this->baseNode.setSplit(split);
|
||||||
|
@ -107,8 +114,11 @@ void SplitContainer::insertSplit(Split *split, Direction direction, Node *relati
|
||||||
|
|
||||||
split->setParent(this);
|
split->setParent(this);
|
||||||
split->show();
|
split->show();
|
||||||
|
split->giveFocus(Qt::MouseFocusReason);
|
||||||
this->splits.push_back(split);
|
this->splits.push_back(split);
|
||||||
|
|
||||||
|
// this->setAcceptDrops(false);
|
||||||
|
|
||||||
this->layout();
|
this->layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +131,14 @@ SplitContainer::Position SplitContainer::releaseSplit(Split *split)
|
||||||
split->setParent(nullptr);
|
split->setParent(nullptr);
|
||||||
Position position = node->releaseSplit();
|
Position position = node->releaseSplit();
|
||||||
this->layout();
|
this->layout();
|
||||||
|
if (splits.size() != 0) {
|
||||||
|
this->splits.front()->giveFocus(Qt::MouseFocusReason);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (this->splits.empty()) {
|
||||||
|
// this->setAcceptDrops(true);
|
||||||
|
// }
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,11 +155,41 @@ void SplitContainer::layout()
|
||||||
this->baseNode.geometry = this->rect();
|
this->baseNode.geometry = this->rect();
|
||||||
|
|
||||||
std::vector<DropRect> _dropRects;
|
std::vector<DropRect> _dropRects;
|
||||||
this->baseNode.layout(Split::altPressesStatus | this->isDragging, _dropRects);
|
this->baseNode.layout(
|
||||||
|
Split::modifierStatus == (Qt::AltModifier | Qt::ControlModifier) || this->isDragging,
|
||||||
|
this->getScale(), _dropRects);
|
||||||
_dropRects.clear();
|
_dropRects.clear();
|
||||||
this->baseNode.layout(Split::altPressesStatus | this->isDragging, _dropRects);
|
this->baseNode.layout(
|
||||||
|
Split::modifierStatus == (Qt::AltModifier | Qt::ControlModifier) || this->isDragging,
|
||||||
|
this->getScale(), _dropRects);
|
||||||
|
|
||||||
this->dropRects = std::move(_dropRects);
|
this->dropRects = _dropRects;
|
||||||
|
|
||||||
|
for (Split *split : this->splits) {
|
||||||
|
const QRect &g = split->geometry();
|
||||||
|
|
||||||
|
Node *node = this->baseNode.findNodeContainingSplit(split);
|
||||||
|
|
||||||
|
_dropRects.push_back(DropRect(QRect(g.left(), g.top(), g.width() / 4, g.height()),
|
||||||
|
Position(node, Direction::Left)));
|
||||||
|
_dropRects.push_back(
|
||||||
|
DropRect(QRect(g.left() + g.width() / 4 * 3, g.top(), g.width() / 4, g.height()),
|
||||||
|
Position(node, Direction::Right)));
|
||||||
|
|
||||||
|
_dropRects.push_back(DropRect(QRect(g.left(), g.top(), g.width(), g.height() / 2),
|
||||||
|
Position(node, Direction::Above)));
|
||||||
|
_dropRects.push_back(
|
||||||
|
DropRect(QRect(g.left(), g.top() + g.height() / 2, g.width(), g.height() / 2),
|
||||||
|
Position(node, Direction::Below)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->splits.empty()) {
|
||||||
|
QRect g = this->rect();
|
||||||
|
_dropRects.push_back(DropRect(QRect(g.left(), g.top(), g.width(), g.height()),
|
||||||
|
Position(nullptr, Direction::Below)));
|
||||||
|
}
|
||||||
|
|
||||||
|
this->overlay.setRects(std::move(_dropRects));
|
||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +208,7 @@ void SplitContainer::mouseReleaseEvent(QMouseEvent *event)
|
||||||
// "Add Chat" was clicked
|
// "Add Chat" was clicked
|
||||||
this->appendNewSplit(true);
|
this->appendNewSplit(true);
|
||||||
|
|
||||||
this->setCursor(QCursor(Qt::ArrowCursor));
|
// this->setCursor(QCursor(Qt::ArrowCursor));
|
||||||
} else {
|
} else {
|
||||||
auto it =
|
auto it =
|
||||||
std::find_if(this->dropRects.begin(), this->dropRects.end(),
|
std::find_if(this->dropRects.begin(), this->dropRects.end(),
|
||||||
|
@ -198,8 +246,16 @@ void SplitContainer::paintEvent(QPaintEvent *)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DropRect &dropRect : this->dropRects) {
|
for (DropRect &dropRect : this->dropRects) {
|
||||||
painter.setPen("#774");
|
QColor border = getApp()->themes->splits.dropPreviewBorder;
|
||||||
painter.setBrush(QBrush("#553"));
|
QColor background = getApp()->themes->splits.dropPreview;
|
||||||
|
|
||||||
|
if (!dropRect.rect.contains(this->mouseOverPoint)) {
|
||||||
|
// border.setAlphaF(0.1);
|
||||||
|
background.setAlphaF(0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
painter.setPen(border);
|
||||||
|
painter.setBrush(background);
|
||||||
|
|
||||||
painter.drawRect(dropRect.rect.marginsRemoved(QMargins(2, 2, 2, 2)));
|
painter.drawRect(dropRect.rect.marginsRemoved(QMargins(2, 2, 2, 2)));
|
||||||
}
|
}
|
||||||
|
@ -213,310 +269,57 @@ void SplitContainer::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
void SplitContainer::dragEnterEvent(QDragEnterEvent *event)
|
void SplitContainer::dragEnterEvent(QDragEnterEvent *event)
|
||||||
{
|
{
|
||||||
if (!event->mimeData()->hasFormat("chatterino/split"))
|
// if (!event->mimeData()->hasFormat("chatterino/split"))
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (!SplitContainer::isDraggingSplit) {
|
// if (!SplitContainer::isDraggingSplit) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
this->isDragging = true;
|
this->isDragging = true;
|
||||||
this->layout();
|
this->layout();
|
||||||
|
|
||||||
event->acceptProposedAction();
|
// if (this->splits.empty()) {
|
||||||
|
|
||||||
// this->dropRegions.clear();
|
|
||||||
|
|
||||||
// if (this->ui.hbox.count() == 0) {
|
|
||||||
// this->dropRegions.push_back(DropRegion(rect(), std::pair<int, int>(-1, -1)));
|
|
||||||
// } else {
|
|
||||||
// for (int i = 0; i < this->ui.hbox.count() + 1; ++i) {
|
|
||||||
// this->dropRegions.push_back(
|
|
||||||
// DropRegion(QRect(((i * 4 - 1) * width() / this->ui.hbox.count()) / 4, 0,
|
|
||||||
// width() / this->ui.hbox.count() / 2 + 1, height() + 1),
|
|
||||||
// std::pair<int, int>(i, -1)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (int i = 0; i < this->ui.hbox.count(); ++i) {
|
|
||||||
// auto vbox = static_cast<QVBoxLayout *>(this->ui.hbox.itemAt(i));
|
|
||||||
|
|
||||||
// for (int j = 0; j < vbox->count() + 1; ++j) {
|
|
||||||
// this->dropRegions.push_back(DropRegion(
|
|
||||||
// QRect(i * width() / this->ui.hbox.count(),
|
|
||||||
// ((j * 2 - 1) * height() / vbox->count()) / 2,
|
|
||||||
// width() / this->ui.hbox.count() + 1, height() / vbox->count() + 1),
|
|
||||||
|
|
||||||
// std::pair<int, int>(i, j)));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// setPreviewRect(event->pos());
|
|
||||||
|
|
||||||
// event->acceptProposedAction();
|
// event->acceptProposedAction();
|
||||||
|
// }
|
||||||
|
|
||||||
|
this->overlay.setGeometry(this->rect());
|
||||||
|
this->overlay.show();
|
||||||
|
this->overlay.raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitContainer::dragMoveEvent(QDragMoveEvent *event)
|
void SplitContainer::dragMoveEvent(QDragMoveEvent *event)
|
||||||
{
|
{
|
||||||
// setPreviewRect(event->pos());
|
// if (this->splits.empty()) {
|
||||||
|
// event->acceptProposedAction();
|
||||||
|
// }
|
||||||
|
|
||||||
for (auto &dropRect : this->dropRects) {
|
// for (auto &dropRect : this->dropRects) {
|
||||||
if (dropRect.rect.contains(event->pos())) {
|
// if (dropRect.rect.contains(event->pos())) {
|
||||||
event->acceptProposedAction();
|
// event->acceptProposedAction();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
event->setAccepted(false);
|
// event->setAccepted(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitContainer::dragLeaveEvent(QDragLeaveEvent *event)
|
void SplitContainer::dragLeaveEvent(QDragLeaveEvent *event)
|
||||||
{
|
{
|
||||||
this->isDragging = false;
|
// this->isDragging = false;
|
||||||
this->layout();
|
// this->layout();
|
||||||
|
|
||||||
// this->dropPreview.hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitContainer::dropEvent(QDropEvent *event)
|
void SplitContainer::dropEvent(QDropEvent *event)
|
||||||
{
|
{
|
||||||
// if (isDraggingSplit) {
|
// if (this->splits.empty()) {
|
||||||
|
// this->insertSplit(SplitContainer::draggingSplit, Direction::Above);
|
||||||
// event->acceptProposedAction();
|
// event->acceptProposedAction();
|
||||||
|
|
||||||
// SplitContainer::draggingSplit->setParent(this);
|
|
||||||
|
|
||||||
// addToLayout(SplitContainer::draggingSplit, dropPosition);
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// this->dropPreview.hide();
|
// this->isDragging = false;
|
||||||
|
// this->layout();
|
||||||
for (auto &dropRect : this->dropRects) {
|
|
||||||
if (dropRect.rect.contains(event->pos())) {
|
|
||||||
this->insertSplit(SplitContainer::draggingSplit, dropRect.position);
|
|
||||||
event->acceptProposedAction();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->isDragging = false;
|
|
||||||
this->layout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void SplitContainer::updateFlexValues()
|
|
||||||
//{
|
|
||||||
// for (int i = 0; i < this->ui.hbox.count(); i++) {
|
|
||||||
// QVBoxLayout *vbox = (QVBoxLayout *)ui.hbox.itemAt(i)->layout();
|
|
||||||
|
|
||||||
// if (vbox->count() != 0) {
|
|
||||||
// ui.hbox.setStretch(i, (int)(1000 * ((Split *)vbox->itemAt(0))->getFlexSizeX()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
// int SplitContainer::splitCount() const
|
|
||||||
//{
|
|
||||||
// return this->splits.size();
|
|
||||||
//}
|
|
||||||
|
|
||||||
// std::pair<int, int> SplitContainer::removeFromLayout(Split *widget)
|
|
||||||
//{
|
|
||||||
// widget->getChannelView().tabHighlightRequested.disconnectAll();
|
|
||||||
|
|
||||||
// // remove reference to chat widget from chatWidgets vector
|
|
||||||
// auto it = std::find(std::begin(this->splits), std::end(this->splits), widget);
|
|
||||||
// if (it != std::end(this->splits)) {
|
|
||||||
// this->splits.erase(it);
|
|
||||||
|
|
||||||
// this->refreshTitle();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Split *neighbouringSplit = nullptr;
|
|
||||||
|
|
||||||
// // Position the split was found at
|
|
||||||
// int positionX = -1, positionY = -1;
|
|
||||||
|
|
||||||
// bool removed = false;
|
|
||||||
|
|
||||||
// QVBoxLayout *layoutToRemove = nullptr;
|
|
||||||
|
|
||||||
// // Find widget in box, remove it, return its position
|
|
||||||
// for (int i = 0; i < this->ui.hbox.count(); ++i) {
|
|
||||||
// auto vbox = static_cast<QVBoxLayout *>(this->ui.hbox.itemAt(i));
|
|
||||||
|
|
||||||
// auto vboxCount = vbox->count();
|
|
||||||
|
|
||||||
// for (int j = 0; j < vboxCount; ++j) {
|
|
||||||
// if (vbox->itemAt(j)->widget() != widget) {
|
|
||||||
// neighbouringSplit = dynamic_cast<Split *>(vbox->itemAt(j)->widget());
|
|
||||||
|
|
||||||
// if (removed && neighbouringSplit != nullptr) {
|
|
||||||
// // The widget we searched for has been found, and we have a split to switch
|
|
||||||
// // focus to
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// removed = true;
|
|
||||||
// positionX = i;
|
|
||||||
|
|
||||||
// // Remove split from box
|
|
||||||
// widget->setParent(nullptr);
|
|
||||||
|
|
||||||
// if (vbox->count() == 0) {
|
|
||||||
// // The split was the last item remaining in the vbox
|
|
||||||
// // Remove the vbox once all iteration is done
|
|
||||||
// layoutToRemove = vbox;
|
|
||||||
// positionY = -1;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Don't break here yet, we want to keep iterating this vbox if possible to find the
|
|
||||||
// // closest still-alive neighbour that we can switch focus to
|
|
||||||
// positionY = j;
|
|
||||||
|
|
||||||
// --j;
|
|
||||||
// --vboxCount;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (removed && neighbouringSplit != nullptr) {
|
|
||||||
// // The widget we searched for has been found, and we have a split to switch focus to
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (removed) {
|
|
||||||
// if (layoutToRemove != nullptr) {
|
|
||||||
// // The split we removed was the last split in its box. Remove the box
|
|
||||||
// // We delay the removing of the box so we can keep iterating over hbox safely
|
|
||||||
// this->ui.hbox.removeItem(layoutToRemove);
|
|
||||||
// delete layoutToRemove;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (neighbouringSplit != nullptr) {
|
|
||||||
// // We found a neighbour split we can switch focus to
|
|
||||||
// neighbouringSplit->giveFocus(Qt::MouseFocusReason);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return std::make_pair(positionX, positionY);
|
|
||||||
//}
|
|
||||||
|
|
||||||
// void SplitContainer::addToLayout(Split *widget, std::pair<int, int> position)
|
|
||||||
//{
|
|
||||||
// this->splits.push_back(widget);
|
|
||||||
// widget->getChannelView().tabHighlightRequested.connect(
|
|
||||||
// [this](HighlightState state) { this->tab->setHighlightState(state); });
|
|
||||||
|
|
||||||
// this->refreshTitle();
|
|
||||||
|
|
||||||
// widget->giveFocus(Qt::MouseFocusReason);
|
|
||||||
|
|
||||||
// // add vbox at the end
|
|
||||||
// if (position.first < 0 || position.first >= this->ui.hbox.count()) {
|
|
||||||
// auto vbox = new QVBoxLayout();
|
|
||||||
// vbox->addWidget(widget);
|
|
||||||
|
|
||||||
// this->ui.hbox.addLayout(vbox, 1);
|
|
||||||
|
|
||||||
// this->refreshCurrentFocusCoordinates();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // insert vbox
|
|
||||||
// if (position.second == -1) {
|
|
||||||
// auto vbox = new QVBoxLayout();
|
|
||||||
// vbox->addWidget(widget);
|
|
||||||
|
|
||||||
// this->ui.hbox.insertLayout(position.first, vbox, 1);
|
|
||||||
// this->refreshCurrentFocusCoordinates();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // add to existing vbox
|
|
||||||
// auto vbox = static_cast<QVBoxLayout *>(this->ui.hbox.itemAt(position.first));
|
|
||||||
|
|
||||||
// vbox->insertWidget(std::max(0, std::min(vbox->count(), position.second)), widget);
|
|
||||||
|
|
||||||
// this->refreshCurrentFocusCoordinates();
|
|
||||||
//}
|
|
||||||
|
|
||||||
// const std::vector<Split *> &SplitContainer::getSplits() const
|
|
||||||
//{
|
|
||||||
// return this->splits;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// std::vector<std::vector<Split *>> SplitContainer::getColumns() const
|
|
||||||
//{
|
|
||||||
// std::vector<std::vector<Split *>> columns;
|
|
||||||
|
|
||||||
// for (int i = 0; i < this->ui.hbox.count(); i++) {
|
|
||||||
// std::vector<Split *> cells;
|
|
||||||
|
|
||||||
// QLayout *vbox = this->ui.hbox.itemAt(i)->layout();
|
|
||||||
// for (int j = 0; j < vbox->count(); j++) {
|
|
||||||
// cells.push_back(dynamic_cast<Split *>(vbox->itemAt(j)->widget()));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// columns.push_back(cells);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return columns;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// void SplitContainer::refreshCurrentFocusCoordinates(bool alsoSetLastRequested)
|
|
||||||
//{
|
|
||||||
// int setX = -1;
|
|
||||||
// int setY = -1;
|
|
||||||
// bool doBreak = false;
|
|
||||||
// for (int x = 0; x < this->ui.hbox.count(); ++x) {
|
|
||||||
// QLayoutItem *item = this->ui.hbox.itemAt(x);
|
|
||||||
// if (item->isEmpty()) {
|
|
||||||
// setX = x;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// QVBoxLayout *vbox = static_cast<QVBoxLayout *>(item->layout());
|
|
||||||
|
|
||||||
// for (int y = 0; y < vbox->count(); ++y) {
|
|
||||||
// QLayoutItem *innerItem = vbox->itemAt(y);
|
|
||||||
|
|
||||||
// if (innerItem->isEmpty()) {
|
|
||||||
// setX = x;
|
|
||||||
// setY = y;
|
|
||||||
// doBreak = true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// QWidget *w = innerItem->widget();
|
|
||||||
// if (w) {
|
|
||||||
// Split *chatWidget = static_cast<Split *>(w);
|
|
||||||
// if (chatWidget->hasFocus()) {
|
|
||||||
// setX = x;
|
|
||||||
// setY = y;
|
|
||||||
// doBreak = true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (doBreak) {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (setX != -1) {
|
|
||||||
// this->currentX = setX;
|
|
||||||
|
|
||||||
// if (setY != -1) {
|
|
||||||
// this->currentY = setY;
|
|
||||||
|
|
||||||
// if (alsoSetLastRequested) {
|
|
||||||
// this->lastRequestedY[setX] = setY;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
// void SplitContainer::requestFocus(int requestedX, int requestedY)
|
// void SplitContainer::requestFocus(int requestedX, int requestedY)
|
||||||
//{
|
//{
|
||||||
// // XXX: Perhaps if we request an Y coordinate out of bounds, we shuold set all previously set
|
// // XXX: Perhaps if we request an Y coordinate out of bounds, we shuold set all previously set
|
||||||
|
@ -561,7 +364,7 @@ void SplitContainer::dropEvent(QDropEvent *event)
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// void SplitContainer::enterEvent(QEvent *)
|
// void SplitContainer::enterEvent(QEvent *event)
|
||||||
//{
|
//{
|
||||||
// if (this->ui.hbox.count() == 0) {
|
// if (this->ui.hbox.count() == 0) {
|
||||||
// this->setCursor(QCursor(Qt::PointingHandCursor));
|
// this->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
|
@ -570,9 +373,17 @@ void SplitContainer::dropEvent(QDropEvent *event)
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// void SplitContainer::leaveEvent(QEvent *)
|
void SplitContainer::mouseMoveEvent(QMouseEvent *event)
|
||||||
//{
|
{
|
||||||
//}
|
this->mouseOverPoint = event->pos();
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SplitContainer::leaveEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
this->mouseOverPoint = QPoint(-1000, -10000);
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
// void SplitContainer::setPreviewRect(QPoint mousePos)
|
// void SplitContainer::setPreviewRect(QPoint mousePos)
|
||||||
//{
|
//{
|
||||||
|
|
|
@ -16,8 +16,13 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <pajlada/signals/signal.hpp>
|
||||||
#include <pajlada/signals/signalholder.hpp>
|
#include <pajlada/signals/signalholder.hpp>
|
||||||
|
|
||||||
|
// remove
|
||||||
|
#include "application.hpp"
|
||||||
|
#include "singletons/thememanager.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
|
@ -285,7 +290,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void layout(bool addSpacing, std::vector<DropRect> &dropRects)
|
void layout(bool addSpacing, float _scale, std::vector<DropRect> &dropRects)
|
||||||
{
|
{
|
||||||
switch (this->type) {
|
switch (this->type) {
|
||||||
case Node::_Split: {
|
case Node::_Split: {
|
||||||
|
@ -303,7 +308,8 @@ public:
|
||||||
qreal childWidth = this->geometry.width();
|
qreal childWidth = this->geometry.width();
|
||||||
|
|
||||||
if (addSpacing) {
|
if (addSpacing) {
|
||||||
qreal offset = this->geometry.width() * 0.1;
|
qreal offset = std::min<qreal>(this->geometry.width() * 0.1, _scale * 24);
|
||||||
|
|
||||||
dropRects.emplace_back(
|
dropRects.emplace_back(
|
||||||
QRect(childX, this->geometry.top(), offset, this->geometry.height()),
|
QRect(childX, this->geometry.top(), offset, this->geometry.height()),
|
||||||
Position(this, Direction::Left));
|
Position(this, Direction::Left));
|
||||||
|
@ -323,7 +329,7 @@ public:
|
||||||
child->geometry =
|
child->geometry =
|
||||||
QRectF(childX, y, childWidth, child->geometry.height() * scaleFactor);
|
QRectF(childX, y, childWidth, child->geometry.height() * scaleFactor);
|
||||||
|
|
||||||
child->layout(addSpacing, dropRects);
|
child->layout(addSpacing, _scale, dropRects);
|
||||||
y += child->geometry.height();
|
y += child->geometry.height();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
@ -338,7 +344,7 @@ public:
|
||||||
qreal childHeight = this->geometry.height();
|
qreal childHeight = this->geometry.height();
|
||||||
|
|
||||||
if (addSpacing) {
|
if (addSpacing) {
|
||||||
qreal offset = this->geometry.height() * 0.1;
|
qreal offset = std::min<qreal>(this->geometry.height() * 0.1, _scale * 24);
|
||||||
dropRects.emplace_back(
|
dropRects.emplace_back(
|
||||||
QRect(this->geometry.left(), childY, this->geometry.width(), offset),
|
QRect(this->geometry.left(), childY, this->geometry.width(), offset),
|
||||||
Position(this, Direction::Above));
|
Position(this, Direction::Above));
|
||||||
|
@ -347,8 +353,8 @@ public:
|
||||||
this->geometry.width(), offset),
|
this->geometry.width(), offset),
|
||||||
Position(this, Direction::Below));
|
Position(this, Direction::Below));
|
||||||
|
|
||||||
childY += this->geometry.height() * 0.1;
|
childY += offset;
|
||||||
childHeight -= this->geometry.height() * 0.2;
|
childHeight -= offset * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal scaleFactor = this->geometry.width() / totalWidth;
|
qreal scaleFactor = this->geometry.width() / totalWidth;
|
||||||
|
@ -358,7 +364,7 @@ public:
|
||||||
child->geometry =
|
child->geometry =
|
||||||
QRectF(x, childY, child->geometry.width() * scaleFactor, childHeight);
|
QRectF(x, childY, child->geometry.width() * scaleFactor, childHeight);
|
||||||
|
|
||||||
child->layout(addSpacing, dropRects);
|
child->layout(addSpacing, _scale, dropRects);
|
||||||
x += child->geometry.width();
|
x += child->geometry.width();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
@ -374,6 +380,105 @@ public:
|
||||||
friend class SplitContainer;
|
friend class SplitContainer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DropOverlay : public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DropOverlay(SplitContainer *_parent = nullptr)
|
||||||
|
: QWidget(_parent)
|
||||||
|
, parent(_parent)
|
||||||
|
, mouseOverPoint(-10000, -10000)
|
||||||
|
{
|
||||||
|
this->setMouseTracking(true);
|
||||||
|
this->setAcceptDrops(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setRects(std::vector<SplitContainer::DropRect> _rects)
|
||||||
|
{
|
||||||
|
this->rects = std::move(_rects);
|
||||||
|
}
|
||||||
|
|
||||||
|
pajlada::Signals::NoArgSignal dragEnded;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *event) override
|
||||||
|
{
|
||||||
|
QPainter painter(this);
|
||||||
|
|
||||||
|
// painter.fillRect(this->rect(), QColor("#334"));
|
||||||
|
|
||||||
|
bool foundMover = false;
|
||||||
|
|
||||||
|
for (DropRect &rect : this->rects) {
|
||||||
|
if (!foundMover && rect.rect.contains(this->mouseOverPoint)) {
|
||||||
|
painter.setBrush(getApp()->themes->splits.dropPreview);
|
||||||
|
painter.setPen(getApp()->themes->splits.dropPreviewBorder);
|
||||||
|
foundMover = true;
|
||||||
|
} else {
|
||||||
|
painter.setBrush(QColor(0, 0, 0, 0));
|
||||||
|
painter.setPen(QColor(0, 0, 0, 0));
|
||||||
|
// painter.setPen(getApp()->themes->splits.dropPreviewBorder);
|
||||||
|
}
|
||||||
|
|
||||||
|
painter.drawRect(rect.rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouseMoveEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
this->mouseOverPoint = event->pos();
|
||||||
|
}
|
||||||
|
|
||||||
|
void leaveEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
this->mouseOverPoint = QPoint(-10000, -10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dragEnterEvent(QDragEnterEvent *event)
|
||||||
|
{
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dragMoveEvent(QDragMoveEvent *event)
|
||||||
|
{
|
||||||
|
event->acceptProposedAction();
|
||||||
|
|
||||||
|
this->mouseOverPoint = event->pos();
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dragLeaveEvent(QDragLeaveEvent *event)
|
||||||
|
{
|
||||||
|
this->mouseOverPoint = QPoint(-10000, -10000);
|
||||||
|
this->close();
|
||||||
|
this->dragEnded.invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dropEvent(QDropEvent *event)
|
||||||
|
{
|
||||||
|
Position *position = nullptr;
|
||||||
|
for (DropRect &rect : this->rects) {
|
||||||
|
if (rect.rect.contains(this->mouseOverPoint)) {
|
||||||
|
position = &rect.position;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position != nullptr) {
|
||||||
|
this->parent->insertSplit(SplitContainer::draggingSplit, *position);
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->mouseOverPoint = QPoint(-10000, -10000);
|
||||||
|
this->close();
|
||||||
|
this->dragEnded.invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<DropRect> rects;
|
||||||
|
QPoint mouseOverPoint;
|
||||||
|
SplitContainer *parent;
|
||||||
|
};
|
||||||
|
|
||||||
SplitContainer(Notebook *parent, NotebookTab *_tab);
|
SplitContainer(Notebook *parent, NotebookTab *_tab);
|
||||||
|
|
||||||
void appendNewSplit(bool openChannelNameDialog);
|
void appendNewSplit(bool openChannelNameDialog);
|
||||||
|
@ -402,31 +507,6 @@ public:
|
||||||
return &this->baseNode;
|
return &this->baseNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::pair<int, int> removeFromLayout(Split *widget);
|
|
||||||
// void addToLayout(Split *widget, std::pair<int, int> position = std::pair<int, int>(-1,
|
|
||||||
// -1));
|
|
||||||
|
|
||||||
// const std::vector<Split *> &getSplits() const;
|
|
||||||
// std::vector<std::vector<Split *>> getColumns() const;
|
|
||||||
|
|
||||||
// void addChat(bool openChannelNameDialog = false);
|
|
||||||
|
|
||||||
// static std::pair<int, int> dropPosition;
|
|
||||||
|
|
||||||
// int currentX = 0;
|
|
||||||
// int currentY = 0;
|
|
||||||
// std::map<int, int> lastRequestedY;
|
|
||||||
|
|
||||||
// void refreshCurrentFocusCoordinates(bool alsoSetLastRequested = false);
|
|
||||||
// void requestFocus(int x, int y);
|
|
||||||
|
|
||||||
// void updateFlexValues();
|
|
||||||
// int splitCount() const;
|
|
||||||
|
|
||||||
// void loadSplits();
|
|
||||||
|
|
||||||
// void save();
|
|
||||||
|
|
||||||
static bool isDraggingSplit;
|
static bool isDraggingSplit;
|
||||||
static Split *draggingSplit;
|
static Split *draggingSplit;
|
||||||
// static Position dragOriginalPosition;
|
// static Position dragOriginalPosition;
|
||||||
|
@ -438,7 +518,8 @@ protected:
|
||||||
// void showEvent(QShowEvent *event) override;
|
// void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
// void enterEvent(QEvent *event) override;
|
// void enterEvent(QEvent *event) override;
|
||||||
// void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
|
@ -463,6 +544,8 @@ private:
|
||||||
std::vector<DropRect> dropRects;
|
std::vector<DropRect> dropRects;
|
||||||
std::vector<DropRegion> dropRegions;
|
std::vector<DropRegion> dropRegions;
|
||||||
NotebookPageDropPreview dropPreview;
|
NotebookPageDropPreview dropPreview;
|
||||||
|
DropOverlay overlay;
|
||||||
|
QPoint mouseOverPoint;
|
||||||
|
|
||||||
void layout();
|
void layout();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue