mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Fixed compile issue on Windows.
Some more refactoring.
This commit is contained in:
parent
70f4010f55
commit
b95fb80210
46
src/gui.cpp
46
src/gui.cpp
@ -45,8 +45,8 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
loadMaps();
|
loadMaps();
|
||||||
loadPOIs();
|
loadPOIs();
|
||||||
|
|
||||||
createTrackView();
|
createPathView();
|
||||||
createTrackGraphs();
|
createGraphTabs();
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
createActions();
|
createActions();
|
||||||
createMenus();
|
createMenus();
|
||||||
@ -57,7 +57,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
layout->addWidget(_pathView);
|
layout->addWidget(_pathView);
|
||||||
layout->addWidget(_trackGraphs);
|
layout->addWidget(_graphTabWidget);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
@ -98,7 +98,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
GUI::~GUI()
|
GUI::~GUI()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _tabs.size(); i++) {
|
for (int i = 0; i < _tabs.size(); i++) {
|
||||||
if (_trackGraphs->indexOf(_tabs.at(i)) < 0)
|
if (_graphTabWidget->indexOf(_tabs.at(i)) < 0)
|
||||||
delete _tabs.at(i);
|
delete _tabs.at(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,25 +455,25 @@ void GUI::createToolBars()
|
|||||||
_navigationToolBar->addAction(_lastAction);
|
_navigationToolBar->addAction(_lastAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createTrackView()
|
void GUI::createPathView()
|
||||||
{
|
{
|
||||||
_pathView = new PathView(this);
|
_pathView = new PathView(this);
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
_track->setFrameShape(QFrame::NoFrame);
|
_pathView->setFrameShape(QFrame::NoFrame);
|
||||||
#endif // Q_OS_WIN32
|
#endif // Q_OS_WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createTrackGraphs()
|
void GUI::createGraphTabs()
|
||||||
{
|
{
|
||||||
_trackGraphs = new QTabWidget;
|
_graphTabWidget = new QTabWidget;
|
||||||
connect(_trackGraphs, SIGNAL(currentChanged(int)), this,
|
connect(_graphTabWidget, SIGNAL(currentChanged(int)), this,
|
||||||
SLOT(graphChanged(int)));
|
SLOT(graphChanged(int)));
|
||||||
|
|
||||||
_trackGraphs->setFixedHeight(200);
|
_graphTabWidget->setFixedHeight(200);
|
||||||
_trackGraphs->setSizePolicy(
|
_graphTabWidget->setSizePolicy(
|
||||||
QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
|
QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
_trackGraphs->setDocumentMode(true);
|
_graphTabWidget->setDocumentMode(true);
|
||||||
#endif // Q_OS_WIN32
|
#endif // Q_OS_WIN32
|
||||||
|
|
||||||
_tabs.append(new ElevationGraph);
|
_tabs.append(new ElevationGraph);
|
||||||
@ -774,13 +774,13 @@ void GUI::plot(QPrinter *printer)
|
|||||||
mh = ih / 2;
|
mh = ih / 2;
|
||||||
info.plot(&p, QRectF(0, 0, printer->width(), ih));
|
info.plot(&p, QRectF(0, 0, printer->width(), ih));
|
||||||
}
|
}
|
||||||
if (_trackGraphs->isVisible()) {
|
if (_graphTabWidget->isVisible()) {
|
||||||
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
|
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
|
||||||
gh = (printer->width() > printer->height())
|
gh = (printer->width() > printer->height())
|
||||||
? 0.15 * r * (printer->height() - ih - 2*mh)
|
? 0.15 * r * (printer->height() - ih - 2*mh)
|
||||||
: 0.15 * (printer->height() - ih - 2*mh);
|
: 0.15 * (printer->height() - ih - 2*mh);
|
||||||
gh = qMax(gh, ratio * 150);
|
gh = qMax(gh, ratio * 150);
|
||||||
GraphTab *gt = static_cast<GraphTab*>(_trackGraphs->currentWidget());
|
GraphTab *gt = static_cast<GraphTab*>(_graphTabWidget->currentWidget());
|
||||||
gt->plot(&p, QRectF(0, printer->height() - gh, printer->width(), gh));
|
gt->plot(&p, QRectF(0, printer->height() - gh, printer->width(), gh));
|
||||||
} else
|
} else
|
||||||
gh = 0;
|
gh = 0;
|
||||||
@ -869,7 +869,7 @@ void GUI::showMap(bool checked)
|
|||||||
|
|
||||||
void GUI::showGraphs(bool checked)
|
void GUI::showGraphs(bool checked)
|
||||||
{
|
{
|
||||||
_trackGraphs->setHidden(!checked);
|
_graphTabWidget->setHidden(!checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::showToolbars(bool checked)
|
void GUI::showToolbars(bool checked)
|
||||||
@ -1020,7 +1020,7 @@ void GUI::graphChanged(int index)
|
|||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GraphTab *gt = static_cast<GraphTab*>(_trackGraphs->widget(index));
|
GraphTab *gt = static_cast<GraphTab*>(_graphTabWidget->widget(index));
|
||||||
gt->setSliderPosition(_sliderPos);
|
gt->setSliderPosition(_sliderPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1050,22 +1050,22 @@ void GUI::updateGraphTabs()
|
|||||||
|
|
||||||
for (int i = 0; i < _tabs.size(); i++) {
|
for (int i = 0; i < _tabs.size(); i++) {
|
||||||
tab = _tabs.at(i);
|
tab = _tabs.at(i);
|
||||||
if (!tab->count() && (index = _trackGraphs->indexOf(tab)) >= 0)
|
if (!tab->count() && (index = _graphTabWidget->indexOf(tab)) >= 0)
|
||||||
_trackGraphs->removeTab(index);
|
_graphTabWidget->removeTab(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < _tabs.size(); i++) {
|
for (int i = 0; i < _tabs.size(); i++) {
|
||||||
tab = _tabs.at(i);
|
tab = _tabs.at(i);
|
||||||
if (tab->count() && _trackGraphs->indexOf(tab) < 0)
|
if (tab->count() && _graphTabWidget->indexOf(tab) < 0)
|
||||||
_trackGraphs->insertTab(i, tab, _tabs.at(i)->label());
|
_graphTabWidget->insertTab(i, tab, _tabs.at(i)->label());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_trackGraphs->count()) {
|
if (_graphTabWidget->count()) {
|
||||||
if (_showGraphsAction->isChecked())
|
if (_showGraphsAction->isChecked())
|
||||||
_trackGraphs->setHidden(false);
|
_graphTabWidget->setHidden(false);
|
||||||
_showGraphsAction->setEnabled(true);
|
_showGraphsAction->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
_trackGraphs->setHidden(true);
|
_graphTabWidget->setHidden(true);
|
||||||
_showGraphsAction->setEnabled(false);
|
_showGraphsAction->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ private:
|
|||||||
void createMenus();
|
void createMenus();
|
||||||
void createToolBars();
|
void createToolBars();
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
void createTrackView();
|
void createPathView();
|
||||||
void createTrackGraphs();
|
void createGraphTabs();
|
||||||
|
|
||||||
bool openPOIFile(const QString &fileName);
|
bool openPOIFile(const QString &fileName);
|
||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
@ -163,7 +163,7 @@ private:
|
|||||||
QLabel *_timeLabel;
|
QLabel *_timeLabel;
|
||||||
|
|
||||||
PathView *_pathView;
|
PathView *_pathView;
|
||||||
QTabWidget *_trackGraphs;
|
QTabWidget *_graphTabWidget;
|
||||||
QList<GraphTab*> _tabs;
|
QList<GraphTab*> _tabs;
|
||||||
|
|
||||||
POI _poi;
|
POI _poi;
|
||||||
|
Loading…
Reference in New Issue
Block a user