1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Improve Tox ID display in settings

Fixes #42
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-07-04 18:49:19 +02:00
parent 7e96a062dc
commit 3aae8dcde7
2 changed files with 24 additions and 3 deletions

View File

@ -2,6 +2,8 @@
#include "widget/widget.h"
#include "settings.h"
#include <QFont>
#include <QClipboard>
#include <QApplication>
SettingsForm::SettingsForm()
: QObject()
@ -9,15 +11,21 @@ SettingsForm::SettingsForm()
main = new QWidget(), head = new QWidget();
QFont bold, small;
bold.setBold(true);
small.setPixelSize(7);
small.setPixelSize(13);
headLabel.setText(tr("User Settings","\"Headline\" of the window"));
headLabel.setFont(bold);
nameLabel.setText(tr("Name","Username/nick"));
statusTextLabel.setText(tr("Status","Status message"));
idLabel.setText("Tox ID");
idLabel.setText("Tox ID (click here to copy)");
id.setFont(small);
id.setTextInteractionFlags(Qt::TextSelectableByMouse);
id.setReadOnly(true);
id.setFrameStyle(QFrame::NoFrame);
id.setMinimumHeight(10);
id.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
id.setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
id.setMaximumHeight(40);
videoTest.setText(tr("Test video","Text on a button to test the video/webcam"));
enableIPv6.setText(tr("Enable IPv6 (recommended)","Text on a checkbox to enable IPv6"));
@ -39,6 +47,7 @@ SettingsForm::SettingsForm()
connect(&videoTest, SIGNAL(clicked()), this, SLOT(onTestVideoClicked()));
connect(&enableIPv6, SIGNAL(stateChanged(int)), this, SLOT(onEnableIPv6Updated()));
connect(&idLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
}
SettingsForm::~SettingsForm()
@ -69,3 +78,9 @@ void SettingsForm::onEnableIPv6Updated()
{
Settings::getInstance().setEnableIPv6(enableIPv6.isChecked());
}
void SettingsForm::copyIdClicked()
{
id.selectAll();;
QApplication::clipboard()->setText(id.toPlainText());
}

View File

@ -8,6 +8,9 @@
#include <QObject>
#include <QSpacerItem>
#include <QCheckBox>
#include <QPushButton>
#include <QTextEdit>
#include "widget/tool/clickablelabel.h"
#include "ui_widget.h"
#include "widget/selfcamview.h"
@ -26,9 +29,12 @@ public slots:
private slots:
void onTestVideoClicked();
void onEnableIPv6Updated();
void copyIdClicked();
private:
QLabel headLabel, nameLabel, statusTextLabel, idLabel, id;
QLabel headLabel, nameLabel, statusTextLabel;
QTextEdit id;
ClickableLabel idLabel;
QPushButton videoTest;
QCheckBox enableIPv6;
QVBoxLayout layout, headLayout;