On Sun, Aug 28, 2011 at 9:58 PM, 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?
This is a very debatable topic. Especially using preprocessor symbols might not be the right thing, it's quite likely that other people will just turn those on in order to make a piece of software work on another platform A better approach is to look at the device itself. Does it have a 102key keyboard? Then it's a laptop, desktop or netbook. Touch screen? Then it's not a netbook or at least a hybrid, and the touch model applies. Using random files on disk sounds bad too, why not just parse /etc/meego-release? Ultimately, if you need 100% coverage, you need to read /etc/boardname and maintain a mapping table of all 'boards' out there. Auke > > +#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
