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: 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 <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: 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: 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: 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)
|
- Dev: Remove unused QTextCodec includes. (#6487)
|
||||||
|
|||||||
@@ -1247,6 +1247,8 @@ bool Notebook::shouldShowTab(const NotebookTab *tab) const
|
|||||||
|
|
||||||
void Notebook::sortTabsAlphabetically()
|
void Notebook::sortTabsAlphabetically()
|
||||||
{
|
{
|
||||||
|
assert(!this->isNotebookLayoutLocked() &&
|
||||||
|
"sortTabsAlphabetically called while notebook layout is locked");
|
||||||
std::ranges::sort(this->items_, [](const Item &a, const Item &b) {
|
std::ranges::sort(this->items_, [](const Item &a, const Item &b) {
|
||||||
const QString &lhs = a.tab->getTitle();
|
const QString &lhs = a.tab->getTitle();
|
||||||
const QString &rhs = b.tab->getTitle();
|
const QString &rhs = b.tab->getTitle();
|
||||||
@@ -1320,6 +1322,10 @@ SplitNotebook::SplitNotebook(Window *parent)
|
|||||||
|
|
||||||
this->sortTabsAlphabeticallyAction_ =
|
this->sortTabsAlphabeticallyAction_ =
|
||||||
new QAction("Sort Tabs Alphabetically", this);
|
new QAction("Sort Tabs Alphabetically", this);
|
||||||
|
if (this->isNotebookLayoutLocked())
|
||||||
|
{
|
||||||
|
this->sortTabsAlphabeticallyAction_->setEnabled(false);
|
||||||
|
}
|
||||||
QObject::connect(this->sortTabsAlphabeticallyAction_, &QAction::triggered,
|
QObject::connect(this->sortTabsAlphabeticallyAction_, &QAction::triggered,
|
||||||
[this] {
|
[this] {
|
||||||
this->sortTabsAlphabetically();
|
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
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -115,15 +115,13 @@ public:
|
|||||||
void setTabLocation(NotebookTabLocation location);
|
void setTabLocation(NotebookTabLocation location);
|
||||||
|
|
||||||
bool isNotebookLayoutLocked() const;
|
bool isNotebookLayoutLocked() const;
|
||||||
void setLockNotebookLayout(bool value);
|
virtual void setLockNotebookLayout(bool value);
|
||||||
|
|
||||||
virtual void addNotebookActionsToMenu(QMenu *menu);
|
virtual void addNotebookActionsToMenu(QMenu *menu);
|
||||||
|
|
||||||
// Update layout and tab visibility
|
// Update layout and tab visibility
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
void sortTabsAlphabetically();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool getShowTabs() const;
|
bool getShowTabs() const;
|
||||||
void setShowTabs(bool value);
|
void setShowTabs(bool value);
|
||||||
@@ -171,6 +169,8 @@ protected:
|
|||||||
|
|
||||||
void performLayout(bool animate = false);
|
void performLayout(bool animate = false);
|
||||||
|
|
||||||
|
void sortTabsAlphabetically();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct LayoutContext {
|
struct LayoutContext {
|
||||||
int left = 0;
|
int left = 0;
|
||||||
@@ -275,6 +275,8 @@ private:
|
|||||||
// Main window on Windows has basically a duplicate of this in Window
|
// Main window on Windows has basically a duplicate of this in Window
|
||||||
PixmapButton *streamerModeIcon_{};
|
PixmapButton *streamerModeIcon_{};
|
||||||
void updateStreamerModeIcon();
|
void updateStreamerModeIcon();
|
||||||
|
|
||||||
|
void setLockNotebookLayout(bool value) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
Reference in New Issue
Block a user