mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Code cleanup
This commit is contained in:
parent
a736e3204f
commit
04f2a08b78
26
src/gui.cpp
26
src/gui.cpp
@ -120,19 +120,25 @@ 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(),
|
||||
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, i);
|
||||
_poiFilesSM->setMapping(a, index);
|
||||
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
|
||||
|
||||
_poiFilesActions.append(a);
|
||||
}
|
||||
|
||||
connect(_poiFilesSM, SIGNAL(mapped(int)), this, SLOT(poiFileChecked(int)));
|
||||
return a;
|
||||
}
|
||||
|
||||
void GUI::createActions()
|
||||
@ -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