#include "framelesswindow.h"
#include "titlebar.h"
#include "mainwindow.h"

FramelessWindow::FramelessWindow(QWidget *parent, Qt::WindowFlags flags)
    :QMainWindow(parent, flags)
{
    initUI();
    connects();
}

FramelessWindow::~FramelessWindow()
{

}

void FramelessWindow::initUI()
{
    initFrameless();

    mMainWindow = new MainWindow;

    this->setCentralWidget(mMainWindow);
    this->setWindowTitle("客户端 v1.0.1");
    this->setWindowIcon(QIcon(":/images/logo_256.png"));
    this->showMaximized();
}

void FramelessWindow::initFrameless()
{
    mTitleBar = new TitleBar(this);
    mTitleBar->updateWidgetFlags();
}



void FramelessWindow::connects()
{
    connect(mTitleBar->menuButton, &QPushButton::clicked, mMainWindow, &MainWindow::setMenuVisiable);
    connect(mMainWindow, &MainWindow::signalQuit, this, [=](){
        this->close();
    });
}

