diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 18 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/modeldelegates.cpp | 6 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveEquipment.cpp | 12 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveEquipment.h | 4 |
5 files changed, 21 insertions, 21 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 8d3cbcbd4..d6fbbeb88 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -120,8 +120,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::DIVEMODE, new DiveTypesDelegate(this)); ui.cylinderTableWidget->setTitle(tr("Available gases")); ui.cylinderTableWidget->setBtnToolTip(tr("Add cylinder")); - ui.cylinderTableWidget->setModel(CylindersModel::instance()); - connect(ui.cylinderTableWidget, &TableView::itemClicked, CylindersModel::instance(), &CylindersModel::remove); + ui.cylinderTableWidget->setModel(CylindersModelFiltered::instance()); + connect(ui.cylinderTableWidget, &TableView::itemClicked, CylindersModelFiltered::instance(), &CylindersModelFiltered::remove); ui.waterType->setItemData(0, FRESHWATER_SALINITY); ui.waterType->setItemData(1, SEAWATER_SALINITY); ui.waterType->setItemData(2, EN13319_SALINITY); @@ -139,13 +139,13 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg // Continue to use old syntax, to avoid problems. connect(ui.tableWidget, SIGNAL(addButtonClicked()), plannerModel, SLOT(addStop())); - connect(CylindersModel::instance(), &CylindersModel::dataChanged, GasSelectionModel::instance(), &GasSelectionModel::repopulate); - connect(CylindersModel::instance(), &CylindersModel::rowsInserted, GasSelectionModel::instance(), &GasSelectionModel::repopulate); - connect(CylindersModel::instance(), &CylindersModel::rowsRemoved, GasSelectionModel::instance(), &GasSelectionModel::repopulate); - connect(CylindersModel::instance(), &CylindersModel::dataChanged, plannerModel, &DivePlannerPointsModel::emitDataChanged); - connect(CylindersModel::instance(), &CylindersModel::dataChanged, plannerModel, &DivePlannerPointsModel::cylinderModelEdited); - connect(CylindersModel::instance(), &CylindersModel::rowsInserted, plannerModel, &DivePlannerPointsModel::cylinderModelEdited); - connect(CylindersModel::instance(), &CylindersModel::rowsRemoved, plannerModel, &DivePlannerPointsModel::cylinderModelEdited); + connect(CylindersModelFiltered::instance(), &CylindersModelFiltered::dataChanged, GasSelectionModel::instance(), &GasSelectionModel::repopulate); + connect(CylindersModelFiltered::instance(), &CylindersModelFiltered::rowsInserted, GasSelectionModel::instance(), &GasSelectionModel::repopulate); + connect(CylindersModelFiltered::instance(), &CylindersModelFiltered::rowsRemoved, GasSelectionModel::instance(), &GasSelectionModel::repopulate); + connect(CylindersModelFiltered::instance(), &CylindersModelFiltered::dataChanged, plannerModel, &DivePlannerPointsModel::emitDataChanged); + connect(CylindersModelFiltered::instance(), &CylindersModelFiltered::dataChanged, plannerModel, &DivePlannerPointsModel::cylinderModelEdited); + connect(CylindersModelFiltered::instance(), &CylindersModelFiltered::rowsInserted, plannerModel, &DivePlannerPointsModel::cylinderModelEdited); + connect(CylindersModelFiltered::instance(), &CylindersModelFiltered::rowsRemoved, plannerModel, &DivePlannerPointsModel::cylinderModelEdited); connect(plannerModel, &DivePlannerPointsModel::calculatedPlanNotes, MainWindow::instance(), &MainWindow::setPlanNotes); diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index b4db7028c..68c267e0d 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -918,7 +918,7 @@ void MainWindow::on_actionReplanDive_triggered() divePlannerWidget->setSalinity(current_dive->salinity); DivePlannerPointsModel::instance()->loadFromDive(current_dive); reset_cylinders(&displayed_dive, true); - CylindersModel::instance()->updateDive(); + CylindersModelFiltered::instance()->updateDive(); } void MainWindow::on_actionDivePlanner_triggered() diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index ae8755292..ed4833550 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -238,7 +238,7 @@ static struct RevertCylinderData { void TankInfoDelegate::setModelData(QWidget*, QAbstractItemModel*, const QModelIndex&) const { - CylindersModel *mymodel = qobject_cast<CylindersModel *>(currCombo.model); + CylindersModelFiltered *mymodel = qobject_cast<CylindersModelFiltered *>(currCombo.model); TankInfoModel *tanks = TankInfoModel::instance(); QModelIndexList matches = tanks->match(tanks->index(0, 0), Qt::DisplayRole, currCombo.activeText); int row; @@ -277,7 +277,7 @@ void TankInfoDelegate::editorClosed(QWidget*, QAbstractItemDelegate::EndEditHint { if (hint == QAbstractItemDelegate::NoHint || hint == QAbstractItemDelegate::RevertModelCache) { - CylindersModel *mymodel = qobject_cast<CylindersModel *>(currCombo.model); + CylindersModelFiltered *mymodel = qobject_cast<CylindersModelFiltered *>(currCombo.model); mymodel->setData(IDX(CylindersModel::TYPE), currCylinderData.type, Qt::EditRole); mymodel->passInData(IDX(CylindersModel::WORKINGPRESS), currCylinderData.pressure); mymodel->passInData(IDX(CylindersModel::SIZE), currCylinderData.size); @@ -289,7 +289,7 @@ QWidget *TankInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewI // ncreate editor needs to be called before because it will populate a few // things in the currCombo global var. QWidget *delegate = ComboBoxDelegate::createEditor(parent, option, index); - CylindersModel *mymodel = qobject_cast<CylindersModel *>(currCombo.model); + CylindersModelFiltered *mymodel = qobject_cast<CylindersModelFiltered *>(currCombo.model); cylinder_t *cyl = mymodel->cylinderAt(index); currCylinderData.type = cyl->type.description; currCylinderData.pressure = cyl->type.workingpressure.mbar; diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp index f731631eb..0a5786e50 100644 --- a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp +++ b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp @@ -17,7 +17,7 @@ #include <QCompleter> TabDiveEquipment::TabDiveEquipment(QWidget *parent) : TabBase(parent), - cylindersModel(new CylindersModel(this)), + cylindersModel(new CylindersModelFiltered(this)), weightModel(new WeightModel(this)) { QCompleter *suitCompleter; @@ -33,7 +33,7 @@ TabDiveEquipment::TabDiveEquipment(QWidget *parent) : TabBase(parent), ui.weights->setModel(weightModel); connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &TabDiveEquipment::divesChanged); - connect(ui.cylinders, &TableView::itemClicked, cylindersModel, &CylindersModel::remove); + connect(ui.cylinders, &TableView::itemClicked, cylindersModel, &CylindersModelFiltered::remove); connect(ui.cylinders, &TableView::itemClicked, this, &TabDiveEquipment::editCylinderWidget); connect(ui.weights, &TableView::itemClicked, this, &TabDiveEquipment::editWeightWidget); @@ -164,7 +164,7 @@ void TabDiveEquipment::addWeight_clicked() void TabDiveEquipment::editCylinderWidget(const QModelIndex &index) { - if (cylindersModel->changed && !MainWindow::instance()->mainTab->isEditing()) { + if (cylindersModel->model()->changed && !MainWindow::instance()->mainTab->isEditing()) { MainWindow::instance()->mainTab->enableEdition(); return; } @@ -228,7 +228,7 @@ void TabDiveEquipment::acceptChanges() // to the original value in current_dive like it should QVector<dive *> selectedDives = getSelectedDivesCurrentLast(); - if (cylindersModel->changed) { + if (cylindersModel->model()->changed) { mark_divelist_changed(true); MODIFY_DIVES(selectedDives, // if we started out with the same cylinder description (for multi-edit) or if we do copt & paste @@ -257,12 +257,12 @@ void TabDiveEquipment::acceptChanges() if (do_replot) MainWindow::instance()->graphics->replot(); - cylindersModel->changed = false; + cylindersModel->model()->changed = false; } void TabDiveEquipment::rejectChanges() { - cylindersModel->changed = false; + cylindersModel->model()->changed = false; cylindersModel->updateDive(); weightModel->updateDive(current_dive); } diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.h b/desktop-widgets/tab-widgets/TabDiveEquipment.h index 1edc20cef..28e6235d1 100644 --- a/desktop-widgets/tab-widgets/TabDiveEquipment.h +++ b/desktop-widgets/tab-widgets/TabDiveEquipment.h @@ -12,7 +12,7 @@ namespace Ui { }; class WeightModel; -class CylindersModel; +class CylindersModelFiltered; class TabDiveEquipment : public TabBase { Q_OBJECT @@ -38,7 +38,7 @@ private slots: private: Ui::TabDiveEquipment ui; SuitCompletionModel suitModel; - CylindersModel *cylindersModel; + CylindersModelFiltered *cylindersModel; WeightModel *weightModel; }; |