Context Menu for Devices in Train View

Right click to add/delete a new device on the device list
in the train view sidebar.

It is temporary to bring the train view in line with the rest
of GC, but will then be updated as we remove functionality that
is hidden behind a right click.
This commit is contained in:
Mark Liversedge
2012-12-15 14:07:45 +00:00
parent e6e84dfd2f
commit 14859d8a51
4 changed files with 85 additions and 1 deletions

View File

@@ -68,6 +68,8 @@
#include "WorkoutWizard.h"
#include "ErgDB.h"
#include "ErgDBDownloadDialog.h"
#include "DeviceConfiguration.h"
#include "AddDeviceWizard.h"
#include "TrainTool.h"
#include "GcWindowTool.h"
@@ -1809,6 +1811,30 @@ MainWindow::deleteRide()
removeCurrentRide();
}
/*----------------------------------------------------------------------
* Realtime Devices and Workouts
*--------------------------------------------------------------------*/
void
MainWindow::addDevice()
{
// get device config
DeviceConfigurations all;
DeviceConfiguration add;
// lets get a new one
AddDeviceWizard *p = new AddDeviceWizard(this, add);
if (p->exec() == QDialog::Accepted) {
QList<DeviceConfiguration> list = all.getList();
list.insert(0, add);
// call device add wizard.
all.writeConfig(list);
// tell everyone
emit configChanged();
}
}
/*----------------------------------------------------------------------
* Cyclists
*--------------------------------------------------------------------*/
@@ -2346,5 +2372,4 @@ MainWindow::actionClicked(int index)
}
}
#endif