2016-08-25 00:45:32 +02:00
|
|
|
#ifndef SETTINGS_H
|
|
|
|
#define SETTINGS_H
|
|
|
|
|
2016-09-30 23:55:25 +02:00
|
|
|
#include "../../connector/syncthingconnectionsettings.h"
|
2017-05-01 03:34:43 +02:00
|
|
|
#include "../global.h"
|
2016-09-29 21:19:54 +02:00
|
|
|
|
2016-11-02 20:03:38 +01:00
|
|
|
#include <qtutilities/settingsdialog/qtsettings.h>
|
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
#include <c++utilities/conversion/types.h>
|
|
|
|
|
2016-09-03 20:14:52 +02:00
|
|
|
#include <QByteArray>
|
2016-11-02 20:03:38 +01:00
|
|
|
#include <QFrame>
|
2017-03-17 00:38:42 +01:00
|
|
|
#include <QHash>
|
2017-05-01 03:34:43 +02:00
|
|
|
#include <QSize>
|
|
|
|
#include <QString>
|
|
|
|
#include <QTabWidget>
|
2016-09-03 20:14:52 +02:00
|
|
|
|
2018-04-02 20:26:00 +02:00
|
|
|
#include <tuple>
|
2016-09-03 20:14:52 +02:00
|
|
|
#include <vector>
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
namespace Dialogs {
|
|
|
|
class QtSettings;
|
|
|
|
}
|
|
|
|
|
2017-03-17 00:38:42 +01:00
|
|
|
namespace Data {
|
|
|
|
class SyncthingProcess;
|
2018-03-31 22:31:28 +02:00
|
|
|
class SyncthingNotifier;
|
2018-04-02 20:26:00 +02:00
|
|
|
class SyncthingConnection;
|
2018-03-31 22:31:28 +02:00
|
|
|
} // namespace Data
|
2017-03-17 00:38:42 +01:00
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
namespace Settings {
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
struct SYNCTHINGWIDGETS_EXPORT Connection {
|
2016-11-02 20:03:38 +01:00
|
|
|
Data::SyncthingConnectionSettings primary;
|
|
|
|
std::vector<Data::SyncthingConnectionSettings> secondary;
|
|
|
|
};
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
struct SYNCTHINGWIDGETS_EXPORT NotifyOn {
|
2016-11-02 20:03:38 +01:00
|
|
|
bool disconnect = true;
|
|
|
|
bool internalErrors = true;
|
2018-03-31 22:31:28 +02:00
|
|
|
bool localSyncComplete = false;
|
|
|
|
bool remoteSyncComplete = false;
|
2016-11-02 20:03:38 +01:00
|
|
|
bool syncthingErrors = true;
|
2018-05-01 22:27:03 +02:00
|
|
|
bool newDeviceConnects = false;
|
|
|
|
bool newDirectoryShared = false;
|
2016-11-02 20:03:38 +01:00
|
|
|
};
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
struct SYNCTHINGWIDGETS_EXPORT Appearance {
|
2016-11-02 20:03:38 +01:00
|
|
|
bool showTraffic = true;
|
|
|
|
QSize trayMenuSize = QSize(450, 400);
|
2019-03-20 17:36:52 +01:00
|
|
|
int frameStyle = QFrame::NoFrame | QFrame::Plain;
|
2016-11-02 20:03:38 +01:00
|
|
|
int tabPosition = QTabWidget::South;
|
2016-11-02 21:05:32 +01:00
|
|
|
bool brightTextColors = false;
|
2016-11-02 20:03:38 +01:00
|
|
|
};
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
struct SYNCTHINGWIDGETS_EXPORT ToolParameter {
|
2017-03-17 00:38:42 +01:00
|
|
|
QString path;
|
|
|
|
QString args;
|
|
|
|
bool autostart = false;
|
|
|
|
};
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
struct SYNCTHINGWIDGETS_EXPORT Launcher {
|
2016-11-02 20:03:38 +01:00
|
|
|
bool enabled = false;
|
2018-04-18 23:27:45 +02:00
|
|
|
bool useLibSyncthing = false;
|
2016-11-02 20:03:38 +01:00
|
|
|
QString syncthingPath =
|
|
|
|
#ifdef PLATFORM_WINDOWS
|
2017-05-01 03:34:43 +02:00
|
|
|
QStringLiteral("syncthing.exe");
|
2016-11-02 20:03:38 +01:00
|
|
|
#else
|
2017-05-01 03:34:43 +02:00
|
|
|
QStringLiteral("syncthing");
|
2016-11-02 20:03:38 +01:00
|
|
|
#endif
|
|
|
|
QString syncthingArgs;
|
2017-03-17 00:38:42 +01:00
|
|
|
QHash<QString, ToolParameter> tools;
|
2018-04-02 20:26:00 +02:00
|
|
|
bool considerForReconnect = false;
|
2017-03-17 00:38:42 +01:00
|
|
|
static Data::SyncthingProcess &toolProcess(const QString &tool);
|
2018-04-02 23:29:39 +02:00
|
|
|
static std::vector<Data::SyncthingProcess *> allProcesses();
|
2017-03-17 00:38:42 +01:00
|
|
|
void autostart() const;
|
|
|
|
static void terminate();
|
2016-11-02 20:03:38 +01:00
|
|
|
};
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2016-12-18 16:50:35 +01:00
|
|
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
2017-05-01 03:34:43 +02:00
|
|
|
struct SYNCTHINGWIDGETS_EXPORT Systemd {
|
2016-12-18 16:50:35 +01:00
|
|
|
QString syncthingUnit = QStringLiteral("syncthing.service");
|
2016-12-27 16:16:12 +01:00
|
|
|
bool showButton = false;
|
|
|
|
bool considerForReconnect = false;
|
2018-04-02 20:26:00 +02:00
|
|
|
|
|
|
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
|
|
|
std::tuple<bool, bool> apply(Data::SyncthingConnection &connection, const Data::SyncthingConnectionSettings *currentConnectionSettings,
|
|
|
|
bool preventReconnect = false) const;
|
|
|
|
#endif
|
2016-12-18 16:50:35 +01:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2017-04-23 18:27:31 +02:00
|
|
|
#if defined(SYNCTHINGWIDGETS_USE_WEBENGINE) || defined(SYNCTHINGWIDGETS_USE_WEBKIT)
|
2017-05-01 03:34:43 +02:00
|
|
|
struct SYNCTHINGWIDGETS_EXPORT WebView {
|
2016-11-02 20:03:38 +01:00
|
|
|
bool disabled = false;
|
|
|
|
double zoomFactor = 1.0;
|
|
|
|
QByteArray geometry;
|
|
|
|
bool keepRunning = true;
|
|
|
|
};
|
2016-08-25 00:45:32 +02:00
|
|
|
#endif
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
struct SYNCTHINGWIDGETS_EXPORT Settings {
|
2016-11-02 20:03:38 +01:00
|
|
|
bool firstLaunch = false;
|
|
|
|
Connection connection;
|
|
|
|
NotifyOn notifyOn;
|
2016-12-11 17:58:58 +01:00
|
|
|
#ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS
|
|
|
|
bool dbusNotifications = false;
|
|
|
|
#endif
|
2017-01-14 02:12:38 +01:00
|
|
|
unsigned int ignoreInavailabilityAfterStart = 15;
|
2016-11-02 20:03:38 +01:00
|
|
|
Appearance appearance;
|
|
|
|
Launcher launcher;
|
2016-12-18 16:50:35 +01:00
|
|
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
|
|
|
Systemd systemd;
|
|
|
|
#endif
|
2017-04-23 18:27:31 +02:00
|
|
|
#if defined(SYNCTHINGWIDGETS_USE_WEBENGINE) || defined(SYNCTHINGWIDGETS_USE_WEBKIT)
|
2016-11-02 20:03:38 +01:00
|
|
|
WebView webView;
|
|
|
|
#endif
|
|
|
|
Dialogs::QtSettings qt;
|
2018-04-02 20:26:00 +02:00
|
|
|
|
|
|
|
void apply(Data::SyncthingNotifier ¬ifier) const;
|
2016-11-02 20:03:38 +01:00
|
|
|
};
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2017-04-23 18:27:31 +02:00
|
|
|
Settings SYNCTHINGWIDGETS_EXPORT &values();
|
|
|
|
void SYNCTHINGWIDGETS_EXPORT restore();
|
|
|
|
void SYNCTHINGWIDGETS_EXPORT save();
|
2017-09-17 21:48:15 +02:00
|
|
|
} // namespace Settings
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
#endif // SETTINGS_H
|