[MeeGo-dev] Is this a reliable way for app to know it's running on MeeGo Tablet vs. Netbook?
Aflar
aflar at 163.com
Thu Sep 1 19:19:01 UTC 2011
--
Best regards!
Aflar Van
At 2011-08-29 12:58:31,"Niels Mayer" <nielsmayer at gmail.com> wrote:
>In order for a package to run reasonably on both netbook and tablet
>UX's, is the following Qt C++ a good way of determining whether an
>application is running on MeeGo Netbook or Tablet?
>
>+#ifdef Q_WS_MAEMO_5
>+ isMeegoTablet = false; // NPM
>+#elif defined(MEEGO_EDITION_HARMATTAN)
>+ isMeegoTablet = false;
>+#elif defined(Q_WS_X11)
>+ /* NPM: package 'tablet-target-config' is in the Tablet KS
>+ http://ftp-nyc.osuosl.org/pub/meego/builds/1.2.0.90/1.2.0.90.12.20110809.2/images/meego-tablet-ia32-pinetrail/meego-tablet-ia32-pinetrail-1.2.0.90.12.20110809.2.packages
>+ but not in
>+ http://ftp-nyc.osuosl.org/pub/meego/builds/1.2.0.90/1.2.0.90.12.20110809.2/images/meego-netbook-ia32/meego-netbook-ia32-1.2.0.90.12.20110809.2.packages
>+ Package 'tablet-target-config' contains a single file
>/usr/share/meegotouch/targets/tablet.conf
>+ if present, then assume we're on MeeGo tablet UX.
>+ */
>+ if (QFile::exists("/usr/share/meegotouch/targets/tablet.conf"))
>+ isMeegoTablet = true;
>+ else
>+ isMeegoTablet = false;
>+#else
>+ isMeegoTablet = false; // NPM
>+#endif
>
>The idea is that this ultimately sets a property
>'Controller.isMeegoTablet' accessible from QML so that code does
>different things on difft platforms:
>
> onButtonClicked: {
> if (Controller.isMeegoTablet) { //NPM
> mainWindow.fullScreen = !(mainWindow.fullScreen);
> mainWindow.pageUsingFullScreen = !(mainWindow.pageUsingFullScreen);
> }
> else if (!Controller.isMaemo) {
> Controller.toggleState();
> }
> else {
> Controller.minimize();
> }
>
>Niels
>http://nielsmayer.com
>
>PS: The code works :-) And successfully invokes the tablet-UX "window
>framing" versus the netbook-UX. and associated different behaviors for
>the "full-screen" button on the app. For details,
>" svn checkout http://ytd-meego.googlecode.com/svn/trunk/playground/qmltube/ "
>" qtcreator qmltube/qmltube.pro "
>_______________________________________________
>MeeGo-dev mailing list
>MeeGo-dev at meego.com
>http://lists.meego.com/listinfo/meego-dev
>http://wiki.meego.com/Mailing_list_guidelines
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.meego.com/pipermail/meego-dev/attachments/20110902/e1d068b7/attachment.html>
More information about the MeeGo-dev
mailing list