libyui-qt
Loading...
Searching...
No Matches
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
37class QSettings;
38class YQPackageSelectorPlugin;
39class YQGraphPlugin;
40class QMenu;
41
42
43class YQApplication: public QObject, public YApplication
44{
45 Q_OBJECT
46
47protected:
48
49 friend class YQUI;
50
57
61 virtual ~YQApplication();
62
63
64public:
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
228 virtual void askForWidgetStyle();
229
239 virtual bool openContextMenu ( const YItemCollection & itemCollection );
240
241
247
253
263 void maybeLeftHandedUser();
264
271 virtual int deviceUnits( YUIDimension dim, float layoutUnits );
272
279 virtual float layoutUnits( YUIDimension dim, int deviceUnits );
280
286 virtual void busyCursor();
287
293 virtual void normalCursor();
294
300 virtual void makeScreenShot( const std::string & fileName );
301
307 virtual void beep();
308
312 virtual QPoint contextMenuPos() { return _contextMenuPos; }
313
317 virtual void setContextMenuPos( QPoint contextMenuPos );
318
319 // Display information and UI capabilities.
320 //
321 // All implemented from YApplication.
322
323 virtual int displayWidth();
324 virtual int displayHeight();
325 virtual int displayDepth();
326 virtual long displayColors();
327
328 // Size of main dialogs
329 virtual int defaultWidth();
330 virtual int defaultHeight();
331
332 //
333 // UI capabilities
334 //
335
336 virtual bool isTextMode() { return false; }
337 virtual bool hasImageSupport() { return true; }
338 virtual bool hasIconSupport() { return true; }
339 virtual bool hasAnimationSupport() { return true; }
340 virtual bool hasFullUtf8Support() { return true; }
341 virtual bool richTextSupportsTable() { return true; }
342 virtual bool hasWizardDialogSupport() { return true; }
343 virtual bool hasWidgetStyleSupport() { return true; }
344 virtual bool leftHandedMouse();
345
351 virtual void setApplicationTitle(const std::string& title);
352
358 virtual void setApplicationIcon(const std::string& icon);
359protected:
360
370 QString fontKey( const QString & lang );
371
372
373 //
374 // Data members
375 //
376
377 // Fonts
378
379 QFont * _currentFont;
380 QFont * _headingFont;
381 QFont * _boldFont;
382
386 QString _fontFamily;
387
391 QSettings * _langFonts;
392
396 QTranslator * _qtTranslations;
397
398 //
399 // Misc
400 //
401
402 bool _autoFonts;
403 int _autoNormalFontSize;
404 int _autoHeadingFontSize;
405
406 bool _leftHandedMouse;
407 bool _askedForLeftHandedMouse;
408
409 QPoint _contextMenuPos;
410 QMenu* _contextMenu;
411
412
413};
414
415
416#endif // YQApplication_h
Definition YQApplication.h:44
virtual void setApplicationIcon(const std::string &icon)
Definition YQApplication.cc:793
void setAutoFonts(bool useAutoFonts)
Definition YQApplication.cc:414
static YQPackageSelectorPluginStub * packageSelectorPlugin()
Definition YQApplication.cc:742
void pickAutoFonts()
Definition YQApplication.cc:421
virtual bool openContextMenu(const YItemCollection &itemCollection)
Definition YQApplication.cc:593
virtual QPoint contextMenuPos()
Definition YQApplication.h:312
virtual void beep()
Definition YQApplication.cc:717
virtual std::string askForExistingFile(const std::string &startWith, const std::string &filter, const std::string &headline)
Definition YQApplication.cc:516
virtual void setLanguage(const std::string &language, const std::string &encoding=std::string())
Definition YQApplication.cc:119
virtual void setApplicationTitle(const std::string &title)
Definition YQApplication.cc:784
virtual std::string askForSaveFileName(const std::string &startWith, const std::string &filter, const std::string &headline)
virtual void normalCursor()
Definition YQApplication.cc:729
virtual std::string glyph(const std::string &glyphSymbolName)
Definition YQApplication.cc:478
QTranslator * _qtTranslations
Definition YQApplication.h:396
const QFont & boldFont()
Definition YQApplication.cc:357
YQApplication()
Definition YQApplication.cc:81
virtual ~YQApplication()
Definition YQApplication.cc:108
const QFont & currentFont()
Definition YQApplication.cc:315
virtual void setContextMenuPos(QPoint contextMenuPos)
Definition YQApplication.cc:778
void loadPredefinedQtTranslations()
Definition YQApplication.cc:141
virtual void askForWidgetStyle()
Definition YQApplication.cc:580
virtual int deviceUnits(YUIDimension dim, float layoutUnits)
Definition YQApplication.cc:697
QSettings * _langFonts
Definition YQApplication.h:391
static YQGraphPluginStub * graphPlugin()
Definition YQApplication.cc:761
virtual float layoutUnits(YUIDimension dim, int deviceUnits)
Definition YQApplication.cc:706
void maybeLeftHandedUser()
Definition YQApplication.cc:652
void setLayoutDirection(const std::string &language)
Definition YQApplication.cc:185
void deleteFonts()
Definition YQApplication.cc:401
virtual std::string askForExistingDirectory(const std::string &startDir, const std::string &headline)
Definition YQApplication.cc:499
virtual void makeScreenShot(const std::string &fileName)
Definition YQApplication.cc:735
QString _fontFamily
Definition YQApplication.h:386
virtual void busyCursor()
Definition YQApplication.cc:723
void setLangFonts(const std::string &language, const std::string &encoding=std::string())
Definition YQApplication.cc:225
QString fontKey(const QString &lang)
Definition YQApplication.cc:305
const QFont & headingFont()
Definition YQApplication.cc:370
bool autoFonts() const
Definition YQApplication.h:138
Definition YQGraphPluginStub.h:42
Definition YQPackageSelectorPluginStub.h:44
Definition YQUI.h:63