summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtProfileWindow.cpp')
-rw-r--r--Swift/QtUI/QtProfileWindow.cpp174
1 files changed, 87 insertions, 87 deletions
diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp
index 8b4b044..461ea38 100644
--- a/Swift/QtUI/QtProfileWindow.cpp
+++ b/Swift/QtUI/QtProfileWindow.cpp
@@ -25,143 +25,143 @@
namespace Swift {
QtProfileWindow::QtProfileWindow() :
- QWidget(),
- ui(new Ui::QtProfileWindow) {
- ui->setupUi(this);
+ QWidget(),
+ ui(new Ui::QtProfileWindow) {
+ ui->setupUi(this);
- ui->statusLabel->setText(tr("Retrieving profile information for this user."));
- ui->statusLabel->setVisible(false);
+ 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);
+ ui->emptyLabel->setText(tr("No profile information is available for this user."));
+ ui->emptyLabel->setVisible(false);
- new QShortcut(QKeySequence::Close, this, SLOT(close()));
- ui->throbberLabel->setMovie(new QMovie(":/icons/throbber.gif", QByteArray(), this));
- connect(ui->savePushButton, SIGNAL(clicked()), SLOT(handleSave()));
- setEditable(false);
- setAttribute(Qt::WA_DeleteOnClose);
- setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ new QShortcut(QKeySequence::Close, this, SLOT(close()));
+ ui->throbberLabel->setMovie(new QMovie(":/icons/throbber.gif", QByteArray(), this));
+ connect(ui->savePushButton, SIGNAL(clicked()), SLOT(handleSave()));
+ setEditable(false);
+ setAttribute(Qt::WA_DeleteOnClose);
+ setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
- adjustSizeTimer.setSingleShot(true);
- connect(&adjustSizeTimer, SIGNAL(timeout()), SLOT(handleAdjustSizeTimeout()));
+ adjustSizeTimer.setSingleShot(true);
+ connect(&adjustSizeTimer, SIGNAL(timeout()), SLOT(handleAdjustSizeTimeout()));
}
QtProfileWindow::~QtProfileWindow() {
- delete ui;
+ delete ui;
}
void QtProfileWindow::setJID(const JID& jid) {
- this->jid = jid;
- updateTitle();
+ this->jid = jid;
+ updateTitle();
}
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();
+ 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();
}
void QtProfileWindow::setEnabled(bool b) {
- ui->vcard->setEnabled(b);
- ui->savePushButton->setEnabled(b);
+ ui->vcard->setEnabled(b);
+ ui->savePushButton->setEnabled(b);
}
void QtProfileWindow::setEditable(bool b) {
- ui->throbberLabel->setVisible(b);
- ui->errorLabel->setVisible(b);
- ui->savePushButton->setVisible(b);
- ui->vcard->setEditable(b);
- updateTitle();
- updateWindowSize();
+ ui->throbberLabel->setVisible(b);
+ ui->errorLabel->setVisible(b);
+ ui->savePushButton->setVisible(b);
+ ui->vcard->setEditable(b);
+ updateTitle();
+ updateWindowSize();
}
void QtProfileWindow::setProcessing(bool processing) {
- if (processing) {
- ui->throbberLabel->movie()->start();
- ui->throbberLabel->show();
- ui->statusLabel->setVisible(true);
- ui->vcard->setVisible(false);
- }
- else {
- ui->throbberLabel->hide();
- ui->throbberLabel->movie()->stop();
- ui->statusLabel->setVisible(false);
- ui->vcard->setVisible(true);
- }
+ if (processing) {
+ ui->throbberLabel->movie()->start();
+ ui->throbberLabel->show();
+ ui->statusLabel->setVisible(true);
+ ui->vcard->setVisible(false);
+ }
+ else {
+ ui->throbberLabel->hide();
+ ui->throbberLabel->movie()->stop();
+ ui->statusLabel->setVisible(false);
+ ui->vcard->setVisible(true);
+ }
}
void QtProfileWindow::setError(const std::string& error) {
- if (!error.empty()) {
- ui->errorLabel->setText("<font color='red'>" + QtUtilities::htmlEscape(P2QSTRING(error)) + "</font>");
- }
- else {
- ui->errorLabel->setText("");
- }
+ if (!error.empty()) {
+ ui->errorLabel->setText("<font color='red'>" + QtUtilities::htmlEscape(P2QSTRING(error)) + "</font>");
+ }
+ else {
+ ui->errorLabel->setText("");
+ }
}
void QtProfileWindow::show() {
- QWidget::showNormal();
- QWidget::activateWindow();
- QWidget::raise();
+ QWidget::showNormal();
+ QWidget::activateWindow();
+ QWidget::raise();
}
void QtProfileWindow::hide() {
- QWidget::hide();
+ QWidget::hide();
}
QSize QtProfileWindow::sizeHint() const {
- return QWidget::sizeHint();
+ return QWidget::sizeHint();
}
void QtProfileWindow::updateTitle() {
- QString jidString;
- if (jid.isValid()) {
- jidString = QString(" ( %1 )").arg(P2QSTRING(jid.toString()));
- }
+ QString jidString;
+ if (jid.isValid()) {
+ jidString = QString(" ( %1 )").arg(P2QSTRING(jid.toString()));
+ }
- if (ui->vcard->isEditable()) {
- setWindowTitle(tr("Edit Profile") + jidString);
- } else {
- setWindowTitle(tr("Show Profile") + jidString);
- }
+ if (ui->vcard->isEditable()) {
+ setWindowTitle(tr("Edit Profile") + jidString);
+ } else {
+ setWindowTitle(tr("Show Profile") + jidString);
+ }
}
void QtProfileWindow::updateWindowSize() {
- // Delay resizing to the end of the event loop, because Qt calculates the correct layout asynchronously.
- // Qt will post LayoutRequests for widgets on the event loop on show and widgets will recaluclate their
- // layout as they process these events.
- // We use the complete and correct size hint from the freshly calculated layout by delaying execution of
- // the resize code to the end of Qt's event loop.
- if (!adjustSizeTimer.isActive()) {
- adjustSizeTimer.start(0);
- }
+ // Delay resizing to the end of the event loop, because Qt calculates the correct layout asynchronously.
+ // Qt will post LayoutRequests for widgets on the event loop on show and widgets will recaluclate their
+ // layout as they process these events.
+ // We use the complete and correct size hint from the freshly calculated layout by delaying execution of
+ // the resize code to the end of Qt's event loop.
+ if (!adjustSizeTimer.isActive()) {
+ adjustSizeTimer.start(0);
+ }
}
void QtProfileWindow::closeEvent(QCloseEvent* event) {
- event->accept();
- onWindowAboutToBeClosed(jid);
+ event->accept();
+ onWindowAboutToBeClosed(jid);
}
void QtProfileWindow::handleSave() {
- onVCardChangeRequest(ui->vcard->getVCard());
+ onVCardChangeRequest(ui->vcard->getVCard());
}
void QtProfileWindow::handleAdjustSizeTimeout() {
- // Force recaluclation of all layout geometry in children widgets.
- // This is required on Windows to have the correct size even on first show.
- QList<QWidget *> children = findChildren<QWidget*>();
- foreach(QWidget* child, children) {
- child->updateGeometry();
- }
-
- updateGeometry();
- adjustSize();
+ // Force recaluclation of all layout geometry in children widgets.
+ // This is required on Windows to have the correct size even on first show.
+ QList<QWidget *> children = findChildren<QWidget*>();
+ foreach(QWidget* child, children) {
+ child->updateGeometry();
+ }
+
+ updateGeometry();
+ adjustSize();
}
}