mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Further UI fixups
More work to unify the tab view with the overall UI look-and-feel, allowing you to remove and add tabs via mouse over rather than the close tab icon. Also added a number of cosmetic adjustments. Fixed up PerformanceManager and ScatterPlot to pick up on the chart fonts and tick size etc. Removed some erroneous static members in the ScatterPlot that caused a SEGV when adding multiple charts (or cancelling an add then adding again).
This commit is contained in:
@@ -147,17 +147,16 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcWindow(mw), main(mw), ran
|
||||
setInstanceName("Google Map");
|
||||
setControls(NULL);
|
||||
setContentsMargins(0,0,0,0);
|
||||
layout = new QVBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
setLayout(layout);
|
||||
|
||||
parent = mw;
|
||||
view = new QWebView();
|
||||
view->setContentsMargins(0,0,0,0);
|
||||
view->page()->view()->setContentsMargins(0,0,0,0);
|
||||
view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
layout = new QVBoxLayout();
|
||||
layout->addWidget(view);
|
||||
layout->setSpacing(0);
|
||||
setLayout(layout);
|
||||
|
||||
//connect(parent, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
|
||||
connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
|
||||
@@ -587,7 +586,10 @@ string GoogleMapControl::CreateMapToolTipJavaScript()
|
||||
<< "}"<< endl
|
||||
<< "div.style.padding = this.options.padding || '5px';"<< endl
|
||||
<< "div.style.backgroundColor = this.options.backgroundColor || '#ffffff';"<< endl
|
||||
#if 0
|
||||
<< "div.style.border = this.options.border || '1px solid #000000';"<< endl
|
||||
#endif
|
||||
<< "div.style.border = '0px solid #000000';"<< endl
|
||||
<< "div.style.fontSize = this.options.fontSize || '80%';"<< endl
|
||||
<< "div.style.color = this.options.color || '#000';"<< endl
|
||||
<< "div.innerHTML = this.html;"<< endl
|
||||
|
||||
@@ -97,7 +97,17 @@ HomeWindow::HomeWindow(MainWindow *mainWindow, QString name, QString /* windowti
|
||||
tabbed->setTabsClosable(false);
|
||||
tabbed->setPalette(palette);
|
||||
tabbed->setDocumentMode(true);
|
||||
tabbed->setStyleSheet("QTabBar { alignment: center; }");
|
||||
|
||||
QTabBar *tb = tabbed->findChild<QTabBar*>(QLatin1String("qt_tabwidget_tabbar"));
|
||||
tb->setShape(QTabBar::RoundedSouth);
|
||||
tb->setDrawBase(false);
|
||||
tabbed->setStyleSheet("QTabBar { alignment: center; }"
|
||||
"QTabWidget::pane { top: 20px; }"
|
||||
#if 0
|
||||
"QTabBar::tab:selected { background: #A8A8A8; font: bold; border: 1px; border-color: black; }"
|
||||
"QTabBar::tab:!selected { background: #A8A8A8;font: normal; }"
|
||||
#endif
|
||||
);
|
||||
|
||||
// styling commented out whilst work out the differences
|
||||
// between mac and linux and windows
|
||||
@@ -288,7 +298,7 @@ HomeWindow::styleChanged(int id)
|
||||
switch (id) {
|
||||
case 0 : // they are tabs in a TabWidget
|
||||
tabbed->addTab(charts[i], charts[i]->property("title").toString());
|
||||
charts[i]->setContentsMargins(0,0,0,0);
|
||||
charts[i]->setContentsMargins(0,25,0,0);
|
||||
charts[i]->setResizable(false); // we need to show on tab selection!
|
||||
charts[i]->hide(); // we need to show on tab selection!
|
||||
break;
|
||||
@@ -400,7 +410,7 @@ HomeWindow::addChart(GcWindow* newone)
|
||||
switch (currentStyle) {
|
||||
|
||||
case 0 :
|
||||
newone->setContentsMargins(0,0,0,0);
|
||||
newone->setContentsMargins(0,25,0,0);
|
||||
newone->setResizable(false); // we need to show on tab selection!
|
||||
tabbed->addTab(newone, newone->property("title").toString());
|
||||
break;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <qwt_data.h>
|
||||
#include <qwt_legend.h>
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_plot_canvas.h>
|
||||
#include <qwt_plot_grid.h>
|
||||
#include "RideItem.h"
|
||||
#include "RideFile.h"
|
||||
@@ -34,11 +35,27 @@ PerfPlot::PerfPlot() : STScurve(NULL), LTScurve(NULL), SBcurve(NULL), DAYcurve(N
|
||||
setInstanceName("PM Plot");
|
||||
|
||||
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
|
||||
setTitle(tr("Performance Manager"));
|
||||
setAxisTitle(yLeft, "Exponentially Weighted Average Stress");
|
||||
setAxisTitle(xBottom, "Time (days)");
|
||||
setAxisTitle(yRight, "Daily Stress");
|
||||
enableAxis(yRight, true);
|
||||
canvas()->setFrameStyle(QFrame::NoFrame);
|
||||
|
||||
setAxisMaxMinor(xBottom, 0);
|
||||
setAxisMaxMinor(yLeft, 0);
|
||||
setAxisMaxMinor(yRight, 0);
|
||||
|
||||
QwtScaleDraw *sd = new QwtScaleDraw;
|
||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||
setAxisScaleDraw(QwtPlot::xBottom, sd);
|
||||
|
||||
sd = new QwtScaleDraw;
|
||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||
setAxisScaleDraw(QwtPlot::yLeft, sd);
|
||||
|
||||
sd = new QwtScaleDraw;
|
||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||
setAxisScaleDraw(QwtPlot::yRight, sd);
|
||||
|
||||
grid = new QwtPlotGrid();
|
||||
grid->attach(this);
|
||||
@@ -176,5 +193,16 @@ void PerfPlot::resize(int newmin, int newmax)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
PerfPlot::setAxisTitle(int axis, QString label)
|
||||
{
|
||||
// setup the default fonts
|
||||
QFont stGiles; // hoho - Chart Font St. Giles ... ok you have to be British to get this joke
|
||||
stGiles.fromString(appsettings->value(this, GC_FONT_CHARTLABELS, QFont().toString()).toString());
|
||||
stGiles.setPointSize(appsettings->value(NULL, GC_FONT_CHARTLABELS_SIZE, 8).toInt());
|
||||
|
||||
|
||||
QwtText title(label);
|
||||
title.setFont(stGiles);
|
||||
QwtPlot::setAxisFont(axis, stGiles);
|
||||
QwtPlot::setAxisTitle(axis, title);
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ class PerfPlot : public QwtPlot
|
||||
void setStressCalculator(StressCalculator *sc);
|
||||
|
||||
void plot();
|
||||
void setAxisTitle(int axis, QString label);
|
||||
void resize(int newmin, int newmax);
|
||||
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ RideEditor::RideEditor(MainWindow *main) : GcWindow(main), data(NULL), ride(NULL
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setSpacing(0);
|
||||
mainLayout->setContentsMargins(2,2,2,2);
|
||||
mainLayout->setContentsMargins(2,0,2,2);
|
||||
|
||||
//Left in the code to display a title, but
|
||||
//its a waste of screen estate, maybe uncomment
|
||||
@@ -72,6 +72,8 @@ RideEditor::RideEditor(MainWindow *main) : GcWindow(main), data(NULL), ride(NULL
|
||||
toolbar = new QToolBar(this);
|
||||
toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
toolbar->setFloatable(true);
|
||||
toolbar->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CFCFCF, stop: 1.0 #A8A8A8);"
|
||||
"border: 0px;");
|
||||
|
||||
QIcon saveIcon(":images/toolbar/save.png");
|
||||
saveAct = new QAction(saveIcon, tr("Save"), this);
|
||||
|
||||
@@ -52,6 +52,10 @@ RideMetadata::RideMetadata(MainWindow *parent) : QWidget(parent), main(parent)
|
||||
tabs->setPalette(palette);
|
||||
tabs->setAutoFillBackground(false);
|
||||
|
||||
tabs->setStyleSheet("QTabBar { alignment: center; }"
|
||||
"QTabWidget::pane { top: 0px; }"
|
||||
);
|
||||
|
||||
mainLayout->addWidget(tabs);
|
||||
|
||||
// read in metadata.xml and setup the tabs etc
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_plot_grid.h>
|
||||
#include <qwt_plot_marker.h>
|
||||
#include <qwt_plot_canvas.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
#include <qwt_symbol.h>
|
||||
|
||||
#define PI M_PI
|
||||
@@ -147,6 +149,21 @@ static QString describeType(int type, bool longer, bool useMetricUnits)
|
||||
ScatterPlot::ScatterPlot(MainWindow *parent) : main(parent)
|
||||
{
|
||||
setInstanceName("2D Plot");
|
||||
all = NULL;
|
||||
grid = NULL;
|
||||
canvas()->setFrameStyle(QFrame::NoFrame);
|
||||
|
||||
setAxisMaxMinor(xBottom, 0);
|
||||
setAxisMaxMinor(yLeft, 0);
|
||||
|
||||
QwtScaleDraw *sd = new QwtScaleDraw;
|
||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||
setAxisScaleDraw(QwtPlot::xBottom, sd);
|
||||
|
||||
sd = new QwtScaleDraw;
|
||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||
setAxisScaleDraw(QwtPlot::yLeft, sd);
|
||||
|
||||
connect(main, SIGNAL(configChanged()), this, SLOT(configChanged()));
|
||||
configChanged(); // use latest colors etc
|
||||
}
|
||||
@@ -196,14 +213,13 @@ void ScatterPlot::setData (ScatterSettings *settings)
|
||||
}
|
||||
}
|
||||
|
||||
static QwtSymbol sym;
|
||||
QwtSymbol sym;
|
||||
sym.setStyle(QwtSymbol::Ellipse);
|
||||
sym.setSize(6);
|
||||
sym.setPen(GCColor::invert(GColor(CPLOTBACKGROUND)));
|
||||
sym.setBrush(QBrush(Qt::NoBrush));
|
||||
|
||||
// wipe away existing
|
||||
static QwtPlotCurve *all = NULL;
|
||||
if (all) {
|
||||
all->detach();
|
||||
delete all;
|
||||
@@ -221,10 +237,9 @@ void ScatterPlot::setData (ScatterSettings *settings)
|
||||
all = NULL;
|
||||
}
|
||||
|
||||
static QPen gridPen(GColor(CPLOTGRID));
|
||||
QPen gridPen(GColor(CPLOTGRID));
|
||||
gridPen.setStyle(Qt::DotLine);
|
||||
|
||||
static QwtPlotGrid *grid = NULL;
|
||||
if (grid) {
|
||||
grid->detach();
|
||||
delete grid;
|
||||
@@ -240,7 +255,6 @@ void ScatterPlot::setData (ScatterSettings *settings)
|
||||
grid = NULL;
|
||||
}
|
||||
|
||||
setTitle(settings->ride->ride()->startTime().toString(GC_DATETIME_FORMAT));
|
||||
setAxisTitle(yLeft, describeType(settings->y, true, useMetricUnits));
|
||||
setAxisTitle(xBottom, describeType(settings->x, true, useMetricUnits));
|
||||
|
||||
@@ -382,3 +396,16 @@ ScatterPlot::showTime(ScatterSettings *settings, int offset, int secs)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ScatterPlot::setAxisTitle(int axis, QString label)
|
||||
{
|
||||
// setup the default fonts
|
||||
QFont stGiles; // hoho - Chart Font St. Giles ... ok you have to be British to get this joke
|
||||
stGiles.fromString(appsettings->value(this, GC_FONT_CHARTLABELS, QFont().toString()).toString());
|
||||
stGiles.setPointSize(appsettings->value(NULL, GC_FONT_CHARTLABELS_SIZE, 8).toInt());
|
||||
|
||||
QwtText title(label);
|
||||
title.setFont(stGiles);
|
||||
QwtPlot::setAxisFont(axis, stGiles);
|
||||
QwtPlot::setAxisTitle(axis, title);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "Units.h"
|
||||
#include "math.h"
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_plot_grid.h>
|
||||
#include <qwt_symbol.h>
|
||||
|
||||
#define MODEL_NONE 0
|
||||
#define MODEL_POWER 1
|
||||
@@ -58,6 +60,7 @@ class ScatterPlot : public QwtPlot
|
||||
ScatterPlot(MainWindow *);
|
||||
void setData(ScatterSettings *);
|
||||
void showTime(ScatterSettings *, int offset, int secs);
|
||||
void setAxisTitle(int axis, QString label);
|
||||
|
||||
public slots:
|
||||
void configChanged();
|
||||
@@ -76,5 +79,8 @@ class ScatterPlot : public QwtPlot
|
||||
QVector<double> y;
|
||||
|
||||
QList <QwtPlotCurve *> intervalCurves; // each curve on plot
|
||||
|
||||
QwtPlotCurve *all;
|
||||
QwtPlotGrid *grid;
|
||||
};
|
||||
#endif // _GC_ScatterPlot_h
|
||||
|
||||
Reference in New Issue
Block a user