libyui-qt  2.43.5
/usr/src/RPM/BUILD/libyui-qt-2.43.5/src/YQApplication.cc
00001 /*
00002   Copyright (C) 2000-2012 Novell, Inc
00003   This library is free software; you can redistribute it and/or modify
00004   it under the terms of the GNU Lesser General Public License as
00005   published by the Free Software Foundation; either version 2.1 of the
00006   License, or (at your option) version 3.0 of the License. This library
00007   is distributed in the hope that it will be useful, but WITHOUT ANY
00008   WARRANTY; without even the implied warranty of MERCHANTABILITY or
00009   FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00010   License for more details. You should have received a copy of the GNU
00011   Lesser General Public License along with this library; if not, write
00012   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
00013   Floor, Boston, MA 02110-1301 USA
00014 */
00015 
00016 
00017 /*-/
00018 
00019   File:         YQApplication.cc
00020 
00021   Author:       Stefan Hundhammer <sh@suse.de>
00022 
00023   Textdomain    "qt"
00024 /-*/
00025 
00026 #include <unistd.h>     // access()
00027 
00028 #include <QApplication>
00029 #include <QLocale>
00030 #include <QRegExp>
00031 #include <QFileDialog>
00032 #include <QDesktopWidget>
00033 #include <QMessageBox>
00034 #include <QSettings>
00035 #include <QFontDatabase>
00036 #include <QMenu>
00037 
00038 #include <fontconfig/fontconfig.h>
00039 
00040 #define YUILogComponent "qt-ui"
00041 #include <yui/YUILog.h>
00042 #include <yui/YUISymbols.h>
00043 #include <yui/Libyui_config.h>
00044 
00045 #include "YQUI.h"
00046 
00047 #include "utf8.h"
00048 #include "YQi18n.h"
00049 
00050 #include "YQApplication.h"
00051 #include "YQPackageSelectorPluginStub.h"
00052 #include "YQGraphPluginStub.h"
00053 #include "YQContextMenu.h"
00054 
00055 
00056 YQApplication::YQApplication()
00057     : YApplication()
00058     , _currentFont( 0 )
00059     , _headingFont( 0 )
00060     , _boldFont( 0 )
00061     , _langFonts( 0 )
00062     , _qtTranslations( 0 )
00063     , _autoFonts( false )
00064     , _autoNormalFontSize( -1 )
00065     , _autoHeadingFontSize( -1 )
00066     , _leftHandedMouse( false )
00067     , _askedForLeftHandedMouse( false )
00068     , _contextMenuPos ( QPoint (0, 0) )
00069     , _contextMenu ( 0 )
00070 {
00071     yuiDebug() << "YQApplication constructor start" << std::endl;
00072 
00073     //setIconBasePath( ICONDIR "/icons/22x22/apps/" );
00074     // the above works too, but let's try it the icon-loader way - FaTE #306356
00075     iconLoader()->addIconSearchPath( ICONDIR "/icons/" );
00076     loadPredefinedQtTranslations();
00077 
00078     yuiDebug() << "YQApplication constructor end" << std::endl;
00079 }
00080 
00081 
00082 YQApplication::~YQApplication()
00083 {
00084     delete _langFonts;
00085     delete _qtTranslations;
00086 
00087     deleteFonts();
00088 }
00089 
00090 static std::string glob_language = "";
00091 
00092 void
00093 YQApplication::setLanguage( const std::string & language,
00094                             const std::string & encoding )
00095 {
00096     glob_language = language;
00097     YApplication::setLanguage( language, encoding );
00098     loadPredefinedQtTranslations();
00099 
00100     bool oldReverseLayout = YApplication::reverseLayout();
00101     setLayoutDirection( language );
00102     setLangFonts( language, encoding );
00103 
00104     if ( oldReverseLayout != YApplication::reverseLayout() )
00105     {
00106         YDialog * dialog = YDialog::topmostDialog( false ); // don't throw
00107 
00108         if ( dialog )
00109             dialog->recalcLayout();
00110     }
00111 }
00112 
00113 
00114 void
00115 YQApplication::loadPredefinedQtTranslations()
00116 {
00117     QString path = QT_LOCALEDIR;
00118     QString language;
00119 
00120     if (glob_language == "")
00121         language = QLocale::system().name();
00122     else
00123         language = glob_language.c_str();
00124 
00125     QString transFile = QString( "qt_%1.qm").arg( language );
00126 
00127     yuiMilestone() << "Selected language: " << language << std::endl;
00128 
00129     if ( path.isEmpty() )
00130     {
00131         yuiWarning() << "Qt locale directory not set - "
00132                      << "no translations for predefined Qt dialogs"
00133                      << std::endl;
00134         return;
00135     }
00136 
00137     if ( ! _qtTranslations )
00138         _qtTranslations = new QTranslator();
00139 
00140     _qtTranslations->load( transFile, path );
00141 
00142     if ( _qtTranslations->isEmpty() )
00143     {
00144         // try fallback
00145         transFile = QString( "qt_%1.qm").arg( language.toLower().left(2) );
00146         _qtTranslations->load( transFile, path );
00147     }
00148 
00149     if ( _qtTranslations->isEmpty() )
00150     {
00151         yuiWarning() << "Can't load translations for predefined Qt dialogs from "
00152                      << path << "/" << transFile << std::endl;
00153     }
00154     else
00155     {
00156         yuiMilestone() << "Loaded translations for predefined Qt dialogs from "
00157                        << path << "/" << transFile << std::endl;
00158 
00159         qApp->installTranslator( _qtTranslations );
00160 
00161         if ( qApp->layoutDirection() == Qt::RightToLeft )
00162             YApplication::setReverseLayout( true );
00163     }
00164 }
00165 
00166 
00167 void
00168 YQApplication::setLayoutDirection( const std::string & language )
00169 {
00170     QString lang( language.c_str() );
00171 
00172     // Force reverse layout for Arabic and Hebrew
00173 
00174     if ( lang.startsWith( "ar" ) ||     // Arabic
00175          lang.startsWith( "he" ) )      // Hebrew
00176     {
00177         yuiMilestone() << "Using reverse layout for " << language << std::endl;
00178 
00179         qApp->setLayoutDirection( Qt::RightToLeft );
00180         YApplication::setReverseLayout( true );
00181     }
00182     else
00183     {
00184         qApp->setLayoutDirection( Qt::LeftToRight );
00185         YApplication::setReverseLayout( false );
00186     }
00187 
00188     // Qt tries to figure that out by having translators translate a message
00189     // "QT_LAYOUT_DIRECTION" to "RTL" for right-to-left languages (i.e.,
00190     // Arabic, Hebrew) with QQapplication::tr(). This of course only works if
00191     // there are translations for those languages for QTranslator in the first
00192     // place, i.e. it only works if translations for the predefined Qt dialogs
00193     // (file selection dialog etc.) are available - and being loaded.
00194     //
00195     // libqt4-x11 contains Arabic translations for those Qt standard dialogs in
00196     // /usr/share/qt4/translations/qt_ar.qm, but (as of Sept. 2008) no Hebrew
00197     // translations.
00198     //
00199     // Anyway, that Qt standard way is not very reliable. And they only do it
00200     // at program startup anyway. Any later loading of those translations will
00201     // not help.
00202 }
00203 
00204 
00205 void
00206 YQApplication::setLangFonts( const std::string & language, const std::string & encoding )
00207 {
00208     if ( _fontFamily.isEmpty() )
00209         _fontFamily = qApp->font().family();
00210 
00211     QString oldFontFamily = _fontFamily;
00212 
00213     if ( ! _langFonts )
00214     {
00215         _langFonts = new QSettings( LANG_FONTS_FILE, QSettings::IniFormat );
00216         Q_CHECK_PTR( _langFonts );
00217 
00218         if ( _langFonts->status() != QSettings::NoError )
00219             yuiError() << "Error reading " << _langFonts->fileName() << std::endl;
00220         else
00221             yuiMilestone() <<  _langFonts->fileName() << " read OK"
00222                            << qPrintable( _langFonts->allKeys().join( "-" ) )
00223                            << std::endl;
00224     }
00225 
00226     QString lang = language.c_str();
00227 
00228     if ( ! encoding.empty() )
00229         lang += QString( "." ) + encoding.c_str();
00230 
00231     QString key;
00232 
00233     if ( ! _langFonts->contains( fontKey( lang ) ) )    // Try with encoding ("zh_CN.UTF8" etc.)
00234     {
00235         lang = language.c_str();                        // Try without encoding ("zh_CN")
00236 
00237         if ( ! _langFonts->contains( fontKey( lang ) ) )
00238             lang.replace( QRegExp( "_.*$" ), "" );      // Cut off trailing country ("_CN")
00239     }
00240 
00241     if ( _langFonts->contains( fontKey( lang ) ) )
00242     {
00243         _fontFamily = _langFonts->value( fontKey( lang ), _fontFamily ).toString();
00244         yuiMilestone() << fontKey( lang ) << " = \"" << _fontFamily << "\"" << std::endl;
00245     }
00246     else
00247     {
00248         _fontFamily = _langFonts->value( fontKey( "" ),  _fontFamily ).toString();
00249         yuiMilestone() << "Using fallback for " << lang
00250                        << ": font = \"" << _fontFamily << "\""
00251                        << std::endl;
00252     }
00253 
00254     if ( _fontFamily.isEmpty() ) {
00255         _fontFamily = "Sans Serif";
00256     }
00257 
00258     if ( _fontFamily != oldFontFamily )
00259     {
00260         yuiMilestone() << "New font family: " << _fontFamily << std::endl;
00261         deleteFonts();
00262         // setting the language loads fonts and we need to tell fontconfig
00263         FcInitReinitialize();
00264 
00265         foreach ( QWidget *widget, QApplication::allWidgets() )
00266         {
00267             if ( widget->font().family() != oldFontFamily )
00268                 continue;
00269 
00270             QFont wfont( widget->font() );
00271             wfont.setFamily( _fontFamily );
00272             widget->setFont( wfont );
00273         }
00274         QFont font( qApp->font() );
00275         font.setFamily( _fontFamily );
00276         qApp->setFont(font);    // font, informWidgets
00277 
00278         yuiMilestone() << "Reloading fonts - now using \"" << font.toString() << "\"" << std::endl;
00279     }
00280     else
00281     {
00282         yuiDebug() << "No font change" << std::endl;
00283     }
00284 
00285 }
00286 
00287 
00288 QString
00289 YQApplication::fontKey( const QString & lang )
00290 {
00291     if ( lang.isEmpty() )
00292         return "font";
00293     else
00294         return QString( "font[%1]").arg( lang );
00295 }
00296 
00297 
00298 const QFont &
00299 YQApplication::currentFont()
00300 {
00301     /**
00302      * Brute force approach to make sure we'll really get a complete Unicode font:
00303      * Explicitly load the one font that we made sure to contain all required
00304      * characters, including Latin1, Latin2, Japanese, Korean, and the
00305      * characters used for glyphs.
00306      *
00307      * There are many fonts that claim to be Unicode, but most of them contain
00308      * just a sorry excuse for a complete Unicode character set. Qt can't know
00309      * how complete a font is, so it chooses one that might be better in otherf
00310      * aspects, but lacks necessary characters.
00311      **/
00312 
00313     if ( ! _currentFont )
00314     {
00315         if ( autoFonts() )
00316         {
00317             pickAutoFonts();
00318 
00319             _currentFont = new QFont( _fontFamily );
00320             _currentFont->setPixelSize( _autoNormalFontSize );
00321             _currentFont->setWeight( QFont::Normal );
00322 
00323             yuiMilestone() << "Loaded " <<  _autoNormalFontSize
00324                            << " pixel font: " << _currentFont->toString()
00325                            << std::endl;
00326 
00327             qApp->setFont( * _currentFont);     // font, informWidgets
00328         }
00329         else
00330         {
00331             // yuiDebug() << "Copying QApplication::font()" << std::endl;
00332             _currentFont = new QFont( qApp->font() );
00333         }
00334     }
00335 
00336     return * _currentFont;
00337 }
00338 
00339 
00340 const QFont &
00341 YQApplication::boldFont()
00342 {
00343     if ( ! _boldFont )
00344     {
00345         _boldFont = new QFont( currentFont() );
00346         _boldFont->setBold( true );
00347     }
00348 
00349     return * _boldFont;
00350 }
00351 
00352 
00353 const QFont &
00354 YQApplication::headingFont()
00355 {
00356     /**
00357      * Brute force load the heading font - see currentFont() above for more.
00358      **/
00359 
00360     if ( ! _headingFont )
00361     {
00362         if ( autoFonts() )
00363         {
00364             pickAutoFonts();
00365 
00366             _headingFont = new QFont( _fontFamily );
00367             _headingFont->setPixelSize( _autoHeadingFontSize );
00368             _headingFont->setWeight( QFont::Bold );
00369 
00370             yuiMilestone() << "Loaded " << _autoHeadingFontSize
00371                            << " pixel bold font: " << _headingFont->toString()
00372                            << std::endl;
00373         }
00374         else
00375         {
00376             _headingFont = new QFont( _fontFamily, 14, QFont::Bold );
00377         }
00378     }
00379 
00380     return * _headingFont;
00381 }
00382 
00383 
00384 void
00385 YQApplication::deleteFonts()
00386 {
00387     delete _currentFont;
00388     delete _headingFont;
00389     delete _boldFont;
00390 
00391     _currentFont = 0;
00392     _headingFont = 0;
00393     _boldFont    = 0;
00394 }
00395 
00396 
00397 void
00398 YQApplication::setAutoFonts( bool useAutoFonts )
00399 {
00400     _autoFonts = useAutoFonts;
00401 }
00402 
00403 
00404 void
00405 YQApplication::pickAutoFonts()
00406 {
00407     if ( _autoNormalFontSize >= 0 )     // Use cached values
00408         return;
00409 
00410     int x = defaultWidth();
00411     int y = defaultHeight();
00412 
00413     int normal  = 10;
00414     int heading = 12;
00415 
00416     if ( x >= 800 && y >= 600 )
00417     {
00418         normal  = 10;
00419         heading = 12;
00420     }
00421 
00422     if ( x >= 1024 && y >= 768 )
00423     {
00424         normal  = 12;
00425         heading = 14;
00426     }
00427 
00428     if ( x >= 1280 && y >= 1024 )
00429     {
00430         normal  = 14;
00431         heading = 18;
00432     }
00433 
00434     if ( x >= 1400 )
00435     {
00436         normal  = 16;
00437         heading = 20;
00438     }
00439 
00440     if ( x >= 1600 )
00441     {
00442         normal  = 18;
00443         heading = 24;
00444     }
00445 
00446     if ( x >= 2048 )    // Sounds futuristic? Just wait one or two years...
00447     {
00448         normal  = 20;
00449         heading = 28;
00450     }
00451 
00452     _autoNormalFontSize  = normal;
00453     _autoHeadingFontSize = heading;
00454 
00455     yuiMilestone() << "Selecting auto fonts - normal: " << _autoNormalFontSize
00456                    << ", heading: " <<  _autoHeadingFontSize  << " (bold)"
00457                    << std::endl;
00458 }
00459 
00460 
00461 string
00462 YQApplication::glyph( const std::string & sym )
00463 {
00464     QChar unicodeChar;
00465 
00466     // Hint: Use the 'xfd' program to view characters available in the Unicode font.
00467 
00468     if      ( sym == YUIGlyph_ArrowLeft         )       unicodeChar = QChar( reverseLayout() ? 0x2192 : 0x2190 );
00469     else if ( sym == YUIGlyph_ArrowRight        )       unicodeChar = QChar( reverseLayout() ? 0x2190 : 0x2192 );
00470     else if ( sym == YUIGlyph_ArrowUp           )       unicodeChar = QChar( 0x2191 );
00471     else if ( sym == YUIGlyph_ArrowDown         )       unicodeChar = QChar( 0x2193 );
00472     else if ( sym == YUIGlyph_CheckMark         )       unicodeChar = QChar( 0x2714 );
00473     else if ( sym == YUIGlyph_BulletArrowRight  )       unicodeChar = QChar( 0x279c );
00474     else if ( sym == YUIGlyph_BulletCircle      )       unicodeChar = QChar( 0x274d );
00475     else if ( sym == YUIGlyph_BulletSquare      )       unicodeChar = QChar( 0x274f );
00476     else return "";
00477 
00478     return toUTF8( QString( unicodeChar ) );
00479 }
00480 
00481 
00482 string
00483 YQApplication::askForExistingDirectory( const std::string & startDir,
00484                                         const std::string & headline )
00485 {
00486     normalCursor();
00487 
00488     QString dirName =
00489         QFileDialog::getExistingDirectory( 0,                           // parent
00490                                            fromUTF8( headline ) ,       // caption
00491                                            fromUTF8( startDir ), QFileDialog::DontUseNativeDialog);     // dir
00492 
00493     busyCursor();
00494 
00495     return toUTF8( dirName );
00496 }
00497 
00498 
00499 string
00500 YQApplication::askForExistingFile( const std::string & startWith,
00501                                    const std::string & filter,
00502                                    const std::string & headline )
00503 {
00504     normalCursor();
00505 
00506     QFileDialog* dialog = new QFileDialog( 0,                           // parent
00507                                            fromUTF8( headline ),        // caption
00508                                            fromUTF8( startWith ),       // dir
00509                                            fromUTF8( filter ));         // filter
00510     dialog->setFileMode( QFileDialog::ExistingFile );
00511     dialog->setFilter( QDir::System | dialog->filter() );
00512     dialog->setOptions( QFileDialog::DontUseNativeDialog );
00513 
00514     QString fileName;
00515     if( dialog->exec() == QDialog::Accepted )
00516         fileName = dialog->selectedFiles().value( 0 );
00517     delete dialog;
00518 
00519     busyCursor();
00520 
00521     return toUTF8( fileName );
00522 }
00523 
00524 
00525 string
00526 YQApplication::askForSaveFileName( const std::string & startWith,
00527                                    const std::string & filter,
00528                                    const std::string & headline )
00529 {
00530     normalCursor();
00531 
00532     QString fileName = askForSaveFileName( fromUTF8( startWith ),
00533                                            fromUTF8( filter ),
00534                                            fromUTF8( headline ) );
00535     busyCursor();
00536 
00537     return toUTF8( fileName );
00538 }
00539 
00540 
00541 bool
00542 YQApplication::openContextMenu( const YItemCollection & itemCollection )
00543 {
00544     YQContextMenu* menu = new YQContextMenu( _contextMenuPos );
00545     menu->addItems(itemCollection);
00546 
00547     return true;
00548 }
00549 
00550 
00551 QString
00552 YQApplication::askForSaveFileName( const QString & startWith,
00553                                    const QString & filter,
00554                                    const QString & headline )
00555 {
00556     QString fileName;
00557 
00558     QWidget* parent = 0;
00559     YDialog * currentDialog = YDialog::currentDialog( false );
00560     if (currentDialog)
00561         parent = (QWidget *) currentDialog->widgetRep();
00562 
00563 
00564     // Leave the mouse cursor alone - this function might be called from
00565     // some other widget, not only from UI::AskForSaveFileName().
00566 
00567     fileName = QFileDialog::getSaveFileName( parent,            // parent
00568                                          headline,              // caption
00569                                          startWith,             // dir
00570                                          filter, 0, QFileDialog::DontUseNativeDialog );         // filter
00571 
00572     if ( fileName.isEmpty() )   // this includes fileName.isNull()
00573         return QString::null;
00574 
00575     return fileName;
00576 }
00577 
00578 
00579 int
00580 YQApplication::displayWidth()
00581 {
00582     return qApp->desktop()->width();
00583 }
00584 
00585 
00586 int
00587 YQApplication::displayHeight()
00588 {
00589     return qApp->desktop()->height();
00590 }
00591 
00592 
00593 int
00594 YQApplication::displayDepth()
00595 {
00596     return qApp->desktop()->depth();
00597 }
00598 
00599 
00600 long
00601 YQApplication::displayColors()
00602 {
00603     return 1L << qApp->desktop()->depth();
00604 }
00605 
00606 
00607 int
00608 YQApplication::defaultWidth()
00609 {
00610     return YQUI::ui()->defaultSize( YD_HORIZ );
00611 }
00612 
00613 
00614 int
00615 YQApplication::defaultHeight()
00616 {
00617     return YQUI::ui()->defaultSize( YD_VERT );
00618 }
00619 
00620 
00621 bool
00622 YQApplication::leftHandedMouse()
00623 {
00624     return _leftHandedMouse;
00625 }
00626 
00627 
00628 void
00629 YQApplication::maybeLeftHandedUser()
00630 {
00631     if ( _askedForLeftHandedMouse )
00632         return;
00633 
00634     QString message =
00635         _( "You clicked the right mouse button "
00636            "where a left-click was expected."
00637            "\n"
00638            "Switch left and right mouse buttons?"
00639            );
00640 
00641     QWidget* parent = 0;
00642     YDialog * currentDialog = YDialog::currentDialog( false );
00643     if (currentDialog)
00644         parent = (QWidget *) currentDialog->widgetRep();
00645 
00646     int button = QMessageBox::question( parent,
00647                                         // Popup dialog caption
00648                                         _( "Unexpected Click" ),
00649                                         message,
00650                                         QMessageBox::Yes | QMessageBox::Default,
00651                                         QMessageBox::No,
00652                                         QMessageBox::Cancel | QMessageBox::Escape );
00653 
00654     if ( button == QMessageBox::Yes )
00655     {
00656         int result;
00657         const char * command =
00658             _leftHandedMouse ?
00659             "xmodmap -e \"pointer = 1 2 3\"":   // switch back to right-handed mouse
00660             "xmodmap -e \"pointer = 3 2 1\"";   // switch to left-handed mouse
00661 
00662         _leftHandedMouse         = ! _leftHandedMouse;  // might be set repeatedly!
00663         _askedForLeftHandedMouse = false;       // give the user a chance to switch back
00664         yuiMilestone() << "Switching mouse buttons: " << command << std::endl;
00665 
00666         result = system( command );
00667         if (result < 0)
00668           yuiError() << "Calling '" << command << "' failed" << std::endl;
00669         else if (result > 0)
00670           yuiError() << "Running '" << command << "' exited with " << result << std::endl;
00671     }
00672     else if ( button == 1 )     // No
00673     {
00674         _askedForLeftHandedMouse = true;
00675     }
00676 }
00677 
00678 
00679 int YQApplication::deviceUnits( YUIDimension dim, float layoutUnits )
00680 {
00681     if ( dim==YD_HORIZ )        layoutUnits *= ( 640.0/80 );
00682     else                        layoutUnits *= ( 480.0/25 );
00683 
00684     return (int) ( layoutUnits + 0.5 );
00685 }
00686 
00687 
00688 float YQApplication::layoutUnits( YUIDimension dim, int deviceUnits )
00689 {
00690     float size = (float) deviceUnits;
00691 
00692     if ( dim==YD_HORIZ )        size *= ( 80/640.0 );
00693     else                        size *= ( 25/480.0 );
00694 
00695     return size;
00696 }
00697 
00698 
00699 void YQApplication::beep()
00700 {
00701     qApp->beep();
00702 }
00703 
00704 
00705 void YQApplication::busyCursor()
00706 {
00707     YQUI::ui()->busyCursor();
00708 }
00709 
00710 
00711 void YQApplication::normalCursor()
00712 {
00713     YQUI::ui()->normalCursor();
00714 }
00715 
00716 
00717 void YQApplication::makeScreenShot( const std::string & fileName )
00718 {
00719     YQUI::ui()->makeScreenShot( fileName );
00720 }
00721 
00722 
00723 YQPackageSelectorPluginStub *
00724 YQApplication::packageSelectorPlugin()
00725 {
00726     static YQPackageSelectorPluginStub * plugin = 0;
00727 
00728     if ( ! plugin )
00729     {
00730         plugin = new YQPackageSelectorPluginStub();
00731 
00732         // This is a deliberate memory leak: If an application requires a
00733         // PackageSelector, it is a package selection application by
00734         // definition. In this case, the ncurses_pkg plugin is intentionally
00735         // kept open to avoid repeated start-up cost of the plugin and libzypp.
00736     }
00737 
00738     return plugin;
00739 }
00740 
00741 
00742 YQGraphPluginStub *
00743 YQApplication::graphPlugin()
00744 {
00745     static YQGraphPluginStub * plugin = 0;
00746 
00747     if ( ! plugin )
00748     {
00749         plugin = new YQGraphPluginStub();
00750 
00751         // This is a deliberate memory leak: Plugin is intentionally
00752         // kept open to avoid repeated start-up cost of the plugin.
00753     }
00754 
00755     return plugin;
00756 }
00757 
00758 void
00759 YQApplication::setContextMenuPos( QPoint contextMenuPos )
00760 {
00761     _contextMenuPos = contextMenuPos;
00762 }
00763 
00764 void YQApplication::setApplicationTitle ( const string& title )
00765 {
00766   QString qtTitle = fromUTF8( title );
00767   YApplication::setApplicationTitle ( title );
00768   YQUI::ui()->setApplicationTitle(qtTitle);
00769   qApp->setApplicationName(qtTitle);
00770 }
00771 
00772 void YQApplication::setApplicationIcon ( const string& icon )
00773 {
00774   QString qtIcon = fromUTF8( icon );
00775   YApplication::setApplicationIcon ( icon );
00776   QPixmap pixmap (qtIcon);
00777   if ( !pixmap.isNull() )
00778     qApp->setWindowIcon ( QIcon ( pixmap ) );
00779 }
00780 
00781 #include "YQApplication.moc"
 All Classes Functions Variables