diff options
author | Simon Rettberg | 2018-01-19 12:05:16 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-01-19 12:05:16 +0100 |
commit | d93a1abd2806bdab8f8d11d96b641989e333d7d4 (patch) | |
tree | b0774802d596f35877ed12d132db34041eb024e6 /src/mainwindow.cpp | |
parent | Fix image scaling by using proper existing methods instead of broken copy & p... (diff) | |
download | slxgreeter-d93a1abd2806bdab8f8d11d96b641989e333d7d4.tar.gz slxgreeter-d93a1abd2806bdab8f8d11d96b641989e333d7d4.tar.xz slxgreeter-d93a1abd2806bdab8f8d11d96b641989e333d7d4.zip |
Temporarily show sleep icon when receiving USR1
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d58b7f6..0e6a5e7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -18,6 +18,9 @@ #include <QSvgRenderer> #include <QAbstractTextDocumentLayout> +#include <sys/types.h> +#include <sys/socket.h> + #include "mainwindow.h" #include "loginform.h" #include "settings.h" @@ -29,6 +32,7 @@ MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidge QWidget(parent), m_ScreenRect(screenRect), m_Primary(primary), + m_LoginForm(NULL), m_messages(nullptr) { setObjectName(QString("MainWindow_%1").arg(screen)); @@ -254,4 +258,24 @@ void MainWindow::setBackground() this->setPalette(palette); } - +void MainWindow::showStandby() +{ + if (m_LoginForm != NULL) { + m_LoginForm->hide(); + } + QSvgWidget *img = new QSvgWidget(":/resources/gnome-face-tired.svg", this); + if (img->renderer()->isValid()) { + QSize sh = img->sizeHint().scaled(this->width() / 2, this->height() / 2, Qt::KeepAspectRatio); + img->setGeometry((this->width() - sh.width()) / 2, (this->height() - sh.height()) / 2, sh.width(), sh.height()); + img->show(); + } else { + qWarning() << "Shice!"; + } + QTimer::singleShot(8000, [this, img]() { + img->hide(); + img->deleteLater(); + if (this->m_LoginForm != NULL) { + m_LoginForm->show(); + } + }); +} |