Hi Aflar,
The highest level and most reliably redundant way for determining the
hardware platform (AFAIK), is as follows:
#include "mapplication.h"
QString targetname = MApplication::deviceName();
if (targetname.isEmpty()) {
#ifdef HAVE_GCONF
MGConfItem targetNameItem("/meegotouch/target/name");
targetname = targetNameItem.value("Default").toString();
#else
targetname = "Default";
#endif //HAVE_GCONF
}
Cheers,
Brad Peters
OTC Middleware guy
2011/9/1 Aflar <[email protected]>
>
>
> --
> Best regards!
> Aflar Van
>
>
> At 2011-08-29 12:58:31,"Niels Mayer" <[email protected]> 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
> >[email protected]
> >http://lists.meego.com/listinfo/meego-dev
> >http://wiki.meego.com/Mailing_list_guidelines
>
>
>
>
> _______________________________________________
> MeeGo-dev mailing list
> [email protected]
> http://lists.meego.com/listinfo/meego-dev
> http://wiki.meego.com/Mailing_list_guidelines
>
_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev
http://wiki.meego.com/Mailing_list_guidelines