1
0
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:
Diadlo 2016-07-02 02:28:08 +03:00
parent a963bcf9b8
commit fb4aa4c8f6
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
12 changed files with 1325 additions and 1100 deletions

View File

@ -28,11 +28,12 @@ FORMS += \
src/widget/form/profileform.ui \
src/widget/form/loadhistorydialog.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/userinterfacesettings.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/about/aboutuser.ui
@ -360,7 +361,8 @@ HEADERS += \
src/widget/about/aboutuser.h \
src/widget/form/groupinviteform.h \
src/widget/tool/profileimporter.h \
src/widget/passwordedit.h
src/widget/passwordedit.h \
src/widget/form/settings/userinterfaceform.h
SOURCES += \
src/ipc.cpp \
@ -423,11 +425,13 @@ SOURCES += \
src/video/groupnetcamview.cpp \
src/video/netcamview.cpp \
src/video/videosurface.cpp \
src/video/videomode.cpp \
src/widget/form/addfriendform.cpp \
src/widget/form/settingswidget.cpp \
src/widget/form/settings/generalform.cpp \
src/widget/form/settings/privacyform.cpp \
src/widget/form/settings/avform.cpp \
src/widget/form/settings/userinterfaceform.cpp \
src/widget/form/profileform.cpp \
src/widget/form/filesform.cpp \
src/widget/tool/chattextedit.cpp \
@ -479,5 +483,4 @@ SOURCES += \
src/widget/about/aboutuser.cpp \
src/widget/form/groupinviteform.cpp \
src/widget/tool/profileimporter.cpp \
src/widget/passwordedit.cpp \
src/video/videomode.cpp
src/widget/passwordedit.cpp

View File

@ -20,9 +20,15 @@
#include "advancedform.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/db/plaindb.h"
#include "src/persistence/profile.h"
#include "src/widget/translator.h"
AdvancedForm::AdvancedForm()
@ -34,15 +40,33 @@ AdvancedForm::AdvancedForm()
// block all child signals during initialization
const RecursiveSignalBlocker signalBlocker(this);
Settings &s = Settings::getInstance();
bodyUI->cbEnableIPv6->setChecked(s.getEnableIPv6());
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->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
{
cb->installEventFilter(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) &&
(qobject_cast<QAbstractSpinBox*>(o) || qobject_cast<QCheckBox*>(o)))
Settings::getInstance().setEnableIPv6(bodyUI->cbEnableIPv6->isChecked());
}
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();
return true;
QMessageBox::warning(this, tr("Call active", "popup title"),
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()
{
int proxyType = bodyUI->proxyType->currentIndex();
bodyUI->retranslateUi(this);
bodyUI->proxyType->setCurrentIndex(proxyType);
}

View File

@ -39,12 +39,17 @@ public:
return tr("Advanced");
}
protected:
bool eventFilter(QObject *o, QEvent *e) final override;
private slots:
// Portable
void onMakeToxPortableUpdated();
void resetToDefault();
// Connection
void onEnableIPv6Updated();
void onUDPUpdated();
void onProxyAddrEdited();
void onProxyPortEdited(int port);
void onUseProxyUpdated();
void onReconnectClicked();
private:
void retranslateUi();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>418</width>
<height>476</height>
<width>505</width>
<height>565</height>
</rect>
</property>
<property name="windowTitle">
@ -24,21 +24,11 @@
<rect>
<x>0</x>
<y>0</y>
<width>398</width>
<height>456</height>
<width>489</width>
<height>549</height>
</rect>
</property>
<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>
<widget class="QLabel" name="warningLabel">
<property name="text">
@ -55,7 +45,149 @@
</property>
</widget>
</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">
<property name="text">
<string>Reset to default settings</string>

View File

@ -20,26 +20,20 @@
#include "generalform.h"
#include "ui_generalsettings.h"
#include <src/core/recursivesignalblocker.h>
#include "src/widget/form/settingswidget.h"
#include "src/widget/widget.h"
#include "src/persistence/settings.h"
#include "src/persistence/smileypack.h"
#include <QFileDialog>
#include "src/core/core.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/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/net/autoupdate.h"
#include <QDesktopWidget>
#include <QMessageBox>
#include <QStyleFactory>
#include <QTime>
#include <QFileDialog>
#include <QFont>
#include <QStandardPaths>
#include <QDebug>
#include "src/widget/widget.h"
static QStringList locales = {"ar",
"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)
: GenericForm(QPixmap(":/img/settings/general.png"))
, bodyUI(new Ui::GeneralSettings)
@ -124,148 +114,55 @@ GeneralForm::GeneralForm(SettingsWidget *myParent)
bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED);
bodyUI->checkUpdates->setChecked(s.getCheckUpdates());
bodyUI->cbEnableIPv6->setChecked(s.getEnableIPv6());
for (int i = 0; i < langs.size(); i++)
bodyUI->transComboBox->insertItem(i, langs[i]);
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->lightTrayIcon->setChecked(s.getLightTrayIcon());
bool showSystemTray = s.getShowSystemTray();
bodyUI->showSystemTray->setChecked(showSystemTray);
bodyUI->startInTray->setChecked(s.getAutostartInTray());
bodyUI->startInTray->setEnabled(showSystemTray);
bodyUI->closeToTray->setChecked(s.getCloseToTray());
bodyUI->closeToTray->setEnabled(showSystemTray);
bodyUI->minimizeToTray->setChecked(s.getMinimizeToTray());
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->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->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->autoSaveFilesDir->setText(s.getGlobalAutoAcceptDir());
bodyUI->autoacceptFiles->setChecked(s.getAutoSaveEnabled());
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();
//general
// General
void (QComboBox::* currentIndexChanged)(int index) = &QComboBox::currentIndexChanged;
connect(bodyUI->transComboBox, currentIndexChanged, this, &GeneralForm::onTranslationUpdated);
connect(bodyUI->checkUpdates, &QCheckBox::stateChanged, this, &GeneralForm::onCheckUpdateChanged);
connect(bodyUI->transComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onTranslationUpdated()));
connect(bodyUI->cbAutorun, &QCheckBox::stateChanged, this, &GeneralForm::onAutorunUpdated);
connect(bodyUI->lightTrayIcon, &QCheckBox::stateChanged, this, &GeneralForm::onSetLightTrayIcon);
connect(bodyUI->showSystemTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowSystemTray);
connect(bodyUI->startInTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetAutostartInTray);
connect(bodyUI->closeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetCloseToTray);
connect(bodyUI->minimizeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetMinimizeToTray);
connect(bodyUI->statusChanges, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
connect(bodyUI->showWindow, &QCheckBox::stateChanged, this, &GeneralForm::onShowWindowChanged);
connect(bodyUI->showInFront, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowInFront);
connect(bodyUI->closeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetCloseToTray);
connect(bodyUI->notifySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetNotifySound);
connect(bodyUI->busySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetBusySound);
connect(bodyUI->textStyleComboBox, &QComboBox::currentTextChanged, this, &GeneralForm::onStyleUpdated);
connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &GeneralForm::onSetGroupAlwaysNotify);
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
//theme
connect(bodyUI->useEmoticons, &QCheckBox::stateChanged, this, &GeneralForm::onUseEmoticonsChange);
connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int)));
connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString)));
connect(bodyUI->themeColorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onThemeColorChanged(int)));
connect(bodyUI->emoticonSize, SIGNAL(editingFinished()), this, SLOT(onEmoticonSizeChanged()));
connect(bodyUI->timestamp, SIGNAL(currentIndexChanged(int)), this, SLOT(onTimestampSelected(int)));
connect(bodyUI->dateFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(onDateFormatSelected(int)));
//connection
connect(bodyUI->cbEnableIPv6, &QCheckBox::stateChanged, this, &GeneralForm::onEnableIPv6Updated);
connect(bodyUI->cbEnableUDP, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated);
connect(bodyUI->proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onUseProxyUpdated()));
connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &GeneralForm::onProxyAddrEdited);
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &GeneralForm::onReconnectClicked);
connect(bodyUI->statusChanges, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
connect(bodyUI->cbSeparateWindow, &QCheckBox::stateChanged, this, &GeneralForm::onSeparateWindowChanged);
connect(bodyUI->cbDontGroupWindows, &QCheckBox::stateChanged, this, &GeneralForm::onDontGroupWindowsChanged);
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
connect(bodyUI->autoAwaySpinBox, &QSpinBox::editingFinished, this, &GeneralForm::onAutoAwayChanged);
connect(bodyUI->autoSaveFilesDir, &QPushButton::clicked, this, &GeneralForm::onAutoSaveDirChange);
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
// prevent stealing mouse wheel scroll
// 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
{
cb->installEventFilter(this);
}
#ifndef QTOX_PLATFORM_EXT
bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
@ -302,11 +197,6 @@ GeneralForm::~GeneralForm()
delete bodyUI;
}
void GeneralForm::onEnableIPv6Updated()
{
Settings::getInstance().setEnableIPv6(bodyUI->cbEnableIPv6->isChecked());
}
void GeneralForm::onTranslationUpdated()
{
Settings::getInstance().setTranslation(locales[bodyUI->transComboBox->currentIndex()]);
@ -345,32 +235,26 @@ void GeneralForm::onSetMinimizeToTray()
Settings::getInstance().setMinimizeToTray(bodyUI->minimizeToTray->isChecked());
}
void GeneralForm::onStyleSelected(QString style)
void GeneralForm::onSetNotifySound()
{
if (bodyUI->styleBrowser->currentIndex() == 0)
Settings::getInstance().setStyle("None");
else
Settings::getInstance().setStyle(style);
this->setStyle(QStyleFactory::create(style));
parent->setBodyHeadStyle(style);
bool notify = bodyUI->notifySound->isChecked();
Settings::getInstance().setNotifySound(notify);
bodyUI->busySound->setEnabled(notify);
}
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));
Translator::translate();
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChanges->isChecked());
}
void GeneralForm::onDateFormatSelected(int index)
void GeneralForm::onFauxOfflineMessaging()
{
Settings::getInstance().setDateFormat(dateFormats.at(index));
Translator::translate();
Settings::getInstance().setFauxOfflineMessaging(bodyUI->cbFauxOfflineMessaging->isChecked());
}
void GeneralForm::onAutoAwayChanged()
@ -398,167 +282,11 @@ void GeneralForm::onAutoSaveDirChange()
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()
{
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)
{
if ((e->type() == QEvent::Wheel) &&
@ -572,39 +300,5 @@ bool GeneralForm::eventFilter(QObject *o, QEvent *e)
void GeneralForm::retranslateUi()
{
int proxyType = bodyUI->proxyType->currentIndex();
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);
}
}

View File

@ -40,52 +40,28 @@ public:
}
private slots:
void onEnableIPv6Updated();
void onTranslationUpdated();
void onAutorunUpdated();
void onSetShowSystemTray();
void onSetAutostartInTray();
void onSetCloseToTray();
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 onUseEmoticonsChange();
void onSetMinimizeToTray();
void onReconnectClicked();
void onSetNotifySound();
void onSetBusySound();
void onSetStatusChange();
void onFauxOfflineMessaging();
void onAutoAcceptFileChange();
void onAutoSaveDirChange();
void onCheckUpdateChanged();
void onShowWindowChanged();
void onSetShowInFront();
void onSetNotifySound();
void onSetBusySound();
void onSetGroupAlwaysNotify();
void onFauxOfflineMessaging();
void onCompactLayout();
void onSeparateWindowChanged();
void onDontGroupWindowsChanged();
void onGroupchatPositionChanged();
void onThemeColorChanged(int);
void on_txtChatFont_currentFontChanged(const QFont& f);
void on_txtChatFontSize_valueChanged(int px);
private:
void retranslateUi();
private:
Ui::GeneralSettings *bodyUI;
void reloadSmiles();
SettingsWidget *parent;
protected:

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1312</width>
<height>1098</height>
<height>580</height>
</rect>
</property>
<property name="windowTitle">
@ -39,11 +39,11 @@
<rect>
<x>0</x>
<y>0</y>
<width>1278</width>
<height>1382</height>
<width>1270</width>
<height>587</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,0,1">
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0">
<property name="spacing">
<number>32</number>
</property>
@ -208,6 +208,55 @@ instead of closing itself.</string>
</item>
</layout>
</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>
</item>
<item>
@ -299,635 +348,17 @@ instead of closing itself.</string>
</widget>
</item>
<item>
<widget class="QGroupBox" name="chatGroupBox">
<property name="title">
<string>Chat</string>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</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">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<spacer name="generalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="textStyleComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Select text styling preference.</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Plaintext</string>
</property>
</item>
<item>
<property name="text">
<string>Show formatting characters</string>
</property>
</item>
<item>
<property name="text">
<string>Don't show formatting characters</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>On new message:</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_10">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="notifySound">
<property name="toolTip">
<string comment="toolTip for Notify sound setting">Play a sound when you recieve message.</string>
</property>
<property name="text">
<string>Play sound</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_13">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="busySound">
<property name="text">
<string>Play sound while Busy</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="showWindow">
<property name="toolTip">
<string comment="tooltip for Show window setting">Open qTox's window when you receive a new message and no window is open yet.</string>
</property>
<property name="text">
<string>Open window</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_15">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="showInFront">
<property name="toolTip">
<string comment="toolTip for Focus window setting">Focus qTox when you receive message.</string>
</property>
<property name="text">
<string>Focus window</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="statusChanges">
<property name="text">
<string>Show contacts' status changes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="groupAlwaysNotify">
<property name="toolTip">
<string comment="toolTip for Group chat always notify">Always notify about new messages in groupchats.</string>
</property>
<property name="text">
<string>Group chats always notify</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbGroupchatPosition">
<property name="toolTip">
<string comment="toolTip for groupchat positioning">If checked, groupchats will be placed at the top of the friends list, otherwise, they'll be placed below online friends.</string>
</property>
<property name="text">
<string>Place groupchats at top of friend list</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbFauxOfflineMessaging">
<property name="toolTip">
<string comment="toolTip for Faux offline messaging setting">Messages you are trying to send to your friends when they are not online
will be sent to them when they appear online to you.</string>
</property>
<property name="text">
<string>Faux offline messaging</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbCompactLayout">
<property name="toolTip">
<string comment="toolTip for compact layout setting">Your contact list will be shown in compact mode.</string>
</property>
<property name="text">
<string>Compact contact list</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QCheckBox" name="cbSeparateWindow">
<property name="text">
<string>Multiple windows mode</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_12">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="cbDontGroupWindows">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Open each chat in an individual window</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="themeGroup">
<property name="title">
<string>Theme</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</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>
</spacer>
</item>
</layout>
</widget>
@ -952,44 +383,9 @@ will be sent to them when they appear online to you.</string>
<tabstop>cbAutorun</tabstop>
<tabstop>checkUpdates</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>
<resources/>
<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>
<sender>showSystemTray</sender>
<signal>toggled(bool)</signal>
@ -1038,21 +434,5 @@ will be sent to them when they appear online to you.</string>
</hint>
</hints>
</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>
</ui>

View 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);
}

View 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

View 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>

View File

@ -18,18 +18,21 @@
*/
#include "settingswidget.h"
#include "src/widget/widget.h"
#include <QTabWidget>
#include <QLabel>
#include <QWindow>
#include "src/video/camerasource.h"
#include "src/widget/widget.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/avform.h"
#include "src/widget/form/settings/advancedform.h"
#include "src/widget/form/settings/aboutform.h"
#include "src/widget/translator.h"
#include "src/widget/contentlayout.h"
#include <QTabWidget>
#include <QLabel>
#include <QWindow>
SettingsWidget::SettingsWidget(QWidget* parent)
: QWidget(parent, Qt::Window)
@ -61,12 +64,13 @@ SettingsWidget::SettingsWidget(QWidget* parent)
bodyLayout->addWidget(settingsWidgets);
GeneralForm* gfrm = new GeneralForm(this);
PrivacyForm* pfrm = new PrivacyForm;
AVForm* avfrm = new AVForm;
AdvancedForm *expfrm = new AdvancedForm;
AboutForm *abtfrm = new AboutForm;
UserInterfaceForm* uifrm = new UserInterfaceForm(this);
PrivacyForm* pfrm = new PrivacyForm();
AVForm* avfrm = new AVForm();
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)
settingsWidgets->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());

View File

@ -57,7 +57,7 @@ private:
QWidget *head, *body;
QTabWidget *settingsWidgets;
QLabel *nameLabel, *imgLabel;
std::array<GenericForm*, 5> cfgForms;
std::array<GenericForm*, 6> cfgForms;
int currentIndex;
};