summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp11
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardAddressField.h22
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp14
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h10
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp6
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h12
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp23
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui75
8 files changed, 138 insertions, 35 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
index af17d97..5f9fddf 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
@@ -4,10 +4,17 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
-#include "QtVCardAddressField.h"
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swift/QtUI/QtVCardWidget/QtVCardAddressField.h>
#include <QGridLayout>
+#include <Swift/QtUI/QtElidingLabel.h>
#include <Swift/QtUI/QtSwiftUtil.h>
namespace Swift {
@@ -58,7 +65,7 @@ void QtVCardAddressField::setupContentWidgets() {
countryLineEdit->setPlaceholderText(tr("Country"));
#endif
- deliveryTypeLabel = new QLabel(this);
+ deliveryTypeLabel = new QtElidingLabel(this);
deliveryTypeLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
getGridLayout()->addWidget(deliveryTypeLabel, getGridLayout()->rowCount()-3, 4, Qt::AlignVCenter);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h
index 5a1256a..8cbee18 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h
@@ -4,20 +4,28 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
-#pragma once
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
-#include <Swiften/Elements/VCard.h>
+#pragma once
#include <QButtonGroup>
#include <QRadioButton>
-#include "QtResizableLineEdit.h"
-#include "QtVCardFieldInfo.h"
-#include "QtVCardGeneralField.h"
-#include "QtVCardHomeWork.h"
+#include <Swiften/Elements/VCard.h>
+
+#include <Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h>
+#include <Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h>
+#include <Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h>
+#include <Swift/QtUI/QtVCardWidget/QtVCardHomeWork.h>
namespace Swift {
+class QtElidingLabel;
+
class QtVCardAddressField : public QtVCardGeneralField, public QtVCardHomeWork {
Q_OBJECT
@@ -51,7 +59,7 @@ class QtVCardAddressField : public QtVCardGeneralField, public QtVCardHomeWork {
QGridLayout* textFieldGridLayout;
QLayoutItem* textFieldGridLayoutItem;
- QLabel* deliveryTypeLabel;
+ QtElidingLabel* deliveryTypeLabel;
QRadioButton* domesticRadioButton;
QRadioButton* internationalRadioButton;
QButtonGroup* buttonGroup;
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp
index ba3d25f..64d2533 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp
@@ -4,11 +4,19 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
-#include "QtVCardAddressLabelField.h"
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h>
-#include <QGridLayout>
#include <boost/algorithm/string.hpp>
+#include <QGridLayout>
+
+#include <Swift/QtUI/QtElidingLabel.h>
#include <Swift/QtUI/QtSwiftUtil.h>
namespace Swift {
@@ -27,7 +35,7 @@ void QtVCardAddressLabelField::setupContentWidgets() {
addressLabelPlainTextEdit->setTabChangesFocus(true);
getGridLayout()->addWidget(addressLabelPlainTextEdit, getGridLayout()->rowCount()-1, 2, 3, 2, Qt::AlignVCenter);
- deliveryTypeLabel = new QLabel(this);
+ deliveryTypeLabel = new QtElidingLabel(this);
deliveryTypeLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
getGridLayout()->addWidget(deliveryTypeLabel, getGridLayout()->rowCount()-2, 4, Qt::AlignVCenter);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h
index a665d31..7d9893b 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#pragma once
#include <QButtonGroup>
@@ -18,6 +24,8 @@
namespace Swift {
+class QtElidingLabel;
+
class QtVCardAddressLabelField : public QtVCardGeneralField, public QtVCardHomeWork {
Q_OBJECT
@@ -41,7 +49,7 @@ class QtVCardAddressLabelField : public QtVCardGeneralField, public QtVCardHomeW
private:
QPlainTextEdit* addressLabelPlainTextEdit;
- QLabel* deliveryTypeLabel;
+ QtElidingLabel* deliveryTypeLabel;
QRadioButton* domesticRadioButton;
QRadioButton* internationalRadioButton;
QButtonGroup* buttonGroup;
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
index b3902bc..6aef507 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2014 Isode Limited.
+ * Copyright (c) 2014-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -17,6 +17,8 @@
#include <QHBoxLayout>
#include <QToolTip>
+#include <Swift/QtUI/QtElidingLabel.h>
+
namespace Swift {
QtVCardGeneralField::QtVCardGeneralField(QWidget* parent, QGridLayout* layout, bool editable, int row, QString label, bool preferrable, bool taggable) :
@@ -45,7 +47,7 @@ void QtVCardGeneralField::initialize() {
label->setText(labelText);
layout->addWidget(label, row, 1, Qt::AlignVCenter | Qt::AlignRight);
- tagLabel = new QLabel(this);
+ tagLabel = new QtElidingLabel(this);
tagLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
tagComboBox = new QtTagComboBox(this);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h
index 9bb7094..6583d12 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2014 Isode Limited.
+ * Copyright (c) 2014-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -17,15 +17,17 @@
#include <QLabel>
#include <QWidget>
-#include "QtCloseButton.h"
-#include "QtTagComboBox.h"
+#include <Swift/QtUI/QtVCardWidget/QtCloseButton.h>
+#include <Swift/QtUI/QtVCardWidget/QtTagComboBox.h>
namespace Swift {
+class QtElidingLabel;
+
/*
* covers features like:
* - preffered (star ceckbox)
- * - combo check boxh
+ * - combo check box
* - label
* - remove button
*/
@@ -84,7 +86,7 @@ class QtVCardGeneralField : public QWidget {
QLabel* label;
QString labelText;
QtTagComboBox* tagComboBox;
- QLabel* tagLabel;
+ QtElidingLabel* tagLabel;
QtCloseButton* closeButton;
};
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
index 46678f5..c8b010e 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h>
#include <Swift/QtUI/QtVCardWidget/ui_QtVCardPhotoAndNameFields.h>
@@ -21,6 +27,8 @@ QtVCardPhotoAndNameFields::QtVCardPhotoAndNameFields(QWidget* parent) :
ui->lineEditSUFFIX->hide();
ui->lineEditFN->hide();
ui->lineEditNICKNAME->hide();
+ ui->labelFN->hide();
+ ui->labelNICKNAME->hide();
ui->labelFULLNAME->hide();
#if QT_VERSION >= 0x040700
@@ -48,15 +56,16 @@ void QtVCardPhotoAndNameFields::setEditable(bool editable) {
this->editable = editable;
ui->avatarWidget->setEditable(editable);
- ui->lineEditFN->setVisible(editable ? true : !ui->lineEditFN->text().isEmpty());
- ui->lineEditFN->setEditable(editable);
- ui->lineEditFN->setStyleSheet(editable ? "" : "QLineEdit {border: none; background-color: transparent;}");
+ ui->horizontalLayoutFN->setSpacing(editable ? 2 : 0);
+ ui->lineEditFN->setVisible(editable);
+ ui->labelFN->setVisible(!editable);
- ui->lineEditNICKNAME->setVisible(editable ? true : !ui->lineEditNICKNAME->text().isEmpty());
- ui->lineEditNICKNAME->setEditable(editable);
- ui->lineEditNICKNAME->setStyleSheet(editable ? "" : "QLineEdit {border: none; background-color: transparent;}");
+ 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);
@@ -87,6 +96,7 @@ std::string QtVCardPhotoAndNameFields::getAvatarType() const {
void QtVCardPhotoAndNameFields::setFormattedName(const QString& formattedName) {
ui->lineEditFN->setText(formattedName);
+ ui->labelFN->setText(formattedName);
}
QString QtVCardPhotoAndNameFields::getFormattedName() const {
@@ -95,6 +105,7 @@ QString QtVCardPhotoAndNameFields::getFormattedName() const {
void QtVCardPhotoAndNameFields::setNickname(const QString& nickname) {
ui->lineEditNICKNAME->setText(nickname);
+ ui->labelNICKNAME->setText(nickname);
}
QString QtVCardPhotoAndNameFields::getNickname() const {
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui
index 04da2bc..146b49d 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui
+++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui
@@ -26,15 +26,24 @@
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
<property name="horizontalSpacing">
<number>5</number>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
- <property name="margin">
- <number>0</number>
- </property>
<item row="0" column="0" rowspan="5">
<widget class="Swift::QtAvatarWidget" name="avatarWidget" native="true">
<property name="sizePolicy">
@@ -52,7 +61,25 @@
</widget>
</item>
<item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <layout class="QHBoxLayout" name="horizontalLayoutFN">
+ <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">
@@ -80,7 +107,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>5</width>
<height>20</height>
</size>
</property>
@@ -89,9 +116,28 @@
</layout>
</item>
<item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <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>
<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>
@@ -107,7 +153,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>5</width>
<height>20</height>
</size>
</property>
@@ -116,7 +162,7 @@
</layout>
</item>
<item row="2" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="horizontalLayoutFULLNAME">
<property name="spacing">
<number>2</number>
</property>
@@ -124,7 +170,13 @@
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
- <widget class="QLabel" name="labelFULLNAME">
+ <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>
@@ -245,6 +297,11 @@
<header>Swift/QtUI/QtAvatarWidget.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>Swift::QtElidingLabel</class>
+ <extends>QLabel</extends>
+ <header>Swift/QtUI/QtElidingLabel.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>