Show the device id in hex

This is consistent with what we used to do

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-06-17 12:46:35 -07:00
parent 9d611ba279
commit 1ee894dced

View file

@ -1155,9 +1155,9 @@ void DiveTripModel::setLayout(DiveTripModel::Layout layout)
setupModelData(); setupModelData();
} }
/*#################################################################### /*####################################################################
* *
* Dive Computer Model * Dive Computer Model
* *
*#################################################################### *####################################################################
*/ */
@ -1179,9 +1179,9 @@ QVariant DiveComputerModel::headerData(int section, Qt::Orientation orientation,
return ret; return ret;
} }
switch(section){ switch(section){
case ID : ret = tr("Device ID"); break; case ID: ret = tr("Device ID"); break;
case MODEL : ret = tr("Model"); break; case MODEL: ret = tr("Model"); break;
case NICKNAME : ret = tr("Nickname"); break; case NICKNAME: ret = tr("Nickname"); break;
} }
return ret; return ret;
} }
@ -1196,12 +1196,12 @@ QVariant DiveComputerModel::data(const QModelIndex& index, int role) const
QVariant ret; QVariant ret;
if (role == Qt::DisplayRole || role == Qt::EditRole){ if (role == Qt::DisplayRole || role == Qt::EditRole){
switch(index.column()){ switch(index.column()){
case ID : ret = device->deviceid; break; case ID: ret = QString("0x").append(QString::number(device->deviceid, 16)); break;
case MODEL : ret = device->model; break; case MODEL: ret = device->model; break;
case NICKNAME : ret = device->nickname; break; case NICKNAME: ret = device->nickname; break;
} }
} }
if (role == Qt::DecorationRole && index.column() == REMOVE){ if (role == Qt::DecorationRole && index.column() == REMOVE){
ret = QIcon(":trash"); ret = QIcon(":trash");
} }
@ -1246,16 +1246,16 @@ Qt::ItemFlags DiveComputerModel::flags(const QModelIndex& index) const
bool DiveComputerModel::setData(const QModelIndex& index, const QVariant& value, int role) bool DiveComputerModel::setData(const QModelIndex& index, const QVariant& value, int role)
{ {
struct device_info *nnl = head_of_device_info_list(); struct device_info *nnl = head_of_device_info_list();
for(int i = 0; i < index.row(); i++){ for(int i = 0; i < index.row(); i++){
nnl = nnl->next; nnl = nnl->next;
} }
QByteArray v = value.toByteArray(); QByteArray v = value.toByteArray();
nnl->nickname = strdup(v.data()); // how should I free this before setting a new one? nnl->nickname = strdup(v.data()); // how should I free this before setting a new one?
// set_dc_nickname(dive); -> should this be used instead? // set_dc_nickname(dive); -> should this be used instead?
return true; return true;
} }