mirror of https://github.com/qTox/qTox.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.8 KiB
71 lines
1.8 KiB
#include "settingsform.h" |
|
#include "widget/widget.h" |
|
#include "settings.h" |
|
#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); |
|
|
|
videoTest.setText("Test video"); |
|
enableIPv6.setText("Enable IPv6 (recommended)"); |
|
enableIPv6.setChecked(Settings::getInstance().getEnableIPv6()); |
|
|
|
main->setLayout(&layout); |
|
layout.addWidget(&nameLabel); |
|
layout.addWidget(&name); |
|
layout.addWidget(&statusTextLabel); |
|
layout.addWidget(&statusText); |
|
layout.addWidget(&idLabel); |
|
layout.addWidget(&id); |
|
layout.addWidget(&videoTest); |
|
layout.addWidget(&enableIPv6); |
|
layout.addStretch(); |
|
|
|
head->setLayout(&headLayout); |
|
headLayout.addWidget(&headLabel); |
|
|
|
connect(&videoTest, SIGNAL(clicked()), this, SLOT(onTestVideoClicked())); |
|
connect(&enableIPv6, SIGNAL(stateChanged(int)), this, SLOT(onEnableIPv6Updated())); |
|
} |
|
|
|
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(); |
|
} |
|
|
|
void SettingsForm::onTestVideoClicked() |
|
{ |
|
Widget::getInstance()->showTestCamview(); |
|
} |
|
|
|
void SettingsForm::onEnableIPv6Updated() |
|
{ |
|
Settings::getInstance().setEnableIPv6(enableIPv6.isChecked()); |
|
}
|
|
|