summaryrefslogblamecommitdiffstats
path: root/src/mainwindow.h
blob: 53fd15006d7f59e43145823e12630b8b74aec2d5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                             

                 
                
                 
                






                      
                
                 
 
               
 




                                 
                                                                                                


                                          
                         
 

                                                       

                                                         
 
                                                               
 
                                                     
 
                                                      
 

                       
                    
 
        
 
                                
 
                                                                        
 
                                         
 
                           
 
                            
 
                       

                                                              
                    
                       
                           
                        
                          
                    
                      


                                
                         


                      
/*
* Copyright (c) 2012-2015 Christian Surlykke, Petr Vanek
*
* This file is part of qt-lightdm-greeter 
* It is distributed under the LGPL 2.1 or later license.
* Please refer to the LICENSE file for a copy of the license.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>

#include <QImage>
#include <QRect>
#include <QSize>
#include <QLabel>
#include <QList>

#include "loginform.h"

namespace Ui {
    class MainWindow;
}

class QTextEdit;
class QSvgWidget;

class GameCore;

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    explicit MainWindow(bool primary, int screen, const QRect &rect, QWidget *parent = nullptr);

    void setFocus(Qt::FocusReason reason);

    bool showLoginForm();

    const QImage& background() { return m_background; }

protected:
    virtual void paintEvent(QPaintEvent *event) override;

    virtual void mouseDoubleClickEvent(QMouseEvent *) override;

    virtual void keyPressEvent(QKeyEvent *) override;

    virtual void resizeEvent(QResizeEvent *) override;

public slots:
    void updateClock();
    void reLayout();

private:

    QSize createLogo(QRect max);

    void createNextLogo(QRect &max, QSize &retval, const QString &path);

    QSize createDistro(const QRect &max);

    bool createLogWindow();

    void createNewsWindow();

    void createClock();
    int getOffset(QString offset, int maxVal, int defaultVal);
    void setBackground();
    int drawClock();
    QRect m_ScreenRect;
    LoginForm* m_LoginForm;
    QImage m_background;
    QTextEdit *m_messages;
    QLabel *m_Clock;
    GameCore *m_Snake;
    QSvgWidget *m_Banner;
    QList<QWidget*> m_DecoItems;
    QTextEdit *m_News;
    QRect m_lastRelayout;
};

#endif // MAINWINDOW_H