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:
James Upjohn
2025-12-07 00:22:40 +13:00
committed by GitHub
parent c67953d14f
commit 7dbc73e84d
3 changed files with 137 additions and 98 deletions
+1 -1
View File
@@ -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
+78 -41
View File
@@ -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,11 +201,30 @@ NotebookTab::NotebookTab(Notebook *notebook)
} }
}); });
this->closeTabsToLeftAction_ = this->closeMultipleTabsMenu_->addAction( QString beforeSelectedName;
"Close Visible Tabs to Left", [this]() { QString afterSelectedName;
switch (tabLocation)
{
case Top:
case Bottom:
beforeSelectedName = "Left";
afterSelectedName = "Right";
break;
case Left:
case Right:
beforeSelectedName = "Top";
afterSelectedName = "Bottom";
break;
}
this->closeTabsBeforeSelectedAction_ =
this->closeMultipleTabsMenu_->addAction(
"Close Visible Tabs to " + beforeSelectedName,
[this, beforeSelectedName]() {
auto reply = QMessageBox::question( auto reply = QMessageBox::question(
this, "Close Visible Tabs to Left", this, "Close Visible Tabs to " + beforeSelectedName,
"Are you sure you want to close all visible tabs to the left?", "Are you sure you want to close all visible tabs to the " +
beforeSelectedName.toLower() + "?",
QMessageBox::Yes | QMessageBox::Cancel); QMessageBox::Yes | QMessageBox::Cancel);
if (reply != QMessageBox::Yes) if (reply != QMessageBox::Yes)
@@ -200,11 +262,14 @@ NotebookTab::NotebookTab(Notebook *notebook)
} }
}); });
this->closeTabsToRightAction_ = this->closeMultipleTabsMenu_->addAction( this->closeTabsAfterSelectedAction_ =
"Close Visible Tabs to Right", [this]() { this->closeMultipleTabsMenu_->addAction(
"Close Visible Tabs to " + afterSelectedName,
[this, afterSelectedName]() {
auto reply = QMessageBox::question( auto reply = QMessageBox::question(
this, "Close Visible Tabs to Right", this, "Close Visible Tabs to " + afterSelectedName,
"Are you sure you want to close all visible tabs to the right?", "Are you sure you want to close all visible tabs to the " +
afterSelectedName + "?",
QMessageBox::Yes | QMessageBox::Cancel); QMessageBox::Yes | QMessageBox::Cancel);
if (reply != QMessageBox::Yes) if (reply != QMessageBox::Yes)
@@ -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));
} }
+4 -2
View File
@@ -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_;
}; };