1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2016-03-05 22:42:22 +01:00
parent a736e3204f
commit 04f2a08b78
2 changed files with 21 additions and 20 deletions

View File

@ -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)));
}
}
}

View File

@ -59,8 +59,9 @@ private slots:
private:
void loadFiles();
void createMapActions();
QAction *createPOIFileAction(int index);
void createPOIFilesActions();
void createMapActions();
void createActions();
void createMenus();
void createToolBars();