diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-03 16:48:59 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-03 16:49:56 -0700 |
commit | 1fec6453a2b7b6dcd34901a4e92dd11aae38879c (patch) | |
tree | a8d89da80007b58374662893ce09103a57f5d9ae /qt-ui/divepicturewidget.cpp | |
parent | 3e46b4862ab919981e098cd3a3cfc5c12e2fd6c3 (diff) | |
download | subsurface-1fec6453a2b7b6dcd34901a4e92dd11aae38879c.tar.gz |
Another futile attempt to keep whitespace consistent
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divepicturewidget.cpp')
-rw-r--r-- | qt-ui/divepicturewidget.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/qt-ui/divepicturewidget.cpp b/qt-ui/divepicturewidget.cpp index 97b7bd25e..a5ca95c0f 100644 --- a/qt-ui/divepicturewidget.cpp +++ b/qt-ui/divepicturewidget.cpp @@ -10,7 +10,7 @@ void DivePictureDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o DivePictureModel *DivePictureModel::instance() { - static DivePictureModel* self = new DivePictureModel(); + static DivePictureModel *self = new DivePictureModel(); return self; } @@ -21,8 +21,9 @@ DivePictureModel::DivePictureModel() typedef QPair<QString, QImage> SPixmap; typedef QList<SPixmap> SPixmapList; -SPixmap scaleImages(const QString& s) { - QImage p = QImage(s).scaled(128,128, Qt::KeepAspectRatio); +SPixmap scaleImages(const QString &s) +{ + QImage p = QImage(s).scaled(128, 128, Qt::KeepAspectRatio); SPixmap ret; ret.first = s; ret.second = p; @@ -32,7 +33,7 @@ SPixmap scaleImages(const QString& s) { void DivePictureModel::updateDivePictures(int divenr) { if (numberOfPictures != 0) { - beginRemoveRows(QModelIndex(), 0, numberOfPictures-1); + beginRemoveRows(QModelIndex(), 0, numberOfPictures - 1); numberOfPictures = 0; endRemoveRows(); } @@ -45,17 +46,17 @@ void DivePictureModel::updateDivePictures(int divenr) stringPixmapCache.clear(); QStringList pictures; - FOR_EACH_PICTURE( d ) { + FOR_EACH_PICTURE (d) { stringPixmapCache[QString(picture->filename)].picture = picture; pictures.push_back(QString(picture->filename)); } - SPixmapList retList = QtConcurrent::blockingMapped<SPixmapList>( pictures, scaleImages); - Q_FOREACH(const SPixmap & pixmap, retList) + SPixmapList retList = QtConcurrent::blockingMapped<SPixmapList>(pictures, scaleImages); + Q_FOREACH (const SPixmap &pixmap, retList) stringPixmapCache[pixmap.first].image = pixmap.second; - beginInsertRows(QModelIndex(), 0, numberOfPictures-1); + beginInsertRows(QModelIndex(), 0, numberOfPictures - 1); endInsertRows(); } @@ -71,16 +72,21 @@ QVariant DivePictureModel::data(const QModelIndex &index, int role) const return ret; QString key = stringPixmapCache.keys().at(index.row()); - if(index.column() == 0){ - switch(role){ - case Qt::ToolTipRole : ret = key; break; - case Qt::DecorationRole : ret = stringPixmapCache[key].image; break; - case Qt::DisplayRole : ret = QFileInfo(key).fileName(); + if (index.column() == 0) { + switch (role) { + case Qt::ToolTipRole: + ret = key; + break; + case Qt::DecorationRole: + ret = stringPixmapCache[key].image; + break; + case Qt::DisplayRole: + ret = QFileInfo(key).fileName(); } - } - else if (index.column() == 1){ - switch(role){ - case Qt::UserRole : ret = QVariant::fromValue( (void*) stringPixmapCache[key].picture); + } else if (index.column() == 1) { + switch (role) { + case Qt::UserRole: + ret = QVariant::fromValue((void *)stringPixmapCache[key].picture); } } return ret; @@ -91,6 +97,6 @@ int DivePictureModel::rowCount(const QModelIndex &parent) const return numberOfPictures; } -DivePictureWidget::DivePictureWidget(QWidget *parent): QListView(parent) +DivePictureWidget::DivePictureWidget(QWidget *parent) : QListView(parent) { } |