libyui-qt
YQApplication.h
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.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQApplication_h
27 #define YQApplication_h
28 
29 #include <qobject.h>
30 #include <qtranslator.h>
31 #include <qfont.h>
32 
33 #include "YQPackageSelectorPluginStub.h"
34 #include "YQGraphPluginStub.h"
35 #include <yui/YApplication.h>
36 
37 class QSettings;
38 class YQPackageSelectorPlugin;
39 class YQGraphPlugin;
40 class QMenu;
41 
42 
43 class YQApplication: public QObject, public YApplication
44 {
45  Q_OBJECT
46 
47 protected:
48 
49  friend class YQUI;
50 
56  YQApplication();
57 
61  virtual ~YQApplication();
62 
63 
64 public:
65 
79  virtual void setLanguage( const std::string & language,
80  const std::string & encoding = std::string() );
81 
87 
92  void setLayoutDirection( const std::string & language );
93 
100  void setLangFonts( const std::string & language,
101  const std::string & encoding = std::string() );
102 
106  const QFont & currentFont();
107 
111  const QFont & boldFont();
112 
116  const QFont & headingFont();
117 
121  void deleteFonts();
122 
128  void pickAutoFonts();
129 
138  bool autoFonts() const { return _autoFonts; }
139 
143  void setAutoFonts( bool useAutoFonts );
144 
152  virtual std::string glyph( const std::string & glyphSymbolName );
153 
168  virtual std::string askForExistingDirectory( const std::string & startDir,
169  const std::string & headline );
170 
187  virtual std::string askForExistingFile( const std::string & startWith,
188  const std::string & filter,
189  const std::string & headline );
190 
209  virtual std::string askForSaveFileName( const std::string & startWith,
210  const std::string & filter,
211  const std::string & headline );
216  static QString askForSaveFileName( const QString & startWith,
217  const QString & filter,
218  const QString & headline );
219 
229  virtual bool openContextMenu ( const YItemCollection & itemCollection );
230 
231 
237 
242  static YQGraphPluginStub * graphPlugin();
243 
253  void maybeLeftHandedUser();
254 
261  virtual int deviceUnits( YUIDimension dim, float layoutUnits );
262 
269  virtual float layoutUnits( YUIDimension dim, int deviceUnits );
270 
276  virtual void busyCursor();
277 
283  virtual void normalCursor();
284 
290  virtual void makeScreenShot( const std::string & fileName );
291 
297  virtual void beep();
298 
302  virtual QPoint contextMenuPos() { return _contextMenuPos; }
303 
307  virtual void setContextMenuPos( QPoint contextMenuPos );
308 
309  // Display information and UI capabilities.
310  //
311  // All implemented from YApplication.
312 
313  virtual int displayWidth();
314  virtual int displayHeight();
315  virtual int displayDepth();
316  virtual long displayColors();
317 
318  // Size of main dialogs
319  virtual int defaultWidth();
320  virtual int defaultHeight();
321 
322  //
323  // UI capabilities
324  //
325 
326  virtual bool isTextMode() { return false; }
327  virtual bool hasImageSupport() { return true; }
328  virtual bool hasIconSupport() { return true; }
329  virtual bool hasAnimationSupport() { return true; }
330  virtual bool hasFullUtf8Support() { return true; }
331  virtual bool richTextSupportsTable() { return true; }
332  virtual bool hasWizardDialogSupport() { return true; }
333  virtual bool leftHandedMouse();
334 
340  virtual void setApplicationTitle(const std::string& title);
341 
347  virtual void setApplicationIcon(const std::string& icon);
348 protected:
349 
359  QString fontKey( const QString & lang );
360 
361 
362  //
363  // Data members
364  //
365 
366  // Fonts
367 
368  QFont * _currentFont;
369  QFont * _headingFont;
370  QFont * _boldFont;
371 
375  QString _fontFamily;
376 
380  QSettings * _langFonts;
381 
385  QTranslator * _qtTranslations;
386 
387  //
388  // Misc
389  //
390 
391  bool _autoFonts;
392  int _autoNormalFontSize;
393  int _autoHeadingFontSize;
394 
395  bool _leftHandedMouse;
396  bool _askedForLeftHandedMouse;
397 
398  QPoint _contextMenuPos;
399  QMenu* _contextMenu;
400 
401 
402 };
403 
404 
405 #endif // YQApplication_h
virtual void normalCursor()
Definition: YQApplication.cc:731
virtual int deviceUnits(YUIDimension dim, float layoutUnits)
Definition: YQApplication.cc:699
virtual std::string glyph(const std::string &glyphSymbolName)
Definition: YQApplication.cc:476
void setLayoutDirection(const std::string &language)
Definition: YQApplication.cc:183
void maybeLeftHandedUser()
Definition: YQApplication.cc:649
virtual QPoint contextMenuPos()
Definition: YQApplication.h:302
virtual ~YQApplication()
Definition: YQApplication.cc:106
virtual void setApplicationTitle(const std::string &title)
Definition: YQApplication.cc:786
virtual std::string askForSaveFileName(const std::string &startWith, const std::string &filter, const std::string &headline)
virtual void busyCursor()
Definition: YQApplication.cc:725
QSettings * _langFonts
Definition: YQApplication.h:380
virtual void beep()
Definition: YQApplication.cc:719
void setAutoFonts(bool useAutoFonts)
Definition: YQApplication.cc:412
void setLangFonts(const std::string &language, const std::string &encoding=std::string())
Definition: YQApplication.cc:223
void deleteFonts()
Definition: YQApplication.cc:399
QTranslator * _qtTranslations
Definition: YQApplication.h:385
Definition: YQApplication.h:43
virtual bool openContextMenu(const YItemCollection &itemCollection)
Definition: YQApplication.cc:556
QString fontKey(const QString &lang)
Definition: YQApplication.cc:303
static YQGraphPluginStub * graphPlugin()
Definition: YQApplication.cc:763
virtual void setContextMenuPos(QPoint contextMenuPos)
Definition: YQApplication.cc:780
virtual void setApplicationIcon(const std::string &icon)
Definition: YQApplication.cc:795
virtual void makeScreenShot(const std::string &fileName)
Definition: YQApplication.cc:737
const QFont & headingFont()
Definition: YQApplication.cc:368
bool autoFonts() const
Definition: YQApplication.h:138
QString _fontFamily
Definition: YQApplication.h:375
YQApplication()
Definition: YQApplication.cc:79
virtual std::string askForExistingDirectory(const std::string &startDir, const std::string &headline)
Definition: YQApplication.cc:497
Definition: YQUI.h:62
virtual void setLanguage(const std::string &language, const std::string &encoding=std::string())
Definition: YQApplication.cc:117
virtual float layoutUnits(YUIDimension dim, int deviceUnits)
Definition: YQApplication.cc:708
const QFont & boldFont()
Definition: YQApplication.cc:355
void loadPredefinedQtTranslations()
Definition: YQApplication.cc:139
Definition: YQGraphPluginStub.h:41
void pickAutoFonts()
Definition: YQApplication.cc:419
static YQPackageSelectorPluginStub * packageSelectorPlugin()
Definition: YQApplication.cc:744
const QFont & currentFont()
Definition: YQApplication.cc:313
Definition: YQPackageSelectorPluginStub.h:43
virtual std::string askForExistingFile(const std::string &startWith, const std::string &filter, const std::string &headline)
Definition: YQApplication.cc:514