2014-06-25 04:11:11 +08:00
|
|
|
#include "settingsform.h"
|
2014-06-30 05:41:47 +08:00
|
|
|
#include "widget/widget.h"
|
2014-07-02 06:47:06 +08:00
|
|
|
#include "settings.h"
|
2014-06-25 04:11:11 +08:00
|
|
|
#include <QFont>
|
|
|
|
|
|
|
|
SettingsForm::SettingsForm()
|
|
|
|
: QObject()
|
|
|
|
{
|
|
|
|
main = new QWidget(), head = new QWidget();
|
|
|
|
QFont bold, small;
|
|
|
|
bold.setBold(true);
|
|
|
|
small.setPixelSize(7);
|
|
|
|
headLabel.setText("User Settings");
|
|
|
|
headLabel.setFont(bold);
|
|
|
|
|
|
|
|
nameLabel.setText("Name");
|
|
|
|
statusTextLabel.setText("Status");
|
|
|
|
idLabel.setText("Tox ID");
|
|
|
|
id.setFont(small);
|
|
|
|
id.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
|
|
|
2014-06-29 04:11:42 +08:00
|
|
|
videoTest.setText("Test video");
|
2014-07-02 06:47:06 +08:00
|
|
|
enableIPv6.setText("Enable IPv6 (recommended)");
|
|
|
|
enableIPv6.setChecked(Settings::getInstance().getEnableIPv6());
|
2014-06-29 04:11:42 +08:00
|
|
|
|
2014-06-25 04:11:11 +08:00
|
|
|
main->setLayout(&layout);
|
|
|
|
layout.addWidget(&nameLabel);
|
|
|
|
layout.addWidget(&name);
|
|
|
|
layout.addWidget(&statusTextLabel);
|
|
|
|
layout.addWidget(&statusText);
|
|
|
|
layout.addWidget(&idLabel);
|
|
|
|
layout.addWidget(&id);
|
2014-06-29 04:11:42 +08:00
|
|
|
layout.addWidget(&videoTest);
|
2014-07-02 06:47:06 +08:00
|
|
|
layout.addWidget(&enableIPv6);
|
2014-06-25 04:11:11 +08:00
|
|
|
layout.addStretch();
|
|
|
|
|
|
|
|
head->setLayout(&headLayout);
|
|
|
|
headLayout.addWidget(&headLabel);
|
2014-06-29 04:11:42 +08:00
|
|
|
|
|
|
|
connect(&videoTest, SIGNAL(clicked()), this, SLOT(onTestVideoClicked()));
|
2014-07-02 06:47:06 +08:00
|
|
|
connect(&enableIPv6, SIGNAL(stateChanged(int)), this, SLOT(onEnableIPv6Updated()));
|
2014-06-25 04:11:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SettingsForm::~SettingsForm()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsForm::setFriendAddress(const QString& friendAddress)
|
|
|
|
{
|
|
|
|
id.setText(friendAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsForm::show(Ui::Widget &ui)
|
|
|
|
{
|
|
|
|
name.setText(ui.nameLabel->text());
|
|
|
|
statusText.setText(ui.statusLabel->text());
|
|
|
|
ui.mainContent->layout()->addWidget(main);
|
|
|
|
ui.mainHead->layout()->addWidget(head);
|
|
|
|
main->show();
|
|
|
|
head->show();
|
|
|
|
}
|
2014-06-29 04:11:42 +08:00
|
|
|
|
|
|
|
void SettingsForm::onTestVideoClicked()
|
|
|
|
{
|
2014-06-30 05:41:47 +08:00
|
|
|
Widget::getInstance()->showTestCamview();
|
2014-06-29 04:11:42 +08:00
|
|
|
}
|
2014-07-02 06:47:06 +08:00
|
|
|
|
|
|
|
void SettingsForm::onEnableIPv6Updated()
|
|
|
|
{
|
|
|
|
Settings::getInstance().setEnableIPv6(enableIPv6.isChecked());
|
|
|
|
}
|