fix: disable "Sort Tabs Alphabetically" option when tab layout is locked (#6710)
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
- Bugfix: Added `desktop-entry` hint to Linux notifications. (#6615)
|
||||
- Bugfix: Fixed <kbd>CMD</kbd> + <kbd>DELETE</kbd> behavior in the user notes editing dialog for macOS. (#6676)
|
||||
- Bugfix: Fixed a potential crash when closing Chatterino with a slow network connection. (#6645)
|
||||
- Bugfix: Disable "Sort Tabs Alphabetically" action when notebook layout is locked. (#6710)
|
||||
- Dev: Update release documentation. (#6498)
|
||||
- Dev: Make code sanitizers opt in with the `CHATTERINO_SANITIZER_SUPPORT` CMake option. After that's enabled, use the `SANITIZE_*` flag to enable individual sanitizers. (#6493)
|
||||
- Dev: Remove unused QTextCodec includes. (#6487)
|
||||
|
||||
@@ -1247,6 +1247,8 @@ bool Notebook::shouldShowTab(const NotebookTab *tab) const
|
||||
|
||||
void Notebook::sortTabsAlphabetically()
|
||||
{
|
||||
assert(!this->isNotebookLayoutLocked() &&
|
||||
"sortTabsAlphabetically called while notebook layout is locked");
|
||||
std::ranges::sort(this->items_, [](const Item &a, const Item &b) {
|
||||
const QString &lhs = a.tab->getTitle();
|
||||
const QString &rhs = b.tab->getTitle();
|
||||
@@ -1320,6 +1322,10 @@ SplitNotebook::SplitNotebook(Window *parent)
|
||||
|
||||
this->sortTabsAlphabeticallyAction_ =
|
||||
new QAction("Sort Tabs Alphabetically", this);
|
||||
if (this->isNotebookLayoutLocked())
|
||||
{
|
||||
this->sortTabsAlphabeticallyAction_->setEnabled(false);
|
||||
}
|
||||
QObject::connect(this->sortTabsAlphabeticallyAction_, &QAction::triggered,
|
||||
[this] {
|
||||
this->sortTabsAlphabetically();
|
||||
@@ -1632,4 +1638,10 @@ void SplitNotebook::forEachSplit(const std::function<void(Split *)> &cb)
|
||||
}
|
||||
}
|
||||
|
||||
void SplitNotebook::setLockNotebookLayout(bool value)
|
||||
{
|
||||
Notebook::setLockNotebookLayout(value);
|
||||
this->sortTabsAlphabeticallyAction_->setEnabled(!value);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -115,15 +115,13 @@ public:
|
||||
void setTabLocation(NotebookTabLocation location);
|
||||
|
||||
bool isNotebookLayoutLocked() const;
|
||||
void setLockNotebookLayout(bool value);
|
||||
virtual void setLockNotebookLayout(bool value);
|
||||
|
||||
virtual void addNotebookActionsToMenu(QMenu *menu);
|
||||
|
||||
// Update layout and tab visibility
|
||||
void refresh();
|
||||
|
||||
void sortTabsAlphabetically();
|
||||
|
||||
protected:
|
||||
bool getShowTabs() const;
|
||||
void setShowTabs(bool value);
|
||||
@@ -171,6 +169,8 @@ protected:
|
||||
|
||||
void performLayout(bool animate = false);
|
||||
|
||||
void sortTabsAlphabetically();
|
||||
|
||||
private:
|
||||
struct LayoutContext {
|
||||
int left = 0;
|
||||
@@ -275,6 +275,8 @@ private:
|
||||
// Main window on Windows has basically a duplicate of this in Window
|
||||
PixmapButton *streamerModeIcon_{};
|
||||
void updateStreamerModeIcon();
|
||||
|
||||
void setLockNotebookLayout(bool value) override;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user