mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
WIP profile: add UI to edit dc nickname
This is just a quick first implementation - it will need to use the undo code in the future, but for now this is a reasonable first step. It's also missing the code to redraw the profile with the updated DC name. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d141bbf38f
commit
2c12648156
1 changed files with 12 additions and 4 deletions
|
@ -1447,10 +1447,18 @@ void ProfileWidget2::makeFirstDC()
|
|||
|
||||
void ProfileWidget2::renameCurrentDC()
|
||||
{
|
||||
// Add UI code to give a new name, and do
|
||||
// create_device_node(device_table, dc->model, serial, nickname)
|
||||
// where 'serial' is the dc extradata for "Serial" and
|
||||
// nickname is the new nickname (empty deletes the entry)
|
||||
bool ok;
|
||||
QString newName = QInputDialog::getText(this, tr("Edit nickname"),
|
||||
tr("Set new nickname for %1 (serial %2):").arg(current_dc->model).arg(current_dc->serial),
|
||||
QLineEdit::Normal, get_dc_nickname(current_dc), &ok);
|
||||
if (ok) {
|
||||
// this needs to happen using the Undo code
|
||||
// note that an empty nickname is valid - it simply removes the nickname for this dive computer
|
||||
create_device_node(&device_table, current_dc->model, current_dc->serial, qPrintable(newName));
|
||||
|
||||
// now trigger the redraw of the profile with the updated nickname
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ProfileWidget2::hideEvents(DiveEventItem *item)
|
||||
|
|
Loading…
Add table
Reference in a new issue