forked from blue/squawk
progress for VCard widget, date of receiving
This commit is contained in:
parent
f3515f1104
commit
e924715a57
8 changed files with 832 additions and 730 deletions
|
@ -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<QGridLayout*>(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();
|
||||
}
|
||||
|
|
|
@ -27,10 +27,14 @@
|
|||
#include <QMimeDatabase>
|
||||
#include <QImage>
|
||||
#include <QStandardPaths>
|
||||
#include <QLabel>
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <set>
|
||||
|
||||
#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<QString> supportedTypes;
|
||||
|
||||
|
|
1501
ui/widgets/vcard.ui
1501
ui/widgets/vcard.ui
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue