mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 08:08:42 +00:00
Remove view specifics from Abstract View (#4637)
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
#include "GcUpgrade.h"
|
||||
#include "LTMWindow.h"
|
||||
|
||||
AbstractView::AbstractView(Context *context, int type) :
|
||||
QWidget(context->tab), context(context), type(type),
|
||||
AbstractView::AbstractView(Context *context, int type, const QString& view, const QString& heading) :
|
||||
QWidget(context->tab), context(context), type(type), view(view),
|
||||
_sidebar(true), _tiled(false), _selected(false), lastHeight(130*dpiYFactor), sidewidth(0),
|
||||
active(false), bottomRequested(false), bottomHideOnIdle(false), perspectiveactive(false),
|
||||
stack(NULL), splitter(NULL), mainSplitter(NULL),
|
||||
@@ -67,10 +67,6 @@ AbstractView::AbstractView(Context *context, int type) :
|
||||
splitter->setOpaqueResize(true); // redraw when released, snappier UI
|
||||
stack->insertWidget(0, splitter); // splitter always at index 0
|
||||
|
||||
QString heading = tr("Compare Activities and Intervals");
|
||||
if (type == VIEW_TRENDS) heading = tr("Compare Date Ranges");
|
||||
else if (type == VIEW_TRAIN) heading = tr("Intensity Adjustments and Workout Control");
|
||||
|
||||
mainSplitter = new ViewSplitter(Qt::Vertical, heading, this);
|
||||
mainSplitter->setHandleWidth(23 *dpiXFactor);
|
||||
mainSplitter->setFrameStyle(QFrame::NoFrame);
|
||||
@@ -269,16 +265,8 @@ 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 view = "none";
|
||||
switch(type) {
|
||||
case VIEW_ANALYSIS: view = "analysis"; break;
|
||||
case VIEW_TRAIN: view = "train"; break;
|
||||
case VIEW_DIARY: view = "diary"; break;
|
||||
case VIEW_TRENDS: view = "home"; break;
|
||||
}
|
||||
|
||||
QString filename = context->athlete->home->config().canonicalPath() + "/" + view + "-perspectives.xml";
|
||||
|
||||
QFile file(filename);
|
||||
if (!file.open(QFile::WriteOnly)) {
|
||||
QMessageBox msgBox;
|
||||
@@ -310,16 +298,9 @@ AbstractView::saveState()
|
||||
void
|
||||
AbstractView::restoreState(bool useDefault)
|
||||
{
|
||||
QString view = "none";
|
||||
switch(type) {
|
||||
case VIEW_ANALYSIS: view = "analysis"; break;
|
||||
case VIEW_TRAIN: view = "train"; break;
|
||||
case VIEW_DIARY: view = "diary"; break;
|
||||
case VIEW_TRENDS: view = "home"; break;
|
||||
}
|
||||
|
||||
// restore window state
|
||||
QString filename = context->athlete->home->config().canonicalPath() + "/" + view + "-perspectives.xml";
|
||||
|
||||
QFileInfo finfo(filename);
|
||||
|
||||
QString content = "";
|
||||
|
||||
@@ -54,7 +54,7 @@ class AbstractView : public QWidget
|
||||
|
||||
public:
|
||||
|
||||
AbstractView(Context *context, int type);
|
||||
AbstractView(Context *context, int type, const QString& view, const QString& heading);
|
||||
virtual ~AbstractView();
|
||||
virtual void close() {};
|
||||
|
||||
@@ -149,9 +149,10 @@ class AbstractView : public QWidget
|
||||
protected:
|
||||
|
||||
Context *context;
|
||||
int type; // used by windowregistry; e.g VIEW_TRAIN VIEW_ANALYSIS VIEW_DIARY VIEW_TRENDS
|
||||
// we don't care what values are pass through to the GcWindowRegistry to decide
|
||||
// what charts are relevant for this view.
|
||||
const int type; // used by windowregistry; e.g VIEW_TRAIN VIEW_ANALYSIS VIEW_DIARY VIEW_TRENDS
|
||||
// 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"
|
||||
|
||||
// properties
|
||||
bool _filtered;
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
#include "TrainBottom.h"
|
||||
#include "Specification.h"
|
||||
|
||||
AnalysisView::AnalysisView(Context *context, QStackedWidget *controls) : AbstractView(context, VIEW_ANALYSIS)
|
||||
AnalysisView::AnalysisView(Context *context, QStackedWidget *controls) :
|
||||
AbstractView(context, VIEW_ANALYSIS, "analysis", "Compare Activities and Intervals")
|
||||
{
|
||||
analSidebar = new AnalysisSidebar(context);
|
||||
BlankStateAnalysisPage *b = new BlankStateAnalysisPage(context);
|
||||
@@ -125,7 +126,8 @@ AnalysisView::isBlank()
|
||||
else return true;
|
||||
}
|
||||
|
||||
DiaryView::DiaryView(Context *context, QStackedWidget *controls) : AbstractView(context, VIEW_DIARY)
|
||||
DiaryView::DiaryView(Context *context, QStackedWidget *controls) :
|
||||
AbstractView(context, VIEW_DIARY, "diary", "Compare Activities and Intervals")
|
||||
{
|
||||
diarySidebar = new DiarySidebar(context);
|
||||
BlankStateDiaryPage *b = new BlankStateDiaryPage(context);
|
||||
@@ -174,7 +176,8 @@ DiaryView::isBlank()
|
||||
else return true;
|
||||
}
|
||||
|
||||
TrendsView::TrendsView(Context *context, QStackedWidget *controls) : AbstractView(context, VIEW_TRENDS)
|
||||
TrendsView::TrendsView(Context *context, QStackedWidget *controls) :
|
||||
AbstractView(context, VIEW_TRENDS, "home", "Compare Date Ranges")
|
||||
{
|
||||
sidebar = new LTMSidebar(context);
|
||||
BlankStateHomePage *b = new BlankStateHomePage(context);
|
||||
@@ -279,7 +282,8 @@ TrendsView::justSelected()
|
||||
}
|
||||
}
|
||||
|
||||
TrainView::TrainView(Context *context, QStackedWidget *controls) : AbstractView(context, VIEW_TRAIN)
|
||||
TrainView::TrainView(Context *context, QStackedWidget *controls) :
|
||||
AbstractView(context, VIEW_TRAIN, "train", "Intensity Adjustments and Workout Control")
|
||||
{
|
||||
trainTool = new TrainSidebar(context);
|
||||
trainTool->setTrainView(this);
|
||||
|
||||
Reference in New Issue
Block a user