mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Tidying new profile form
Fixing up Widget code for simplicity and consistency, add picture to form heading
This commit is contained in:
parent
114ddd8c50
commit
fb63232318
|
@ -54,13 +54,22 @@ ProfileForm::ProfileForm(QWidget *parent) :
|
||||||
bodyUI->setupUi(this);
|
bodyUI->setupUi(this);
|
||||||
core = Core::getInstance();
|
core = Core::getInstance();
|
||||||
|
|
||||||
head = new QWidget();
|
head = new QWidget(this);
|
||||||
|
QHBoxLayout* headLayout = new QHBoxLayout();
|
||||||
|
head->setLayout(headLayout);
|
||||||
|
|
||||||
|
QLabel* imgLabel = new QLabel();
|
||||||
|
headLayout->addWidget(imgLabel);
|
||||||
|
|
||||||
|
QLabel* nameLabel = new QLabel();
|
||||||
QFont bold;
|
QFont bold;
|
||||||
bold.setBold(true);
|
bold.setBold(true);
|
||||||
head->setLayout(&headLayout);
|
nameLabel->setFont(bold);
|
||||||
headLabel.setText(tr("User Profile"));
|
headLayout->addWidget(nameLabel);
|
||||||
headLabel.setFont(bold);
|
headLayout->addStretch(1);
|
||||||
headLayout.addWidget(&headLabel);
|
|
||||||
|
nameLabel->setText(tr("User Profile"));
|
||||||
|
imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation));
|
||||||
|
|
||||||
// tox
|
// tox
|
||||||
toxId = new ClickableTE();
|
toxId = new ClickableTE();
|
||||||
|
@ -118,6 +127,7 @@ ProfileForm::~ProfileForm()
|
||||||
void ProfileForm::show(Ui::MainWindow &ui)
|
void ProfileForm::show(Ui::MainWindow &ui)
|
||||||
{
|
{
|
||||||
ui.mainHead->layout()->addWidget(head);
|
ui.mainHead->layout()->addWidget(head);
|
||||||
|
ui.mainContent->layout()->addWidget(this);
|
||||||
head->show();
|
head->show();
|
||||||
QWidget::show();
|
QWidget::show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,6 @@ private:
|
||||||
Ui::IdentitySettings* bodyUI;
|
Ui::IdentitySettings* bodyUI;
|
||||||
MaskablePixmapWidget* profilePicture;
|
MaskablePixmapWidget* profilePicture;
|
||||||
QWidget *head;
|
QWidget *head;
|
||||||
QLabel headLabel;
|
|
||||||
QVBoxLayout headLayout;
|
|
||||||
Core* core;
|
Core* core;
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
bool hasCheck = false;
|
bool hasCheck = false;
|
||||||
|
|
|
@ -184,10 +184,10 @@ void Widget::init()
|
||||||
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
||||||
connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
|
connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
|
||||||
connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
|
connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
|
||||||
connect(ui->nameLabel, SIGNAL(clicked()), this, SLOT(onUsernameClicked()));
|
connect(profilePicture, &MaskablePixmapWidget::clicked, this, &Widget::showProfile);
|
||||||
|
connect(ui->nameLabel, &CroppingLabel::clicked, this, &Widget::showProfile);
|
||||||
connect(ui->statusLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onStatusMessageChanged(QString, QString)));
|
connect(ui->statusLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onStatusMessageChanged(QString, QString)));
|
||||||
connect(ui->mainSplitter, &QSplitter::splitterMoved, this, &Widget::onSplitterMoved);
|
connect(ui->mainSplitter, &QSplitter::splitterMoved, this, &Widget::onSplitterMoved);
|
||||||
connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked()));
|
|
||||||
connect(addFriendForm, SIGNAL(friendRequested(QString, QString)), this, SIGNAL(friendRequested(QString, QString)));
|
connect(addFriendForm, SIGNAL(friendRequested(QString, QString)), this, SIGNAL(friendRequested(QString, QString)));
|
||||||
connect(timer, &QTimer::timeout, this, &Widget::onUserAwayCheck);
|
connect(timer, &QTimer::timeout, this, &Widget::onUserAwayCheck);
|
||||||
connect(timer, &QTimer::timeout, this, &Widget::onEventIconTick);
|
connect(timer, &QTimer::timeout, this, &Widget::onEventIconTick);
|
||||||
|
@ -310,11 +310,6 @@ QString Widget::getUsername()
|
||||||
return Nexus::getCore()->getUsername();
|
return Nexus::getCore()->getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onAvatarClicked()
|
|
||||||
{
|
|
||||||
showProfile();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::onSelfAvatarLoaded(const QPixmap& pic)
|
void Widget::onSelfAvatarLoaded(const QPixmap& pic)
|
||||||
{
|
{
|
||||||
profilePicture->setPixmap(pic);
|
profilePicture->setPixmap(pic);
|
||||||
|
@ -490,6 +485,14 @@ void Widget::onSettingsClicked()
|
||||||
activeChatroomWidget = nullptr;
|
activeChatroomWidget = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::showProfile() // onAvatarClicked, onUsernameClicked
|
||||||
|
{
|
||||||
|
hideMainForms();
|
||||||
|
profileForm->show(*ui);
|
||||||
|
setWindowTitle(tr("Profile"));
|
||||||
|
activeChatroomWidget = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::hideMainForms()
|
void Widget::hideMainForms()
|
||||||
{
|
{
|
||||||
QLayoutItem* item;
|
QLayoutItem* item;
|
||||||
|
@ -510,20 +513,6 @@ void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUse
|
||||||
Nexus::getCore()->setUsername(newUsername);
|
Nexus::getCore()->setUsername(newUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::showProfile()
|
|
||||||
{
|
|
||||||
hideMainForms();
|
|
||||||
ui->mainContent->layout()->addWidget(profileForm);
|
|
||||||
profileForm->show(*ui);
|
|
||||||
setWindowTitle(tr("Profile"));
|
|
||||||
activeChatroomWidget = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::onUsernameClicked()
|
|
||||||
{
|
|
||||||
showProfile();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::setUsername(const QString& username)
|
void Widget::setUsername(const QString& username)
|
||||||
{
|
{
|
||||||
ui->nameLabel->setText(username);
|
ui->nameLabel->setText(username);
|
||||||
|
|
|
@ -77,7 +77,6 @@ public:
|
||||||
|
|
||||||
void reloadTheme();
|
void reloadTheme();
|
||||||
|
|
||||||
void showProfile();
|
|
||||||
public slots:
|
public slots:
|
||||||
void onSettingsClicked();
|
void onSettingsClicked();
|
||||||
void setWindowTitle(const QString& title);
|
void setWindowTitle(const QString& title);
|
||||||
|
@ -122,8 +121,7 @@ private slots:
|
||||||
void onAddClicked();
|
void onAddClicked();
|
||||||
void onGroupClicked();
|
void onGroupClicked();
|
||||||
void onTransferClicked();
|
void onTransferClicked();
|
||||||
void onAvatarClicked();
|
void showProfile();
|
||||||
void onUsernameClicked();
|
|
||||||
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
|
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
|
||||||
void onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage);
|
void onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage);
|
||||||
void onChatroomWidgetClicked(GenericChatroomWidget *);
|
void onChatroomWidgetClicked(GenericChatroomWidget *);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user