From c3dd28586430a026c8f6ddfdf76a089454ff7e3f Mon Sep 17 00:00:00 2001 From: Ovidiu Sabou Date: Wed, 4 Mar 2015 21:35:34 +0200 Subject: [PATCH] Set a header to be consistent and to have the profile page remain open when switching profiles --- src/widget/form/profileform.cpp | 17 +++++++++++++++++ src/widget/form/profileform.h | 6 ++++++ src/widget/widget.cpp | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/widget/form/profileform.cpp b/src/widget/form/profileform.cpp index 9084a23c3..6159f71b2 100644 --- a/src/widget/form/profileform.cpp +++ b/src/widget/form/profileform.cpp @@ -18,6 +18,7 @@ #include "src/nexus.h" #include "ui_identitysettings.h" #include "profileform.h" +#include "ui_mainwindow.h" #include "src/widget/form/settingswidget.h" #include "src/widget/maskablepixmapwidget.h" #include "src/misc/settings.h" @@ -53,6 +54,14 @@ ProfileForm::ProfileForm(QWidget *parent) : bodyUI->setupUi(this); core = Core::getInstance(); + head = new QWidget(); + QFont bold; + bold.setBold(true); + head->setLayout(&headLayout); + headLabel.setText(tr("User Profile")); + headLabel.setFont(bold); + headLayout.addWidget(&headLabel); + // tox toxId = new ClickableTE(); toxId->setReadOnly(true); @@ -102,6 +111,14 @@ ProfileForm::ProfileForm(QWidget *parent) : ProfileForm::~ProfileForm() { delete bodyUI; + delete head; +} + +void ProfileForm::show(Ui::MainWindow &ui) +{ + ui.mainHead->layout()->addWidget(head); + head->show(); + QWidget::show(); } void ProfileForm::copyIdClicked() diff --git a/src/widget/form/profileform.h b/src/widget/form/profileform.h index daca69c20..c9daadf23 100644 --- a/src/widget/form/profileform.h +++ b/src/widget/form/profileform.h @@ -20,6 +20,7 @@ #include #include #include +#include class CroppingLabel; class Core; @@ -27,6 +28,7 @@ class MaskablePixmapWidget; namespace Ui { class IdentitySettings; +class MainWindow; } class ClickableTE : public QLineEdit @@ -46,6 +48,7 @@ class ProfileForm : public QWidget public: ProfileForm(QWidget *parent = nullptr); ~ProfileForm(); + void show(Ui::MainWindow &ui); signals: void userNameChanged(QString); @@ -76,6 +79,9 @@ private: void refreshProfiles(); Ui::IdentitySettings* bodyUI; MaskablePixmapWidget* profilePicture; + QWidget *head; + QLabel headLabel; + QVBoxLayout headLayout; Core* core; QTimer timer; bool hasCheck = false; diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index bc4c42975..3f4334143 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -550,7 +550,7 @@ void Widget::showProfile() { hideMainForms(); ui->mainContent->layout()->addWidget(profileForm); - profileForm->show(); + profileForm->show(*ui); setWindowTitle(tr("Profile")); activeChatroomWidget = nullptr; }