summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/QtProfileWindow.cpp41
-rw-r--r--Swift/QtUI/QtProfileWindow.h1
-rw-r--r--Swift/QtUI/QtProfileWindow.ui48
-rw-r--r--Swiften/Elements/VCard.h10
4 files changed, 86 insertions, 14 deletions
diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp
index d0d1414..e643627 100644
--- a/Swift/QtUI/QtProfileWindow.cpp
+++ b/Swift/QtUI/QtProfileWindow.cpp
@@ -29,2 +29,9 @@ QtProfileWindow::QtProfileWindow() :
ui->setupUi(this);
+
+ ui->statusLabel->setText(tr("Retrieving profile information for this user."));
+ ui->statusLabel->setVisible(false);
+
+ ui->emptyLabel->setText(tr("No profile information is available for this user."));
+ ui->emptyLabel->setVisible(false);
+
new QShortcut(QKeySequence::Close, this, SLOT(close()));
@@ -47,2 +54,11 @@ void QtProfileWindow::setVCard(VCard::ref vcard) {
ui->vcard->setVCard(vcard);
+ if (vcard->isEmpty()) {
+ ui->vcard->setVisible(false);
+ ui->emptyLabel->setVisible(true);
+ } else {
+ ui->vcard->setVisible(true);
+ ui->emptyLabel->setVisible(false);
+ }
+
+ updateWindowSize();
}
@@ -66,2 +82,4 @@ void QtProfileWindow::setProcessing(bool processing) {
ui->throbberLabel->show();
+ ui->statusLabel->setVisible(true);
+ ui->vcard->setVisible(false);
}
@@ -70,3 +88,7 @@ void QtProfileWindow::setProcessing(bool processing) {
ui->throbberLabel->movie()->stop();
+ ui->statusLabel->setVisible(false);
+ ui->vcard->setVisible(true);
}
+
+ updateWindowSize();
}
@@ -104,2 +126,21 @@ void QtProfileWindow::updateTitle() {
+void QtProfileWindow::updateWindowSize() {
+ int width = 0;
+ int height = 0;
+
+ QSize size = ui->statusLabel->size();
+ width = std::max(width, size.width());
+ height = std::max(height, size.height() * 3);
+
+ size = ui->emptyLabel->size();
+ width = std::max(width, size.width());
+ height = std::max(height, size.height() * 3);
+
+ size = ui->vcard->size();
+ width = std::max(width, size.width());
+ height = std::max(height, size.height());
+
+ resize(width, height);
+}
+
void QtProfileWindow::closeEvent(QCloseEvent* event) {
diff --git a/Swift/QtUI/QtProfileWindow.h b/Swift/QtUI/QtProfileWindow.h
index a2af63a..57cc2df 100644
--- a/Swift/QtUI/QtProfileWindow.h
+++ b/Swift/QtUI/QtProfileWindow.h
@@ -46,2 +46,3 @@ class QtProfileWindow : public QWidget, public ProfileWindow {
void updateTitle();
+ void updateWindowSize();
virtual void closeEvent(QCloseEvent* event);
diff --git a/Swift/QtUI/QtProfileWindow.ui b/Swift/QtUI/QtProfileWindow.ui
index 9394dc5..ed2986d 100644
--- a/Swift/QtUI/QtProfileWindow.ui
+++ b/Swift/QtUI/QtProfileWindow.ui
@@ -15,3 +15,3 @@
</property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="1,0,0,0,0">
<property name="margin">
@@ -23,2 +23,35 @@
<item>
+ <widget class="QLabel" name="statusLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="emptyLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="throbberLabel">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::NoTextInteraction</set>
+ </property>
+ </widget>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout">
@@ -48,15 +81,2 @@
<item>
- <widget class="QLabel" name="throbberLabel">
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::NoTextInteraction</set>
- </property>
- </widget>
- </item>
- <item>
<widget class="QPushButton" name="savePushButton">
diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h
index 84b6cfe..409a8ab 100644
--- a/Swiften/Elements/VCard.h
+++ b/Swiften/Elements/VCard.h
@@ -265,2 +265,12 @@ namespace Swift {
+ bool isEmpty() const {
+ bool empty = version_.empty() && fullName_.empty() && familyName_.empty() && givenName_.empty() && middleName_.empty() && prefix_.empty() && suffix_.empty();
+ empty &= photo_.empty() && photoType_.empty() && nick_.empty();
+ empty &= birthday_.is_not_a_date_time();
+ empty &= unknownContent_.empty();
+ empty &= emailAddresses_.empty() && telephones_.empty() && addresses_.empty() && addressLabels_.empty() && jids_.empty();
+ empty &= description_.empty() && organizations_.empty() && titles_.empty() && roles_.empty() && urls_.empty();
+ return empty;
+ }
+
private: