syncthingtray/widgets/settings/settings.h

124 lines
2.7 KiB
C
Raw Normal View History

2016-08-25 00:45:32 +02:00
#ifndef SETTINGS_H
#define SETTINGS_H
#include "../global.h"
#include "../../connector/syncthingconnectionsettings.h"
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 <QString>
#include <QByteArray>
2016-11-02 20:03:38 +01:00
#include <QSize>
#include <QFrame>
#include <QTabWidget>
#include <QHash>
2016-09-03 20:14:52 +02:00
#include <vector>
2016-08-25 00:45:32 +02:00
namespace Dialogs {
class QtSettings;
}
namespace Data {
class SyncthingProcess;
}
2016-08-25 00:45:32 +02:00
namespace Settings {
struct SYNCTHINGWIDGETS_EXPORT Connection
2016-11-02 20:03:38 +01:00
{
Data::SyncthingConnectionSettings primary;
std::vector<Data::SyncthingConnectionSettings> secondary;
};
struct SYNCTHINGWIDGETS_EXPORT NotifyOn
2016-11-02 20:03:38 +01:00
{
bool disconnect = true;
bool internalErrors = true;
bool syncComplete = true;
bool syncthingErrors = true;
};
struct SYNCTHINGWIDGETS_EXPORT Appearance
2016-11-02 20:03:38 +01:00
{
bool showTraffic = true;
QSize trayMenuSize = QSize(450, 400);
int frameStyle = QFrame::StyledPanel | QFrame::Sunken;
int tabPosition = QTabWidget::South;
bool brightTextColors = false;
2016-11-02 20:03:38 +01:00
};
struct SYNCTHINGWIDGETS_EXPORT ToolParameter
{
QString path;
QString args;
bool autostart = false;
};
struct SYNCTHINGWIDGETS_EXPORT Launcher
2016-11-02 20:03:38 +01:00
{
bool enabled = false;
QString syncthingPath =
#ifdef PLATFORM_WINDOWS
QStringLiteral("syncthing.exe");
#else
QStringLiteral("syncthing");
#endif
QString syncthingArgs;
QHash<QString, ToolParameter> tools;
2016-11-02 20:03:38 +01:00
QString syncthingCmd() const;
QString toolCmd(const QString &tool) const;
static Data::SyncthingProcess &toolProcess(const QString &tool);
void autostart() const;
static void terminate();
2016-11-02 20:03:38 +01:00
};
2016-08-25 00:45:32 +02:00
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
struct SYNCTHINGWIDGETS_EXPORT Systemd
{
QString syncthingUnit = QStringLiteral("syncthing.service");
bool showButton = false;
bool considerForReconnect = false;
};
#endif
#if defined(SYNCTHINGWIDGETS_USE_WEBENGINE) || defined(SYNCTHINGWIDGETS_USE_WEBKIT)
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
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
unsigned int ignoreInavailabilityAfterStart = 15;
2016-11-02 20:03:38 +01:00
Appearance appearance;
Launcher launcher;
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
Systemd systemd;
#endif
#if defined(SYNCTHINGWIDGETS_USE_WEBENGINE) || defined(SYNCTHINGWIDGETS_USE_WEBKIT)
2016-11-02 20:03:38 +01:00
WebView webView;
#endif
Dialogs::QtSettings qt;
};
2016-08-25 00:45:32 +02:00
Settings SYNCTHINGWIDGETS_EXPORT &values();
void SYNCTHINGWIDGETS_EXPORT restore();
void SYNCTHINGWIDGETS_EXPORT save();
2016-08-25 00:45:32 +02:00
}
#endif // SETTINGS_H