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

feat(UI): remove unnecessary spacings on the Profile page

Moved "header" under the scrollbar.

Renamed `Profile` and `User Profile` to `My profile`.

There is a regression with profile page header title no longer being
bold; according it Qt Creator it should be bold. No idea how to fix
that.

Thanks to @Diadlo for the code removing unnecessary header.
This commit is contained in:
Zetok Zalbavar 2016-12-17 22:05:43 +00:00
parent eb2af79b88
commit 1fc412df72
No known key found for this signature in database
GPG Key ID: C953D3880212068A
5 changed files with 109 additions and 36 deletions

View File

@ -31,6 +31,7 @@
/** /**
* Spacing in px inserted when the author of the last message changes * Spacing in px inserted when the author of the last message changes
* @note Why the hell is this a thing? surely the different font is enough? * @note Why the hell is this a thing? surely the different font is enough?
* - Even a different font is not enough TODO #1307 ~~zetok
*/ */
#define AUTHOR_CHANGE_SPACING 5 #define AUTHOR_CHANGE_SPACING 5

View File

@ -55,22 +55,6 @@ ProfileForm::ProfileForm(QWidget* parent) :
bodyUI->setupUi(this); bodyUI->setupUi(this);
core = Core::getInstance(); core = Core::getInstance();
head = new QWidget(this);
QHBoxLayout* headLayout = new QHBoxLayout();
head->setLayout(headLayout);
QLabel* imgLabel = new QLabel();
headLayout->addWidget(imgLabel);
nameLabel = new QLabel();
QFont bold;
bold.setBold(true);
nameLabel->setFont(bold);
headLayout->addWidget(nameLabel);
headLayout->addStretch(1);
imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation));
// tox // tox
toxId = new ClickableTE(); toxId = new ClickableTE();
toxId->setReadOnly(true); toxId->setReadOnly(true);
@ -86,9 +70,13 @@ ProfileForm::ProfileForm(QWidget* parent) :
bodyUI->toxmeServersList->addItem("toxme.io"); bodyUI->toxmeServersList->addItem("toxme.io");
QString toxmeInfo = Settings::getInstance().getToxmeInfo(); QString toxmeInfo = Settings::getInstance().getToxmeInfo();
if (toxmeInfo.isEmpty()) // User not registered if (toxmeInfo.isEmpty()) // User not registered
{
showRegisterToxme(); showRegisterToxme();
}
else else
{
showExistingToxme(); showExistingToxme();
}
bodyUI->qrLabel->setWordWrap(true); bodyUI->qrLabel->setWordWrap(true);
@ -155,12 +143,11 @@ ProfileForm::~ProfileForm()
Translator::unregister(this); Translator::unregister(this);
delete qr; delete qr;
delete bodyUI; delete bodyUI;
head->deleteLater();
} }
bool ProfileForm::isShown() const bool ProfileForm::isShown() const
{ {
if (head->isVisible()) if (profilePicture->isVisible())
{ {
window()->windowHandle()->alert(0); window()->windowHandle()->alert(0);
return true; return true;
@ -171,9 +158,7 @@ bool ProfileForm::isShown() const
void ProfileForm::show(ContentLayout* contentLayout) void ProfileForm::show(ContentLayout* contentLayout)
{ {
contentLayout->mainHead->layout()->addWidget(head);
contentLayout->mainContent->layout()->addWidget(this); contentLayout->mainContent->layout()->addWidget(this);
head->show();
QWidget::show(); QWidget::show();
prFileLabelUpdate(); prFileLabelUpdate();
bool portable = Settings::getInstance().getMakeToxPortable(); bool portable = Settings::getInstance().getMakeToxPortable();
@ -473,7 +458,6 @@ void ProfileForm::onChangePassClicked()
void ProfileForm::retranslateUi() void ProfileForm::retranslateUi()
{ {
bodyUI->retranslateUi(this); bodyUI->retranslateUi(this);
nameLabel->setText(tr("User Profile"));
setPasswordButtonsText(); setPasswordButtonsText();
// We have to add the toxId tooltip here and not in the .ui or Qt won't know how to translate it dynamically // We have to add the toxId tooltip here and not in the .ui or Qt won't know how to translate it dynamically
toxId->setToolTip(tr("This bunch of characters tells other Tox clients how to contact you.\nShare it with your friends to communicate.")); toxId->setToolTip(tr("This bunch of characters tells other Tox clients how to contact you.\nShare it with your friends to communicate."));

View File

@ -96,8 +96,6 @@ private:
void refreshProfiles(); void refreshProfiles();
Ui::IdentitySettings* bodyUI; Ui::IdentitySettings* bodyUI;
MaskablePixmapWidget* profilePicture; MaskablePixmapWidget* profilePicture;
QLabel* nameLabel;
QWidget* head;
Core* core; Core* core;
QTimer timer; QTimer timer;
bool hasCheck = false; bool hasCheck = false;

View File

@ -14,17 +14,20 @@
<string notr="true">Form</string> <string notr="true">Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>9</number> <number>0</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>9</number> <number>0</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>9</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>9</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QScrollArea" name="scrollArea"> <widget class="QScrollArea" name="scrollArea">
@ -39,14 +42,99 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>612</width> <width>604</width>
<height>800</height> <height>853</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,0,1"> <layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,0,0,0,1">
<property name="spacing"> <property name="spacing">
<number>9</number> <number>9</number>
</property> </property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="header">
<property name="spacing">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="imgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../res.qrc">:/img/settings/identity.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>My profile</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>5</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="publicGroup"> <widget class="QGroupBox" name="publicGroup">
<property name="title"> <property name="title">
@ -544,6 +632,8 @@ Profile does not contain your history.</string>
<tabstop>deletePassButton</tabstop> <tabstop>deletePassButton</tabstop>
<tabstop>changePassButton</tabstop> <tabstop>changePassButton</tabstop>
</tabstops> </tabstops>
<resources/> <resources>
<include location="../../../res.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -1409,15 +1409,15 @@ QString Widget::fromDialogType(DialogType type)
switch (type) switch (type)
{ {
case AddDialog: case AddDialog:
return tr("Add friend"); return tr("Add friend", "title of the window");
case GroupDialog: case GroupDialog:
return tr("Group invites"); return tr("Group invites", "title of the window");
case TransferDialog: case TransferDialog:
return tr("File transfers"); return tr("File transfers", "title of the window");
case SettingDialog: case SettingDialog:
return tr("Settings"); return tr("Settings", "title of the window");
case ProfileDialog: case ProfileDialog:
return tr("Profile"); return tr("My profile", "title of the window");
default: default:
return QString(); return QString();
} }