@ -12,124 +12,111 @@
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
*/
# ifndef UBPLATFORMUTILS_H_
# ifndef UBPLATFORMUTILS_H_
# define UBPLATFORMUTILS_H_
# define UBPLATFORMUTILS_H_
# include <QtCore>
# include <QtCore>
# include <QIcon>
# include <QIcon>
class QMainWindow ;
class QMainWindow ;
# define SYMBOL_KEYS_COUNT 47
# define SYMBOL_KEYS_COUNT 47
struct KEYBT
struct KEYBT
{
{
const QChar symbol1 ;
const QChar symbol1 ;
const int code1 ;
const int code1 ;
const QChar symbol2 ;
const QChar symbol2 ;
const int code2 ;
const int code2 ;
KEYBT ( unsigned int _symbol1 ,
KEYBT ( unsigned int _symbol1 ,
unsigned int _symbol2 ) :
unsigned int _symbol2 ) :
symbol1 ( _symbol1 ) ,
symbol1 ( _symbol1 ) ,
code1 ( _symbol1 ) ,
code1 ( _symbol1 ) ,
symbol2 ( _symbol2 ) ,
symbol2 ( _symbol2 ) ,
code2 ( _symbol2 ) { }
code2 ( _symbol2 ) { }
KEYBT ( QChar _symbol1 ,
KEYBT ( QChar _symbol1 ,
int _code1 ,
int _code1 ,
QChar _symbol2 ,
QChar _symbol2 ,
int _code2 ) :
int _code2 ) :
symbol1 ( _symbol1 ) ,
symbol1 ( _symbol1 ) ,
code1 ( _code1 ) ,
code1 ( _code1 ) ,
symbol2 ( _symbol2 ) ,
symbol2 ( _symbol2 ) ,
code2 ( _code2 ) { }
code2 ( _code2 ) { }
} ;
} ;
class UBKeyboardLocale
class UBKeyboardLocale
{
{
public :
public :
UBKeyboardLocale ( const QString & _fullName ,
UBKeyboardLocale ( const QString & _fullName ,
const QString & _name ,
const QString & _name ,
const QString & _id ,
const QString & _id ,
QIcon * _icon ,
QIcon * _icon ,
KEYBT * * _symbols )
KEYBT * * _symbols )
: fullName ( _fullName ) , name ( _name ) , id ( _id ) , icon ( _icon ) ,
: fullName ( _fullName ) , name ( _name ) , id ( _id ) , icon ( _icon ) ,
constSymbols ( NULL ) , varSymbols ( _symbols )
constSymbols ( NULL ) , varSymbols ( _symbols )
{ }
{ }
UBKeyboardLocale ( const QString & _fullName ,
UBKeyboardLocale ( const QString & _fullName ,
const QString & _name ,
const QString & _name ,
const QString & _id ,
const QString & _id ,
QIcon * _icon ,
QIcon * _icon ,
const KEYBT _symbols [ ] )
const KEYBT _symbols [ ] )
: fullName ( _fullName ) , name ( _name ) , id ( _id ) , icon ( _icon ) ,
: fullName ( _fullName ) , name ( _name ) , id ( _id ) , icon ( _icon ) ,
constSymbols ( _symbols ) , varSymbols ( NULL )
constSymbols ( _symbols ) , varSymbols ( NULL )
{ }
{ }
~ UBKeyboardLocale ( ) ;
~ UBKeyboardLocale ( ) ;
const QString fullName ;
const QString fullName ;
const QString name ;
const QString name ;
const QString id ;
const QString id ;
QIcon * icon ;
QIcon * icon ;
const KEYBT * operator [ ] ( int index ) const
const KEYBT * operator [ ] ( int index ) const
{
{
return ( varSymbols = = NULL ) ? constSymbols + index : varSymbols [ index ] ;
return ( varSymbols = = NULL ) ? constSymbols + index : varSymbols [ index ] ;
}
}
private :
private :
const KEYBT * constSymbols ;
const KEYBT * constSymbols ;
KEYBT * * varSymbols ;
KEYBT * * varSymbols ;
} ;
} ;
class UBPlatformUtils
class UBPlatformUtils
{
{
private :
private :
UBPlatformUtils ( ) ;
UBPlatformUtils ( ) ;
virtual ~ UBPlatformUtils ( ) ;
virtual ~ UBPlatformUtils ( ) ;
static void initializeKeyboardLayouts ( ) ;
static void initializeKeyboardLayouts ( ) ;
static void destroyKeyboardLayouts ( ) ;
static void destroyKeyboardLayouts ( ) ;
static int nKeyboardLayouts ;
static int nKeyboardLayouts ;
static UBKeyboardLocale * * keyboardLayouts ;
static UBKeyboardLocale * * keyboardLayouts ;
public :
public :
static void init ( ) ;
static void init ( ) ;
static void destroy ( ) ;
static void destroy ( ) ;
static QString applicationResourcesDirectory ( ) ;
static QString applicationResourcesDirectory ( ) ;
static void hideFile ( const QString & filePath ) ;
static void setFileType ( const QString & filePath , unsigned long fileType ) ;
static void hideFile ( const QString & filePath ) ;
static void fadeDisplayOut ( ) ;
static void setFileType ( const QString & filePath , unsigned long fileType ) ;
static void fadeDisplayIn ( ) ;
static QString preferredTranslation ( ) ;
static void fadeDisplayOut ( ) ;
static QString preferredLanguage ( ) ;
static void fadeDisplayIn ( ) ;
static bool hasVirtualKeyboard ( ) ;
//static void showVirtualKeyboard();
static QString preferredTranslation ( ) ;
static void runInstaller ( const QString & installerFilePath ) ;
static QString preferredLanguage ( ) ;
static void bringPreviousProcessToFront ( ) ;
static QString osUserLoginName ( ) ;
static bool hasVirtualKeyboard ( ) ;
static void setDesktopMode ( bool desktop ) ;
//static void showVirtualKeyboard();
static void setWindowNonActivableFlag ( QWidget * widget , bool nonAcivable ) ;
static QString computerName ( ) ;
static void runInstaller ( const QString & installerFilePath ) ;
static UBKeyboardLocale * * getKeyboardLayouts ( int & nCount ) ;
static QString urlFromClipboard ( ) ;
static void bringPreviousProcessToFront ( ) ;
} ;
static QString osUserLoginName ( ) ;
static void setDesktopMode ( bool desktop ) ;
# endif /* UBPLATFORMUTILS_H_ */
static void setWindowNonActivableFlag ( QWidget * widget , bool nonAcivable ) ;
static QString computerName ( ) ;
static UBKeyboardLocale * * getKeyboardLayouts ( int & nCount ) ;
} ;
# endif /* UBPLATFORMUTILS_H_ */