libyui-qt  2.49.2
YQApplication Class Reference
Inheritance diagram for YQApplication:
Collaboration diagram for YQApplication:

Public Member Functions

virtual void setLanguage (const std::string &language, const std::string &encoding=std::string())
 Set language and encoding for the locale environment ($LANG). More...
 
void loadPredefinedQtTranslations ()
 Load translations for Qt's predefined dialogs like file selection box etc.
 
void setLayoutDirection (const std::string &language)
 Set the layout direction (left-to-right or right-to-left) from 'language'.
 
void setLangFonts (const std::string &language, const std::string &encoding=std::string())
 Set fonts according to the specified language and encoding. More...
 
const QFont & currentFont ()
 Returns the application's default font. More...
 
const QFont & boldFont ()
 Returns the application's default bold font.
 
const QFont & headingFont ()
 Returns the application's heading font. More...
 
void deleteFonts ()
 Delete the fonts so they will be reloaded upon their next usage.
 
void pickAutoFonts ()
 Determine good fonts based on defaultsize geometry and set _auto_normal_font_size and _auto_heading_font_size accordingly. More...
 
bool autoFonts () const
 Returns 'true' if the UI automatically picks fonts, disregarding Qt standard settings. More...
 
void setAutoFonts (bool useAutoFonts)
 Set whether or not fonts should automatically be picked.
 
virtual std::string glyph (const std::string &glyphSymbolName)
 Return a std::string for a named glyph. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual bool openContextMenu (const YItemCollection &itemCollection)
 Open a context menu for a widget. More...
 
void maybeLeftHandedUser ()
 A mouse click with the wrong mouse button was detected - e.g., a right click on a push button. More...
 
virtual int deviceUnits (YUIDimension dim, float layoutUnits)
 Convert logical layout spacing units into device dependent units. More...
 
virtual float layoutUnits (YUIDimension dim, int deviceUnits)
 Convert device dependent units into logical layout spacing units. More...
 
virtual void busyCursor ()
 Change the (mouse) cursor to indicate busy status. More...
 
virtual void normalCursor ()
 Change the (mouse) cursor back from busy status to normal. More...
 
virtual void makeScreenShot (const std::string &fileName)
 Make a screen shot and save it to the specified file. More...
 
virtual void beep ()
 Beep. More...
 
virtual QPoint contextMenuPos ()
 Return position of the context menu (in gloabl coordinates)
 
virtual void setContextMenuPos (QPoint contextMenuPos)
 Sets the position of the context menu (in gloabl coordinates)
 
virtual int displayWidth ()
 
virtual int displayHeight ()
 
virtual int displayDepth ()
 
virtual long displayColors ()
 
virtual int defaultWidth ()
 
virtual int defaultHeight ()
 
virtual bool isTextMode ()
 
virtual bool hasImageSupport ()
 
virtual bool hasIconSupport ()
 
virtual bool hasAnimationSupport ()
 
virtual bool hasFullUtf8Support ()
 
virtual bool richTextSupportsTable ()
 
virtual bool hasWizardDialogSupport ()
 
virtual bool leftHandedMouse ()
 
virtual void setApplicationTitle (const std::string &title)
 Set the application title. More...
 
virtual void setApplicationIcon (const std::string &icon)
 Set the application Icon. More...
 

Static Public Member Functions

static QString askForSaveFileName (const QString &startWith, const QString &filter, const QString &headline)
 Lower-level version that works with QStrings and does not change the mouse cursor.
 
static YQPackageSelectorPluginStubpackageSelectorPlugin ()
 Return the package selector plugin singleton or creates it (including loading the plugin lib) if it does not exist yet.
 
static YQGraphPluginStubgraphPlugin ()
 Return the package selector plugin singleton or creates it (including loading the plugin lib) if it does not exist yet.
 

Protected Member Functions

 YQApplication ()
 Constructor. More...
 
virtual ~YQApplication ()
 Destructor.
 
QString fontKey (const QString &lang)
 Constructs a key for the language specific font file: "font[lang]" for font[de_DE] = "Sans Serif" font[zh] = "ChineseSpecial, something" font[ja_JP] = "JapaneseSpecial, something" font = "Sans Serif".
 

Protected Attributes

QFont * _currentFont
 
QFont * _headingFont
 
QFont * _boldFont
 
QString _fontFamily
 Font family or list of font families to use ("Sans Serif" etc.)
 
QSettings * _langFonts
 Language-specific font settings.
 
QTranslator * _qtTranslations
 Translator for the predefined Qt dialogs.
 
bool _autoFonts
 
int _autoNormalFontSize
 
int _autoHeadingFontSize
 
bool _leftHandedMouse
 
bool _askedForLeftHandedMouse
 
QPoint _contextMenuPos
 
QMenu * _contextMenu
 

Friends

class YQUI
 

Detailed Description

Definition at line 43 of file YQApplication.h.

Constructor & Destructor Documentation

◆ YQApplication()

YQApplication::YQApplication ( )
protected

Constructor.

Use YUI::app() to get the singleton for this class.

Definition at line 62 of file YQApplication.cc.

Here is the call graph for this function:

Member Function Documentation

◆ askForExistingDirectory()

string YQApplication::askForExistingDirectory ( const std::string &  startDir,
const std::string &  headline 
)
virtual

Open a directory selection box and prompt the user for an existing directory.

'startDir' is the initial directory that is displayed.

'headline' is an explanatory text for the directory selection box. Graphical UIs may omit that if no window manager is running.

Returns the selected directory name or an empty std::string if the user canceled the operation.

Implemented from YApplication.

Definition at line 478 of file YQApplication.cc.

Here is the call graph for this function:

◆ askForExistingFile()

string YQApplication::askForExistingFile ( const std::string &  startWith,
const std::string &  filter,
const std::string &  headline 
)
virtual

Open a file selection box and prompt the user for an existing file.

'startWith' is the initial directory or file.

'filter' is one or more blank-separated file patterns, e.g. "*.png *.jpg"

'headline' is an explanatory text for the file selection box. Graphical UIs may omit that if no window manager is running.

Returns the selected file name or an empty std::string if the user canceled the operation.

Implemented from YApplication.

Definition at line 495 of file YQApplication.cc.

Here is the call graph for this function:

◆ askForSaveFileName()

string YQApplication::askForSaveFileName ( const std::string &  startWith,
const std::string &  filter,
const std::string &  headline 
)
virtual

Open a file selection box and prompt the user for a file to save data to.

Automatically asks for confirmation if the user selects an existing file.

'startWith' is the initial directory or file.

'filter' is one or more blank-separated file patterns, e.g. "*.png *.jpg"

'headline' is an explanatory text for the file selection box. Graphical UIs may omit that if no window manager is running.

Returns the selected file name or an empty std::string if the user canceled the operation.

Implemented from YApplication.

Definition at line 521 of file YQApplication.cc.

Here is the call graph for this function:

◆ autoFonts()

bool YQApplication::autoFonts ( ) const
inline

Returns 'true' if the UI automatically picks fonts, disregarding Qt standard settings.

This makes sense during system installation system where the display DPI cannot reliably be retrieved and thus Qt uses random font sizes based on that random DPI.

Definition at line 138 of file YQApplication.h.

◆ beep()

void YQApplication::beep ( )
virtual

Beep.

Reimplemented from YApplication.

Definition at line 699 of file YQApplication.cc.

◆ busyCursor()

void YQApplication::busyCursor ( )
virtual

Change the (mouse) cursor to indicate busy status.

Reimplemented from YApplication.

Definition at line 705 of file YQApplication.cc.

Here is the call graph for this function:

◆ currentFont()

const QFont & YQApplication::currentFont ( )

Returns the application's default font.

Brute force approach to make sure we'll really get a complete Unicode font: Explicitly load the one font that we made sure to contain all required characters, including Latin1, Latin2, Japanese, Korean, and the characters used for glyphs.

There are many fonts that claim to be Unicode, but most of them contain just a sorry excuse for a complete Unicode character set. Qt can't know how complete a font is, so it chooses one that might be better in otherf aspects, but lacks necessary characters.

Definition at line 294 of file YQApplication.cc.

Here is the call graph for this function:

◆ deviceUnits()

int YQApplication::deviceUnits ( YUIDimension  dim,
float  layoutUnits 
)
virtual

Convert logical layout spacing units into device dependent units.

A default size dialog is assumed to be 80x25 layout spacing units.

Reimplemented from YApplication.

Definition at line 679 of file YQApplication.cc.

Here is the call graph for this function:

◆ glyph()

string YQApplication::glyph ( const std::string &  glyphSymbolName)
virtual

Return a std::string for a named glyph.

Using this is discouraged in new applications.

Reimplemented from YApplication.

Definition at line 457 of file YQApplication.cc.

◆ headingFont()

const QFont & YQApplication::headingFont ( )

Returns the application's heading font.

Brute force load the heading font - see currentFont() above for more.

Definition at line 349 of file YQApplication.cc.

Here is the call graph for this function:

◆ layoutUnits()

float YQApplication::layoutUnits ( YUIDimension  dim,
int  deviceUnits 
)
virtual

Convert device dependent units into logical layout spacing units.

A default size dialog is assumed to be 80x25 layout spacing units.

Reimplemented from YApplication.

Definition at line 688 of file YQApplication.cc.

Here is the call graph for this function:

◆ makeScreenShot()

void YQApplication::makeScreenShot ( const std::string &  fileName)
virtual

Make a screen shot and save it to the specified file.

Reimplemented from YApplication.

Definition at line 717 of file YQApplication.cc.

Here is the call graph for this function:

◆ maybeLeftHandedUser()

void YQApplication::maybeLeftHandedUser ( )

A mouse click with the wrong mouse button was detected - e.g., a right click on a push button.

The user might be left-handed, but his mouse might not (yet) be configured for left-handed use - e.g., during installation. Ask him if he would like his mouse temporarily configured as a left-handed mouse.

This status can be queried with YQApplication::leftHandedMouse().

Definition at line 629 of file YQApplication.cc.

◆ normalCursor()

void YQApplication::normalCursor ( )
virtual

Change the (mouse) cursor back from busy status to normal.

Reimplemented from YApplication.

Definition at line 711 of file YQApplication.cc.

Here is the call graph for this function:

◆ openContextMenu()

bool YQApplication::openContextMenu ( const YItemCollection &  itemCollection)
virtual

Open a context menu for a widget.

'itemCollection' describes the menu structure

Returns true on success (otherwise false).

Implemented from YApplication.

Definition at line 537 of file YQApplication.cc.

◆ pickAutoFonts()

void YQApplication::pickAutoFonts ( )

Determine good fonts based on defaultsize geometry and set _auto_normal_font_size and _auto_heading_font_size accordingly.

Caches the values, so it's safe to call this repeatedly.

Definition at line 400 of file YQApplication.cc.

◆ setApplicationIcon()

void YQApplication::setApplicationIcon ( const std::string &  icon)
virtual

Set the application Icon.

Reimplemented from YApplication.

Definition at line 772 of file YQApplication.cc.

◆ setApplicationTitle()

void YQApplication::setApplicationTitle ( const std::string &  title)
virtual

Set the application title.

Reimplemented from YApplication.

Definition at line 764 of file YQApplication.cc.

Here is the call graph for this function:

◆ setLangFonts()

void YQApplication::setLangFonts ( const std::string &  language,
const std::string &  encoding = std::string() 
)

Set fonts according to the specified language and encoding.

This is most important for some Asian languages that have overlaps in the Unicode table, like Japanese vs. Chinese.

Definition at line 204 of file YQApplication.cc.

Here is the call graph for this function:

◆ setLanguage()

void YQApplication::setLanguage ( const std::string &  language,
const std::string &  encoding = std::string() 
)
virtual

Set language and encoding for the locale environment ($LANG).

Load UI-internal translations (e.g. for predefined dialogs like file selection) and fonts.

'language' is the ISO short code ("de_DE", "en_US", ...).

'encoding' an (optional) encoding ("utf8", ...) that will be appended if present.

Reimplemented from YApplication.

Definition at line 100 of file YQApplication.cc.

Here is the call graph for this function:

The documentation for this class was generated from the following files: