mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Open the last selected tab on restart
This commit is contained in:
parent
d0f1ea8502
commit
c744659ce0
3 changed files with 26 additions and 8 deletions
|
@ -186,6 +186,11 @@ void WindowManager::initialize()
|
|||
tab->getTab()->useDefaultTitle = false;
|
||||
}
|
||||
|
||||
// selected
|
||||
if (tab_obj.value("selected").toBool(false)) {
|
||||
window.getNotebook().select(tab);
|
||||
}
|
||||
|
||||
// load splits
|
||||
int colNr = 0;
|
||||
for (QJsonValue column_val : tab_obj.value("splits").toArray()) {
|
||||
|
@ -251,6 +256,11 @@ void WindowManager::save()
|
|||
tab_obj.insert("title", tab->getTab()->getTitle());
|
||||
}
|
||||
|
||||
// selected
|
||||
if (window->getNotebook().getSelectedPage() == tab) {
|
||||
tab_obj.insert("selected", true);
|
||||
}
|
||||
|
||||
// splits
|
||||
QJsonArray columns_arr;
|
||||
std::vector<std::vector<widgets::Split *>> columns = tab->getColumns();
|
||||
|
|
|
@ -119,6 +119,20 @@ void Notebook::removeCurrentPage()
|
|||
this->removePage(this->selectedPage);
|
||||
}
|
||||
|
||||
SplitContainer *Notebook::getOrAddSelectedPage()
|
||||
{
|
||||
if (selectedPage == nullptr) {
|
||||
this->addNewPage(true);
|
||||
}
|
||||
|
||||
return selectedPage;
|
||||
}
|
||||
|
||||
SplitContainer *Notebook::getSelectedPage()
|
||||
{
|
||||
return selectedPage;
|
||||
}
|
||||
|
||||
void Notebook::select(SplitContainer *page)
|
||||
{
|
||||
if (page == this->selectedPage) {
|
||||
|
|
|
@ -30,14 +30,8 @@ public:
|
|||
void select(SplitContainer *page);
|
||||
void selectIndex(int index);
|
||||
|
||||
SplitContainer *getOrAddSelectedPage()
|
||||
{
|
||||
if (selectedPage == nullptr) {
|
||||
this->addNewPage(true);
|
||||
}
|
||||
|
||||
return selectedPage;
|
||||
}
|
||||
SplitContainer *getOrAddSelectedPage();
|
||||
SplitContainer *getSelectedPage();
|
||||
|
||||
void performLayout(bool animate = true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue