mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:13:23 +00:00
Good deal of whitespace fixes and code cleanup.
I just went thru all of subsurface code removing some whitespaces issues and trying to make the code prettyer, I also removed a few QString issues.d Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
9ed933d033
commit
1b9a4f2bf8
11 changed files with 50 additions and 131 deletions
|
@ -38,9 +38,8 @@ void DiveComputerManagementDialog::update()
|
||||||
|
|
||||||
void DiveComputerManagementDialog::tryRemove(const QModelIndex& index)
|
void DiveComputerManagementDialog::tryRemove(const QModelIndex& index)
|
||||||
{
|
{
|
||||||
if (index.column() != DiveComputerModel::REMOVE){
|
if (index.column() != DiveComputerModel::REMOVE)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox::StandardButton response = QMessageBox::question(
|
QMessageBox::StandardButton response = QMessageBox::question(
|
||||||
this,
|
this,
|
||||||
|
@ -49,9 +48,8 @@ void DiveComputerManagementDialog::tryRemove(const QModelIndex& index)
|
||||||
QMessageBox::Ok | QMessageBox::Cancel
|
QMessageBox::Ok | QMessageBox::Cancel
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response == QMessageBox::Ok){
|
if (response == QMessageBox::Ok)
|
||||||
model->remove(index);
|
model->remove(index);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveComputerManagementDialog::accept()
|
void DiveComputerManagementDialog::accept()
|
||||||
|
|
|
@ -52,9 +52,8 @@ void DiveListView::fixMessyQtModelBehaviour()
|
||||||
{
|
{
|
||||||
QAbstractItemModel *m = model();
|
QAbstractItemModel *m = model();
|
||||||
for(int i = 0; i < model()->rowCount(); i++){
|
for(int i = 0; i < model()->rowCount(); i++){
|
||||||
if (m->rowCount( m->index(i, 0) ) != 0){
|
if (m->rowCount( m->index(i, 0) ) != 0)
|
||||||
setFirstColumnSpanned(i, QModelIndex(), true);
|
setFirstColumnSpanned(i, QModelIndex(), true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,13 +87,11 @@ void DiveListView::showSearchEdit()
|
||||||
|
|
||||||
bool DiveListView::eventFilter(QObject* , QEvent* event)
|
bool DiveListView::eventFilter(QObject* , QEvent* event)
|
||||||
{
|
{
|
||||||
if(event->type() != QEvent::KeyPress){
|
if(event->type() != QEvent::KeyPress)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
QKeyEvent *keyEv = static_cast<QKeyEvent*>(event);
|
QKeyEvent *keyEv = static_cast<QKeyEvent*>(event);
|
||||||
if (keyEv->key() != Qt::Key_Escape){
|
if (keyEv->key() != Qt::Key_Escape)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
searchBox->clear();
|
searchBox->clear();
|
||||||
searchBox->hide();
|
searchBox->hide();
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
#define DIVELISTVIEW_H
|
#define DIVELISTVIEW_H
|
||||||
|
|
||||||
/*! A view subclass for use with dives
|
/*! A view subclass for use with dives
|
||||||
|
|
||||||
Note: calling this a list view might be misleading?
|
Note: calling this a list view might be misleading?
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
|
@ -211,17 +211,15 @@ void DivePlannerGraphics::pointInserted(const QModelIndex& parent, int start , i
|
||||||
|
|
||||||
void DivePlannerGraphics::keyDownAction()
|
void DivePlannerGraphics::keyDownAction()
|
||||||
{
|
{
|
||||||
if (scene()->selectedItems().count()) {
|
Q_FOREACH(QGraphicsItem *i, scene()->selectedItems()) {
|
||||||
Q_FOREACH(QGraphicsItem *i, scene()->selectedItems()) {
|
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler*>(i)) {
|
||||||
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler*>(i)) {
|
int row = handles.indexOf(handler);
|
||||||
int row = handles.indexOf(handler);
|
divedatapoint dp = plannerModel->at(row);
|
||||||
divedatapoint dp = plannerModel->at(row);
|
if (dp.depth >= depthLine->maximum())
|
||||||
if (dp.depth >= depthLine->maximum())
|
continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
dp.depth += M_OR_FT(1,5);
|
dp.depth += M_OR_FT(1,5);
|
||||||
plannerModel->editStop(row, dp);
|
plannerModel->editStop(row, dp);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,13 +395,9 @@ void DivePlannerGraphics::decreaseDepth()
|
||||||
|
|
||||||
void DivePlannerGraphics::decreaseTime()
|
void DivePlannerGraphics::decreaseTime()
|
||||||
{
|
{
|
||||||
if (timeLine->maximum() - 10 < TIME_INITIAL_MAX) {
|
if (timeLine->maximum() - 10 < TIME_INITIAL_MAX || timeLine->maximum() - 10 < dpMaxTime)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (timeLine->maximum() - 10 < dpMaxTime) {
|
|
||||||
qDebug() << timeLine->maximum() << dpMaxTime;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
minMinutes -= 10;
|
minMinutes -= 10;
|
||||||
timeLine->setMaximum(timeLine->maximum() - 10);
|
timeLine->setMaximum(timeLine->maximum() - 10);
|
||||||
timeLine->updateTicks();
|
timeLine->updateTicks();
|
||||||
|
@ -575,7 +569,6 @@ void DivePlannerGraphics::moveActiveHandler(const QPointF& mappedPos, const int
|
||||||
maxtime = plannerModel->at(pos + 1).time;
|
maxtime = plannerModel->at(pos + 1).time;
|
||||||
|
|
||||||
int minutes = rint(timeLine->valueAt(mappedPos));
|
int minutes = rint(timeLine->valueAt(mappedPos));
|
||||||
|
|
||||||
if (minutes * 60 <= mintime || minutes * 60 >= maxtime)
|
if (minutes * 60 <= mintime || minutes * 60 >= maxtime)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -591,10 +584,7 @@ void DivePlannerGraphics::moveActiveHandler(const QPointF& mappedPos, const int
|
||||||
activeDraggedHandler->setPos(QPointF(xpos, ypos));
|
activeDraggedHandler->setPos(QPointF(xpos, ypos));
|
||||||
qDeleteAll(lines);
|
qDeleteAll(lines);
|
||||||
lines.clear();
|
lines.clear();
|
||||||
|
|
||||||
drawProfile();
|
drawProfile();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivePlannerGraphics::isPointOutOfBoundaries(const QPointF& point)
|
bool DivePlannerGraphics::isPointOutOfBoundaries(const QPointF& point)
|
||||||
|
@ -758,7 +748,6 @@ void Ruler::setTickSize(qreal size)
|
||||||
tickSize = size;
|
tickSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Ruler::setTickInterval(double i)
|
void Ruler::setTickInterval(double i)
|
||||||
{
|
{
|
||||||
interval = i;
|
interval = i;
|
||||||
|
@ -796,7 +785,6 @@ qreal Ruler::percentAt(const QPointF& p)
|
||||||
return percent;
|
return percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Ruler::maximum() const
|
double Ruler::maximum() const
|
||||||
{
|
{
|
||||||
return max;
|
return max;
|
||||||
|
@ -1228,6 +1216,5 @@ void DivePlannerPointsModel::createPlan()
|
||||||
beginRemoveRows(QModelIndex(), 0, rowCount() -1 );
|
beginRemoveRows(QModelIndex(), 0, rowCount() -1 );
|
||||||
divepoints.clear();
|
divepoints.clear();
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
|
|
||||||
planCreated();
|
planCreated();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,14 +68,12 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget* parent, Qt::WindowFlags f) :
|
||||||
|
|
||||||
timer->setInterval(200);
|
timer->setInterval(200);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(updateProgressBar()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(updateProgressBar()));
|
||||||
|
|
||||||
updateState(INITIAL);
|
updateState(INITIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadFromDCWidget::runDialog()
|
void DownloadFromDCWidget::runDialog()
|
||||||
{
|
{
|
||||||
updateState(INITIAL);
|
updateState(INITIAL);
|
||||||
|
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,13 +322,10 @@ static QString str_error(const char *fmt, ...)
|
||||||
void DownloadThread::run()
|
void DownloadThread::run()
|
||||||
{
|
{
|
||||||
const char *error;
|
const char *error;
|
||||||
|
|
||||||
if (!strcmp(data->vendor, "Uemis"))
|
if (!strcmp(data->vendor, "Uemis"))
|
||||||
error = do_uemis_import(data->devname, data->force_download);
|
error = do_uemis_import(data->devname, data->force_download);
|
||||||
else
|
else
|
||||||
error = do_libdivecomputer_import(data);
|
error = do_libdivecomputer_import(data);
|
||||||
|
if (error)
|
||||||
if (error) {
|
|
||||||
this->error = str_error(error, data->devname, data->vendor, data->product);
|
this->error = str_error(error, data->devname, data->vendor, data->product);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,9 +198,8 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U
|
||||||
lon = lon * 180 / M_PI;
|
lon = lon * 180 / M_PI;
|
||||||
lat = lat * 180 / M_PI;
|
lat = lat * 180 / M_PI;
|
||||||
}
|
}
|
||||||
if (!editingDiveCoords) {
|
if (!editingDiveCoords)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
editingDiveCoords->latitude.udeg = lrint(lat * 1000000.0);
|
editingDiveCoords->latitude.udeg = lrint(lat * 1000000.0);
|
||||||
editingDiveCoords->longitude.udeg = lrint(lon * 1000000.0);
|
editingDiveCoords->longitude.udeg = lrint(lon * 1000000.0);
|
||||||
|
@ -222,13 +221,10 @@ void GlobeGPS::mousePressEvent(QMouseEvent* event)
|
||||||
void GlobeGPS::resizeEvent(QResizeEvent* event)
|
void GlobeGPS::resizeEvent(QResizeEvent* event)
|
||||||
{
|
{
|
||||||
int size = event->size().width();
|
int size = event->size().width();
|
||||||
|
|
||||||
MarbleWidget::resizeEvent(event);
|
MarbleWidget::resizeEvent(event);
|
||||||
|
|
||||||
if (size > 600)
|
if (size > 600)
|
||||||
messageWidget->setGeometry((size - 600) / 2, 5, 600, 0);
|
messageWidget->setGeometry((size - 600) / 2, 5, 600, 0);
|
||||||
else
|
else
|
||||||
messageWidget->setGeometry(5, 5, size - 10, 0);
|
messageWidget->setGeometry(5, 5, size - 10, 0);
|
||||||
|
|
||||||
messageWidget->setMaximumHeight(500);
|
messageWidget->setMaximumHeight(500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,6 @@ void MainTab::clearStats()
|
||||||
else \
|
else \
|
||||||
ui.field->setText(get_temperature_string(d->field, TRUE))
|
ui.field->setText(get_temperature_string(d->field, TRUE))
|
||||||
|
|
||||||
|
|
||||||
void MainTab::updateDiveInfo(int dive)
|
void MainTab::updateDiveInfo(int dive)
|
||||||
{
|
{
|
||||||
if (!isEnabled() && dive != -1)
|
if (!isEnabled() && dive != -1)
|
||||||
|
@ -483,7 +482,6 @@ void MainTab::resetPallete()
|
||||||
ui.dateTimeEdit->setPalette(p);
|
ui.dateTimeEdit->setPalette(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define EDIT_TEXT2(what, text) \
|
#define EDIT_TEXT2(what, text) \
|
||||||
textByteArray = text.toLocal8Bit(); \
|
textByteArray = text.toLocal8Bit(); \
|
||||||
free(what);\
|
free(what);\
|
||||||
|
|
|
@ -32,26 +32,20 @@ StarWidgetsDelegate::StarWidgetsDelegate(QWidget* parent):
|
||||||
void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
QStyledItemDelegate::paint(painter, option, index);
|
QStyledItemDelegate::paint(painter, option, index);
|
||||||
|
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QVariant value = index.model()->data(index, DiveTripModel::STAR_ROLE);
|
QVariant value = index.model()->data(index, DiveTripModel::STAR_ROLE);
|
||||||
|
|
||||||
if (!value.isValid())
|
if (!value.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int rating = value.toInt();
|
int rating = value.toInt();
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||||
|
|
||||||
for(int i = 0; i < rating; i++)
|
for(int i = 0; i < rating; i++)
|
||||||
painter->drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y(), StarWidget::starActive());
|
painter->drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y(), StarWidget::starActive());
|
||||||
|
|
||||||
for(int i = rating; i < TOTALSTARS; i++)
|
for(int i = rating; i < TOTALSTARS; i++)
|
||||||
painter->drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y(), StarWidget::starInactive());
|
painter->drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y(), StarWidget::starInactive());
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ static QVariant percent_string(fraction_t fraction)
|
||||||
|
|
||||||
if (!permille)
|
if (!permille)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
return QString("%1%").arg(permille / 10.0, 0, 'f', 1);
|
return QString("%1%").arg(permille / 10.0, 0, 'f', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,9 +642,8 @@ WSInfoModel::WSInfoModel() : QAbstractTableModel(), rows(-1)
|
||||||
struct ws_info_t *info = ws_info;
|
struct ws_info_t *info = ws_info;
|
||||||
for (info = ws_info; info->name; info++, rows++){
|
for (info = ws_info; info->name; info++, rows++){
|
||||||
QString wsInfoName(info->name);
|
QString wsInfoName(info->name);
|
||||||
if( wsInfoName.count() > biggerEntry.count()){
|
if( wsInfoName.count() > biggerEntry.count())
|
||||||
biggerEntry = wsInfoName;
|
biggerEntry = wsInfoName;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rows > -1) {
|
if (rows > -1) {
|
||||||
|
@ -662,9 +660,8 @@ void WSInfoModel::updateInfo()
|
||||||
rows = -1;
|
rows = -1;
|
||||||
for (info = ws_info; info->name; info++, rows++){
|
for (info = ws_info; info->name; info++, rows++){
|
||||||
QString wsInfoName(info->name);
|
QString wsInfoName(info->name);
|
||||||
if( wsInfoName.count() > biggerEntry.count()){
|
if( wsInfoName.count() > biggerEntry.count())
|
||||||
biggerEntry = wsInfoName;
|
biggerEntry = wsInfoName;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rows > -1) {
|
if (rows > -1) {
|
||||||
|
@ -805,9 +802,8 @@ TankInfoModel::TankInfoModel() : QAbstractTableModel(), rows(-1)
|
||||||
struct tank_info_t *info = tank_info;
|
struct tank_info_t *info = tank_info;
|
||||||
for (info = tank_info; info->name; info++, rows++){
|
for (info = tank_info; info->name; info++, rows++){
|
||||||
QString infoName(info->name);
|
QString infoName(info->name);
|
||||||
if (infoName.count() > biggerEntry.count()){
|
if (infoName.count() > biggerEntry.count())
|
||||||
biggerEntry = infoName;
|
biggerEntry = infoName;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rows > -1) {
|
if (rows > -1) {
|
||||||
|
@ -929,7 +925,6 @@ int TreeModel::rowCount(const QModelIndex& parent) const
|
||||||
parentItem = static_cast<TreeItem*>(parent.internalPointer());
|
parentItem = static_cast<TreeItem*>(parent.internalPointer());
|
||||||
|
|
||||||
int amount = parentItem->children.count();
|
int amount = parentItem->children.count();
|
||||||
|
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1081,27 +1076,22 @@ QString DiveItem::displayDuration() const
|
||||||
QString DiveItem::displayTemperature() const
|
QString DiveItem::displayTemperature() const
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
if (!dive->watertemp.mkelvin)
|
if (!dive->watertemp.mkelvin)
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
if (get_units()->temperature == units::CELSIUS)
|
if (get_units()->temperature == units::CELSIUS)
|
||||||
str = QString::number(mkelvin_to_C(dive->watertemp.mkelvin), 'f', 1);
|
str = QString::number(mkelvin_to_C(dive->watertemp.mkelvin), 'f', 1);
|
||||||
else
|
else
|
||||||
str = QString::number(mkelvin_to_F(dive->watertemp.mkelvin), 'f', 1);
|
str = QString::number(mkelvin_to_F(dive->watertemp.mkelvin), 'f', 1);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DiveItem::displaySac() const
|
QString DiveItem::displaySac() const
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
if (get_units()->volume == units::LITER)
|
if (get_units()->volume == units::LITER)
|
||||||
str = QString::number(dive->sac / 1000.0, 'f', 1);
|
str = QString::number(dive->sac / 1000.0, 'f', 1);
|
||||||
else
|
else
|
||||||
str = QString::number(ml_to_cuft(dive->sac), 'f', 2);
|
str = QString::number(ml_to_cuft(dive->sac), 'f', 2);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1499,20 +1489,13 @@ QVariant TablePrintModel::data(const QModelIndex &index, int role) const
|
||||||
return QColor(list.at(index.row())->colorBackground);
|
return QColor(list.at(index.row())->colorBackground);
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole)
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case 0:
|
case 0: return list.at(index.row())->number;
|
||||||
return list.at(index.row())->number;
|
case 1: return list.at(index.row())->date;
|
||||||
case 1:
|
case 2: return list.at(index.row())->depth;
|
||||||
return list.at(index.row())->date;
|
case 3: return list.at(index.row())->duration;
|
||||||
case 2:
|
case 4: return list.at(index.row())->divemaster;
|
||||||
return list.at(index.row())->depth;
|
case 5: return list.at(index.row())->buddy;
|
||||||
case 3:
|
case 6: return list.at(index.row())->location;
|
||||||
return list.at(index.row())->duration;
|
|
||||||
case 4:
|
|
||||||
return list.at(index.row())->divemaster;
|
|
||||||
case 5:
|
|
||||||
return list.at(index.row())->buddy;
|
|
||||||
case 6:
|
|
||||||
return list.at(index.row())->location;
|
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -1522,20 +1505,13 @@ bool TablePrintModel::setData(const QModelIndex &index, const QVariant &value, i
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case 0:
|
case 0: list.at(index.row())->number = value.toString();
|
||||||
list.at(index.row())->number = value.toString();
|
case 1: list.at(index.row())->date = value.toString();
|
||||||
case 1:
|
case 2: list.at(index.row())->depth = value.toString();
|
||||||
list.at(index.row())->date = value.toString();
|
case 3: list.at(index.row())->duration = value.toString();
|
||||||
case 2:
|
case 4: list.at(index.row())->divemaster = value.toString();
|
||||||
list.at(index.row())->depth = value.toString();
|
case 5: list.at(index.row())->buddy = value.toString();
|
||||||
case 3:
|
case 6: list.at(index.row())->location = value.toString();
|
||||||
list.at(index.row())->duration = value.toString();
|
|
||||||
case 4:
|
|
||||||
list.at(index.row())->divemaster = value.toString();
|
|
||||||
case 5:
|
|
||||||
list.at(index.row())->buddy = value.toString();
|
|
||||||
case 6:
|
|
||||||
list.at(index.row())->location = value.toString();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1616,19 +1592,18 @@ QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole: {
|
case Qt::DisplayRole: {
|
||||||
struct DiveItem di;
|
struct DiveItem di;
|
||||||
di.dive = dive;
|
di.dive = dive;;
|
||||||
QString unit;
|
|
||||||
char buf[80];
|
char buf[80];
|
||||||
const QString empty = QString("");
|
|
||||||
const QString unknown = QString(tr("unknown"));
|
const QString unknown = tr("unknown");
|
||||||
|
|
||||||
// dive# + date, depth, location, duration
|
// dive# + date, depth, location, duration
|
||||||
if (row == 0) {
|
if (row == 0) {
|
||||||
if (col == 0)
|
if (col == 0)
|
||||||
return QString(tr("Dive #%1 - %2")).arg(dive->number).arg(di.displayDate());
|
return tr("Dive #%1 - %2").arg(dive->number).arg(di.displayDate());
|
||||||
if (col == 5) {
|
if (col == 5) {
|
||||||
unit = (get_units()->length == units::METERS) ? "m" : "ft";
|
QString unit = (get_units()->length == units::METERS) ? "m" : "ft";
|
||||||
return QString(tr("Max depth: %1 %2")).arg(di.displayDepth()).arg(unit);
|
return tr("Max depth: %1 %2").arg(di.displayDepth()).arg(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (row == 1) {
|
if (row == 1) {
|
||||||
|
@ -1640,11 +1615,11 @@ QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const
|
||||||
// cylinder headings
|
// cylinder headings
|
||||||
if (row == 2) {
|
if (row == 2) {
|
||||||
if (col == 0)
|
if (col == 0)
|
||||||
return QString(tr("Cylinder"));
|
return tr("Cylinder");
|
||||||
if (col == 1)
|
if (col == 1)
|
||||||
return QString(tr("Gasmix"));
|
return tr("Gasmix");
|
||||||
if (col == 2)
|
if (col == 2)
|
||||||
return QString(tr("Gas Used"));
|
return tr("Gas Used");
|
||||||
}
|
}
|
||||||
// cylinder data
|
// cylinder data
|
||||||
if (row > 2 && row < 10 && row - 3 < MAX_CYLINDERS) {
|
if (row > 2 && row < 10 && row - 3 < MAX_CYLINDERS) {
|
||||||
|
@ -1670,11 +1645,11 @@ QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const
|
||||||
// sac, cns, otu - headings
|
// sac, cns, otu - headings
|
||||||
if (col == 3) {
|
if (col == 3) {
|
||||||
if (row == 2)
|
if (row == 2)
|
||||||
return QString(tr("SAC"));
|
return tr("SAC");
|
||||||
if (row == 4)
|
if (row == 4)
|
||||||
return QString(tr("Max. CNS"));
|
return tr("Max. CNS");
|
||||||
if (row == 6)
|
if (row == 6)
|
||||||
return QString(tr("OTU"));
|
return tr("OTU");
|
||||||
}
|
}
|
||||||
// sac, cns, otu - data
|
// sac, cns, otu - data
|
||||||
if (col == 4) {
|
if (col == 4) {
|
||||||
|
@ -1687,13 +1662,13 @@ QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
// weights heading
|
// weights heading
|
||||||
if (row == 2 && col == 5)
|
if (row == 2 && col == 5)
|
||||||
return QString(tr("Weights"));
|
return tr("Weights");
|
||||||
// total weight
|
// total weight
|
||||||
if (row == 9) {
|
if (row == 9) {
|
||||||
weight_t tw = { total_weight(dive) };
|
weight_t tw = { total_weight(dive) };
|
||||||
if (tw.grams) {
|
if (tw.grams) {
|
||||||
if (col == 5)
|
if (col == 5)
|
||||||
return QString("Total weight");
|
return tr("Total weight");
|
||||||
if (col == 6)
|
if (col == 6)
|
||||||
return get_weight_string(tw, true);
|
return get_weight_string(tw, true);
|
||||||
}
|
}
|
||||||
|
@ -1712,7 +1687,7 @@ QVariant ProfilePrintModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return empty;
|
return QString();
|
||||||
}
|
}
|
||||||
case Qt::FontRole: {
|
case Qt::FontRole: {
|
||||||
QFont font;
|
QFont font;
|
||||||
|
|
|
@ -67,8 +67,6 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
|
||||||
|
|
||||||
setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
||||||
setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* since we cannot use translate() directly on the scene we hack on
|
/* since we cannot use translate() directly on the scene we hack on
|
||||||
|
@ -286,7 +284,6 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
|
||||||
|
|
||||||
/* Depth profile */
|
/* Depth profile */
|
||||||
plot_depth_profile();
|
plot_depth_profile();
|
||||||
|
|
||||||
plot_events(dc);
|
plot_events(dc);
|
||||||
|
|
||||||
if (rulerEnabled && !printMode)
|
if (rulerEnabled && !printMode)
|
||||||
|
@ -300,11 +297,8 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
|
||||||
|
|
||||||
/* Text on top of all graphs.. */
|
/* Text on top of all graphs.. */
|
||||||
plot_temperature_text();
|
plot_temperature_text();
|
||||||
|
|
||||||
plot_depth_text();
|
plot_depth_text();
|
||||||
|
|
||||||
plot_cylinder_pressure_text();
|
plot_cylinder_pressure_text();
|
||||||
|
|
||||||
plot_deco_text();
|
plot_deco_text();
|
||||||
|
|
||||||
/* Put the dive computer name in the lower left corner */
|
/* Put the dive computer name in the lower left corner */
|
||||||
|
@ -649,7 +643,6 @@ void ProfileGraphicsView::plot_depth_sample(struct plot_data *entry,text_render_
|
||||||
plot_text(tro, QPointF(sec, entry->depth), QString("%1").arg(d, 0, 'f', 1));
|
plot_text(tro, QPointF(sec, entry->depth), QString("%1").arg(d, 0, 'f', 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProfileGraphicsView::plot_temperature_text()
|
void ProfileGraphicsView::plot_temperature_text()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -768,13 +761,11 @@ void ProfileGraphicsView::plot_cylinder_pressure(struct divecomputer *dc)
|
||||||
scene()->addItem(item);
|
scene()->addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
from = QPointF(SCALEGC(entry->sec, mbar));
|
from = QPointF(SCALEGC(entry->sec, mbar));
|
||||||
last_index = entry->cylinderindex;
|
last_index = entry->cylinderindex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* set the color for the pressure plot according to temporary sac rate
|
/* set the color for the pressure plot according to temporary sac rate
|
||||||
* as compared to avg_sac; the calculation simply maps the delta between
|
* as compared to avg_sac; the calculation simply maps the delta between
|
||||||
* sac and avg_sac to indexes 0 .. (SAC_COLORS - 1) with everything
|
* sac and avg_sac to indexes 0 .. (SAC_COLORS - 1) with everything
|
||||||
|
@ -926,7 +917,6 @@ void ProfileGraphicsView::remove_ruler()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProfileGraphicsView::plot_depth_profile()
|
void ProfileGraphicsView::plot_depth_profile()
|
||||||
{
|
{
|
||||||
int i, incr;
|
int i, incr;
|
||||||
|
@ -1324,7 +1314,6 @@ void ToolTipItem::clear()
|
||||||
|
|
||||||
void ToolTipItem::setRect(const QRectF& r)
|
void ToolTipItem::setRect(const QRectF& r)
|
||||||
{
|
{
|
||||||
|
|
||||||
// qDeleteAll(childItems());
|
// qDeleteAll(childItems());
|
||||||
delete background;
|
delete background;
|
||||||
|
|
||||||
|
@ -1355,7 +1344,6 @@ void ToolTipItem::setRect(const QRectF& r)
|
||||||
updateTitlePosition();
|
updateTitlePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ToolTipItem::collapse()
|
void ToolTipItem::collapse()
|
||||||
{
|
{
|
||||||
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect");
|
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect");
|
||||||
|
@ -1370,10 +1358,8 @@ void ToolTipItem::collapse()
|
||||||
|
|
||||||
void ToolTipItem::expand()
|
void ToolTipItem::expand()
|
||||||
{
|
{
|
||||||
|
if (!title)
|
||||||
if (!title) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
double width = 0, height = title->boundingRect().height() + SPACING;
|
double width = 0, height = title->boundingRect().height() + SPACING;
|
||||||
Q_FOREACH(ToolTip t, toolTips) {
|
Q_FOREACH(ToolTip t, toolTips) {
|
||||||
|
@ -1418,7 +1404,6 @@ ToolTipItem::~ToolTipItem()
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ToolTipItem::updateTitlePosition()
|
void ToolTipItem::updateTitlePosition()
|
||||||
{
|
{
|
||||||
if (rectangle.width() < title->boundingRect().width() + SPACING*4) {
|
if (rectangle.width() < title->boundingRect().width() + SPACING*4) {
|
||||||
|
@ -1532,8 +1517,6 @@ EventItem::EventItem(QGraphicsItem* parent, bool grayscale): QGraphicsPolygonIte
|
||||||
ball->setPen(QPen(getColor(ALERT_FG)));
|
ball->setPen(QPen(getColor(ALERT_FG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RulerNodeItem::RulerNodeItem(QGraphicsItem *parent, graphics_context context) : QGraphicsEllipseItem(parent), gc(context), entry(NULL) , ruler(NULL)
|
RulerNodeItem::RulerNodeItem(QGraphicsItem *parent, graphics_context context) : QGraphicsEllipseItem(parent), gc(context), entry(NULL) , ruler(NULL)
|
||||||
{
|
{
|
||||||
setRect(QRect(QPoint(-8,8),QPoint(8,-8)));
|
setRect(QRect(QPoint(-8,8),QPoint(8,-8)));
|
||||||
|
|
|
@ -61,7 +61,6 @@ double MinMaxAvgWidget::minimum() const
|
||||||
|
|
||||||
MinMaxAvgWidget::MinMaxAvgWidget(QWidget* parent)
|
MinMaxAvgWidget::MinMaxAvgWidget(QWidget* parent)
|
||||||
: d(new MinMaxAvgWidgetPrivate(this)){
|
: d(new MinMaxAvgWidgetPrivate(this)){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinMaxAvgWidget::clear()
|
void MinMaxAvgWidget::clear()
|
||||||
|
|
Loading…
Add table
Reference in a new issue