mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Start populating the maintab Dive Info widget
Establish some useful helpers and use them when updating the values. One of the helpers (from statistics.c) puzzlingly doesn't link - so that's ifdefed out. Also had to re-arrange the settings reading code (it came too late) and to extract the expanding code of the top dive from the settings reading code (as it had no business being there to begin with). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1a8239a240
commit
b75a89aa86
7 changed files with 100 additions and 9 deletions
|
@ -32,14 +32,17 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()),
|
|||
sortModel(new QSortFilterProxyModel())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
readSettings();
|
||||
sortModel->setSourceModel(model);
|
||||
ui->ListWidget->setModel(sortModel);
|
||||
setWindowIcon(QIcon(":subsurface-icon"));
|
||||
|
||||
connect(ui->ListWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(dive_selection_changed(QItemSelection,QItemSelection)));
|
||||
|
||||
readSettings();
|
||||
QModelIndex firstDiveOrTrip = sortModel->index(0,0);
|
||||
if (sortModel->index(0,0, firstDiveOrTrip).isValid())
|
||||
ui->ListWidget->setCurrentIndex(sortModel->index(0,0, firstDiveOrTrip));
|
||||
else
|
||||
ui->ListWidget->setCurrentIndex(firstDiveOrTrip);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionNew_triggered()
|
||||
|
@ -343,11 +346,6 @@ void MainWindow::readSettings()
|
|||
}
|
||||
ui->ListWidget->collapseAll();
|
||||
ui->ListWidget->expand(sortModel->index(0,0));
|
||||
QModelIndex firstDiveOrTrip = sortModel->index(0,0);
|
||||
if (sortModel->index(0,0, firstDiveOrTrip).isValid())
|
||||
ui->ListWidget->setCurrentIndex(sortModel->index(0,0, firstDiveOrTrip));
|
||||
else
|
||||
ui->ListWidget->setCurrentIndex(firstDiveOrTrip);
|
||||
settings.endGroup();
|
||||
settings.beginGroup("Units");
|
||||
GET_UNIT(v, "feet", length, units::METERS, units::FEET);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue