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),
loaded(false)
{
viewCfgPath = context->athlete->home->config().canonicalPath();
defaultAppearance= GSettings::defaultAppearanceSettings();
// setup the basic widget
@@ -253,12 +253,6 @@ AbstractView::configChanged(qint32)
if (sidebar_) sidebar_->setStyleSheet(ourStyleSheet());
}
QString
AbstractView::getPathToPerspectiveFile()
{
return context->athlete->home->config().canonicalPath();
}
void
AbstractView::saveState()
{
@@ -270,7 +264,7 @@ AbstractView::saveState()
// we do not save all the other Qt properties since
// we're not interested in them
// 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);
if (!file.open(QFile::WriteOnly)) {
@@ -304,7 +298,7 @@ void
AbstractView::restoreState(bool useDefault)
{
// restore window state
QString filename = getPathToPerspectiveFile() + "/" + view + "-perspectives.xml";
QString filename = viewCfgPath + "/" + view + "-perspectives.xml";
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
// what charts are relevant for this view.
const QString view; // type of view: "train", "analysis", "diary", "home"
QString viewCfgPath; // directory path to the view's configuration
// properties
bool _filtered;
@@ -189,7 +190,6 @@ class AbstractView : public QWidget
virtual void notifyViewSidebarChanged() {}
virtual void setViewSpecificPerspective() {};
virtual void notifyViewSplitterMoved() {};
virtual QString getPathToPerspectiveFile();
private slots:
void onIdle();