diff options
Diffstat (limited to 'Swift/QtUI/QtProfileWindow.cpp')
| -rw-r--r-- | Swift/QtUI/QtProfileWindow.cpp | 41 |
1 files changed, 41 insertions, 0 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) { |
Swift