diff --git a/src/GoogleMapControl.cpp b/src/GoogleMapControl.cpp index cdc61c42a..7d4293105 100644 --- a/src/GoogleMapControl.cpp +++ b/src/GoogleMapControl.cpp @@ -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 diff --git a/src/HomeWindow.cpp b/src/HomeWindow.cpp index a2128d8a1..16bb3d99a 100644 --- a/src/HomeWindow.cpp +++ b/src/HomeWindow.cpp @@ -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(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; diff --git a/src/PerfPlot.cpp b/src/PerfPlot.cpp index e296d58cd..fa5caa3cc 100644 --- a/src/PerfPlot.cpp +++ b/src/PerfPlot.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #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); +} diff --git a/src/PerfPlot.h b/src/PerfPlot.h index 88666839b..1ef76f19c 100644 --- a/src/PerfPlot.h +++ b/src/PerfPlot.h @@ -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); }; diff --git a/src/RideEditor.cpp b/src/RideEditor.cpp index 52e7d7433..916b9ebff 100644 --- a/src/RideEditor.cpp +++ b/src/RideEditor.cpp @@ -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); diff --git a/src/RideMetadata.cpp b/src/RideMetadata.cpp index fdd285610..77814280f 100644 --- a/src/RideMetadata.cpp +++ b/src/RideMetadata.cpp @@ -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 diff --git a/src/ScatterPlot.cpp b/src/ScatterPlot.cpp index 2d7b27693..1357a9635 100644 --- a/src/ScatterPlot.cpp +++ b/src/ScatterPlot.cpp @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #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); +} diff --git a/src/ScatterPlot.h b/src/ScatterPlot.h index 9d755f019..f270df520 100644 --- a/src/ScatterPlot.h +++ b/src/ScatterPlot.h @@ -26,6 +26,8 @@ #include "Units.h" #include "math.h" #include +#include +#include #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 y; QList intervalCurves; // each curve on plot + + QwtPlotCurve *all; + QwtPlotGrid *grid; }; #endif // _GC_ScatterPlot_h