MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    QWidget *centralWidget = new QWidget;
    centralWidget->setLayout(new QVBoxLayout);
    centralWidget->layout()->setMargin(0);
    centralWidget->layout()->setSpacing(0);
    setCentralWidget(centralWidget);

    ActionBar *tabBar = new ActionBar(QIcon(":/icons/logo"));
    centralWidget->layout()->addWidget(tabBar);

    QAction *proj = new QAction(QIcon(":/icons/project"), "project", this);
    connect(proj, SIGNAL(triggered()), this, SLOT(toProjMgPage()));
    tabBar->addButton(proj, 2, true);

    QAction *mem = new QAction(QIcon(":/icons/member"), "member", this);
    connect(mem, SIGNAL(triggered()), this, SLOT(toMemMgPage()));
    tabBar->addButton(mem, 3, true);

    QMdiArea *mdiArea = new QMdiArea;
    centralWidget->layout()->addWidget(mdiArea);

    mem_mg = new MemMgWindow(mdiArea);
    mem_mg->setAttribute(Qt::WA_DeleteOnClose);
    mem_mg->setWindowFlags (Qt::SubWindow | Qt::FramelessWindowHint);
    mem_mg->hide();
    connect(mem_mg, SIGNAL(turnToContentWindow(int)), this, SLOT(toMemContentPage(int)));

    mem_content = new MemContentWindow(mdiArea);
    mem_content->setAttribute(Qt::WA_DeleteOnClose);
    mem_content->setWindowFlags (Qt::SubWindow | Qt::FramelessWindowHint);
    mem_content->hide();
    connect(mem_content, SIGNAL(turnToInfoWindow(int ,QSqlQuery&)), this, SLOT(toMemInfoPage(int ,QSqlQuery&)));
    connect(mem_content, SIGNAL(back()), this, SLOT(toMemMgPage()));

    mem_info = new MemInfoWindow(mdiArea);
    mem_info->setAttribute(Qt::WA_DeleteOnClose);
    mem_info->setWindowFlags (Qt::SubWindow | Qt::FramelessWindowHint);
    mem_info->hide();
    connect(mem_info, SIGNAL(back(int)), this, SLOT(toMemContentPage(int)));

    proj_mg = new ProjMgWindow(mdiArea);
    proj_mg->setAttribute(Qt::WA_DeleteOnClose);
    proj_mg->setWindowFlags (Qt::SubWindow | Qt::FramelessWindowHint);
    proj_mg->hide();

    toProjMgPage();
}
AboutDialog::AboutDialog(QWidget *parent, BitScreen* screen) :
    QDialog(parent),
    ui(new Ui::AboutDialog)
{
    const std::string urlMain("http://www.artboomerang.win");
    const std::string urlExplorer("http://www.artboomerang.win");
    ui->setupUi(this);
    this->setWindowTitle("About ArtBoomerang");
    ui->scrollAreaAboutDlg->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
    QScroller::grabGesture(ui->scrollAreaAboutDlg->viewport(), QScroller::TouchGesture);
    QScroller::grabGesture(this->ui->scrollAreaAboutDlg->viewport(), QScroller::LeftMouseButtonGesture);
    ui->scrollAreaAboutDlg->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

#ifdef USE_FULLSCREEN
        ui->pushButton->setIconSize(screen->iconSize());
        ActionBar *actionBar =new ActionBar(this);
        QAction *closeAction = new QAction(QIcon(":/android_icons/action_close"), tr("&Close"), this);
        connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
        actionBar->addButton(closeAction);
        ui->actionBarLayout->addWidget(actionBar);
        actionBar->setTitle(windowTitle(), false);
        setWindowState(this->windowState() ^ Qt::WindowMaximized);
#endif
    //transparent window with bg-image
    //setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
    //setParent(0); // Create TopLevel-Widget
    //setAttribute(Qt::WA_NoSystemBackground, true);
    //setAttribute(Qt::WA_TranslucentBackground, true);
    //setAttribute(Qt::WA_PaintOnScreen);
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(close()));
    //std::replace( s.begin(), s.end(), 'x', 'y');
    QString cpTxt = ui->copyrightLabel->text();
    cpTxt.replace(QString("[urlMain]"), QString::fromStdString(urlMain))
            .replace(QString("[urlExplorer]"), QString::fromStdString(urlExplorer));
    ui->copyrightLabel->setText(cpTxt);
}