Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #24678: Remember which tab was last open within a session #24999

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/appshell/iappshellconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class IAppShellConfiguration : MODULE_EXPORT_INTERFACE
virtual bool needShowSplashScreen() const = 0;
virtual void setNeedShowSplashScreen(bool show) = 0;

virtual const QString& preferencesDialogLastOpenedPageId() const = 0;
virtual void setPreferencesDialogLastOpenedPageId(const QString& lastOpenedPageId) = 0;

virtual void startEditSettings() = 0;
virtual void applySettings() = 0;
virtual void rollbackSettings() = 0;
Expand Down
10 changes: 10 additions & 0 deletions src/appshell/internal/appshellconfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ void AppShellConfiguration::setNeedShowSplashScreen(bool show)
settings()->setSharedValue(SPLASH_SCREEN_VISIBLE_KEY, Val(show));
}

const QString& AppShellConfiguration::preferencesDialogLastOpenedPageId() const
{
return m_preferencesDialogCurrentPageId;
}

void AppShellConfiguration::setPreferencesDialogLastOpenedPageId(const QString& lastOpenedPageId)
{
m_preferencesDialogCurrentPageId = lastOpenedPageId;
}

void AppShellConfiguration::startEditSettings()
{
settings()->beginTransaction();
Expand Down
5 changes: 5 additions & 0 deletions src/appshell/internal/appshellconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ class AppShellConfiguration : public IAppShellConfiguration, public muse::Inject
bool needShowSplashScreen() const override;
void setNeedShowSplashScreen(bool show) override;

const QString& preferencesDialogLastOpenedPageId() const override;
void setPreferencesDialogLastOpenedPageId(const QString& lastOpenedPageId) override;

void startEditSettings() override;
void applySettings() override;
void rollbackSettings() override;
Expand All @@ -106,6 +109,8 @@ class AppShellConfiguration : public IAppShellConfiguration, public muse::Inject
muse::Ret writeSessionState(const QByteArray& data);

muse::io::paths_t parseSessionProjectsPaths(const QByteArray& json) const;

QString m_preferencesDialogCurrentPageId;
};
}

Expand Down
8 changes: 7 additions & 1 deletion src/appshell/view/preferences/preferencesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ void PreferencesModel::load(const QString& currentPageId)
if (!currentPageId.isEmpty()) {
setCurrentPageId(currentPageId);
} else {
setCurrentPageId("general");
const QString& lastOpenedPageId = configuration()->preferencesDialogLastOpenedPageId();
if (lastOpenedPageId.isEmpty()) {
setCurrentPageId("general");
} else {
setCurrentPageId(lastOpenedPageId);
}
}

m_rootItem = new PreferencePageItem();
Expand Down Expand Up @@ -275,6 +280,7 @@ void PreferencesModel::setCurrentPageId(QString currentPageId)
}

m_currentPageId = currentPageId;
configuration()->setPreferencesDialogLastOpenedPageId(currentPageId);
emit currentPageIdChanged(m_currentPageId);
}

Expand Down