src/hbcore/inputfw/hbinpututils.cpp
changeset 34 ed14f46c0e55
parent 6 c3690ec91ef8
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    46 #define HB_DIGIT_ARABIC_INDIC_START_VALUE   0x0660
    46 #define HB_DIGIT_ARABIC_INDIC_START_VALUE   0x0660
    47 #define HB_DIGIT_EASTERN_ARABIC_START_VALUE 0x06F0
    47 #define HB_DIGIT_EASTERN_ARABIC_START_VALUE 0x06F0
    48 
    48 
    49 
    49 
    50 /*!
    50 /*!
       
    51 @stable
       
    52 @hbcore
    51 \class HbInputUtils
    53 \class HbInputUtils
    52 \brief A collection input related utility methods.
    54 \brief The HbInputUtils class is a collection of input related utility functions.
    53 
    55 
    54 This class contains a collection of static input related utility methods that do not
    56 This class contains a collection of static input related utility functions
    55 naturally belong to any other scope. There are convenience methods for testing
    57 that do not naturally belong to any other scope. There are convenience functions
    56 attributes of keyboard and input mode types, instantiating plugins etc.
    58 for testing keyboard attributes and input mode types, instantiating plugins, and so on.
    57 
    59 
    58 \sa HbInputMethod
    60 \sa HbInputMethod
    59 \sa QInputContextPlugin
    61 \sa QInputContextPlugin
    60 */
    62 */
    61 
    63 
    62 /*!
    64 /*!
    63 Finds the fist number character bound to key using given mapping data.
    65 Finds the first number character bound to \a key using the given mapping data.
    64 */
    66 */
    65 QChar HbInputUtils::findFirstNumberCharacterBoundToKey(const HbMappedKey *key,
    67 QChar HbInputUtils::findFirstNumberCharacterBoundToKey(const HbMappedKey *key,
    66         const HbInputLanguage language,
    68         const HbInputLanguage language,
    67         const HbInputDigitType digitType)
    69         const HbInputDigitType digitType)
    68 {
    70 {
   101 
   103 
   102     return 0;
   104     return 0;
   103 }
   105 }
   104 
   106 
   105 /*!
   107 /*!
   106 Returns true if the concept of "text case" can be applied to given input mode.
   108 Returns \c true if the concept of "text case" can be applied to \a inputMode.
   107 For example Chinese and Japanese modes do not have text case.
   109 For example Chinese and Japanese modes do not have text case.
   108 */
   110 */
   109 bool HbInputUtils::isCaseSensitiveMode(HbInputModeType inputMode)
   111 bool HbInputUtils::isCaseSensitiveMode(HbInputModeType inputMode)
   110 {
   112 {
   111     if (isChineseInputMode(inputMode)) {
   113     if (isChineseInputMode(inputMode)) {
   114 
   116 
   115     return true;
   117     return true;
   116 }
   118 }
   117 
   119 
   118 /*!
   120 /*!
   119 Lists all Qt library files in language database directory. May return
   121 Lists all %Qt library files in the language database directory. Can return
   120 files that are not language database plugins. languageDatabasePluginInstance()
   122 files that are not language database plugins. languageDatabasePluginInstance()
   121 checks the validity of plugin files provided by this function.
   123 checks the validity of plugin files provided by this function.
   122 
   124 
   123 \sa languageDatabasePluginInstance
   125 \sa languageDatabasePluginInstance
   124 */
   126 */
   136         }
   138         }
   137     }
   139     }
   138 }
   140 }
   139 
   141 
   140 /*!
   142 /*!
   141 Creates an instance of given language database plugin, if valid.
   143 Creates an instance of the given language database plugin, if valid.
   142 */
   144 */
   143 HbLanguageDatabaseInterface *HbInputUtils::languageDatabasePluginInstance(const QString &pluginFileName, const QString &subfolder)
   145 HbLanguageDatabaseInterface *HbInputUtils::languageDatabasePluginInstance(const QString &pluginFileName, const QString &subfolder)
   144 {
   146 {
   145     if (!QLibrary::isLibrary(pluginFileName)) {
   147     if (!QLibrary::isLibrary(pluginFileName)) {
   146         qDebug("HbInputUtils::languageDatabasePluginInstance: Not a library!");
   148         qDebug("HbInputUtils::languageDatabasePluginInstance: Not a library!");
   168 
   170 
   169     return res;
   171     return res;
   170 }
   172 }
   171 
   173 
   172 /*!
   174 /*!
   173 Lists all the input languages that the set of available input methods supports. Excludes custom input methods.
   175 Lists all the input languages supported by the set of available input methods. Excludes custom input methods.
   174 */
   176 */
   175 void HbInputUtils::listSupportedInputLanguages(QList<HbInputLanguage>& results)
   177 void HbInputUtils::listSupportedInputLanguages(QList<HbInputLanguage>& results)
   176 {
   178 {
   177     results = HbInputModeCache::instance()->listInputLanguages();
   179     results = HbInputModeCache::instance()->listInputLanguages();
   178 }
   180 }
   179 
   181 
   180 /*!
   182 /*!
   181 This method creates an instance of QWidget and wraps given graphics widget inside it.
   183 This function creates a QWidget instance and wraps the given graphics widget
   182 It creates QGraphicsScene, adds given widget there and creates a view to the scene
   184 inside it. It creates a QGraphicsScene object, adds \a graphicsWidget there,
   183 inside returned QWidget. This is utility method is mainly for internal use.
   185 and creates a view to the scene inside the returned %QWidget. This utility
       
   186 function is mainly for the internal use of the input framework.
   184 */
   187 */
   185 QWidget *HbInputUtils::createWrapperWidget(QGraphicsWidget *graphicsWidget)
   188 QWidget *HbInputUtils::createWrapperWidget(QGraphicsWidget *graphicsWidget)
   186 {
   189 {
   187     QWidget *ret = 0;
   190     QWidget *ret = 0;
   188 
   191 
   202 
   205 
   203     return ret;
   206     return ret;
   204 }
   207 }
   205 
   208 
   206 /*!
   209 /*!
   207 A convenience method that wraps given widget inside QGraphicsProxyWidget
   210 A convenience function that wraps the given widget inside a QGraphicsProxyWidget
   208 and returns it. This is utility method is mainly for internal use.
   211 and returns it. This utility method is mainly for the internal use of the input
       
   212 framework.
   209 */
   213 */
   210 QGraphicsWidget *HbInputUtils::createGraphicsProxyWidget(QWidget *widget)
   214 QGraphicsWidget *HbInputUtils::createGraphicsProxyWidget(QWidget *widget)
   211 {
   215 {
   212 
   216 
   213     QGraphicsProxyWidget *proxy = 0;
   217     QGraphicsProxyWidget *proxy = 0;
   219 
   223 
   220     return proxy;
   224     return proxy;
   221 }
   225 }
   222 
   226 
   223 /*!
   227 /*!
   224 returns the input digit type for the given input language
   228 Returns the input digit type for the given input language.
   225 */
   229 */
   226 
   230 
   227 HbInputDigitType HbInputUtils::inputDigitType(HbInputLanguage language)
   231 HbInputDigitType HbInputUtils::inputDigitType(HbInputLanguage language)
   228 {
   232 {
   229     HbInputDigitType digitType = HbDigitTypeNone;
   233     HbInputDigitType digitType = HbDigitTypeNone;
   246     return digitType;
   250     return digitType;
   247 }
   251 }
   248 
   252 
   249 
   253 
   250 /*!
   254 /*!
   251 Returns the proxy widget of the embedded widget in a graphics view ;
   255 Returns the proxy widget of the embedded widget in a graphics view.
   252 if widget does not have the proxy widget then it returns the proxy widget of its window.
   256 If the widget does not have a proxy widget it returns the proxy widget of its window.
   253  otherwise returns 0.
   257 Otherwise returns 0.
   254 */
   258 */
   255 QGraphicsProxyWidget *HbInputUtils::graphicsProxyWidget(const QWidget *w)
   259 QGraphicsProxyWidget *HbInputUtils::graphicsProxyWidget(const QWidget *w)
   256 {
   260 {
   257     QGraphicsProxyWidget *pw = w ? w->graphicsProxyWidget() : 0;
   261     QGraphicsProxyWidget *pw = w ? w->graphicsProxyWidget() : 0;
   258     if (w && !pw) {
   262     if (w && !pw) {
   259         pw = w->window() ? w->window()->graphicsProxyWidget() : w->graphicsProxyWidget();
   263         pw = w->window() ? w->window()->graphicsProxyWidget() : w->graphicsProxyWidget();
   260     }
   264     }
   261     return pw;
   265     return pw;
   262 }
   266 }
   263 
   267 
       
   268 /*!
       
   269 \fn bool HbInputUtils::isChineseInputMode(HbInputModeType inputMode)
       
   270 Returns \c true if \a inputMode is the Chinese input mode.
       
   271 */
       
   272 
       
   273 /*!
       
   274 \fn bool HbInputUtils::isQwertyKeyboard(HbKeyboardType keyboardType)
       
   275 Returns \c true if \a keyboardType is a QWERTY keyboard type.
       
   276 */
       
   277 
       
   278 /*!
       
   279 \fn bool HbInputUtils::isTouchKeyboard(HbKeyboardType keyboardType)
       
   280 Returns \c true if \a keyboardType is a virtual keyboard type.
       
   281 */
   264 
   282 
   265 // End of file
   283 // End of file
   266 
   284