fix: wording of "close visible tabs to X" for vertical tabs (#6619)
Reviewed-by: nerix <nero.9@hotmail.de> Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
+1
-1
@@ -13,6 +13,7 @@
|
|||||||
- Minor: Added a menu action to sort tabs alphabetically. (#6551)
|
- Minor: Added a menu action to sort tabs alphabetically. (#6551)
|
||||||
- Minor: Fixed "edit hotkey" dialog opening like a normal window. (#6540)
|
- Minor: Fixed "edit hotkey" dialog opening like a normal window. (#6540)
|
||||||
- Minor: Added an API to get the current Twitch account in plugins. (#6554)
|
- Minor: Added an API to get the current Twitch account in plugins. (#6554)
|
||||||
|
- Minor: Added options to close multiple visible tabs. (#6515, #6619)
|
||||||
- Minor: Added a setting to show the stream title in live messages. (#6572)
|
- Minor: Added a setting to show the stream title in live messages. (#6572)
|
||||||
- Minor: Added broadcaster-only `/poll`, `/cancelpoll`, and `/endpoll` commands. (#6583, #6605)
|
- Minor: Added broadcaster-only `/poll`, `/cancelpoll`, and `/endpoll` commands. (#6583, #6605)
|
||||||
- Minor: Added broadcaster-only `/prediction` command to start a prediction. (#6583)
|
- Minor: Added broadcaster-only `/prediction` command to start a prediction. (#6583)
|
||||||
@@ -57,7 +58,6 @@
|
|||||||
- Dev: Unwrapped `LimitedQueueSnapshot` to `std::vector`. (#6606)
|
- Dev: Unwrapped `LimitedQueueSnapshot` to `std::vector`. (#6606)
|
||||||
- Dev: Simplified uses of `getMessageSnapshot`. (#6607)
|
- Dev: Simplified uses of `getMessageSnapshot`. (#6607)
|
||||||
- Dev: Disabled `llvm-prefer-static-over-anonymous-namespace` in clang-tidy. (#6610)
|
- Dev: Disabled `llvm-prefer-static-over-anonymous-namespace` in clang-tidy. (#6610)
|
||||||
- Dev: Added options to close multiple visible tabs. (#6515)
|
|
||||||
|
|
||||||
## 2.5.4
|
## 2.5.4
|
||||||
|
|
||||||
|
|||||||
@@ -125,9 +125,52 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
|||||||
});
|
});
|
||||||
|
|
||||||
this->closeMultipleTabsMenu_ = new QMenu("Close Multiple Tabs", this);
|
this->closeMultipleTabsMenu_ = new QMenu("Close Multiple Tabs", this);
|
||||||
this->menu_.addMenu(closeMultipleTabsMenu_);
|
|
||||||
|
|
||||||
closeMultipleTabsMenu_->addAction("Close All Visible Tabs", [this]() {
|
const auto tabDirection = getSettings()->tabDirection.getEnum();
|
||||||
|
this->menu_.addMenu(closeMultipleTabsMenu_);
|
||||||
|
getSettings()->tabDirection.connect(
|
||||||
|
[this](int val) {
|
||||||
|
this->recreateCloseMultipleTabsMenu(
|
||||||
|
static_cast<NotebookTabLocation>(val));
|
||||||
|
},
|
||||||
|
this->signalHolder_);
|
||||||
|
|
||||||
|
this->menu_.addAction(
|
||||||
|
"Popup Tab",
|
||||||
|
getApp()->getHotkeys()->getDisplaySequence(HotkeyCategory::Window,
|
||||||
|
"popup", {{"window"}}),
|
||||||
|
[this]() {
|
||||||
|
if (auto *container = dynamic_cast<SplitContainer *>(this->page))
|
||||||
|
{
|
||||||
|
container->popup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this->menu_.addAction("Duplicate Tab", [this]() {
|
||||||
|
this->notebook_->duplicatePage(this->page);
|
||||||
|
});
|
||||||
|
|
||||||
|
highlightNewMessagesAction_ =
|
||||||
|
new QAction("Mark Tab as Unread on New Messages", &this->menu_);
|
||||||
|
highlightNewMessagesAction_->setCheckable(true);
|
||||||
|
highlightNewMessagesAction_->setChecked(highlightEnabled_);
|
||||||
|
QObject::connect(highlightNewMessagesAction_, &QAction::triggered,
|
||||||
|
[this](bool checked) {
|
||||||
|
this->highlightEnabled_ = checked;
|
||||||
|
});
|
||||||
|
this->menu_.addAction(highlightNewMessagesAction_);
|
||||||
|
|
||||||
|
this->menu_.addSeparator();
|
||||||
|
|
||||||
|
this->notebook_->addNotebookActionsToMenu(&this->menu_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotebookTab::recreateCloseMultipleTabsMenu(
|
||||||
|
const NotebookTabLocation tabLocation)
|
||||||
|
{
|
||||||
|
this->closeMultipleTabsMenu_->clear();
|
||||||
|
|
||||||
|
this->closeMultipleTabsMenu_->addAction("Close All Visible Tabs", [this]() {
|
||||||
auto reply = QMessageBox::question(
|
auto reply = QMessageBox::question(
|
||||||
this, "Close All Visible Tabs",
|
this, "Close All Visible Tabs",
|
||||||
"Are you sure you want to close all visible tabs?",
|
"Are you sure you want to close all visible tabs?",
|
||||||
@@ -158,83 +201,105 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->closeTabsToLeftAction_ = this->closeMultipleTabsMenu_->addAction(
|
QString beforeSelectedName;
|
||||||
"Close Visible Tabs to Left", [this]() {
|
QString afterSelectedName;
|
||||||
auto reply = QMessageBox::question(
|
switch (tabLocation)
|
||||||
this, "Close Visible Tabs to Left",
|
{
|
||||||
"Are you sure you want to close all visible tabs to the left?",
|
case Top:
|
||||||
QMessageBox::Yes | QMessageBox::Cancel);
|
case Bottom:
|
||||||
|
beforeSelectedName = "Left";
|
||||||
|
afterSelectedName = "Right";
|
||||||
|
break;
|
||||||
|
case Left:
|
||||||
|
case Right:
|
||||||
|
beforeSelectedName = "Top";
|
||||||
|
afterSelectedName = "Bottom";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reply != QMessageBox::Yes)
|
this->closeTabsBeforeSelectedAction_ =
|
||||||
{
|
this->closeMultipleTabsMenu_->addAction(
|
||||||
return;
|
"Close Visible Tabs to " + beforeSelectedName,
|
||||||
}
|
[this, beforeSelectedName]() {
|
||||||
|
auto reply = QMessageBox::question(
|
||||||
|
this, "Close Visible Tabs to " + beforeSelectedName,
|
||||||
|
"Are you sure you want to close all visible tabs to the " +
|
||||||
|
beforeSelectedName.toLower() + "?",
|
||||||
|
QMessageBox::Yes | QMessageBox::Cancel);
|
||||||
|
|
||||||
std::vector<QWidget *> pagesToRemove;
|
if (reply != QMessageBox::Yes)
|
||||||
for (int i = 0; i < this->notebook_->getPageCount(); ++i)
|
|
||||||
{
|
|
||||||
auto *page = this->notebook_->getPageAt(i);
|
|
||||||
if (page == this->page)
|
|
||||||
{
|
{
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *container = dynamic_cast<SplitContainer *>(page);
|
std::vector<QWidget *> pagesToRemove;
|
||||||
if (!container)
|
for (int i = 0; i < this->notebook_->getPageCount(); ++i)
|
||||||
{
|
{
|
||||||
continue;
|
auto *page = this->notebook_->getPageAt(i);
|
||||||
|
if (page == this->page)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto *container = dynamic_cast<SplitContainer *>(page);
|
||||||
|
if (!container)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto *tab = container->getTab();
|
||||||
|
if (!tab || !tab->isVisible())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pagesToRemove.push_back(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *tab = container->getTab();
|
for (auto *page : pagesToRemove)
|
||||||
if (!tab || !tab->isVisible())
|
|
||||||
{
|
{
|
||||||
continue;
|
this->notebook_->removePage(page);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this->closeTabsAfterSelectedAction_ =
|
||||||
|
this->closeMultipleTabsMenu_->addAction(
|
||||||
|
"Close Visible Tabs to " + afterSelectedName,
|
||||||
|
[this, afterSelectedName]() {
|
||||||
|
auto reply = QMessageBox::question(
|
||||||
|
this, "Close Visible Tabs to " + afterSelectedName,
|
||||||
|
"Are you sure you want to close all visible tabs to the " +
|
||||||
|
afterSelectedName + "?",
|
||||||
|
QMessageBox::Yes | QMessageBox::Cancel);
|
||||||
|
|
||||||
|
if (reply != QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pagesToRemove.push_back(page);
|
for (int i = this->notebook_->getPageCount() - 1; i >= 0; --i)
|
||||||
}
|
|
||||||
|
|
||||||
for (auto *page : pagesToRemove)
|
|
||||||
{
|
|
||||||
this->notebook_->removePage(page);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this->closeTabsToRightAction_ = this->closeMultipleTabsMenu_->addAction(
|
|
||||||
"Close Visible Tabs to Right", [this]() {
|
|
||||||
auto reply = QMessageBox::question(
|
|
||||||
this, "Close Visible Tabs to Right",
|
|
||||||
"Are you sure you want to close all visible tabs to the right?",
|
|
||||||
QMessageBox::Yes | QMessageBox::Cancel);
|
|
||||||
|
|
||||||
if (reply != QMessageBox::Yes)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = this->notebook_->getPageCount() - 1; i >= 0; --i)
|
|
||||||
{
|
|
||||||
auto *p = this->notebook_->getPageAt(i);
|
|
||||||
if (p == this->page)
|
|
||||||
{
|
{
|
||||||
break;
|
auto *p = this->notebook_->getPageAt(i);
|
||||||
}
|
if (p == this->page)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
auto *container = dynamic_cast<SplitContainer *>(p);
|
auto *container = dynamic_cast<SplitContainer *>(p);
|
||||||
if (!container)
|
if (!container)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *tab = container->getTab();
|
auto *tab = container->getTab();
|
||||||
if (!tab || !tab->isVisible())
|
if (!tab || !tab->isVisible())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->notebook_->removePage(p);
|
this->notebook_->removePage(p);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->closeMultipleTabsMenu_->addAction(
|
this->closeMultipleTabsMenu_->addAction(
|
||||||
"Close Other Visible Tabs", [this]() {
|
"Close Other Visible Tabs", [this]() {
|
||||||
@@ -271,35 +336,6 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
|||||||
this->notebook_->removePage(p);
|
this->notebook_->removePage(p);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->menu_.addAction(
|
|
||||||
"Popup Tab",
|
|
||||||
getApp()->getHotkeys()->getDisplaySequence(HotkeyCategory::Window,
|
|
||||||
"popup", {{"window"}}),
|
|
||||||
[this]() {
|
|
||||||
if (auto *container = dynamic_cast<SplitContainer *>(this->page))
|
|
||||||
{
|
|
||||||
container->popup();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this->menu_.addAction("Duplicate Tab", [this]() {
|
|
||||||
this->notebook_->duplicatePage(this->page);
|
|
||||||
});
|
|
||||||
|
|
||||||
highlightNewMessagesAction_ =
|
|
||||||
new QAction("Mark Tab as Unread on New Messages", &this->menu_);
|
|
||||||
highlightNewMessagesAction_->setCheckable(true);
|
|
||||||
highlightNewMessagesAction_->setChecked(highlightEnabled_);
|
|
||||||
QObject::connect(highlightNewMessagesAction_, &QAction::triggered,
|
|
||||||
[this](bool checked) {
|
|
||||||
this->highlightEnabled_ = checked;
|
|
||||||
});
|
|
||||||
this->menu_.addAction(highlightNewMessagesAction_);
|
|
||||||
|
|
||||||
this->menu_.addSeparator();
|
|
||||||
|
|
||||||
this->notebook_->addNotebookActionsToMenu(&this->menu_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookTab::showRenameDialog()
|
void NotebookTab::showRenameDialog()
|
||||||
@@ -1065,8 +1101,9 @@ void NotebookTab::mousePressEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
this->closeMultipleTabsMenu_->setEnabled(visibleTabCount > 1);
|
this->closeMultipleTabsMenu_->setEnabled(visibleTabCount > 1);
|
||||||
|
|
||||||
this->closeTabsToLeftAction_->setEnabled(selectedTabIndex > 0);
|
this->closeTabsBeforeSelectedAction_->setEnabled(
|
||||||
this->closeTabsToRightAction_->setEnabled(
|
selectedTabIndex > 0);
|
||||||
|
this->closeTabsAfterSelectedAction_->setEnabled(
|
||||||
selectedTabIndex != -1 &&
|
selectedTabIndex != -1 &&
|
||||||
selectedTabIndex < (visibleTabCount - 1));
|
selectedTabIndex < (visibleTabCount - 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ private:
|
|||||||
void removeHighlightSource(const ChannelView::ChannelViewID &source);
|
void removeHighlightSource(const ChannelView::ChannelViewID &source);
|
||||||
void updateHighlightStateDueSourcesChange();
|
void updateHighlightStateDueSourcesChange();
|
||||||
|
|
||||||
|
void recreateCloseMultipleTabsMenu(NotebookTabLocation tabLocation);
|
||||||
|
|
||||||
QPropertyAnimation positionChangedAnimation_;
|
QPropertyAnimation positionChangedAnimation_;
|
||||||
QPoint positionAnimationDesiredPoint_;
|
QPoint positionAnimationDesiredPoint_;
|
||||||
|
|
||||||
@@ -163,8 +165,8 @@ private:
|
|||||||
|
|
||||||
QMenu menu_;
|
QMenu menu_;
|
||||||
QMenu *closeMultipleTabsMenu_{};
|
QMenu *closeMultipleTabsMenu_{};
|
||||||
QAction *closeTabsToLeftAction_{};
|
QAction *closeTabsBeforeSelectedAction_{};
|
||||||
QAction *closeTabsToRightAction_{};
|
QAction *closeTabsAfterSelectedAction_{};
|
||||||
|
|
||||||
pajlada::Signals::SignalHolder managedConnections_;
|
pajlada::Signals::SignalHolder managedConnections_;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user