mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Overview Minimum Columns Settings
.. most users likely won't use this, but the minimum number of columns to scale the scene is now configurable in the settings dialog for the overview.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
|
||||
static QIcon grayConfig, whiteConfig, accentConfig;
|
||||
|
||||
OverviewWindow::OverviewWindow(Context *context, int scope, bool blank) : GcChartWindow(context), context(context), configured(false), scope(scope), blank(blank), mincols(5)
|
||||
OverviewWindow::OverviewWindow(Context *context, int scope, bool blank) : GcChartWindow(context), context(context), configured(false), scope(scope), blank(blank)
|
||||
{
|
||||
setContentsMargins(0,0,0,0);
|
||||
setProperty("color", GColor(COVERVIEWBACKGROUND));
|
||||
@@ -39,17 +39,27 @@ OverviewWindow::OverviewWindow(Context *context, int scope, bool blank) : GcChar
|
||||
QAction *importChart= new QAction(tr("Import Chart..."));
|
||||
addAction(importChart);
|
||||
|
||||
QAction *renameChart= new QAction(tr("Rename..."));
|
||||
addAction(renameChart);
|
||||
QAction *settings= new QAction(tr("Settings..."));
|
||||
addAction(settings);
|
||||
|
||||
setControls(NULL);
|
||||
// settings
|
||||
QWidget *controls=new QWidget(this);
|
||||
QFormLayout *formlayout = new QFormLayout(controls);
|
||||
mincolsEdit= new QSpinBox(this);
|
||||
mincolsEdit->setMinimum(1);
|
||||
mincolsEdit->setMaximum(10);
|
||||
mincolsEdit->setValue(5);
|
||||
mincolsEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
formlayout->addRow(new QLabel(tr("Minimum Columns")), mincolsEdit);
|
||||
|
||||
setControls(controls);
|
||||
|
||||
QHBoxLayout *main = new QHBoxLayout;
|
||||
main->setSpacing(0);
|
||||
main->setContentsMargins(0,0,0,0);
|
||||
|
||||
space = new ChartSpace(context, scope, this);
|
||||
space->setMinimumColumns(mincols);
|
||||
space->setMinimumColumns(minimumColumns());
|
||||
main->addWidget(space);
|
||||
|
||||
HelpWhatsThis *help = new HelpWhatsThis(space);
|
||||
@@ -77,7 +87,8 @@ OverviewWindow::OverviewWindow(Context *context, int scope, bool blank) : GcChar
|
||||
// menu items
|
||||
connect(addTile, SIGNAL(triggered(bool)), this, SLOT(addTile()));
|
||||
connect(importChart, SIGNAL(triggered(bool)), this, SLOT(importChart()));
|
||||
connect(renameChart, SIGNAL(triggered(bool)), this, SLOT(renameChart()));
|
||||
connect(settings, SIGNAL(triggered(bool)), this, SLOT(settings()));
|
||||
connect(mincolsEdit, SIGNAL(valueChanged(int)), this, SLOT(setMinimumColumns(int)));
|
||||
connect(space, SIGNAL(itemConfigRequested(ChartSpaceItem*)), this, SLOT(configItem(ChartSpaceItem*)));
|
||||
}
|
||||
|
||||
@@ -104,7 +115,7 @@ OverviewWindow::addTile()
|
||||
}
|
||||
|
||||
void
|
||||
OverviewWindow::renameChart()
|
||||
OverviewWindow::settings()
|
||||
{
|
||||
emit showControls();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "RideItem.h"
|
||||
#include "RideMetric.h"
|
||||
#include "HrZones.h"
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "ChartSpace.h"
|
||||
#include "OverviewItems.h"
|
||||
@@ -53,13 +54,13 @@ class OverviewWindow : public GcChartWindow
|
||||
QString getConfiguration() const;
|
||||
void setConfiguration(QString x);
|
||||
|
||||
int minimumColumns() const { return mincols; }
|
||||
void setMinimumColumns(int x) { mincols=x; space->setMinimumColumns(mincols); }
|
||||
int minimumColumns() const { return mincolsEdit->value(); }
|
||||
void setMinimumColumns(int x) { if (x>0 && x< 11) {mincolsEdit->setValue(x); space->setMinimumColumns(x); }}
|
||||
|
||||
// add a tile to the window
|
||||
void addTile();
|
||||
void importChart();
|
||||
void renameChart();
|
||||
void settings();
|
||||
|
||||
// config item requested
|
||||
void configItem(ChartSpaceItem *);
|
||||
@@ -71,7 +72,8 @@ class OverviewWindow : public GcChartWindow
|
||||
bool configured;
|
||||
int scope;
|
||||
bool blank;
|
||||
int mincols;
|
||||
|
||||
QSpinBox *mincolsEdit;
|
||||
};
|
||||
|
||||
class OverviewConfigDialog : public QDialog
|
||||
|
||||
@@ -194,7 +194,7 @@ class ChartSpace : public QWidget
|
||||
// current state for event processing
|
||||
enum { NONE, DRAG, SPAN, XRESIZE, YRESIZE } state;
|
||||
|
||||
void setMinimumColumns(int x) { mincols=x; updateGeometry(); }
|
||||
void setMinimumColumns(int x) { mincols=x; updateGeometry(); updateView(); }
|
||||
int minimumColumns() const { return mincols; }
|
||||
|
||||
// used by children
|
||||
|
||||
Reference in New Issue
Block a user