diff options
-rw-r--r-- | qt-ui/divepicturewidget.cpp | 9 | ||||
-rw-r--r-- | qt-ui/divepicturewidget.h | 2 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 6 | ||||
-rw-r--r-- | qt-ui/maintab.h | 1 | ||||
-rw-r--r-- | qt-ui/maintab.ui | 14 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 5 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 1 |
7 files changed, 19 insertions, 19 deletions
diff --git a/qt-ui/divepicturewidget.cpp b/qt-ui/divepicturewidget.cpp index 01e52d6e8..916345346 100644 --- a/qt-ui/divepicturewidget.cpp +++ b/qt-ui/divepicturewidget.cpp @@ -9,7 +9,6 @@ void DivePictureDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o DivePictureModel::DivePictureModel(QObject *parent): QAbstractTableModel(parent) { - } typedef QPair<QString, QPixmap> SPixmap; @@ -53,7 +52,7 @@ void DivePictureModel::updateDivePictures(int divenr) int DivePictureModel::columnCount(const QModelIndex &parent) const { - + return 1; } QVariant DivePictureModel::data(const QModelIndex &index, int role) const @@ -64,9 +63,10 @@ QVariant DivePictureModel::data(const QModelIndex &index, int role) const QString key = stringPixmapCache.keys().at(index.row()); switch(role){ - case Qt::DisplayRole : return key; - case Qt::DecorationRole : return stringPixmapCache[key]; + case Qt::DisplayRole : ret = key; break; + case Qt::DecorationRole : ret = stringPixmapCache[key]; break; } + return ret; } int DivePictureModel::rowCount(const QModelIndex &parent) const @@ -76,5 +76,4 @@ int DivePictureModel::rowCount(const QModelIndex &parent) const DivePictureWidget::DivePictureWidget(QWidget *parent): QListView(parent) { - } diff --git a/qt-ui/divepicturewidget.h b/qt-ui/divepicturewidget.h index ff8d1aa8f..9fb5465df 100644 --- a/qt-ui/divepicturewidget.h +++ b/qt-ui/divepicturewidget.h @@ -6,7 +6,7 @@ #include <QListView> #include <QThread> -class DivePictureModel : QAbstractTableModel { +class DivePictureModel : public QAbstractTableModel { Q_OBJECT public: DivePictureModel(QObject *parent); diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index e08ba8426..7c28a4972 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -16,6 +16,7 @@ #include "divelist.h" #include "qthelper.h" #include "display.h" +#include "divepicturewidget.h" #include <QLabel> #include <QCompleter> @@ -29,7 +30,8 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), weightModel(new WeightModel(this)), cylindersModel(CylindersModel::instance()), - editMode(NONE) + editMode(NONE), + divePictureModel(new DivePictureModel(this)) { ui.setupUi(this); @@ -37,6 +39,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.cylinders->setModel(cylindersModel); ui.weights->setModel(weightModel); + ui.photosView->setModel(divePictureModel); closeMessage(); QAction *action = new QAction(tr("Save"), this); @@ -371,6 +374,7 @@ void MainTab::updateDiveInfo(int dive) process_selected_dives(); process_all_dives(d, &prevd); + divePictureModel->updateDivePictures(dive); UPDATE_TEXT(d, notes); UPDATE_TEXT(d, location); UPDATE_TEXT(d, suit); diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index b8a5f2d7f..4d6a0e139 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -93,6 +93,7 @@ private: LocationCompletionModel locationModel; SuitCompletionModel suitModel; TagCompletionModel tagModel; + DivePictureModel *divePictureModel; struct dive editedDive; // when editing we do all changes on a copy of the real data and only apply when saved Completers completers; void resetPallete(); diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index 31ed1309d..0998db22f 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -289,8 +289,8 @@ <rect> <x>0</x> <y>0</y> - <width>662</width> - <height>649</height> + <width>100</width> + <height>30</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_5"> @@ -369,8 +369,8 @@ <rect> <x>0</x> <y>0</y> - <width>662</width> - <height>649</height> + <width>399</width> + <height>325</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_6"> @@ -679,8 +679,8 @@ <rect> <x>0</x> <y>0</y> - <width>662</width> - <height>649</height> + <width>267</width> + <height>115</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_7"> @@ -819,7 +819,7 @@ </attribute> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="DivePictureWidget" name="listView"/> + <widget class="DivePictureWidget" name="photosView"/> </item> </layout> </widget> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 964d2bbc2..af2fcf5c7 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -59,8 +59,7 @@ MainWindow::MainWindow() : QMainWindow(), yearlyStatsModel(0), state(VIEWALL), updateManager(0), - fakeDiveId(0), - divePictureModel(new DivePictureModel(this)) + fakeDiveId(0) { Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!"); m_Instance = this; @@ -90,7 +89,6 @@ MainWindow::MainWindow() : QMainWindow(), ui.ListWidget->expand(ui.ListWidget->model()->index(0, 0)); ui.ListWidget->scrollTo(ui.ListWidget->model()->index(0, 0), QAbstractItemView::PositionAtCenter); ui.divePlannerWidget->settingsChanged(); - #ifdef NO_MARBLE ui.layoutWidget->hide(); ui.menuView->removeAction(ui.actionViewGlobe); @@ -166,7 +164,6 @@ void MainWindow::current_dive_changed(int divenr) */ ui.newProfile->plotDives(QList<dive *>() << (current_dive)); ui.InfoWidget->updateDiveInfo(divenr); - divePictureModel->updateDivePictures(divenr); } void MainWindow::on_actionNew_triggered() diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index c8c792ed4..57c205ba4 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -180,7 +180,6 @@ private: bool plannerStateClean(); void createFakeDiveForAddAndPlan(); int fakeDiveId; - DivePictureModel *divePictureModel; }; #endif // MAINWINDOW_H |