mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Train View Perspective Switch on Workout selection
To enable workout preview in the more specific layout, provided the current perspective allows switching, to avoid unwanted swithing when using the Workout Editor. Reorder perspectives in default layout.
This commit is contained in:
@@ -253,27 +253,6 @@
|
||||
<property name="style" type="int" value="2" />
|
||||
</chart>
|
||||
</layout>
|
||||
<layout name="Video Workout" style="0" type="1" expression="" trainswitch="3">
|
||||
<chart id="21" name="" title="Video" >
|
||||
<property name="title" type="QString" value="Video" />
|
||||
<property name="subtitle" type="QString" value="" />
|
||||
<property name="widthFactor" type="double" value="1" />
|
||||
<property name="heightFactor" type="double" value="1" />
|
||||
<property name="style" type="int" value="0" />
|
||||
<property name="resizable" type="bool" value="0" />
|
||||
<property name="videoLayout" type="int" value="0" />
|
||||
</chart>
|
||||
</layout>
|
||||
<layout name="Workout Editor" style="0" type="1" expression="" trainswitch="0">
|
||||
<chart id="36" name="" title="Workout Editor" >
|
||||
<property name="title" type="QString" value="Workout Editor" />
|
||||
<property name="subtitle" type="QString" value="" />
|
||||
<property name="widthFactor" type="double" value="1" />
|
||||
<property name="heightFactor" type="double" value="1" />
|
||||
<property name="style" type="int" value="0" />
|
||||
<property name="resizable" type="bool" value="0" />
|
||||
</chart>
|
||||
</layout>
|
||||
<layout name="Map Workout" style="2" type="1" expression="" trainswitch="4">
|
||||
<chart id="22" name="" title="Power" >
|
||||
<property name="title" type="QString" value="Power" />
|
||||
@@ -410,4 +389,25 @@
|
||||
<property name="style" type="int" value="2" />
|
||||
</chart>
|
||||
</layout>
|
||||
<layout name="Video Workout" style="0" type="1" expression="" trainswitch="3">
|
||||
<chart id="21" name="" title="Video" >
|
||||
<property name="title" type="QString" value="Video" />
|
||||
<property name="subtitle" type="QString" value="" />
|
||||
<property name="widthFactor" type="double" value="1" />
|
||||
<property name="heightFactor" type="double" value="1" />
|
||||
<property name="style" type="int" value="0" />
|
||||
<property name="resizable" type="bool" value="0" />
|
||||
<property name="videoLayout" type="int" value="0" />
|
||||
</chart>
|
||||
</layout>
|
||||
<layout name="Workout Editor" style="0" type="1" expression="" trainswitch="0">
|
||||
<chart id="36" name="" title="Workout Editor" >
|
||||
<property name="title" type="QString" value="Workout Editor" />
|
||||
<property name="subtitle" type="QString" value="" />
|
||||
<property name="widthFactor" type="double" value="1" />
|
||||
<property name="heightFactor" type="double" value="1" />
|
||||
<property name="style" type="int" value="0" />
|
||||
<property name="resizable" type="bool" value="0" />
|
||||
</chart>
|
||||
</layout>
|
||||
</layouts>
|
||||
|
||||
@@ -865,6 +865,30 @@ TrainSidebar::workoutTreeWidgetSelectionChanged()
|
||||
|
||||
// clean last
|
||||
if (prior) delete prior;
|
||||
|
||||
// lets SWITCH PERSPECTIVE for the selected file, but only
|
||||
// if everything has been initialised properly (aka lazy load)
|
||||
if (trainView && trainView->page()) {
|
||||
|
||||
Perspective::switchenum want=Perspective::None;
|
||||
if (mediafile != "") want=Perspective::Video; // if media file selected
|
||||
else want = (mode == ERG || mode == MRC) ? Perspective::Erg : Perspective::Slope; // mode always known
|
||||
if (want == Perspective::Slope && ergFileQueryAdapter.hasGPS()) want=Perspective::Map; // Map without Video
|
||||
|
||||
// if the current perspective allows automatic switching,
|
||||
// we want a view type and the current page isn't what
|
||||
// we want then lets go find one to switch to and switch
|
||||
// to the first one that matches
|
||||
if (trainView->page()->trainSwitch() != Perspective::None && want != Perspective::None && trainView->page()->trainSwitch() != want) {
|
||||
|
||||
for(int i=0; i<trainView->perspectives_.count(); i++) {
|
||||
if (trainView->perspectives_[i]->trainSwitch() == want) {
|
||||
context->mainWindow->switchPerspective(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1595,31 +1619,6 @@ void TrainSidebar::Connect()
|
||||
gui_timer->start(REFRESHRATE);
|
||||
|
||||
emit setNotification(tr("Connected.."), 2);
|
||||
|
||||
// lets SWITCH PERSPECTIVE as we are connected, but only
|
||||
// if everything has been initialised properly (aka lazy load)
|
||||
// given the connect widget is on the train view it is unlikely
|
||||
// below will ever be false, but no harm in checking
|
||||
if (trainView && trainView->page()) {
|
||||
|
||||
Perspective::switchenum want=Perspective::None;
|
||||
if (mediafile != "") want=Perspective::Video; // if media file selected
|
||||
else want = (mode == ERG || mode == MRC) ? Perspective::Erg : Perspective::Slope; // mode always known
|
||||
if (want == Perspective::Slope && ergFileQueryAdapter.hasGPS()) want=Perspective::Map; // Map without Video
|
||||
|
||||
// so we want a view type and the current page isn't what
|
||||
// we want then lets go find one to switch to and switch
|
||||
// to the first one that matches
|
||||
if (want != Perspective::None && trainView->page()->trainSwitch() != want) {
|
||||
|
||||
for(int i=0; i<trainView->perspectives_.count(); i++) {
|
||||
if (trainView->perspectives_[i]->trainSwitch() == want) {
|
||||
context->mainWindow->switchPerspective(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TrainSidebar::Disconnect()
|
||||
|
||||
Reference in New Issue
Block a user