author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kglobal.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | microkde/kglobal.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp index 53edd08..9cc5835 100644 --- a/microkde/kglobal.cpp +++ b/microkde/kglobal.cpp @@ -1,112 +1,113 @@ #include "kglobal.h" #include "kstandarddirs.h" -#include <qkeycode.h> +#include <qnamespace.h> #include <qapplication.h> +#include <QDesktopWidget> KLocale *KGlobal::mLocale = 0; KConfig *KGlobal::mConfig = 0; KIconLoader *KGlobal::mIconLoader = 0; KStandardDirs *KGlobal::mDirs = 0; QString KGlobal::mAppName = "godot"; KLocale *KGlobal::locale() { if ( !mLocale ) { - ASSERT(mAppName); + Q_ASSERT(!mAppName.isEmpty()); mLocale = new KLocale();//mAppName); } return mLocale; } //US void KGlobal::setLocale(KLocale *kg) { mLocale = kg; } KConfig *KGlobal::config() { //mConfig is set inside setAppName. Though it has to be the first function you call. return mConfig; } KGlobal::Size KGlobal::getDesktopSize() { #ifdef DESKTOP_VERSION return KGlobal::Desktop; #else if ( QApplication::desktop()->width() <= 320 ) return KGlobal::Small; else if ( QApplication::desktop()->width() > 480) return KGlobal::Desktop; else return KGlobal::Medium; #endif } KGlobal::Orientation KGlobal::getOrientation() { if (QApplication::desktop()->width() > QApplication::desktop()->height()) return KGlobal::Landscape; else return KGlobal::Portrait; } int KGlobal::getDesktopWidth() { return QApplication::desktop()->width(); } int KGlobal::getDesktopHeight() { return QApplication::desktop()->height(); } KIconLoader *KGlobal::iconLoader() { if ( !mIconLoader ) { mIconLoader = new KIconLoader(); } return mIconLoader; } KStandardDirs *KGlobal::dirs() { if ( !mDirs ) { mDirs = new KStandardDirs(); } return mDirs; } void KGlobal::setAppName( const QString &appName ) { mAppName = appName; mConfig = new KConfig( locateLocal("config", mAppName + "rc" ) ); } //US QString KGlobal::getAppName() { return mAppName; } QString KGlobal::formatMessage ( QString mess, int maxlen ) { //int maxlen = 80; if ( maxlen == 0 ) { maxlen = QApplication::desktop()->width()/10; if ( maxlen > 32 ) maxlen = (maxlen * 3) / 4; if ( maxlen > 100 ) maxlen = 100; } int start = 0; int end = mess.length(); QString retVal = ""; int nl, space; |