2013-04-13 20:44:02 -07:00
|
|
|
/*
|
|
|
|
* divelistview.h
|
|
|
|
*
|
|
|
|
* header file for the dive list of Subsurface
|
|
|
|
*
|
|
|
|
*/
|
2013-04-12 08:24:07 +01:00
|
|
|
#ifndef DIVELISTVIEW_H
|
|
|
|
#define DIVELISTVIEW_H
|
|
|
|
|
|
|
|
/*! A view subclass for use with dives
|
|
|
|
Note: calling this a list view might be misleading?
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QTreeView>
|
2014-02-09 18:18:54 +01:00
|
|
|
#include <QLineEdit>
|
2013-05-28 17:07:43 -03:00
|
|
|
#include "models.h"
|
2013-04-12 08:24:07 +01:00
|
|
|
|
|
|
|
class DiveListView : public QTreeView
|
|
|
|
{
|
2013-05-14 08:18:26 -03:00
|
|
|
Q_OBJECT
|
2013-04-12 08:24:07 +01:00
|
|
|
public:
|
|
|
|
DiveListView(QWidget *parent = 0);
|
2013-11-08 20:30:17 -02:00
|
|
|
~DiveListView();
|
2013-05-13 22:14:59 -03:00
|
|
|
void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
2013-05-14 08:18:26 -03:00
|
|
|
void currentChanged(const QModelIndex& current, const QModelIndex& previous);
|
2013-06-06 11:22:08 +09:00
|
|
|
void reload(DiveTripModel::Layout layout, bool forceSort = true);
|
2013-05-30 01:04:42 -03:00
|
|
|
bool eventFilter(QObject* , QEvent* );
|
2013-06-05 15:41:52 +09:00
|
|
|
void unselectDives();
|
2013-11-16 18:41:47 -02:00
|
|
|
void selectDive(int dive_table_idx, bool scrollto = false, bool toggle = false);
|
2013-12-02 17:15:40 -02:00
|
|
|
void selectDives(const QList<int>& newDiveSelection);
|
2013-11-14 17:52:03 +09:00
|
|
|
void rememberSelection();
|
|
|
|
void restoreSelection();
|
2013-06-06 09:06:42 +09:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
2013-11-26 15:44:18 -02:00
|
|
|
QList<dive_trip_t*> selectedTrips();
|
2013-05-21 16:51:49 -03:00
|
|
|
public slots:
|
2013-05-26 10:12:45 -07:00
|
|
|
void toggleColumnVisibilityByIndex();
|
|
|
|
void reloadHeaderActions();
|
2013-05-28 17:07:43 -03:00
|
|
|
void headerClicked(int);
|
2013-05-30 01:04:42 -03:00
|
|
|
void showSearchEdit();
|
2013-06-06 09:06:42 +09:00
|
|
|
void removeFromTrip();
|
2013-06-06 10:37:18 +09:00
|
|
|
void deleteDive();
|
2013-12-06 17:40:59 -08:00
|
|
|
void markDiveInvalid();
|
2013-06-06 09:06:42 +09:00
|
|
|
void testSlot();
|
2013-06-12 14:14:25 -03:00
|
|
|
void fixMessyQtModelBehaviour();
|
2013-06-26 19:16:40 -10:00
|
|
|
void mergeTripAbove();
|
|
|
|
void mergeTripBelow();
|
2013-11-15 11:32:19 +09:00
|
|
|
void newTripAbove();
|
2013-11-17 15:36:57 -08:00
|
|
|
void addToTripAbove();
|
2013-09-23 21:57:28 -07:00
|
|
|
void mergeDives();
|
2013-10-17 21:50:08 -03:00
|
|
|
void saveSelectedDivesAs();
|
2013-10-19 20:35:36 +03:00
|
|
|
void exportSelectedDivesAsUDDF();
|
2013-11-18 14:53:05 +01:00
|
|
|
void shiftTimes();
|
2014-01-27 14:44:26 +01:00
|
|
|
void loadImages();
|
2013-12-05 18:28:28 +02:00
|
|
|
void uploadToDivelogsDE();
|
2013-06-14 09:17:46 -07:00
|
|
|
|
2013-06-19 10:20:16 -07:00
|
|
|
signals:
|
2013-05-14 08:18:26 -03:00
|
|
|
void currentDiveChanged(int divenr);
|
2013-06-06 09:06:42 +09:00
|
|
|
|
2013-05-13 22:14:59 -03:00
|
|
|
private:
|
|
|
|
bool mouseClickSelection;
|
2013-11-08 21:08:14 -02:00
|
|
|
QList<int> expandedRows;
|
2013-11-05 14:09:08 +09:00
|
|
|
int sortColumn;
|
|
|
|
Qt::SortOrder currentOrder;
|
2013-05-29 16:46:27 -03:00
|
|
|
DiveTripModel::Layout currentLayout;
|
2014-02-09 18:18:54 +01:00
|
|
|
QLineEdit searchBox;
|
2013-06-06 09:06:42 +09:00
|
|
|
QModelIndex contextMenuIndex;
|
2013-11-26 15:44:18 -02:00
|
|
|
|
|
|
|
/* if dive_trip_t is null, there's no problem. */
|
|
|
|
QMultiHash<dive_trip_t *, int> selectedDives;
|
2013-06-26 19:16:40 -10:00
|
|
|
void merge_trip(const QModelIndex &a, const int offset);
|
2013-11-08 20:30:17 -02:00
|
|
|
void setupUi();
|
2013-11-08 21:08:14 -02:00
|
|
|
void backupExpandedRows();
|
|
|
|
void restoreExpandedRows();
|
2013-11-13 16:59:56 -02:00
|
|
|
int lastVisibleColumn();
|
2013-11-26 15:44:18 -02:00
|
|
|
void selectTrip ( dive_trip_t* trip );
|
2014-01-27 14:44:26 +01:00
|
|
|
QString lastUsedImageDir();
|
|
|
|
void updateLastUsedImageDir(const QString& s);
|
2013-04-12 08:24:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DIVELISTVIEW_H
|