mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Code cleanup
This commit is contained in:
parent
a736e3204f
commit
04f2a08b78
38
src/gui.cpp
38
src/gui.cpp
@ -120,21 +120,27 @@ void GUI::createPOIFilesActions()
|
||||
{
|
||||
_poiFilesSM = new QSignalMapper(this);
|
||||
|
||||
for (int i = 0; i < _poi.files().count(); i++) {
|
||||
QAction *a = new QAction(QFileInfo(_poi.files().at(i)).fileName(),
|
||||
this);
|
||||
a->setCheckable(true);
|
||||
a->setChecked(true);
|
||||
|
||||
_poiFilesSM->setMapping(a, i);
|
||||
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
|
||||
|
||||
_poiFilesActions.append(a);
|
||||
}
|
||||
for (int i = 0; i < _poi.files().count(); i++)
|
||||
createPOIFileAction(i);
|
||||
|
||||
connect(_poiFilesSM, SIGNAL(mapped(int)), this, SLOT(poiFileChecked(int)));
|
||||
}
|
||||
|
||||
QAction *GUI::createPOIFileAction(int index)
|
||||
{
|
||||
QAction *a = new QAction(QFileInfo(_poi.files().at(index)).fileName(),
|
||||
this);
|
||||
a->setCheckable(true);
|
||||
a->setChecked(true);
|
||||
|
||||
_poiFilesSM->setMapping(a, index);
|
||||
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
|
||||
|
||||
_poiFilesActions.append(a);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
void GUI::createActions()
|
||||
{
|
||||
// Action Groups
|
||||
@ -511,14 +517,8 @@ void GUI::openPOIFile()
|
||||
} else {
|
||||
_showPOIAction->setChecked(true);
|
||||
_track->loadPOI(_poi);
|
||||
|
||||
QAction *a = new QAction(QFileInfo(fileName).fileName(), this);
|
||||
a->setCheckable(true);
|
||||
a->setChecked(true);
|
||||
_poiFilesSM->setMapping(a, _poi.files().count() - 1);
|
||||
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
|
||||
_poiFilesActions.append(a);
|
||||
_poiFilesMenu->addAction(a);
|
||||
_poiFilesMenu->addAction(createPOIFileAction(
|
||||
_poi.files().indexOf(fileName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user