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;
|
2013-06-17 16:41:00 +00:00
|
|
|
|
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>
|
2014-03-25 17:54:37 +00:00
|
|
|
#include <stdint.h>
|
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"
|
2014-12-18 07:47:52 +00:00
|
|
|
#include "ui_filterwidget.h"
|
2016-04-05 05:02:03 +00:00
|
|
|
#include "core/exif.h"
|
|
|
|
#include "core/dive.h"
|
2013-10-03 18:54:24 +00:00
|
|
|
|
2014-12-24 15:23:31 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class MinMaxAvgWidget : public QWidget {
|
2013-06-04 21:51:27 +00:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
|
|
|
|
Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
|
|
|
|
Q_PROPERTY(double average READ average WRITE setAverage)
|
|
|
|
public:
|
|
|
|
MinMaxAvgWidget(QWidget *parent);
|
2013-11-30 17:18:02 +00:00
|
|
|
~MinMaxAvgWidget();
|
2013-06-04 21:51:27 +00:00
|
|
|
double minimum() const;
|
|
|
|
double maximum() const;
|
|
|
|
double average() const;
|
|
|
|
void setMinimum(double minimum);
|
|
|
|
void setMaximum(double maximum);
|
|
|
|
void setAverage(double average);
|
2014-02-28 04:09:57 +00:00
|
|
|
void setMinimum(const QString &minimum);
|
|
|
|
void setMaximum(const QString &maximum);
|
|
|
|
void setAverage(const QString &average);
|
2014-05-30 22:46:55 +00:00
|
|
|
void overrideMinToolTipText(const QString &newTip);
|
2014-11-17 18:40:08 +00:00
|
|
|
void overrideAvgToolTipText(const QString &newTip);
|
2014-05-30 22:46:55 +00:00
|
|
|
void overrideMaxToolTipText(const QString &newTip);
|
2017-01-10 15:56:55 +00:00
|
|
|
void setAvgVisibility(const bool visible);
|
2013-06-04 21:51:27 +00:00
|
|
|
void clear();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2013-06-04 21:51:27 +00:00
|
|
|
private:
|
2013-11-30 17:18:02 +00:00
|
|
|
QScopedPointer<MinMaxAvgWidgetPrivate> d;
|
2013-06-04 21:51:27 +00:00
|
|
|
};
|
|
|
|
|
2013-06-17 16:41:00 +00:00
|
|
|
class RenumberDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static RenumberDialog *instance();
|
2014-05-19 21:11:32 +00:00
|
|
|
void renumberOnlySelected(bool selected = true);
|
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-11-30 17:18:04 +00:00
|
|
|
explicit RenumberDialog(QWidget *parent);
|
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:
|
|
|
|
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 13:53:05 +00:00
|
|
|
class ShiftTimesDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static ShiftTimesDialog *instance();
|
2014-05-22 18:40:22 +00:00
|
|
|
void showEvent(QShowEvent *event);
|
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:
|
2013-11-30 17:18:04 +00:00
|
|
|
explicit ShiftTimesDialog(QWidget *parent);
|
2014-03-20 20:57:49 +00:00
|
|
|
int64_t when;
|
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-01-27 13:44:26 +00:00
|
|
|
void buttonClicked(QAbstractButton *button);
|
2014-02-13 15:43:55 +00:00
|
|
|
void syncCameraClicked();
|
|
|
|
void dcDateTimeChanged(const QDateTime &);
|
2015-03-14 16:44:24 +00:00
|
|
|
void timeEditChanged(const QTime &time);
|
2017-04-30 20:24:08 +00:00
|
|
|
void timeEditChanged();
|
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;
|
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-06-19 18:42:05 +00:00
|
|
|
class QCalendarWidget;
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2014-11-16 16:04:06 +00:00
|
|
|
namespace Ui{
|
|
|
|
class FilterWidget2;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MultiFilter : public QWidget {
|
2014-11-03 19:39:31 +00:00
|
|
|
Q_OBJECT
|
2014-11-13 21:45:32 +00:00
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void closeFilter();
|
2014-11-16 16:04:06 +00:00
|
|
|
void adjustHeight();
|
|
|
|
void filterFinished();
|
|
|
|
|
2014-11-03 19:39:31 +00:00
|
|
|
public:
|
|
|
|
MultiFilter(QWidget *parent);
|
2014-12-18 07:47:52 +00:00
|
|
|
Ui::FilterWidget2 ui;
|
2014-11-03 19:39:31 +00:00
|
|
|
};
|
|
|
|
|
2017-12-23 13:17:23 +00:00
|
|
|
class FilterBase : public QWidget {
|
|
|
|
protected:
|
|
|
|
FilterBase(FilterModelBase *model, QWidget *parent = 0);
|
|
|
|
FilterModelBase *model;
|
|
|
|
Ui::FilterWidget ui;
|
2014-10-01 19:23:02 +00:00
|
|
|
virtual void showEvent(QShowEvent *);
|
|
|
|
virtual void hideEvent(QHideEvent *);
|
2017-12-23 13:17:23 +00:00
|
|
|
friend class MultiFilter;
|
|
|
|
};
|
2014-10-31 21:28:39 +00:00
|
|
|
|
2017-12-23 13:17:23 +00:00
|
|
|
class TagFilter : public FilterBase {
|
|
|
|
public:
|
|
|
|
TagFilter(QWidget *parent = 0);
|
2014-09-17 16:51:08 +00:00
|
|
|
};
|
|
|
|
|
2017-12-23 13:17:23 +00:00
|
|
|
class BuddyFilter : public FilterBase {
|
2014-10-31 18:49:52 +00:00
|
|
|
public:
|
|
|
|
BuddyFilter(QWidget *parent = 0);
|
|
|
|
};
|
|
|
|
|
2017-12-23 13:17:23 +00:00
|
|
|
class SuitFilter : public FilterBase {
|
2014-11-13 19:32:17 +00:00
|
|
|
public:
|
|
|
|
SuitFilter(QWidget *parent = 0);
|
|
|
|
};
|
|
|
|
|
2017-12-23 13:17:23 +00:00
|
|
|
class LocationFilter : public FilterBase {
|
2014-10-31 19:45:39 +00:00
|
|
|
public:
|
|
|
|
LocationFilter(QWidget *parent = 0);
|
|
|
|
};
|
|
|
|
|
2015-11-16 04:56:24 +00:00
|
|
|
class TextHyperlinkEventFilter : public QObject {
|
|
|
|
public:
|
|
|
|
explicit TextHyperlinkEventFilter(QTextEdit *txtEdit);
|
|
|
|
|
|
|
|
virtual bool eventFilter(QObject *target, QEvent *evt);
|
|
|
|
|
|
|
|
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 15:52:01 +00:00
|
|
|
bool isGnome3Session();
|
2014-09-17 22:39:49 +00:00
|
|
|
QImage grayImage(const QImage &coloredImg);
|
2013-09-27 15:52:01 +00:00
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // SIMPLEWIDGETS_H
|