libyui-qt  2.49.2
YQApplication.cc
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YQApplication.cc
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23  Textdomain "qt"
24 /-*/
25 
26 #include <unistd.h> // access()
27 
28 #include <QApplication>
29 #include <QLocale>
30 #include <QRegExp>
31 #include <QFileDialog>
32 #include <QDesktopWidget>
33 #include <QMessageBox>
34 #include <QSettings>
35 #include <QFontDatabase>
36 #include <QMenu>
37 #include <QLibraryInfo>
38 
39 #include <fontconfig/fontconfig.h>
40 
41 #define YUILogComponent "qt-ui"
42 #include <yui/YUILog.h>
43 #include <yui/YUISymbols.h>
44 #include <yui/Libyui_config.h>
45 
46 #include "YQUI.h"
47 
48 #include "utf8.h"
49 #include "YQi18n.h"
50 
51 #include "YQApplication.h"
52 #include "YQPackageSelectorPluginStub.h"
53 #include "YQGraphPluginStub.h"
54 #include "YQContextMenu.h"
55 
56 // Qt5 requires the explicit font initialization; otherwise it picks up
57 // any random matching fonts, and tends to choose the worst one
58 // (e.g. bitmap fonts) in the end. (bnc#879991)
59 // Note that this is also set in LANG_FONTS_FILE
60 static const char * default_font_family = "Sans Serif";
61 
63  : YApplication()
64  , _currentFont( 0 )
65  , _headingFont( 0 )
66  , _boldFont( 0 )
67  , _langFonts( 0 )
68  , _qtTranslations( 0 )
69  , _autoFonts( false )
70  , _autoNormalFontSize( -1 )
71  , _autoHeadingFontSize( -1 )
72  , _leftHandedMouse( false )
73  , _askedForLeftHandedMouse( false )
74  , _contextMenuPos ( QPoint (0, 0) )
75  , _contextMenu ( 0 )
76 {
77  yuiDebug() << "YQApplication constructor start" << std::endl;
78 
79  //setIconBasePath( ICONDIR "/icons/22x22/apps/" );
80  // the above works too, but let's try it the icon-loader way - FaTE #306356
81  iconLoader()->addIconSearchPath( ICONDIR "/icons/" );
83  _fontFamily = default_font_family;
84 
85  yuiDebug() << "YQApplication constructor end" << std::endl;
86 }
87 
88 
90 {
91  delete _langFonts;
92  delete _qtTranslations;
93 
94  deleteFonts();
95 }
96 
97 static std::string glob_language = "";
98 
99 void
100 YQApplication::setLanguage( const std::string & language,
101  const std::string & encoding )
102 {
103  glob_language = language;
104  YApplication::setLanguage( language, encoding );
106 
107  bool oldReverseLayout = YApplication::reverseLayout();
108  setLayoutDirection( language );
109  setLangFonts( language, encoding );
110 
111  if ( oldReverseLayout != YApplication::reverseLayout() )
112  {
113  YDialog * dialog = YDialog::topmostDialog( false ); // don't throw
114 
115  if ( dialog )
116  dialog->recalcLayout();
117  }
118 }
119 
120 
121 void
123 {
124  QString path = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
125  QString language;
126 
127  if (glob_language == "")
128  language = QLocale::system().name();
129  else
130  language = glob_language.c_str();
131 
132  QString transFile = QString( "qt_%1.qm").arg( language );
133 
134  yuiMilestone() << "Selected language: " << language << std::endl;
135 
136  if ( path.isEmpty() )
137  {
138  yuiWarning() << "Qt locale directory not set - "
139  << "no translations for predefined Qt dialogs"
140  << std::endl;
141  return;
142  }
143 
144  if ( ! _qtTranslations )
145  _qtTranslations = new QTranslator();
146 
147  if ( !_qtTranslations->load( transFile, path ) )
148  {
149  yuiWarning() << "Can't load translations for predefined Qt dialogs for "
150  << language << std::endl;
151  }
152  else
153  {
154  yuiMilestone() << "Loaded translations for predefined Qt dialogs for "
155  << language << std::endl;
156 
157  qApp->installTranslator( _qtTranslations );
158 
159  if ( qApp->layoutDirection() == Qt::RightToLeft )
160  YApplication::setReverseLayout( true );
161  }
162 }
163 
164 
165 void
166 YQApplication::setLayoutDirection( const std::string & language )
167 {
168  QString lang( language.c_str() );
169 
170  // Force reverse layout for Arabic and Hebrew
171 
172  if ( lang.startsWith( "ar" ) || // Arabic
173  lang.startsWith( "he" ) ) // Hebrew
174  {
175  yuiMilestone() << "Using reverse layout for " << language << std::endl;
176 
177  qApp->setLayoutDirection( Qt::RightToLeft );
178  YApplication::setReverseLayout( true );
179  }
180  else
181  {
182  qApp->setLayoutDirection( Qt::LeftToRight );
183  YApplication::setReverseLayout( false );
184  }
185 
186  // Qt tries to figure that out by having translators translate a message
187  // "QT_LAYOUT_DIRECTION" to "RTL" for right-to-left languages (i.e.,
188  // Arabic, Hebrew) with QQapplication::tr(). This of course only works if
189  // there are translations for those languages for QTranslator in the first
190  // place, i.e. it only works if translations for the predefined Qt dialogs
191  // (file selection dialog etc.) are available - and being loaded.
192  //
193  // libqt4-x11 contains Arabic translations for those Qt standard dialogs in
194  // /usr/share/qt4/translations/qt_ar.qm, but (as of Sept. 2008) no Hebrew
195  // translations.
196  //
197  // Anyway, that Qt standard way is not very reliable. And they only do it
198  // at program startup anyway. Any later loading of those translations will
199  // not help.
200 }
201 
202 
203 void
204 YQApplication::setLangFonts( const std::string & language, const std::string & encoding )
205 {
206  if ( ! _langFonts )
207  {
208  // FIXME, LANG_FONTS_FILE is defined in the generic interface,
209  // in yui/Libyui_config.h
210  _langFonts = new QSettings( LANG_FONTS_FILE, QSettings::IniFormat );
211  Q_CHECK_PTR( _langFonts );
212 
213  if ( _langFonts->status() != QSettings::NoError )
214  yuiError() << "Error reading " << _langFonts->fileName() << std::endl;
215  else
216  yuiMilestone() << _langFonts->fileName() << " read OK"
217  << qPrintable( _langFonts->allKeys().join( "-" ) )
218  << std::endl;
219  }
220 
221  QString lang = language.c_str();
222 
223  if ( ! encoding.empty() )
224  lang += QString( "." ) + encoding.c_str();
225 
226  QString key;
227  bool reloadFont = false;
228 
229  if ( ! _langFonts->contains( fontKey( lang ) ) ) // Try with encoding ("zh_CN.UTF8" etc.)
230  {
231  lang = language.c_str(); // Try without encoding ("zh_CN")
232 
233  if ( ! _langFonts->contains( fontKey( lang ) ) )
234  lang.replace( QRegExp( "_.*$" ), "" ); // Cut off trailing country ("_CN")
235  }
236 
237  if ( _langFonts->contains( fontKey( lang ) ) )
238  {
239  QStringList fontList =
240  _langFonts->value( fontKey( lang ), "" ).toString().split( "," );
241  for ( int i = 0; i < fontList.size(); ++i )
242  {
243  yuiMilestone() << fontKey( lang ) << " adding " << fontList.at( i ) << std::endl;
244  QFontDatabase::addApplicationFont( fontList.at( i ) );
245  }
246 
247  reloadFont = true;
248  }
249 
250  if ( _fontFamily.isEmpty() ) {
251  _fontFamily = default_font_family;
252  reloadFont = true;
253  }
254 
255  if (reloadFont) {
256 
257  yuiMilestone() << "Reloading fonts" << std::endl;
258 
259  // update fonts
260  deleteFonts();
261 
262  foreach ( QWidget *widget, QApplication::allWidgets() )
263  {
264  QFont wfont( widget->font() );
265  wfont.setFamily( _fontFamily );
266  widget->setFont( wfont );
267  }
268  QFont font( qApp->font() );
269  font.setFamily( _fontFamily );
270  qApp->setFont(font); // font, informWidgets
271 
272  yuiMilestone() << "Removing the key " << lang << std::endl;
273  _langFonts->remove( fontKey( lang ) );
274  }
275  else
276  {
277  yuiDebug() << "No font change" << std::endl;
278  }
279 
280 }
281 
282 
283 QString
284 YQApplication::fontKey( const QString & lang )
285 {
286  if ( lang.isEmpty() )
287  return "font";
288  else
289  return QString( "font[%1]").arg( lang );
290 }
291 
292 
293 const QFont &
295 {
296  /**
297  * Brute force approach to make sure we'll really get a complete Unicode font:
298  * Explicitly load the one font that we made sure to contain all required
299  * characters, including Latin1, Latin2, Japanese, Korean, and the
300  * characters used for glyphs.
301  *
302  * There are many fonts that claim to be Unicode, but most of them contain
303  * just a sorry excuse for a complete Unicode character set. Qt can't know
304  * how complete a font is, so it chooses one that might be better in otherf
305  * aspects, but lacks necessary characters.
306  **/
307 
308  if ( ! _currentFont )
309  {
310  if ( autoFonts() )
311  {
312  pickAutoFonts();
313 
314  _currentFont = new QFont( _fontFamily );
315  _currentFont->setPixelSize( _autoNormalFontSize );
316  _currentFont->setWeight( QFont::Normal );
317 
318  yuiMilestone() << "Loaded " << _autoNormalFontSize
319  << " pixel font: " << _currentFont->toString()
320  << std::endl;
321 
322  qApp->setFont( * _currentFont); // font, informWidgets
323  }
324  else
325  {
326  // yuiDebug() << "Copying QApplication::font()" << std::endl;
327  _currentFont = new QFont( qApp->font() );
328  }
329  }
330 
331  return * _currentFont;
332 }
333 
334 
335 const QFont &
337 {
338  if ( ! _boldFont )
339  {
340  _boldFont = new QFont( currentFont() );
341  _boldFont->setBold( true );
342  }
343 
344  return * _boldFont;
345 }
346 
347 
348 const QFont &
350 {
351  /**
352  * Brute force load the heading font - see currentFont() above for more.
353  **/
354 
355  if ( ! _headingFont )
356  {
357  if ( autoFonts() )
358  {
359  pickAutoFonts();
360 
361  _headingFont = new QFont( _fontFamily );
362  _headingFont->setPixelSize( _autoHeadingFontSize );
363  _headingFont->setWeight( QFont::Bold );
364 
365  yuiMilestone() << "Loaded " << _autoHeadingFontSize
366  << " pixel bold font: " << _headingFont->toString()
367  << std::endl;
368  }
369  else
370  {
371  _headingFont = new QFont( _fontFamily, 14, QFont::Bold );
372  }
373  }
374 
375  return * _headingFont;
376 }
377 
378 
379 void
381 {
382  delete _currentFont;
383  delete _headingFont;
384  delete _boldFont;
385 
386  _currentFont = 0;
387  _headingFont = 0;
388  _boldFont = 0;
389 }
390 
391 
392 void
393 YQApplication::setAutoFonts( bool useAutoFonts )
394 {
395  _autoFonts = useAutoFonts;
396 }
397 
398 
399 void
401 {
402  if ( _autoNormalFontSize >= 0 ) // Use cached values
403  return;
404 
405  int x = defaultWidth();
406  int y = defaultHeight();
407 
408  int normal = 10;
409  int heading = 12;
410 
411  if ( x >= 800 && y >= 600 )
412  {
413  normal = 10;
414  heading = 12;
415  }
416 
417  if ( x >= 1024 && y >= 768 )
418  {
419  normal = 12;
420  heading = 14;
421  }
422 
423  if ( x >= 1280 && y >= 1024 )
424  {
425  normal = 14;
426  heading = 18;
427  }
428 
429  if ( x >= 1400 )
430  {
431  normal = 16;
432  heading = 20;
433  }
434 
435  if ( x >= 1600 )
436  {
437  normal = 18;
438  heading = 24;
439  }
440 
441  if ( x >= 2048 ) // Sounds futuristic? Just wait one or two years...
442  {
443  normal = 20;
444  heading = 28;
445  }
446 
447  _autoNormalFontSize = normal;
448  _autoHeadingFontSize = heading;
449 
450  yuiMilestone() << "Selecting auto fonts - normal: " << _autoNormalFontSize
451  << ", heading: " << _autoHeadingFontSize << " (bold)"
452  << std::endl;
453 }
454 
455 
456 string
457 YQApplication::glyph( const std::string & sym )
458 {
459  QChar unicodeChar;
460 
461  // Hint: Use the 'xfd' program to view characters available in the Unicode font.
462 
463  if ( sym == YUIGlyph_ArrowLeft ) unicodeChar = QChar( reverseLayout() ? 0x2192 : 0x2190 );
464  else if ( sym == YUIGlyph_ArrowRight ) unicodeChar = QChar( reverseLayout() ? 0x2190 : 0x2192 );
465  else if ( sym == YUIGlyph_ArrowUp ) unicodeChar = QChar( 0x2191 );
466  else if ( sym == YUIGlyph_ArrowDown ) unicodeChar = QChar( 0x2193 );
467  else if ( sym == YUIGlyph_CheckMark ) unicodeChar = QChar( 0x2714 );
468  else if ( sym == YUIGlyph_BulletArrowRight ) unicodeChar = QChar( 0x279c );
469  else if ( sym == YUIGlyph_BulletCircle ) unicodeChar = QChar( 0x274d );
470  else if ( sym == YUIGlyph_BulletSquare ) unicodeChar = QChar( 0x274f );
471  else return "";
472 
473  return toUTF8( QString( unicodeChar ) );
474 }
475 
476 
477 string
478 YQApplication::askForExistingDirectory( const std::string & startDir,
479  const std::string & headline )
480 {
481  normalCursor();
482 
483  QString dirName =
484  QFileDialog::getExistingDirectory( 0, // parent
485  fromUTF8( headline ) , // caption
486  fromUTF8( startDir ), QFileDialog::DontUseNativeDialog); // dir
487 
488  busyCursor();
489 
490  return toUTF8( dirName );
491 }
492 
493 
494 string
495 YQApplication::askForExistingFile( const std::string & startWith,
496  const std::string & filter,
497  const std::string & headline )
498 {
499  normalCursor();
500 
501  QFileDialog* dialog = new QFileDialog( 0, // parent
502  fromUTF8( headline ), // caption
503  fromUTF8( startWith ), // dir
504  fromUTF8( filter )); // filter
505  dialog->setFileMode( QFileDialog::ExistingFile );
506  dialog->setFilter( QDir::System | dialog->filter() );
507  dialog->setOptions( QFileDialog::DontUseNativeDialog );
508 
509  QString fileName;
510  if( dialog->exec() == QDialog::Accepted )
511  fileName = dialog->selectedFiles().value( 0 );
512  delete dialog;
513 
514  busyCursor();
515 
516  return toUTF8( fileName );
517 }
518 
519 
520 string
521 YQApplication::askForSaveFileName( const std::string & startWith,
522  const std::string & filter,
523  const std::string & headline )
524 {
525  normalCursor();
526 
527  QString fileName = askForSaveFileName( fromUTF8( startWith ),
528  fromUTF8( filter ),
529  fromUTF8( headline ) );
530  busyCursor();
531 
532  return toUTF8( fileName );
533 }
534 
535 
536 bool
537 YQApplication::openContextMenu( const YItemCollection & itemCollection )
538 {
539  QWidget* parent = 0;
540  YDialog * currentDialog = YDialog::currentDialog( false );
541  if (currentDialog)
542  parent = (QWidget *) currentDialog->widgetRep();
543 
544  YQContextMenu* menu = new YQContextMenu(parent, _contextMenuPos );
545  menu->addItems(itemCollection);
546 
547  return true;
548 }
549 
550 
551 QString
552 YQApplication::askForSaveFileName( const QString & startWith,
553  const QString & filter,
554  const QString & headline )
555 {
556  QString fileName;
557 
558  QWidget* parent = 0;
559  YDialog * currentDialog = YDialog::currentDialog( false );
560  if (currentDialog)
561  parent = (QWidget *) currentDialog->widgetRep();
562 
563 
564  // Leave the mouse cursor alone - this function might be called from
565  // some other widget, not only from UI::AskForSaveFileName().
566 
567  fileName = QFileDialog::getSaveFileName( parent, // parent
568  headline, // caption
569  startWith, // dir
570  filter, 0, QFileDialog::DontUseNativeDialog ); // filter
571 
572  if ( fileName.isEmpty() ) // this includes fileName.isNull()
573  return QString::null;
574 
575  return fileName;
576 }
577 
578 
579 int
580 YQApplication::displayWidth()
581 {
582  return qApp->desktop()->width();
583 }
584 
585 
586 int
587 YQApplication::displayHeight()
588 {
589  return qApp->desktop()->height();
590 }
591 
592 
593 int
594 YQApplication::displayDepth()
595 {
596  return qApp->desktop()->depth();
597 }
598 
599 
600 long
601 YQApplication::displayColors()
602 {
603  return 1L << qApp->desktop()->depth();
604 }
605 
606 
607 int
608 YQApplication::defaultWidth()
609 {
610  return YQUI::ui()->defaultSize( YD_HORIZ );
611 }
612 
613 
614 int
615 YQApplication::defaultHeight()
616 {
617  return YQUI::ui()->defaultSize( YD_VERT );
618 }
619 
620 
621 bool
622 YQApplication::leftHandedMouse()
623 {
624  return _leftHandedMouse;
625 }
626 
627 
628 void
630 {
631  if ( _askedForLeftHandedMouse )
632  return;
633 
634  QString message =
635  _( "You clicked the right mouse button "
636  "where a left-click was expected."
637  "\n"
638  "Switch left and right mouse buttons?"
639  );
640 
641  QWidget* parent = 0;
642  YDialog * currentDialog = YDialog::currentDialog( false );
643  if (currentDialog)
644  parent = (QWidget *) currentDialog->widgetRep();
645 
646  int button = QMessageBox::question( parent,
647  // Popup dialog caption
648  _( "Unexpected Click" ),
649  message,
650  QMessageBox::Yes | QMessageBox::Default,
651  QMessageBox::No,
652  QMessageBox::Cancel | QMessageBox::Escape );
653 
654  if ( button == QMessageBox::Yes )
655  {
656  int result;
657  const char * command =
658  _leftHandedMouse ?
659  "xmodmap -e \"pointer = 1 2 3\"": // switch back to right-handed mouse
660  "xmodmap -e \"pointer = 3 2 1\""; // switch to left-handed mouse
661 
662  _leftHandedMouse = ! _leftHandedMouse; // might be set repeatedly!
663  _askedForLeftHandedMouse = false; // give the user a chance to switch back
664  yuiMilestone() << "Switching mouse buttons: " << command << std::endl;
665 
666  result = system( command );
667  if (result < 0)
668  yuiError() << "Calling '" << command << "' failed" << std::endl;
669  else if (result > 0)
670  yuiError() << "Running '" << command << "' exited with " << result << std::endl;
671  }
672  else if ( button == 1 ) // No
673  {
674  _askedForLeftHandedMouse = true;
675  }
676 }
677 
678 
679 int YQApplication::deviceUnits( YUIDimension dim, float layoutUnits )
680 {
681  if ( dim==YD_HORIZ ) layoutUnits *= ( 640.0/80 );
682  else layoutUnits *= ( 480.0/25 );
683 
684  return (int) ( layoutUnits + 0.5 );
685 }
686 
687 
688 float YQApplication::layoutUnits( YUIDimension dim, int deviceUnits )
689 {
690  float size = (float) deviceUnits;
691 
692  if ( dim==YD_HORIZ ) size *= ( 80/640.0 );
693  else size *= ( 25/480.0 );
694 
695  return size;
696 }
697 
698 
700 {
701  qApp->beep();
702 }
703 
704 
706 {
707  YQUI::ui()->busyCursor();
708 }
709 
710 
712 {
713  YQUI::ui()->normalCursor();
714 }
715 
716 
717 void YQApplication::makeScreenShot( const std::string & fileName )
718 {
719  YQUI::ui()->makeScreenShot( fileName );
720 }
721 
722 
725 {
726  static YQPackageSelectorPluginStub * plugin = 0;
727 
728  if ( ! plugin )
729  {
730  plugin = new YQPackageSelectorPluginStub();
731 
732  // This is a deliberate memory leak: If an application requires a
733  // PackageSelector, it is a package selection application by
734  // definition. In this case, the ncurses_pkg plugin is intentionally
735  // kept open to avoid repeated start-up cost of the plugin and libzypp.
736  }
737 
738  return plugin;
739 }
740 
741 
744 {
745  static YQGraphPluginStub * plugin = 0;
746 
747  if ( ! plugin )
748  {
749  plugin = new YQGraphPluginStub();
750 
751  // This is a deliberate memory leak: Plugin is intentionally
752  // kept open to avoid repeated start-up cost of the plugin.
753  }
754 
755  return plugin;
756 }
757 
758 void
759 YQApplication::setContextMenuPos( QPoint contextMenuPos )
760 {
761  _contextMenuPos = contextMenuPos;
762 }
763 
764 void YQApplication::setApplicationTitle ( const string& title )
765 {
766  QString qtTitle = fromUTF8( title );
767  YApplication::setApplicationTitle ( title );
768  YQUI::ui()->setApplicationTitle(qtTitle);
769  qApp->setApplicationName(qtTitle);
770 }
771 
772 void YQApplication::setApplicationIcon ( const string& icon )
773 {
774  QString qtIcon = fromUTF8( icon );
775  YApplication::setApplicationIcon ( icon );
776  QPixmap pixmap (qtIcon);
777  if ( !pixmap.isNull() )
778  qApp->setWindowIcon ( QIcon ( pixmap ) );
779 }
780 
781 #include "YQApplication.moc"
int defaultSize(YUIDimension dim) const
Returns size for opt(defaultsize) dialogs (in one dimension).
Definition: YQUI.cc:575
virtual void normalCursor()
Change the (mouse) cursor back from busy status to normal.
virtual int deviceUnits(YUIDimension dim, float layoutUnits)
Convert logical layout spacing units into device dependent units.
virtual std::string glyph(const std::string &glyphSymbolName)
Return a std::string for a named glyph.
void setLayoutDirection(const std::string &language)
Set the layout direction (left-to-right or right-to-left) from &#39;language&#39;.
void maybeLeftHandedUser()
A mouse click with the wrong mouse button was detected - e.g., a right click on a push button...
virtual QPoint contextMenuPos()
Return position of the context menu (in gloabl coordinates)
virtual ~YQApplication()
Destructor.
void setApplicationTitle(const QString &title)
Sets the application name for the window title.
Definition: YQUI.h:287
virtual void setApplicationTitle(const std::string &title)
Set the application title.
virtual void busyCursor()
Change the (mouse) cursor to indicate busy status.
QSettings * _langFonts
Language-specific font settings.
virtual void beep()
Beep.
void makeScreenShot(std::string filename)
Make a screen shot in .png format and save it to &#39;filename&#39;.
void setAutoFonts(bool useAutoFonts)
Set whether or not fonts should automatically be picked.
void setLangFonts(const std::string &language, const std::string &encoding=std::string())
Set fonts according to the specified language and encoding.
void deleteFonts()
Delete the fonts so they will be reloaded upon their next usage.
QTranslator * _qtTranslations
Translator for the predefined Qt dialogs.
virtual bool openContextMenu(const YItemCollection &itemCollection)
Open a context menu for a widget.
QString fontKey(const QString &lang)
Constructs a key for the language specific font file: "font[lang]" for font[de_DE] = "Sans Serif" fon...
static YQGraphPluginStub * graphPlugin()
Return the package selector plugin singleton or creates it (including loading the plugin lib) if it d...
virtual void setContextMenuPos(QPoint contextMenuPos)
Sets the position of the context menu (in gloabl coordinates)
virtual void setApplicationIcon(const std::string &icon)
Set the application Icon.
virtual void makeScreenShot(const std::string &fileName)
Make a screen shot and save it to the specified file.
const QFont & headingFont()
Returns the application&#39;s heading font.
bool autoFonts() const
Returns &#39;true&#39; if the UI automatically picks fonts, disregarding Qt standard settings.
QString _fontFamily
Font family or list of font families to use ("Sans Serif" etc.)
YQApplication()
Constructor.
virtual std::string askForExistingDirectory(const std::string &startDir, const std::string &headline)
Open a directory selection box and prompt the user for an existing directory.
virtual std::string askForSaveFileName(const std::string &startWith, const std::string &filter, const std::string &headline)
Open a file selection box and prompt the user for a file to save data to.
void busyCursor()
Show mouse cursor indicating busy state.
Definition: YQUI.cc:550
virtual void setLanguage(const std::string &language, const std::string &encoding=std::string())
Set language and encoding for the locale environment ($LANG).
virtual float layoutUnits(YUIDimension dim, int deviceUnits)
Convert device dependent units into logical layout spacing units.
const QFont & boldFont()
Returns the application&#39;s default bold font.
void loadPredefinedQtTranslations()
Load translations for Qt&#39;s predefined dialogs like file selection box etc.
void normalCursor()
Show normal mouse cursor not indicating busy status.
Definition: YQUI.cc:556
void pickAutoFonts()
Determine good fonts based on defaultsize geometry and set _auto_normal_font_size and _auto_heading_f...
static YQPackageSelectorPluginStub * packageSelectorPlugin()
Return the package selector plugin singleton or creates it (including loading the plugin lib) if it d...
static YQUI * ui()
Access the global Qt-UI.
Definition: YQUI.h:80
const QFont & currentFont()
Returns the application&#39;s default font.
virtual std::string askForExistingFile(const std::string &startWith, const std::string &filter, const std::string &headline)
Open a file selection box and prompt the user for an existing file.