diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/configuredivecomputerdialog.cpp | 16 | ||||
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 12 | ||||
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/globe.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/groupedlineedit.cpp | 4 | ||||
-rw-r--r-- | desktop-widgets/kmessagewidget.cpp | 4 | ||||
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 8 | ||||
-rw-r--r-- | desktop-widgets/maintab.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 16 | ||||
-rw-r--r-- | desktop-widgets/modeldelegates.cpp | 16 | ||||
-rw-r--r-- | desktop-widgets/printer.cpp | 4 | ||||
-rw-r--r-- | desktop-widgets/templateedit.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/templatelayout.cpp | 2 |
13 files changed, 45 insertions, 45 deletions
diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp index 4ee61bb99..fce32c892 100644 --- a/desktop-widgets/configuredivecomputerdialog.cpp +++ b/desktop-widgets/configuredivecomputerdialog.cpp @@ -494,11 +494,11 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3() deviceDetails->dynamicAscendRate = ui.dynamicAscendRate->isChecked(); deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator->isChecked(); deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2->isChecked(); - deviceDetails->tempSensorOffset = ui.tempSensorOffsetDoubleSpinBox->value() * 10; + deviceDetails->tempSensorOffset = lrint(ui.tempSensorOffsetDoubleSpinBox->value() * 10); deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox->value(); - deviceDetails->safetyStopStartDepth = ui.safetyStopStartDepthDoubleSpinBox->value() * 10; - deviceDetails->safetyStopEndDepth = ui.safetyStopEndDepthDoubleSpinBox->value() * 10; - deviceDetails->safetyStopResetDepth = ui.safetyStopResetDepthDoubleSpinBox->value() * 10; + deviceDetails->safetyStopStartDepth = lrint(ui.safetyStopStartDepthDoubleSpinBox->value() * 10); + deviceDetails->safetyStopEndDepth = lrint(ui.safetyStopEndDepthDoubleSpinBox->value() * 10); + deviceDetails->safetyStopResetDepth = lrint(ui.safetyStopResetDepthDoubleSpinBox->value() * 10); //set gas values gas gas1; @@ -612,7 +612,7 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC() deviceDetails->desaturation = ui.desaturationSpinBox_3->value(); deviceDetails->lastDeco = ui.lastDecoSpinBox_3->value(); deviceDetails->samplingRate = ui.samplingRateSpinBox_3->value(); - deviceDetails->salinity = ui.salinityDoubleSpinBox_3->value() * 100; + deviceDetails->salinity = lrint(ui.salinityDoubleSpinBox_3->value() * 100); deviceDetails->dateFormat = ui.dateFormatComboBox_3->currentIndex(); deviceDetails->syncTime = ui.dateTimeSyncCheckBox_3->isChecked(); deviceDetails->safetyStop = ui.safetyStopCheckBox_3->isChecked(); @@ -629,9 +629,9 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC() deviceDetails->decoGasConsumption = ui.decoGasConsumption_3->value(); deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator_3->isChecked(); deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox_3->value(); - deviceDetails->safetyStopStartDepth = ui.safetyStopStartDepthDoubleSpinBox_3->value() * 10; - deviceDetails->safetyStopEndDepth = ui.safetyStopEndDepthDoubleSpinBox_3->value() * 10; - deviceDetails->safetyStopResetDepth = ui.safetyStopResetDepthDoubleSpinBox_3->value() * 10; + deviceDetails->safetyStopStartDepth = lrint(ui.safetyStopStartDepthDoubleSpinBox_3->value() * 10); + deviceDetails->safetyStopEndDepth = lrint(ui.safetyStopEndDepthDoubleSpinBox_3->value() * 10); + deviceDetails->safetyStopResetDepth = lrint(ui.safetyStopResetDepthDoubleSpinBox_3->value() * 10); //set gas values gas gas1; diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 4fc38cd2a..9dce53da8 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -228,7 +228,7 @@ void DivePlannerWidget::heightChanged(const int height) void DivePlannerWidget::salinityChanged(const double salinity) { /* Salinity is expressed in weight in grams per 10l */ - plannerModel->setSalinity(10000 * salinity); + plannerModel->setSalinity(lrint(10000 * salinity)); } void PlannerSettingsWidget::bottomSacChanged(const double bottomSac) @@ -478,27 +478,27 @@ void PlannerSettingsWidget::printDecoPlan() void PlannerSettingsWidget::setAscRate75(int rate) { - SettingsObjectWrapper::instance()->planner_settings->setAscrate75(rate * UNIT_FACTOR); + SettingsObjectWrapper::instance()->planner_settings->setAscrate75(lrint(rate * UNIT_FACTOR)); } void PlannerSettingsWidget::setAscRate50(int rate) { - SettingsObjectWrapper::instance()->planner_settings->setAscrate50(rate * UNIT_FACTOR); + SettingsObjectWrapper::instance()->planner_settings->setAscrate50(lrint(rate * UNIT_FACTOR)); } void PlannerSettingsWidget::setAscRateStops(int rate) { - SettingsObjectWrapper::instance()->planner_settings->setAscratestops(rate * UNIT_FACTOR); + SettingsObjectWrapper::instance()->planner_settings->setAscratestops(lrint(rate * UNIT_FACTOR)); } void PlannerSettingsWidget::setAscRateLast6m(int rate) { - SettingsObjectWrapper::instance()->planner_settings->setAscratelast6m(rate * UNIT_FACTOR); + SettingsObjectWrapper::instance()->planner_settings->setAscratelast6m(lrint(rate * UNIT_FACTOR)); } void PlannerSettingsWidget::setDescRate(int rate) { - SettingsObjectWrapper::instance()->planner_settings->setDescrate(rate * UNIT_FACTOR); + SettingsObjectWrapper::instance()->planner_settings->setDescrate(lrint(rate * UNIT_FACTOR)); } void PlannerSettingsWidget::sacFactorChanged(const double factor) diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 5501a57ae..fe41c2070 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -126,7 +126,7 @@ void DownloadFromDCWidget::updateProgressBar() } else { ui.progressBar->setFormat("%p%"); } - ui.progressBar->setValue(progress_bar_fraction * 100); + ui.progressBar->setValue(lrint(progress_bar_fraction * 100)); } void DownloadFromDCWidget::updateState(states state) diff --git a/desktop-widgets/globe.cpp b/desktop-widgets/globe.cpp index ebe1fdb1c..2bab4e83f 100644 --- a/desktop-widgets/globe.cpp +++ b/desktop-widgets/globe.cpp @@ -267,7 +267,7 @@ void GlobeGPS::centerOnDiveSite(struct dive_site *ds) // otherwise check to make sure we aren't still running an animation and then remember // the current zoom level if (currentZoomLevel == -1) { - currentZoomLevel = zoomFromDistance(3.0); + currentZoomLevel = lrint(zoomFromDistance(3.0)); centerOn(longitude, latitude); fixZoom(true); return; diff --git a/desktop-widgets/groupedlineedit.cpp b/desktop-widgets/groupedlineedit.cpp index 9ce5e175c..68f53d79e 100644 --- a/desktop-widgets/groupedlineedit.cpp +++ b/desktop-widgets/groupedlineedit.cpp @@ -139,9 +139,9 @@ QSize GroupedLineEdit::sizeHint() const { QSize rs( 40, - document()->findBlock(0).layout()->lineAt(0).height() + + lrint(document()->findBlock(0).layout()->lineAt(0).height() + document()->documentMargin() * 2 + - frameWidth() * 2); + frameWidth() * 2)); return rs; } diff --git a/desktop-widgets/kmessagewidget.cpp b/desktop-widgets/kmessagewidget.cpp index 2e506af2d..8a7a154d1 100644 --- a/desktop-widgets/kmessagewidget.cpp +++ b/desktop-widgets/kmessagewidget.cpp @@ -177,8 +177,8 @@ void KMessageWidgetPrivate::updateSnapShot() void KMessageWidgetPrivate::slotTimeLineChanged(qreal value) { - q->setFixedHeight(qMin(value * 2, qreal(1.0)) * content->height()); - q->update(); + q->setFixedHeight(lrint(qMin(value * 2, qreal(1.0)) * content->height())); + q->update(); } void KMessageWidgetPrivate::slotTimeLineFinished() diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 20cc6fe1d..3e8a85fb6 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -156,8 +156,8 @@ void LocationInformationWidget::acceptChanges() if (!ui.diveSiteCoordinates->text().isEmpty()) { double lat, lon; parseGpsText(ui.diveSiteCoordinates->text(), &lat, &lon); - currentDs->latitude.udeg = lat * 1000000.0; - currentDs->longitude.udeg = lon * 1000000.0; + currentDs->latitude.udeg = (int)(lat * 1000000.0); + currentDs->longitude.udeg = (int)(lon * 1000000.0); } if (dive_site_is_empty(currentDs)) { LocationInformationModel::instance()->removeRow(get_divesite_idx(currentDs)); @@ -232,8 +232,8 @@ void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString if (!same_string(qPrintable(text), coords)) { double latitude, longitude; if (parseGpsText(text, &latitude, &longitude)) { - displayed_dive_site.latitude.udeg = latitude * 1000000; - displayed_dive_site.longitude.udeg = longitude * 1000000; + displayed_dive_site.latitude.udeg = (int)(latitude * 1000000); + displayed_dive_site.longitude.udeg = (int)(longitude * 1000000); markChangedWidget(ui.diveSiteCoordinates); emit coordinatesChanged(); ui.geoCodeButton->setEnabled(latitude != 0 && longitude != 0); diff --git a/desktop-widgets/maintab.cpp b/desktop-widgets/maintab.cpp index 7a9ac5d2b..d8ccafb0a 100644 --- a/desktop-widgets/maintab.cpp +++ b/desktop-widgets/maintab.cpp @@ -629,7 +629,7 @@ void MainTab::updateDiveInfo(bool clear) continue; volumes.append(get_volume_string(gases[i], true)); if (duration[i]) { - sac.mliter = gases[i].mliter / (depth_to_atm(mean[i], &displayed_dive) * duration[i] / 60); + sac.mliter = lrint(gases[i].mliter / (depth_to_atm(mean[i], &displayed_dive) * duration[i] / 60)); SACs.append(get_volume_string(sac, true).append(tr("/min"))); } } diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index b6faa3dff..28bc6cee6 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1041,8 +1041,8 @@ void MainWindow::on_actionYearlyStatistics_triggered() QTreeView *view = new QTreeView(); view->setModel(m); l->addWidget(view); - d.resize(width() * .8, height() / 2); - d.move(width() * .1, height() / 4); + d.resize(lrint(width() * .8), height() / 2); + d.move(lrint(width() * .1), height() / 4); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), &d); connect(close, SIGNAL(activated()), &d, SLOT(close())); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), &d); @@ -1105,19 +1105,19 @@ void MainWindow::on_actionViewAll_triggered() const int appH = qApp->desktop()->size().height(); const int appW = qApp->desktop()->size().width(); if (mainSizes.empty()) { - mainSizes.append(appH * 0.7); - mainSizes.append(appH * 0.3); + mainSizes.append(lrint(appH * 0.7)); + mainSizes.append(lrint(appH * 0.3)); } static QList<int> infoProfileSizes; if (infoProfileSizes.empty()) { - infoProfileSizes.append(appW * 0.3); - infoProfileSizes.append(appW * 0.7); + infoProfileSizes.append(lrint(appW * 0.3)); + infoProfileSizes.append(lrint(appW * 0.7)); } static QList<int> listGlobeSizes; if (listGlobeSizes.empty()) { - listGlobeSizes.append(appW * 0.7); - listGlobeSizes.append(appW * 0.3); + listGlobeSizes.append(lrint(appW * 0.7)); + listGlobeSizes.append(lrint(appW * 0.3)); } QSettings settings; diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 01e8f4d17..8255d40c8 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -526,18 +526,18 @@ print_part: if (option.state & QStyle::State_Selected) { painter->setPen(QPen(opt.palette.highlight().color().darker())); painter->setBrush(opt.palette.highlight()); - const qreal pad = 1.0; - const qreal pad2 = pad * 2.0; - const qreal rounding = 5.0; + const int pad = 1; + const int pad2 = pad * 2; + const int rounding = 5; painter->drawRoundedRect(option.rect.x() + pad, - option.rect.y() + pad, - option.rect.width() - pad2, - option.rect.height() - pad2, - rounding, rounding); + option.rect.y() + pad, + option.rect.width() - pad2, + option.rect.height() - pad2, + rounding, rounding); } painter->setPen(textPen); painter->setFont(fontBigger); - const qreal textPad = 5.0; + const int textPad = 5; painter->drawText(option.rect.x() + textPad, option.rect.y() + fmBigger.boundingRect("YH").height(), diveSiteName); double pointSize = fontSmaller.pointSizeF(); fontSmaller.setPointSizeF(0.9 * pointSize); diff --git a/desktop-widgets/printer.cpp b/desktop-widgets/printer.cpp index 49a9a18b1..1ea275cfe 100644 --- a/desktop-widgets/printer.cpp +++ b/desktop-widgets/printer.cpp @@ -104,7 +104,7 @@ void Printer::flowRender() webView->page()->mainFrame()->scroll(0, dontbreakElement.geometry().y() - start); // rendering progress is 4/5 of total work - emit(progessUpdated((end * 80.0 / fullPageResolution) + done)); + emit(progessUpdated(lrint((end * 80.0 / fullPageResolution) + done))); // add new pages only in print mode, while previewing we don't add new pages if (printMode == Printer::PRINT) @@ -183,7 +183,7 @@ void Printer::render(int Pages = 0) viewPort.adjust(0, pageSize.height(), 0, pageSize.height()); // rendering progress is 4/5 of total work - emit(progessUpdated((i * 80.0 / Pages) + done)); + emit(progessUpdated(lrint((i * 80.0 / Pages) + done))); if (i < Pages - 1 && printMode == Printer::PRINT) static_cast<QPrinter*>(paintDevice)->newPage(); } diff --git a/desktop-widgets/templateedit.cpp b/desktop-widgets/templateedit.cpp index ea6314075..34f617b1a 100644 --- a/desktop-widgets/templateedit.cpp +++ b/desktop-widgets/templateedit.cpp @@ -17,7 +17,7 @@ TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions, // restore the settings and init the UI ui->fontSelection->setCurrentIndex(templateOptions->font_index); - ui->fontsize->setValue(templateOptions->font_size); + ui->fontsize->setValue(lrint(templateOptions->font_size)); ui->colorpalette->setCurrentIndex(templateOptions->color_palette_index); ui->linespacing->setValue(templateOptions->line_spacing); ui->borderwidth->setValue(templateOptions->border_width); diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp index 3bd9f1fa8..b463b220b 100644 --- a/desktop-widgets/templatelayout.cpp +++ b/desktop-widgets/templatelayout.cpp @@ -105,7 +105,7 @@ QString TemplateLayout::generate() DiveObjectHelper *d = new DiveObjectHelper(dive); diveList.append(QVariant::fromValue(d)); progress++; - emit progressUpdated(progress * 100.0 / totalWork); + emit progressUpdated(lrint(progress * 100.0 / totalWork)); } Grantlee::Context c; c.insert("dives", diveList); |