mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat(settings): Extracted user interface settings on new tab
This commit is contained in:
parent
a963bcf9b8
commit
fb4aa4c8f6
15
qtox.pro
15
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,13 @@ 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/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 +483,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
|
|
||||||
|
|
|
@ -20,9 +20,15 @@
|
||||||
#include "advancedform.h"
|
#include "advancedform.h"
|
||||||
#include "ui_advancedsettings.h"
|
#include "ui_advancedsettings.h"
|
||||||
|
|
||||||
#include <src/core/recursivesignalblocker.h>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#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/translator.h"
|
#include "src/widget/translator.h"
|
||||||
|
|
||||||
AdvancedForm::AdvancedForm()
|
AdvancedForm::AdvancedForm()
|
||||||
|
@ -34,15 +40,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());
|
||||||
|
int port = s.getProxyPort();
|
||||||
|
if (port != -1)
|
||||||
|
bodyUI->proxyPort->setValue(port);
|
||||||
|
|
||||||
|
bodyUI->proxyType->setCurrentIndex(static_cast<int>(s.getProxyType()));
|
||||||
|
onUseProxyUpdated();
|
||||||
|
|
||||||
|
// portable
|
||||||
connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &AdvancedForm::onMakeToxPortableUpdated);
|
connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &AdvancedForm::onMakeToxPortableUpdated);
|
||||||
connect(bodyUI->resetButton, SIGNAL(clicked()), this, SLOT(resetToDefault()));
|
connect(bodyUI->resetButton, &QPushButton::clicked, this, &AdvancedForm::resetToDefault);
|
||||||
|
//connection
|
||||||
|
void (QComboBox::* currentIndexChanged)(int) = &QComboBox::currentIndexChanged;
|
||||||
|
void (QSpinBox::* valueChanged)(int) = &QSpinBox::valueChanged;
|
||||||
|
connect(bodyUI->cbEnableIPv6, &QCheckBox::stateChanged, this, &AdvancedForm::onEnableIPv6Updated);
|
||||||
|
connect(bodyUI->cbEnableUDP, &QCheckBox::stateChanged, this, &AdvancedForm::onUDPUpdated);
|
||||||
|
connect(bodyUI->proxyType, currentIndexChanged, this, &AdvancedForm::onUseProxyUpdated);
|
||||||
|
connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &AdvancedForm::onProxyAddrEdited);
|
||||||
|
connect(bodyUI->proxyPort, valueChanged, this, &AdvancedForm::onProxyPortEdited);
|
||||||
|
connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &AdvancedForm::onReconnectClicked);
|
||||||
|
|
||||||
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
|
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
|
||||||
{
|
|
||||||
cb->installEventFilter(this);
|
cb->installEventFilter(this);
|
||||||
}
|
|
||||||
|
|
||||||
Translator::registerHandler(std::bind(&AdvancedForm::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&AdvancedForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
@ -62,18 +86,55 @@ void AdvancedForm::resetToDefault()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AdvancedForm::eventFilter(QObject *o, QEvent *e)
|
void AdvancedForm::onEnableIPv6Updated()
|
||||||
{
|
{
|
||||||
if ((e->type() == QEvent::Wheel) &&
|
Settings::getInstance().setEnableIPv6(bodyUI->cbEnableIPv6->isChecked());
|
||||||
(qobject_cast<QAbstractSpinBox*>(o) || qobject_cast<QCheckBox*>(o)))
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::onUDPUpdated()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setForceTCP(!bodyUI->cbEnableUDP->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::onProxyAddrEdited()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setProxyAddr(bodyUI->proxyAddr->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::onProxyPortEdited(int port)
|
||||||
|
{
|
||||||
|
if (port <= 0)
|
||||||
|
port = -1;
|
||||||
|
|
||||||
|
Settings::getInstance().setProxyPort(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::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 AdvancedForm::onReconnectClicked()
|
||||||
|
{
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
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:
|
||||||
|
// Portable
|
||||||
void onMakeToxPortableUpdated();
|
void onMakeToxPortableUpdated();
|
||||||
void resetToDefault();
|
void resetToDefault();
|
||||||
|
// Connection
|
||||||
|
void onEnableIPv6Updated();
|
||||||
|
void onUDPUpdated();
|
||||||
|
void onProxyAddrEdited();
|
||||||
|
void onProxyPortEdited(int port);
|
||||||
|
void onUseProxyUpdated();
|
||||||
|
void onReconnectClicked();
|
||||||
|
|
||||||
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,21 +24,11 @@
|
||||||
<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">
|
||||||
|
@ -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>
|
||||||
|
|
|
@ -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,6 @@ 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
|
|
||||||
static QStringList dateFormats = {"yyyy-MM-dd", "dd-MM-yyyy", "d-MM-yyyy", "dddd d-MM-yyyy", "dddd d-MM", "dddd dd MMMM"};
|
|
||||||
|
|
||||||
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,148 +114,55 @@ 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->autoacceptFiles->setChecked(s.getAutoSaveEnabled());
|
||||||
|
|
||||||
bodyUI->cbEnableUDP->setChecked(!s.getForceTCP());
|
// General
|
||||||
bodyUI->proxyAddr->setText(s.getProxyAddr());
|
void (QComboBox::* currentIndexChanged)(int index) = &QComboBox::currentIndexChanged;
|
||||||
int port = s.getProxyPort();
|
connect(bodyUI->transComboBox, currentIndexChanged, this, &GeneralForm::onTranslationUpdated);
|
||||||
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->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->cbAutorun, &QCheckBox::stateChanged, this, &GeneralForm::onAutorunUpdated);
|
||||||
connect(bodyUI->lightTrayIcon, &QCheckBox::stateChanged, this, &GeneralForm::onSetLightTrayIcon);
|
connect(bodyUI->lightTrayIcon, &QCheckBox::stateChanged, this, &GeneralForm::onSetLightTrayIcon);
|
||||||
|
|
||||||
connect(bodyUI->showSystemTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowSystemTray);
|
connect(bodyUI->showSystemTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowSystemTray);
|
||||||
connect(bodyUI->startInTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetAutostartInTray);
|
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->minimizeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetMinimizeToTray);
|
||||||
connect(bodyUI->statusChanges, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
|
connect(bodyUI->closeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetCloseToTray);
|
||||||
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->notifySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetNotifySound);
|
||||||
connect(bodyUI->busySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetBusySound);
|
connect(bodyUI->busySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetBusySound);
|
||||||
connect(bodyUI->textStyleComboBox, &QComboBox::currentTextChanged, this, &GeneralForm::onStyleUpdated);
|
connect(bodyUI->statusChanges, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
|
||||||
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->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
|
||||||
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
|
|
||||||
connect(bodyUI->cbSeparateWindow, &QCheckBox::stateChanged, this, &GeneralForm::onSeparateWindowChanged);
|
connect(bodyUI->autoAwaySpinBox, &QSpinBox::editingFinished, this, &GeneralForm::onAutoAwayChanged);
|
||||||
connect(bodyUI->cbDontGroupWindows, &QCheckBox::stateChanged, this, &GeneralForm::onDontGroupWindowsChanged);
|
connect(bodyUI->autoSaveFilesDir, &QPushButton::clicked, this, &GeneralForm::onAutoSaveDirChange);
|
||||||
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
|
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
|
||||||
|
|
||||||
// prevent stealing mouse wheel scroll
|
// prevent stealing mouse wheel scroll
|
||||||
// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
|
// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
|
||||||
|
@ -284,9 +181,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
|
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
|
||||||
{
|
|
||||||
cb->installEventFilter(this);
|
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,
|
||||||
|
@ -302,11 +197,6 @@ GeneralForm::~GeneralForm()
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onEnableIPv6Updated()
|
|
||||||
{
|
|
||||||
Settings::getInstance().setEnableIPv6(bodyUI->cbEnableIPv6->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralForm::onTranslationUpdated()
|
void GeneralForm::onTranslationUpdated()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setTranslation(locales[bodyUI->transComboBox->currentIndex()]);
|
Settings::getInstance().setTranslation(locales[bodyUI->transComboBox->currentIndex()]);
|
||||||
|
@ -345,32 +235,26 @@ void GeneralForm::onSetMinimizeToTray()
|
||||||
Settings::getInstance().setMinimizeToTray(bodyUI->minimizeToTray->isChecked());
|
Settings::getInstance().setMinimizeToTray(bodyUI->minimizeToTray->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onStyleSelected(QString style)
|
void GeneralForm::onSetNotifySound()
|
||||||
{
|
{
|
||||||
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::onSetBusySound()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setEmojiFontPointSize(bodyUI->emoticonSize->value());
|
Settings::getInstance().setBusySound(bodyUI->busySound->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onTimestampSelected(int index)
|
void GeneralForm::onSetStatusChange()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChanges->isChecked());
|
||||||
Translator::translate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onDateFormatSelected(int index)
|
void GeneralForm::onFauxOfflineMessaging()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setDateFormat(dateFormats.at(index));
|
Settings::getInstance().setFauxOfflineMessaging(bodyUI->cbFauxOfflineMessaging->isChecked());
|
||||||
Translator::translate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onAutoAwayChanged()
|
void GeneralForm::onAutoAwayChanged()
|
||||||
|
@ -398,167 +282,11 @@ void GeneralForm::onAutoSaveDirChange()
|
||||||
bodyUI->autoSaveFilesDir->setText(directory);
|
bodyUI->autoSaveFilesDir->setText(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onUseEmoticonsChange()
|
|
||||||
{
|
|
||||||
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()
|
void GeneralForm::onCheckUpdateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked());
|
Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onShowWindowChanged()
|
|
||||||
{
|
|
||||||
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)
|
bool GeneralForm::eventFilter(QObject *o, QEvent *e)
|
||||||
{
|
{
|
||||||
if ((e->type() == QEvent::Wheel) &&
|
if ((e->type() == QEvent::Wheel) &&
|
||||||
|
@ -572,39 +300,5 @@ bool GeneralForm::eventFilter(QObject *o, QEvent *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,52 +40,28 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onEnableIPv6Updated();
|
|
||||||
void onTranslationUpdated();
|
void onTranslationUpdated();
|
||||||
void onAutorunUpdated();
|
void onAutorunUpdated();
|
||||||
void onSetShowSystemTray();
|
void onSetShowSystemTray();
|
||||||
void onSetAutostartInTray();
|
void onSetAutostartInTray();
|
||||||
void onSetCloseToTray();
|
void onSetCloseToTray();
|
||||||
void onSetLightTrayIcon();
|
void onSetLightTrayIcon();
|
||||||
void onSmileyBrowserIndexChanged(int index);
|
|
||||||
void onUDPUpdated();
|
|
||||||
void onProxyAddrEdited();
|
|
||||||
void onProxyPortEdited(int port);
|
|
||||||
void onUseProxyUpdated();
|
|
||||||
void onEmoticonSizeChanged();
|
|
||||||
void onStyleSelected(QString style);
|
|
||||||
void onTimestampSelected(int index);
|
|
||||||
void onDateFormatSelected(int index);
|
|
||||||
void onStyleUpdated();
|
|
||||||
void onSetStatusChange();
|
|
||||||
void onAutoAwayChanged();
|
void onAutoAwayChanged();
|
||||||
void onUseEmoticonsChange();
|
|
||||||
void onSetMinimizeToTray();
|
void onSetMinimizeToTray();
|
||||||
void onReconnectClicked();
|
void onSetNotifySound();
|
||||||
|
void onSetBusySound();
|
||||||
|
void onSetStatusChange();
|
||||||
|
void onFauxOfflineMessaging();
|
||||||
|
|
||||||
void onAutoAcceptFileChange();
|
void onAutoAcceptFileChange();
|
||||||
void onAutoSaveDirChange();
|
void onAutoSaveDirChange();
|
||||||
void onCheckUpdateChanged();
|
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_txtChatFontSize_valueChanged(int px);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralSettings *bodyUI;
|
Ui::GeneralSettings *bodyUI;
|
||||||
void reloadSmiles();
|
|
||||||
SettingsWidget *parent;
|
SettingsWidget *parent;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -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,636 +348,18 @@ instead of closing itself.</string>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="chatGroupBox">
|
<spacer name="verticalSpacer">
|
||||||
<property name="title">
|
|
||||||
<string>Chat</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
|
||||||
<item>
|
|
||||||
<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">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</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>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<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>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</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>
|
||||||
|
|
381
src/widget/form/settings/userinterfaceform.cpp
Normal file
381
src/widget/form/settings/userinterfaceform.cpp
Normal file
|
@ -0,0 +1,381 @@
|
||||||
|
/*
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 UserInterfaceForm::UserInterfaceForm
|
||||||
|
* @param myParent Setting widget which will contain this form as tab.
|
||||||
|
*
|
||||||
|
* Constructor of UserInterfaceForm. 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);
|
||||||
|
reloadSmiles();
|
||||||
|
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())));
|
||||||
|
|
||||||
|
// Chat
|
||||||
|
connect(bodyUI->textStyleComboBox, &QComboBox::currentTextChanged, this, &UserInterfaceForm::onStyleUpdated);
|
||||||
|
|
||||||
|
connect(bodyUI->showWindow, &QCheckBox::stateChanged, this, &UserInterfaceForm::onShowWindowChanged);
|
||||||
|
connect(bodyUI->showInFront, &QCheckBox::stateChanged, this, &UserInterfaceForm::onSetShowInFront);
|
||||||
|
|
||||||
|
connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &UserInterfaceForm::onSetGroupAlwaysNotify);
|
||||||
|
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &UserInterfaceForm::onGroupchatPositionChanged);
|
||||||
|
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &UserInterfaceForm::onCompactLayout);
|
||||||
|
|
||||||
|
connect(bodyUI->cbDontGroupWindows, &QCheckBox::stateChanged, this, &UserInterfaceForm::onDontGroupWindowsChanged);
|
||||||
|
connect(bodyUI->cbSeparateWindow, &QCheckBox::stateChanged, this, &UserInterfaceForm::onSeparateWindowChanged);
|
||||||
|
|
||||||
|
// Theme
|
||||||
|
void (QComboBox::* currentIndexChanged)(int) = &QComboBox::currentIndexChanged;
|
||||||
|
connect(bodyUI->useEmoticons, &QCheckBox::stateChanged, this, &UserInterfaceForm::onUseEmoticonsChange);
|
||||||
|
connect(bodyUI->smileyPackBrowser, currentIndexChanged, this, &UserInterfaceForm::onSmileyBrowserIndexChanged);
|
||||||
|
connect(bodyUI->styleBrowser, &QComboBox::currentTextChanged, this, &UserInterfaceForm::onStyleSelected);
|
||||||
|
connect(bodyUI->themeColorCBox, currentIndexChanged, this, &UserInterfaceForm::onThemeColorChanged);
|
||||||
|
connect(bodyUI->emoticonSize, &QSpinBox::editingFinished, this, &UserInterfaceForm::onEmoticonSizeChanged);
|
||||||
|
connect(bodyUI->timestamp, currentIndexChanged, this, &UserInterfaceForm::onTimestampSelected);
|
||||||
|
connect(bodyUI->dateFormats, currentIndexChanged, this, &UserInterfaceForm::onDateFormatSelected);
|
||||||
|
|
||||||
|
|
||||||
|
// 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 UserInterfaceForm::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);
|
||||||
|
}
|
||||||
|
|
||||||
|
Translator::registerHandler(std::bind(&UserInterfaceForm::retranslateUi, this), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInterfaceForm::~UserInterfaceForm()
|
||||||
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
|
delete bodyUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onStyleSelected(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::onEmoticonSizeChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setEmojiFontPointSize(bodyUI->emoticonSize->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onTimestampSelected(int index)
|
||||||
|
{
|
||||||
|
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
||||||
|
Translator::translate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onDateFormatSelected(int index)
|
||||||
|
{
|
||||||
|
Settings::getInstance().setDateFormat(dateFormats.at(index));
|
||||||
|
Translator::translate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onUseEmoticonsChange()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setUseEmoticons(bodyUI->useEmoticons->isChecked());
|
||||||
|
bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onStyleUpdated()
|
||||||
|
{
|
||||||
|
Settings::StyleType styleType =
|
||||||
|
static_cast<Settings::StyleType>(bodyUI->textStyleComboBox->currentIndex());
|
||||||
|
Settings::getInstance().setStylePreference(styleType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onSmileyBrowserIndexChanged(int index)
|
||||||
|
{
|
||||||
|
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();
|
||||||
|
Settings::getInstance().setSmileyPack(filename);
|
||||||
|
reloadSmiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reload smiles and size information.
|
||||||
|
*/
|
||||||
|
void UserInterfaceForm::reloadSmiles()
|
||||||
|
{
|
||||||
|
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 smiles;
|
||||||
|
for (int i = 0; i < emoticons.size(); i++)
|
||||||
|
smiles.push_front(emoticons.at(i).first());
|
||||||
|
|
||||||
|
const QSize size(18,18);
|
||||||
|
for (int i = 0; i < smileLabels.size(); i++)
|
||||||
|
{
|
||||||
|
QIcon icon = SmileyPack::getInstance().getAsIcon(smiles[i]);
|
||||||
|
smileLabels[i]->setPixmap(icon.pixmap(size));
|
||||||
|
smileLabels[i]->setToolTip(smiles[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(smiles[0]);
|
||||||
|
QSize actualSize = icon.actualSize(maxSize);
|
||||||
|
bodyUI->emoticonSize->setMaximum(actualSize.width());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onShowWindowChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setShowWindow(bodyUI->showWindow->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onSetShowInFront()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setShowInFront(bodyUI->showInFront->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onSetGroupAlwaysNotify()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setGroupAlwaysNotify(bodyUI->groupAlwaysNotify->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onCompactLayout()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setCompactLayout(bodyUI->cbCompactLayout->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onSeparateWindowChanged()
|
||||||
|
{
|
||||||
|
bool checked = bodyUI->cbSeparateWindow->isChecked();
|
||||||
|
bodyUI->cbDontGroupWindows->setEnabled(checked);
|
||||||
|
Settings::getInstance().setSeparateWindow(checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onDontGroupWindowsChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setDontGroupWindows(bodyUI->cbDontGroupWindows->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onGroupchatPositionChanged()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setGroupchatPosition(bodyUI->cbGroupchatPosition->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterfaceForm::onThemeColorChanged(int)
|
||||||
|
{
|
||||||
|
int index = bodyUI->themeColorCBox->currentIndex();
|
||||||
|
Settings::getInstance().setThemeColor(index);
|
||||||
|
Style::setThemeColor(index);
|
||||||
|
Style::applyTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Retranslate all elements on 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UserInterfaceForm::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);
|
||||||
|
}
|
71
src/widget/form/settings/userinterfaceform.h
Normal file
71
src/widget/form/settings/userinterfaceform.h
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
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 onSmileyBrowserIndexChanged(int index);
|
||||||
|
void onEmoticonSizeChanged();
|
||||||
|
void onStyleSelected(QString style);
|
||||||
|
void onTimestampSelected(int index);
|
||||||
|
void onDateFormatSelected(int index);
|
||||||
|
void onStyleUpdated();
|
||||||
|
void onUseEmoticonsChange();
|
||||||
|
void onShowWindowChanged();
|
||||||
|
void onSetShowInFront();
|
||||||
|
void onSetGroupAlwaysNotify();
|
||||||
|
void onCompactLayout();
|
||||||
|
void onSeparateWindowChanged();
|
||||||
|
void onDontGroupWindowsChanged();
|
||||||
|
void onGroupchatPositionChanged();
|
||||||
|
void onThemeColorChanged(int);
|
||||||
|
|
||||||
|
void on_txtChatFont_currentFontChanged(const QFont& f);
|
||||||
|
void on_txtChatFontSize_valueChanged(int arg1);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
void reloadSmiles();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<QLabel*> smileLabels;
|
||||||
|
SettingsWidget* parent;
|
||||||
|
Ui::UserInterfaceSettings *bodyUI;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *o, QEvent *e) final override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#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)
|
||||||
|
@ -61,12 +64,13 @@ SettingsWidget::SettingsWidget(QWidget* parent)
|
||||||
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());
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ private:
|
||||||
QWidget *head, *body;
|
QWidget *head, *body;
|
||||||
QTabWidget *settingsWidgets;
|
QTabWidget *settingsWidgets;
|
||||||
QLabel *nameLabel, *imgLabel;
|
QLabel *nameLabel, *imgLabel;
|
||||||
std::array<GenericForm*, 5> cfgForms;
|
std::array<GenericForm*, 6> cfgForms;
|
||||||
int currentIndex;
|
int currentIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user