Skip to content
Snippets Groups Projects
Commit aec6fa40 authored by jpbl's avatar jpbl
Browse files

we LCD is now working properly now

parent cc4fc70e
No related branches found
No related tags found
No related merge requests found
Showing
with 86 additions and 27 deletions
......@@ -29,6 +29,7 @@ taxidermy::QWidgetBuilder::QWidgetBuilder()
: WidgetBuilder("QWidget")
, mWidget(NULL)
, mPosSet(false)
, mSizeSet(false)
{}
void
......@@ -42,9 +43,22 @@ taxidermy::QWidgetBuilder::load(const QMap< QString, QString > &values)
mY = (*ypos).toInt();
}
QMap< QString, QString >::ConstIterator background = values.find("background");
if(background != values.end()) {
mBackground = qtutils::transparize(*background);
QMap< QString, QString >::ConstIterator height = values.find("height");
QMap< QString, QString >::ConstIterator width = values.find("width");
if(height != values.end() && width != values.end()) {
mSizeSet = true;
mHeight = (*height).toInt();
mWidth = (*width).toInt();
}
QMap< QString, QString >::ConstIterator bimage = values.find("bImage");
if(bimage != values.end()) {
mBackgroundImage = qtutils::transparize(*bimage);
}
QMap< QString, QString >::ConstIterator bcolor = values.find("bColor");
if(bcolor != values.end()) {
mBackgroundColor = QColor(*bcolor);
}
}
......@@ -64,12 +78,21 @@ taxidermy::QWidgetBuilder::update(QWidget *widget)
mWidget->move(mX, mY);
}
if(!mBackground.isNull()) {
mWidget->setPaletteBackgroundPixmap(mBackground);
if(mBackground.hasAlpha()) {
mWidget->setMask(*mBackground.mask());
if(!mBackgroundImage.isNull()) {
mWidget->setPaletteBackgroundPixmap(mBackgroundImage);
if(mBackgroundImage.hasAlpha()) {
mWidget->setMask(*mBackgroundImage.mask());
}
mWidget->resize(mBackground.size());
mWidget->resize(mBackgroundImage.size());
}
else if(mBackgroundColor.isValid()) {
mWidget->setPaletteBackgroundColor(mBackgroundColor);
}
//If the user took the energy to specify the size,
//Then we must use this size.
if(mSizeSet) {
mWidget->resize(mWidth, mHeight);
}
}
}
......
......@@ -21,6 +21,7 @@
#ifndef __TAXIDERMY_QWIDGET_BUILDER_HPP__
#define __TAXIDERMY_QWIDGET_BUILDER_HPP__
#include <qcolor.h>
#include <qpixmap.h>
#include <qwidget.h>
......@@ -40,8 +41,14 @@ namespace taxidermy
int mX;
int mY;
//Size
bool mSizeSet;
int mWidth;
int mHeight;
//Images
QPixmap mBackground;
QPixmap mBackgroundImage;
QColor mBackgroundColor;
public:
QWidgetBuilder();
......
......@@ -33,7 +33,7 @@ taxidermy::qtutils::addFilePath(const QString &path)
}
QPixmap
taxidermy::qtutils::transparize(const QString &image)
taxidermy::qtutils::transparize(const QString &image, bool hard)
{
#ifdef QT3_SUPPORT
QPixmap p(retreive(image));
......@@ -55,7 +55,7 @@ taxidermy::qtutils::transparize(const QString &image)
if (img.hasAlphaBuffer()) {
bm = img.createAlphaMask();
}
else {
else if(hard) {
bm = img.createHeuristicMask();
}
p.setMask(bm);
......
......@@ -24,7 +24,7 @@ namespace taxidermy
{
namespace qtutils
{
QPixmap transparize(const QString &image);
QPixmap transparize(const QString &image, bool hard = false);
void addFilePath(const QString &path);
};
......
......@@ -168,6 +168,22 @@ pressed=redial_on.png
released=redial_off.png
paint=1
[main]
type=QWidget
bImage=main.png
[screen]
type=QWidget
x=22
y=44
bImage=screen_green.png
bColor=gray
[overscreen]
type=QWidget
bImage=overscreen.png
# DTMF Keypad
#dtmf_1=12,22
#dtmf_2=58,22
......
skins/gmetal/main.png

32.7 KiB

File moved
images/screen_green.png

361 B | W: | H:

skins/gmetal/screen_green.png

343 B | W: | H:

images/screen_green.png
skins/gmetal/screen_green.png
images/screen_green.png
skins/gmetal/screen_green.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -170,8 +170,19 @@ paint=1
[main]
type=QWidget
background=main.png
bImage=main.png
[screen]
type=QWidget
x=22
y=44
width=184
height=98
bImage=screen_main.png
[overscreen]
type=QWidget
bImage=overscreen.png
# DTMF Keypad
#dtmf_1=12,22
......
skins/metal/l1_off.png

1.02 KiB

skins/metal/l2_off.png

1.08 KiB

skins/metal/l3_off.png

1.12 KiB

skins/metal/l4_off.png

1.08 KiB

skins/metal/l5_off.png

1.09 KiB

skins/metal/l6_off.png

1.13 KiB

skins/metal/overscreen.png

1.31 KiB

File moved
......@@ -42,9 +42,8 @@
#define OVERSCREEN "overscreen.png"
SFLLcd::SFLLcd(QWidget *parent)
: QLabel(parent, "SFLLcd", Qt::WNoAutoErase)
, mScreen(TransparentWidget::retreive(SCREEN))
, mOverscreen(TransparentWidget::retreive(OVERSCREEN))
: QLabel(parent, "screen", Qt::WNoAutoErase)
, mOverscreen(parent, "overscreen")
, mGlobalStatusPos(-1)
, mUnselectedLineStatusPos(-1)
, mLineStatusPos(-1)
......@@ -53,9 +52,9 @@ SFLLcd::SFLLcd(QWidget *parent)
, mIsTimed(false)
, mFont(FONT_FAMILY, FONT_SIZE)
{
resize(mScreen.size());
move(22,44);
setPaletteBackgroundColor(QColor("gray"));
mOverscreen.setPaletteBackgroundColor(QColor("gray"));
//mOverscreen.hide();
mUnselectedLineTimer = new QTimer(this);
QObject::connect(mUnselectedLineTimer, SIGNAL(timeout()),
this, SLOT(updateGlobalText()));
......@@ -195,7 +194,7 @@ void
SFLLcd::paintEvent(QPaintEvent *event)
{
static QPixmap pixmap(size());
pixmap.resize(size());
QRect rect = event->rect();
QSize newSize = rect.size().expandedTo(pixmap.size());
pixmap.resize(newSize);
......@@ -218,7 +217,8 @@ SFLLcd::paintEvent(QPaintEvent *event)
int margin = 2;
p.setFont(mFont);
p.drawPixmap(0,0, mScreen);
QPoint pointtest(margin, fm.height());
p.drawText(QPoint(margin, fm.height()),
extractVisibleText(globalStatus, *globalStatusPos));
p.drawText(QPoint(margin, 2*fm.height()),
......@@ -228,11 +228,14 @@ SFLLcd::paintEvent(QPaintEvent *event)
p.drawText(QPoint(margin, 4*fm.height()),
extractVisibleText(mBufferStatus, mBufferStatusPos));
p.drawText(QPoint(margin, mScreen.size().height() - margin), getTimeStatus());
p.drawPixmap(0,0, mOverscreen);
p.drawText(QPoint(margin, pixmap.size().height() - margin), getTimeStatus());
const QPixmap *pix = mOverscreen.paletteBackgroundPixmap();
if(pix != NULL && !pix->isNull()) {
p.drawPixmap(0,0, *pix);
}
p.end();
bitBlt(this, event->rect().topLeft(), &pixmap);
bitBlt(this, QPoint(0,0), &pixmap);
}
bool
......@@ -240,7 +243,7 @@ SFLLcd::textIsTooBig(const QString &text)
{
QFontMetrics fm(mFont);
int screenWidth = mScreen.width() - 4;
int screenWidth = width() - 4;
int textWidth = fm.boundingRect(text).width();
if(textWidth > screenWidth) {
......
......@@ -63,8 +63,7 @@ private:
void dragEnterEvent(QDragEnterEvent* event);
void dropEvent(QDropEvent* event);
QPixmap mScreen;
QPixmap mOverscreen;
QLabel mOverscreen;
QString mGlobalStatus;
QString mUnselectedLineStatus;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment