#include "mainwindow.h"

#include <QAction>
#include <QBoxLayout>
#include <DTitlebar>
#include <QMessageBox>
#include <QApplication>
#include "view/userinfoinputview.h"

#include <QDebug>

MainWindow::MainWindow(QWidget *parent)
    : BMWindowBaseClass(parent)
{
    titlebar()->setBackgroundTransparent(true);
    titlebar()->setTitle("");
    titlebar()->setIcon(QIcon(":/image/logo_24.svg"));

//    auto menu = new QMenu;
//    auto action = new QAction(tr("Show QRCode"), menu);
//    menu->addAction(action);
//    titlebar()->setMenu(menu);

    setFixedSize(420, 570);
    auto userInfoView = new UserInfoInputView();

#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
    setCentralWidget(userInfoView);
#else
    setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
    titlebar()->setDisableFlags(Qt::WindowMaximizeButtonHint);
    auto mainLayout = new QVBoxLayout;
    mainLayout->addWidget(userInfoView);
    setContentLayout(mainLayout);
#endif


//    connect(action, &QAction::triggered,
//            userInfoView, &UserInfoInputView::showQRCode);
}

MainWindow::~MainWindow()
{

}

void MainWindow::showInstallFailed()
{
}
