| 
									
										
										
										
											2017-04-27 20:26:05 +02:00
										 |  |  | // SPDX-License-Identifier: GPL-2.0
 | 
					
						
							| 
									
										
										
										
											2013-06-04 18:51:27 -03:00
										 |  |  | #ifndef SIMPLEWIDGETS_H
 | 
					
						
							|  |  |  | #define SIMPLEWIDGETS_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class MinMaxAvgWidgetPrivate; | 
					
						
							| 
									
										
										
										
											2013-06-17 13:41:00 -03:00
										 |  |  | class QAbstractButton; | 
					
						
							| 
									
										
										
										
											2014-12-24 13:23:31 -02:00
										 |  |  | class QNetworkReply; | 
					
						
							| 
									
										
										
										
											2017-12-23 14:17:23 +01:00
										 |  |  | class FilterModelBase; | 
					
						
							| 
									
										
										
										
											2013-06-17 13:41:00 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-04 18:51:27 -03:00
										 |  |  | #include <QWidget>
 | 
					
						
							| 
									
										
										
										
											2015-02-11 13:13:52 -02:00
										 |  |  | #include <QGroupBox>
 | 
					
						
							| 
									
										
										
										
											2013-06-17 13:41:00 -03:00
										 |  |  | #include <QDialog>
 | 
					
						
							| 
									
										
										
										
											2017-01-11 10:25:07 +01:00
										 |  |  | #include <QTextEdit>
 | 
					
						
							| 
									
										
										
										
											2014-03-25 12:54:37 -05:00
										 |  |  | #include <stdint.h>
 | 
					
						
							| 
									
										
										
										
											2013-06-04 18:51:27 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-03 15:38:49 -07:00
										 |  |  | #include "ui_renumber.h"
 | 
					
						
							| 
									
										
										
										
											2014-11-25 21:22:02 +01:00
										 |  |  | #include "ui_setpoint.h"
 | 
					
						
							| 
									
										
										
										
											2013-11-18 14:53:05 +01:00
										 |  |  | #include "ui_shifttimes.h"
 | 
					
						
							| 
									
										
										
										
											2014-01-27 14:44:26 +01:00
										 |  |  | #include "ui_shiftimagetimes.h"
 | 
					
						
							| 
									
										
										
										
											2015-04-24 17:10:55 +02:00
										 |  |  | #include "ui_urldialog.h"
 | 
					
						
							| 
									
										
										
										
											2014-08-16 09:32:23 -06:00
										 |  |  | #include "ui_divecomponentselection.h"
 | 
					
						
							| 
									
										
										
										
											2014-10-31 16:01:28 -02:00
										 |  |  | #include "ui_listfilter.h"
 | 
					
						
							| 
									
										
										
										
											2016-04-04 22:02:03 -07:00
										 |  |  | #include "core/exif.h"
 | 
					
						
							|  |  |  | #include "core/dive.h"
 | 
					
						
							| 
									
										
										
										
											2013-10-03 11:54:24 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-24 13:23:31 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | class MinMaxAvgWidget : public QWidget { | 
					
						
							| 
									
										
										
										
											2013-06-04 18:51:27 -03:00
										 |  |  | 	Q_OBJECT | 
					
						
							| 
									
										
										
										
											2019-05-31 19:28:45 +02:00
										 |  |  | 	QLabel *avgIco, *avgValue; | 
					
						
							|  |  |  | 	QLabel *minIco, *minValue; | 
					
						
							|  |  |  | 	QLabel *maxIco, *maxValue; | 
					
						
							| 
									
										
										
										
											2013-06-04 18:51:27 -03:00
										 |  |  | public: | 
					
						
							|  |  |  | 	MinMaxAvgWidget(QWidget *parent); | 
					
						
							|  |  |  | 	double minimum() const; | 
					
						
							|  |  |  | 	double maximum() const; | 
					
						
							|  |  |  | 	double average() const; | 
					
						
							|  |  |  | 	void setMinimum(double minimum); | 
					
						
							|  |  |  | 	void setMaximum(double maximum); | 
					
						
							|  |  |  | 	void setAverage(double average); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 	void setMinimum(const QString &minimum); | 
					
						
							|  |  |  | 	void setMaximum(const QString &maximum); | 
					
						
							|  |  |  | 	void setAverage(const QString &average); | 
					
						
							| 
									
										
										
										
											2014-05-30 23:46:55 +01:00
										 |  |  | 	void overrideMinToolTipText(const QString &newTip); | 
					
						
							| 
									
										
										
										
											2014-11-17 18:40:08 +00:00
										 |  |  | 	void overrideAvgToolTipText(const QString &newTip); | 
					
						
							| 
									
										
										
										
											2014-05-30 23:46:55 +01:00
										 |  |  | 	void overrideMaxToolTipText(const QString &newTip); | 
					
						
							| 
									
										
										
										
											2019-05-31 19:28:45 +02:00
										 |  |  | 	void setAvgVisibility(bool visible); | 
					
						
							| 
									
										
										
										
											2013-06-04 18:51:27 -03:00
										 |  |  | 	void clear(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-17 13:41:00 -03:00
										 |  |  | class RenumberDialog : public QDialog { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	static RenumberDialog *instance(); | 
					
						
							| 
									
										
										
										
											2014-05-20 06:11:32 +09:00
										 |  |  | 	void renumberOnlySelected(bool selected = true); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | private | 
					
						
							|  |  |  | slots: | 
					
						
							| 
									
										
										
										
											2013-06-17 13:41:00 -03:00
										 |  |  | 	void buttonClicked(QAbstractButton *button); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-17 13:41:00 -03:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2013-11-30 09:18:04 -08:00
										 |  |  | 	explicit RenumberDialog(QWidget *parent); | 
					
						
							| 
									
										
										
										
											2013-10-03 11:54:25 -07:00
										 |  |  | 	Ui::RenumberDialog ui; | 
					
						
							| 
									
										
										
										
											2014-05-20 06:11:32 +09:00
										 |  |  | 	bool selectedOnly; | 
					
						
							| 
									
										
										
										
											2013-06-17 13:41:00 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-25 21:22:02 +01:00
										 |  |  | class SetpointDialog : public QDialog { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	static SetpointDialog *instance(); | 
					
						
							|  |  |  | 	void setpointData(struct divecomputer *divecomputer, int time); | 
					
						
							|  |  |  | private | 
					
						
							|  |  |  | slots: | 
					
						
							|  |  |  | 	void buttonClicked(QAbstractButton *button); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	explicit SetpointDialog(QWidget *parent); | 
					
						
							|  |  |  | 	Ui::SetpointDialog ui; | 
					
						
							|  |  |  | 	struct divecomputer *dc; | 
					
						
							|  |  |  | 	int time; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-18 14:53:05 +01:00
										 |  |  | class ShiftTimesDialog : public QDialog { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	static ShiftTimesDialog *instance(); | 
					
						
							| 
									
										
										
										
											2014-05-22 11:40:22 -07:00
										 |  |  | 	void showEvent(QShowEvent *event); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | private | 
					
						
							|  |  |  | slots: | 
					
						
							| 
									
										
										
										
											2013-11-18 14:53:05 +01:00
										 |  |  | 	void buttonClicked(QAbstractButton *button); | 
					
						
							| 
									
										
										
										
											2014-05-22 11:40:22 -07:00
										 |  |  | 	void changeTime(); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-18 14:53:05 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2013-11-30 09:18:04 -08:00
										 |  |  | 	explicit ShiftTimesDialog(QWidget *parent); | 
					
						
							| 
									
										
										
										
											2014-03-20 22:57:49 +02:00
										 |  |  | 	int64_t when; | 
					
						
							| 
									
										
										
										
											2013-11-18 14:53:05 +01:00
										 |  |  | 	Ui::ShiftTimesDialog ui; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-27 14:44:26 +01:00
										 |  |  | class ShiftImageTimesDialog : public QDialog { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2015-03-14 17:44:24 +01:00
										 |  |  | 	explicit ShiftImageTimesDialog(QWidget *parent, QStringList fileNames); | 
					
						
							| 
									
										
										
										
											2014-02-13 16:43:55 +01:00
										 |  |  | 	time_t amount() const; | 
					
						
							|  |  |  | 	void setOffset(time_t offset); | 
					
						
							| 
									
										
										
										
											2015-09-11 11:31:02 +02:00
										 |  |  | 	bool matchAll(); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | private | 
					
						
							|  |  |  | slots: | 
					
						
							| 
									
										
										
										
											2014-01-27 14:44:26 +01:00
										 |  |  | 	void buttonClicked(QAbstractButton *button); | 
					
						
							| 
									
										
										
										
											2014-02-13 16:43:55 +01:00
										 |  |  | 	void syncCameraClicked(); | 
					
						
							|  |  |  | 	void dcDateTimeChanged(const QDateTime &); | 
					
						
							| 
									
										
										
										
											2015-03-14 17:44:24 +01:00
										 |  |  | 	void timeEditChanged(const QTime &time); | 
					
						
							| 
									
										
										
										
											2017-04-30 22:24:08 +02:00
										 |  |  | 	void timeEditChanged(); | 
					
						
							| 
									
										
										
										
											2015-03-14 17:44:24 +01:00
										 |  |  | 	void updateInvalid(); | 
					
						
							| 
									
										
										
										
											2015-09-11 11:31:02 +02:00
										 |  |  | 	void matchAllImagesToggled(bool); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-27 14:44:26 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2015-03-14 17:44:24 +01:00
										 |  |  | 	QStringList fileNames; | 
					
						
							| 
									
										
										
										
											2018-09-17 17:34:13 +02:00
										 |  |  | 	QVector<timestamp_t> timestamps; | 
					
						
							| 
									
										
										
										
											2014-01-27 14:44:26 +01:00
										 |  |  | 	Ui::ShiftImageTimesDialog ui; | 
					
						
							| 
									
										
										
										
											2014-02-13 16:43:55 +01:00
										 |  |  | 	time_t m_amount; | 
					
						
							|  |  |  | 	time_t dcImageEpoch; | 
					
						
							| 
									
										
										
										
											2015-09-11 11:31:02 +02:00
										 |  |  | 	bool matchAllImages; | 
					
						
							| 
									
										
										
										
											2014-01-27 14:44:26 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-24 17:10:55 +02:00
										 |  |  | class URLDialog : public QDialog { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	explicit URLDialog(QWidget *parent); | 
					
						
							|  |  |  | 	QString url() const; | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	Ui::URLDialog ui; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-19 15:42:05 -03:00
										 |  |  | class QCalendarWidget; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-16 09:32:23 -06:00
										 |  |  | class DiveComponentSelection : public QDialog { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	explicit DiveComponentSelection(QWidget *parent, struct dive *target, struct dive_components *_what); | 
					
						
							|  |  |  | private | 
					
						
							|  |  |  | slots: | 
					
						
							|  |  |  | 	void buttonClicked(QAbstractButton *button); | 
					
						
							| 
									
										
										
										
											2014-09-17 15:39:49 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-16 09:32:23 -06:00
										 |  |  | private: | 
					
						
							|  |  |  | 	Ui::DiveComponentSelectionDialog ui; | 
					
						
							|  |  |  | 	struct dive *targetDive; | 
					
						
							|  |  |  | 	struct dive_components *what; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-15 20:56:24 -08:00
										 |  |  | class TextHyperlinkEventFilter : public QObject { | 
					
						
							| 
									
										
										
										
											2018-09-14 11:51:05 -07:00
										 |  |  | 	Q_OBJECT | 
					
						
							| 
									
										
										
										
											2015-11-15 20:56:24 -08:00
										 |  |  | public: | 
					
						
							|  |  |  | 	explicit TextHyperlinkEventFilter(QTextEdit *txtEdit); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-29 22:13:44 +02:00
										 |  |  | 	bool eventFilter(QObject *target, QEvent *evt) override; | 
					
						
							| 
									
										
										
										
											2015-11-15 20:56:24 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	void handleUrlClick(const QString &urlStr); | 
					
						
							|  |  |  | 	void handleUrlTooltip(const QString &urlStr, const QPoint &pos); | 
					
						
							|  |  |  | 	bool stringMeetsOurUrlRequirements(const QString &maybeUrlStr); | 
					
						
							|  |  |  | 	QString fromCursorTilWhitespace(QTextCursor *cursor, const bool searchBackwards); | 
					
						
							|  |  |  | 	QString tryToFormulateUrl(QTextCursor *cursor); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QTextEdit const *const textEdit; | 
					
						
							|  |  |  | 	QWidget const *const scrollView; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Q_DISABLE_COPY(TextHyperlinkEventFilter) | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-27 12:52:01 -03:00
										 |  |  | bool isGnome3Session(); | 
					
						
							| 
									
										
										
										
											2014-09-17 15:39:49 -07:00
										 |  |  | QImage grayImage(const QImage &coloredImg); | 
					
						
							| 
									
										
										
										
											2013-09-27 12:52:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-11 19:14:46 +01:00
										 |  |  | #endif // SIMPLEWIDGETS_H
 |