mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Make the new picture widget display the pictures.
Small changes in the model to display the pictures of the dives. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									2cded299ac
								
							
						
					
					
						commit
						3595ad0294
					
				
					 7 changed files with 19 additions and 19 deletions
				
			
		|  | @ -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) | ||||
| { | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| #include <QListView> | ||||
| #include <QThread> | ||||
| 
 | ||||
| class DivePictureModel : QAbstractTableModel { | ||||
| class DivePictureModel : public QAbstractTableModel { | ||||
| Q_OBJECT | ||||
| public: | ||||
| 	DivePictureModel(QObject *parent); | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -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> | ||||
|  |  | |||
|  | @ -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() | ||||
|  |  | |||
|  | @ -180,7 +180,6 @@ private: | |||
| 	bool plannerStateClean(); | ||||
| 	void createFakeDiveForAddAndPlan(); | ||||
| 	int fakeDiveId; | ||||
| 	DivePictureModel *divePictureModel; | ||||
| }; | ||||
| 
 | ||||
| #endif // MAINWINDOW_H
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue