Correction to configuration path override in AbstractView pt2 (#4681)

Continuation of #4661
This commit is contained in:
Paul Johnson
2025-08-01 13:16:06 +01:00
committed by GitHub
parent 18b83b0fe9
commit 26f84e885c
2 changed files with 4 additions and 10 deletions

View File

@@ -41,7 +41,7 @@ AbstractView::AbstractView(Context *context, int type, const QString& view, cons
sidebar_(NULL), bottom_(NULL), perspective_(NULL), blank_(NULL), sidebar_(NULL), bottom_(NULL), perspective_(NULL), blank_(NULL),
loaded(false) loaded(false)
{ {
viewCfgPath = context->athlete->home->config().canonicalPath();
defaultAppearance= GSettings::defaultAppearanceSettings(); defaultAppearance= GSettings::defaultAppearanceSettings();
// setup the basic widget // setup the basic widget
@@ -253,12 +253,6 @@ AbstractView::configChanged(qint32)
if (sidebar_) sidebar_->setStyleSheet(ourStyleSheet()); if (sidebar_) sidebar_->setStyleSheet(ourStyleSheet());
} }
QString
AbstractView::getPathToPerspectiveFile()
{
return context->athlete->home->config().canonicalPath();
}
void void
AbstractView::saveState() AbstractView::saveState()
{ {
@@ -270,7 +264,7 @@ AbstractView::saveState()
// we do not save all the other Qt properties since // we do not save all the other Qt properties since
// we're not interested in them // we're not interested in them
// NOTE: currently we support QString, int, double and bool types - beware custom types!! // NOTE: currently we support QString, int, double and bool types - beware custom types!!
QString filename = getPathToPerspectiveFile() + "/" + view + "-perspectives.xml"; QString filename = viewCfgPath + "/" + view + "-perspectives.xml";
QFile file(filename); QFile file(filename);
if (!file.open(QFile::WriteOnly)) { if (!file.open(QFile::WriteOnly)) {
@@ -304,7 +298,7 @@ void
AbstractView::restoreState(bool useDefault) AbstractView::restoreState(bool useDefault)
{ {
// restore window state // restore window state
QString filename = getPathToPerspectiveFile() + "/" + view + "-perspectives.xml"; QString filename = viewCfgPath + "/" + view + "-perspectives.xml";
QFileInfo finfo(filename); QFileInfo finfo(filename);

View File

@@ -153,6 +153,7 @@ class AbstractView : public QWidget
// we don't care what values are pass through to the GcWindowRegistry to decide // we don't care what values are pass through to the GcWindowRegistry to decide
// what charts are relevant for this view. // what charts are relevant for this view.
const QString view; // type of view: "train", "analysis", "diary", "home" const QString view; // type of view: "train", "analysis", "diary", "home"
QString viewCfgPath; // directory path to the view's configuration
// properties // properties
bool _filtered; bool _filtered;
@@ -189,7 +190,6 @@ class AbstractView : public QWidget
virtual void notifyViewSidebarChanged() {} virtual void notifyViewSidebarChanged() {}
virtual void setViewSpecificPerspective() {}; virtual void setViewSpecificPerspective() {};
virtual void notifyViewSplitterMoved() {}; virtual void notifyViewSplitterMoved() {};
virtual QString getPathToPerspectiveFile();
private slots: private slots:
void onIdle(); void onIdle();