Changeset 401

Show
Ignore:
Timestamp:
05/28/07 20:19:36 (18 months ago)
Author:
krobillard
Message:

Orca Qt - A label can now be initialized from a word.

Location:
trunk/orca/qt
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/qt/project.r

    r108 r401  
    1717    ] 
    1818    linux [ 
    19         libs %fam 
     19        ;libs %fam 
    2020        libs %bz2 
    2121        ;libs_from %/usr/X11R6/lib 
  • trunk/orca/qt/qorca.cpp

    r146 r401  
    324324 
    325325 
    326 static const char* valueStr( OValue* val ) 
    327 { 
    328     OString* str = orSTRING( val ); 
    329     orTermCStr( str ); 
    330     return orStrChars( str, val ); 
     326static void valueToQString( const OValue* val, QString& str ) 
     327{ 
     328    if( orIsString( val->type ) ) 
     329    { 
     330        str = cstring( val ); 
     331    } 
     332    else if( val->type == OT_INTEGER ) 
     333    { 
     334        str.setNum( val->integer ); 
     335    } 
     336    else if( val->type == OT_DECIMAL ) 
     337    { 
     338        str.setNum( val->num.decimal ); 
     339    } 
     340    else if( val->type == OT_NONE ) 
     341    { 
     342        str.clear(); 
     343    } 
     344    else 
     345    { 
     346        AOString ts; 
     347        str = ts.mold( val ); 
     348    } 
    331349} 
    332350 
     
    414432                parent.addWidget( pw ); 
    415433                setWID( setWord, pw->_wid ); 
    416                 pw->setText( valueStr( cbp.values + 1 ) ); 
     434 
     435                val = cbp.values + 1; 
     436                if( orIs(val, OT_WORD) ) 
     437                { 
     438                    orWordVal( val, blk, val ); 
     439                } 
     440                QString txt; 
     441                valueToQString( val, txt ); 
     442                pw->setText( txt ); 
     443 
    417444                wid = pw; 
    418445            } 
     
    427454                parent.addWidget( pw ); 
    428455                setWID( setWord, pw->_wid ); 
    429                 pw->setText( valueStr( cbp.values + 1 ) ); 
     456                pw->setText( cstring( cbp.values + 1 ) ); 
    430457                pw->setBlock( cbp.values + 2 ); 
    431458                wid = pw; 
     
    441468                parent.addWidget( pw ); 
    442469                setWID( setWord, pw->_wid ); 
    443                 pw->setText( valueStr( cbp.values + 1 ) ); 
     470                pw->setText( cstring( cbp.values + 1 ) ); 
    444471                wid = pw; 
    445472            } 
     
    466493                    { 
    467494                        if( orIs(it, OT_STRING) ) 
    468                             pw->addItem( valueStr( it ) ); 
     495                            pw->addItem( cstring( it ) ); 
    469496                        ++it; 
    470497                    } 
     
    472499                else 
    473500                { 
    474                     pw->addItem( valueStr( val ) ); 
     501                    pw->addItem( cstring( val ) ); 
    475502                } 
    476503            } 
     
    496523            case LD_TIP: 
    497524                if( wid ) 
    498                     wid->setToolTip( valueStr(cbp.values + 1) ); 
     525                    wid->setToolTip( cstring(cbp.values + 1) ); 
    499526                break; 
    500527 
     
    502529            { 
    503530                if( qEnv.curWidget ) 
    504                     qEnv.curWidget->setWindowTitle( valueStr(cbp.values + 1) ); 
     531                    qEnv.curWidget->setWindowTitle( cstring(cbp.values + 1) ); 
    505532            } 
    506533                break; 
     
    528555 
    529556                if( match->integer == LD_LINE_EDITS ) 
    530                     pw->setText( valueStr( cbp.values + 1 ) ); 
     557                    pw->setText( cstring( cbp.values + 1 ) ); 
    531558            } 
    532559                break; 
     
    545572                if( match->integer == LD_TEXT_EDITS ) 
    546573                { 
    547                     const char* str = valueStr( cbp.values + 1 ); 
     574                    const char* str = cstring( cbp.values + 1 ); 
    548575                    if( *str == '<' ) 
    549576                        pw->setHtml( str ); 
     
    565592 
    566593                val = cbp.values + 1; 
    567                 pw->setTitle( valueStr( val ) ); 
     594                pw->setTitle( cstring( val ) ); 
    568595 
    569596                ++val; 
     
    598625                    if( combo ) 
    599626                    { 
    600                         combo->addItem( valueStr( cbp.values ) ); 
     627                        combo->addItem( cstring( cbp.values ) ); 
    601628                        break; 
    602629                    } 
     
    605632                    if( texted ) 
    606633                    { 
    607                         const char* str = valueStr( cbp.values ); 
     634                        const char* str = cstring( cbp.values ); 
    608635                        if( *str == '<' ) 
    609636                            texted->setHtml( str ); 
     
    9821009                break; 
    9831010        } 
    984     } 
    985 } 
    986  
    987  
    988 static void valueToQString( const OValue* val, QString& str ) 
    989 { 
    990     if( orIsString( val->type ) ) 
    991     { 
    992         str = cstring( val ); 
    993     } 
    994     else if( val->type == OT_INTEGER ) 
    995     { 
    996         str.setNum( val->integer ); 
    997     } 
    998     else if( val->type == OT_DECIMAL ) 
    999     { 
    1000         str.setNum( val->num.decimal ); 
    1001     } 
    1002     else if( val->type == OT_NONE ) 
    1003     { 
    1004         str.clear(); 
    1005     } 
    1006     else 
    1007     { 
    1008         AOString ts; 
    1009         str = ts.mold( val ); 
    10101011    } 
    10111012} 
     
    12261227  "  2 ['spacer]\n" 
    12271228  "  3 ['label string!]\n" 
     1229  "  3 ['label word!]\n" 
    12281230  "  4 ['button string! block!]\n" 
    12291231  "  5 ['checkbox string!]\n"