Join Today
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16
Like Tree4Likes

Thread: [ZMultiLineEdit] EZX Programming for dummy by dummy A1200, E6

  1. #1

    Default [ZMultiLineEdit] EZX Programming for dummy by dummy A1200, E6

    after test with ZPushButton in http://www.motorolafans.com/forums/showthread.php?p=132847#post132847

    Now I try another widget. here is a memCheck application. main widget is ZMultiLineEdit. application doing an easy job by execute command cat /proc/meminfo and dispaly result in ZMultiLineEdit.

    ZMultiLineEdit is a text box that can have 1 or more lines. and it can expandable in both size.

    you can create ZMultiLineEdit by

    memStatus = new ZMultiLineEdit( this, false, 12 );
    this = parent widget. can be content widget, QVBox, QBox. but can not create ZMultiLineEdit on ZScrollView it cause a segmentation fault.
    false = ezx style. I found no different between true and false. report me If you found it.
    12 = number of lines.

    After create it ZMultiLineEdit need to config many properties such as

    setWordWrap for define wraping text.
    setSizePolicy for define expanding in horizontal and vertical when text length is out of it's area.
    setReadOnly to make it read only but can copy text inside it.
    setMaxLength for define number of characters for user input.

    and we can define filter for input by

    QRegExp mFilter = QRegExp("[^0-9]");
    mPhoneNumberEdit->setFilter(mFilter);
    see QRegExp for more detail.

    Here is a full source code of memCheck demo.
    Code:
    //-------------------------------------------------------------------------------------------------
    //
    //  Header Name: MemCheck.cpp
    //
    //  General Description: MemCheck class implement file.
    //
    //-------------------------------------------------------------------------------------------------
    //
    //                            Eakrin Confidential Proprietary
    //                     Template ID and version: 20080308  Version 0.1
    //                      (c) Copyright eakrin 2008, All Rights Reserved
    //
    //-------------------------------------------------------------------------------------------------
    
    #include <ZApplication.h>
    #include <ZMainWidget.h>
    #include <ZPushButton.h>
    #include <ZMessageBox.h>
    #include <ZScrollView.h>
    #include <ezxutilcst.h>
    #include <ZMultiLineEdit.h>
    
    // UTIL_MemInfo always return undefine type. can not convert to QString.
    //#include <UTIL_MemInfo.h>
    
    #include <qlabel.h>
    #include <qlayout.h>
    #include <qfile.h>
    #include <qtextstream.h>
    
    #include <stdlib.h>
    
    #include "MemCheck.h"
    
    MemCheck::MemCheck( void )
        : ZMainWidget( FALSE, NULL, NULL, 0 )
    {
        // Create Title bar.
        title = new QLabel( tr( "Memory Status" ), this );
        title->setScaledContents( TRUE );
        setTitleBarWidget( title );
        title->show();
    
        // Create CST Widget.
        cst = new UTIL_CST( this, tr( "Refresh" ) );
        setCSTWidget( cst );
        cst->show();
    
        // Create CST Right Button.
        ZPushButton *btn = cst->getRightBtn();
        connect( btn, SIGNAL( clicked() ), qApp, SLOT( slotQuickQuit() ) );
    
        // Create CST Mid Button.
        btn = cst->getMidBtn();
        connect( btn, SIGNAL( clicked() ), this, SLOT( refresh() ) );
    
        // Create CST Left Button with popup menu.
        cstMenu = new QPopupMenu( cst, NULL );
        cstMenu->insertItem( tr( "About.." ) );
        connect( cstMenu, SIGNAL( activated( int ) ), this, SLOT( selectCSTMenu( int ) ) );
        btn =cst->getLeftBtn();
        btn->setPopup( cstMenu );
    
        // Create content widget.
        //QWidget *contentWidget = this->getContentWidget( TRUE );
    
        /*
        ZScrollView *contentWidget = new ZScrollView( this );
        setContentWidget( contentWidget );
        contentWidget->show();
        */
        //QVBoxLayout *contentLayout = new QVBoxLayout( contentWidget );
    
        memStatus = new ZMultiLineEdit( this, false, 12 );
        memStatus->setWordWrap( ZMultiLineEdit::WidgetWidth );
        memStatus->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding));
        memStatus->setReadOnly( TRUE );
        setContentWidget( memStatus );
    
        // refresh memory status.
        this->refresh();
    }
    
    MemCheck::~MemCheck( void )
    {
    
    }
    
    void MemCheck::refresh( void )
    {
        system( "cat /proc/meminfo > /tmp/MemInfo.txt" );
    
        QFile ft( "/tmp/MemInfo.txt" );
        if ( ft.open( IO_ReadOnly ) )
        {
            QTextStream ts ( &ft );
    
            ts.readLine();
            ts.readLine();
            ts.readLine();
    
            QString mem;
            for (int row = 0; row < 15; row++)
            {
                mem = ts.readLine();
                memStatus->insertLine( mem );
            }
            ft.close();
        }
    
        system( "rm /tmp/MemInfo.txt" );
    }
    
    void MemCheck::selectCSTMenu( int menuId )
    {
        showAboutDialog();
    }
    
    void MemCheck::showAboutDialog( void )
    {
        ZMessageBox::information(this, NULL, 
            QString::fromUtf8("<qt><p><b>MemCheck %1</b></p>eakrin @ MotorolaFans.com</qt>").arg(VERSION),                 
            QString::fromUtf8("Ok"));
    }
    Code:
    //-------------------------------------------------------------------------------------------------
    //
    //  Header Name: MemCheck.h
    //
    //  General Description: MemCheck header file.
    //
    //-------------------------------------------------------------------------------------------------
    //
    //                            Eakrin Confidential Proprietary
    //                     Template ID and version: 20080308  Version 0.1
    //                      (c) Copyright eakrin 2008, All Rights Reserved
    //
    //-------------------------------------------------------------------------------------------------
    
    #ifndef __MEM_CHECK_H__
    #define __MEM_CHECK_H__
    
    #ifndef __cplusplus
    #error "This is a C++ header file;it requires C++ to compile."
    #endif
    
    #include <ZMainWidget.h>
    
    #define VERSION "0.1"
    #define RELEASE "Mar 9, 2008"
    
    class QLabel;
    class ZMultiLineEdit;
    class UTIL_CST;
    class QPopupMenu;
    //class UTIL_MemInfo;
    
    
    class MemCheck : public ZMainWidget
    {
        Q_OBJECT
    
    public:
        MemCheck( void );
        ~MemCheck( void );
    
    public slots:
        void refresh( void );
        void selectCSTMenu( int menuId );
        void showAboutDialog( void );
    
    private:
        QLabel *title;
        UTIL_CST *cst;
        QPopupMenu *cstMenu;
    
        //UTIL_MemInfo *mi;
    
        ZMultiLineEdit *memStatus;
    };
    
    #endif // #ifndef __MEM_CHECK_H__
    Code:
    //-------------------------------------------------------------------------------------------------
    //
    //  Header Name: main.cpp
    //
    //  General Description: main file for Ezx Mem Check
    //
    //-------------------------------------------------------------------------------------------------
    //
    //                            Eakrin Confidential Proprietary
    //                     Template ID and version: 20080308  Version 0.1
    //                      (c) Copyright eakrin 2008, All Rights Reserved
    //
    //-------------------------------------------------------------------------------------------------
    
    #include <ZApplication.h>
    #include "MemCheck.h"
    
    int main( int argc, char** argv )
    {
        ZApplication app( argc, argv );
        MemCheck *mw = new MemCheck();
    
        app.showMainWidget(mw);
        return app.exec();
    }
    and you can set startup keyboard by setInputMethods.

    setInputMethods( mPhoneNumberEdit, IMID_NUMBER_KB, 0, 0 );
    IMID_NUMBER_KB is a keyboard constant id defined in ZIMethod.h. IMID_NUMBER_KB is Quuid not a string. I tested only number keyboard. didn't test with symbol, thai, china board. And There have no another language keyboard id in ZIMethod.h may be we can use them from *.kdb in EMEA_LP.

    And need to replace ZMainWidget.h with my update from this post for setInputMethod.
    http://www.motorolafans.com/forums/s...2&postcount=63

    thanks for blackhawk about setInputMethods.

    cheer!
    eakrin
    Attached Thumbnails Attached Thumbnails [ZMultiLineEdit] EZX Programming for dummy by dummy A1200, E6-memcheck_screenshot1.png  
    redice likes this.
    Visit my Blog here.http://my.opera.com/eakrin

  2. #2
    Join Date
    Sep 2005
    Location
    Jakarta, Indonesia
    Posts
    1,091

    Default

    To prevent ZScrollView raising seg. fault, you have to set the child widget minimum size.

    Code:
    ZScrollView *sv = new ZScrollView(this);
    setContentWidget(sv);
    
    ZMultiLineEdit *le = new ZMultiLineEdit(sv->viewport(), TRUE, 10);
    le->setMinimumWidth(ZGloball::getSubContentR().width());
    sv->addChild(0, 0, TRUE);
    Using above code, you will have a ZMultiLineEdit with EZX style You have to set the ZMainWidget's edit mode argument to TRUE, to make the ZScrollView have auto resizing ability (when the virtual keyboard invoke). ZScrollView also can to manage the child widget size and layout but not do the job for now, maybe because we have incomplete header for it.

  3. #3
    Join Date
    Sep 2005
    Location
    Jakarta, Indonesia
    Posts
    1,091

    Default

    @eakrin
    Now I can compile EditorE source code without any modification (except the environment set and a bunch of soft link to foxe6's EZX headers. Yes, I keep blackhawk's SDK standard). The file browser not working as expected but this application now running on A1200 I have to use different libezxappbase Must I have to flash my Ming to different firmware?

  4. #4

    Default

    @blackhawk.
    what is your f/w. ? Look like you use a Monsterpack or Hybrid f/w. I 'll test A1200i, A1200r, A1200e library later. But I think It should be the same library in A1200, i, r ,e, and E6. I use only E6's libraries and make a symbolic link to a1200. all my apps worked in both A1200 and e6. I think you have the same problem as ustrucx. he flash his phone to standard f/w and everything work fine with foxe6's sdk. and be careful for A1200 f/w track.

    because I think now I found the source of segmentation fault error from *.h file. Need to test it a little to be sure. Then after that we should have many header files as we need. LOL.

    cheer!
    redice likes this.
    Visit my Blog here.http://my.opera.com/eakrin

  5. Default

    I've tried yan0 or foxe6's SDK for many times on my A1200E, but always fail when setup a ZMultiLineEdit. Now, I find the way from xptools and MFiles:

    First, replace the libezxappbase.so.* with libezxappbase.so.1 from these packages. Compile the application with foxe6's header files. Coy libezxappbase.so.1 to your SD (eg: /mmc/mmca1/lib/ ). When launch the executable, set the env like this:

    #!/bin/sh
    . /home/native/.profile # apply QT exec env
    export LD_LIBRARY_PATH=/mmc/mmca1/lib:$LD_LIBRARY_PATH

    exec /where/your/app/is
    This my first time to make a simple application with ZMultiLineEdit to run on my A1200E from source!
    Last edited by redice; 03-17-2008 at 01:25 PM.
    Embedded linux lover

  6. #6
    Join Date
    Sep 2005
    Location
    Jakarta, Indonesia
    Posts
    1,091

    Default

    @redice
    Congratulations! I have talking about this problem above. This is the reason why MFile author can use EditorE source to build Edit (text editor binary inside MFile package) but we still have a problem: ZScrollView can not manage the child widget properly. That's why Edit file browser not work as expected. I have an updated EditorE source, the file browser now look more native (using UTIL_ListBox) but far away from my computer for now and have no the source copy to upload it here
    redice likes this.

  7. #7
    Join Date
    Sep 2005
    Location
    Jakarta, Indonesia
    Posts
    1,091

    Default

    @redice
    Since we have a same problem, is your firmware R532_G_11.00.59P like my mine?

  8. #8
    borman Guest

    Default

    I've also tried using ZMultiLineEdit on my a1200e, with foxe6's SDK I got seg. faults, but eug from motofan.ru told me how to correct the SDK:
    compare these chunks of code
    Code:
    public:
    
        ZMultiLineEdit( QWidget *parent=0, const char *name=0);
    
        /**
         * Constructor of ZMultiLineEdit
         *
         * @param EZXStyle if false, the class is almost the samewith qmultilineedit.
         * if true ezx-special functions will be suported.
         *
         * @param lines the default lines the ZMultiLineEdit has
         */
        ZMultiLineEdit( QWidget *parent,bool EZXStyle,int lines = 1,const char *name=0 );
    
        virtual ~ZMultiLineEdit();
    This one is in foxe6's SDK


    Code:
    public:
      
        char buf[2048];
    
        ZMultiLineEdit( QWidget *parent=0, const char *name=0, bool unk=true );
    
        /**
         * Constructor of ZMultiLineEdit
         *
         * @param EZXStyle if false, the class is almost the samewith qmultilineedit.
         * if true ezx-special functions will be suported.
         *
         * @param lines the default lines the ZMultiLineEdit has
         */
        ZMultiLineEdit( QWidget *parent,bool EZXStyle,int lines = 1,const char *name=0, bool unk=true );
    
        virtual ~ZMultiLineEdit();
    And this one is correct and works with libezxappbase from a1200e

    so there's no need for library from e6
    redice likes this.

  9. Default

    Quote Originally Posted by blackhawk View Post
    @redice
    Since we have a same problem, is your firmware R532_G_11.00.59P like my mine?
    My firmware is R541_G_11.50.34P.
    Embedded linux lover

  10. #10
    Join Date
    Sep 2005
    Location
    Jakarta, Indonesia
    Posts
    1,091

    Default

    @borman
    To compile an application that using ZMultiLineEdit (EditorE for an example), my R532_G_11.00.59P A1200's libezxappbase library need boolean argument in ZMultiLineEdit costructor but it raise segmentation fault at runtime. My English not good enough to explain, but we are not talking about that E6's libezxappbase is the correct library for this problem.

    @redice
    Different firmware but have a same problem


 
+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. [Req] EZX Programming Ebook
    By *~Nimsrules~* in forum Moto eBooks
    Replies: 2
    Last Post: 04-21-2009, 11:10 AM
  2. EZX programming for dummy by dummy
    By eakrin in forum Development
    Replies: 15
    Last Post: 12-02-2008, 09:28 AM
  3. Q: C Programming etc on A1200
    By roheed in forum A1200 General Chat
    Replies: 12
    Last Post: 05-12-2008, 05:45 AM
  4. NEED HELP (DUMMY)
    By ROKR in forum E6 General Chat
    Replies: 3
    Last Post: 07-14-2007, 06:43 AM
  5. PLEASE PLEASE, HELP A DUMMY
    By luke1719 in forum E680i General Chat
    Replies: 4
    Last Post: 05-11-2006, 07:19 AM

Tags for this Thread

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