2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-06-04 21:51:27 +00:00
|
|
|
#ifndef SIMPLEWIDGETS_H
|
|
|
|
#define SIMPLEWIDGETS_H
|
|
|
|
|
|
|
|
class MinMaxAvgWidgetPrivate;
|
2013-06-17 16:41:00 +00:00
|
|
|
class QAbstractButton;
|
2014-12-24 15:23:31 +00:00
|
|
|
class QNetworkReply;
|
2017-12-23 13:17:23 +00:00
|
|
|
class FilterModelBase;
|
2020-10-26 15:56:46 +00:00
|
|
|
struct dive;
|
|
|
|
struct dive_components;
|
2013-06-17 16:41:00 +00:00
|
|
|
|
2020-10-26 15:56:46 +00:00
|
|
|
#include "core/units.h"
|
2013-06-04 21:51:27 +00:00
|
|
|
#include <QWidget>
|
2015-02-11 15:13:52 +00:00
|
|
|
#include <QGroupBox>
|
2013-06-17 16:41:00 +00:00
|
|
|
#include <QDialog>
|
2017-01-11 09:25:07 +00:00
|
|
|
#include <QTextEdit>
|
2013-06-04 21:51:27 +00:00
|
|
|
|
2013-10-03 22:38:49 +00:00
|
|
|
#include "ui_renumber.h"
|
2014-11-25 20:22:02 +00:00
|
|
|
#include "ui_setpoint.h"
|
2013-11-18 13:53:05 +00:00
|
|
|
#include "ui_shifttimes.h"
|
2014-01-27 13:44:26 +00:00
|
|
|
#include "ui_shiftimagetimes.h"
|
2015-04-24 15:10:55 +00:00
|
|
|
#include "ui_urldialog.h"
|
2014-08-16 15:32:23 +00:00
|
|
|
#include "ui_divecomponentselection.h"
|
2014-10-31 18:01:28 +00:00
|
|
|
#include "ui_listfilter.h"
|
2020-05-27 21:09:30 +00:00
|
|
|
#include "ui_addfilterpreset.h"
|
2014-12-24 15:23:31 +00:00
|
|
|
|
2013-06-17 16:41:00 +00:00
|
|
|
class RenumberDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-05-27 12:00:47 +00:00
|
|
|
explicit RenumberDialog(bool selectedOnly, QWidget *parent);
|
2014-02-28 04:09:57 +00:00
|
|
|
private
|
|
|
|
slots:
|
2013-06-17 16:41:00 +00:00
|
|
|
void buttonClicked(QAbstractButton *button);
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2013-06-17 16:41:00 +00:00
|
|
|
private:
|
2013-10-03 18:54:25 +00:00
|
|
|
Ui::RenumberDialog ui;
|
2014-05-19 21:11:32 +00:00
|
|
|
bool selectedOnly;
|
2013-06-17 16:41:00 +00:00
|
|
|
};
|
|
|
|
|
2014-11-25 20:22:02 +00:00
|
|
|
class SetpointDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-03-03 22:17:08 +00:00
|
|
|
SetpointDialog(struct dive *d, int dcNr, int time);
|
2014-11-25 20:22:02 +00:00
|
|
|
private
|
|
|
|
slots:
|
|
|
|
void buttonClicked(QAbstractButton *button);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::SetpointDialog ui;
|
2020-03-03 22:17:08 +00:00
|
|
|
struct dive *d;
|
|
|
|
int dcNr;
|
2014-11-25 20:22:02 +00:00
|
|
|
int time;
|
|
|
|
};
|
|
|
|
|
2013-11-18 13:53:05 +00:00
|
|
|
class ShiftTimesDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2023-01-18 00:34:14 +00:00
|
|
|
// Must be called with non-empty dives vector!
|
|
|
|
explicit ShiftTimesDialog(std::vector<dive *> dives, QWidget *parent);
|
2014-02-28 04:09:57 +00:00
|
|
|
private
|
|
|
|
slots:
|
2013-11-18 13:53:05 +00:00
|
|
|
void buttonClicked(QAbstractButton *button);
|
2014-05-22 18:40:22 +00:00
|
|
|
void changeTime();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2013-11-18 13:53:05 +00:00
|
|
|
private:
|
2014-03-20 20:57:49 +00:00
|
|
|
int64_t when;
|
2023-01-18 00:34:14 +00:00
|
|
|
std::vector<dive *> dives;
|
2013-11-18 13:53:05 +00:00
|
|
|
Ui::ShiftTimesDialog ui;
|
|
|
|
};
|
|
|
|
|
2014-01-27 13:44:26 +00:00
|
|
|
class ShiftImageTimesDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-03-14 16:44:24 +00:00
|
|
|
explicit ShiftImageTimesDialog(QWidget *parent, QStringList fileNames);
|
2014-02-13 15:43:55 +00:00
|
|
|
time_t amount() const;
|
|
|
|
void setOffset(time_t offset);
|
2015-09-11 09:31:02 +00:00
|
|
|
bool matchAll();
|
2014-02-28 04:09:57 +00:00
|
|
|
private
|
|
|
|
slots:
|
2014-02-13 15:43:55 +00:00
|
|
|
void syncCameraClicked();
|
|
|
|
void dcDateTimeChanged(const QDateTime &);
|
2021-09-20 14:09:41 +00:00
|
|
|
void timeEdited(const QString &timeText);
|
|
|
|
void backwardsChanged(bool);
|
2015-03-14 16:44:24 +00:00
|
|
|
void updateInvalid();
|
2015-09-11 09:31:02 +00:00
|
|
|
void matchAllImagesToggled(bool);
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2014-01-27 13:44:26 +00:00
|
|
|
private:
|
2015-03-14 16:44:24 +00:00
|
|
|
QStringList fileNames;
|
2018-09-17 15:34:13 +00:00
|
|
|
QVector<timestamp_t> timestamps;
|
2014-01-27 13:44:26 +00:00
|
|
|
Ui::ShiftImageTimesDialog ui;
|
2014-02-13 15:43:55 +00:00
|
|
|
time_t m_amount;
|
|
|
|
time_t dcImageEpoch;
|
2015-09-11 09:31:02 +00:00
|
|
|
bool matchAllImages;
|
2014-01-27 13:44:26 +00:00
|
|
|
};
|
|
|
|
|
2015-04-24 15:10:55 +00:00
|
|
|
class URLDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit URLDialog(QWidget *parent);
|
|
|
|
QString url() const;
|
|
|
|
private:
|
|
|
|
Ui::URLDialog ui;
|
|
|
|
};
|
|
|
|
|
2014-08-16 15:32:23 +00: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 22:39:49 +00:00
|
|
|
|
2014-08-16 15:32:23 +00:00
|
|
|
private:
|
|
|
|
Ui::DiveComponentSelectionDialog ui;
|
|
|
|
struct dive *targetDive;
|
|
|
|
struct dive_components *what;
|
|
|
|
};
|
|
|
|
|
2020-05-27 21:09:30 +00:00
|
|
|
class AddFilterPresetDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-09-06 21:53:31 +00:00
|
|
|
explicit AddFilterPresetDialog(const QString &defaultName, QWidget *parent);
|
2020-05-27 21:09:30 +00:00
|
|
|
QString doit(); // returns name of filter preset or empty string if user cancelled the dialog
|
|
|
|
private
|
|
|
|
slots:
|
|
|
|
void nameChanged(const QString &text);
|
|
|
|
private:
|
|
|
|
Ui::AddFilterPresetDialog ui;
|
|
|
|
};
|
|
|
|
|
2015-11-16 04:56:24 +00:00
|
|
|
class TextHyperlinkEventFilter : public QObject {
|
2018-09-14 18:51:05 +00:00
|
|
|
Q_OBJECT
|
2015-11-16 04:56:24 +00:00
|
|
|
public:
|
|
|
|
explicit TextHyperlinkEventFilter(QTextEdit *txtEdit);
|
|
|
|
|
2018-09-29 20:13:44 +00:00
|
|
|
bool eventFilter(QObject *target, QEvent *evt) override;
|
2015-11-16 04:56:24 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void handleUrlClick(const QString &urlStr);
|
|
|
|
void handleUrlTooltip(const QString &urlStr, const QPoint &pos);
|
|
|
|
bool stringMeetsOurUrlRequirements(const QString &maybeUrlStr);
|
2020-02-06 21:56:10 +00:00
|
|
|
QString fromCursorTilWhitespace(QTextCursor *cursor, bool searchBackwards);
|
2015-11-16 04:56:24 +00:00
|
|
|
QString tryToFormulateUrl(QTextCursor *cursor);
|
|
|
|
|
|
|
|
QTextEdit const *const textEdit;
|
|
|
|
QWidget const *const scrollView;
|
|
|
|
|
|
|
|
Q_DISABLE_COPY(TextHyperlinkEventFilter)
|
|
|
|
};
|
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // SIMPLEWIDGETS_H
|