summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-08 12:54:53 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-08 12:54:53 -0800
commit0dd8d11a183e45b2dbab5664ce893f6534f3e442 (patch)
tree0017f2c9de349a23c43d1ea59d4f0ab147abc046 /qt-ui
parent3ae664b6dcf1adc08e49c928e293470835af04f0 (diff)
downloadsubsurface-0dd8d11a183e45b2dbab5664ce893f6534f3e442.tar.gz
Dive d/l selection UI: hook up select / unselect all
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp20
-rw-r--r--qt-ui/downloadfromdivecomputer.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index ffda54769..458a41d1f 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -77,6 +77,10 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) :
ui.chooseLogFile->setEnabled(ui.logToFile->isChecked());
connect(ui.chooseLogFile, SIGNAL(clicked()), this, SLOT(pickLogFile()));
connect(ui.logToFile, SIGNAL(stateChanged(int)), this, SLOT(checkLogFile(int)));
+ ui.selectAllButton->setEnabled(false);
+ ui.unselectAllButton->setEnabled(false);
+ connect(ui.selectAllButton, SIGNAL(clicked()), diveImportedModel, SLOT(selectAll()));
+ connect(ui.unselectAllButton, SIGNAL(clicked()), diveImportedModel, SLOT(selectNone()));
vendorModel = new QStringListModel(vendorList);
ui.vendor->setModel(vendorModel);
if (default_dive_computer_vendor) {
@@ -455,6 +459,8 @@ void DownloadFromDCWidget::markChildrenAsDisabled()
ui.dumpToFile->setDisabled(true);
ui.chooseLogFile->setDisabled(true);
ui.chooseDumpFile->setDisabled(true);
+ ui.selectAllButton->setDisabled(true);
+ ui.unselectAllButton->setDisabled(true);
}
void DownloadFromDCWidget::markChildrenAsEnabled()
@@ -472,6 +478,8 @@ void DownloadFromDCWidget::markChildrenAsEnabled()
ui.dumpToFile->setDisabled(false);
ui.chooseLogFile->setDisabled(false);
ui.chooseDumpFile->setDisabled(false);
+ ui.selectAllButton->setDisabled(false);
+ ui.unselectAllButton->setDisabled(false);
}
static void fillDeviceList(const char *name, void *data)
@@ -598,6 +606,18 @@ void DiveImportedModel::changeSelected(QModelIndex index)
dataChanged(index, index, QVector<int>() << Qt::CheckStateRole);
}
+void DiveImportedModel::selectAll()
+{
+ memset(checkStates, true, lastIndex - firstIndex);
+ dataChanged(index(0, 0), index(0, lastIndex - firstIndex - 1), QVector<int>() << Qt::CheckStateRole);
+}
+
+void DiveImportedModel::selectNone()
+{
+ memset(checkStates, false, lastIndex - firstIndex);
+ dataChanged(index(0, 0), index(0, lastIndex - firstIndex - 1), QVector<int>() << Qt::CheckStateRole);
+}
+
Qt::ItemFlags DiveImportedModel::flags(const QModelIndex &index) const
{
if (index.column() != 0)
diff --git a/qt-ui/downloadfromdivecomputer.h b/qt-ui/downloadfromdivecomputer.h
index 81a32f206..c010fa0fd 100644
--- a/qt-ui/downloadfromdivecomputer.h
+++ b/qt-ui/downloadfromdivecomputer.h
@@ -42,6 +42,8 @@ public:
public
slots:
void changeSelected(QModelIndex index);
+ void selectAll();
+ void selectNone();
private:
int firstIndex;