mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3457
Diadlo (12): feat(settings): Extracted user interface settings on new tab feat(settings): Added reset settings button feat(settings): Deleted settings header feat(settings): Added privacy block feat(settings): Moved proxy to personal settings refactor(proxy): Changed port type on unsigned int. refactor(settings): Changed manual connects to auto-connections refactor: Remove html tags from 'IMPORTANT NOTE' fix(settings): Added loader for old settings refactor: Remove html tags from author block docs(settingsform): Added docs to settings forms refactor: Fixed typo
This commit is contained in:
commit
656dd72396
16
qtox.pro
16
qtox.pro
|
@ -28,11 +28,12 @@ FORMS += \
|
||||||
src/widget/form/profileform.ui \
|
src/widget/form/profileform.ui \
|
||||||
src/widget/form/loadhistorydialog.ui \
|
src/widget/form/loadhistorydialog.ui \
|
||||||
src/widget/form/setpassworddialog.ui \
|
src/widget/form/setpassworddialog.ui \
|
||||||
src/widget/form/settings/aboutsettings.ui \
|
|
||||||
src/widget/form/settings/advancedsettings.ui \
|
|
||||||
src/widget/form/settings/avform.ui \
|
|
||||||
src/widget/form/settings/generalsettings.ui \
|
src/widget/form/settings/generalsettings.ui \
|
||||||
|
src/widget/form/settings/userinterfacesettings.ui \
|
||||||
src/widget/form/settings/privacysettings.ui \
|
src/widget/form/settings/privacysettings.ui \
|
||||||
|
src/widget/form/settings/avform.ui \
|
||||||
|
src/widget/form/settings/advancedsettings.ui \
|
||||||
|
src/widget/form/settings/aboutsettings.ui \
|
||||||
src/widget/form/removefrienddialog.ui \
|
src/widget/form/removefrienddialog.ui \
|
||||||
src/widget/about/aboutuser.ui
|
src/widget/about/aboutuser.ui
|
||||||
|
|
||||||
|
@ -360,7 +361,8 @@ HEADERS += \
|
||||||
src/widget/about/aboutuser.h \
|
src/widget/about/aboutuser.h \
|
||||||
src/widget/form/groupinviteform.h \
|
src/widget/form/groupinviteform.h \
|
||||||
src/widget/tool/profileimporter.h \
|
src/widget/tool/profileimporter.h \
|
||||||
src/widget/passwordedit.h
|
src/widget/passwordedit.h \
|
||||||
|
src/widget/form/settings/userinterfaceform.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/ipc.cpp \
|
src/ipc.cpp \
|
||||||
|
@ -423,11 +425,14 @@ SOURCES += \
|
||||||
src/video/groupnetcamview.cpp \
|
src/video/groupnetcamview.cpp \
|
||||||
src/video/netcamview.cpp \
|
src/video/netcamview.cpp \
|
||||||
src/video/videosurface.cpp \
|
src/video/videosurface.cpp \
|
||||||
|
src/video/videomode.cpp \
|
||||||
src/widget/form/addfriendform.cpp \
|
src/widget/form/addfriendform.cpp \
|
||||||
src/widget/form/settingswidget.cpp \
|
src/widget/form/settingswidget.cpp \
|
||||||
src/widget/form/settings/generalform.cpp \
|
src/widget/form/settings/generalform.cpp \
|
||||||
src/widget/form/settings/privacyform.cpp \
|
src/widget/form/settings/privacyform.cpp \
|
||||||
src/widget/form/settings/avform.cpp \
|
src/widget/form/settings/avform.cpp \
|
||||||
|
src/widget/form/settings/userinterfaceform.cpp \
|
||||||
|
src/widget/form/settings/genericsettings.cpp \
|
||||||
src/widget/form/profileform.cpp \
|
src/widget/form/profileform.cpp \
|
||||||
src/widget/form/filesform.cpp \
|
src/widget/form/filesform.cpp \
|
||||||
src/widget/tool/chattextedit.cpp \
|
src/widget/tool/chattextedit.cpp \
|
||||||
|
@ -479,5 +484,4 @@ SOURCES += \
|
||||||
src/widget/about/aboutuser.cpp \
|
src/widget/about/aboutuser.cpp \
|
||||||
src/widget/form/groupinviteform.cpp \
|
src/widget/form/groupinviteform.cpp \
|
||||||
src/widget/tool/profileimporter.cpp \
|
src/widget/tool/profileimporter.cpp \
|
||||||
src/widget/passwordedit.cpp \
|
src/widget/passwordedit.cpp
|
||||||
src/video/videomode.cpp
|
|
||||||
|
|
|
@ -135,11 +135,15 @@ void Settings::loadGlobal()
|
||||||
|
|
||||||
QSettings s(filePath, QSettings::IniFormat);
|
QSettings s(filePath, QSettings::IniFormat);
|
||||||
s.setIniCodec("UTF-8");
|
s.setIniCodec("UTF-8");
|
||||||
|
|
||||||
s.beginGroup("Login");
|
s.beginGroup("Login");
|
||||||
|
{
|
||||||
autoLogin = s.value("autoLogin", false).toBool();
|
autoLogin = s.value("autoLogin", false).toBool();
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("DHT Server");
|
s.beginGroup("DHT Server");
|
||||||
|
{
|
||||||
if (s.value("useCustomList").toBool())
|
if (s.value("useCustomList").toBool())
|
||||||
{
|
{
|
||||||
useCustomDhtList = true;
|
useCustomDhtList = true;
|
||||||
|
@ -159,21 +163,33 @@ void Settings::loadGlobal()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
useCustomDhtList=false;
|
useCustomDhtList = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("General");
|
s.beginGroup("General");
|
||||||
enableIPv6 = s.value("enableIPv6", true).toBool();
|
{
|
||||||
|
{
|
||||||
|
// TODO: values in this block are moved -> remove in future
|
||||||
|
enableIPv6 = s.value("enableIPv6", true).toBool();
|
||||||
|
makeToxPortable = s.value("makeToxPortable", false).toBool();
|
||||||
|
forceTCP = s.value("forceTCP", false).toBool();
|
||||||
|
proxyType = static_cast<ProxyType>(s.value("proxyType", 0).toInt());
|
||||||
|
proxyAddr = s.value("proxyAddr", "").toString();
|
||||||
|
proxyPort = static_cast<quint16>(s.value("proxyPort", 0).toUInt());
|
||||||
|
showWindow = s.value("showWindow", true).toBool();
|
||||||
|
showInFront = s.value("showInFront", false).toBool();
|
||||||
|
groupAlwaysNotify = s.value("groupAlwaysNotify", false).toBool();
|
||||||
|
separateWindow = s.value("separateWindow", false).toBool();
|
||||||
|
dontGroupWindows = s.value("dontGroupWindows", true).toBool();
|
||||||
|
groupchatPosition = s.value("groupchatPosition", true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
translation = s.value("translation", "en").toString();
|
translation = s.value("translation", "en").toString();
|
||||||
showSystemTray = s.value("showSystemTray", true).toBool();
|
showSystemTray = s.value("showSystemTray", true).toBool();
|
||||||
makeToxPortable = s.value("makeToxPortable", false).toBool();
|
|
||||||
autostartInTray = s.value("autostartInTray", false).toBool();
|
autostartInTray = s.value("autostartInTray", false).toBool();
|
||||||
closeToTray = s.value("closeToTray", false).toBool();
|
closeToTray = s.value("closeToTray", false).toBool();
|
||||||
forceTCP = s.value("forceTCP", false).toBool();
|
|
||||||
proxyType = static_cast<ProxyType>(s.value("proxyType", 0).toInt());
|
|
||||||
proxyAddr = s.value("proxyAddr", "").toString();
|
|
||||||
proxyPort = static_cast<quint16>(s.value("proxyPort", 0).toUInt());
|
|
||||||
if (currentProfile.isEmpty())
|
if (currentProfile.isEmpty())
|
||||||
{
|
{
|
||||||
currentProfile = s.value("currentProfile", "").toString();
|
currentProfile = s.value("currentProfile", "").toString();
|
||||||
|
@ -181,41 +197,51 @@ void Settings::loadGlobal()
|
||||||
}
|
}
|
||||||
autoAwayTime = s.value("autoAwayTime", 10).toInt();
|
autoAwayTime = s.value("autoAwayTime", 10).toInt();
|
||||||
checkUpdates = s.value("checkUpdates", true).toBool();
|
checkUpdates = s.value("checkUpdates", true).toBool();
|
||||||
showWindow = s.value("showWindow", true).toBool();
|
|
||||||
showInFront = s.value("showInFront", false).toBool();
|
|
||||||
notifySound = s.value("notifySound", true).toBool();
|
notifySound = s.value("notifySound", true).toBool();
|
||||||
busySound = s.value("busySound", false).toBool();
|
busySound = s.value("busySound", false).toBool();
|
||||||
groupAlwaysNotify = s.value("groupAlwaysNotify", false).toBool();
|
|
||||||
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
|
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
|
||||||
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
|
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
|
||||||
globalAutoAcceptDir = s.value("globalAutoAcceptDir",
|
globalAutoAcceptDir = s.value("globalAutoAcceptDir", QStandardPaths::locate(
|
||||||
QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory)
|
QStandardPaths::HomeLocation,
|
||||||
).toString();
|
QString(),
|
||||||
separateWindow = s.value("separateWindow", false).toBool();
|
QStandardPaths::LocateDirectory)).toString();
|
||||||
dontGroupWindows = s.value("dontGroupWindows", true).toBool();
|
|
||||||
groupchatPosition = s.value("groupchatPosition", true).toBool();
|
|
||||||
stylePreference = static_cast<StyleType>(s.value("stylePreference", 1).toInt());
|
stylePreference = static_cast<StyleType>(s.value("stylePreference", 1).toInt());
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Advanced");
|
s.beginGroup("Advanced");
|
||||||
Db::syncType sType = static_cast<Db::syncType>(s.value("dbSyncType", 2).toInt());
|
{
|
||||||
|
makeToxPortable = s.value("makeToxPortable", false).toBool();
|
||||||
|
enableIPv6 = s.value("enableIPv6", true).toBool();
|
||||||
|
forceTCP = s.value("forceTCP", false).toBool();
|
||||||
|
int type = s.value("dbSyncType", static_cast<int>(Db::syncType::stFull)).toInt();
|
||||||
|
Db::syncType sType = static_cast<Db::syncType>(type);
|
||||||
setDbSyncType(sType);
|
setDbSyncType(sType);
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Widgets");
|
s.beginGroup("Widgets");
|
||||||
|
{
|
||||||
QList<QString> objectNames = s.childKeys();
|
QList<QString> objectNames = s.childKeys();
|
||||||
for (const QString& name : objectNames)
|
for (const QString& name : objectNames)
|
||||||
widgetSettings[name] = s.value(name).toByteArray();
|
widgetSettings[name] = s.value(name).toByteArray();
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("GUI");
|
s.beginGroup("GUI");
|
||||||
|
{
|
||||||
|
showWindow = s.value("showWindow", true).toBool();
|
||||||
|
showInFront = s.value("showInFront", false).toBool();
|
||||||
|
groupAlwaysNotify = s.value("groupAlwaysNotify", false).toBool();
|
||||||
|
groupchatPosition = s.value("groupchatPosition", true).toBool();
|
||||||
|
separateWindow = s.value("separateWindow", false).toBool();
|
||||||
|
dontGroupWindows = s.value("dontGroupWindows", true).toBool();
|
||||||
|
|
||||||
const QString DEFAULT_SMILEYS = ":/smileys/emojione/emoticons.xml";
|
const QString DEFAULT_SMILEYS = ":/smileys/emojione/emoticons.xml";
|
||||||
smileyPack = s.value("smileyPack", DEFAULT_SMILEYS).toString();
|
smileyPack = s.value("smileyPack", DEFAULT_SMILEYS).toString();
|
||||||
if (!SmileyPack::isValid(smileyPack))
|
if (!SmileyPack::isValid(smileyPack))
|
||||||
{
|
|
||||||
smileyPack = DEFAULT_SMILEYS;
|
smileyPack = DEFAULT_SMILEYS;
|
||||||
}
|
|
||||||
emojiFontPointSize = s.value("emojiFontPointSize", 16).toInt();
|
emojiFontPointSize = s.value("emojiFontPointSize", 16).toInt();
|
||||||
firstColumnHandlePos = s.value("firstColumnHandlePos", 50).toInt();
|
firstColumnHandlePos = s.value("firstColumnHandlePos", 50).toInt();
|
||||||
secondColumnHandlePosFromRight = s.value("secondColumnHandlePosFromRight", 50).toInt();
|
secondColumnHandlePosFromRight = s.value("secondColumnHandlePosFromRight", 50).toInt();
|
||||||
|
@ -235,6 +261,7 @@ void Settings::loadGlobal()
|
||||||
else
|
else
|
||||||
style = "None";
|
style = "None";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Chat");
|
s.beginGroup("Chat");
|
||||||
|
@ -244,29 +271,35 @@ void Settings::loadGlobal()
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("State");
|
s.beginGroup("State");
|
||||||
|
{
|
||||||
windowGeometry = s.value("windowGeometry", QByteArray()).toByteArray();
|
windowGeometry = s.value("windowGeometry", QByteArray()).toByteArray();
|
||||||
windowState = s.value("windowState", QByteArray()).toByteArray();
|
windowState = s.value("windowState", QByteArray()).toByteArray();
|
||||||
splitterState = s.value("splitterState", QByteArray()).toByteArray();
|
splitterState = s.value("splitterState", QByteArray()).toByteArray();
|
||||||
dialogGeometry = s.value("dialogGeometry", QByteArray()).toByteArray();
|
dialogGeometry = s.value("dialogGeometry", QByteArray()).toByteArray();
|
||||||
dialogSplitterState = s.value("dialogSplitterState", QByteArray()).toByteArray();
|
dialogSplitterState = s.value("dialogSplitterState", QByteArray()).toByteArray();
|
||||||
dialogSettingsGeometry = s.value("dialogSettingsGeometry", QByteArray()).toByteArray();
|
dialogSettingsGeometry = s.value("dialogSettingsGeometry", QByteArray()).toByteArray();
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Audio");
|
s.beginGroup("Audio");
|
||||||
|
{
|
||||||
inDev = s.value("inDev", "").toString();
|
inDev = s.value("inDev", "").toString();
|
||||||
audioInDevEnabled = s.value("audioInDevEnabled", true).toBool();
|
audioInDevEnabled = s.value("audioInDevEnabled", true).toBool();
|
||||||
outDev = s.value("outDev", "").toString();
|
outDev = s.value("outDev", "").toString();
|
||||||
audioOutDevEnabled = s.value("audioOutDevEnabled", true).toBool();
|
audioOutDevEnabled = s.value("audioOutDevEnabled", true).toBool();
|
||||||
audioInGainDecibel = s.value("inGain", 0).toReal();
|
audioInGainDecibel = s.value("inGain", 0).toReal();
|
||||||
outVolume = s.value("outVolume", 100).toInt();
|
outVolume = s.value("outVolume", 100).toInt();
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Video");
|
s.beginGroup("Video");
|
||||||
|
{
|
||||||
videoDev = s.value("videoDev", "").toString();
|
videoDev = s.value("videoDev", "").toString();
|
||||||
camVideoRes = s.value("camVideoRes", QRect()).toRect();
|
camVideoRes = s.value("camVideoRes", QRect()).toRect();
|
||||||
screenRegion = s.value("screenRegion", QRect()).toRect();
|
screenRegion = s.value("screenRegion", QRect()).toRect();
|
||||||
screenGrabbed = s.value("screenGrabbed", false).toBool();
|
screenGrabbed = s.value("screenGrabbed", false).toBool();
|
||||||
camVideoFPS = static_cast<quint16>(s.value("camVideoFPS", 0).toUInt());
|
camVideoFPS = static_cast<quint16>(s.value("camVideoFPS", 0).toUInt());
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
// Read the embedded DHT bootstrap nodes list if needed
|
// Read the embedded DHT bootstrap nodes list if needed
|
||||||
|
@ -323,11 +356,14 @@ void Settings::loadPersonal(Profile* profile)
|
||||||
friendLst.clear();
|
friendLst.clear();
|
||||||
|
|
||||||
ps.beginGroup("Privacy");
|
ps.beginGroup("Privacy");
|
||||||
|
{
|
||||||
typingNotification = ps.value("typingNotification", true).toBool();
|
typingNotification = ps.value("typingNotification", true).toBool();
|
||||||
enableLogging = ps.value("enableLogging", true).toBool();
|
enableLogging = ps.value("enableLogging", true).toBool();
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("Friends");
|
ps.beginGroup("Friends");
|
||||||
|
{
|
||||||
int size = ps.beginReadArray("Friend");
|
int size = ps.beginReadArray("Friend");
|
||||||
friendLst.reserve(size);
|
friendLst.reserve(size);
|
||||||
for (int i = 0; i < size; i ++)
|
for (int i = 0; i < size; i ++)
|
||||||
|
@ -346,10 +382,12 @@ void Settings::loadPersonal(Profile* profile)
|
||||||
friendLst[ToxId(fp.addr).publicKey] = fp;
|
friendLst[ToxId(fp.addr).publicKey] = fp;
|
||||||
}
|
}
|
||||||
ps.endArray();
|
ps.endArray();
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("Requests");
|
ps.beginGroup("Requests");
|
||||||
size = ps.beginReadArray("Request");
|
{
|
||||||
|
int size = ps.beginReadArray("Request");
|
||||||
friendRequests.clear();
|
friendRequests.clear();
|
||||||
friendRequests.reserve(size);
|
friendRequests.reserve(size);
|
||||||
for (int i = 0; i < size; i ++)
|
for (int i = 0; i < size; i ++)
|
||||||
|
@ -362,14 +400,34 @@ void Settings::loadPersonal(Profile* profile)
|
||||||
friendRequests.push_back(request);
|
friendRequests.push_back(request);
|
||||||
}
|
}
|
||||||
ps.endArray();
|
ps.endArray();
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
|
// TODO: values in this group are moved -> remove in future
|
||||||
ps.beginGroup("General");
|
ps.beginGroup("General");
|
||||||
|
{
|
||||||
compactLayout = ps.value("compactLayout", true).toBool();
|
compactLayout = ps.value("compactLayout", true).toBool();
|
||||||
|
}
|
||||||
|
ps.endGroup();
|
||||||
|
|
||||||
|
ps.beginGroup("GUI");
|
||||||
|
{
|
||||||
|
compactLayout = ps.value("compactLayout", true).toBool();
|
||||||
|
}
|
||||||
|
ps.endGroup();
|
||||||
|
|
||||||
|
ps.beginGroup("Proxy");
|
||||||
|
{
|
||||||
|
int type = ps.value("proxyType", static_cast<int>(ProxyType::ptNone)).toInt();
|
||||||
|
setProxyType(static_cast<ProxyType>(type));
|
||||||
|
proxyAddr = ps.value("proxyAddr", "").toString();
|
||||||
|
proxyPort = static_cast<quint16>(ps.value("proxyPort", 0).toUInt());
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("Circles");
|
ps.beginGroup("Circles");
|
||||||
size = ps.beginReadArray("Circle");
|
{
|
||||||
|
int size = ps.beginReadArray("Circle");
|
||||||
circleLst.clear();
|
circleLst.clear();
|
||||||
circleLst.reserve(size);
|
circleLst.reserve(size);
|
||||||
for (int i = 0; i < size; i ++)
|
for (int i = 0; i < size; i ++)
|
||||||
|
@ -381,16 +439,33 @@ void Settings::loadPersonal(Profile* profile)
|
||||||
circleLst.push_back(cp);
|
circleLst.push_back(cp);
|
||||||
}
|
}
|
||||||
ps.endArray();
|
ps.endArray();
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("Toxme");
|
ps.beginGroup("Toxme");
|
||||||
|
{
|
||||||
toxmeInfo = ps.value("info", "").toString();
|
toxmeInfo = ps.value("info", "").toString();
|
||||||
toxmeBio = ps.value("bio", "").toString();
|
toxmeBio = ps.value("bio", "").toString();
|
||||||
toxmePriv = ps.value("priv", false).toBool();
|
toxmePriv = ps.value("priv", false).toBool();
|
||||||
toxmePass = ps.value("pass", "").toString();
|
toxmePass = ps.value("pass", "").toString();
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::resetToDefault()
|
||||||
|
{
|
||||||
|
// To stop saving
|
||||||
|
loaded = false;
|
||||||
|
|
||||||
|
// Remove file with profile settings
|
||||||
|
QDir dir(getSettingsDirPath());
|
||||||
|
Profile *profile = Nexus::getProfile();
|
||||||
|
QString localPath = dir.filePath(profile->getName() + ".ini");
|
||||||
|
QFile local(localPath);
|
||||||
|
if (local.exists())
|
||||||
|
local.remove();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Asynchronous, saves the global settings.
|
* @brief Asynchronous, saves the global settings.
|
||||||
*/
|
*/
|
||||||
|
@ -400,6 +475,9 @@ void Settings::saveGlobal()
|
||||||
return (void) QMetaObject::invokeMethod(&getInstance(), "saveGlobal");
|
return (void) QMetaObject::invokeMethod(&getInstance(), "saveGlobal");
|
||||||
|
|
||||||
QMutexLocker locker{&bigLock};
|
QMutexLocker locker{&bigLock};
|
||||||
|
if (!loaded)
|
||||||
|
return;
|
||||||
|
|
||||||
QString path = getSettingsDirPath() + globalSettingsFile;
|
QString path = getSettingsDirPath() + globalSettingsFile;
|
||||||
qDebug() << "Saving global settings at " + path;
|
qDebug() << "Saving global settings at " + path;
|
||||||
|
|
||||||
|
@ -409,10 +487,13 @@ void Settings::saveGlobal()
|
||||||
s.clear();
|
s.clear();
|
||||||
|
|
||||||
s.beginGroup("Login");
|
s.beginGroup("Login");
|
||||||
|
{
|
||||||
s.setValue("autoLogin", autoLogin);
|
s.setValue("autoLogin", autoLogin);
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("DHT Server");
|
s.beginGroup("DHT Server");
|
||||||
|
{
|
||||||
s.setValue("useCustomList", useCustomDhtList);
|
s.setValue("useCustomList", useCustomDhtList);
|
||||||
s.beginWriteArray("dhtServerList", dhtServerList.size());
|
s.beginWriteArray("dhtServerList", dhtServerList.size());
|
||||||
for (int i = 0; i < dhtServerList.size(); i ++)
|
for (int i = 0; i < dhtServerList.size(); i ++)
|
||||||
|
@ -424,47 +505,53 @@ void Settings::saveGlobal()
|
||||||
s.setValue("port", dhtServerList[i].port);
|
s.setValue("port", dhtServerList[i].port);
|
||||||
}
|
}
|
||||||
s.endArray();
|
s.endArray();
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("General");
|
s.beginGroup("General");
|
||||||
s.setValue("enableIPv6", enableIPv6);
|
{
|
||||||
s.setValue("translation",translation);
|
s.setValue("translation",translation);
|
||||||
s.setValue("makeToxPortable",makeToxPortable);
|
|
||||||
s.setValue("showSystemTray", showSystemTray);
|
s.setValue("showSystemTray", showSystemTray);
|
||||||
s.setValue("autostartInTray",autostartInTray);
|
s.setValue("autostartInTray",autostartInTray);
|
||||||
s.setValue("closeToTray", closeToTray);
|
s.setValue("closeToTray", closeToTray);
|
||||||
s.setValue("proxyType", static_cast<int>(proxyType));
|
|
||||||
s.setValue("forceTCP", forceTCP);
|
|
||||||
s.setValue("proxyAddr", proxyAddr);
|
|
||||||
s.setValue("proxyPort", proxyPort);
|
|
||||||
s.setValue("currentProfile", currentProfile);
|
s.setValue("currentProfile", currentProfile);
|
||||||
s.setValue("autoAwayTime", autoAwayTime);
|
s.setValue("autoAwayTime", autoAwayTime);
|
||||||
s.setValue("checkUpdates", checkUpdates);
|
s.setValue("checkUpdates", checkUpdates);
|
||||||
s.setValue("showWindow", showWindow);
|
|
||||||
s.setValue("showInFront", showInFront);
|
|
||||||
s.setValue("notifySound", notifySound);
|
s.setValue("notifySound", notifySound);
|
||||||
s.setValue("busySound", busySound);
|
s.setValue("busySound", busySound);
|
||||||
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
|
||||||
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
||||||
s.setValue("separateWindow", separateWindow);
|
|
||||||
s.setValue("dontGroupWindows", dontGroupWindows);
|
|
||||||
s.setValue("groupchatPosition", groupchatPosition);
|
|
||||||
s.setValue("autoSaveEnabled", autoSaveEnabled);
|
s.setValue("autoSaveEnabled", autoSaveEnabled);
|
||||||
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
|
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
|
||||||
s.setValue("stylePreference", static_cast<int>(stylePreference));
|
s.setValue("stylePreference", static_cast<int>(stylePreference));
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Advanced");
|
s.beginGroup("Advanced");
|
||||||
|
{
|
||||||
|
s.setValue("makeToxPortable",makeToxPortable);
|
||||||
|
s.setValue("enableIPv6", enableIPv6);
|
||||||
|
s.setValue("forceTCP", forceTCP);
|
||||||
s.setValue("dbSyncType", static_cast<int>(dbSyncType));
|
s.setValue("dbSyncType", static_cast<int>(dbSyncType));
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Widgets");
|
s.beginGroup("Widgets");
|
||||||
const QList<QString> widgetNames = widgetSettings.keys();
|
{
|
||||||
for (const QString& name : widgetNames)
|
const QList<QString> widgetNames = widgetSettings.keys();
|
||||||
s.setValue(name, widgetSettings.value(name));
|
for (const QString& name : widgetNames)
|
||||||
|
s.setValue(name, widgetSettings.value(name));
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("GUI");
|
s.beginGroup("GUI");
|
||||||
|
{
|
||||||
|
s.setValue("showWindow", showWindow);
|
||||||
|
s.setValue("showInFront", showInFront);
|
||||||
|
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
||||||
|
s.setValue("separateWindow", separateWindow);
|
||||||
|
s.setValue("dontGroupWindows", dontGroupWindows);
|
||||||
|
s.setValue("groupchatPosition", groupchatPosition);
|
||||||
|
|
||||||
s.setValue("smileyPack", smileyPack);
|
s.setValue("smileyPack", smileyPack);
|
||||||
s.setValue("emojiFontPointSize", emojiFontPointSize);
|
s.setValue("emojiFontPointSize", emojiFontPointSize);
|
||||||
s.setValue("firstColumnHandlePos", firstColumnHandlePos);
|
s.setValue("firstColumnHandlePos", firstColumnHandlePos);
|
||||||
|
@ -478,6 +565,7 @@ void Settings::saveGlobal()
|
||||||
s.setValue("themeColor", themeColor);
|
s.setValue("themeColor", themeColor);
|
||||||
s.setValue("style", style);
|
s.setValue("style", style);
|
||||||
s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled);
|
s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled);
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Chat");
|
s.beginGroup("Chat");
|
||||||
|
@ -487,29 +575,35 @@ void Settings::saveGlobal()
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("State");
|
s.beginGroup("State");
|
||||||
|
{
|
||||||
s.setValue("windowGeometry", windowGeometry);
|
s.setValue("windowGeometry", windowGeometry);
|
||||||
s.setValue("windowState", windowState);
|
s.setValue("windowState", windowState);
|
||||||
s.setValue("splitterState", splitterState);
|
s.setValue("splitterState", splitterState);
|
||||||
s.setValue("dialogGeometry", dialogGeometry);
|
s.setValue("dialogGeometry", dialogGeometry);
|
||||||
s.setValue("dialogSplitterState", dialogSplitterState);
|
s.setValue("dialogSplitterState", dialogSplitterState);
|
||||||
s.setValue("dialogSettingsGeometry", dialogSettingsGeometry);
|
s.setValue("dialogSettingsGeometry", dialogSettingsGeometry);
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Audio");
|
s.beginGroup("Audio");
|
||||||
|
{
|
||||||
s.setValue("inDev", inDev);
|
s.setValue("inDev", inDev);
|
||||||
s.setValue("audioInDevEnabled", audioInDevEnabled);
|
s.setValue("audioInDevEnabled", audioInDevEnabled);
|
||||||
s.setValue("outDev", outDev);
|
s.setValue("outDev", outDev);
|
||||||
s.setValue("audioOutDevEnabled", audioOutDevEnabled);
|
s.setValue("audioOutDevEnabled", audioOutDevEnabled);
|
||||||
s.setValue("inGain", audioInGainDecibel);
|
s.setValue("inGain", audioInGainDecibel);
|
||||||
s.setValue("outVolume", outVolume);
|
s.setValue("outVolume", outVolume);
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Video");
|
s.beginGroup("Video");
|
||||||
|
{
|
||||||
s.setValue("videoDev", videoDev);
|
s.setValue("videoDev", videoDev);
|
||||||
s.setValue("camVideoRes", camVideoRes);
|
s.setValue("camVideoRes", camVideoRes);
|
||||||
s.setValue("camVideoFPS", camVideoFPS);
|
s.setValue("camVideoFPS", camVideoFPS);
|
||||||
s.setValue("screenRegion", screenRegion);
|
s.setValue("screenRegion", screenRegion);
|
||||||
s.setValue("screenGrabbed", screenGrabbed);
|
s.setValue("screenGrabbed", screenGrabbed);
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,6 +636,8 @@ void Settings::savePersonal(QString profileName, const QString &password)
|
||||||
Q_ARG(QString, profileName), Q_ARG(QString, password));
|
Q_ARG(QString, profileName), Q_ARG(QString, password));
|
||||||
|
|
||||||
QMutexLocker locker{&bigLock};
|
QMutexLocker locker{&bigLock};
|
||||||
|
if (!loaded)
|
||||||
|
return;
|
||||||
|
|
||||||
QString path = getSettingsDirPath() + profileName + ".ini";
|
QString path = getSettingsDirPath() + profileName + ".ini";
|
||||||
|
|
||||||
|
@ -549,6 +645,7 @@ void Settings::savePersonal(QString profileName, const QString &password)
|
||||||
|
|
||||||
SettingsSerializer ps(path, password);
|
SettingsSerializer ps(path, password);
|
||||||
ps.beginGroup("Friends");
|
ps.beginGroup("Friends");
|
||||||
|
{
|
||||||
ps.beginWriteArray("Friend", friendLst.size());
|
ps.beginWriteArray("Friend", friendLst.size());
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (auto& frnd : friendLst)
|
for (auto& frnd : friendLst)
|
||||||
|
@ -566,11 +663,13 @@ void Settings::savePersonal(QString profileName, const QString &password)
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
ps.endArray();
|
ps.endArray();
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("Requests");
|
ps.beginGroup("Requests");
|
||||||
|
{
|
||||||
ps.beginWriteArray("Request", friendRequests.size());
|
ps.beginWriteArray("Request", friendRequests.size());
|
||||||
index = 0;
|
int index = 0;
|
||||||
for (auto& request : friendRequests)
|
for (auto& request : friendRequests)
|
||||||
{
|
{
|
||||||
ps.setArrayIndex(index);
|
ps.setArrayIndex(index);
|
||||||
|
@ -581,15 +680,27 @@ void Settings::savePersonal(QString profileName, const QString &password)
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
ps.endArray();
|
ps.endArray();
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("General");
|
ps.beginGroup("GUI");
|
||||||
|
{
|
||||||
ps.setValue("compactLayout", compactLayout);
|
ps.setValue("compactLayout", compactLayout);
|
||||||
|
}
|
||||||
|
ps.endGroup();
|
||||||
|
|
||||||
|
ps.beginGroup("Proxy");
|
||||||
|
{
|
||||||
|
ps.setValue("proxyType", static_cast<int>(proxyType));
|
||||||
|
ps.setValue("proxyAddr", proxyAddr);
|
||||||
|
ps.setValue("proxyPort", proxyPort);
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("Circles");
|
ps.beginGroup("Circles");
|
||||||
|
{
|
||||||
ps.beginWriteArray("Circle", circleLst.size());
|
ps.beginWriteArray("Circle", circleLst.size());
|
||||||
index = 0;
|
int index = 0;
|
||||||
for (auto& circle : circleLst)
|
for (auto& circle : circleLst)
|
||||||
{
|
{
|
||||||
ps.setArrayIndex(index);
|
ps.setArrayIndex(index);
|
||||||
|
@ -598,18 +709,23 @@ void Settings::savePersonal(QString profileName, const QString &password)
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
ps.endArray();
|
ps.endArray();
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("Privacy");
|
ps.beginGroup("Privacy");
|
||||||
|
{
|
||||||
ps.setValue("typingNotification", typingNotification);
|
ps.setValue("typingNotification", typingNotification);
|
||||||
ps.setValue("enableLogging", enableLogging);
|
ps.setValue("enableLogging", enableLogging);
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.beginGroup("Toxme");
|
ps.beginGroup("Toxme");
|
||||||
|
{
|
||||||
ps.setValue("info", toxmeInfo);
|
ps.setValue("info", toxmeInfo);
|
||||||
ps.setValue("bio", toxmeBio);
|
ps.setValue("bio", toxmeBio);
|
||||||
ps.setValue("priv", toxmePriv);
|
ps.setValue("priv", toxmePriv);
|
||||||
ps.setValue("pass", toxmePass);
|
ps.setValue("pass", toxmePass);
|
||||||
|
}
|
||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
|
|
||||||
ps.save();
|
ps.save();
|
||||||
|
|
|
@ -149,6 +149,8 @@ public:
|
||||||
void loadPersonal();
|
void loadPersonal();
|
||||||
void loadPersonal(Profile *profile);
|
void loadPersonal(Profile *profile);
|
||||||
|
|
||||||
|
void resetToDefault();
|
||||||
|
|
||||||
struct Request
|
struct Request
|
||||||
{
|
{
|
||||||
QString address;
|
QString address;
|
||||||
|
|
|
@ -20,13 +20,24 @@
|
||||||
#include "aboutform.h"
|
#include "aboutform.h"
|
||||||
#include "ui_aboutsettings.h"
|
#include "ui_aboutsettings.h"
|
||||||
|
|
||||||
#include <src/core/recursivesignalblocker.h>
|
|
||||||
#include "src/widget/translator.h"
|
|
||||||
#include "tox/tox.h"
|
|
||||||
#include "src/net/autoupdate.h"
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <tox/tox.h>
|
||||||
|
|
||||||
|
#include "src/core/recursivesignalblocker.h"
|
||||||
|
#include "src/net/autoupdate.h"
|
||||||
|
#include "src/widget/translator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class AboutForm
|
||||||
|
*
|
||||||
|
* This form contains information about qTox and libraries versions, external
|
||||||
|
* links and licence text. Shows progress during an update.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Constructor of AboutForm.
|
||||||
|
*/
|
||||||
AboutForm::AboutForm()
|
AboutForm::AboutForm()
|
||||||
: GenericForm(QPixmap(":/img/settings/general.png"))
|
: GenericForm(QPixmap(":/img/settings/general.png"))
|
||||||
, bodyUI(new Ui::AboutSettings)
|
, bodyUI(new Ui::AboutSettings)
|
||||||
|
@ -47,67 +58,89 @@ AboutForm::AboutForm()
|
||||||
progressTimer->setSingleShot(false);
|
progressTimer->setSingleShot(false);
|
||||||
connect(progressTimer, &QTimer::timeout, this, &AboutForm::showUpdateProgress);
|
connect(progressTimer, &QTimer::timeout, this, &AboutForm::showUpdateProgress);
|
||||||
|
|
||||||
|
eventsInit();
|
||||||
Translator::registerHandler(std::bind(&AboutForm::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&AboutForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update versions and links.
|
||||||
|
*
|
||||||
|
* Update commit hash if built with git, show author and known issues info
|
||||||
|
* It also updates qTox, toxcore and Qt versions.
|
||||||
|
*/
|
||||||
void AboutForm::replaceVersions()
|
void AboutForm::replaceVersions()
|
||||||
{
|
{
|
||||||
// TODO: When we finally have stable releases: build-in a way to tell
|
// TODO: When we finally have stable releases: build-in a way to tell
|
||||||
// nightly builds from stable releases.
|
// nightly builds from stable releases.
|
||||||
|
|
||||||
QString TOXCORE_VERSION = QString::number(TOX_VERSION_MAJOR) + "." +
|
QString TOXCORE_VERSION = QString::number(TOX_VERSION_MAJOR) + "." +
|
||||||
QString::number(TOX_VERSION_MINOR) + "." +
|
QString::number(TOX_VERSION_MINOR) + "." +
|
||||||
QString::number(TOX_VERSION_PATCH);
|
QString::number(TOX_VERSION_PATCH);
|
||||||
|
|
||||||
bodyUI->youareusing->setText(bodyUI->youareusing->text().replace("$GIT_DESCRIBE", QString(GIT_DESCRIBE)));
|
bodyUI->youareusing->setText(bodyUI->youareusing->text().replace("$GIT_DESCRIBE", QString(GIT_DESCRIBE)));
|
||||||
bodyUI->gitVersion->setText(bodyUI->gitVersion->text().replace("$GIT_VERSION", QString(GIT_VERSION)));
|
bodyUI->gitVersion->setText(bodyUI->gitVersion->text().replace("$GIT_VERSION", QString(GIT_VERSION)));
|
||||||
bodyUI->toxCoreVersion->setText(bodyUI->toxCoreVersion->text().replace("$TOXCOREVERSION", TOXCORE_VERSION));
|
bodyUI->toxCoreVersion->setText(bodyUI->toxCoreVersion->text().replace("$TOXCOREVERSION", TOXCORE_VERSION));
|
||||||
bodyUI->qtVersion->setText(bodyUI->qtVersion->text().replace("$QTVERSION", QT_VERSION_STR));
|
bodyUI->qtVersion->setText(bodyUI->qtVersion->text().replace("$QTVERSION", QT_VERSION_STR));
|
||||||
|
|
||||||
|
QString issueBody = QString(
|
||||||
|
"##### Brief Description\n\n"
|
||||||
|
"OS: Windows / OS X / Linux (include version and/or distro)\n"
|
||||||
|
"qTox version: %1\n"
|
||||||
|
"Commit hash: %2\n"
|
||||||
|
"toxcore: %3\n"
|
||||||
|
"Qt: %4\n"
|
||||||
|
"Hardware: \n…\n\n"
|
||||||
|
"Reproducible: Always / Almost Always / Sometimes"
|
||||||
|
" / Rarely / Couldn't Reproduce\n\n"
|
||||||
|
"##### Steps to reproduce\n\n"
|
||||||
|
"1. \n2. \n3. …\n\n"
|
||||||
|
"##### Observed Behavior\n\n\n"
|
||||||
|
"##### Expected Behavior\n\n\n"
|
||||||
|
"##### Additional Info\n"
|
||||||
|
"(links, images, etc go here)\n\n"
|
||||||
|
"----\n\n"
|
||||||
|
"More information on how to write good bug reports in the wiki: "
|
||||||
|
"https://github.com/qTox/qTox/wiki/Writing-Useful-Bug-Reports.\n\n"
|
||||||
|
"Please remove any unnecessary template section before submitting.")
|
||||||
|
.arg(GIT_DESCRIBE, GIT_VERSION, TOXCORE_VERSION, QT_VERSION_STR);
|
||||||
|
|
||||||
|
issueBody.replace("#", "%23").replace(":", "%3A");
|
||||||
|
|
||||||
bodyUI->knownIssues->setText(
|
bodyUI->knownIssues->setText(
|
||||||
tr("A list of all known issues may be found at our %1 at Github."
|
tr("A list of all known issues may be found at our %1 at Github."
|
||||||
" If you discover a bug or security vulnerability within"
|
" If you discover a bug or security vulnerability within"
|
||||||
" qTox, please %3 according to the guidelines in our %2"
|
" qTox, please %3 according to the guidelines in our %2"
|
||||||
" wiki article.")
|
" wiki article.")
|
||||||
.arg(QString::fromUtf8("<a href=\"https://github.com/qTox/qTox/"
|
.arg(createLink("https://github.com/qTox/qTox/issues",
|
||||||
"issues\""
|
tr("bug-tracker")))
|
||||||
" style=\"text-decoration: underline;"
|
.arg(createLink("https://github.com/qTox/qTox/wiki/Writing-Useful-Bug-Reports",
|
||||||
" color:#0000ff;\">%1</a>")
|
tr("Writing Useful Bug Reports")))
|
||||||
.arg(tr("bug-tracker")))
|
.arg(createLink("https://github.com/qTox/qTox/issues/new?body="
|
||||||
.arg(QString::fromUtf8("<a href=\"https://github.com/qTox/qTox/"
|
+ QUrl(issueBody).toEncoded(),
|
||||||
"wiki/Writing-Useful-Bug-Reports\""
|
tr("report it")))
|
||||||
" style=\"text-decoration: underline;"
|
|
||||||
" color:#0000ff;\">%1</a>")
|
|
||||||
.arg(tr("Writing Useful Bug Reports")))
|
|
||||||
.arg(QStringLiteral(
|
|
||||||
"<a href=\"https://github.com/qTox/qTox/issues"
|
|
||||||
"/new?body=%23%23%23%23%23+Brief+Description%0A%0AOS"
|
|
||||||
"%3A+Windows+%2F+OS+X+%2F+Linux+(include+version+and"
|
|
||||||
"%2For+distro)%0AqTox+version%3A+") +
|
|
||||||
QStringLiteral(GIT_DESCRIBE) +
|
|
||||||
QStringLiteral("%0ACommit+hash%3A+") +
|
|
||||||
QStringLiteral(GIT_VERSION) +
|
|
||||||
QStringLiteral("%0Atoxcore%3A+") + TOXCORE_VERSION +
|
|
||||||
QStringLiteral("%0AQt%3A+") +
|
|
||||||
QStringLiteral(QT_VERSION_STR) +
|
|
||||||
QStringLiteral("%0AHardware%3A++%0A%E2%80%A6%0A%0A"
|
|
||||||
"Reproducible%3A+Always+%2F+Almost+Always+"
|
|
||||||
"%2F+Sometimes+%2F+Rarely+%2F+Couldn%27t+"
|
|
||||||
"Reproduce%0A%0A%23%23%23%23%23+Steps+to+"
|
|
||||||
"reproduce%0A%0A1.+%0A2.+%0A3.+%E2%80%A6"
|
|
||||||
"%0A%0A%23%23%23%23%23+Observed+Behavior"
|
|
||||||
"%0A%0A%0A%23%23%23%23%23+Expected+Behavior"
|
|
||||||
"%0A%0A%0A%23%23%23%23%23+Additional+Info"
|
|
||||||
"%0A(links%2C+images%2C+etc+go+here)%0A%0A"
|
|
||||||
"----%0A%0AMore+information+on+how+to+"
|
|
||||||
"write+good+bug+reports+in+the+wiki%3A+"
|
|
||||||
"https%3A%2F%2Fgithub.com%2FqTox%2FqTox%2F"
|
|
||||||
"wiki%2FWriting-Useful-Bug-Reports.%0A%0A"
|
|
||||||
"Please+remove+any+unnecessary+template+"
|
|
||||||
"section+before+submitting.\""
|
|
||||||
" style=\"text-decoration: underline;"
|
|
||||||
" color:#0000ff;\">") + tr("report it") +
|
|
||||||
QStringLiteral("</a>")
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
QString authorInfo = QString("<p>%1</p><p>%2</p>")
|
||||||
|
.arg(tr("Original author: %1")
|
||||||
|
.arg(createLink("https://github.com/tux3", "tux3")))
|
||||||
|
.arg(tr("See a full list of %1 at Github")
|
||||||
|
.arg(createLink("https://github.com/qTox/qTox/graphs/contributors",
|
||||||
|
tr("contributors"))));
|
||||||
|
|
||||||
|
bodyUI->authorInfo->setText(authorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates hyperlink with specific style.
|
||||||
|
* @param path The URL of the page the link goes to.
|
||||||
|
* @param text Text, which will be clickable.
|
||||||
|
* @return Hyperlink to paste.
|
||||||
|
*/
|
||||||
|
QString AboutForm::createLink(QString path, QString text) const
|
||||||
|
{
|
||||||
|
return QString::fromUtf8("<a href=\"%1\" style=\"text-decoration: underline; color:#0000ff;\">%2</a>")
|
||||||
|
.arg(path, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
AboutForm::~AboutForm()
|
AboutForm::~AboutForm()
|
||||||
|
@ -116,6 +149,9 @@ AboutForm::~AboutForm()
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update information about update.
|
||||||
|
*/
|
||||||
void AboutForm::showUpdateProgress()
|
void AboutForm::showUpdateProgress()
|
||||||
{
|
{
|
||||||
QString version = AutoUpdater::getProgressVersion();
|
QString version = AutoUpdater::getProgressVersion();
|
||||||
|
@ -149,6 +185,9 @@ void AboutForm::showEvent(QShowEvent *)
|
||||||
progressTimer->start();
|
progressTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Retranslate all elements in the form.
|
||||||
|
*/
|
||||||
void AboutForm::retranslateUi()
|
void AboutForm::retranslateUi()
|
||||||
{
|
{
|
||||||
bodyUI->retranslateUi(this);
|
bodyUI->retranslateUi(this);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
class Core;
|
class Core;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
class QString;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AboutSettings;
|
class AboutSettings;
|
||||||
|
@ -50,6 +51,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void replaceVersions();
|
void replaceVersions();
|
||||||
|
inline QString createLink(QString path, QString text) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AboutSettings* bodyUI;
|
Ui::AboutSettings* bodyUI;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>530</width>
|
<width>530</width>
|
||||||
<height>476</height>
|
<height>553</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -29,14 +29,14 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-72</y>
|
<y>0</y>
|
||||||
<width>496</width>
|
<width>514</width>
|
||||||
<height>648</height>
|
<height>537</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0,0">
|
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0,0">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="versioGroup">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -222,12 +222,12 @@
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Noto Sans'; font-size:12pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt; color:#000000;">Copyright © 2014-2016 by The qTox Project</span></p>
|
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; color:#000000;">Copyright © 2014-2016 by The qTox Project</span></p>
|
||||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">qTox is a Qt-based graphical interface for Tox.</span></p>
|
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">qTox is a Qt-based graphical interface for Tox.</span></p>
|
||||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt;">qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</span></p>
|
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</span></p>
|
||||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt;">qTox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </span></p>
|
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">qTox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </span></p>
|
||||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">You should have received a copy of the GNU General Public License along with this program. If not, see </span><a href="https://www.gnu.org/copyleft/gpl.html"><span style=" font-family:'Ubuntu'; font-size:10pt; text-decoration: underline; color:#007af4;">https://www.gnu.org/copyleft/gpl.html</span></a><span style=" font-family:'Ubuntu'; font-size:10pt;">.</span></p></body></html></string>
|
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">You should have received a copy of the GNU General Public License along with this program. If not, see </span><a href="https://www.gnu.org/copyleft/gpl.html"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#007af4;">https://www.gnu.org/copyleft/gpl.html</span></a><span style=" font-family:'Ubuntu';">.</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="searchPaths">
|
<property name="searchPaths">
|
||||||
<stringlist/>
|
<stringlist/>
|
||||||
|
@ -244,7 +244,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="authorGroup">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -262,7 +262,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="authorInfo">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -275,7 +275,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>Original author: <a href="https://github.com/tux3"><span style=" text-decoration: underline; color:#0000ff;">tux3</span></a></p><p>See a full list of <a href="https://github.com/qTox/qTox/graphs/contributors"><span style=" text-decoration: underline; color:#0000ff;">contributors</span></a> at Github</p></body></html></string>
|
<string notr="true">{AUTHOR INFO}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks">
|
<property name="openExternalLinks">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -289,7 +289,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="knowIssuesGroup">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -319,6 +319,9 @@ p, li { white-space: pre-wrap; }
|
||||||
<family>Sans Serif</family>
|
<family>Sans Serif</family>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">{KNOWN ISSUES TEXT}</string>
|
||||||
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -20,11 +20,28 @@
|
||||||
#include "advancedform.h"
|
#include "advancedform.h"
|
||||||
#include "ui_advancedsettings.h"
|
#include "ui_advancedsettings.h"
|
||||||
|
|
||||||
#include <src/core/recursivesignalblocker.h>
|
#include <QApplication>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
#include "src/core/core.h"
|
||||||
|
#include "src/core/coreav.h"
|
||||||
|
#include "src/core/recursivesignalblocker.h"
|
||||||
|
#include "src/nexus.h"
|
||||||
#include "src/persistence/settings.h"
|
#include "src/persistence/settings.h"
|
||||||
#include "src/persistence/db/plaindb.h"
|
#include "src/persistence/db/plaindb.h"
|
||||||
|
#include "src/persistence/profile.h"
|
||||||
|
#include "src/widget/gui.h"
|
||||||
#include "src/widget/translator.h"
|
#include "src/widget/translator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class AdvancedForm
|
||||||
|
*
|
||||||
|
* This form contains all connection settings.
|
||||||
|
* Is also contains "Reset settings" button and "Make portable" checkbox.
|
||||||
|
*/
|
||||||
|
|
||||||
AdvancedForm::AdvancedForm()
|
AdvancedForm::AdvancedForm()
|
||||||
: GenericForm(QPixmap(":/img/settings/general.png"))
|
: GenericForm(QPixmap(":/img/settings/general.png"))
|
||||||
, bodyUI (new Ui::AdvancedSettings)
|
, bodyUI (new Ui::AdvancedSettings)
|
||||||
|
@ -34,16 +51,33 @@ AdvancedForm::AdvancedForm()
|
||||||
// block all child signals during initialization
|
// block all child signals during initialization
|
||||||
const RecursiveSignalBlocker signalBlocker(this);
|
const RecursiveSignalBlocker signalBlocker(this);
|
||||||
|
|
||||||
|
Settings &s = Settings::getInstance();
|
||||||
|
bodyUI->cbEnableIPv6->setChecked(s.getEnableIPv6());
|
||||||
bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable());
|
bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable());
|
||||||
|
bodyUI->cbEnableUDP->setChecked(!s.getForceTCP());
|
||||||
|
bodyUI->proxyAddr->setText(s.getProxyAddr());
|
||||||
|
quint16 port = s.getProxyPort();
|
||||||
|
if (port > 0)
|
||||||
|
bodyUI->proxyPort->setValue(port);
|
||||||
|
|
||||||
connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &AdvancedForm::onMakeToxPortableUpdated);
|
int index = static_cast<int>(s.getProxyType());
|
||||||
connect(bodyUI->resetButton, SIGNAL(clicked()), this, SLOT(resetToDefault()));
|
bodyUI->proxyType->setCurrentIndex(index);
|
||||||
|
on_proxyType_currentIndexChanged(index);
|
||||||
|
|
||||||
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
|
QString warningBody = tr("Unless you %1 know what you are doing, "
|
||||||
{
|
"please do %2 change anything here. Changes "
|
||||||
cb->installEventFilter(this);
|
"made here may lead to problems with qTox, and even "
|
||||||
}
|
"to loss of your data, e.g. history.</p>")
|
||||||
|
.arg(QString("<b>%1</b>").arg(tr("really")))
|
||||||
|
.arg(QString("<b>%1</b>").arg(tr("not")));
|
||||||
|
|
||||||
|
QString warning = QString("<div style=\"color:#ff0000;\">"
|
||||||
|
"<p><b>%1</b></p><p>%2</p></div>")
|
||||||
|
.arg(tr("IMPORTANT NOTE")).arg(warningBody);
|
||||||
|
|
||||||
|
bodyUI->warningLabel->setText(warning);
|
||||||
|
|
||||||
|
eventsInit();
|
||||||
Translator::registerHandler(std::bind(&AdvancedForm::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&AdvancedForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,27 +87,76 @@ AdvancedForm::~AdvancedForm()
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvancedForm::onMakeToxPortableUpdated()
|
void AdvancedForm::on_cbMakeToxPortable_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setMakeToxPortable(bodyUI->cbMakeToxPortable->isChecked());
|
Settings::getInstance().setMakeToxPortable(bodyUI->cbMakeToxPortable->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvancedForm::resetToDefault()
|
void AdvancedForm::on_resetButton_clicked()
|
||||||
{
|
{
|
||||||
|
const QString titile = tr("Reset settings");
|
||||||
|
bool result = GUI::askQuestion(titile,
|
||||||
|
tr("All settings will be reset to default. Are you sure?"),
|
||||||
|
tr("Yes"), tr("No"));
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Settings::getInstance().resetToDefault();
|
||||||
|
GUI::showInfo(titile, "Changes will take effect after restart");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AdvancedForm::eventFilter(QObject *o, QEvent *e)
|
void AdvancedForm::on_cbEnableIPv6_stateChanged()
|
||||||
{
|
{
|
||||||
if ((e->type() == QEvent::Wheel) &&
|
Settings::getInstance().setEnableIPv6(bodyUI->cbEnableIPv6->isChecked());
|
||||||
(qobject_cast<QAbstractSpinBox*>(o) || qobject_cast<QCheckBox*>(o)))
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::on_cbEnableUDP_stateChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setForceTCP(!bodyUI->cbEnableUDP->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::on_proxyAddr_editingFinished()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setProxyAddr(bodyUI->proxyAddr->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::on_proxyPort_valueChanged(int port)
|
||||||
|
{
|
||||||
|
if (port <= 0)
|
||||||
|
port = 0;
|
||||||
|
|
||||||
|
Settings::getInstance().setProxyPort(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::on_proxyType_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
Settings::ProxyType proxytype = static_cast<Settings::ProxyType>(index);
|
||||||
|
|
||||||
|
bodyUI->proxyAddr->setEnabled(proxytype != Settings::ProxyType::ptNone);
|
||||||
|
bodyUI->proxyPort->setEnabled(proxytype != Settings::ProxyType::ptNone);
|
||||||
|
Settings::getInstance().setProxyType(proxytype);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::on_reconnectButton_clicked()
|
||||||
|
{
|
||||||
|
if (Core::getInstance()->getAv()->anyActiveCalls())
|
||||||
{
|
{
|
||||||
e->ignore();
|
QMessageBox::warning(this, tr("Call active", "popup title"),
|
||||||
return true;
|
tr("You can't disconnect while a call is active!", "popup text"));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return QWidget::eventFilter(o, e);
|
|
||||||
|
emit Core::getInstance()->statusSet(Status::Offline);
|
||||||
|
Nexus::getProfile()->restartCore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Retranslate all elements in the form.
|
||||||
|
*/
|
||||||
void AdvancedForm::retranslateUi()
|
void AdvancedForm::retranslateUi()
|
||||||
{
|
{
|
||||||
|
int proxyType = bodyUI->proxyType->currentIndex();
|
||||||
bodyUI->retranslateUi(this);
|
bodyUI->retranslateUi(this);
|
||||||
|
bodyUI->proxyType->setCurrentIndex(proxyType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,17 @@ public:
|
||||||
return tr("Advanced");
|
return tr("Advanced");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *o, QEvent *e) final override;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onMakeToxPortableUpdated();
|
// Portable
|
||||||
void resetToDefault();
|
void on_cbMakeToxPortable_stateChanged();
|
||||||
|
void on_resetButton_clicked();
|
||||||
|
// Connection
|
||||||
|
void on_cbEnableIPv6_stateChanged();
|
||||||
|
void on_cbEnableUDP_stateChanged();
|
||||||
|
void on_proxyAddr_editingFinished();
|
||||||
|
void on_proxyPort_valueChanged(int port);
|
||||||
|
void on_proxyType_currentIndexChanged(int index);
|
||||||
|
void on_reconnectButton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>418</width>
|
<width>505</width>
|
||||||
<height>476</height>
|
<height>565</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -24,25 +24,15 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>398</width>
|
<width>489</width>
|
||||||
<height>456</height>
|
<height>549</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbMakeToxPortable">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string extracomment="describes makeToxPortable checkbox">Save settings to the working directory instead of the usual conf dir</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Make Tox portable</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="warningLabel">
|
<widget class="QLabel" name="warningLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600; color:#ff0000;">IMPORTANT NOTE</span></p><p><span style=" color:#ff0000;">Unless you </span><span style=" font-weight:600; color:#ff0000;">really</span><span style=" color:#ff0000;"> know what you are doing, please do </span><span style=" font-weight:600; color:#ff0000;">not</span><span style=" color:#ff0000;"> change anything here. Changes made here may lead to problems with qTox, and even to loss of your data, e.g. history.</span></p></body></html></string>
|
<string notr="true">{IMPORTANT NOTE HERE}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::RichText</enum>
|
<enum>Qt::RichText</enum>
|
||||||
|
@ -55,7 +45,149 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignTop">
|
<item>
|
||||||
|
<widget class="QGroupBox" name="ProtableGroup">
|
||||||
|
<property name="title">
|
||||||
|
<string>Portable</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbMakeToxPortable">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string extracomment="describes makeToxPortable checkbox">Save settings to the working directory instead of the usual conf dir</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Make Tox portable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="connectionGroup">
|
||||||
|
<property name="title">
|
||||||
|
<string>Connection Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayoutProxy">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbEnableIPv6">
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Text on a checkbox to enable IPv6">Enable IPv6 (recommended)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbEnableUDP">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string extracomment="force tcp checkbox tooltip">Disabling this allows, e.g., toxing over Tor. It adds load to the Tox network however, so uncheck only when necessary.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Text on checkbox to disable UDP">Enable UDP (recommended)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="proxyLayout">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="proxyTypeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Proxy type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QSpinBox" name="proxyPort">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="proxyAddrLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Text on proxy addr label">Address:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="proxyAddr"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="proxyPortLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Text on proxy port label">Port:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="3">
|
||||||
|
<widget class="QComboBox" name="proxyType">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>None</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>SOCKS5</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>HTTP</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="reconnectButton">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="reconnect button">Reconnect</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QPushButton" name="resetButton">
|
<widget class="QPushButton" name="resetButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Reset to default settings</string>
|
<string>Reset to default settings</string>
|
||||||
|
|
|
@ -19,24 +19,24 @@
|
||||||
|
|
||||||
#include "avform.h"
|
#include "avform.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#include <QScreen>
|
||||||
|
#include <QShowEvent>
|
||||||
|
|
||||||
#include "src/audio/audio.h"
|
#include "src/audio/audio.h"
|
||||||
#include "src/persistence/settings.h"
|
|
||||||
#include "src/video/camerasource.h"
|
|
||||||
#include "src/video/cameradevice.h"
|
|
||||||
#include "src/video/videosurface.h"
|
|
||||||
#include "src/widget/translator.h"
|
|
||||||
#include "src/widget/tool/screenshotgrabber.h"
|
|
||||||
#include "src/core/core.h"
|
#include "src/core/core.h"
|
||||||
#include "src/core/coreav.h"
|
#include "src/core/coreav.h"
|
||||||
#include "src/core/recursivesignalblocker.h"
|
#include "src/core/recursivesignalblocker.h"
|
||||||
|
#include "src/persistence/settings.h"
|
||||||
#include <QDesktopWidget>
|
#include "src/video/cameradevice.h"
|
||||||
#include <QDebug>
|
#include "src/video/camerasource.h"
|
||||||
#include <QScreen>
|
#include "src/video/videosurface.h"
|
||||||
#include <QShowEvent>
|
#include "src/widget/tool/screenshotgrabber.h"
|
||||||
#include <cassert>
|
#include "src/widget/translator.h"
|
||||||
#include <map>
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ALC_ALL_DEVICES_SPECIFIER
|
#ifndef ALC_ALL_DEVICES_SPECIFIER
|
||||||
#define ALC_ALL_DEVICES_SPECIFIER ALC_DEVICE_SPECIFIER
|
#define ALC_ALL_DEVICES_SPECIFIER ALC_DEVICE_SPECIFIER
|
||||||
|
@ -78,11 +78,7 @@ AVForm::AVForm()
|
||||||
microphoneSlider->setTracking(false);
|
microphoneSlider->setTracking(false);
|
||||||
microphoneSlider->installEventFilter(this);
|
microphoneSlider->installEventFilter(this);
|
||||||
|
|
||||||
for (QComboBox* cb : findChildren<QComboBox*>())
|
eventsInit();
|
||||||
{
|
|
||||||
cb->installEventFilter(this);
|
|
||||||
cb->setFocusPolicy(Qt::StrongFocus);
|
|
||||||
}
|
|
||||||
|
|
||||||
QDesktopWidget *desktop = QApplication::desktop();
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
connect(desktop, &QDesktopWidget::resized, this, &AVForm::rescanDevices);
|
connect(desktop, &QDesktopWidget::resized, this, &AVForm::rescanDevices);
|
||||||
|
@ -567,18 +563,6 @@ void AVForm::killVideoSurface()
|
||||||
camVideoSurface = nullptr;
|
camVideoSurface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AVForm::eventFilter(QObject *o, QEvent *e)
|
|
||||||
{
|
|
||||||
if ((e->type() == QEvent::Wheel) &&
|
|
||||||
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ||
|
|
||||||
qobject_cast<QSlider*>(o)))
|
|
||||||
{
|
|
||||||
e->ignore();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return QWidget::eventFilter(o, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AVForm::retranslateUi()
|
void AVForm::retranslateUi()
|
||||||
{
|
{
|
||||||
Ui::AVForm::retranslateUi(this);
|
Ui::AVForm::retranslateUi(this);
|
||||||
|
|
|
@ -74,7 +74,6 @@ protected:
|
||||||
void updateVideoModes(int curIndex);
|
void updateVideoModes(int curIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool eventFilter(QObject *o, QEvent *e) final override;
|
|
||||||
void hideEvent(QHideEvent* event) final override;
|
void hideEvent(QHideEvent* event) final override;
|
||||||
void showEvent(QShowEvent*event) final override;
|
void showEvent(QShowEvent*event) final override;
|
||||||
void open(const QString &devName, const VideoMode &mode);
|
void open(const QString &devName, const VideoMode &mode);
|
||||||
|
|
|
@ -20,26 +20,20 @@
|
||||||
#include "generalform.h"
|
#include "generalform.h"
|
||||||
#include "ui_generalsettings.h"
|
#include "ui_generalsettings.h"
|
||||||
|
|
||||||
#include <src/core/recursivesignalblocker.h>
|
#include <QFileDialog>
|
||||||
#include "src/widget/form/settingswidget.h"
|
|
||||||
#include "src/widget/widget.h"
|
|
||||||
#include "src/persistence/settings.h"
|
|
||||||
#include "src/persistence/smileypack.h"
|
|
||||||
#include "src/core/core.h"
|
#include "src/core/core.h"
|
||||||
#include "src/core/coreav.h"
|
#include "src/core/coreav.h"
|
||||||
#include "src/widget/style.h"
|
#include "src/core/recursivesignalblocker.h"
|
||||||
|
#include "src/net/autoupdate.h"
|
||||||
#include "src/nexus.h"
|
#include "src/nexus.h"
|
||||||
#include "src/persistence/profile.h"
|
#include "src/persistence/profile.h"
|
||||||
|
#include "src/persistence/settings.h"
|
||||||
|
#include "src/persistence/smileypack.h"
|
||||||
|
#include "src/widget/form/settingswidget.h"
|
||||||
|
#include "src/widget/style.h"
|
||||||
#include "src/widget/translator.h"
|
#include "src/widget/translator.h"
|
||||||
#include "src/net/autoupdate.h"
|
#include "src/widget/widget.h"
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QStyleFactory>
|
|
||||||
#include <QTime>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QFont>
|
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
static QStringList locales = {"ar",
|
static QStringList locales = {"ar",
|
||||||
"be",
|
"be",
|
||||||
|
@ -104,10 +98,11 @@ static QStringList langs = {"Arabic",
|
||||||
"Українська",
|
"Українська",
|
||||||
"简体中文"};
|
"简体中文"};
|
||||||
|
|
||||||
static QStringList timeFormats = {"hh:mm AP", "hh:mm", "hh:mm:ss AP", "hh:mm:ss"};
|
/**
|
||||||
// http://doc.qt.io/qt-4.8/qdate.html#fromString
|
* @class GeneralForm
|
||||||
static QStringList dateFormats = {"yyyy-MM-dd", "dd-MM-yyyy", "d-MM-yyyy", "dddd d-MM-yyyy", "dddd d-MM", "dddd dd MMMM"};
|
*
|
||||||
|
* This form contains all settings that are not suited to other forms
|
||||||
|
*/
|
||||||
GeneralForm::GeneralForm(SettingsWidget *myParent)
|
GeneralForm::GeneralForm(SettingsWidget *myParent)
|
||||||
: GenericForm(QPixmap(":/img/settings/general.png"))
|
: GenericForm(QPixmap(":/img/settings/general.png"))
|
||||||
, bodyUI(new Ui::GeneralSettings)
|
, bodyUI(new Ui::GeneralSettings)
|
||||||
|
@ -124,175 +119,41 @@ GeneralForm::GeneralForm(SettingsWidget *myParent)
|
||||||
bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED);
|
bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED);
|
||||||
bodyUI->checkUpdates->setChecked(s.getCheckUpdates());
|
bodyUI->checkUpdates->setChecked(s.getCheckUpdates());
|
||||||
|
|
||||||
bodyUI->cbEnableIPv6->setChecked(s.getEnableIPv6());
|
|
||||||
for (int i = 0; i < langs.size(); i++)
|
for (int i = 0; i < langs.size(); i++)
|
||||||
bodyUI->transComboBox->insertItem(i, langs[i]);
|
bodyUI->transComboBox->insertItem(i, langs[i]);
|
||||||
|
|
||||||
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(s.getTranslation()));
|
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(s.getTranslation()));
|
||||||
|
|
||||||
const QFont chatBaseFont = s.getChatMessageFont();
|
|
||||||
bodyUI->txtChatFontSize->setValue(QFontInfo(chatBaseFont).pixelSize());
|
|
||||||
bodyUI->txtChatFont->setCurrentFont(chatBaseFont);
|
|
||||||
bodyUI->textStyleComboBox->setCurrentIndex(static_cast<int>(s.getStylePreference()));
|
|
||||||
bodyUI->cbAutorun->setChecked(s.getAutorun());
|
bodyUI->cbAutorun->setChecked(s.getAutorun());
|
||||||
|
|
||||||
|
bodyUI->lightTrayIcon->setChecked(s.getLightTrayIcon());
|
||||||
bool showSystemTray = s.getShowSystemTray();
|
bool showSystemTray = s.getShowSystemTray();
|
||||||
|
|
||||||
bodyUI->showSystemTray->setChecked(showSystemTray);
|
bodyUI->showSystemTray->setChecked(showSystemTray);
|
||||||
bodyUI->startInTray->setChecked(s.getAutostartInTray());
|
bodyUI->startInTray->setChecked(s.getAutostartInTray());
|
||||||
bodyUI->startInTray->setEnabled(showSystemTray);
|
bodyUI->startInTray->setEnabled(showSystemTray);
|
||||||
bodyUI->closeToTray->setChecked(s.getCloseToTray());
|
|
||||||
bodyUI->closeToTray->setEnabled(showSystemTray);
|
|
||||||
bodyUI->minimizeToTray->setChecked(s.getMinimizeToTray());
|
bodyUI->minimizeToTray->setChecked(s.getMinimizeToTray());
|
||||||
bodyUI->minimizeToTray->setEnabled(showSystemTray);
|
bodyUI->minimizeToTray->setEnabled(showSystemTray);
|
||||||
bodyUI->lightTrayIcon->setChecked(s.getLightTrayIcon());
|
bodyUI->closeToTray->setChecked(s.getCloseToTray());
|
||||||
|
bodyUI->closeToTray->setEnabled(showSystemTray);
|
||||||
|
|
||||||
|
bodyUI->notifySound->setChecked(s.getNotifySound());
|
||||||
|
bodyUI->busySound->setChecked(s.getBusySound());
|
||||||
|
bodyUI->busySound->setEnabled(s.getNotifySound());
|
||||||
|
|
||||||
bodyUI->statusChanges->setChecked(s.getStatusChangeNotificationEnabled());
|
bodyUI->statusChanges->setChecked(s.getStatusChangeNotificationEnabled());
|
||||||
bodyUI->useEmoticons->setChecked(s.getUseEmoticons());
|
|
||||||
bodyUI->autoacceptFiles->setChecked(s.getAutoSaveEnabled());
|
|
||||||
bodyUI->autoSaveFilesDir->setText(s.getGlobalAutoAcceptDir());
|
|
||||||
|
|
||||||
bool showWindow = s.getShowWindow();
|
|
||||||
|
|
||||||
bodyUI->showWindow->setChecked(showWindow);
|
|
||||||
bodyUI->showInFront->setChecked(s.getShowInFront());
|
|
||||||
bodyUI->showInFront->setEnabled(showWindow);
|
|
||||||
|
|
||||||
bool notifySound = s.getNotifySound();
|
|
||||||
|
|
||||||
bodyUI->notifySound->setChecked(notifySound);
|
|
||||||
bodyUI->busySound->setChecked(s.getBusySound());
|
|
||||||
bodyUI->busySound->setEnabled(notifySound);
|
|
||||||
bodyUI->groupAlwaysNotify->setChecked(s.getGroupAlwaysNotify());
|
|
||||||
bodyUI->cbFauxOfflineMessaging->setChecked(s.getFauxOfflineMessaging());
|
bodyUI->cbFauxOfflineMessaging->setChecked(s.getFauxOfflineMessaging());
|
||||||
bodyUI->cbCompactLayout->setChecked(s.getCompactLayout());
|
|
||||||
bodyUI->cbSeparateWindow->setChecked(s.getSeparateWindow());
|
|
||||||
bodyUI->cbDontGroupWindows->setChecked(s.getDontGroupWindows());
|
|
||||||
bodyUI->cbDontGroupWindows->setEnabled(bodyUI->cbSeparateWindow->isChecked());
|
|
||||||
bodyUI->cbGroupchatPosition->setChecked(s.getGroupchatPosition());
|
|
||||||
|
|
||||||
for (auto entry : SmileyPack::listSmileyPacks())
|
|
||||||
bodyUI->smileyPackBrowser->addItem(entry.first, entry.second);
|
|
||||||
|
|
||||||
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(s.getSmileyPack()));
|
|
||||||
reloadSmiles();
|
|
||||||
bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());
|
|
||||||
|
|
||||||
bodyUI->styleBrowser->addItem(tr("None"));
|
|
||||||
bodyUI->styleBrowser->addItems(QStyleFactory::keys());
|
|
||||||
if (QStyleFactory::keys().contains(s.getStyle()))
|
|
||||||
bodyUI->styleBrowser->setCurrentText(s.getStyle());
|
|
||||||
else
|
|
||||||
bodyUI->styleBrowser->setCurrentText(tr("None"));
|
|
||||||
|
|
||||||
for (QString color : Style::getThemeColorNames())
|
|
||||||
bodyUI->themeColorCBox->addItem(color);
|
|
||||||
|
|
||||||
bodyUI->themeColorCBox->setCurrentIndex(s.getThemeColor());
|
|
||||||
|
|
||||||
bodyUI->emoticonSize->setValue(s.getEmojiFontPointSize());
|
|
||||||
|
|
||||||
QStringList timestamps;
|
|
||||||
for (QString timestamp : timeFormats)
|
|
||||||
timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp));
|
|
||||||
|
|
||||||
bodyUI->timestamp->addItems(timestamps);
|
|
||||||
|
|
||||||
QLocale ql;
|
|
||||||
QStringList datestamps;
|
|
||||||
dateFormats.append(ql.dateFormat());
|
|
||||||
dateFormats.append(ql.dateFormat(QLocale::LongFormat));
|
|
||||||
dateFormats.removeDuplicates();
|
|
||||||
timeFormats.append(ql.timeFormat());
|
|
||||||
timeFormats.append(ql.timeFormat(QLocale::LongFormat));
|
|
||||||
timeFormats.removeDuplicates();
|
|
||||||
|
|
||||||
for (QString datestamp : dateFormats)
|
|
||||||
datestamps << QString("%1 - %2").arg(datestamp, QDate::currentDate().toString(datestamp));
|
|
||||||
|
|
||||||
bodyUI->dateFormats->addItems(datestamps);
|
|
||||||
|
|
||||||
bodyUI->timestamp->setCurrentText(QString("%1 - %2").arg(s.getTimestampFormat(), QTime::currentTime().toString(s.getTimestampFormat())));
|
|
||||||
|
|
||||||
bodyUI->dateFormats->setCurrentText(QString("%1 - %2").arg(s.getDateFormat(), QDate::currentDate().toString(s.getDateFormat())));
|
|
||||||
|
|
||||||
bodyUI->autoAwaySpinBox->setValue(s.getAutoAwayTime());
|
bodyUI->autoAwaySpinBox->setValue(s.getAutoAwayTime());
|
||||||
|
bodyUI->autoSaveFilesDir->setText(s.getGlobalAutoAcceptDir());
|
||||||
bodyUI->cbEnableUDP->setChecked(!s.getForceTCP());
|
bodyUI->autoacceptFiles->setChecked(s.getAutoSaveEnabled());
|
||||||
bodyUI->proxyAddr->setText(s.getProxyAddr());
|
|
||||||
int port = s.getProxyPort();
|
|
||||||
if (port != -1)
|
|
||||||
bodyUI->proxyPort->setValue(port);
|
|
||||||
|
|
||||||
bodyUI->proxyType->setCurrentIndex(static_cast<int>(s.getProxyType()));
|
|
||||||
onUseProxyUpdated();
|
|
||||||
|
|
||||||
//general
|
|
||||||
connect(bodyUI->checkUpdates, &QCheckBox::stateChanged, this, &GeneralForm::onCheckUpdateChanged);
|
|
||||||
connect(bodyUI->transComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onTranslationUpdated()));
|
|
||||||
connect(bodyUI->cbAutorun, &QCheckBox::stateChanged, this, &GeneralForm::onAutorunUpdated);
|
|
||||||
connect(bodyUI->lightTrayIcon, &QCheckBox::stateChanged, this, &GeneralForm::onSetLightTrayIcon);
|
|
||||||
connect(bodyUI->showSystemTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowSystemTray);
|
|
||||||
connect(bodyUI->startInTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetAutostartInTray);
|
|
||||||
connect(bodyUI->closeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetCloseToTray);
|
|
||||||
connect(bodyUI->minimizeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetMinimizeToTray);
|
|
||||||
connect(bodyUI->statusChanges, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
|
|
||||||
connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
|
|
||||||
connect(bodyUI->showWindow, &QCheckBox::stateChanged, this, &GeneralForm::onShowWindowChanged);
|
|
||||||
connect(bodyUI->showInFront, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowInFront);
|
|
||||||
connect(bodyUI->notifySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetNotifySound);
|
|
||||||
connect(bodyUI->busySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetBusySound);
|
|
||||||
connect(bodyUI->textStyleComboBox, &QComboBox::currentTextChanged, this, &GeneralForm::onStyleUpdated);
|
|
||||||
connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &GeneralForm::onSetGroupAlwaysNotify);
|
|
||||||
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
|
|
||||||
connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
|
|
||||||
//theme
|
|
||||||
connect(bodyUI->useEmoticons, &QCheckBox::stateChanged, this, &GeneralForm::onUseEmoticonsChange);
|
|
||||||
connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int)));
|
|
||||||
connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString)));
|
|
||||||
connect(bodyUI->themeColorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onThemeColorChanged(int)));
|
|
||||||
connect(bodyUI->emoticonSize, SIGNAL(editingFinished()), this, SLOT(onEmoticonSizeChanged()));
|
|
||||||
connect(bodyUI->timestamp, SIGNAL(currentIndexChanged(int)), this, SLOT(onTimestampSelected(int)));
|
|
||||||
connect(bodyUI->dateFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(onDateFormatSelected(int)));
|
|
||||||
//connection
|
|
||||||
connect(bodyUI->cbEnableIPv6, &QCheckBox::stateChanged, this, &GeneralForm::onEnableIPv6Updated);
|
|
||||||
connect(bodyUI->cbEnableUDP, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated);
|
|
||||||
connect(bodyUI->proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onUseProxyUpdated()));
|
|
||||||
connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &GeneralForm::onProxyAddrEdited);
|
|
||||||
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
|
|
||||||
connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &GeneralForm::onReconnectClicked);
|
|
||||||
connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
|
|
||||||
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
|
|
||||||
connect(bodyUI->cbSeparateWindow, &QCheckBox::stateChanged, this, &GeneralForm::onSeparateWindowChanged);
|
|
||||||
connect(bodyUI->cbDontGroupWindows, &QCheckBox::stateChanged, this, &GeneralForm::onDontGroupWindowsChanged);
|
|
||||||
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
|
|
||||||
|
|
||||||
// prevent stealing mouse wheel scroll
|
|
||||||
// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
|
|
||||||
// you can scroll through general settings without accidentially changing theme/skin/icons etc.
|
|
||||||
// @see GeneralForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more
|
|
||||||
for (QComboBox *cb : findChildren<QComboBox*>())
|
|
||||||
{
|
|
||||||
cb->installEventFilter(this);
|
|
||||||
cb->setFocusPolicy(Qt::StrongFocus);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (QSpinBox *sp : findChildren<QSpinBox*>())
|
|
||||||
{
|
|
||||||
sp->installEventFilter(this);
|
|
||||||
sp->setFocusPolicy(Qt::WheelFocus);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
|
|
||||||
{
|
|
||||||
cb->installEventFilter(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef QTOX_PLATFORM_EXT
|
#ifndef QTOX_PLATFORM_EXT
|
||||||
bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
|
bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
|
||||||
bodyUI->autoAwaySpinBox->setEnabled(false); // though they are unusable
|
bodyUI->autoAwaySpinBox->setEnabled(false); // though they are unusable
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
eventsInit();
|
||||||
Translator::registerHandler(std::bind(&GeneralForm::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&GeneralForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,89 +163,78 @@ GeneralForm::~GeneralForm()
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onEnableIPv6Updated()
|
void GeneralForm::on_transComboBox_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
Settings::getInstance().setEnableIPv6(bodyUI->cbEnableIPv6->isChecked());
|
Settings::getInstance().setTranslation(locales[index]);
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onTranslationUpdated()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setTranslation(locales[bodyUI->transComboBox->currentIndex()]);
|
|
||||||
Translator::translate();
|
Translator::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onAutorunUpdated()
|
void GeneralForm::on_cbAutorun_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setAutorun(bodyUI->cbAutorun->isChecked());
|
Settings::getInstance().setAutorun(bodyUI->cbAutorun->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onSetShowSystemTray()
|
void GeneralForm::on_showSystemTray_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setShowSystemTray(bodyUI->showSystemTray->isChecked());
|
Settings::getInstance().setShowSystemTray(bodyUI->showSystemTray->isChecked());
|
||||||
Settings::getInstance().saveGlobal();
|
Settings::getInstance().saveGlobal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onSetAutostartInTray()
|
void GeneralForm::on_startInTray_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked());
|
Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onSetCloseToTray()
|
void GeneralForm::on_closeToTray_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setCloseToTray(bodyUI->closeToTray->isChecked());
|
Settings::getInstance().setCloseToTray(bodyUI->closeToTray->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onSetLightTrayIcon()
|
void GeneralForm::on_lightTrayIcon_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setLightTrayIcon(bodyUI->lightTrayIcon->isChecked());
|
Settings::getInstance().setLightTrayIcon(bodyUI->lightTrayIcon->isChecked());
|
||||||
Widget::getInstance()->updateIcons();
|
Widget::getInstance()->updateIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onSetMinimizeToTray()
|
void GeneralForm::on_minimizeToTray_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setMinimizeToTray(bodyUI->minimizeToTray->isChecked());
|
Settings::getInstance().setMinimizeToTray(bodyUI->minimizeToTray->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onStyleSelected(QString style)
|
void GeneralForm::on_notifySound_stateChanged()
|
||||||
{
|
{
|
||||||
if (bodyUI->styleBrowser->currentIndex() == 0)
|
bool notify = bodyUI->notifySound->isChecked();
|
||||||
Settings::getInstance().setStyle("None");
|
Settings::getInstance().setNotifySound(notify);
|
||||||
else
|
bodyUI->busySound->setEnabled(notify);
|
||||||
Settings::getInstance().setStyle(style);
|
|
||||||
|
|
||||||
this->setStyle(QStyleFactory::create(style));
|
|
||||||
parent->setBodyHeadStyle(style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onEmoticonSizeChanged()
|
void GeneralForm::on_busySound_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setEmojiFontPointSize(bodyUI->emoticonSize->value());
|
Settings::getInstance().setBusySound(bodyUI->busySound->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onTimestampSelected(int index)
|
void GeneralForm::on_statusChanges_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChanges->isChecked());
|
||||||
Translator::translate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onDateFormatSelected(int index)
|
void GeneralForm::on_cbFauxOfflineMessaging_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setDateFormat(dateFormats.at(index));
|
Settings::getInstance().setFauxOfflineMessaging(bodyUI->cbFauxOfflineMessaging->isChecked());
|
||||||
Translator::translate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onAutoAwayChanged()
|
void GeneralForm::on_autoAwaySpinBox_editingFinished()
|
||||||
{
|
{
|
||||||
int minutes = bodyUI->autoAwaySpinBox->value();
|
int minutes = bodyUI->autoAwaySpinBox->value();
|
||||||
Settings::getInstance().setAutoAwayTime(minutes);
|
Settings::getInstance().setAutoAwayTime(minutes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onAutoAcceptFileChange()
|
void GeneralForm::on_autoacceptFiles_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setAutoSaveEnabled(bodyUI->autoacceptFiles->isChecked());
|
Settings::getInstance().setAutoSaveEnabled(bodyUI->autoacceptFiles->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onAutoSaveDirChange()
|
void GeneralForm::on_autoSaveFilesDir_clicked()
|
||||||
{
|
{
|
||||||
QString previousDir = Settings::getInstance().getGlobalAutoAcceptDir();
|
QString previousDir = Settings::getInstance().getGlobalAutoAcceptDir();
|
||||||
QString directory = QFileDialog::getExistingDirectory(0,
|
QString directory = QFileDialog::getExistingDirectory(0,
|
||||||
|
@ -398,213 +248,15 @@ void GeneralForm::onAutoSaveDirChange()
|
||||||
bodyUI->autoSaveFilesDir->setText(directory);
|
bodyUI->autoSaveFilesDir->setText(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onUseEmoticonsChange()
|
void GeneralForm::on_checkUpdates_stateChanged()
|
||||||
{
|
|
||||||
Settings::getInstance().setUseEmoticons(bodyUI->useEmoticons->isChecked());
|
|
||||||
bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onStyleUpdated()
|
|
||||||
{
|
|
||||||
Settings::StyleType styleType =
|
|
||||||
static_cast<Settings::StyleType>(bodyUI->textStyleComboBox->currentIndex());
|
|
||||||
Settings::getInstance().setStylePreference(styleType);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onSetStatusChange()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChanges->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onSmileyBrowserIndexChanged(int index)
|
|
||||||
{
|
|
||||||
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();
|
|
||||||
Settings::getInstance().setSmileyPack(filename);
|
|
||||||
reloadSmiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onUDPUpdated()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setForceTCP(!bodyUI->cbEnableUDP->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onProxyAddrEdited()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setProxyAddr(bodyUI->proxyAddr->text());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onProxyPortEdited(int port)
|
|
||||||
{
|
|
||||||
Settings::getInstance().setProxyPort(static_cast<quint16>(port));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onUseProxyUpdated()
|
|
||||||
{
|
|
||||||
Settings::ProxyType proxytype =
|
|
||||||
static_cast<Settings::ProxyType>(bodyUI->proxyType->currentIndex());
|
|
||||||
|
|
||||||
bodyUI->proxyAddr->setEnabled(proxytype != Settings::ProxyType::ptNone);
|
|
||||||
bodyUI->proxyPort->setEnabled(proxytype != Settings::ProxyType::ptNone);
|
|
||||||
Settings::getInstance().setProxyType(proxytype);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onReconnectClicked()
|
|
||||||
{
|
|
||||||
if (Core::getInstance()->getAv()->anyActiveCalls())
|
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("Call active", "popup title"),
|
|
||||||
tr("You can't disconnect while a call is active!", "popup text"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
emit Core::getInstance()->statusSet(Status::Offline);
|
|
||||||
Nexus::getProfile()->restartCore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::reloadSmiles()
|
|
||||||
{
|
|
||||||
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
|
|
||||||
if (emoticons.isEmpty())
|
|
||||||
{ // sometimes there are no emoticons available, don't crash in this case
|
|
||||||
qDebug() << "reloadSmilies: No emoticons found";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList smiles;
|
|
||||||
for (int i = 0; i < emoticons.size(); i++)
|
|
||||||
smiles.push_front(emoticons.at(i).first());
|
|
||||||
|
|
||||||
const QSize size(18,18);
|
|
||||||
bodyUI->smile1->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[0]).pixmap(size));
|
|
||||||
bodyUI->smile2->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[1]).pixmap(size));
|
|
||||||
bodyUI->smile3->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[2]).pixmap(size));
|
|
||||||
bodyUI->smile4->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[3]).pixmap(size));
|
|
||||||
bodyUI->smile5->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[4]).pixmap(size));
|
|
||||||
|
|
||||||
bodyUI->smile1->setToolTip(smiles[0]);
|
|
||||||
bodyUI->smile2->setToolTip(smiles[1]);
|
|
||||||
bodyUI->smile3->setToolTip(smiles[2]);
|
|
||||||
bodyUI->smile4->setToolTip(smiles[3]);
|
|
||||||
bodyUI->smile5->setToolTip(smiles[4]);
|
|
||||||
|
|
||||||
//set maximum size of emoji
|
|
||||||
QDesktopWidget desktop;
|
|
||||||
int maxSize = qMin(desktop.geometry().height()/8,
|
|
||||||
desktop.geometry().width()/8); // 8 is the count of row and column in emoji's in widget
|
|
||||||
bodyUI->emoticonSize->setMaximum(SmileyPack::getInstance().getAsIcon(smiles[0]).actualSize(QSize(maxSize,maxSize)).width());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onCheckUpdateChanged()
|
|
||||||
{
|
{
|
||||||
Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked());
|
Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onShowWindowChanged()
|
/**
|
||||||
{
|
* @brief Retranslate all elements in the form.
|
||||||
Settings::getInstance().setShowWindow(bodyUI->showWindow->isChecked());
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onSetShowInFront()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setShowInFront(bodyUI->showInFront->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onSetNotifySound()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setNotifySound(bodyUI->notifySound->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onSetBusySound()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setBusySound(bodyUI->busySound->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onSetGroupAlwaysNotify()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setGroupAlwaysNotify(bodyUI->groupAlwaysNotify->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onFauxOfflineMessaging()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setFauxOfflineMessaging(bodyUI->cbFauxOfflineMessaging->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onCompactLayout()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setCompactLayout(bodyUI->cbCompactLayout->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onSeparateWindowChanged()
|
|
||||||
{
|
|
||||||
bodyUI->cbDontGroupWindows->setEnabled(bodyUI->cbSeparateWindow->isChecked());
|
|
||||||
Settings::getInstance().setSeparateWindow(bodyUI->cbSeparateWindow->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onDontGroupWindowsChanged()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setDontGroupWindows(bodyUI->cbDontGroupWindows->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onGroupchatPositionChanged()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setGroupchatPosition(bodyUI->cbGroupchatPosition->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onThemeColorChanged(int)
|
|
||||||
{
|
|
||||||
int index = bodyUI->themeColorCBox->currentIndex();
|
|
||||||
Settings::getInstance().setThemeColor(index);
|
|
||||||
Style::setThemeColor(index);
|
|
||||||
Style::applyTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GeneralForm::eventFilter(QObject *o, QEvent *e)
|
|
||||||
{
|
|
||||||
if ((e->type() == QEvent::Wheel) &&
|
|
||||||
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) || qobject_cast<QCheckBox*>(o)))
|
|
||||||
{
|
|
||||||
e->ignore();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return QWidget::eventFilter(o, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::retranslateUi()
|
void GeneralForm::retranslateUi()
|
||||||
{
|
{
|
||||||
int proxyType = bodyUI->proxyType->currentIndex();
|
|
||||||
bodyUI->retranslateUi(this);
|
bodyUI->retranslateUi(this);
|
||||||
bodyUI->proxyType->setCurrentIndex(proxyType);
|
|
||||||
|
|
||||||
QStringList colorThemes(Style::getThemeColorNames());
|
|
||||||
for (int i = 0; i != colorThemes.size(); ++i)
|
|
||||||
{
|
|
||||||
bodyUI->themeColorCBox->setItemText(i, colorThemes[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bodyUI->styleBrowser->setItemText(0, tr("None"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::on_txtChatFont_currentFontChanged(const QFont& f)
|
|
||||||
{
|
|
||||||
QFont tmpFont = f;
|
|
||||||
const int px = bodyUI->txtChatFontSize->value();
|
|
||||||
|
|
||||||
if (QFontInfo(tmpFont).pixelSize() != px)
|
|
||||||
tmpFont.setPixelSize(px);
|
|
||||||
|
|
||||||
Settings::getInstance().setChatMessageFont(tmpFont);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::on_txtChatFontSize_valueChanged(int px)
|
|
||||||
{
|
|
||||||
Settings& s = Settings::getInstance();
|
|
||||||
QFont tmpFont = s.getChatMessageFont();
|
|
||||||
const int fontSize = QFontInfo(tmpFont).pixelSize();
|
|
||||||
|
|
||||||
if (px != fontSize)
|
|
||||||
{
|
|
||||||
tmpFont.setPixelSize(px);
|
|
||||||
s.setChatMessageFont(tmpFont);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,56 +40,29 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onEnableIPv6Updated();
|
void on_transComboBox_currentIndexChanged(int index);
|
||||||
void onTranslationUpdated();
|
void on_cbAutorun_stateChanged();
|
||||||
void onAutorunUpdated();
|
void on_showSystemTray_stateChanged();
|
||||||
void onSetShowSystemTray();
|
void on_startInTray_stateChanged();
|
||||||
void onSetAutostartInTray();
|
void on_closeToTray_stateChanged();
|
||||||
void onSetCloseToTray();
|
void on_lightTrayIcon_stateChanged();
|
||||||
void onSetLightTrayIcon();
|
void on_autoAwaySpinBox_editingFinished();
|
||||||
void onSmileyBrowserIndexChanged(int index);
|
void on_minimizeToTray_stateChanged();
|
||||||
void onUDPUpdated();
|
void on_notifySound_stateChanged();
|
||||||
void onProxyAddrEdited();
|
void on_busySound_stateChanged();
|
||||||
void onProxyPortEdited(int port);
|
void on_statusChanges_stateChanged();
|
||||||
void onUseProxyUpdated();
|
void on_cbFauxOfflineMessaging_stateChanged();
|
||||||
void onEmoticonSizeChanged();
|
|
||||||
void onStyleSelected(QString style);
|
|
||||||
void onTimestampSelected(int index);
|
|
||||||
void onDateFormatSelected(int index);
|
|
||||||
void onStyleUpdated();
|
|
||||||
void onSetStatusChange();
|
|
||||||
void onAutoAwayChanged();
|
|
||||||
void onUseEmoticonsChange();
|
|
||||||
void onSetMinimizeToTray();
|
|
||||||
void onReconnectClicked();
|
|
||||||
void onAutoAcceptFileChange();
|
|
||||||
void onAutoSaveDirChange();
|
|
||||||
void onCheckUpdateChanged();
|
|
||||||
void onShowWindowChanged();
|
|
||||||
void onSetShowInFront();
|
|
||||||
void onSetNotifySound();
|
|
||||||
void onSetBusySound();
|
|
||||||
void onSetGroupAlwaysNotify();
|
|
||||||
void onFauxOfflineMessaging();
|
|
||||||
void onCompactLayout();
|
|
||||||
void onSeparateWindowChanged();
|
|
||||||
void onDontGroupWindowsChanged();
|
|
||||||
void onGroupchatPositionChanged();
|
|
||||||
void onThemeColorChanged(int);
|
|
||||||
|
|
||||||
void on_txtChatFont_currentFontChanged(const QFont& f);
|
void on_autoacceptFiles_stateChanged();
|
||||||
void on_txtChatFontSize_valueChanged(int px);
|
void on_autoSaveFilesDir_clicked();
|
||||||
|
void on_checkUpdates_stateChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralSettings *bodyUI;
|
Ui::GeneralSettings *bodyUI;
|
||||||
void reloadSmiles();
|
|
||||||
SettingsWidget *parent;
|
SettingsWidget *parent;
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *o, QEvent *e) final override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1312</width>
|
<width>1312</width>
|
||||||
<height>1098</height>
|
<height>580</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -39,11 +39,11 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1278</width>
|
<width>1270</width>
|
||||||
<height>1382</height>
|
<height>587</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,0,1">
|
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>32</number>
|
<number>32</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -208,6 +208,55 @@ instead of closing itself.</string>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="newMessageLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>On new message:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>40</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="notifySound">
|
||||||
|
<property name="text">
|
||||||
|
<string>Play sound</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>40</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="busySound">
|
||||||
|
<property name="text">
|
||||||
|
<string>Play sound while Busy</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="statusChanges">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show contacts' status changes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbFauxOfflineMessaging">
|
||||||
|
<property name="text">
|
||||||
|
<string>Faux offline messaging</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -299,635 +348,17 @@ instead of closing itself.</string>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="chatGroupBox">
|
<spacer name="verticalSpacer">
|
||||||
<property name="title">
|
<property name="orientation">
|
||||||
<string>Chat</string>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<property name="sizeHint" stdset="0">
|
||||||
<item>
|
<size>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<width>20</width>
|
||||||
<item row="0" column="0">
|
<height>40</height>
|
||||||
<widget class="QLabel" name="label_2">
|
</size>
|
||||||
<property name="text">
|
|
||||||
<string>Base font:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QFontComboBox" name="txtChatFont"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QSpinBox" name="txtChatFontSize">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string>px</string>
|
|
||||||
</property>
|
|
||||||
<property name="prefix">
|
|
||||||
<string>Size: </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="textStyleLabel">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>New text styling preference may not load until qTox restarts.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Text Style format:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<spacer name="generalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="2">
|
|
||||||
<widget class="QComboBox" name="textStyleComboBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Select text styling preference.</string>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Plaintext</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Show formatting characters</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Don't show formatting characters</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>On new message:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>40</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="notifySound">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="toolTip for Notify sound setting">Play a sound when you recieve message.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Play sound</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>40</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="busySound">
|
|
||||||
<property name="text">
|
|
||||||
<string>Play sound while Busy</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="showWindow">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="tooltip for Show window setting">Open qTox's window when you receive a new message and no window is open yet.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Open window</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>40</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="showInFront">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="toolTip for Focus window setting">Focus qTox when you receive message.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Focus window</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="statusChanges">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show contacts' status changes</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="groupAlwaysNotify">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="toolTip for Group chat always notify">Always notify about new messages in groupchats.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Group chats always notify</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbGroupchatPosition">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="toolTip for groupchat positioning">If checked, groupchats will be placed at the top of the friends list, otherwise, they'll be placed below online friends.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Place groupchats at top of friend list</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbFauxOfflineMessaging">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="toolTip for Faux offline messaging setting">Messages you are trying to send to your friends when they are not online
|
|
||||||
will be sent to them when they appear online to you.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Faux offline messaging</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbCompactLayout">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="toolTip for compact layout setting">Your contact list will be shown in compact mode.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Compact contact list</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbSeparateWindow">
|
|
||||||
<property name="text">
|
|
||||||
<string>Multiple windows mode</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>40</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbDontGroupWindows">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Open each chat in an individual window</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="themeGroup">
|
|
||||||
<property name="title">
|
|
||||||
<string>Theme</string>
|
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
</spacer>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="useEmoticons">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use emoticons</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="smileyPackLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="Text on smiley pack label">Smiley Pack:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="smileyPackBrowser">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>80</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0">
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<item alignment="Qt::AlignTop">
|
|
||||||
<widget class="QLabel" name="smile1">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string notr="true">:)</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item alignment="Qt::AlignTop">
|
|
||||||
<widget class="QLabel" name="smile2">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string notr="true">;)</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item alignment="Qt::AlignTop">
|
|
||||||
<widget class="QLabel" name="smile3">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string notr="true">:p</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item alignment="Qt::AlignTop">
|
|
||||||
<widget class="QLabel" name="smile4">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string notr="true">:O</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item alignment="Qt::AlignTop">
|
|
||||||
<widget class="QLabel" name="smile5">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string notr="true">:'(</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="emoticonSizeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Emoticon size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QSpinBox" name="emoticonSize">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="specialValueText">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string> px</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>2147483647</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>25</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="styleLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Style:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QComboBox" name="styleBrowser">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="themeColorLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Theme color:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QComboBox" name="themeColorCBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="timestampLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Timestamp format:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QComboBox" name="timestamp">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="dateformatLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Date format:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QComboBox" name="dateFormats"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="connectionGroup">
|
|
||||||
<property name="title">
|
|
||||||
<string>Connection Settings</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayoutProxy">
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbEnableIPv6">
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="Text on a checkbox to enable IPv6">Enable IPv6 (recommended)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbEnableUDP">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string extracomment="force tcp checkbox tooltip">Disabling this allows, e.g., toxing over Tor. It adds load to the Tox network however, so uncheck only when necessary.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="Text on checkbox to disable UDP">Enable UDP (recommended)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QGridLayout" name="proxyLayout">
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="proxyTypeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Proxy type:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QSpinBox" name="proxyPort">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>65535</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="proxyAddrLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="Text on proxy addr label">Address:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" name="proxyAddr"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QLabel" name="proxyPortLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="Text on proxy port label">Port:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="3">
|
|
||||||
<widget class="QComboBox" name="proxyType">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>None</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>SOCKS5</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>HTTP</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="reconnectButton">
|
|
||||||
<property name="text">
|
|
||||||
<string comment="reconnect button">Reconnect</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -952,44 +383,9 @@ will be sent to them when they appear online to you.</string>
|
||||||
<tabstop>cbAutorun</tabstop>
|
<tabstop>cbAutorun</tabstop>
|
||||||
<tabstop>checkUpdates</tabstop>
|
<tabstop>checkUpdates</tabstop>
|
||||||
<tabstop>autoSaveFilesDir</tabstop>
|
<tabstop>autoSaveFilesDir</tabstop>
|
||||||
<tabstop>statusChanges</tabstop>
|
|
||||||
<tabstop>groupAlwaysNotify</tabstop>
|
|
||||||
<tabstop>cbGroupchatPosition</tabstop>
|
|
||||||
<tabstop>cbFauxOfflineMessaging</tabstop>
|
|
||||||
<tabstop>cbCompactLayout</tabstop>
|
|
||||||
<tabstop>cbSeparateWindow</tabstop>
|
|
||||||
<tabstop>useEmoticons</tabstop>
|
|
||||||
<tabstop>smileyPackBrowser</tabstop>
|
|
||||||
<tabstop>emoticonSize</tabstop>
|
|
||||||
<tabstop>styleBrowser</tabstop>
|
|
||||||
<tabstop>themeColorCBox</tabstop>
|
|
||||||
<tabstop>timestamp</tabstop>
|
|
||||||
<tabstop>dateFormats</tabstop>
|
|
||||||
<tabstop>cbEnableIPv6</tabstop>
|
|
||||||
<tabstop>cbEnableUDP</tabstop>
|
|
||||||
<tabstop>proxyType</tabstop>
|
|
||||||
<tabstop>proxyAddr</tabstop>
|
|
||||||
<tabstop>proxyPort</tabstop>
|
|
||||||
<tabstop>reconnectButton</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
|
||||||
<sender>showWindow</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>showInFront</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>329</x>
|
|
||||||
<y>349</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>451</x>
|
|
||||||
<y>349</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>showSystemTray</sender>
|
<sender>showSystemTray</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
|
@ -1038,21 +434,5 @@ will be sent to them when they appear online to you.</string>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>notifySound</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>busySound</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>665</x>
|
|
||||||
<y>522</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>684</x>
|
|
||||||
<y>551</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
69
src/widget/form/settings/genericsettings.cpp
Normal file
69
src/widget/form/settings/genericsettings.cpp
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
#include "genericsettings.h"
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QSpinBox>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class GenericForm
|
||||||
|
*
|
||||||
|
* This is abstract class used as superclass for all settings forms.
|
||||||
|
* It provides correct behaviour of controls for settings forms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GenericForm::GenericForm(const QPixmap &icon)
|
||||||
|
: formIcon(icon)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap GenericForm::getFormIcon()
|
||||||
|
{
|
||||||
|
return formIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prevent stealing mouse wheel scroll.
|
||||||
|
*
|
||||||
|
* Scrolling event won't be transmitted to comboboxes or spinboxes.
|
||||||
|
* You can scroll through general settings without accidentially changing
|
||||||
|
* theme / skin / icons etc.
|
||||||
|
* @see GenericForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more
|
||||||
|
*/
|
||||||
|
void GenericForm::eventsInit()
|
||||||
|
{
|
||||||
|
for (QComboBox *cb : findChildren<QComboBox*>())
|
||||||
|
{
|
||||||
|
cb->installEventFilter(this);
|
||||||
|
cb->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (QSpinBox *sp : findChildren<QSpinBox*>())
|
||||||
|
{
|
||||||
|
sp->installEventFilter(this);
|
||||||
|
sp->setFocusPolicy(Qt::WheelFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
|
||||||
|
cb->installEventFilter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Ignore scroll on different controls.
|
||||||
|
* @param o Object which has been installed for the watched object.
|
||||||
|
* @param e Event object.
|
||||||
|
* @return True to stop it being handled further, false otherwise.
|
||||||
|
*/
|
||||||
|
bool GenericForm::eventFilter(QObject *o, QEvent *e)
|
||||||
|
{
|
||||||
|
if ((e->type() == QEvent::Wheel) &&
|
||||||
|
(qobject_cast<QComboBox*>(o) ||
|
||||||
|
qobject_cast<QAbstractSpinBox*>(o) ||
|
||||||
|
qobject_cast<QCheckBox*>(o)))
|
||||||
|
{
|
||||||
|
e->ignore();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QWidget::eventFilter(o, e);
|
||||||
|
}
|
|
@ -24,14 +24,15 @@ class GenericForm : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit GenericForm(const QPixmap &icon) : formIcon(icon) {;}
|
explicit GenericForm(const QPixmap &icon);
|
||||||
virtual ~GenericForm() {}
|
virtual ~GenericForm() {}
|
||||||
|
|
||||||
virtual QString getFormName() = 0;
|
virtual QString getFormName() = 0;
|
||||||
QPixmap getFormIcon()
|
QPixmap getFormIcon();
|
||||||
{
|
|
||||||
return formIcon;
|
protected:
|
||||||
}
|
bool eventFilter(QObject *o, QEvent *e) final override;
|
||||||
|
void eventsInit();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QPixmap formIcon;
|
QPixmap formIcon;
|
||||||
|
|
|
@ -20,8 +20,12 @@
|
||||||
#include "privacyform.h"
|
#include "privacyform.h"
|
||||||
#include "ui_privacysettings.h"
|
#include "ui_privacysettings.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "src/core/core.h"
|
#include "src/core/core.h"
|
||||||
#include <src/core/recursivesignalblocker.h>
|
#include "src/core/recursivesignalblocker.h"
|
||||||
#include "src/nexus.h"
|
#include "src/nexus.h"
|
||||||
#include "src/persistence/history.h"
|
#include "src/persistence/history.h"
|
||||||
#include "src/persistence/profile.h"
|
#include "src/persistence/profile.h"
|
||||||
|
@ -32,10 +36,6 @@
|
||||||
#include "src/widget/translator.h"
|
#include "src/widget/translator.h"
|
||||||
#include "src/widget/widget.h"
|
#include "src/widget/widget.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
PrivacyForm::PrivacyForm()
|
PrivacyForm::PrivacyForm()
|
||||||
: GenericForm(QPixmap(":/img/settings/privacy.png"))
|
: GenericForm(QPixmap(":/img/settings/privacy.png"))
|
||||||
, bodyUI(new Ui::PrivacySettings)
|
, bodyUI(new Ui::PrivacySettings)
|
||||||
|
@ -45,12 +45,7 @@ PrivacyForm::PrivacyForm()
|
||||||
// block all child signals during initialization
|
// block all child signals during initialization
|
||||||
const RecursiveSignalBlocker signalBlocker(this);
|
const RecursiveSignalBlocker signalBlocker(this);
|
||||||
|
|
||||||
connect(bodyUI->cbTypingNotification, SIGNAL(stateChanged(int)), this, SLOT(onTypingNotificationEnabledUpdated()));
|
eventsInit();
|
||||||
connect(bodyUI->cbKeepHistory, SIGNAL(stateChanged(int)), this, SLOT(onEnableLoggingUpdated()));
|
|
||||||
connect(bodyUI->nospamLineEdit, SIGNAL(editingFinished()), this, SLOT(setNospam()));
|
|
||||||
connect(bodyUI->randomNosapamButton, SIGNAL(clicked()), this, SLOT(generateRandomNospam()));
|
|
||||||
connect(bodyUI->nospamLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onNospamEdit()));
|
|
||||||
|
|
||||||
Translator::registerHandler(std::bind(&PrivacyForm::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&PrivacyForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +55,7 @@ PrivacyForm::~PrivacyForm()
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivacyForm::onEnableLoggingUpdated()
|
void PrivacyForm::on_cbKeepHistory_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setEnableLogging(bodyUI->cbKeepHistory->isChecked());
|
Settings::getInstance().setEnableLogging(bodyUI->cbKeepHistory->isChecked());
|
||||||
Widget::getInstance()->clearAllReceipts();
|
Widget::getInstance()->clearAllReceipts();
|
||||||
|
@ -76,12 +71,12 @@ void PrivacyForm::onEnableLoggingUpdated()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivacyForm::onTypingNotificationEnabledUpdated()
|
void PrivacyForm::on_cbTypingNotification_stateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setTypingNotification(bodyUI->cbTypingNotification->isChecked());
|
Settings::getInstance().setTypingNotification(bodyUI->cbTypingNotification->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivacyForm::setNospam()
|
void PrivacyForm::on_nospamLineEdit_editingFinished()
|
||||||
{
|
{
|
||||||
QString newNospam = bodyUI->nospamLineEdit->text();
|
QString newNospam = bodyUI->nospamLineEdit->text();
|
||||||
|
|
||||||
|
@ -99,7 +94,7 @@ void PrivacyForm::showEvent(QShowEvent*)
|
||||||
bodyUI->cbKeepHistory->setChecked(Settings::getInstance().getEnableLogging());
|
bodyUI->cbKeepHistory->setChecked(Settings::getInstance().getEnableLogging());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivacyForm::generateRandomNospam()
|
void PrivacyForm::on_randomNosapamButton_clicked()
|
||||||
{
|
{
|
||||||
QTime time = QTime::currentTime();
|
QTime time = QTime::currentTime();
|
||||||
qsrand((uint)time.msec());
|
qsrand((uint)time.msec());
|
||||||
|
@ -112,7 +107,7 @@ void PrivacyForm::generateRandomNospam()
|
||||||
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().noSpam);
|
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().noSpam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivacyForm::onNospamEdit()
|
void PrivacyForm::on_nospamLineEdit_textChanged()
|
||||||
{
|
{
|
||||||
QString str = bodyUI->nospamLineEdit->text();
|
QString str = bodyUI->nospamLineEdit->text();
|
||||||
int curs = bodyUI->nospamLineEdit->cursorPosition();
|
int curs = bodyUI->nospamLineEdit->cursorPosition();
|
||||||
|
|
|
@ -38,11 +38,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onEnableLoggingUpdated();
|
void on_cbKeepHistory_stateChanged();
|
||||||
void onTypingNotificationEnabledUpdated();
|
void on_cbTypingNotification_stateChanged();
|
||||||
void setNospam();
|
void on_nospamLineEdit_editingFinished();
|
||||||
void generateRandomNospam();
|
void on_randomNosapamButton_clicked();
|
||||||
void onNospamEdit();
|
void on_nospamLineEdit_textChanged();
|
||||||
virtual void showEvent(QShowEvent*) final override;
|
virtual void showEvent(QShowEvent*) final override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>300</height>
|
<height>359</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -36,30 +36,39 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>380</width>
|
<width>378</width>
|
||||||
<height>280</height>
|
<height>337</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cbTypingNotification">
|
<widget class="QGroupBox" name="verticalGroupBox">
|
||||||
<property name="toolTip">
|
<property name="title">
|
||||||
<string comment="tooltip for typing notifications setting">Your friends will be able to see when you are typing.</string>
|
<string>Privacy</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<string>Send typing notifications</string>
|
<item>
|
||||||
</property>
|
<widget class="QCheckBox" name="cbTypingNotification">
|
||||||
</widget>
|
<property name="toolTip">
|
||||||
</item>
|
<string comment="tooltip for typing notifications setting">Your friends will be able to see when you are typing.</string>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QCheckBox" name="cbKeepHistory">
|
<property name="text">
|
||||||
<property name="toolTip">
|
<string>Send typing notifications</string>
|
||||||
<string comment="toolTip for Keep History setting">Chat history keeping is still in development.
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbKeepHistory">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="toolTip for Keep History setting">Chat history keeping is still in development.
|
||||||
Save format changes are possible, which may result in data loss.</string>
|
Save format changes are possible, which may result in data loss.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Keep chat history</string>
|
<string>Keep chat history</string>
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignTop">
|
<item alignment="Qt::AlignTop">
|
||||||
|
|
328
src/widget/form/settings/userinterfaceform.cpp
Normal file
328
src/widget/form/settings/userinterfaceform.cpp
Normal file
|
@ -0,0 +1,328 @@
|
||||||
|
/*
|
||||||
|
Copyright © 2014-2016 by The qTox Project
|
||||||
|
|
||||||
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||||
|
|
||||||
|
qTox is libre software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
qTox is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "userinterfaceform.h"
|
||||||
|
#include "ui_userinterfacesettings.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QFont>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
#include <QTime>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
#include "src/core/core.h"
|
||||||
|
#include "src/core/coreav.h"
|
||||||
|
#include "src/core/recursivesignalblocker.h"
|
||||||
|
#include "src/net/autoupdate.h"
|
||||||
|
#include "src/nexus.h"
|
||||||
|
#include "src/persistence/profile.h"
|
||||||
|
#include "src/persistence/settings.h"
|
||||||
|
#include "src/persistence/smileypack.h"
|
||||||
|
#include "src/widget/form/settingswidget.h"
|
||||||
|
#include "src/widget/style.h"
|
||||||
|
#include "src/widget/translator.h"
|
||||||
|
#include "src/widget/widget.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class UserInterfaceForm
|
||||||
|
*
|
||||||
|
* This form contains all settings which change the UI appearance or behaviour.
|
||||||
|
* It also contains the smiley configuration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static QStringList timeFormats = {"hh:mm AP", "hh:mm", "hh:mm:ss AP", "hh:mm:ss"};
|
||||||
|
|
||||||
|
// http://doc.qt.io/qt-4.8/qdate.html#fromString
|
||||||
|
static QStringList dateFormats = {"yyyy-MM-dd", "dd-MM-yyyy", "d-MM-yyyy", "dddd d-MM-yyyy", "dddd d-MM", "dddd dd MMMM"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Constructor of UserInterfaceForm.
|
||||||
|
* @param myParent Setting widget which will contain this form as tab.
|
||||||
|
*
|
||||||
|
* Restores all controls from the settings.
|
||||||
|
*/
|
||||||
|
UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent) :
|
||||||
|
GenericForm(QPixmap(":/img/settings/general.png"))
|
||||||
|
{
|
||||||
|
parent = myParent;
|
||||||
|
|
||||||
|
bodyUI = new Ui::UserInterfaceSettings;
|
||||||
|
bodyUI->setupUi(this);
|
||||||
|
|
||||||
|
// block all child signals during initialization
|
||||||
|
const RecursiveSignalBlocker signalBlocker(this);
|
||||||
|
|
||||||
|
Settings &s = Settings::getInstance();
|
||||||
|
const QFont chatBaseFont = s.getChatMessageFont();
|
||||||
|
bodyUI->txtChatFontSize->setValue(QFontInfo(chatBaseFont).pixelSize());
|
||||||
|
bodyUI->txtChatFont->setCurrentFont(chatBaseFont);
|
||||||
|
int index = static_cast<int>(s.getStylePreference());
|
||||||
|
bodyUI->textStyleComboBox->setCurrentIndex(index);
|
||||||
|
|
||||||
|
bool showWindow = s.getShowWindow();
|
||||||
|
|
||||||
|
bodyUI->showWindow->setChecked(showWindow);
|
||||||
|
bodyUI->showInFront->setChecked(s.getShowInFront());
|
||||||
|
bodyUI->showInFront->setEnabled(showWindow);
|
||||||
|
|
||||||
|
bodyUI->groupAlwaysNotify->setChecked(s.getGroupAlwaysNotify());
|
||||||
|
bodyUI->cbGroupchatPosition->setChecked(s.getGroupchatPosition());
|
||||||
|
bodyUI->cbCompactLayout->setChecked(s.getCompactLayout());
|
||||||
|
bodyUI->cbSeparateWindow->setChecked(s.getSeparateWindow());
|
||||||
|
bodyUI->cbDontGroupWindows->setChecked(s.getDontGroupWindows());
|
||||||
|
bodyUI->cbDontGroupWindows->setEnabled(s.getSeparateWindow());
|
||||||
|
|
||||||
|
bodyUI->useEmoticons->setChecked(s.getUseEmoticons());
|
||||||
|
for (auto entry : SmileyPack::listSmileyPacks())
|
||||||
|
bodyUI->smileyPackBrowser->addItem(entry.first, entry.second);
|
||||||
|
|
||||||
|
smileLabels = {bodyUI->smile1, bodyUI->smile2, bodyUI->smile3,
|
||||||
|
bodyUI->smile4, bodyUI->smile5};
|
||||||
|
|
||||||
|
int currentPack = bodyUI->smileyPackBrowser->findData(s.getSmileyPack());
|
||||||
|
bodyUI->smileyPackBrowser->setCurrentIndex(currentPack);
|
||||||
|
reloadSmileys();
|
||||||
|
bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());
|
||||||
|
|
||||||
|
bodyUI->styleBrowser->addItem(tr("None"));
|
||||||
|
bodyUI->styleBrowser->addItems(QStyleFactory::keys());
|
||||||
|
|
||||||
|
QString style;
|
||||||
|
if (QStyleFactory::keys().contains(s.getStyle()))
|
||||||
|
style = s.getStyle();
|
||||||
|
else
|
||||||
|
style = tr("None");
|
||||||
|
|
||||||
|
bodyUI->styleBrowser->setCurrentText(style);
|
||||||
|
|
||||||
|
for (QString color : Style::getThemeColorNames())
|
||||||
|
bodyUI->themeColorCBox->addItem(color);
|
||||||
|
|
||||||
|
bodyUI->themeColorCBox->setCurrentIndex(s.getThemeColor());
|
||||||
|
bodyUI->emoticonSize->setValue(s.getEmojiFontPointSize());
|
||||||
|
|
||||||
|
QStringList timestamps;
|
||||||
|
for (QString timestamp : timeFormats)
|
||||||
|
timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp));
|
||||||
|
|
||||||
|
bodyUI->timestamp->addItems(timestamps);
|
||||||
|
|
||||||
|
QLocale ql;
|
||||||
|
QStringList datestamps;
|
||||||
|
dateFormats.append(ql.dateFormat());
|
||||||
|
dateFormats.append(ql.dateFormat(QLocale::LongFormat));
|
||||||
|
dateFormats.removeDuplicates();
|
||||||
|
timeFormats.append(ql.timeFormat());
|
||||||
|
timeFormats.append(ql.timeFormat(QLocale::LongFormat));
|
||||||
|
timeFormats.removeDuplicates();
|
||||||
|
|
||||||
|
for (QString datestamp : dateFormats)
|
||||||
|
datestamps << QString("%1 - %2").arg(datestamp, QDate::currentDate().toString(datestamp));
|
||||||
|
|
||||||
|
bodyUI->dateFormats->addItems(datestamps);
|
||||||
|
bodyUI->timestamp->setCurrentText(QString("%1 - %2").arg(s.getTimestampFormat(), QTime::currentTime().toString(s.getTimestampFormat())));
|
||||||
|
bodyUI->dateFormats->setCurrentText(QString("%1 - %2").arg(s.getDateFormat(), QDate::currentDate().toString(s.getDateFormat())));
|
||||||
|
|
||||||
|
eventsInit();
|
||||||
|
Translator::registerHandler(std::bind(&UserInterfaceForm::retranslateUi, this), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInterfaceForm::~UserInterfaceForm()
|
||||||
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
|
delete bodyUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_styleBrowser_currentIndexChanged(QString style)
|
||||||
|
{
|
||||||
|
if (bodyUI->styleBrowser->currentIndex() == 0)
|
||||||
|
Settings::getInstance().setStyle("None");
|
||||||
|
else
|
||||||
|
Settings::getInstance().setStyle(style);
|
||||||
|
|
||||||
|
this->setStyle(QStyleFactory::create(style));
|
||||||
|
parent->setBodyHeadStyle(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_emoticonSize_editingFinished()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setEmojiFontPointSize(bodyUI->emoticonSize->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_timestamp_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
||||||
|
Translator::translate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_dateFormats_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
Settings::getInstance().setDateFormat(dateFormats.at(index));
|
||||||
|
Translator::translate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_useEmoticons_stateChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setUseEmoticons(bodyUI->useEmoticons->isChecked());
|
||||||
|
bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_textStyleComboBox_currentTextChanged()
|
||||||
|
{
|
||||||
|
Settings::StyleType styleType =
|
||||||
|
static_cast<Settings::StyleType>(bodyUI->textStyleComboBox->currentIndex());
|
||||||
|
Settings::getInstance().setStylePreference(styleType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_smileyPackBrowser_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();
|
||||||
|
Settings::getInstance().setSmileyPack(filename);
|
||||||
|
reloadSmileys();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reload smileys and size information.
|
||||||
|
*/
|
||||||
|
void UserInterfaceForm::reloadSmileys()
|
||||||
|
{
|
||||||
|
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
|
||||||
|
|
||||||
|
// sometimes there are no emoticons available, don't crash in this case
|
||||||
|
if (emoticons.isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << "reloadSmilies: No emoticons found";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList smileys;
|
||||||
|
for (int i = 0; i < emoticons.size(); i++)
|
||||||
|
smileys.push_front(emoticons.at(i).first());
|
||||||
|
|
||||||
|
const QSize size(18,18);
|
||||||
|
for (int i = 0; i < smileLabels.size(); i++)
|
||||||
|
{
|
||||||
|
QIcon icon = SmileyPack::getInstance().getAsIcon(smileys[i]);
|
||||||
|
smileLabels[i]->setPixmap(icon.pixmap(size));
|
||||||
|
smileLabels[i]->setToolTip(smileys[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//set maximum size of emoji
|
||||||
|
QDesktopWidget desktop;
|
||||||
|
// 8 is the count of row and column in emoji's in widget
|
||||||
|
const int sideSize = 8;
|
||||||
|
int maxSide = qMin(desktop.geometry().height() / sideSize,
|
||||||
|
desktop.geometry().width() / sideSize);
|
||||||
|
QSize maxSize(maxSide, maxSide);
|
||||||
|
|
||||||
|
QIcon icon = SmileyPack::getInstance().getAsIcon(smileys[0]);
|
||||||
|
QSize actualSize = icon.actualSize(maxSize);
|
||||||
|
bodyUI->emoticonSize->setMaximum(actualSize.width());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_showWindow_stateChanged()
|
||||||
|
{
|
||||||
|
bool isChecked = bodyUI->showWindow->isChecked();
|
||||||
|
Settings::getInstance().setShowWindow(isChecked);
|
||||||
|
bodyUI->showInFront->setEnabled(isChecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_showInFront_stateChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setShowInFront(bodyUI->showInFront->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_groupAlwaysNotify_stateChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setGroupAlwaysNotify(bodyUI->groupAlwaysNotify->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_cbCompactLayout_stateChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setCompactLayout(bodyUI->cbCompactLayout->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_cbSeparateWindow_stateChanged()
|
||||||
|
{
|
||||||
|
bool checked = bodyUI->cbSeparateWindow->isChecked();
|
||||||
|
bodyUI->cbDontGroupWindows->setEnabled(checked);
|
||||||
|
Settings::getInstance().setSeparateWindow(checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_cbDontGroupWindows_stateChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setDontGroupWindows(bodyUI->cbDontGroupWindows->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_cbGroupchatPosition_stateChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setGroupchatPosition(bodyUI->cbGroupchatPosition->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_themeColorCBox_currentIndexChanged(int)
|
||||||
|
{
|
||||||
|
int index = bodyUI->themeColorCBox->currentIndex();
|
||||||
|
Settings::getInstance().setThemeColor(index);
|
||||||
|
Style::setThemeColor(index);
|
||||||
|
Style::applyTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Retranslate all elements in the form.
|
||||||
|
*/
|
||||||
|
void UserInterfaceForm::retranslateUi()
|
||||||
|
{
|
||||||
|
bodyUI->retranslateUi(this);
|
||||||
|
|
||||||
|
QStringList colorThemes(Style::getThemeColorNames());
|
||||||
|
for (int i = 0; i < colorThemes.size(); ++i)
|
||||||
|
{
|
||||||
|
bodyUI->themeColorCBox->setItemText(i, colorThemes[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
bodyUI->styleBrowser->setItemText(0, tr("None"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_txtChatFont_currentFontChanged(const QFont& f)
|
||||||
|
{
|
||||||
|
QFont tmpFont = f;
|
||||||
|
const int px = bodyUI->txtChatFontSize->value();
|
||||||
|
|
||||||
|
if (QFontInfo(tmpFont).pixelSize() != px)
|
||||||
|
tmpFont.setPixelSize(px);
|
||||||
|
|
||||||
|
Settings::getInstance().setChatMessageFont(tmpFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::on_txtChatFontSize_valueChanged(int px)
|
||||||
|
{
|
||||||
|
Settings& s = Settings::getInstance();
|
||||||
|
QFont tmpFont = s.getChatMessageFont();
|
||||||
|
const int fontSize = QFontInfo(tmpFont).pixelSize();
|
||||||
|
|
||||||
|
if (px != fontSize)
|
||||||
|
{
|
||||||
|
tmpFont.setPixelSize(px);
|
||||||
|
s.setChatMessageFont(tmpFont);
|
||||||
|
}
|
||||||
|
}
|
69
src/widget/form/settings/userinterfaceform.h
Normal file
69
src/widget/form/settings/userinterfaceform.h
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
Copyright © 2014-2015 by The qTox Project
|
||||||
|
|
||||||
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||||
|
|
||||||
|
qTox is libre software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
qTox is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef USERINTERFACEFORM_H
|
||||||
|
#define USERINTERFACEFORM_H
|
||||||
|
|
||||||
|
#include "genericsettings.h"
|
||||||
|
#include "src/widget/form/settingswidget.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class UserInterfaceSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserInterfaceForm : public GenericForm
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit UserInterfaceForm(SettingsWidget* myParent);
|
||||||
|
~UserInterfaceForm();
|
||||||
|
virtual QString getFormName() final override {return tr("User Interface");}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_smileyPackBrowser_currentIndexChanged(int index);
|
||||||
|
void on_emoticonSize_editingFinished();
|
||||||
|
void on_styleBrowser_currentIndexChanged(QString style);
|
||||||
|
void on_timestamp_currentIndexChanged(int index);
|
||||||
|
void on_dateFormats_currentIndexChanged(int index);
|
||||||
|
void on_textStyleComboBox_currentTextChanged();
|
||||||
|
void on_useEmoticons_stateChanged();
|
||||||
|
void on_showWindow_stateChanged();
|
||||||
|
void on_showInFront_stateChanged();
|
||||||
|
void on_groupAlwaysNotify_stateChanged();
|
||||||
|
void on_cbCompactLayout_stateChanged();
|
||||||
|
void on_cbSeparateWindow_stateChanged();
|
||||||
|
void on_cbDontGroupWindows_stateChanged();
|
||||||
|
void on_cbGroupchatPosition_stateChanged();
|
||||||
|
void on_themeColorCBox_currentIndexChanged(int);
|
||||||
|
|
||||||
|
void on_txtChatFont_currentFontChanged(const QFont& f);
|
||||||
|
void on_txtChatFontSize_valueChanged(int arg1);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
void reloadSmileys();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<QLabel*> smileLabels;
|
||||||
|
SettingsWidget* parent;
|
||||||
|
Ui::UserInterfaceSettings *bodyUI;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
518
src/widget/form/settings/userinterfacesettings.ui
Normal file
518
src/widget/form/settings/userinterfacesettings.ui
Normal file
|
@ -0,0 +1,518 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>UserInterfaceSettings</class>
|
||||||
|
<widget class="QWidget" name="UserInterfaceSettings">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1312</width>
|
||||||
|
<height>1025</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string notr="true">Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="VerticalOnlyScroller" name="scrollArea">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1290</width>
|
||||||
|
<height>1003</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,0,0,0">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>32</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="formGroupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Chat</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Base font:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QFontComboBox" name="txtChatFont"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QSpinBox" name="txtChatFontSize">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string>px</string>
|
||||||
|
</property>
|
||||||
|
<property name="prefix">
|
||||||
|
<string>Size: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="textStyleLabel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>New text styling preference may not load until qTox restarts.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Text Style format:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<spacer name="generalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="textStyleComboBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select text styling preference.</string>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Plaintext</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Show formatting characters</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Don't show formatting characters</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="newMessageGroup">
|
||||||
|
<property name="title">
|
||||||
|
<string>New message</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="showWindow">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="tooltip for Show window setting">Open qTox's window when you receive a new message and no window is open yet.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Open window</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>40</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="showInFront">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="toolTip for Focus window setting">Focus qTox when you receive message.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Focus window</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="contactListGroup">
|
||||||
|
<property name="title">
|
||||||
|
<string>Contact list</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="groupAlwaysNotify">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="toolTip for Group chat always notify">Always notify about new messages in groupchats.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Group chats always notify</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbGroupchatPosition">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="toolTip for groupchat positioning">If checked, groupchats will be placed at the top of the friends list, otherwise, they'll be placed below online friends.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Place groupchats at top of friend list</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbCompactLayout">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="toolTip for compact layout setting">Your contact list will be shown in compact mode.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Compact contact list</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbSeparateWindow">
|
||||||
|
<property name="text">
|
||||||
|
<string>Multiple windows mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>40</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbDontGroupWindows">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Open each chat in an individual window</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="formGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Emoticons</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_4">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="useEmoticons">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use emoticons</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="smileyPackLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Text on smiley pack label">Smiley Pack:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="smileyPackBrowser">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="smile1">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string notr="true">:)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="smile2">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string notr="true">;)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="smile3">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string notr="true">:p</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="smile4">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string notr="true">:O</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="smile5">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string notr="true">:'(</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="emoticonSizeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Emoticon size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QSpinBox" name="emoticonSize">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="specialValueText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> px</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>2147483647</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>25</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Theme</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="styleLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Style:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="styleBrowser">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="themeColorLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Theme color:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QComboBox" name="themeColorCBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="timestampLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Timestamp format:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QComboBox" name="timestamp">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="dateformatLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Date format:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QComboBox" name="dateFormats"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>VerticalOnlyScroller</class>
|
||||||
|
<extends>QScrollArea</extends>
|
||||||
|
<header>src/widget/form/settings/verticalonlyscroller.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>scrollArea</tabstop>
|
||||||
|
<tabstop>styleBrowser</tabstop>
|
||||||
|
<tabstop>themeColorCBox</tabstop>
|
||||||
|
<tabstop>timestamp</tabstop>
|
||||||
|
<tabstop>dateFormats</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -18,18 +18,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "settingswidget.h"
|
#include "settingswidget.h"
|
||||||
#include "src/widget/widget.h"
|
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QWindow>
|
||||||
|
|
||||||
#include "src/video/camerasource.h"
|
#include "src/video/camerasource.h"
|
||||||
|
#include "src/widget/widget.h"
|
||||||
#include "src/widget/form/settings/generalform.h"
|
#include "src/widget/form/settings/generalform.h"
|
||||||
|
#include "src/widget/form/settings/userinterfaceform.h"
|
||||||
#include "src/widget/form/settings/privacyform.h"
|
#include "src/widget/form/settings/privacyform.h"
|
||||||
#include "src/widget/form/settings/avform.h"
|
#include "src/widget/form/settings/avform.h"
|
||||||
#include "src/widget/form/settings/advancedform.h"
|
#include "src/widget/form/settings/advancedform.h"
|
||||||
#include "src/widget/form/settings/aboutform.h"
|
#include "src/widget/form/settings/aboutform.h"
|
||||||
#include "src/widget/translator.h"
|
#include "src/widget/translator.h"
|
||||||
#include "src/widget/contentlayout.h"
|
#include "src/widget/contentlayout.h"
|
||||||
#include <QTabWidget>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QWindow>
|
|
||||||
|
|
||||||
SettingsWidget::SettingsWidget(QWidget* parent)
|
SettingsWidget::SettingsWidget(QWidget* parent)
|
||||||
: QWidget(parent, Qt::Window)
|
: QWidget(parent, Qt::Window)
|
||||||
|
@ -37,36 +40,20 @@ SettingsWidget::SettingsWidget(QWidget* parent)
|
||||||
// block all signals during initialization, including child widgets
|
// block all signals during initialization, including child widgets
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
|
|
||||||
body = new QWidget();
|
|
||||||
QVBoxLayout* bodyLayout = new QVBoxLayout();
|
QVBoxLayout* bodyLayout = new QVBoxLayout();
|
||||||
body->setLayout(bodyLayout);
|
|
||||||
|
|
||||||
head = new QWidget(this);
|
|
||||||
QHBoxLayout* headLayout = new QHBoxLayout();
|
|
||||||
head->setLayout(headLayout);
|
|
||||||
|
|
||||||
imgLabel = new QLabel();
|
|
||||||
headLayout->addWidget(imgLabel);
|
|
||||||
|
|
||||||
nameLabel = new QLabel();
|
|
||||||
QFont bold;
|
|
||||||
bold.setBold(true);
|
|
||||||
nameLabel->setFont(bold);
|
|
||||||
headLayout->addWidget(nameLabel);
|
|
||||||
headLayout->addStretch(1);
|
|
||||||
|
|
||||||
settingsWidgets = new QTabWidget(this);
|
settingsWidgets = new QTabWidget(this);
|
||||||
settingsWidgets->setTabPosition(QTabWidget::North);
|
settingsWidgets->setTabPosition(QTabWidget::North);
|
||||||
|
|
||||||
bodyLayout->addWidget(settingsWidgets);
|
bodyLayout->addWidget(settingsWidgets);
|
||||||
|
|
||||||
GeneralForm* gfrm = new GeneralForm(this);
|
GeneralForm* gfrm = new GeneralForm(this);
|
||||||
PrivacyForm* pfrm = new PrivacyForm;
|
UserInterfaceForm* uifrm = new UserInterfaceForm(this);
|
||||||
AVForm* avfrm = new AVForm;
|
PrivacyForm* pfrm = new PrivacyForm();
|
||||||
AdvancedForm *expfrm = new AdvancedForm;
|
AVForm* avfrm = new AVForm();
|
||||||
AboutForm *abtfrm = new AboutForm;
|
AdvancedForm *expfrm = new AdvancedForm();
|
||||||
|
AboutForm *abtfrm = new AboutForm();
|
||||||
|
|
||||||
cfgForms = {{ gfrm, pfrm, avfrm, expfrm, abtfrm }};
|
cfgForms = {{ gfrm, uifrm, pfrm, avfrm, expfrm, abtfrm }};
|
||||||
for (GenericForm* cfgForm : cfgForms)
|
for (GenericForm* cfgForm : cfgForms)
|
||||||
settingsWidgets->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());
|
settingsWidgets->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());
|
||||||
|
|
||||||
|
@ -84,8 +71,7 @@ SettingsWidget::~SettingsWidget()
|
||||||
|
|
||||||
void SettingsWidget::setBodyHeadStyle(QString style)
|
void SettingsWidget::setBodyHeadStyle(QString style)
|
||||||
{
|
{
|
||||||
head->setStyle(QStyleFactory::create(style));
|
settingsWidgets->setStyle(QStyleFactory::create(style));
|
||||||
body->setStyle(QStyleFactory::create(style));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::showAbout()
|
void SettingsWidget::showAbout()
|
||||||
|
@ -95,9 +81,9 @@ void SettingsWidget::showAbout()
|
||||||
|
|
||||||
bool SettingsWidget::isShown() const
|
bool SettingsWidget::isShown() const
|
||||||
{
|
{
|
||||||
if (body->isVisible())
|
if (settingsWidgets->isVisible())
|
||||||
{
|
{
|
||||||
body->window()->windowHandle()->alert(0);
|
settingsWidgets->window()->windowHandle()->alert(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,25 +92,18 @@ bool SettingsWidget::isShown() const
|
||||||
|
|
||||||
void SettingsWidget::show(ContentLayout* contentLayout)
|
void SettingsWidget::show(ContentLayout* contentLayout)
|
||||||
{
|
{
|
||||||
contentLayout->mainContent->layout()->addWidget(body);
|
contentLayout->mainContent->layout()->addWidget(settingsWidgets);
|
||||||
contentLayout->mainHead->layout()->addWidget(head);
|
settingsWidgets->show();
|
||||||
body->show();
|
|
||||||
head->show();
|
|
||||||
onTabChanged(settingsWidgets->currentIndex());
|
onTabChanged(settingsWidgets->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::onTabChanged(int index)
|
void SettingsWidget::onTabChanged(int index)
|
||||||
{
|
{
|
||||||
this->settingsWidgets->setCurrentIndex(index);
|
settingsWidgets->setCurrentIndex(index);
|
||||||
GenericForm* currentWidget = static_cast<GenericForm*>(this->settingsWidgets->widget(index));
|
|
||||||
nameLabel->setText(currentWidget->getFormName());
|
|
||||||
imgLabel->setPixmap(currentWidget->getFormIcon().scaledToHeight(40, Qt::SmoothTransformation));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::retranslateUi()
|
void SettingsWidget::retranslateUi()
|
||||||
{
|
{
|
||||||
GenericForm* currentWidget = static_cast<GenericForm*>(settingsWidgets->currentWidget());
|
for (size_t i = 0; i < cfgForms.size(); i++)
|
||||||
nameLabel->setText(currentWidget->getFormName());
|
|
||||||
for (size_t i=0; i<cfgForms.size(); i++)
|
|
||||||
settingsWidgets->setTabText(i, cfgForms[i]->getFormName());
|
settingsWidgets->setTabText(i, cfgForms[i]->getFormName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,8 @@ private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *head, *body;
|
|
||||||
QTabWidget *settingsWidgets;
|
QTabWidget *settingsWidgets;
|
||||||
QLabel *nameLabel, *imgLabel;
|
std::array<GenericForm*, 6> cfgForms;
|
||||||
std::array<GenericForm*, 5> cfgForms;
|
|
||||||
int currentIndex;
|
int currentIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user