summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-05-30 22:43:14 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-05-31 15:30:49 (GMT)
commite677a606d5f3d4ef5b0e6a29ec8eb996f197600b (patch)
treebb5768c6d0a836086201aa533c833825e1f50e1a
parente36548d66bdcc70e891ff7f84707ee59c5562c64 (diff)
downloadswift-e677a606d5f3d4ef5b0e6a29ec8eb996f197600b.zip
swift-e677a606d5f3d4ef5b0e6a29ec8eb996f197600b.tar.bz2
Layout improvements to QtVCardPhotoAndNameFields
Layout label and editing widgets below each other instead of next to each other. This way there will not be any horizontal spacing if one of them is hidden. This also removes empty name parts in the shown fullname. Test-Information: Tested on Mac OS X 10.9.5 and Qt 5.4.1. Change-Id: I20561a8e7f8b9305cd3314b1250a2d006abbccb5
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp5
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui382
2 files changed, 215 insertions, 172 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
index c8b010e..75b1f07 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
@@ -56,16 +56,13 @@ void QtVCardPhotoAndNameFields::setEditable(bool editable) {
this->editable = editable;
ui->avatarWidget->setEditable(editable);
- ui->horizontalLayoutFN->setSpacing(editable ? 2 : 0);
ui->lineEditFN->setVisible(editable);
ui->labelFN->setVisible(!editable);
- ui->horizontalLayoutNICKNAME->setSpacing(editable ? 2 : 0);
ui->lineEditNICKNAME->setVisible(editable);
ui->labelNICKNAME->setVisible(!editable);
// prefix given middle last suffix
- ui->horizontalLayoutFULLNAME->setSpacing(editable ? 2 : 0);
ui->lineEditPREFIX->setVisible(editable);
ui->lineEditGIVEN->setVisible(editable);
ui->lineEditMIDDLE->setVisible(editable);
@@ -79,7 +76,7 @@ void QtVCardPhotoAndNameFields::setEditable(bool editable) {
for (QStringList::iterator i = fullname.begin(); i != fullname.end(); i++) {
*i = i->trimmed();
}
- ui->labelFULLNAME->setText(fullname.join(" "));
+ ui->labelFULLNAME->setText((fullname.filter(QRegExp(".+"))).join(" "));
}
void QtVCardPhotoAndNameFields::setAvatar(const ByteArray &data, const std::string &type) {
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui
index 146b49d..8e24098 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui
+++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>522</width>
- <height>81</height>
+ <width>207</width>
+ <height>168</height>
</rect>
</property>
<property name="sizePolicy">
@@ -62,52 +62,65 @@
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayoutFN">
+ <property name="spacing">
+ <number>0</number>
+ </property>
<item>
- <widget class="Swift::QtElidingLabel" name="labelFN">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <pointsize>18</pointsize>
- </font>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Swift::QtResizableLineEdit" name="lineEditFN">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <pointsize>18</pointsize>
- <weight>50</weight>
- <bold>false</bold>
- </font>
- </property>
- <property name="toolTip">
- <string>Formatted Name</string>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="Swift::QtElidingLabel" name="labelFN">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>18</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Swift::QtResizableLineEdit" name="lineEditFN">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>18</pointsize>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="toolTip">
+ <string>Formatted Name</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
<property name="sizeHint" stdset="0">
<size>
- <width>5</width>
+ <width>0</width>
<height>20</height>
</size>
</property>
@@ -116,44 +129,57 @@
</layout>
</item>
<item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayoutNICKNAME">
- <item>
- <widget class="Swift::QtElidingLabel" name="labelNICKNAME">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
+ <layout class="QHBoxLayout" name="horizontalLayoutNICKNAME" stretch="0,0">
+ <property name="spacing">
+ <number>0</number>
+ </property>
<item>
- <widget class="Swift::QtResizableLineEdit" name="lineEditNICKNAME">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Nickname</string>
- </property>
- <property name="frame">
- <bool>true</bool>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="Swift::QtElidingLabel" name="labelNICKNAME">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Swift::QtResizableLineEdit" name="lineEditNICKNAME">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Nickname</string>
+ </property>
+ <property name="frame">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
<property name="sizeHint" stdset="0">
<size>
- <width>5</width>
+ <width>0</width>
<height>20</height>
</size>
</property>
@@ -162,117 +188,137 @@
</layout>
</item>
<item row="2" column="1">
- <layout class="QHBoxLayout" name="horizontalLayoutFULLNAME">
+ <layout class="QHBoxLayout" name="horizontalLayoutFULLNAME_1">
<property name="spacing">
- <number>2</number>
+ <number>0</number>
</property>
<property name="sizeConstraint">
- <enum>QLayout::SetMinimumSize</enum>
+ <enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
- <widget class="Swift::QtElidingLabel" name="labelFULLNAME">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Swift::QtResizableLineEdit" name="lineEditPREFIX">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Prefix</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Swift::QtResizableLineEdit" name="lineEditGIVEN">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Given Name</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="readOnly">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Swift::QtResizableLineEdit" name="lineEditMIDDLE">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Middle Name</string>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="frame">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Swift::QtResizableLineEdit" name="lineEditFAMILY">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Last Name</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Swift::QtResizableLineEdit" name="lineEditSUFFIX">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Suffix</string>
- </property>
- <property name="readOnly">
- <bool>false</bool>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="Swift::QtElidingLabel" name="labelFULLNAME">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayoutFULLNAME_2">
+ <property name="spacing">
+ <number>5</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="Swift::QtResizableLineEdit" name="lineEditPREFIX">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Prefix</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Swift::QtResizableLineEdit" name="lineEditGIVEN">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Given Name</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="readOnly">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Swift::QtResizableLineEdit" name="lineEditSUFFIX">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Suffix</string>
+ </property>
+ <property name="readOnly">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Swift::QtResizableLineEdit" name="lineEditFAMILY">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Last Name</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Swift::QtResizableLineEdit" name="lineEditMIDDLE">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Middle Name</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="frame">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>