mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
e218b07ab8
commit
2e2e61962d
8
core.cpp
8
core.cpp
|
@ -63,7 +63,13 @@ Core::~Core()
|
||||||
|
|
||||||
void Core::start()
|
void Core::start()
|
||||||
{
|
{
|
||||||
tox = tox_new(1); // IPv6 enabled, needed for LAN discovery, but can crash some weird routers
|
// IPv6 needed for LAN discovery, but can crash some weird routers. On by default, can be disabled in options.
|
||||||
|
bool enableIPv6 = Settings::getInstance().getEnableIPv6();
|
||||||
|
if (enableIPv6)
|
||||||
|
qDebug() << "Core starting with IPv6 enabled";
|
||||||
|
else
|
||||||
|
qWarning() << "Core starting with IPv6 disabled. LAN discovery may not work properly.";
|
||||||
|
tox = tox_new(enableIPv6);
|
||||||
if (tox == nullptr)
|
if (tox == nullptr)
|
||||||
{
|
{
|
||||||
qCritical() << "Tox core failed to start";
|
qCritical() << "Tox core failed to start";
|
||||||
|
|
12
settings.cpp
12
settings.cpp
|
@ -83,6 +83,7 @@ void Settings::load()
|
||||||
s.beginGroup("General");
|
s.beginGroup("General");
|
||||||
username = s.value("username", "My name").toString();
|
username = s.value("username", "My name").toString();
|
||||||
statusMessage = s.value("statusMessage", "My status").toString();
|
statusMessage = s.value("statusMessage", "My status").toString();
|
||||||
|
enableIPv6 = s.value("enableIPv6", true).toBool();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Widgets");
|
s.beginGroup("Widgets");
|
||||||
|
@ -142,6 +143,7 @@ void Settings::save()
|
||||||
s.beginGroup("General");
|
s.beginGroup("General");
|
||||||
s.setValue("username", username);
|
s.setValue("username", username);
|
||||||
s.setValue("statusMessage", statusMessage);
|
s.setValue("statusMessage", statusMessage);
|
||||||
|
s.setValue("enableIPv6", enableIPv6);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Widgets");
|
s.beginGroup("Widgets");
|
||||||
|
@ -209,6 +211,16 @@ void Settings::setStatusMessage(const QString& newMessage)
|
||||||
statusMessage = newMessage;
|
statusMessage = newMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getEnableIPv6() const
|
||||||
|
{
|
||||||
|
return enableIPv6;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setEnableIPv6(bool newValue)
|
||||||
|
{
|
||||||
|
enableIPv6 = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::getEnableLogging() const
|
bool Settings::getEnableLogging() const
|
||||||
{
|
{
|
||||||
return enableLogging;
|
return enableLogging;
|
||||||
|
|
|
@ -49,6 +49,9 @@ public:
|
||||||
QString getStatusMessage() const;
|
QString getStatusMessage() const;
|
||||||
void setStatusMessage(const QString& newMessage);
|
void setStatusMessage(const QString& newMessage);
|
||||||
|
|
||||||
|
bool getEnableIPv6() const;
|
||||||
|
void setEnableIPv6(bool newValue);
|
||||||
|
|
||||||
bool getEnableLogging() const;
|
bool getEnableLogging() const;
|
||||||
void setEnableLogging(bool newValue);
|
void setEnableLogging(bool newValue);
|
||||||
|
|
||||||
|
@ -130,6 +133,8 @@ private:
|
||||||
QString username;
|
QString username;
|
||||||
QString statusMessage;
|
QString statusMessage;
|
||||||
|
|
||||||
|
bool enableIPv6;
|
||||||
|
|
||||||
bool enableLogging;
|
bool enableLogging;
|
||||||
bool encryptLogs;
|
bool encryptLogs;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "settingsform.h"
|
#include "settingsform.h"
|
||||||
#include "widget/widget.h"
|
#include "widget/widget.h"
|
||||||
|
#include "settings.h"
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
|
||||||
SettingsForm::SettingsForm()
|
SettingsForm::SettingsForm()
|
||||||
|
@ -19,6 +20,8 @@ SettingsForm::SettingsForm()
|
||||||
id.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
id.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
|
|
||||||
videoTest.setText("Test video");
|
videoTest.setText("Test video");
|
||||||
|
enableIPv6.setText("Enable IPv6 (recommended)");
|
||||||
|
enableIPv6.setChecked(Settings::getInstance().getEnableIPv6());
|
||||||
|
|
||||||
main->setLayout(&layout);
|
main->setLayout(&layout);
|
||||||
layout.addWidget(&nameLabel);
|
layout.addWidget(&nameLabel);
|
||||||
|
@ -28,12 +31,14 @@ SettingsForm::SettingsForm()
|
||||||
layout.addWidget(&idLabel);
|
layout.addWidget(&idLabel);
|
||||||
layout.addWidget(&id);
|
layout.addWidget(&id);
|
||||||
layout.addWidget(&videoTest);
|
layout.addWidget(&videoTest);
|
||||||
|
layout.addWidget(&enableIPv6);
|
||||||
layout.addStretch();
|
layout.addStretch();
|
||||||
|
|
||||||
head->setLayout(&headLayout);
|
head->setLayout(&headLayout);
|
||||||
headLayout.addWidget(&headLabel);
|
headLayout.addWidget(&headLabel);
|
||||||
|
|
||||||
connect(&videoTest, SIGNAL(clicked()), this, SLOT(onTestVideoClicked()));
|
connect(&videoTest, SIGNAL(clicked()), this, SLOT(onTestVideoClicked()));
|
||||||
|
connect(&enableIPv6, SIGNAL(stateChanged(int)), this, SLOT(onEnableIPv6Updated()));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsForm::~SettingsForm()
|
SettingsForm::~SettingsForm()
|
||||||
|
@ -59,3 +64,8 @@ void SettingsForm::onTestVideoClicked()
|
||||||
{
|
{
|
||||||
Widget::getInstance()->showTestCamview();
|
Widget::getInstance()->showTestCamview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsForm::onEnableIPv6Updated()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setEnableIPv6(enableIPv6.isChecked());
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSpacerItem>
|
#include <QSpacerItem>
|
||||||
|
#include <QCheckBox>
|
||||||
#include "ui_widget.h"
|
#include "ui_widget.h"
|
||||||
#include "widget/selfcamview.h"
|
#include "widget/selfcamview.h"
|
||||||
|
|
||||||
|
@ -24,10 +25,12 @@ public slots:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTestVideoClicked();
|
void onTestVideoClicked();
|
||||||
|
void onEnableIPv6Updated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel headLabel, nameLabel, statusTextLabel, idLabel, id;
|
QLabel headLabel, nameLabel, statusTextLabel, idLabel, id;
|
||||||
QPushButton videoTest;
|
QPushButton videoTest;
|
||||||
|
QCheckBox enableIPv6;
|
||||||
QVBoxLayout layout, headLayout;
|
QVBoxLayout layout, headLayout;
|
||||||
QWidget *main, *head;
|
QWidget *main, *head;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user