diff --git a/global.cpp b/global.cpp index efadd6c..9beb7a1 100644 --- a/global.cpp +++ b/global.cpp @@ -533,6 +533,11 @@ void Shared::VCard::setOrgUnit(const QString& unit) } } +QDateTime Shared::VCard::getReceivingTime() const +{ + return receivingTime; +} + QIcon Shared::availabilityIcon(Shared::Availability av, bool big) { const std::deque& fallback = QApplication::palette().window().color().lightnessF() > 0.5 ? diff --git a/global.h b/global.h index 1261d1f..b046efa 100644 --- a/global.h +++ b/global.h @@ -300,6 +300,7 @@ public: void setOrgRole(const QString& role); QString getOrgTitle() const; void setOrgTitle(const QString& title); + QDateTime getReceivingTime() const; private: QString fullName; diff --git a/ui/squawk.cpp b/ui/squawk.cpp index b228ac8..5ddd525 100644 --- a/ui/squawk.cpp +++ b/ui/squawk.cpp @@ -751,6 +751,7 @@ void Squawk::responseVCard(const QString& jid, const Shared::VCard& card) std::map::const_iterator itr = vCards.find(jid); if (itr != vCards.end()) { itr->second->setVCard(card); + itr->second->hideProgress(); } } @@ -790,6 +791,7 @@ void Squawk::onActivateVCard(const QString& account, const QString& jid, bool ed card->show(); card->raise(); card->activateWindow(); + card->showProgress(tr("Downloading vCard")); emit requestVCard(account, jid); } diff --git a/ui/utils/message.cpp b/ui/utils/message.cpp index 4c8debe..2498d84 100644 --- a/ui/utils/message.cpp +++ b/ui/utils/message.cpp @@ -63,7 +63,6 @@ Message::Message(const Shared::Message& source, bool outgoing, const QString& p_ dFont.setItalic(true); dFont.setPointSize(dFont.pointSize() - 2); date->setFont(dFont); - date->setForegroundRole(QPalette::ToolTipText); QFont f; f.setBold(true); diff --git a/ui/utils/progress.cpp b/ui/utils/progress.cpp index 9886270..95eafa2 100644 --- a/ui/utils/progress.cpp +++ b/ui/utils/progress.cpp @@ -34,9 +34,10 @@ Progress::Progress(quint16 p_size, QWidget* parent): label.setFrameStyle(0); label.setContentsMargins(0, 0, 0, 0); label.setInteractive(false); + label.setStyleSheet("background: transparent"); pixmap->setTransformOriginPoint(size / 2, size / 2); pixmap->setTransformationMode(Qt::SmoothTransformation); - pixmap->setOffset(0, 0);; + pixmap->setOffset(0, 0); animation.setDuration(500); animation.setStartValue(0.0f); diff --git a/ui/widgets/vcard.cpp b/ui/widgets/vcard.cpp index c20b4bf..4584638 100644 --- a/ui/widgets/vcard.cpp +++ b/ui/widgets/vcard.cpp @@ -30,7 +30,10 @@ VCard::VCard(const QString& jid, bool edit, QWidget* parent): avatarMenu(nullptr), editable(edit), currentAvatarType(Shared::Avatar::empty), - currentAvatarPath("") + currentAvatarPath(""), + progress(new Progress(100)), + progressLabel(new QLabel()), + overlay(new QWidget()) { m_ui->setupUi(this); m_ui->jabberID->setText(jid); @@ -50,6 +53,7 @@ VCard::VCard(const QString& jid, bool edit, QWidget* parent): m_ui->avatarButton->setMenu(avatarMenu); avatarMenu->addAction(setAvatar); avatarMenu->addAction(clearAvatar); + m_ui->title->setText(tr("Your card")); } else { m_ui->buttonBox->hide(); m_ui->fullName->setReadOnly(true); @@ -64,6 +68,7 @@ VCard::VCard(const QString& jid, bool edit, QWidget* parent): m_ui->organizationRole->setReadOnly(true); m_ui->description->setReadOnly(true); m_ui->url->setReadOnly(true); + m_ui->title->setText(tr("Contact %1 card").arg(jid)); } connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &VCard::onButtonBoxAccepted); @@ -73,6 +78,23 @@ VCard::VCard(const QString& jid, bool edit, QWidget* parent): int height = m_ui->personalForm->minimumSize().height() - avatarButtonMargins.height(); m_ui->avatarButton->setIconSize(QSize(height, height)); + + QGridLayout* gr = static_cast(layout()); + gr->addWidget(overlay, 0, 0, 4, 1); + QVBoxLayout* nl = new QVBoxLayout(); + QGraphicsOpacityEffect* opacity = new QGraphicsOpacityEffect(); + opacity->setOpacity(0.8); + overlay->setLayout(nl); + overlay->setBackgroundRole(QPalette::Base); + overlay->setAutoFillBackground(true); + overlay->setGraphicsEffect(opacity); + progressLabel->setAlignment(Qt::AlignCenter); + progressLabel->setStyleSheet("font: 16pt"); + nl->addStretch(); + nl->addWidget(progress); + nl->addWidget(progressLabel); + nl->addStretch(); + overlay->hide(); } VCard::~VCard() @@ -102,6 +124,9 @@ void VCard::setVCard(const Shared::VCard& card) m_ui->organizationRole->setText(card.getOrgRole()); m_ui->description->setText(card.getDescription()); m_ui->url->setText(card.getUrl()); + + QDateTime receivingTime = card.getReceivingTime(); + m_ui->receivingTimeLabel->setText(tr("Received %1 at %2").arg(receivingTime.date().toString()).arg(receivingTime.time().toString())); currentAvatarType = card.getAvatarType(); currentAvatarPath = card.getAvatarPath(); @@ -211,3 +236,16 @@ void VCard::onAvatarSelected() } } } + +void VCard::showProgress(const QString& line) +{ + progressLabel->setText(line); + overlay->show(); + progress->start(); +} + +void VCard::hideProgress() +{ + overlay->hide(); + progress->stop(); +} diff --git a/ui/widgets/vcard.h b/ui/widgets/vcard.h index afba227..4831734 100644 --- a/ui/widgets/vcard.h +++ b/ui/widgets/vcard.h @@ -27,10 +27,14 @@ #include #include #include +#include +#include +#include #include #include "../../global.h" +#include "../utils/progress.h" namespace Ui { @@ -50,6 +54,8 @@ public: void setVCard(const Shared::VCard& card); void setVCard(const QString& jid, const Shared::VCard& card); QString getJid() const; + void showProgress(const QString& = ""); + void hideProgress(); signals: void saveVCard(const Shared::VCard& card); @@ -67,6 +73,9 @@ private: bool editable; Shared::Avatar currentAvatarType; QString currentAvatarPath; + Progress* progress; + QLabel* progressLabel; + QWidget* overlay; static const std::set supportedTypes; diff --git a/ui/widgets/vcard.ui b/ui/widgets/vcard.ui index 9eabf0b..a582d3c 100644 --- a/ui/widgets/vcard.ui +++ b/ui/widgets/vcard.ui @@ -2,777 +2,825 @@ VCard + + true + 0 0 594 - 595 + 651 - - - 6 - + - 6 + 0 - 6 + 0 - 6 + 0 - 6 + 0 - - - - Qt::TabFocus + + 0 + + + + + 6 - - QTabWidget::North + + 6 - - QTabWidget::Rounded + + 6 - - 0 + + 6 - - Qt::ElideNone - - - true - - - false - - - - General - - - + + + + font: 16pt + + + Contact john@dow.org card + + + Qt::AlignCenter + + + + + + + font: italic 8pt; + + + Received 12.07.2007 at 17.35 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + Qt::TabFocus + + + QTabWidget::North + + + QTabWidget::Rounded + + 0 - - 6 + + Qt::ElideNone - - 0 + + true - - 0 + + false - - 6 - - - - - - 0 - 0 - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Personal information</span></p></body></html> - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p><span style=" font-size:24pt; font-weight:600;">General</span></p></body></html> - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - - - <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Organization</span></p></body></html> - - - Qt::AlignCenter - - - - - - - Qt::AlignHCenter|Qt::AlignTop - - - - - Organization name - - - organizationName - - - - - - - - 200 - 0 - - - - - 350 - 16777215 - - - - - - - - Unit / Department - - - organizationDepartment - - - - - - - - 200 - 0 - - - - - 350 - 16777215 - - - - - - - - Role / Profession - - - organizationRole - - - - - - - - 200 - 0 - - - - - 350 - 16777215 - - - - - - - - Job title - - - organizationTitle - - - - - - - - 200 - 0 - - - - - 350 - 16777215 - - - - - - - - - - QLayout::SetDefaultConstraint - - - Qt::AlignHCenter|Qt::AlignTop - - - - - - 200 - 0 - - - - - 350 - 16777215 - - - - - - - - - 200 - 0 - - - - - 350 - 16777215 - - - - - - - - Middle name - - - middleName - - - - - - - First name - - - firstName - - - - - - - Last name - - - lastName - - - - - - - - 200 - 0 - - - - - 350 - 16777215 - - - - - - - - Nick name - - - nickName - - - - - - - - 200 - 0 - - - - - 350 - 16777215 - - - - - - - - Birthday - - - birthday - - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - .. - - - - 0 - 0 - - - - QToolButton::InstantPopup - - - Qt::ToolButtonIconOnly - - - Qt::NoArrow - - - - - - - Qt::Horizontal - - - - - - - - - - - - Full name - - - fullName - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Contact - - - - 0 - - - 0 - - - 6 - - - 0 - - - 0 - - - - - <html><head/><body><p><span style=" font-size:24pt; font-weight:600;">Contact</span></p></body></html> - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - + + + General + + + 0 - - true + + 6 - - - - 0 - 0 - 582 - 471 - - - - - - - Qt::Horizontal + + 0 + + + 0 + + + 6 + + + + + + 0 + 0 + + + + + + + <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Organization</span></p></body></html> + + + Qt::AlignCenter + + + + + + + QLayout::SetDefaultConstraint + + + Qt::AlignHCenter|Qt::AlignTop + + + + + + 200 + 0 + - - - - - - - - <html><head/><body><p><span style=" font-style:italic;">User has no contact e-mail addresses</span></p></body></html> - - - Qt::AlignCenter - - - - - - - - - <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">E-Mail addresses</span></p></body></html> - - - Qt::AlignCenter + + + 350 + 16777215 + - - - Qt::AlignHCenter|Qt::AlignTop + + + + 200 + 0 + - - - - - 150 - 0 - - - - - 300 - 16777215 - - - - - - - - Jabber ID - - - jabberID - - - - - - - - 150 - 0 - - - - - 300 - 16777215 - - - - - - - - Web site - - - url - - - - - - - - - Qt::Horizontal + + + 350 + 16777215 + - - - - Qt::Horizontal + + + + Middle name + + + middleName + + + + + + + First name + + + firstName + + + + + + + Last name + + + lastName + + + + + + + + 200 + 0 + + + + + 350 + 16777215 + + + + + + + + Nick name + + + nickName + + + + + + + + 200 + 0 + + + + + 350 + 16777215 + + + + + + + + Birthday + + + birthday - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - <html><head/><body><p><span style=" font-style:italic;">User has no contact e-mail addresses</span></p></body></html> - - - Qt::AlignCenter - - - - - - - - - <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Addresses</span></p></body></html> - - - Qt::AlignCenter - - - - - - - - - <html><head/><body><p><span style=" font-style:italic;">User has no contact e-mail addresses</span></p></body></html> - - - Qt::AlignCenter - - - - - - - - - <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Phone numbers</span></p></body></html> - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - + - - - - - - - - Description - - - - 0 - - - 6 - - - 0 - - - 0 - - - 6 - - - - - <html><head/><body><p><span style=" font-size:24pt; font-weight:600;">Description</span></p></body></html> + + + + + Qt::AlignHCenter|Qt::AlignTop + + + + + Organization name + + + organizationName + + + + + + + + 200 + 0 + + + + + 350 + 16777215 + + + + + + + + Unit / Department + + + organizationDepartment + + + + + + + + 200 + 0 + + + + + 350 + 16777215 + + + + + + + + Role / Profession + + + organizationRole + + + + + + + + 200 + 0 + + + + + 350 + 16777215 + + + + + + + + Job title + + + organizationTitle + + + + + + + + 200 + 0 + + + + + 350 + 16777215 + + + + + + + + + + Qt::Horizontal + + + + + + + + + + + + Full name + + + fullName + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + + + + <html><head/><body><p><span style=" font-size:24pt; font-weight:600;">General</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Personal information</span></p></body></html> + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + .. + + + + 0 + 0 + + + + QToolButton::InstantPopup + + + Qt::ToolButtonIconOnly + + + Qt::NoArrow + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Contact + + + + 0 - - - - - - QFrame::StyledPanel + + 0 - - Qt::LinksAccessibleByMouse|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + 6 - - - - - - - - - - QDialogButtonBox::Close|QDialogButtonBox::Save - - - false - - + + 0 + + + 0 + + + + + <html><head/><body><p><span style=" font-size:24pt; font-weight:600;">Contact</span></p></body></html> + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + true + + + + + 0 + 0 + 575 + 475 + + + + + + + Qt::Horizontal + + + + + + + + + <html><head/><body><p><span style=" font-style:italic;">User has no contact e-mail addresses</span></p></body></html> + + + Qt::AlignCenter + + + + + + + + + <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">E-Mail addresses</span></p></body></html> + + + Qt::AlignCenter + + + + + + + Qt::AlignHCenter|Qt::AlignTop + + + + + + 150 + 0 + + + + + 300 + 16777215 + + + + + + + + Jabber ID + + + jabberID + + + + + + + + 150 + 0 + + + + + 300 + 16777215 + + + + + + + + Web site + + + url + + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + <html><head/><body><p><span style=" font-style:italic;">User has no contact e-mail addresses</span></p></body></html> + + + Qt::AlignCenter + + + + + + + + + <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Addresses</span></p></body></html> + + + Qt::AlignCenter + + + + + + + + + <html><head/><body><p><span style=" font-style:italic;">User has no contact e-mail addresses</span></p></body></html> + + + Qt::AlignCenter + + + + + + + + + <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Phone numbers</span></p></body></html> + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Description + + + + 0 + + + 6 + + + 0 + + + 0 + + + 6 + + + + + <html><head/><body><p><span style=" font-size:24pt; font-weight:600;">Description</span></p></body></html> + + + + + + + QFrame::StyledPanel + + + Qt::LinksAccessibleByMouse|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + QDialogButtonBox::Close|QDialogButtonBox::Save + + + false + + + + @@ -806,7 +854,6 @@ organizationDepartment organizationRole organizationTitle - tabWidget jabberID url description