
#include <QtGui>


#include "menu.h"


//! [0] //! [1]
menu::menu(QWidget *parent)

{

    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
	
	

	QVBoxLayout *mainLayout = new QVBoxLayout;
    											   			 
	QLabel *lab1 = new QLabel("<font color='blue'><b>Přidat uživatele</b></font><br>Prostřednictvím průvodce,<br>který Vás provede procesem.");
	QLabel *lab2 = new QLabel("<font color='blue'><b>Editovat uživatele</b></font><br>Můžete měnit údaje a mazat<br>či aktualizovat otisky.");
	QLabel *lab3 = new QLabel("<font color='blue'><b>Editovat skupinu</b></font><br>Nastavte práva skupinám<br>uživatelů systému.");

/*	Title->setStyleSheet("* { font-weight: bold; margin: 10px; background-image: url(/sdcard/AddUser.png); background-repeat: none; background-position: left; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,stop:0 rgb(208,229,244), stop:1 rgba(234,234,234)); background-clip: margin; background-origin: margin; }");
*/
	QGroupBox *groupBox1 = new QGroupBox();
	QGroupBox *groupBox2 = new QGroupBox();
	QGroupBox *groupBox3 = new QGroupBox();

	AddButton = new QPushButton(NULL, this);  
	AddButton->setIcon(QPixmap("/sdcard/AddUser48.png"));
	AddButton->setIconSize(QSize(48,48));
	AddButton->setFixedSize(55,55);
	EditButton = new QPushButton(NULL, this); 
	EditButton->setIcon(QPixmap("/sdcard/EditUser48.png"));
	EditButton->setIconSize(QSize(48,48));
	EditButton->setFixedSize(55,55); 
	EditButton->setContentsMargins(1,1,1,1);
	GroupButton = new QPushButton(NULL, this);
	GroupButton->setIcon(QPixmap("/sdcard/EditGroup48.png"));
	GroupButton->setIconSize(QSize(48,48));  
	GroupButton->setFixedSize(55,55);


	QHBoxLayout *vbox1 = new QHBoxLayout;
	QHBoxLayout *vbox2 = new QHBoxLayout;
	QHBoxLayout *vbox3 = new QHBoxLayout;

	
	vbox1->insertWidget(1,AddButton);
	vbox1->insertWidget(0,lab1);
	vbox1->setContentsMargins(2,2,2,2);
	groupBox1->setLayout(vbox1);
	mainLayout->addWidget(groupBox1);
	

	
	vbox2->insertWidget(1,EditButton);
	vbox2->insertWidget(0,lab2);
	groupBox2->setLayout(vbox2);
	vbox2->setContentsMargins(2,2,2,2);
	mainLayout->addWidget(groupBox2);

	
	vbox3->insertWidget(1,GroupButton);
	vbox3->insertWidget(0,lab3);
	groupBox3->setLayout(vbox3);
	vbox3->setContentsMargins(2,2,2,2);
	mainLayout->addWidget(groupBox3);

	connect(AddButton, SIGNAL(clicked()), this, SLOT(pressed1()));
	connect(EditButton, SIGNAL(clicked()), this, SLOT(pressed2()));
	connect(GroupButton, SIGNAL(clicked()), this, SLOT(pressed3()));

	setLayout(mainLayout);

}

void menu::pressed1(void){

this->done(1);

}
void menu::pressed2(void){

this->done(2);

}
void menu::pressed3(void){

this->done(3);

}

void menu::SetPermissions(char UserPerm){

if(UserPerm==PRights::SuperAdmin)
GroupButton->setEnabled(true);	
else
GroupButton->setEnabled(false);	

}
