Join Today
Page 2 of 6 FirstFirst 123456 LastLast
Results 11 to 20 of 58
Like Tree2Likes

Thread: The way to E6/A1200 Native EZX Application

  1. #11

    Default

    hey Donga... GREAT JOB... cant thank you enough...

  2. #12

    Default

    samr7 's SDK does not have all header. some class that need specific API such as Calling, SMS, Bluetooth, etc. I know this is hard to be done on it. It take long time to test all function in 1 library to create 1 header file.
    Visit my Blog here.http://my.opera.com/eakrin

  3. #13
    Join Date
    Jul 2007
    Location
    Samut Prakarn, Thailand
    Posts
    79

    Default

    Yes, it also take lots of time to generate the new header for get function, try, test and modified.
    But if we were joined together, i think it would be done. (but when ?... lol)

    @qelib fixed loss class updated : 2007/09/24.

  4. #14
    Join Date
    Jul 2007
    Location
    Samut Prakarn, Thailand
    Posts
    79

    Default [Inheritance]

    Inheritance and using the custom wrapper widget 1
    using: previous QEAppTemplate and @qelib fixed loss class updated : 2007/09/24.

    Note:
    Before decide to create new class, please test creating the original of the EZX widget or the Qt-Embedded widget first for see it can work normally or not.
    If it can work but not complete itself (example can show widget but not show text etc. in this case, i see the QListBoxItem and UTIL_Listbox have not run in normal operation, so i'd created the qelistbox class instead)
    lets wrapped it for complete.

    Example of QEWidget inheritance
    After we have the qewidget class on the last section i'd explain,
    So, in this section will show you how to create custom wrapper widget for example.

    I will create the QEXWidget class which inherited from the QEWidget to be the base of other paint widget which used in the qeiLock

    Capability of the class:
    - grab and cut a part of the background of parent widget
    - custom paint with the image layer (not real layer but it act as)

    difficult to explain , lets see the code instead

    qexwidget.h
    Code:
    /***************************************************************************
     *                                                                         *
     *   (c) 2007, Thanomsub Noppaburana <donga.nb@gmail.com>                  *
     *                                                                         *
     *   This program is free software; you can redistribute it and/or modify  *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     *   This program is distributed in the hope that it will be useful,       *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
     *   GNU General Public License for more details.                          *
     *                                                                         *
     *   You should have received a copy of the GNU General Public License     *
     *   along with this program; if not, write to the                         *
     *   Free Software Foundation, Inc.,                                       *
     *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
     ***************************************************************************/
    
    #ifndef __QEXWIDGET_H__
    #define __QEXWIDGET_H__
    
    #include "qewidget.h"
    
    /**
     *****************************************************************************
      class QEXWidget definition
     *****************************************************************************
     */
    class QEXWidget : public QEWidget
    {
        Q_OBJECT
    public:
        QEXWidget(QWidget *parent, const char *name = 0);
        QEXWidget(const char *name = 0);
        virtual ~QEXWidget();
    
        int sx() const { return m_sx; };
        int sy() const { return m_sy; };
        virtual void setGeometry(int x, int y, int w, int h);
        virtual void resize(int w, int h);
        virtual void move(int x, int y);
        virtual void movePaintLayer(int x, int y, bool fixBackground=FALSE);
        virtual void setRequireParentBackground(bool require);
        virtual void setDrawingBGStyle(const DrawingStyle &ds = DS_Normal);
        DrawingStyle drawingStyle() const { return m_drawingStyle; };
    
        virtual void setBackgroundImage(const QImage &img, bool createMask = FALSE);
        QImage backgroundImage() const { return m_bckImage; };
        virtual void setNoBackgroundMode(bool OnOff = FALSE);
    
    protected:
        virtual void takeParentBackground();
    
        /* event handling */
        virtual bool paintEvent(QPaintEvent *);
    
    protected:
        bool         m_isRequireParentBG;
        bool         m_isTakenParentBG;
        QImage       m_parentBckImage;
        QPixmap      m_pixBuffer;
        QImage       m_bckImage;
        DrawingStyle m_drawingStyle;
        int          m_sx, m_sy;
        QWidget::BackgroundMode  origBackMode;
    };
    
    
    #endif //__QEXWIDGET_H__
    qexwidget.cpp
    Code:
    /***************************************************************************
     *                                                                         *
     *   (c) 2007, Thanomsub Noppaburana <donga.nb@gmail.com>                  *
     *                                                                         *
     *   This program is free software; you can redistribute it and/or modify  *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     *   This program is distributed in the hope that it will be useful,       *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
     *   GNU General Public License for more details.                          *
     *                                                                         *
     *   You should have received a copy of the GNU General Public License     *
     *   along with this program; if not, write to the                         *
     *   Free Software Foundation, Inc.,                                       *
     *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
     ***************************************************************************/
    
    #include <qpainter.h>
    
    #include "qexwidget.h"
    
    /**
     *****************************************************************************
      class QEXWidget implementation
     *****************************************************************************
     */
    QEXWidget::QEXWidget(QWidget *parent, const char *name)
      : QEWidget(parent, name),
        m_isRequireParentBG(FALSE), m_isTakenParentBG(FALSE),
        m_pixBuffer(0), m_bckImage(0),
        m_drawingStyle(DS_Normal),
        m_sx(0), m_sy(0)
    {
        origBackMode = m_Widget->backgroundMode();
    }
    
    QEXWidget::QEXWidget(const char *name)
      : QEWidget(name),
        m_isRequireParentBG(FALSE), m_isTakenParentBG(FALSE),
        m_pixBuffer(0), m_bckImage(0),
        m_drawingStyle(DS_Normal),
        m_sx(0), m_sy(0)
    {
        origBackMode = m_Widget->backgroundMode();
    }
    
    QEXWidget::~QEXWidget()
    {
    }
    
    void QEXWidget::setGeometry(int x, int y, int w, int h)
    {
        QEWidget::setGeometry(x, y, w, h);
        m_pixBuffer.resize(w, h);
        m_sx = x;
        m_sy = y;
    }
    
    void QEXWidget::move(int x, int y)
    {
        QEWidget::move(x, y);
        m_sx = x;
        m_sy = y;
    }
    
    void QEXWidget::resize(int w, int h)
    {
        QEObject::resize(w, h);
        m_pixBuffer.resize(w, h);
    }
    
    void QEXWidget::movePaintLayer(int x, int y, bool fixBackground)
    {
        if (!fixBackground) { move(x, y); return; }
        m_sx = x;
        m_sy = y;
        widget()->repaint();
    }
    
    void QEXWidget::setRequireParentBackground(bool require)
    {
        m_isTakenParentBG = FALSE;
        if (require) {
            m_isRequireParentBG = TRUE;
        }
        else {
            m_isRequireParentBG = FALSE;
            m_parentBckImage.reset();
        }
    }
    
    void QEXWidget::setNoBackgroundMode(bool OnOff)
    {
        setBackgroundMode(OnOff ? QWidget::NoBackground : origBackMode);
    }
    
    void QEXWidget::setBackgroundImage(const QImage &img, bool createMask)
    {
        m_bckImage = img;
        if (!createMask) return;
        QPixmap maskPix;
        maskPix.convertFromImage(img);
        if (m_Widget) m_Widget->setMask(QRegion(*maskPix.mask()));
    }
    
    void QEXWidget::setDrawingBGStyle(const DrawingStyle &ds)
    {
        if (m_drawingStyle == ds) return;
        m_drawingStyle = ds;
    }
    
    void QEXWidget::takeParentBackground()
    {
        if (m_Widget && m_Widget->parentWidget()) {
            QImage imgTemp;
            imgTemp = *m_Widget->parentWidget()->backgroundPixmap();
            m_parentBckImage = imgTemp.copy(x(), y(), width(), height());
        }
        m_isTakenParentBG = TRUE;
    }
    
    bool QEXWidget::paintEvent(QPaintEvent *)
    {
        int dx = m_sx - x();
        int dy = m_sy - y();
        if (m_isRequireParentBG && !m_isTakenParentBG) takeParentBackground();
        QPainter pBuf(&m_pixBuffer);
        if (m_isTakenParentBG) pBuf.drawImage(0, 0, m_parentBckImage);
        pBuf.drawImage(dx, dy, m_bckImage);
        pBuf.end();
        bitBlt(widget(), 0, 0, &m_pixBuffer );
        return TRUE;
    }
    Look at the paintEvent(), i used the image buffer on painting and put it to the widget by bitBlt function, known as the double buffer technic for made the smooth painting.
    The movePaintLayer(int x, int y, bool fixBackground) i used for "FAKE" moving widget (you can see the result of this function when you unlock qeiLock - last build binary).
    Last edited by donga; 09-24-2007 at 04:00 PM.

  5. #15
    Join Date
    Jul 2007
    Location
    Samut Prakarn, Thailand
    Posts
    79

    Wink

    Inheritance and using the custom wrapper widget 2
    using: previous QEAppTemplate and @qelib fixed loss class updated : 2007/09/24.

    After we have the qexwidget class already, Now try to create other.
    In this example, i'll show the QELabel and the QELabelButton which i used istead of the QLabel widget and QPushButton since it can not work on my phone (or can run but not stable).

    The QELabel is inherited from the QEXWidget, and the QELabelButton is inherited from QELabel.

    You can see this 2 widget in the main page of the Setting Options program for qeiLock.

    again, difficult to explain... the code should explain itself better than me

    QELabel class - qelabel.h
    Code:
    /***************************************************************************
     *                                                                         *
     *   (c) 2007, Thanomsub Noppaburana <donga.nb@gmail.com>                  *
     *                                                                         *
     *   This program is free software; you can redistribute it and/or modify  *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     *   This program is distributed in the hope that it will be useful,       *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
     *   GNU General Public License for more details.                          *
     *                                                                         *
     *   You should have received a copy of the GNU General Public License     *
     *   along with this program; if not, write to the                         *
     *   Free Software Foundation, Inc.,                                       *
     *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
     ***************************************************************************/
    
    #ifndef __QE_LABEL_H__
    #define __QE_LABEL_H__
    
    #include <qpainter.h>
    
    #include "qeobject.h"
    #include "qexwidget.h"
    
    /**
     *****************************************************************************
      class QELabel definition
     *****************************************************************************
     */
    class QELabel : public QEXWidget
    {
        Q_OBJECT
    public:
        QELabel(const QString &, QWidget *parent, const char *name = 0);
        virtual ~QELabel();
    
        virtual void setText(const QString &);
        virtual QString getText() const { return m_text; };
        virtual void setBoldFont(bool bold);
        virtual void setDrawingBGStyle(const DrawingStyle &ds = DS_Normal, bool boldFont = FALSE);
    
    protected:
        /* event handling */
        virtual bool paintEvent(QPaintEvent *);
    
    protected:
        QFont        *m_drawingFont;
        QFontMetrics *m_fontMetrics;
        QString       m_text;
        int           m_margin;
        int           m_fontPointSize;
        int           m_fontHeight;
        bool          isBoldFont;
    };
    
    #endif //__QE_LABEL_H__
    QELabel class - qelabel.cpp
    Code:
    /***************************************************************************
     *                                                                         *
     *   (c) 2007, Thanomsub Noppaburana <donga.nb@gmail.com>                  *
     *                                                                         *
     *   This program is free software; you can redistribute it and/or modify  *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     *   This program is distributed in the hope that it will be useful,       *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
     *   GNU General Public License for more details.                          *
     *                                                                         *
     *   You should have received a copy of the GNU General Public License     *
     *   along with this program; if not, write to the                         *
     *   Free Software Foundation, Inc.,                                       *
     *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
     ***************************************************************************/
    
    #include "qeglobal.h"
    #include "qelabel.h"
    
    /**
     *****************************************************************************
      class QELabel implementation
     *****************************************************************************
     */
    QELabel::QELabel(const QString &txt, QWidget *parent, const char *name)
      : QEXWidget(parent, name),
        m_drawingFont(0), m_fontMetrics(0), m_text(txt), m_margin(3), m_fontHeight(0),
        isBoldFont(FALSE)
    {
        m_text = txt;
        m_fontPointSize = 14;
        m_drawingFont = new QFont("SSong", m_fontPointSize);
    
        QFontMetrics fm(*m_drawingFont);
        m_fontHeight = fm.height();
        m_height = fm.height() + (m_margin*2);
        setGeometry(0, 0, 240, m_height);
        //setNoBackgroundMode(FALSE);
        hookEvents(TRUE);
    }
    
    QELabel::~QELabel()
    {
        if (m_drawingFont) delete m_drawingFont;
        hookEvents(FALSE);
    }
    
    void QELabel::setText(const QString &txt)
    {
        if (m_text == txt) return;
        m_text = txt;
        setDrawingBGStyle(drawingStyle());
    
        QFontMetrics fm(*m_drawingFont);
        m_height = fm.height() + (m_margin*2);
        m_fontHeight = fm.height();
        resize(m_width, m_height);
        widget()->setFont(*m_drawingFont);
        widget()->update();
    }
    
    void QELabel::setBoldFont(bool bold)
    {
        if (isBoldFont == bold) return;
        isBoldFont = bold;
        m_drawingFont->setBold(isBoldFont);
    }
    
    void QELabel::setDrawingBGStyle(const DrawingStyle &ds, bool boldFont)
    {
        QEXWidget::setDrawingBGStyle(ds);
    
        m_drawingFont->setBold(boldFont);
    
        switch (ds) {
            case DS_ScreenTitle:
                m_fontPointSize += 2;
                m_drawingFont->setBold(FALSE);
                break;
            case DS_DialogTitle:
                m_fontPointSize += 2;
                m_drawingFont->setBold(FALSE);
                break;
            case DS_Normal:
            case DS_HighlightTextBackground:
                m_drawingFont->setBold(FALSE);
                break;
            case DS_CSTBar:
            case DS_Dialog_CSTBar:
                m_fontPointSize += 2;
                m_drawingFont->setBold(TRUE);
                break;
        }
        m_drawingFont->setPointSize(m_fontPointSize);
    
        QFontMetrics fm(*m_drawingFont);
        //m_width  = (drawingStyle() == DS_Normal) ? fm.width(m_text) : width();
        //m_width  = width();
        m_height = fm.height() + (m_margin*2);
        m_fontHeight = fm.height();
        resize(m_width, m_height);
        widget()->setFont(*m_drawingFont);
        widget()->update();
    }
    
    bool QELabel::paintEvent(QPaintEvent *)
    {
        QPainter p(widget());
        p.drawPixmap(0, 0, QEGlobal::getDrawingBGPixmap(drawingStyle()));
    
        DrawingStyle ds = drawingStyle();
        QColor penColor = ((ds!=DS_Normal) || (ds!=DS_HighlightTextBackground)) ? white : gray;
        p.setPen(penColor);
        //p.drawText(m_margin, height() - m_fontHeight - m_margin, width()-m_margin, height()-m_margin, AlignLeft, m_text);
        p.drawText(m_margin, m_margin, width()-m_margin, height()-m_margin, AlignLeft, m_text);
        p.end();
        return TRUE;
    }
    QELabelButton class - qelabelbutton.h
    Code:
    /***************************************************************************
     *                                                                         *
     *   (c) 2007, Thanomsub Noppaburana <donga.nb@gmail.com>                  *
     *                                                                         *
     *   This program is free software; you can redistribute it and/or modify  *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     *   This program is distributed in the hope that it will be useful,       *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
     *   GNU General Public License for more details.                          *
     *                                                                         *
     *   You should have received a copy of the GNU General Public License     *
     *   along with this program; if not, write to the                         *
     *   Free Software Foundation, Inc.,                                       *
     *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
     ***************************************************************************/
    
    #ifndef __QE_LABELBUTTON_H__
    #define __QE_LABELBUTTON_H__
    
    #include <qpainter.h>
    #include <qwidget.h>
    
    #include "qeobject.h"
    #include "qelabel.h"
    
    /**
     *****************************************************************************
      class QELabelButton definition
     *****************************************************************************
     */
    class QELabelButton : public QELabel
    {
        Q_OBJECT
    public:
        QELabelButton(const QString &text, QWidget *parent, const char *name = 0);
        QELabelButton(const char *name = 0);
        virtual ~QELabelButton();
    
        virtual void setText(const QString &);
        int cursorX() { return m_mouseX; };
        int cursorY() { return m_mouseY; };
        QPoint cursorPos() { return QPoint(m_mouseX, m_mouseY); };
        bool isOnPressed() { return m_isMousePressed; };
    
    signals:
        void mousePressed(QPoint globalPoint);
        void mouseReleased(QPoint globalPoint);
        void mouseMoved(QPoint globalPoint);
        void mouseDblClicked(QPoint globalPoint);
        void clicked();
        void doubleClicked();
    
    protected:
        void generateBG();
    
        /* event handling */
        virtual bool mousePressEvent(QMouseEvent *);
        virtual bool mouseReleaseEvent(QMouseEvent *);
        virtual bool mouseMoveEvent(QMouseEvent *);
        virtual bool mouseDblClickEvent(QMouseEvent *);
        virtual bool mouseEnterEvent(QMouseEvent *);
        virtual bool mouseLeaveEvent(QMouseEvent *);
        virtual bool paintEvent(QPaintEvent *);
    
    private:
        QImage      bufIMG;
        QImage     *m_imgbtnUnpressBG;
        QImage     *m_imgbtnPressBG;
        bool        m_isMousePressed;
        bool        m_isMouseReleased;
        bool        m_isMouseInRegion;
        int         m_mouseX;
        int         m_mouseY;
    };
    
    #endif //__QE_LABELBUTTON_H__
    QELabelButton class - qelabelbutton.cpp
    Code:
    /***************************************************************************
     *                                                                         *
     *   (c) 2007, Thanomsub Noppaburana <donga.nb@gmail.com>                  *
     *                                                                         *
     *   This program is free software; you can redistribute it and/or modify  *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     *   This program is distributed in the hope that it will be useful,       *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
     *   GNU General Public License for more details.                          *
     *                                                                         *
     *   You should have received a copy of the GNU General Public License     *
     *   along with this program; if not, write to the                         *
     *   Free Software Foundation, Inc.,                                       *
     *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
     ***************************************************************************/
    
    #include "qeglobal.h"
    #include "qelabelbutton.h"
    
    /**
     *****************************************************************************
      class QELabelButton implementation
     *****************************************************************************
     */
    QELabelButton::QELabelButton(const QString &text, QWidget *parent, const char *name)
      : QELabel(text, parent, name),
        m_imgbtnUnpressBG(0), m_imgbtnPressBG(0),
        m_isMousePressed(FALSE), m_isMouseReleased(TRUE), m_isMouseInRegion(FALSE),
        m_mouseX(0), m_mouseY(0)
    {
        bufIMG = QEGlobal::getSkinPixmap("General_Stretch_Button_S.g");
        //bufIMG.setAlphaBuffer(TRUE);
        setBackgroundMode(QWidget::NoBackground);
    }
    
    QELabelButton::QELabelButton(const char *name)
      : QELabel("Button", 0, name),
        m_imgbtnUnpressBG(0), m_imgbtnPressBG(0),
        m_isMousePressed(FALSE), m_isMouseReleased(TRUE), m_isMouseInRegion(FALSE),
        m_mouseX(0), m_mouseY(0)
    {
        bufIMG = QEGlobal::getSkinPixmap("General_Stretch_Button_S.g");
        //bufIMG.setAlphaBuffer(TRUE);
        //setBackgroundPixmap(getSkinPixmap("General_Stretch_Button_S.g"));
        setBackgroundMode(QWidget::NoBackground);
    }
    
    QELabelButton::~QELabelButton()
    {
        /*m_imgbtnUnpressBG->reset();
        m_imgbtnPressBG->reset();
        delete m_imgbtnUnpressBG;
        delete m_imgbtnPressBG;
        */
    }
    
    void QELabelButton::setText(const QString &txt)
    {
        if (m_text == txt) return;
        m_text = txt;
        widget()->update();
    /*    setDrawingBGStyle(drawingStyle());
    
        QFontMetrics fm(*m_drawingFont);
        m_height = fm.height() + (m_margin*2);
        m_fontHeight = fm.height();
        resize(m_width, m_height);
        widget()->setFont(*m_drawingFont);
        widget()->update();
    */
    }
    
    void QELabelButton::generateBG()
    {
        //m_imgbtnUnpressBG = new QImage(
        //m_imgbtnPressBG->reset();
        //setBackgroundPixmap(getSkinPixmap("General_Stretch_Button_S.g"));
    }
    
    bool QELabelButton::paintEvent(QPaintEvent *ev)
    {
    /*    QPixmap pixBG;
        pixBG.convertFromImage(bufIMG.smoothScale(bufIMG.width(), height()));
    
        QPixmap pixMidBG(pixBG.width()-6, height());
        bitBlt(&pixMidBG, 0, 0, &pixBG, 3, 0, pixBG.width()-6, height());
    
        QImage imgTmp;
        imgTmp = pixMidBG;
    
        pixMidBG.convertFromImage(imgTmp.smoothScale(width()-6, height()));
    
        QPixmap buf2(width(), height());
        bitBlt(&buf2, 0, 0, &pixBG, 0, 0, 3, height());
        bitBlt(&buf2, width()-3, 0, &pixBG, pixBG.width()-3, 0, 3, height());
        bitBlt(&buf2, 3, 0, &pixMidBG, 0, 0, width()-6, height());
    
    
        QImage imageBG;
        imageBG = buf2;
        imageBG.setAlphaBuffer(TRUE);
    
        QPainter p(widget());
        //p.drawPixmap(0, 0, buf2);
        p.drawImage(0, 0, m_isMousePressed ? imageBG : imageBG.mirror(), 0, 0, -1, -1, OrderedAlphaDither);
        p.end();
    */
        QPainter p(widget());
        QBrush brush(m_isMousePressed ? gray : darkGray);
        p.fillRect(0, 0, width(), height(), brush);
        p.drawRect(0, 0, width(), height());
    
        p.drawPixmap(0, 0, QEGlobal::getDrawingBGPixmap(drawingStyle()));
        DrawingStyle ds = drawingStyle();
        QColor penColor = ((ds!=DS_Normal) || (ds!=DS_HighlightTextBackground)) ? white : gray;
        p.setPen(penColor);
        p.drawText(m_margin, m_margin, width()-m_margin, height()-m_margin, AlignCenter | AlignVCenter, m_text);
    
        p.end();
    
        return TRUE;
    }
    
    bool QELabelButton::mousePressEvent(QMouseEvent *ev)
    {
        m_isMouseInRegion = m_isMousePressed = TRUE;
        widget()->update();
        m_mouseX = ev->globalPos().x();
        m_mouseY = ev->globalPos().y();
        emit mousePressed(ev->globalPos());
        return TRUE;
    }
    
    bool QELabelButton::mouseReleaseEvent(QMouseEvent *ev)
    {
        m_isMousePressed = FALSE;
        widget()->update();
        m_mouseX = ev->globalPos().x();
        m_mouseY = ev->globalPos().y();
        emit mouseReleased(ev->globalPos());
        if (m_isMouseInRegion) {
            emit clicked();
        }
        m_isMouseInRegion = FALSE;
        return TRUE;
    }
    
    bool QELabelButton::mouseMoveEvent(QMouseEvent *ev)
    {
        if (!m_isMousePressed) return TRUE;
        m_mouseX = ev->globalPos().x();
        m_mouseY = ev->globalPos().y();
        emit mouseMoved(ev->globalPos());
        return TRUE;
    }
    
    bool QELabelButton::mouseDblClickEvent(QMouseEvent *ev)
    {
        m_isMousePressed = FALSE;
        m_mouseX = ev->globalPos().x();
        m_mouseY = ev->globalPos().y();
        emit mouseDblClicked(ev->globalPos());
        emit doubleClicked();
        m_isMouseInRegion = FALSE;
        return TRUE;
    }
    
    bool QELabelButton::mouseEnterEvent(QMouseEvent *)
    {
        m_isMouseInRegion = TRUE;
        return FALSE;
    }
    
    bool QELabelButton::mouseLeaveEvent(QMouseEvent *)
    {
        m_isMouseInRegion = FALSE;
        return FALSE;
    }
    Testing it
    Well, after have [b]QEXWidget, QELabel, QELabelButton[/] class already, lets links (or you may copy) it
    to the "lib/" of the QEAppTemplate example for testing.
    now in the "lib" folder of the QEAppTemplate should have following files:
    Code:
    lib/qeconfig.cpp
    lib/qeobject.cpp
    lib/qeglobal.h
    lib/qeconfig.h
    lib/qeapplication.h
    lib/qewidget.h
    lib/qelabel.cpp
    lib/qeapplication.cpp
    lib/qeglobal.cpp
    lib/qexwidget.cpp
    lib/qeobject.h
    lib/qexwidget.h
    lib/qepixmap_inc.h
    lib/qemainwidget.cpp
    lib/qewidget.cpp
    lib/qelabelbutton.h
    lib/qemainwidget.h
    lib/qelabelbutton.cpp
    lib/qelabel.h
    Now, open the editor for edit the old qeapptemplate.cpp to:
    Code:
    /***************************************************************************
     *                                                                         *
     *   (c) 2007, Thanomsub Noppaburana <donga.nb@gmail.com>                  *
     *                                                                         *
     *   This program is free software; you can redistribute it and/or modify  *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     *   This program is distributed in the hope that it will be useful,       *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
     *   GNU General Public License for more details.                          *
     *                                                                         *
     *   You should have received a copy of the GNU General Public License     *
     *   along with this program; if not, write to the                         *
     *   Free Software Foundation, Inc.,                                       *
     *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
     ***************************************************************************/
    
    #include "lib/qelabel.h"
    #include "lib/qelabelbutton.h"
    
    #include "qeapptemplate.h"
    
    /**
     *****************************************************************************
     QEAppTemplate class implementation
     *****************************************************************************
     */
    
    QEAppTemplate::QEAppTemplate(const char *name)
      : QEMainWidget(0, name)
    {
    }
    
    QEAppTemplate::~QEAppTemplate()
    {
        printf("(%s)->QEAppTemplate<-::destroy()\n", name());
    }
    
    
    /** GUI creation */
    void QEAppTemplate::setupGUI()
    {
        /* Show normal mode */
        showNormalMode(TRUE, TRUE);
    
        /* Setup CST Bar */
        getCSTBarWidget(TRUE);
        ZPushButton *btn = CSTwidget()->getRightBtn();
        connect(btn, SIGNAL(clicked()), qApp, SLOT(slotQuickQuit()));
    
        /* Set Title text */
        ((QLabel*)getTitleBarWidget())->setText("QE App Template");
    
        /* Get Content widget */
        getContentWidget(TRUE)->resize(m_contentWidth, m_contentHeight);
    
    }
    
    void QEAppTemplate::setupContent()
    {
        QELabel *label1 = new QELabel("TEST LABEL 1", contentWidget(), "lbl1");
        ((QScrollView*)contentWidget())->addChild(label1->widget());
        label1->show();
    
        QELabel *label2 = new QELabel("TEST LABEL 2", contentWidget(), "lbl2");
        ((QScrollView*)contentWidget())->addChild(label2->widget(), 0, label1->height());
        label2->show();
    
        QELabelButton *labelBtn = new QELabelButton("TEST LABEL Button", contentWidget(), "lblBtn");
        ((QScrollView*)contentWidget())->addChild(labelBtn->widget(), 0, label1->height() + label2->height());
        labelBtn->show();
    }
    If done, lets compile it, strip and transfer the last build to the phone on SD card again for testing.

    The result should be:



    Hope this would be guide you for make the other better widget for ours
    Attached Files Attached Files

  6. #16

    Default

    Thanks donga,I look forward to your qezxplayer upgrade.

  7. #17

    Default

    Thanks! donga,you are great!!!

  8. #18

    Default

    I'm new around here - but appreciate how much of a step this is!

    How different is it to this?

    http://lsb.blogdns.net/ezx-devkit for the A780

    Will apps developed using your one work on athe A780 too?

  9. #19
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    387

    Default

    Gee, what a waste of talent.

    Donga, you should be working on improving OpenMoko for EZX
    By the way, great work!

  10. #20

    Default

    Hi donga.

    I've tried all these QE apps and all of them work on A1200 with 53p. The problem is i can't link any of them against my libraries. This is what i get:

    src/lib/qeapplication.o(.gnu.linkonce.r._ZTV13QEApplication+0x5c): undefined reference to `ZApplication::insertStr(QWSEvent*)'
    src/lib/qeapplication.o(.gnu.linkonce.r._ZTV13QEApplication+0x64): undefined reference to `ZApplication::hardKeyEventFilter(QKeyEvent*)'
    src/lib/qelabel.o(.text+0xe0): In function `QELabel::QELabel[not-in-charge](QString const&, QWidget*, char const*, bool)':
    : undefined reference to `QFont::QFont[in-charge](QString const&, int, int, bool)'
    src/lib/qelabel.o(.text+0x234): In function `QELabel::QELabel[in-charge](QString const&, QWidget*, char const*, bool)':
    : undefined reference to `QFont::QFont[in-charge](QString const&, int, int, bool)'

    Any idea why ? I have set up my environment and tools as you described so i think my ezx libs are different . What's your fw ?


 
Page 2 of 6 FirstFirst 123456 LastLast

Similar Threads

  1. Native EZX messenger-GAIM,etc..
    By naset in forum Development
    Replies: 51
    Last Post: 02-08-2010, 09:42 PM
  2. Native ezx app/code sharing, tips and tricks
    By rpconnect in forum Development Stickys
    Replies: 50
    Last Post: 11-01-2007, 12:30 PM
  3. All application (Soft, Game and more) for EZX linux phone
    By boy_dn in forum E680i General Chat
    Replies: 5
    Last Post: 02-11-2007, 04:24 PM
  4. porting Opie application to ezx problem.
    By eakrin in forum Development
    Replies: 2
    Last Post: 06-26-2006, 11:30 PM
  5. anyone has IM native application
    By sky2k in forum E680i General Chat
    Replies: 1
    Last Post: 01-06-2006, 05:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Single Sign On provided by vBSSO

Search Engine Optimization by vBSEO 3.6.0 RC 1