changes in arhitecture, some improvments, much optimising and simplify,

many bagfixes and new graphics engine
This commit is contained in:
blizer
2011-08-20 07:34:19 +04:00
committed by unknown
parent 0a9679fd99
commit f3d0ca7101
33 changed files with 1444 additions and 897 deletions

67
touchbuttframe.cpp Normal file
View File

@@ -0,0 +1,67 @@
#include "touchbuttframe.h"
TouchButtFrame::TouchButtFrame(QWidget *parent, QColor cr, QColor cg, QColor cw, QColor cp, Orientation orientation) :
QFrame(parent)
{
colr = cr; colg = cg; colw = cw; colp = cp;
setFrameShape(QFrame::StyledPanel);;
if (orientation == Horizontal) lay = new QHBoxLayout();
else lay = new QVBoxLayout();
count = 0;
}
void TouchButtFrame::addButton(QString caption)
{
touch_butt * butt = new touch_butt(count,caption,colr,colg,colw,colp);
butt->setMinimumHeight(50);
butt->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
butt->setCheckable(true);
butt->setAutoExclusive(true);
butt->setAutoFillBackground(true);
if (lay->isEmpty()) butt->setChecked(true);
connect(butt,SIGNAL(touch_click(int)),SLOT(butt_click(int)));
connect(butt,SIGNAL(touch_toggle(int,bool)),SLOT(butt_toggle(int,bool)));
lay->addWidget(butt);
this->setLayout(lay);
count++;
}
void TouchButtFrame::butt_click(int index)
{
//qDebug() << "button" << index << "clicked!";
//if (((touch_butt*)lay->itemAt(index)->widget())->isChecked())
//((touch_butt*)lay->itemAt(index)->widget())->setGreen();
emit click(index);
}
void TouchButtFrame::butt_toggle(int index,bool checked)
{
//if (((touch_butt*)lay->itemAt(index)->widget())->isChecked())
//qDebug() << "button" << index << "toggled" << checked;
emit toggle(index,checked);
}
void TouchButtFrame::resetColors()
{
for (int i=0; i<buttCount(); ++i)
{
Button(i)->setColor(colr,colg,colw,colp);
}
}
int TouchButtFrame::buttCount()
{
return count;
}
touch_butt * TouchButtFrame::Button(int index)
{
return ((touch_butt*)lay->itemAt(index)->widget());
}