WIP: master. Pop ups windows opening on centr of parent #68

Draft
pavanvo wants to merge 2 commits from pavanvo/squawk:master into master
3 changed files with 11 additions and 8 deletions
Showing only changes of commit ea7dcc5f18 - Show all commits

View File

@ -637,14 +637,13 @@ void Squawk::onContextAboutToHide()
void Squawk::onAboutSquawkCalled() void Squawk::onAboutSquawkCalled()
{ {
if (about == nullptr) { if (about == nullptr) {
about = new About(); about = new About(this);
about->setAttribute(Qt::WA_DeleteOnClose); about->setAttribute(Qt::WA_DeleteOnClose);
connect(about, &Settings::destroyed, this, &Squawk::onAboutSquawkClosed); connect(about, &Settings::destroyed, this, &Squawk::onAboutSquawkClosed);
} else {
about->raise();
about->activateWindow();
} }
about->show(); about->show();
about->raise();
about->activateWindow();
} }
Models::Roster::ElId Squawk::currentConversationId() const Models::Roster::ElId Squawk::currentConversationId() const

View File

@ -25,7 +25,7 @@ static const std::string QXMPP_VERSION_MAJOR(std::to_string(QXMPP_VERSION >> 16)
static const QString QXMPP_VERSION_STRING = QString::fromStdString(QXMPP_VERSION_MAJOR + "." + QXMPP_VERSION_MINOR + "." + QXMPP_VERSION_PATCH); static const QString QXMPP_VERSION_STRING = QString::fromStdString(QXMPP_VERSION_MAJOR + "." + QXMPP_VERSION_MINOR + "." + QXMPP_VERSION_PATCH);
About::About(QWidget* parent): About::About(QWidget* parent):
QWidget(parent), QDialog(parent),
m_ui(new Ui::About), m_ui(new Ui::About),
license(nullptr) license(nullptr)
{ {
@ -37,7 +37,11 @@ About::About(QWidget* parent):
m_ui->qxmppVersionValue->setText(QXmppVersion()); m_ui->qxmppVersionValue->setText(QXmppVersion());
m_ui->qxmppBuiltAgainstVersion->setText(tr("(built against %1)").arg(QXMPP_VERSION_STRING)); m_ui->qxmppBuiltAgainstVersion->setText(tr("(built against %1)").arg(QXMPP_VERSION_STRING));
setWindowFlag(Qt::Tool); setWindowFlag(Qt::WindowStaysOnTopHint);
move(
parent->window()->frameGeometry().topLeft() +
parent->window()->rect().center() - rect().center()
);
connect(m_ui->licenceLink, &QLabel::linkActivated, this, &About::onLicenseActivated); connect(m_ui->licenceLink, &QLabel::linkActivated, this, &About::onLicenseActivated);
} }

View File

@ -17,7 +17,7 @@
#ifndef ABOUT_H #ifndef ABOUT_H
#define ABOUT_H #define ABOUT_H
#include <QWidget> #include <QDialog>
#include <QScopedPointer> #include <QScopedPointer>
#include <QApplication> #include <QApplication>
#include <QFile> #include <QFile>
@ -32,7 +32,7 @@ class About;
/** /**
* @todo write docs * @todo write docs
*/ */
class About : public QWidget class About : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public: