added basic new layout
This commit is contained in:
@@ -139,10 +139,10 @@ void NotebookButton::dropEvent(QDropEvent *event)
|
||||
Notebook *notebook = dynamic_cast<Notebook *>(this->parentWidget());
|
||||
|
||||
if (notebook != nuuls) {
|
||||
SplitContainer *tab = notebook->addNewPage();
|
||||
SplitContainer *page = notebook->addNewPage();
|
||||
|
||||
SplitContainer::draggingSplit->setParent(tab);
|
||||
tab->addToLayout(SplitContainer::draggingSplit);
|
||||
SplitContainer::draggingSplit->setParent(page);
|
||||
page->appendSplit(SplitContainer::draggingSplit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ NotebookTab::NotebookTab(Notebook *_notebook)
|
||||
QString newTitle = d.getText();
|
||||
if (newTitle.isEmpty()) {
|
||||
this->useDefaultTitle = true;
|
||||
this->page->refreshTitle();
|
||||
this->page->refreshTabTitle();
|
||||
} else {
|
||||
this->useDefaultTitle = false;
|
||||
this->setTitle(newTitle);
|
||||
|
||||
@@ -241,13 +241,13 @@ void SplitHeader::mouseMoveEvent(QMouseEvent *event)
|
||||
tooltipWidget->show();
|
||||
}
|
||||
|
||||
if (this->dragging) {
|
||||
if (std::abs(this->dragStart.x() - event->pos().x()) > 12 ||
|
||||
std::abs(this->dragStart.y() - event->pos().y()) > 12) {
|
||||
this->split->drag();
|
||||
this->dragging = false;
|
||||
}
|
||||
}
|
||||
// if (this->dragging) {
|
||||
// if (std::abs(this->dragStart.x() - event->pos().x()) > 12 ||
|
||||
// std::abs(this->dragStart.y() - event->pos().y()) > 12) {
|
||||
// this->split->drag();
|
||||
// this->dragging = false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void SplitHeader::leaveEvent(QEvent *event)
|
||||
|
||||
@@ -163,15 +163,16 @@ void SplitInput::installKeyPressedEvent()
|
||||
return;
|
||||
}
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
SplitContainer *page =
|
||||
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
// SplitContainer *page =
|
||||
// static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
|
||||
int reqX = page->currentX;
|
||||
int reqY = page->lastRequestedY[reqX] - 1;
|
||||
// page->requestFocus();
|
||||
// int reqX = page->currentX;
|
||||
// int reqY = page->lastRequestedY[reqX] - 1;
|
||||
|
||||
qDebug() << "Alt+Down to" << reqX << "/" << reqY;
|
||||
// qDebug() << "Alt+Down to" << reqX << "/" << reqY;
|
||||
|
||||
page->requestFocus(reqX, reqY);
|
||||
// page->requestFocus(reqX, reqY);
|
||||
} else {
|
||||
if (this->prevMsg.size() && this->prevIndex) {
|
||||
if (this->prevIndex == (this->prevMsg.size())) {
|
||||
@@ -191,15 +192,15 @@ void SplitInput::installKeyPressedEvent()
|
||||
return;
|
||||
}
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
SplitContainer *page =
|
||||
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
// SplitContainer *page =
|
||||
// static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
|
||||
int reqX = page->currentX;
|
||||
int reqY = page->lastRequestedY[reqX] + 1;
|
||||
// int reqX = page->currentX;
|
||||
// int reqY = page->lastRequestedY[reqX] + 1;
|
||||
|
||||
qDebug() << "Alt+Down to" << reqX << "/" << reqY;
|
||||
// qDebug() << "Alt+Down to" << reqX << "/" << reqY;
|
||||
|
||||
page->requestFocus(reqX, reqY);
|
||||
// page->requestFocus(reqX, reqY);
|
||||
} else {
|
||||
if (this->prevIndex != (this->prevMsg.size() - 1) &&
|
||||
this->prevIndex != this->prevMsg.size()) {
|
||||
@@ -216,27 +217,27 @@ void SplitInput::installKeyPressedEvent()
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Left) {
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
SplitContainer *page =
|
||||
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
// SplitContainer *page =
|
||||
// static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
|
||||
int reqX = page->currentX - 1;
|
||||
int reqY = page->lastRequestedY[reqX];
|
||||
// int reqX = page->currentX - 1;
|
||||
// int reqY = page->lastRequestedY[reqX];
|
||||
|
||||
qDebug() << "Alt+Left to" << reqX << "/" << reqY;
|
||||
// qDebug() << "Alt+Left to" << reqX << "/" << reqY;
|
||||
|
||||
page->requestFocus(reqX, reqY);
|
||||
// page->requestFocus(reqX, reqY);
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Right) {
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
SplitContainer *page =
|
||||
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
// SplitContainer *page =
|
||||
// static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
|
||||
int reqX = page->currentX + 1;
|
||||
int reqY = page->lastRequestedY[reqX];
|
||||
// int reqX = page->currentX + 1;
|
||||
// int reqY = page->lastRequestedY[reqX];
|
||||
|
||||
qDebug() << "Alt+Right to" << reqX << "/" << reqY;
|
||||
// qDebug() << "Alt+Right to" << reqX << "/" << reqY;
|
||||
|
||||
page->requestFocus(reqX, reqY);
|
||||
// page->requestFocus(reqX, reqY);
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Tab) {
|
||||
if (event->modifiers() == Qt::ControlModifier) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "application.hpp"
|
||||
#include "singletons/resourcemanager.hpp"
|
||||
#include "widgets/split.hpp"
|
||||
#include "widgets/splitcontainer.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
@@ -146,6 +147,17 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched, QEvent *even
|
||||
this->parent->split->drag();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
SplitContainer *container = this->parent->split->getContainer();
|
||||
|
||||
if (container != nullptr) {
|
||||
auto *_split = new Split(container);
|
||||
container->insertSplit(
|
||||
_split,
|
||||
(SplitContainer::Direction)(this->hoveredElement + SplitContainer::Left -
|
||||
SplitLeft),
|
||||
this->parent->split);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
enum HoveredElement { None, SplitMove, SplitLeft, SplitRight, SplitUp, SplitDown };
|
||||
// fourtf: !!! preserve the order of left, up, right and down
|
||||
enum HoveredElement { None, SplitMove, SplitLeft, SplitUp, SplitRight, SplitDown };
|
||||
HoveredElement hoveredElement = None;
|
||||
Split *split;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user