summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-09-29 07:19:41 (GMT)
committerSwift Review <review@swift.im>2014-09-30 13:25:05 (GMT)
commit19729be77c227a93aad29875d091a8d9010e2769 (patch)
treeb5966cefbf01e3d0e23732eb226cbd2a54c26758
parentf648c9b872be2520984fbb2779ea8d0f459fa8c3 (diff)
downloadswift-contrib-19729be77c227a93aad29875d091a8d9010e2769.zip
swift-contrib-19729be77c227a93aad29875d091a8d9010e2769.tar.bz2
Always bring profile window to the top on 'Show Profile' so it is visible to the
user and has focus. Test-Information: Checked via running Swift and testing in different scenarios that this functionality works. This includes situations where the profile window has been closed, minimised or put in the background. Change-Id: I367ef555fabe32f7ec1d09e7ff72b17d2071e134
-rw-r--r--Swift/QtUI/QtProfileWindow.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp
index e643627..9526d63 100644
--- a/Swift/QtUI/QtProfileWindow.cpp
+++ b/Swift/QtUI/QtProfileWindow.cpp
@@ -1,37 +1,37 @@
/*
- * Copyright (c) 2011 Remko Tronçon
+ * Copyright (c) 2011-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
/*
* Copyright (c) 2012 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include "QtProfileWindow.h"
#include "ui_QtProfileWindow.h"
#include <QCloseEvent>
#include <QMovie>
#include <QShortcut>
#include <QTextDocument>
#include <Swift/QtUI/QtSwiftUtil.h>
#include <Swift/QtUI/QtUtilities.h>
namespace Swift {
QtProfileWindow::QtProfileWindow() :
QWidget(),
ui(new Ui::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()));
@@ -71,72 +71,73 @@ void QtProfileWindow::setEnabled(bool b) {
void QtProfileWindow::setEditable(bool b) {
ui->throbberLabel->setVisible(b);
ui->errorLabel->setVisible(b);
ui->savePushButton->setVisible(b);
ui->vcard->setEditable(b);
updateTitle();
}
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);
}
updateWindowSize();
}
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("");
}
}
void QtProfileWindow::show() {
- QWidget::show();
+ QWidget::showNormal();
QWidget::activateWindow();
+ QWidget::raise();
}
void QtProfileWindow::hide() {
QWidget::hide();
}
void QtProfileWindow::updateTitle() {
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);
}
}
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());