Printing: print tags instead of max CNS

And re-order / re-size the fields so more useful information is actually
shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-07-11 21:39:44 -07:00
parent 2552b027ae
commit 6699dab952
2 changed files with 16 additions and 13 deletions

View file

@ -1902,9 +1902,9 @@ QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const
if (col == 0)
return tr("Gas used:");
if (col == 2)
return tr("SAC:");
return tr("Tags:");
if (col == 3)
return tr("Max. CNS:");
return tr("SAC:");
if (col == 4)
return tr("Weights:");
}
@ -1932,24 +1932,27 @@ QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const
if (row == 3) {
if (col == 0) {
int added = 0;
const char *desc;
QString gases;
QString gas, gases;
for (int i = 0; i < MAX_CYLINDERS; i++) {
desc = dive->cylinder[i].type.description;
gas = dive->cylinder[i].type.description;
gas += QString(!gas.isEmpty() ? " " : "") + gasname(&dive->cylinder[i].gasmix);
// if has a description and if such gas is not already present
if (desc && gases.indexOf(QString(desc)) == -1) {
if (!gas.isEmpty() && gases.indexOf(gas) == -1) {
if (added > 0)
gases += QString(" / ");
gases += QString(desc);
gases += gas;
added++;
}
}
return gases;
}
if (col == 2)
return di.displaySac();
if (col == 2) {
char buffer[256];
taglist_get_tagstring(dive->tag_list, buffer, 256);
return QString(buffer);
}
if (col == 3)
return QString::number(dive->maxcns);
return di.displaySac();
if (col == 4) {
weight_t tw = { total_weight(dive) };
return get_weight_string(tw, true);

View file

@ -42,9 +42,9 @@ PrintLayout::PrintLayout(PrintDialog *dialogPtr, QPrinter *printerPtr, struct op
const int dw = 20; // base percentage
profilePrintColumnWidths.append(dw);
profilePrintColumnWidths.append(dw);
profilePrintColumnWidths.append(dw - 3);
profilePrintColumnWidths.append(dw - 3);
profilePrintColumnWidths.append(dw + 6); // fit to 100%
profilePrintColumnWidths.append(dw + 8);
profilePrintColumnWidths.append(dw - 4);
profilePrintColumnWidths.append(dw - 4); // fit to 100%
const int sr = 12; // smallest row height in pixels
profilePrintRowHeights.append(sr);
profilePrintRowHeights.append(sr + 4);