mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Remember sidebar setting
.. show/hide sidebar setting is reinstated on restart, is specific to each view and now the menu check stays in sync with user selection. .. another old glitch thats taken a while to get resolved !
This commit is contained in:
@@ -110,6 +110,7 @@
|
||||
#define GC_SETTINGS_LAST "<system>mainwindow/lastOpened"
|
||||
#define GC_SETTINGS_MAIN_GEOM "<system>mainwindow/geometry"
|
||||
#define GC_SETTINGS_MAIN_STATE "<system>mainwindow/state"
|
||||
#define GC_SETTINGS_MAIN_SIDEBAR "<system>mainwindow/sidebar/"
|
||||
#define GC_SETTINGS_LAST_IMPORT_PATH "<system>mainwindow/lastImportPath"
|
||||
#define GC_SETTINGS_LAST_WORKOUT_PATH "<system>mainwindow/lastWorkoutPath"
|
||||
#define GC_LAST_DOWNLOAD_DEVICE "<system>mainwindow/lastDownloadDevice"
|
||||
|
||||
@@ -95,6 +95,9 @@ class MainWindow : public QMainWindow
|
||||
Tab *athleteTab() { return currentTab; }
|
||||
NewSideBar *newSidebar() { return sidebar; }
|
||||
|
||||
// tab view keeps this up to date
|
||||
QAction *showhideSidebar;
|
||||
|
||||
protected:
|
||||
|
||||
// used by ChooseCyclistDialog to see which athletes
|
||||
@@ -306,7 +309,6 @@ class MainWindow : public QMainWindow
|
||||
|
||||
// Toolbar state checkables in View menu / context
|
||||
QAction *styleAction;
|
||||
QAction *showhideSidebar;
|
||||
QAction *showhideLowbar;
|
||||
QAction *showhideToolbar;
|
||||
QAction *showhideTabbar;
|
||||
|
||||
@@ -367,8 +367,12 @@ TabView::setBlank(BlankStatePage *blank)
|
||||
void
|
||||
TabView::sidebarChanged()
|
||||
{
|
||||
// wait for main window to catch up
|
||||
if (sidebar_ == NULL) return;
|
||||
|
||||
// tell main window qmenu we changed
|
||||
if (context->mainWindow->init) context->mainWindow->showhideSidebar->setChecked(_sidebar);
|
||||
|
||||
if (sidebarEnabled()) {
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
@@ -386,8 +390,8 @@ TabView::sidebarChanged()
|
||||
// if it was collapsed we need set to at least 200
|
||||
// unless the mainwindow isn't big enough
|
||||
if (sidebar_->width()<10) {
|
||||
int size = width() - 200;
|
||||
if (size>200) size = 200;
|
||||
int size = width() - 200 * dpiXFactor;
|
||||
if (size>(200* dpiXFactor)) size = 200* dpiXFactor;
|
||||
|
||||
QList<int> sizes;
|
||||
sizes.append(size);
|
||||
@@ -399,7 +403,7 @@ TabView::sidebarChanged()
|
||||
// we are the analysis view
|
||||
// all a bit of a hack to stop the column widths from
|
||||
// being adjusted as the splitter gets resized and reset
|
||||
if (type == VIEW_ANALYSIS && active == false && context->tab->rideNavigator()->geometry().width() != 100)
|
||||
if (context->mainWindow->init && type == VIEW_ANALYSIS && active == false && context->tab->rideNavigator()->geometry().width() != 100)
|
||||
context->tab->rideNavigator()->setWidth(context->tab->rideNavigator()->geometry().width());
|
||||
setUpdatesEnabled(true);
|
||||
|
||||
@@ -418,6 +422,9 @@ TabView::selectionChanged()
|
||||
// we got selected..
|
||||
if (isSelected()) {
|
||||
|
||||
// makes sure menu now reflects our setting
|
||||
context->mainWindow->showhideSidebar->setChecked(_sidebar);
|
||||
|
||||
// or do we need to show blankness?
|
||||
if (isBlank() && blank_ && page_ && blank_->canShow()) {
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ AnalysisView::AnalysisView(Context *context, QStackedWidget *controls) : TabView
|
||||
setBlank(b);
|
||||
setBottom(new ComparePane(context, this, ComparePane::interval));
|
||||
|
||||
setSidebarEnabled(appsettings->value(this, GC_SETTINGS_MAIN_SIDEBAR "analysis", true).toBool());
|
||||
|
||||
connect(bottomSplitter(), SIGNAL(compareChanged(bool)), this, SLOT(compareChanged(bool)));
|
||||
connect(bottomSplitter(), SIGNAL(compareClear()), bottom(), SLOT(clear()));
|
||||
}
|
||||
@@ -54,6 +56,7 @@ RideNavigator *AnalysisView::rideNavigator()
|
||||
|
||||
AnalysisView::~AnalysisView()
|
||||
{
|
||||
appsettings->setValue(GC_SETTINGS_MAIN_SIDEBAR "analysis", _sidebar);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -100,11 +103,13 @@ DiaryView::DiaryView(Context *context, QStackedWidget *controls) : TabView(conte
|
||||
setPage(d);
|
||||
setBlank(b);
|
||||
|
||||
setSidebarEnabled(appsettings->value(this, GC_SETTINGS_MAIN_SIDEBAR "diary", true).toBool());
|
||||
connect(s, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange)));
|
||||
}
|
||||
|
||||
DiaryView::~DiaryView()
|
||||
{
|
||||
appsettings->setValue(GC_SETTINGS_MAIN_SIDEBAR "diary", _sidebar);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -141,6 +146,7 @@ HomeView::HomeView(Context *context, QStackedWidget *controls) : TabView(context
|
||||
setBlank(b);
|
||||
setBottom(new ComparePane(context, this, ComparePane::season));
|
||||
|
||||
setSidebarEnabled(appsettings->value(this, GC_SETTINGS_MAIN_SIDEBAR "trend", true).toBool());
|
||||
connect(sidebar, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange)));
|
||||
connect(this, SIGNAL(onSelectionChanged()), this, SLOT(justSelected()));
|
||||
connect(bottomSplitter(), SIGNAL(compareChanged(bool)), this, SLOT(compareChanged(bool)));
|
||||
@@ -149,6 +155,7 @@ HomeView::HomeView(Context *context, QStackedWidget *controls) : TabView(context
|
||||
|
||||
HomeView::~HomeView()
|
||||
{
|
||||
appsettings->setValue(GC_SETTINGS_MAIN_SIDEBAR "trend", _sidebar);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -199,6 +206,7 @@ TrainView::TrainView(Context *context, QStackedWidget *controls) : TabView(conte
|
||||
setBottom(trainBottom);
|
||||
setHideBottomOnIdle(false);
|
||||
|
||||
setSidebarEnabled(appsettings->value(NULL, GC_SETTINGS_MAIN_SIDEBAR "train").toBool());
|
||||
connect(this, SIGNAL(onSelectionChanged()), this, SLOT(onSelectionChanged()));
|
||||
connect(trainBottom, SIGNAL(autoHideChanged(bool)), this, SLOT(onAutoHideChanged(bool)));
|
||||
}
|
||||
@@ -210,6 +218,7 @@ void TrainView::onAutoHideChanged(bool enabled)
|
||||
|
||||
TrainView::~TrainView()
|
||||
{
|
||||
appsettings->setValue(GC_SETTINGS_MAIN_SIDEBAR "train", _sidebar);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user