mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Blank state : no GPS image for Google Map
Add an image when no GPS data present
This commit is contained in:
@@ -730,19 +730,34 @@ GcChartWindow::GcChartWindow(QWidget *parent) : GcWindow(parent) {
|
||||
_mainWidget->setLayout(_mainLayout);
|
||||
}
|
||||
|
||||
void GcChartWindow:: setChartLayout(QLayout *layout)
|
||||
void
|
||||
GcChartWindow:: setChartLayout(QLayout *layout)
|
||||
{
|
||||
_chartLayout = layout;
|
||||
_mainLayout->addLayout(_chartLayout,0,0, Qt::AlignTop);
|
||||
}
|
||||
|
||||
void GcChartWindow:: setRevealLayout(QLayout *layout)
|
||||
void
|
||||
GcChartWindow:: setRevealLayout(QLayout *layout)
|
||||
{
|
||||
_revealLayout = layout;
|
||||
_revealControls->setLayout(_revealLayout);
|
||||
}
|
||||
|
||||
void GcChartWindow:: reveal()
|
||||
void
|
||||
GcChartWindow:: setBlankLayout(QLayout *layout)
|
||||
{
|
||||
_blank->setLayout(layout);
|
||||
}
|
||||
|
||||
void
|
||||
GcChartWindow:: setIsBlank(bool value)
|
||||
{
|
||||
_layout->setCurrentWidget(value?_blank:_mainWidget);
|
||||
}
|
||||
|
||||
void
|
||||
GcChartWindow:: reveal()
|
||||
{
|
||||
_unrevealTimer->stop();
|
||||
_revealControls->raise();
|
||||
|
||||
@@ -225,6 +225,9 @@ public:
|
||||
|
||||
void setChartLayout(QLayout *layout);
|
||||
void setRevealLayout(QLayout *layout);
|
||||
void setBlankLayout(QLayout *layout);
|
||||
|
||||
void setIsBlank(bool value);
|
||||
|
||||
public slots:
|
||||
void hideRevealControls();
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcWindow(mw), main(mw), range(-1), current(NULL)
|
||||
GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcChartWindow(mw), main(mw), range(-1), current(NULL)
|
||||
{
|
||||
setInstanceName("Google Map");
|
||||
setControls(NULL);
|
||||
@@ -38,7 +38,7 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcWindow(mw), main(mw), ran
|
||||
layout = new QVBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(2,0,2,2);
|
||||
setLayout(layout);
|
||||
setChartLayout(layout);
|
||||
|
||||
parent = mw;
|
||||
view = new QWebView();
|
||||
@@ -51,6 +51,29 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcWindow(mw), main(mw), ran
|
||||
|
||||
webBridge = new WebBridge(mw, this);
|
||||
|
||||
//
|
||||
// Blank layout (no GPS data)
|
||||
//
|
||||
QVBoxLayout *blanklayout = new QVBoxLayout();
|
||||
blanklayout->setAlignment(Qt::AlignCenter);
|
||||
blanklayout->setContentsMargins(70,70,70,70);
|
||||
|
||||
QToolButton *blankImg = new QToolButton(this);
|
||||
blankImg->setFocusPolicy(Qt::NoFocus);
|
||||
blankImg->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
blankImg->setStyleSheet("QToolButton {text-align: left;color : blue;background: transparent}");
|
||||
|
||||
blankImg->setIcon(QPixmap(":/images/nogps.png"));
|
||||
blankImg->setIconSize(QSize(475,610));
|
||||
|
||||
blanklayout->addStretch();
|
||||
blanklayout->addWidget(blankImg);
|
||||
blanklayout->addStretch();
|
||||
setBlankLayout(blanklayout);
|
||||
|
||||
//
|
||||
// connects
|
||||
//
|
||||
connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
|
||||
connect(view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(updateFrame()));
|
||||
connect(mw, SIGNAL(intervalsChanged()), webBridge, SLOT(intervalsChanged()));
|
||||
@@ -111,8 +134,10 @@ void GoogleMapControl::createHtml()
|
||||
// No GPS data, so sorry no map
|
||||
if(!ride || !ride->ride() || ride->ride()->areDataPresent()->lat == false || ride->ride()->areDataPresent()->lon == false) {
|
||||
currentPage = tr("No GPS Data Present");
|
||||
setIsBlank(true);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
setIsBlank(false);
|
||||
|
||||
// load the Google Map v3 API
|
||||
currentPage = QString("<!DOCTYPE html> \n"
|
||||
|
||||
@@ -79,7 +79,7 @@ class WebBridge : public QObject
|
||||
void drawIntervals();
|
||||
};
|
||||
|
||||
class GoogleMapControl : public GcWindow
|
||||
class GoogleMapControl : public GcChartWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
G_OBJECT
|
||||
|
||||
Reference in New Issue
Block a user