Disable the switching depth column for cylinders

Since the planner is disabled this column isn't needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-01-26 07:15:13 -08:00
parent f11001ff4e
commit bf20572630
4 changed files with 15 additions and 10 deletions

View file

@ -961,7 +961,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidge
QTableView *view = ui.cylinderTableWidget->view();
view->setColumnHidden(CylindersModel::START, true);
view->setColumnHidden(CylindersModel::END, true);
view->setColumnHidden(CylindersModel::DEPTH, false);
// disabled as pointless outside of the disabled planner
// view->setColumnHidden(CylindersModel::DEPTH, false);
view->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this));
connect(ui.cylinderTableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addCylinder_clicked()));
connect(ui.tableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addStop()));

View file

@ -84,7 +84,8 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this));
ui.weights->view()->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate(this));
ui.cylinders->view()->setColumnHidden(CylindersModel::DEPTH, true);
// disabled as this column is pointless outside the disabled planner
// ui.cylinders->view()->setColumnHidden(CylindersModel::DEPTH, true);
completers.buddy = new QCompleter(BuddyCompletionModel::instance(), ui.buddy);
completers.divemaster = new QCompleter(DiveMasterCompletionModel::instance(), ui.divemaster);
completers.location = new QCompleter(LocationCompletionModel::instance(), ui.location);

View file

@ -65,7 +65,10 @@ void CleanerTableModel::setHeaderDataStrings(const QStringList& newHeaders)
CylindersModel::CylindersModel(QObject* parent): current(0), rows(0)
{
// enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH};
setHeaderDataStrings( QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << trUtf8("O" UTF8_SUBSCRIPT_2 "%") << tr("He%") << tr("Switch at"));
setHeaderDataStrings( QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") <<
tr("StartPress") << tr("EndPress") << trUtf8("O" UTF8_SUBSCRIPT_2 "%") << tr("He%")
// while the planner is disabled, we don't need this column: << tr("Switch at")
);
}
CylindersModel *CylindersModel::instance()
@ -136,9 +139,9 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
case HE:
ret = percent_string(cyl->gasmix.he);
break;
case DEPTH:
ret = get_depth_string(cyl->depth, true);
break;
// case DEPTH:
// ret = get_depth_string(cyl->depth, true);
// break;
}
break;
case Qt::DecorationRole:
@ -251,9 +254,9 @@ bool CylindersModel::setData(const QModelIndex& index, const QVariant& value, in
changed = true;
}
break;
case DEPTH:
if (CHANGED())
cyl->depth = string_to_depth(vString.toUtf8().data());
// case DEPTH:
// if (CHANGED())
// cyl->depth = string_to_depth(vString.toUtf8().data());
}
dataChanged(index, index);
if (addDiveMode)

View file

@ -81,7 +81,7 @@ private:
class CylindersModel : public CleanerTableModel {
Q_OBJECT
public:
enum Column {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH, COLUMNS};
enum Column {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, /* DEPTH, */ COLUMNS};
explicit CylindersModel(QObject* parent = 0);
static CylindersModel *instance();