mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat(settings): add notification signals for changed settings values
Makes changes to settings application wide transparent. The properties section is optional in theory, but comes in very handy, if we decide to access settings e.g. from within a script context.
This commit is contained in:
parent
e4398c7894
commit
f00b9008e6
|
@ -364,7 +364,7 @@ bool Audio::initInput(const QString& deviceName)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->setInputGain(Settings::getInstance().getAudioInGain());
|
d->setInputGain(Settings::getInstance().getAudioInGainDecibel());
|
||||||
|
|
||||||
qDebug() << "Opened audio input" << deviceName;
|
qDebug() << "Opened audio input" << deviceName;
|
||||||
alcCaptureStart(alInDev);
|
alcCaptureStart(alInDev);
|
||||||
|
|
|
@ -52,7 +52,6 @@ public:
|
||||||
void setTypingNotificationVisible(bool visible);
|
void setTypingNotificationVisible(bool visible);
|
||||||
void scrollToLine(ChatLine::Ptr line);
|
void scrollToLine(ChatLine::Ptr line);
|
||||||
void selectAll();
|
void selectAll();
|
||||||
void forceRelayout();
|
|
||||||
|
|
||||||
QString getSelectedText() const;
|
QString getSelectedText() const;
|
||||||
|
|
||||||
|
@ -67,6 +66,13 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void forceRelayout();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onSelectionTimerTimeout();
|
||||||
|
void onWorkerTimeout();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QRectF calculateSceneRect() const;
|
QRectF calculateSceneRect() const;
|
||||||
QRect getVisibleRect() const;
|
QRect getVisibleRect() const;
|
||||||
|
@ -100,10 +106,6 @@ protected:
|
||||||
|
|
||||||
ChatLine::Ptr findLineByPosY(qreal yPos) const;
|
ChatLine::Ptr findLineByPosY(qreal yPos) const;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onSelectionTimerTimeout();
|
|
||||||
void onWorkerTimeout();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
bool isActiveFileTransfer(ChatLine::Ptr l);
|
bool isActiveFileTransfer(ChatLine::Ptr l);
|
||||||
|
|
|
@ -56,7 +56,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
|
||||||
text = detectQuotes(detectAnchors(text), type);
|
text = detectQuotes(detectAnchors(text), type);
|
||||||
|
|
||||||
//text styling
|
//text styling
|
||||||
if (Settings::getInstance().getStylePreference() != NONE)
|
if (Settings::getInstance().getStylePreference() != Settings::StyleType::NONE)
|
||||||
text = detectStyle(text);
|
text = detectStyle(text);
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
|
@ -229,7 +229,7 @@ QString ChatMessage::detectStyle(const QString &str)
|
||||||
{
|
{
|
||||||
int mul = 0; // Determines how many characters to strip from text
|
int mul = 0; // Determines how many characters to strip from text
|
||||||
// Set mul depending on styleownPreference
|
// Set mul depending on styleownPreference
|
||||||
if (Settings::getInstance().getStylePreference() == WITHOUT_CHARS)
|
if (Settings::getInstance().getStylePreference() == Settings::StyleType::WITHOUT_CHARS)
|
||||||
mul = 2;
|
mul = 2;
|
||||||
|
|
||||||
// Match captured string to corresponding style format
|
// Match captured string to corresponding style format
|
||||||
|
|
|
@ -122,8 +122,8 @@ void Core::makeTox(QByteArray savedata)
|
||||||
// IPv6 needed for LAN discovery, but can crash some weird routers. On by default, can be disabled in options.
|
// IPv6 needed for LAN discovery, but can crash some weird routers. On by default, can be disabled in options.
|
||||||
bool enableIPv6 = Settings::getInstance().getEnableIPv6();
|
bool enableIPv6 = Settings::getInstance().getEnableIPv6();
|
||||||
bool forceTCP = Settings::getInstance().getForceTCP();
|
bool forceTCP = Settings::getInstance().getForceTCP();
|
||||||
ProxyType proxyType = Settings::getInstance().getProxyType();
|
Settings::ProxyType proxyType = Settings::getInstance().getProxyType();
|
||||||
int proxyPort = Settings::getInstance().getProxyPort();
|
quint16 proxyPort = Settings::getInstance().getProxyPort();
|
||||||
QString proxyAddr = Settings::getInstance().getProxyAddr();
|
QString proxyAddr = Settings::getInstance().getProxyAddr();
|
||||||
QByteArray proxyAddrData = proxyAddr.toUtf8();
|
QByteArray proxyAddrData = proxyAddr.toUtf8();
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ void Core::makeTox(QByteArray savedata)
|
||||||
toxOptions.savedata_data = (uint8_t*)savedata.data();
|
toxOptions.savedata_data = (uint8_t*)savedata.data();
|
||||||
toxOptions.savedata_length = savedata.size();
|
toxOptions.savedata_length = savedata.size();
|
||||||
|
|
||||||
if (proxyType != ProxyType::ptNone)
|
if (proxyType != Settings::ProxyType::ptNone)
|
||||||
{
|
{
|
||||||
if (proxyAddr.length() > 255)
|
if (proxyAddr.length() > 255)
|
||||||
{
|
{
|
||||||
|
@ -157,9 +157,9 @@ void Core::makeTox(QByteArray savedata)
|
||||||
{
|
{
|
||||||
qDebug() << "using proxy" << proxyAddr << ":" << proxyPort;
|
qDebug() << "using proxy" << proxyAddr << ":" << proxyPort;
|
||||||
// protection against changings in TOX_PROXY_TYPE enum
|
// protection against changings in TOX_PROXY_TYPE enum
|
||||||
if (proxyType == ProxyType::ptSOCKS5)
|
if (proxyType == Settings::ProxyType::ptSOCKS5)
|
||||||
toxOptions.proxy_type = TOX_PROXY_TYPE_SOCKS5;
|
toxOptions.proxy_type = TOX_PROXY_TYPE_SOCKS5;
|
||||||
else if (proxyType == ProxyType::ptHTTP)
|
else if (proxyType == Settings::ProxyType::ptHTTP)
|
||||||
toxOptions.proxy_type = TOX_PROXY_TYPE_HTTP;
|
toxOptions.proxy_type = TOX_PROXY_TYPE_HTTP;
|
||||||
|
|
||||||
toxOptions.proxy_host = proxyAddrData.data();
|
toxOptions.proxy_host = proxyAddrData.data();
|
||||||
|
@ -592,7 +592,7 @@ void Core::requestFriendship(const QString& friendAddress, const QString& messag
|
||||||
{
|
{
|
||||||
qDebug() << "Requested friendship of "<<friendId;
|
qDebug() << "Requested friendship of "<<friendId;
|
||||||
// Update our friendAddresses
|
// Update our friendAddresses
|
||||||
Settings::getInstance().updateFriendAdress(friendAddress);
|
Settings::getInstance().updateFriendAddress(friendAddress);
|
||||||
QString inviteStr = tr("/me offers friendship.");
|
QString inviteStr = tr("/me offers friendship.");
|
||||||
if (message.length())
|
if (message.length())
|
||||||
inviteStr = tr("/me offers friendship, \"%1\"").arg(message);
|
inviteStr = tr("/me offers friendship, \"%1\"").arg(message);
|
||||||
|
@ -1166,7 +1166,7 @@ bool Core::hasFriendWithPublicKey(const QString &pubkey) const
|
||||||
QString Core::getFriendAddress(uint32_t friendNumber) const
|
QString Core::getFriendAddress(uint32_t friendNumber) const
|
||||||
{
|
{
|
||||||
QString id = getFriendPublicKey(friendNumber);
|
QString id = getFriendPublicKey(friendNumber);
|
||||||
QString addr = Settings::getInstance().getFriendAdress(id);
|
QString addr = Settings::getInstance().getFriendAddress(id);
|
||||||
if (addr.size() > id.size())
|
if (addr.size() > id.size())
|
||||||
return addr;
|
return addr;
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,40 @@
|
||||||
#define TOX_HEX_ID_LENGTH 2*TOX_ADDRESS_SIZE
|
#define TOX_HEX_ID_LENGTH 2*TOX_ADDRESS_SIZE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@file corestructs.h
|
* @file corestructs.h
|
||||||
@brief Some headers use Core structs but don't need to include all of core.h
|
* @brief Some headers use Core structs but don't need to include all of core.h
|
||||||
|
*
|
||||||
They should include this file directly instead to reduce compilation times
|
* They should include this file directly instead to reduce compilation times
|
||||||
*/
|
*
|
||||||
|
*
|
||||||
|
* @var ToxFile::fileKind Data file (default) or avatar
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@var uint8_t ToxFile::fileKind
|
* @brief Compare equal operator
|
||||||
@brief Data file (default) or avatar
|
* @param other the compared instance
|
||||||
*/
|
* @return true, if equal; false otherwise
|
||||||
|
*/
|
||||||
|
bool DhtServer::operator==(const DhtServer& other) const
|
||||||
|
{
|
||||||
|
return this == &other ||
|
||||||
|
(port == other.port && address == other.address &&
|
||||||
|
userId == other.userId && name == other.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Compare not equal operator
|
||||||
|
* @param other the compared instance
|
||||||
|
* @return true, if not equal; false otherwise
|
||||||
|
*/
|
||||||
|
bool DhtServer::operator!=(const DhtServer& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ToxFile constructor
|
||||||
|
*/
|
||||||
ToxFile::ToxFile(uint32_t fileNum, uint32_t friendId, QByteArray filename, QString filePath, FileDirection Direction)
|
ToxFile::ToxFile(uint32_t fileNum, uint32_t friendId, QByteArray filename, QString filePath, FileDirection Direction)
|
||||||
: fileKind{TOX_FILE_KIND_DATA}, fileNum(fileNum), friendId(friendId), fileName{filename},
|
: fileKind{TOX_FILE_KIND_DATA}, fileNum(fileNum), friendId(friendId), fileName{filename},
|
||||||
filePath{filePath}, file{new QFile(filePath)}, bytesSent{0}, filesize{0},
|
filePath{filePath}, file{new QFile(filePath)}, bytesSent{0}, filesize{0},
|
||||||
|
|
|
@ -15,6 +15,9 @@ struct DhtServer
|
||||||
QString userId;
|
QString userId;
|
||||||
QString address;
|
QString address;
|
||||||
quint16 port;
|
quint16 port;
|
||||||
|
|
||||||
|
bool operator==(const DhtServer& other) const;
|
||||||
|
bool operator!=(const DhtServer& other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ToxFile
|
struct ToxFile
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
|
|
||||||
namespace Db {
|
namespace Db {
|
||||||
enum class syncType : int {stOff = 0, stNormal = 1, stFull = 2};
|
enum class syncType {stOff = 0, stNormal = 1, stFull = 2};
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlainDb : public GenericDdInterface
|
class PlainDb : public GenericDdInterface
|
||||||
|
|
|
@ -29,7 +29,10 @@
|
||||||
|
|
||||||
class Profile;
|
class Profile;
|
||||||
class GenericDdInterface;
|
class GenericDdInterface;
|
||||||
namespace Db { enum class syncType; }
|
|
||||||
|
namespace Db {
|
||||||
|
enum class syncType;
|
||||||
|
}
|
||||||
|
|
||||||
class HistoryKeeper
|
class HistoryKeeper
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,15 +32,106 @@
|
||||||
|
|
||||||
class ToxId;
|
class ToxId;
|
||||||
class Profile;
|
class Profile;
|
||||||
namespace Db { enum class syncType; }
|
|
||||||
|
|
||||||
enum ProxyType {ptNone, ptSOCKS5, ptHTTP};
|
namespace Db {
|
||||||
|
enum class syncType;
|
||||||
enum StyleType {NONE, WITH_CHARS, WITHOUT_CHARS};
|
}
|
||||||
|
|
||||||
class Settings : public QObject
|
class Settings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_ENUMS(ProxyType)
|
||||||
|
Q_ENUMS(StyleType)
|
||||||
|
|
||||||
|
// general
|
||||||
|
Q_PROPERTY(bool compactLayout READ getCompactLayout WRITE setCompactLayout
|
||||||
|
NOTIFY compactLayoutChanged FINAL)
|
||||||
|
Q_PROPERTY(bool autorun READ getAutorun WRITE setAutorun
|
||||||
|
NOTIFY autorunChanged FINAL)
|
||||||
|
|
||||||
|
// GUI
|
||||||
|
Q_PROPERTY(bool separateWindow READ getSeparateWindow
|
||||||
|
WRITE setSeparateWindow NOTIFY separateWindowChanged FINAL)
|
||||||
|
Q_PROPERTY(QString smileyPack READ getSmileyPack WRITE setSmileyPack
|
||||||
|
NOTIFY smileyPackChanged FINAL)
|
||||||
|
Q_PROPERTY(int emojiFontPointSize READ getEmojiFontPointSize
|
||||||
|
WRITE setEmojiFontPointSize NOTIFY emojiFontPointSizeChanged
|
||||||
|
FINAL)
|
||||||
|
Q_PROPERTY(bool minimizeOnClose READ getMinimizeOnClose
|
||||||
|
WRITE setMinimizeOnClose NOTIFY minimizeOnCloseChanged FINAL)
|
||||||
|
Q_PROPERTY(QByteArray windowGeometry READ getWindowGeometry
|
||||||
|
WRITE setWindowGeometry NOTIFY windowGeometryChanged FINAL)
|
||||||
|
Q_PROPERTY(QByteArray windowState READ getWindowState WRITE setWindowState
|
||||||
|
NOTIFY windowStateChanged FINAL)
|
||||||
|
Q_PROPERTY(QByteArray splitterState READ getSplitterState
|
||||||
|
WRITE setSplitterState NOTIFY splitterStateChanged FINAL)
|
||||||
|
Q_PROPERTY(QByteArray dialogGeometry READ getDialogGeometry
|
||||||
|
WRITE setDialogGeometry NOTIFY dialogGeometryChanged FINAL)
|
||||||
|
Q_PROPERTY(QByteArray dialogSplitterState READ getDialogSplitterState
|
||||||
|
WRITE setDialogSplitterState NOTIFY dialogSplitterStateChanged
|
||||||
|
FINAL)
|
||||||
|
Q_PROPERTY(QByteArray dialogSettingsGeometry READ getDialogSettingsGeometry
|
||||||
|
WRITE setDialogSettingsGeometry
|
||||||
|
NOTIFY dialogSettingsGeometryChanged FINAL)
|
||||||
|
Q_PROPERTY(QString style READ getStyle WRITE setStyle NOTIFY styleChanged
|
||||||
|
FINAL)
|
||||||
|
Q_PROPERTY(bool showSystemTray READ getShowSystemTray
|
||||||
|
WRITE setShowSystemTray NOTIFY showSystemTrayChanged FINAL)
|
||||||
|
|
||||||
|
// ChatView
|
||||||
|
Q_PROPERTY(bool groupchatPosition READ getGroupchatPosition
|
||||||
|
WRITE setGroupchatPosition NOTIFY groupchatPositionChanged FINAL)
|
||||||
|
Q_PROPERTY(QFont chatMessageFont READ getChatMessageFont
|
||||||
|
WRITE setChatMessageFont NOTIFY chatMessageFontChanged FINAL)
|
||||||
|
Q_PROPERTY(StyleType stylePreference READ getStylePreference
|
||||||
|
WRITE setStylePreference NOTIFY stylePreferenceChanged FINAL)
|
||||||
|
Q_PROPERTY(QString timestampFormat READ getTimestampFormat
|
||||||
|
WRITE setTimestampFormat NOTIFY timestampFormatChanged FINAL)
|
||||||
|
Q_PROPERTY(QString dateFormat READ getDateFormat WRITE setDateFormat
|
||||||
|
NOTIFY dateFormatChanged FINAL)
|
||||||
|
Q_PROPERTY(bool statusChangeNotificationEnabled
|
||||||
|
READ getStatusChangeNotificationEnabled
|
||||||
|
WRITE setStatusChangeNotificationEnabled
|
||||||
|
NOTIFY statusChangeNotificationEnabledChanged FINAL)
|
||||||
|
|
||||||
|
// Privacy
|
||||||
|
Q_PROPERTY(bool typingNotification READ getTypingNotification
|
||||||
|
WRITE setTypingNotification NOTIFY typingNotificationChanged
|
||||||
|
FINAL)
|
||||||
|
|
||||||
|
// Audio
|
||||||
|
Q_PROPERTY(QString inDev READ getInDev WRITE setInDev
|
||||||
|
NOTIFY inDevChanged FINAL)
|
||||||
|
Q_PROPERTY(bool audioInDevEnabled READ getAudioInDevEnabled
|
||||||
|
WRITE setAudioInDevEnabled NOTIFY audioInDevEnabledChanged FINAL)
|
||||||
|
Q_PROPERTY(qreal audioInGainDecibel READ getAudioInGainDecibel
|
||||||
|
WRITE setAudioInGainDecibel NOTIFY audioInGainDecibelChanged
|
||||||
|
FINAL)
|
||||||
|
Q_PROPERTY(QString outDev READ getOutDev WRITE setOutDev
|
||||||
|
NOTIFY outDevChanged FINAL)
|
||||||
|
Q_PROPERTY(bool audioOutDevEnabled READ getAudioOutDevEnabled
|
||||||
|
WRITE setAudioOutDevEnabled NOTIFY audioOutDevEnabledChanged
|
||||||
|
FINAL)
|
||||||
|
Q_PROPERTY(int outVolume READ getOutVolume WRITE setOutVolume
|
||||||
|
NOTIFY outVolumeChanged FINAL)
|
||||||
|
|
||||||
|
// Video
|
||||||
|
Q_PROPERTY(QString videoDev READ getVideoDev WRITE setVideoDev
|
||||||
|
NOTIFY videoDevChanged FINAL)
|
||||||
|
Q_PROPERTY(QRect camVideoRes READ getCamVideoRes WRITE setCamVideoRes
|
||||||
|
NOTIFY camVideoResChanged FINAL)
|
||||||
|
Q_PROPERTY(QRect screenRegion READ getScreenRegion WRITE setScreenRegion
|
||||||
|
NOTIFY screenRegionChanged FINAL)
|
||||||
|
Q_PROPERTY(bool screenGrabbed READ getScreenGrabbed WRITE setScreenGrabbed
|
||||||
|
NOTIFY screenGrabbedChanged FINAL)
|
||||||
|
Q_PROPERTY(quint16 camVideoFPS READ getCamVideoFPS
|
||||||
|
WRITE setCamVideoFPS NOTIFY camVideoFPSChanged FINAL)
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum class ProxyType {ptNone = 0, ptSOCKS5 = 1, ptHTTP = 2};
|
||||||
|
enum class StyleType {NONE = 0, WITH_CHARS = 1, WITHOUT_CHARS = 2};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Settings& getInstance();
|
static Settings& getInstance();
|
||||||
static void destroyInstance();
|
static void destroyInstance();
|
||||||
|
@ -65,15 +156,89 @@ public:
|
||||||
bool read;
|
bool read;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void saveGlobal();
|
void saveGlobal();
|
||||||
void sync();
|
void sync();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dhtServerListChanged();
|
// General
|
||||||
void smileyPackChanged();
|
void enableIPv6Changed(bool enabled);
|
||||||
void emojiFontChanged();
|
void forceTCPChanged(bool enabled);
|
||||||
|
void proxyTypeChanged(ProxyType type);
|
||||||
|
void proxyAddressChanged(const QString& address);
|
||||||
|
void proxyPortChanged(quint16 port);
|
||||||
|
void dhtServerListChanged(const QList<DhtServer>& servers);
|
||||||
|
void autorunChanged(bool enabled);
|
||||||
|
void autoSaveEnabledChanged(bool enabled);
|
||||||
|
void autostartInTrayChanged(bool enabled);
|
||||||
|
void showInFrontChanged(bool enabled);
|
||||||
|
void closeToTrayChanged(bool enabled);
|
||||||
|
void lightTrayIconChanged(bool enabled);
|
||||||
|
void minimizeToTrayChanged(bool enabled);
|
||||||
|
void showWindowChanged(bool enabled);
|
||||||
|
void makeToxPortableChanged(bool enabled);
|
||||||
|
void busySoundChanged(bool enabled);
|
||||||
|
void notifySoundChanged(bool enabled);
|
||||||
|
void groupAlwaysNotifyChanged(bool enabled);
|
||||||
|
void translationChanged(const QString& translation);
|
||||||
|
void toxmeInfoChanged(const QString& info);
|
||||||
|
void toxmeBioChanged(const QString& bio);
|
||||||
|
void toxmePrivChanged(bool priv);
|
||||||
|
void toxmePassChanged();
|
||||||
|
void currentProfileChanged(const QString& profile);
|
||||||
|
void currentProfileIdChanged(quint32 id);
|
||||||
|
void enableLoggingChanged(bool enabled);
|
||||||
|
void autoAwayTimeChanged(int minutes);
|
||||||
|
void globalAutoAcceptDirChanged(const QString& path);
|
||||||
|
void checkUpdatesChanged(bool enabled);
|
||||||
|
void widgetDataChanged(const QString& key);
|
||||||
|
|
||||||
|
// GUI
|
||||||
|
void autoLoginChanged(bool enabled);
|
||||||
|
void separateWindowChanged(bool enabled);
|
||||||
|
void showSystemTrayChanged(bool enabled);
|
||||||
|
bool minimizeOnCloseChanged(bool enabled);
|
||||||
|
void windowGeometryChanged(const QByteArray& rect);
|
||||||
|
void windowStateChanged(const QByteArray& state);
|
||||||
|
void splitterStateChanged(const QByteArray& state);
|
||||||
|
void dialogGeometryChanged(const QByteArray& rect);
|
||||||
|
void dialogSplitterStateChanged(const QByteArray& state);
|
||||||
|
void dialogSettingsGeometryChanged(const QByteArray& rect);
|
||||||
|
void styleChanged(const QString& style);
|
||||||
|
void themeColorChanged(int color);
|
||||||
|
void compactLayoutChanged(bool enabled);
|
||||||
|
|
||||||
|
// ChatView
|
||||||
|
void useEmoticonsChanged(bool enabled);
|
||||||
|
void smileyPackChanged(const QString& name);
|
||||||
|
void emojiFontPointSizeChanged(int size);
|
||||||
|
void dontGroupWindowsChanged(bool enabled);
|
||||||
|
void groupchatPositionChanged(bool enabled);
|
||||||
|
void chatMessageFontChanged(const QFont& font);
|
||||||
|
void stylePreferenceChanged(StyleType type);
|
||||||
|
void timestampFormatChanged(const QString& format);
|
||||||
|
void dateFormatChanged(const QString& format);
|
||||||
|
void statusChangeNotificationEnabledChanged(bool enabled);
|
||||||
|
void fauxOfflineMessagingChanged(bool enabled);
|
||||||
|
|
||||||
|
// Privacy
|
||||||
|
void typingNotificationChanged(bool enabled);
|
||||||
|
void dbSyncTypeChanged(Db::syncType type);
|
||||||
|
|
||||||
|
// Audio
|
||||||
|
void inDevChanged(const QString& name);
|
||||||
|
void audioInDevEnabledChanged(bool enabled);
|
||||||
|
void audioInGainDecibelChanged(qreal gain);
|
||||||
|
void outDevChanged(const QString& name);
|
||||||
|
void audioOutDevEnabledChanged(bool enabled);
|
||||||
|
void outVolumeChanged(int volume);
|
||||||
|
|
||||||
|
// Video
|
||||||
|
void videoDevChanged(const QString& name);
|
||||||
|
void camVideoResChanged(const QRect& resolution);
|
||||||
|
void screenRegionChanged(const QRect& region);
|
||||||
|
void screenGrabbedChanged(bool enabled);
|
||||||
|
void camVideoFPSChanged(quint16 fps);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const QList<DhtServer>& getDhtServerList() const;
|
const QList<DhtServer>& getDhtServerList() const;
|
||||||
|
@ -104,32 +269,32 @@ public:
|
||||||
void setStyle(const QString& newValue);
|
void setStyle(const QString& newValue);
|
||||||
|
|
||||||
bool getShowSystemTray() const;
|
bool getShowSystemTray() const;
|
||||||
void setShowSystemTray(const bool& newValue);
|
void setShowSystemTray(bool newValue);
|
||||||
|
|
||||||
bool getUseEmoticons() const;
|
bool getUseEmoticons() const;
|
||||||
void setUseEmoticons(bool newValue);
|
void setUseEmoticons(bool newValue);
|
||||||
|
|
||||||
QString getCurrentProfile() const;
|
QString getCurrentProfile() const;
|
||||||
uint32_t getCurrentProfileId() const;
|
uint32_t getCurrentProfileId() const;
|
||||||
void setCurrentProfile(QString profile);
|
void setCurrentProfile(const QString& profile);
|
||||||
|
|
||||||
QString getTranslation() const;
|
QString getTranslation() const;
|
||||||
void setTranslation(QString newValue);
|
void setTranslation(const QString& newValue);
|
||||||
|
|
||||||
// Toxme
|
// Toxme
|
||||||
void deleteToxme();
|
void deleteToxme();
|
||||||
void setToxme(QString name, QString server, QString bio, bool priv, QString pass = "");
|
void setToxme(QString name, QString server, QString bio, bool priv, QString pass = "");
|
||||||
QString getToxmeInfo() const;
|
QString getToxmeInfo() const;
|
||||||
void setToxmeInfo(QString info);
|
void setToxmeInfo(const QString& info);
|
||||||
|
|
||||||
QString getToxmeBio() const;
|
QString getToxmeBio() const;
|
||||||
void setToxmeBio(QString bio);
|
void setToxmeBio(const QString& bio);
|
||||||
|
|
||||||
bool getToxmePriv() const;
|
bool getToxmePriv() const;
|
||||||
void setToxmePriv(bool priv);
|
void setToxmePriv(bool priv);
|
||||||
|
|
||||||
QString getToxmePass() const;
|
QString getToxmePass() const;
|
||||||
void setToxmePass(const QString &pass);
|
void setToxmePass(const QString& pass);
|
||||||
|
|
||||||
void setAutoSaveEnabled(bool newValue);
|
void setAutoSaveEnabled(bool newValue);
|
||||||
bool getAutoSaveEnabled() const;
|
bool getAutoSaveEnabled() const;
|
||||||
|
@ -143,7 +308,7 @@ public:
|
||||||
void setProxyAddr(const QString& newValue);
|
void setProxyAddr(const QString& newValue);
|
||||||
|
|
||||||
ProxyType getProxyType() const;
|
ProxyType getProxyType() const;
|
||||||
void setProxyType(int newValue);
|
void setProxyType(ProxyType newValue);
|
||||||
|
|
||||||
quint16 getProxyPort() const;
|
quint16 getProxyPort() const;
|
||||||
void setProxyPort(quint16 newValue);
|
void setProxyPort(quint16 newValue);
|
||||||
|
@ -152,7 +317,7 @@ public:
|
||||||
void setEnableLogging(bool newValue);
|
void setEnableLogging(bool newValue);
|
||||||
|
|
||||||
Db::syncType getDbSyncType() const;
|
Db::syncType getDbSyncType() const;
|
||||||
void setDbSyncType(int newValue);
|
void setDbSyncType(Db::syncType newValue);
|
||||||
|
|
||||||
int getAutoAwayTime() const;
|
int getAutoAwayTime() const;
|
||||||
void setAutoAwayTime(int newValue);
|
void setAutoAwayTime(int newValue);
|
||||||
|
@ -187,8 +352,8 @@ public:
|
||||||
bool getAudioOutDevEnabled() const;
|
bool getAudioOutDevEnabled() const;
|
||||||
void setAudioOutDevEnabled(bool enabled);
|
void setAudioOutDevEnabled(bool enabled);
|
||||||
|
|
||||||
qreal getAudioInGain() const;
|
qreal getAudioInGainDecibel() const;
|
||||||
void setAudioInGain(qreal dB);
|
void setAudioInGainDecibel(qreal dB);
|
||||||
|
|
||||||
int getOutVolume() const;
|
int getOutVolume() const;
|
||||||
void setOutVolume(int volume);
|
void setOutVolume(int volume);
|
||||||
|
@ -197,7 +362,7 @@ public:
|
||||||
void setVideoDev(const QString& deviceSpecifier);
|
void setVideoDev(const QString& deviceSpecifier);
|
||||||
|
|
||||||
QRect getScreenRegion() const;
|
QRect getScreenRegion() const;
|
||||||
void setScreenRegion(const QRect &value);
|
void setScreenRegion(const QRect& value);
|
||||||
|
|
||||||
bool getScreenGrabbed() const;
|
bool getScreenGrabbed() const;
|
||||||
void setScreenGrabbed(bool value);
|
void setScreenGrabbed(bool value);
|
||||||
|
@ -212,10 +377,10 @@ public:
|
||||||
void setAnimationEnabled(bool newValue);
|
void setAnimationEnabled(bool newValue);
|
||||||
|
|
||||||
QString getSmileyPack() const;
|
QString getSmileyPack() const;
|
||||||
void setSmileyPack(const QString &value);
|
void setSmileyPack(const QString& value);
|
||||||
|
|
||||||
int getThemeColor() const;
|
int getThemeColor() const;
|
||||||
void setThemeColor(const int& value);
|
void setThemeColor(int value);
|
||||||
|
|
||||||
StyleType getStylePreference() const;
|
StyleType getStylePreference() const;
|
||||||
void setStylePreference(StyleType newValue);
|
void setStylePreference(StyleType newValue);
|
||||||
|
@ -239,60 +404,54 @@ public:
|
||||||
const QFont& getChatMessageFont() const;
|
const QFont& getChatMessageFont() const;
|
||||||
void setChatMessageFont(const QFont& font);
|
void setChatMessageFont(const QFont& font);
|
||||||
|
|
||||||
int getFirstColumnHandlePos() const;
|
|
||||||
void setFirstColumnHandlePos(const int pos);
|
|
||||||
|
|
||||||
int getSecondColumnHandlePosFromRight() const;
|
|
||||||
void setSecondColumnHandlePosFromRight(const int pos);
|
|
||||||
|
|
||||||
const QString& getTimestampFormat() const;
|
const QString& getTimestampFormat() const;
|
||||||
void setTimestampFormat(const QString& format);
|
void setTimestampFormat(const QString& format);
|
||||||
|
|
||||||
const QString& getDateFormat() const;
|
const QString& getDateFormat() const;
|
||||||
void setDateFormat(const QString& format);
|
void setDateFormat(const QString& format);
|
||||||
|
|
||||||
bool isMinimizeOnCloseEnabled() const;
|
bool getMinimizeOnClose() const;
|
||||||
void setMinimizeOnClose(bool newValue);
|
void setMinimizeOnClose(bool newValue);
|
||||||
|
|
||||||
bool getStatusChangeNotificationEnabled() const;
|
bool getStatusChangeNotificationEnabled() const;
|
||||||
void setStatusChangeNotificationEnabled(bool newValue);
|
void setStatusChangeNotificationEnabled(bool newValue);
|
||||||
|
|
||||||
// Privacy
|
// Privacy
|
||||||
bool isTypingNotificationEnabled() const;
|
bool getTypingNotification() const;
|
||||||
void setTypingNotification(bool enabled);
|
void setTypingNotification(bool enabled);
|
||||||
|
|
||||||
// State
|
// State
|
||||||
QByteArray getWindowGeometry() const;
|
QByteArray getWindowGeometry() const;
|
||||||
void setWindowGeometry(const QByteArray &value);
|
void setWindowGeometry(const QByteArray& value);
|
||||||
|
|
||||||
QByteArray getWindowState() const;
|
QByteArray getWindowState() const;
|
||||||
void setWindowState(const QByteArray &value);
|
void setWindowState(const QByteArray& value);
|
||||||
|
|
||||||
QByteArray getSplitterState() const;
|
QByteArray getSplitterState() const;
|
||||||
void setSplitterState(const QByteArray &value);
|
void setSplitterState(const QByteArray& value);
|
||||||
|
|
||||||
QByteArray getDialogGeometry() const;
|
QByteArray getDialogGeometry() const;
|
||||||
void setDialogGeometry(const QByteArray& value);
|
void setDialogGeometry(const QByteArray& value);
|
||||||
|
|
||||||
QByteArray getDialogSplitterState() const;
|
QByteArray getDialogSplitterState() const;
|
||||||
void setDialogSplitterState(const QByteArray &value);
|
void setDialogSplitterState(const QByteArray& value);
|
||||||
|
|
||||||
QByteArray getDialogSettingsGeometry() const;
|
QByteArray getDialogSettingsGeometry() const;
|
||||||
void setDialogSettingsGeometry(const QByteArray& value);
|
void setDialogSettingsGeometry(const QByteArray& value);
|
||||||
|
|
||||||
QString getFriendAdress(const QString &publicKey) const;
|
QString getFriendAddress(const QString& publicKey) const;
|
||||||
void updateFriendAdress(const QString &newAddr);
|
void updateFriendAddress(const QString& newAddr);
|
||||||
|
|
||||||
QString getFriendAlias(const ToxId &id) const;
|
QString getFriendAlias(const ToxId& id) const;
|
||||||
void setFriendAlias(const ToxId &id, const QString &alias);
|
void setFriendAlias(const ToxId& id, const QString& alias);
|
||||||
|
|
||||||
int getFriendCircleID(const ToxId &id) const;
|
int getFriendCircleID(const ToxId& id) const;
|
||||||
void setFriendCircleID(const ToxId &id, int circleID);
|
void setFriendCircleID(const ToxId& id, int circleID);
|
||||||
|
|
||||||
QDate getFriendActivity(const ToxId &id) const;
|
QDate getFriendActivity(const ToxId& id) const;
|
||||||
void setFriendActivity(const ToxId &id, const QDate &date);
|
void setFriendActivity(const ToxId& id, const QDate &date);
|
||||||
|
|
||||||
void removeFriendSettings(const ToxId &id);
|
void removeFriendSettings(const ToxId& id);
|
||||||
|
|
||||||
bool getFauxOfflineMessaging() const;
|
bool getFauxOfflineMessaging() const;
|
||||||
void setFauxOfflineMessaging(bool value);
|
void setFauxOfflineMessaging(bool value);
|
||||||
|
@ -313,14 +472,14 @@ public:
|
||||||
void setAutoLogin(bool state);
|
void setAutoLogin(bool state);
|
||||||
|
|
||||||
int getCircleCount() const;
|
int getCircleCount() const;
|
||||||
int addCircle(const QString &name = QString());
|
int addCircle(const QString& name = QString());
|
||||||
int removeCircle(int id);
|
int removeCircle(int id);
|
||||||
QString getCircleName(int id) const;
|
QString getCircleName(int id) const;
|
||||||
void setCircleName(int id, const QString &name);
|
void setCircleName(int id, const QString& name);
|
||||||
bool getCircleExpanded(int id) const;
|
bool getCircleExpanded(int id) const;
|
||||||
void setCircleExpanded(int id, bool expanded);
|
void setCircleExpanded(int id, bool expanded);
|
||||||
|
|
||||||
bool addFriendRequest(const QString &friendAddress, const QString &message);
|
bool addFriendRequest(const QString& friendAddress, const QString& message);
|
||||||
unsigned int getUnreadFriendRequests() const;
|
unsigned int getUnreadFriendRequests() const;
|
||||||
Request getFriendRequest(int index) const;
|
Request getFriendRequest(int index) const;
|
||||||
int getFriendRequestSize() const;
|
int getFriendRequestSize() const;
|
||||||
|
|
|
@ -165,7 +165,7 @@ void AddFriendForm::onSendTriggered()
|
||||||
if (toxId.toString().isEmpty()) // If it isn't supported
|
if (toxId.toString().isEmpty()) // If it isn't supported
|
||||||
{
|
{
|
||||||
qDebug() << "Toxme didn't return a ToxID, trying ToxDNS";
|
qDebug() << "Toxme didn't return a ToxID, trying ToxDNS";
|
||||||
if (Settings::getInstance().getProxyType() != ProxyType::ptNone)
|
if (Settings::getInstance().getProxyType() != Settings::ProxyType::ptNone)
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton btn = QMessageBox::warning(main, "qTox", tr("qTox needs to use the Tox DNS, but can't do it through a proxy.\n\
|
QMessageBox::StandardButton btn = QMessageBox::warning(main, "qTox", tr("qTox needs to use the Tox DNS, but can't do it through a proxy.\n\
|
||||||
Ignore the proxy and connect to the Internet directly?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
|
Ignore the proxy and connect to the Internet directly?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
|
||||||
|
|
|
@ -163,7 +163,7 @@ void ChatForm::onSendTriggered()
|
||||||
|
|
||||||
void ChatForm::onTextEditChanged()
|
void ChatForm::onTextEditChanged()
|
||||||
{
|
{
|
||||||
if (!Settings::getInstance().isTypingNotificationEnabled())
|
if (!Settings::getInstance().getTypingNotification())
|
||||||
{
|
{
|
||||||
if (isTyping)
|
if (isTyping)
|
||||||
Core::getInstance()->sendTyping(f->getFriendID(), false);
|
Core::getInstance()->sendTyping(f->getFriendID(), false);
|
||||||
|
|
|
@ -76,8 +76,10 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
chatWidget = new ChatLog(this);
|
chatWidget = new ChatLog(this);
|
||||||
chatWidget->setBusyNotification(ChatMessage::createBusyNotification());
|
chatWidget->setBusyNotification(ChatMessage::createBusyNotification());
|
||||||
|
|
||||||
connect(&Settings::getInstance(), &Settings::emojiFontChanged,
|
// settings
|
||||||
this, [this]() { chatWidget->forceRelayout(); });
|
const Settings& s = Settings::getInstance();
|
||||||
|
connect(&s, &Settings::emojiFontPointSizeChanged,
|
||||||
|
chatWidget, &ChatLog::forceRelayout);
|
||||||
|
|
||||||
msgEdit = new ChatTextEdit();
|
msgEdit = new ChatTextEdit();
|
||||||
|
|
||||||
|
|
|
@ -537,7 +537,7 @@ void AVForm::on_microphoneSlider_valueChanged(int value)
|
||||||
{
|
{
|
||||||
const qreal dB = value / 10.0;
|
const qreal dB = value / 10.0;
|
||||||
|
|
||||||
Settings::getInstance().setAudioInGain(dB);
|
Settings::getInstance().setAudioInGainDecibel(dB);
|
||||||
Audio::getInstance().setInputGain(dB);
|
Audio::getInstance().setInputGain(dB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent)
|
||||||
const QFont chatBaseFont = s.getChatMessageFont();
|
const QFont chatBaseFont = s.getChatMessageFont();
|
||||||
bodyUI->txtChatFontSize->setValue(QFontInfo(chatBaseFont).pixelSize());
|
bodyUI->txtChatFontSize->setValue(QFontInfo(chatBaseFont).pixelSize());
|
||||||
bodyUI->txtChatFont->setCurrentFont(chatBaseFont);
|
bodyUI->txtChatFont->setCurrentFont(chatBaseFont);
|
||||||
bodyUI->textStyleComboBox->setCurrentIndex(s.getStylePreference());
|
bodyUI->textStyleComboBox->setCurrentIndex(static_cast<int>(s.getStylePreference()));
|
||||||
bodyUI->cbAutorun->setChecked(s.getAutorun());
|
bodyUI->cbAutorun->setChecked(s.getAutorun());
|
||||||
|
|
||||||
bool showSystemTray = s.getShowSystemTray();
|
bool showSystemTray = s.getShowSystemTray();
|
||||||
|
@ -407,7 +407,9 @@ void GeneralForm::onUseEmoticonsChange()
|
||||||
|
|
||||||
void GeneralForm::onStyleUpdated()
|
void GeneralForm::onStyleUpdated()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setStylePreference(static_cast<StyleType>(bodyUI->textStyleComboBox->currentIndex()));
|
Settings::StyleType styleType =
|
||||||
|
static_cast<Settings::StyleType>(bodyUI->textStyleComboBox->currentIndex());
|
||||||
|
Settings::getInstance().setStylePreference(styleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onSetStatusChange()
|
void GeneralForm::onSetStatusChange()
|
||||||
|
@ -434,18 +436,16 @@ void GeneralForm::onProxyAddrEdited()
|
||||||
|
|
||||||
void GeneralForm::onProxyPortEdited(int port)
|
void GeneralForm::onProxyPortEdited(int port)
|
||||||
{
|
{
|
||||||
if (port > 0)
|
Settings::getInstance().setProxyPort(static_cast<quint16>(port));
|
||||||
Settings::getInstance().setProxyPort(port);
|
|
||||||
else
|
|
||||||
Settings::getInstance().setProxyPort(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onUseProxyUpdated()
|
void GeneralForm::onUseProxyUpdated()
|
||||||
{
|
{
|
||||||
int proxytype = bodyUI->proxyType->currentIndex();
|
Settings::ProxyType proxytype =
|
||||||
|
static_cast<Settings::ProxyType>(bodyUI->proxyType->currentIndex());
|
||||||
|
|
||||||
bodyUI->proxyAddr->setEnabled(proxytype);
|
bodyUI->proxyAddr->setEnabled(proxytype != Settings::ProxyType::ptNone);
|
||||||
bodyUI->proxyPort->setEnabled(proxytype);
|
bodyUI->proxyPort->setEnabled(proxytype != Settings::ProxyType::ptNone);
|
||||||
Settings::getInstance().setProxyType(proxytype);
|
Settings::getInstance().setProxyType(proxytype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,9 @@ void PrivacyForm::setNospam()
|
||||||
|
|
||||||
void PrivacyForm::showEvent(QShowEvent*)
|
void PrivacyForm::showEvent(QShowEvent*)
|
||||||
{
|
{
|
||||||
|
const Settings& s = Settings::getInstance();
|
||||||
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().noSpam);
|
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().noSpam);
|
||||||
bodyUI->cbTypingNotification->setChecked(Settings::getInstance().isTypingNotificationEnabled());
|
bodyUI->cbTypingNotification->setChecked(s.getTypingNotification());
|
||||||
bodyUI->cbKeepHistory->setChecked(Settings::getInstance().getEnableLogging());
|
bodyUI->cbKeepHistory->setChecked(Settings::getInstance().getEnableLogging());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,7 @@ void Widget::onFailedToStartCore()
|
||||||
|
|
||||||
void Widget::onBadProxyCore()
|
void Widget::onBadProxyCore()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setProxyType(0);
|
Settings::getInstance().setProxyType(Settings::ProxyType::ptNone);
|
||||||
QMessageBox critical(this);
|
QMessageBox critical(this);
|
||||||
critical.setText(tr("toxcore failed to start with your proxy settings. qTox cannot run; please modify your "
|
critical.setText(tr("toxcore failed to start with your proxy settings. qTox cannot run; please modify your "
|
||||||
"settings and restart.", "popup text"));
|
"settings and restart.", "popup text"));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user