yacreader/YACReaderLibrary/no_libraries_widget.cpp

58 lines
1.8 KiB
C++

#include "no_libraries_widget.h"
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
NoLibrariesWidget::NoLibrariesWidget(QWidget *parent) :
QWidget(parent)
{
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
setStyleSheet("{color:FFFFFF;}");
QPixmap icon(":/images/noLibrariesIcon.png");
QLabel * iconLabel = new QLabel();
iconLabel->setPixmap(icon);
QPixmap line(":/images/noLibrariesLine.png");
QLabel * lineLabel = new QLabel();
lineLabel->setPixmap(line);
QLabel * text = new QLabel(tr("<font color=\"#565959\">You don't have any library yet</font>"));
text->setStyleSheet("QLabel {font-size:25px;font-weight:bold;}");
QPushButton * createButton = new QPushButton(tr("create your first library"));
createButton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
QPushButton * addButton = new QPushButton(tr("add an existing one"));
addButton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
QVBoxLayout * layout = new QVBoxLayout(this);
QHBoxLayout * buttonLayout = new QHBoxLayout();
layout->setAlignment(Qt::AlignHCenter);
buttonLayout->addSpacing(100);
buttonLayout->addWidget(createButton);
layout->addSpacing(25);
buttonLayout->addWidget(addButton);
buttonLayout->addSpacing(100);
layout->addStretch();
layout->addWidget(iconLabel,0,Qt::AlignHCenter);
layout->addSpacing(10);
layout->addWidget(text,0,Qt::AlignHCenter);
layout->addSpacing(8);
layout->addWidget(lineLabel,0,Qt::AlignHCenter);
layout->addSpacing(12);
layout->addLayout(buttonLayout,0);
layout->addSpacing(150);
layout->addStretch();
connect(createButton,SIGNAL(clicked()),this,SIGNAL(createNewLibrary()));
connect(addButton,SIGNAL(clicked()),this,SIGNAL(addExistingLibrary()));
}