code:
Summary: Display runtime Qt (Quick) and System information
Name: qtinfo
Version: 0.0.1
Release:   1
Group:     Development/Tools
License:   BSD
URL:       https://projects.forum.nokia.com/qtinfo
Source:    %{name}-%{version}.tar.gz
BuildRoot: /tmp/%{name}-%{version}-%{release}-root
BuildRequires: qt-devel
BuildRequires: qt-mobility-devel
BuildRequires: libqtopengl-devel
BuildRequires: libqtwebkit-devel

%description
Display basic Qt-related information in an easy-to-report-to-developer way

%prep
%setup -q -n %{name}-%{version}

%build
qmake QtInfo.pro
make %{?_smp_mflags}

%install
%{__rm} -rf $RPM_BUILD_ROOT
qmake QtInfo.pro
make %{?_smp_mflags} INSTALL_ROOT=%{buildroot} install

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
#%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
/opt/qtinfo/bin/libglinfolib.so
/opt/qtinfo/bin/libglinfolib.so.1
/opt/qtinfo/bin/libglinfolib.so.1.0
/opt/qtinfo/bin/libglinfolib.so.1.0.0
/opt/qtinfo/bin/libmobilityinfolib.so
/opt/qtinfo/bin/libmobilityinfolib.so.1
/opt/qtinfo/bin/libmobilityinfolib.so.1.0
/opt/qtinfo/bin/libmobilityinfolib.so.1.0.0
/opt/qtinfo/bin/libmultimediainfolib.so
/opt/qtinfo/bin/libmultimediainfolib.so.1
/opt/qtinfo/bin/libmultimediainfolib.so.1.0
/opt/qtinfo/bin/libmultimediainfolib.so.1.0.0
/opt/qtinfo/bin/libqtquickinfolib.so
/opt/qtinfo/bin/libqtquickinfolib.so.1
/opt/qtinfo/bin/libqtquickinfolib.so.1.0
/opt/qtinfo/bin/libqtquickinfolib.so.1.0.0
/opt/qtinfo/bin/libsqlinfolib.so
/opt/qtinfo/bin/libsqlinfolib.so.1
/opt/qtinfo/bin/libsqlinfolib.so.1.0
/opt/qtinfo/bin/libsqlinfolib.so.1.0.0
/opt/qtinfo/bin/libwebkitinfolib.so
/opt/qtinfo/bin/libwebkitinfolib.so.1
/opt/qtinfo/bin/libwebkitinfolib.so.1.0
/opt/qtinfo/bin/libwebkitinfolib.so.1.0.0
/opt/qtinfo/bin/qtinfo
/usr/share/themes/base/meegotouch/icons/qtinfo.svg


code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Qt info</title>

Qt info

Below you can see the details of your current Qt installation.

__ROWTEMPLATE__

__SECTIONTEMPLATE__

repo_name: snapshot/qtinfo

license: unknown


code:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--

   Copyright (c) 2011, 2012 Research In Motion Limited.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

-->
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">

<!-- BlackBerry Tablet OS application descriptor file.

    Specifies parameters for identifying, installing, and launching native applications on BlackBerry Tablet OS.

-->

    <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
         Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
    <id>com.example.QtInfo</id>

    <!-- The name that is displayed in the BlackBerry Tablet OS application installer.
         May have multiple values for each language. See samples or xsd schema file. Optional. -->
    <name>QtInfo</name>

    <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
         Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
         An updated version of application must have a versionNumber value higher than the previous version. Required. -->
    <versionNumber>1.0.0</versionNumber>

    <!-- Fourth digit segment of the package version. First three segments are taken from the
         <versionNumber> element.  Must be an integer from 0 to 2^16-1 -->
    <buildId>2</buildId>

    <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
    <!-- <versionLabel></versionLabel> -->

    <!-- Description, displayed in the BlackBerry Tablet OS application installer.
         May have multiple values for each language. See samples or xsd schema file. Optional. -->
    <description>The QtInfo application</description>

    <!-- Copyright information. Optional. -->
    <!-- <copyright></copyright> -->

    <!--  Name of author which is used for signing. Must match the developer name of your development certificate. -->
    <author>Attila Csipa</author>

    <!--  Unique author ID assigned by signing authority. Required if using debug tokens. -->
    <authorId>gYAAgGWYboWBFXlBEdKjSSRb1fw</authorId>

    <initialWindow>
        <systemChrome>none</systemChrome>
        <autoOrients>true</autoOrients>
        <transparent>false</transparent>
    </initialWindow>

    <!--  The category where the application appears. Either core.games or core.media. -->
    <category>core.games</category>
    <configuration id="com.qnx.qcc.toolChain.355029720" name="Default">
       <platformArchitecture>armle-v7</platformArchitecture>
       <asset path="qtinfo/qtinfo" entry="true" type="Qnx/Elf">qtinfo</asset>
       <asset path="qtquickinfolib/libqtquickinfolib.so" entry="true" type="Qnx/Elf">libqtquickinfolib.so</asset>
       <asset path="cascadesui/libcascadesui.so" entry="true" type="Qnx/Elf">libcascadesui.so</asset>
       <asset path="bb10infolib/libbb10infolib.so" entry="true" type="Qnx/Elf">libbb10infolib.so</asset>
<!--       <asset path="glinfolib/libglinfolib.so" entry="true" type="Qnx/Elf">libglinfolib.so</asset>  -->
       <asset path="mobilityinfolib/libmobilityinfolib12.so" entry="true" type="Qnx/Elf">libmobilityinfolib12.so</asset>
       <asset path="multimediainfolib/libmultimediainfolib12.so" entry="true" type="Qnx/Elf">libmultimediainfolib12.so</asset>
       <asset path="sqlinfolib/libsqlinfolib.so" entry="true" type="Qnx/Elf">libsqlinfolib.so</asset>
       <asset path="../trunk/qtinfo/bb10icon.png">icon.png</asset>
       <asset path="../trunk/cascadesui/assets">assets</asset>
    </configuration>
    <configuration id="com.qnx.qcc.toolChain.1891073914" name="Device-Debug">
       <platformArchitecture>armle-v7</platformArchitecture>
       <asset path="qtinfo/qtinfo" entry="true" type="Qnx/Elf">qtinfo</asset>
       <asset path="qtquickinfolib/libqtquickinfolib.so" entry="true" type="Qnx/Elf">libqtquickinfolib.so</asset>
       <asset path="cascadesui/libcascadesui.so" entry="true" type="Qnx/Elf">libcascadesui.so</asset>
       <asset path="bb10infolib/libbb10infolib.so" entry="true" type="Qnx/Elf">libbb10infolib.so</asset>
<!--       <asset path="glinfolib/libglinfolib.so" entry="true" type="Qnx/Elf">libglinfolib.so</asset>  -->
       <asset path="mobilityinfolib/libmobilityinfolib12.so" entry="true" type="Qnx/Elf">libmobilityinfolib12.so</asset>
       <asset path="multimediainfolib/libmultimediainfolib12.so" entry="true" type="Qnx/Elf">libmultimediainfolib12.so</asset>
       <asset path="sqlinfolib/libsqlinfolib.so" entry="true" type="Qnx/Elf">libsqlinfolib.so</asset>
       <asset path="../../trunk/qtinfo/bb10icon.png">icon.png</asset>
       <asset path="../../trunk/cascadesui/assets">assets</asset>
    </configuration>
    <configuration id="com.qnx.qcc.toolChain.956081273" name="Device-Release">
       <platformArchitecture>armle-v7</platformArchitecture>
       <asset path="${QNX_TARGET}/qtinfo/qtinfo" entry="true" type="Qnx/Elf">qtinfo</asset>
       <asset path="${QNX_TARGET}/qtquickinfolib/libqtquickinfolib.so" entry="true" type="Qnx/Elf">libqtquickinfolib.so</asset>
       <asset path="${QNX_TARGET}/cascadesui/libcascadesui.so" entry="true" type="Qnx/Elf">libcascadesui.so</asset>
       <asset path="${QNX_TARGET}/bb10infolib/libbb10infolib.so" entry="true" type="Qnx/Elf">libbb10infolib.so</asset>
<!--       <asset path="${QNX_TARGET}/glinfolib/libglinfolib.so" entry="true" type="Qnx/Elf">libglinfolib.so</asset>  -->
       <asset path="${QNX_TARGET}/mobilityinfolib/libmobilityinfolib12.so" entry="true" type="Qnx/Elf">libmobilityinfolib12.so</asset>
       <asset path="${QNX_TARGET}/multimediainfolib/libmultimediainfolib12.so" entry="true" type="Qnx/Elf">libmultimediainfolib12.so</asset>
       <asset path="${QNX_TARGET}/sqlinfolib/libsqlinfolib.so" entry="true" type="Qnx/Elf">libsqlinfolib.so</asset>
       <asset path="bb10icon.png">icon.png</asset>
       <asset path="../cascadesui/assets">assets</asset>
    </configuration>
    <configuration id="com.qnx.qcc.toolChain.238702501" name="Simulator-Debug">
       <platformArchitecture>x86</platformArchitecture>
       <asset path="qtinfo/qtinfo" entry="true" type="Qnx/Elf">qtinfo</asset>
       <asset path="qtquickinfolib/libqtquickinfolib.so" entry="true" type="Qnx/Elf">libqtquickinfolib.so</asset>
       <asset path="cascadesui/libcascadesui.so" entry="true" type="Qnx/Elf">libcascadesui.so</asset>
       <asset path="bb10infolib/libbb10infolib.so" entry="true" type="Qnx/Elf">libbb10infolib.so</asset>
<!--       <asset path="glinfolib/libglinfolib.so" entry="true" type="Qnx/Elf">libglinfolib.so</asset>  -->
       <asset path="mobilityinfolib/libmobilityinfolib12.so" entry="true" type="Qnx/Elf">libmobilityinfolib12.so</asset>
       <asset path="multimediainfolib/libmultimediainfolib12.so" entry="true" type="Qnx/Elf">libmultimediainfolib12.so</asset>
       <asset path="sqlinfolib/libsqlinfolib.so" entry="true" type="Qnx/Elf">libsqlinfolib.so</asset>
       <asset path="../../trunk/qtinfo/bb10icon.png">icon.png</asset>
       <asset path="../../trunk/cascadesui/assets">assets</asset>
    </configuration>

    <!--  The icon for the application, which should be 86x86. -->
    <icon>
        <image>icon.png</image>
    </icon>

    <!-- Locale support    <asset path="translations" dest="qm">
        <include name="*.qm"/>
    </asset> -->

    <!-- Request permission to execute native code.  Required for native applications. -->
    <permission system="true">run_native</permission>
    <permission>read_device_identifying_information</permission>
    <permission>use_camera</permission>
    <permission>access_internet</permission>
    <permission>access_location_services</permission>
    <permission>read_geolocation</permission>

    <env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>

<!--    <asset path="%QT_INSTALL_LIBS%">lib</asset>
    <asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
    <asset path="%QT_INSTALL_IMPORTS%">imports</asset> -->

</qnx>


code: /home/attila/bbndk/host_10_0_9_284/linux/x86/usr/bin/blackberry-nativepackager -package -appVersion 1.0.0 -buildId 1 -sign /tmp/qtinfo.bar /home/attila/src/QtInfo/trunk/qtinfo/bar-descriptor.xml -configuration Device-Release -D QNX_TARGET=~/src/QtInfo/QtInfo-build-BB10_1011-Default_build_Release -cskpass [PLACEHOLDER]


code:
<?xml version="1.0" encoding="utf-8" ?>
<assets>
  <target-device width="768" height="1280" ppi="356" class="phone"/>
</assets>


code:
#include "infoloader.h"

#include <QFile>
#include <QDebug>
#include <QLibrary>
#include <QLibraryInfo>
#include <QImageReader>
#include <QFontDatabase>
#include <QLocale>
#include <QTextBrowser>
#include <QApplication>

#ifdef Q_OS_BLACKBERRY
#include <bb/cascades/Application>
#endif

#define ROWTEMPLATE "\n\

\n\
              %0	\n\
              %1	\n\

%2"

#define SECTIONTEMPLATE "\n\

%0
\n\

\n\
    __SECTIONROWTEMPLATE__\

\n\
    __SECTIONTEMPLATE__"

InfoLoader::InfoLoader(QObject *parent) :
    QThread(parent),
    rowstr(ROWTEMPLATE),
    sectionstr(SECTIONTEMPLATE),
    out(&text)
{
}

void InfoLoader::run()
{
    QFile htmlfile("://Qt_info.html");
    htmlfile.open(QIODevice::ReadOnly);
    html = htmlfile.readAll();
//    QString loadinghtml = html;
//    loadinghtml.replace("__SECTIONTEMPLATE__", "Please wait, reading data");
//    ui->webView->setHtml(loadinghtml,QUrl("qrc:/"));

    QString key = "Qt version";
    QString value = qVersion();
    QStringList valuelist;

    qDebug() << key << value ;

    addToTemplate(key, value);

    emit newInfoAvailable("Checking build date...");
    key = "Qt build";
    value = QLibraryInfo::buildDate().toString()+ ", ";
#if QT_VERSION < 0x050000
    value += QLibraryInfo::buildKey() + ", ";
#endif
    value += QLibraryInfo::licensee();
    addToTemplate(key, value);

    emit newInfoAvailable("Checking country/language...");
    key = "Country";
    QLocale defaultlocale;
    value = QLocale::countryToString(defaultlocale.country());
    addToTemplate(key, value);

    key = "Language";
    value = QLocale::languageToString(defaultlocale.language()) + " (" + defaultlocale.name() + ")";
    addToTemplate(key, value);

    emit newInfoAvailable("Checking Qt modules...");
    key = "Qt modules";
    value = "";
    QStringList qtlibs;
    QStringList qtmobilitylibs;

    qtlibs << "Qt3Support";
    qtlibs << "QAxContainer";
    qtlibs << "QAxServer";
    qtlibs << "QtCLucene";
    qtlibs << "QtCore";
    qtlibs << "QtDBus";
    qtlibs << "QtDeclarative";           // 4.7
    qtlibs << "QtDesignerComponents";
    qtlibs << "QtDesigner";
    qtlibs << "QtGui";
    qtlibs << "QtHelp";
    qtlibs << "QtMultimedia";
    qtlibs << "QtMaemo5";                // 4.6
    qtlibs << "phonon";
    qtlibs << "QtNetwork";               // includes QtBearer starting w 4.7
    qtlibs << "QtOpenGL";
    qtlibs << "QtOpenVG";                // 4.6
    qtlibs << "QtScript";
    qtlibs << "QtScriptTools";
    qtlibs << "QtSql";
    qtlibs << "QtSvg";
    qtlibs << "QtTest";
    qtlibs << "QtUiTools";
    qtlibs << "QtWebKit";
    qtlibs << "QtXmlPatterns";
    qtlibs << "QtXml";

    qtlibs << "Qt5CLucene";
    qtlibs << "Qt5Concurrent";
    qtlibs << "Qt5Core";
    qtlibs << "Qt5Declarative";
    qtlibs << "Qt5Designer";
    qtlibs << "Qt5DesignerComponents";
    qtlibs << "Qt5Gui";
    qtlibs << "Qt5Help";
    qtlibs << "Qt5Multimedia";
    qtlibs << "Qt5MultimediaQuick_p";
    qtlibs << "Qt5MultimediaWidgets";
    qtlibs << "Qt5Network";
    qtlibs << "Qt5OpenGL";
    qtlibs << "Qt5PrintSupport";
    qtlibs << "Qt5Qml";
    qtlibs << "Qt5Quick";
    qtlibs << "Qt5QuickParticles";
    qtlibs << "Qt5QuickTest";
    qtlibs << "Qt5Script";
    qtlibs << "Qt5ScriptTools";
    qtlibs << "Qt5Sql";
    qtlibs << "Qt5Svg";
    qtlibs << "Qt5Test";
    qtlibs << "Qt5V8";
    qtlibs << "Qt5WebKit";
    qtlibs << "Qt5WebKitWidgets";
    qtlibs << "Qt5Widgets";
    qtlibs << "Qt5Xml";
    qtlibs << "Qt5XmlPatterns";

    qtmobilitylibs << "QtBearer";          // 1.0.x ONLY
    qtmobilitylibs << "QtConnectivity";    // 1.2
    qtmobilitylibs << "QtContacts";
    qtmobilitylibs << "QtFeedback";        // 1.1
    qtmobilitylibs << "QtGallery";         // 1.1
    qtmobilitylibs << "QtLocation";
    qtmobilitylibs << "QtMultimediaKit";
    qtmobilitylibs << "QtSensors";
    qtmobilitylibs << "QtServiceFramework";
    qtmobilitylibs << "QtSystemInfo";
    qtmobilitylibs << "QtOrganizer";       // 1.1
    qtmobilitylibs << "QtPublishSubscribe";
    qtmobilitylibs << "QtVersitOrganizer"; // 1.1
    qtmobilitylibs << "QtVersit";
    qtlibs.append(qtmobilitylibs);

    int progressTotalSteps = qtlibs.count() + 11; // 11 = number of loadInfos we're going to do later. #automateme
    int progressStep = 0;

    foreach(QString libname, qtlibs) {
        emit newInfoAvailable(QString("Locating %0...").arg(libname));
        QString libfilename = loadLib(libname);
        if (!libfilename.isEmpty()) {
            emit newInfoAvailable(QString("Found as %0 ").arg(libfilename));
            value += libname.replace("lib", "") + " ";
            installedlibs << libname;
        } else {
            emit newInfoAvailable(QString("Not found"));
        }
        emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));
    }
    addToTemplate(key, value);

    emit newInfoAvailable("Checking Qt Mobility version...");
    int mobver = divineMobilityVersion();
    QString libsuffix;
    if (mobver >= 0x010200) {
        libsuffix = "12";
    } else if (mobver >= 0x010100) {
        libsuffix = "11";
    }
    else // 1.0
    {
        libsuffix = "10";
    }

//    loadInfo("Section Name", "Qt module name needed to load", "our local lib name", "our local extern C function name");

#ifdef Q_OS_BLACKBERRY
    emit newInfoAvailable("Loading bb10info...");
    loadInfo("BB10", "QtCore", "bb10infolib", "bb10Info");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));
#endif

    emit newInfoAvailable("Loading systeminfo...");
    loadInfo("Mobility", "QtSystemInfo", QString("mobilityinfolib%0").arg(libsuffix), "mobilityInfo");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable(QString("Loading multimediakit (%0)...").arg(libsuffix));
    loadInfo("MultimediaKit", "QtMultimediaKit", QString("multimediainfolib%0").arg(libsuffix), "multimediaInfo");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable("Loading Multimedia...");
    loadInfo("Multimedia", "Qt5Multimedia", "multimediainfolib", "multimediaInfo");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable("Loading declarative...");
    loadInfo("Qt Quick", "QtDeclarative", "qtquickinfolib", "qtQuickInfo");
    loadInfo("Qt Quick", "Qt5Declarative", "qtquickinfolib", "qtQuickInfo");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable("Loading qml...");
    loadInfo("Qt Quick2", "Qt5Qml", "qtquick2infolib", "qtQuick2Info");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable("Loading OpenGL...");
    loadInfo("OpenGL", "QtOpenGL", "glinfolib", "GLInfo");
    loadInfo("OpenGL", "Qt5OpenGL", "glinfolib", "GLInfo");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable("Loading webkit...");
    loadInfo("WebKit", "QtWebKit", "webkitinfolib", "webkitInfo");
    loadInfo("WebKit", "Qt5WebKit", "webkitinfolib", "webkitInfo");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable("Loading sql...");
    loadInfo("SQL", "QtSql", "sqlinfolib", "sqlInfo");
    loadInfo("SQL", "Qt5Sql", "sqlinfolib", "sqlInfo");
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable("Determining default paths...");
    key = "Library path";
    value = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
    addToTemplate(key, value);
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    key = "Plugin path";
    value = QLibraryInfo::location(QLibraryInfo::PluginsPath);
    addToTemplate(key, value);
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    key = "Import path";
    value = QLibraryInfo::location((QLibraryInfo::LibraryLocation)11); // QLibraryInfo::ImportsPath == 11, but not available in Qt4.6
    addToTemplate(key, value);
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

    emit newInfoAvailable("Determining image drivers...");
    key = "Image formats";
    valuelist.clear();
    QList<QByteArray> sif = QImageReader::supportedImageFormats ();
    foreach (QString fmtstr, sif)
    {
        valuelist << fmtstr;
    }
    addToTemplate(key, valuelist.join(", "));
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));
    qApp->processEvents();

    emit newInfoAvailable("Determining system fonts...");
    QList<QPair<QString, QString> > list;
    list.append(QPair<QString,QString>("section", "Fonts"));
#ifdef Q_OS_BLACKBERRY
    list.append(QPair<QString,QString>("Installed fonts", "N/A (Cascades incompatible with QFontDatabase)"));
    list.append(QPair<QString,QString>("Writing systems", "N/A (Cascades incompatible with QFontDatabase)"));
    list.append(QPair<QString,QString>("Standard sizes", "N/A (Cascades incompatible with QFontDatabase)"));
    // and all this shouldn't be hardcoded except BB10 Qt SIGSEGVs if we create a QFontDatabase object
#else
    QFontDatabase database;
    list.append(QPair<QString,QString>("Installed fonts", database.families().join(", ")));
    // database.pointSizes(family) // One day...
    valuelist.clear();
    foreach(QFontDatabase::WritingSystem ws, database.writingSystems()) {
        valuelist << QString("%0 (%1)").arg(QFontDatabase::writingSystemName(ws)).arg(QFontDatabase::writingSystemSample(ws));
    }
    list.append(QPair<QString,QString>("Writing systems", valuelist.join(", ")));
    valuelist.clear();
    foreach(int size, database.standardSizes()) {
        valuelist << QString("%0").arg(size);
    }
    list.append(QPair<QString,QString>("Standard sizes", valuelist.join(", ")));
#endif
    addToTemplate(list);
    emit progressChange((int)(++progressStep*100.0/(float)progressTotalSteps));

}
bool InfoLoader::loadValues(QString library, QString defaultKey, const char* function)
{
    QString key = defaultKey;
    typedef QList<QPair<QString, QString> > (*fn)();
    QLibrary lib(library);
    fn v = (fn) lib.resolve(function);
//    fn v = (fn) QLibrary::resolve(library, function);
    qDebug() << library <<  v;
    QList<QPair<QString, QString> > list;
    if (v) {
        list = v();
        addToTemplate(list);

    } else { // one more try for the overly pedantic MSVC
        qDebug() << lib.errorString() << endl;
        typedef QString (*fnstr)();
        fnstr strfunc = (fnstr) lib.resolve(QString(QString(function)+"QString").toUtf8());
        if (strfunc) {
            QString str = strfunc();
            QStringList lines = str.split("##LINESEPARATOR##");
            foreach (QString line, lines) {
                QStringList pairstring = line.split("##PAIRSEPARATOR##");
                if (pairstring.size() < 2) continue;
                QPair<QString, QString> pair(pairstring[0], pairstring[1]);
                list.append(pair);
            }
            addToTemplate(list);

        } else {
            qDebug() << lib.errorString() << endl;
            addToTemplate(key, "Not Available");
            return false;
        }
    }
    return true;
}

void InfoLoader::addToTemplate(QString key, QString value)
{
    html = html.replace("__ROWTEMPLATE__", rowstr.arg(key).arg(value).arg("__ROWTEMPLATE__"));
    rawpairs.append(qMakePair(key, value));

#ifndef Q_OS_BLACKBERRY
    QTextBrowser tb;
    tb.setHtml(value);
    out << key << ": " << tb.toPlainText() << endl;
#else
    out << key << ": " << value << endl;
#endif
}

void InfoLoader::addToTemplate(QList<QPair<QString, QString> > list)
{
    bool insection = false;
    for (int i = 0; i < list.length(); i++)
    {
        QPair<QString, QString> key = list.at(i);
        rawpairs.append(key);
        if (key.first == "section") {
            insection = true;
            html = html.replace("__SECTIONROWTEMPLATE__", ""); // close off any previous open sections we might have
            html = html.replace("__SECTIONTEMPLATE__", sectionstr.arg(key.second));
            out << endl << key.second << endl << endl;
        } else {
            if (insection) {
                html = html.replace("__SECTIONROWTEMPLATE__", rowstr.arg(key.first).arg(key.second).arg("__SECTIONROWTEMPLATE__"));
            } else {
                html = html.replace("__ROWTEMPLATE__", rowstr.arg(key.first).arg(key.second).arg("__ROWTEMPLATE__"));
            }
            out << " " << key.first << ": " << key.second << endl;
        }
    }
    html = html.replace("__SECTIONROWTEMPLATE__", ""); // close off any previous open sections we might have
    out << endl;
}

QString InfoLoader::loadLib(QString libname)
{
// very very dirty hack
// to sort out why when 4.6.x is installed loading QtBearer appears to hang the app
#ifdef Q_OS_SYMBIAN
    if(QString(qVersion()).startsWith("4.6") && libname=="QtBearer" )
        return QString("QtBearer");
#endif
    QLibrary lib(libname);
    QTextStream sout(stdout);
    sout << lib.errorString() << endl;
//    qDebug() << lib.errorString();
    if (!lib.load()) {
        foreach (QString prefix, QStringList() << "" << "lib") {
            foreach(QString version, QStringList() << "" << "1" << "2" << "3" << "4" << "5") {
                lib.setFileNameAndVersion(prefix + libname, version.toInt()); // Linux naming
                if (lib.load()) break;
    sout << lib.errorString() << endl;
        qDebug() << lib.errorString();
                lib.setFileName(prefix + libname + version); // Windows and Symbian naming
    sout << lib.errorString() << endl;
        qDebug() << lib.errorString();
                if (lib.load()) break;
            }
            if (lib.isLoaded()) break;
        }
    }
    bool loaded = lib.isLoaded();

    qDebug() << libname << "loaded " << loaded;

    if (loaded) {
        lib.unload();
        return lib.fileName();
    } else {
    sout << lib.errorString() << endl;
        qDebug() << lib.errorString();
        return QString();
    }
}

void InfoLoader::loadInfo(QString key, QString libname, QString libfile, const char* infofunc)
{
    if (installedlibs.contains(libname))
    {
#ifdef Q_OS_BLACKBERRY
        QString libname(loadLib("app/native/lib"+libfile+".so")); // hmm... might need to include ./ as one of the possible prefixes ?
#else
        QString libname(loadLib(qApp->applicationDirPath()+"/"+libfile)); // hmm... might need to include ./ as one of the possible prefixes ?
#endif

        if (!libname.isEmpty())
        {
            loadValues(libname, key, infofunc);
        }
    }
}

int InfoLoader::divineMobilityVersion()
{
#ifdef Q_OS_BLACKBERRY
    // BB is unable to tell which version it has :/
    return 0x010200;
#endif
    if (installedlibs.contains("QtConnectivity"))
        return 0x010200;
    if (installedlibs.contains("QtGallery"))
        return 0x010100;
#ifdef Q_WS_MAEMO_5
    // check if we might have the community edition installed somewhere
    if (!loadLib("/opt/qtm12/lib/libQtConnectivity").isEmpty())
        return 0x010200;
    if (!loadLib("/opt/qtm11/lib/libQtGallery").isEmpty())
        return 0x010100;
#endif
    if (installedlibs.contains("QtBearer")) // bearer is present ONLY in 1.0
        return 0x010000;

    return 0;
}


code:
#ifndef INFOLOADER_H
#define INFOLOADER_H

#include <QThread>
#include <QPair>
#include <QTextStream>
#include <QStringList>

class InfoLoader : public QThread
{
    Q_OBJECT
public:
    explicit InfoLoader(QObject *parent = 0);

signals:
    void newInfoAvailable(QString str);
    void progressChange(int percent);

public slots:

public:
    void run();
    QString resultAsHTML() { return html.replace("__ROWTEMPLATE__", "").replace("__SECTIONTEMPLATE__", ""); }
    QString resultAsText() { return text; }
    QList<QPair<QString, QString> > resultAsRawpairs() { return rawpairs; }

    bool isLoaded(QString library) { return installedlibs.contains(library); }

    int divineMobilityVersion();
    static QString loadLib(QString libname);

private:
    QString html;
    QString text;
    QString rowstr;
    QString sectionstr;
    QTextStream out;
    QStringList installedlibs;
    QList<QPair<QString, QString> > rawpairs;
    void loadInfo(QString key, QString libname, QString libfile, const char* infofunc); // pvt because of out
    bool loadValues(QString library, QString defaultKey, const char* function); // pvt because of out, used by loadInfo
    void addToTemplate(QString key, QString value);
    void addToTemplate(QList<QPair<QString, QString> > list);
};

#endif // INFOLOADER_H


code:
#include <QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
#if defined(Q_WS_S60)
    w.showFullScreen();
#else
    w.show();
#endif
//    a.processEvents();
//    w.startLoading();

    return a.exec();
}


code:
#include <bb/cascades/Application>
#include "maincascadeswindow.hpp"
#include <QLocale>
#include <QTranslator>
#include <QStringList>
#include <QDebug>

#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>

using namespace bb::cascades;

int main(int argc, char **argv)
{
/*
    QApplication* tmpapp = new QApplication(argc, argv);
    tmpapp->processEvents();
    QFontDatabase database;
    QString familiesList = database.families().join(", ");
    QStringList valuelist;
    foreach(QFontDatabase::WritingSystem ws, database.writingSystems()) {
        valuelist << QString("%0 (%1)").arg(QFontDatabase::writingSystemName(ws)).arg(QFontDatabase::writingSystemSample(ws));
    }
    QString writingsystemList = valuelist.join(", ");
    valuelist.clear();
    foreach(int size, database.standardSizes()) {
        valuelist << QString("%0").arg(size);
    }
    QString standardsizesList = valuelist.join(", ");
    qDebug() << familiesList << writingsystemList << standardsizesList;
    tmpapp->processEvents();
    delete tmpapp; // stuff you don't see normally. BB10 is special.
*/
    // this is where the server is started etc
    Application app(argc, argv);
//    app.setProperty("families", QString("TehFontList"));
//    app.setProperty("families", familiesList);

    // localization support
    QTranslator translator;
    QString locale_string = QLocale().name();
    QString filename = QString( "QtInfo_%1" ).arg( locale_string );
    if (translator.load(filename, "app/native/qm")) {
        app.installTranslator( &translator );
    }

    // create the application pane object to init UI etc.
    new MainCascadesWindow(&app);
//    QmlDocument *qml = QmlDocument::create("asset:///loading.qml").parent(&app);
//    AbstractPane *root = qml->createRootObject<AbstractPane>();
//    app.setScene(root);

    // we complete the transaction started in the app constructor and start the client event loop here
    return Application::exec();
    // when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children)
}


code:
#include "maincascadeswindow.hpp"
//#include "mylistmodel.hpp"

#include <bb/cascades/Application>
#include <qdebug.h>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/GroupDataModel>

#define applicationDirPath QString("")

using namespace bb::cascades;

MainCascadesWindow::MainCascadesWindow(bb::cascades::Application *app)
: QObject(app), infoloader(new InfoLoader(this))
{
    qml = QmlDocument::create("asset:///loading.qml").parent(app);
    root = qml->createRootObject<AbstractPane>();
    app->setScene(root);

    connect(infoloader, SIGNAL(newInfoAvailable(QString)), SLOT(updateLoadScreen(QString)), Qt::DirectConnection);
    connect(infoloader, SIGNAL(progressChange(int)), SLOT(updateProgress(int)), Qt::DirectConnection);
    QTimer::singleShot(0,this,SLOT(showUI()));

}

QObject* MainCascadesWindow::loadWidget(QString library, const char* function)
{
    typedef QObject* (*fn)(QList<QPair<QString, QString> >, QObject*);
    fn v = (fn) QLibrary::resolve(infoloader->loadLib(applicationDirPath+"/"+library), function);
    qDebug() << library <<  v;
    if (v) {
        return v(infoloader->resultAsRawpairs(), this);
    }
    return NULL;
}

bool MainCascadesWindow::callBoolFunction(QString library, const char *function)
{
    typedef bool (*fn)();
    fn v = (fn) QLibrary::resolve(infoloader->loadLib(applicationDirPath+"/"+library), function);
//    qDebug() << "calling " << library << function << v;
    QTextStream sout(stdout);
    sout << "calling ";
    sout << library;
    sout << function << endl;
//    sout << v;
    if (v != 0) {
        return v();
    }
    sout << "Could not resolve func/lib " << applicationDirPath << "/lib" << library << " " << infoloader->loadLib(applicationDirPath+"/lib"+library) << " " << function << endl;
//    sout << QLibrary::errorString() << endl;
    return false;
}

void MainCascadesWindow::showUI()
{
    infoloader->run();

//    ui->webView->setHtml(html,QUrl("qrc:/"));

    QTextStream sout(stdout);
    sout << infoloader->resultAsText();
    qDebug() << infoloader->resultAsText();
//    QString jsondata = "{";
    qml = QmlDocument::create("asset:///main.qml").parent(bb::cascades::Application::instance());
    root = qml->createRootObject<AbstractPane>();
    bb::cascades::Application::instance()->setScene(root);

    bb::cascades::GroupDataModel *dmobj = (bb::cascades::GroupDataModel*) root->findChild<QObject*>("dm");
    typedef QPair<QString, QString> pairtype;
    QString lastsection = "Qt";
    QVariantMap headervm;
    headervm["first"] = "Qt";
    headervm["type"] = "header";
    dmobj->insert(headervm);
    foreach(pairtype pair, infoloader->resultAsRawpairs())
    {
        qDebug() << pair.first << pair.second;
        QVariantMap qvm;
        if (pair.first == "section") {
            lastsection = pair.second;
            qvm["first"]= lastsection;
            qvm["second"]= lastsection;
            qvm["section"]= lastsection;
            qvm["type"]= "header";
        } else {
            qvm["first"]  = pair.first;
            qvm["second"] = pair.second.replace("<br>","\n");
            qvm["section"]= lastsection;
            qvm["type"]= "item";
        }
        dmobj->insert(qvm);
    }
    dmobj->setSortedAscending(false);

}

void MainCascadesWindow::updateProgress(int perc)
{
    QObject *progress = root->findChild<QObject*>("progress");
    if (progress)
        progress->setProperty("value", perc);

    bb::cascades::Application::instance()->processEvents();
}
void MainCascadesWindow::updateLoadScreen(QString str)
{
    QObject *textArea = root->findChild<QObject*>("loadTicker");
    if (textArea)
        textArea->setProperty("text", str + "\n" + textArea->property("text").toString());

    bb::cascades::Application::instance()->processEvents();
}


code:
// List with context menu project template
#ifndef MainCascadesWindow_HPP_
#define MainCascadesWindow_HPP_

#include <QObject>

#include "infoloader.h"

namespace bb { namespace cascades { class Application; }}
namespace bb { namespace cascades { class QmlDocument; }}
namespace bb { namespace cascades { class AbstractPane; }}

/*!
 * @brief Application pane object
 *
 *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
 */
class MainCascadesWindow : public QObject
{
    Q_OBJECT
public:
    MainCascadesWindow(bb::cascades::Application *app);
    virtual ~MainCascadesWindow() {}
public slots:
    void showUI();
    void updateProgress(int perc);
    void updateLoadScreen(QString str);
private:
    QObject *loadWidget(QString library, const char *function);
    bool callBoolFunction(QString library, const char *function);
    InfoLoader* infoloader;
    bb::cascades::QmlDocument *qml;
    bb::cascades::AbstractPane *root;
};

#endif /* MainCascadesWindow_HPP_ */


code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLibrary>
#include <QDebug>
#include <QTextStream>
#include <QDesktopServices>
#include <QTimer>
#include <QStatusBar>

#include "qplatformdefs.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    infoloader(new InfoLoader(this))
{
    ui->setupUi(this);
    ui->clipboardButton->setVisible(false);
    ui->emailButton->setVisible(false);
    ui->closeButton->setVisible(false);
    ui->jsbinButton->setVisible(false);
    ui->saveButton->setVisible(false);
//    this->statusBar()->setVisible(false);
//    connect(infoloader, SIGNAL(finished()), SLOT(showUI()));
    connect(infoloader, SIGNAL(newInfoAvailable(QString)), SLOT(updateLoadScreen(QString)), Qt::DirectConnection);
    connect(infoloader, SIGNAL(progressChange(int)), ui->progressBar, SLOT(setValue(int)), Qt::DirectConnection);
    QTimer::singleShot(0,this,SLOT(showUI()));
}

MainWindow::~MainWindow()
{
    delete ui;
}

QWidget* MainWindow::loadWidget(QString library, const char* function)
{
    typedef QWidget* (*fn)(QList<QPair<QString, QString> >, QObject*);
    fn v = (fn) QLibrary::resolve(infoloader->loadLib(qApp->applicationDirPath()+"/"+library), function);
    qDebug() << library <<  v;
    if (v) {
        return v(infoloader->resultAsRawpairs(), this);
    }
    return NULL;
}

bool MainWindow::callBoolFunction(QString library, const char *function)
{
    typedef bool (*fn)();
#ifdef MEEGO_EDITION_HARMATTAN
    fn v = (fn) QLibrary::resolve(infoloader->loadLib(qApp->applicationDirPath()+"/lib"+library), function);
#else
    fn v = (fn) QLibrary::resolve(infoloader->loadLib(qApp->applicationDirPath()+"/"+library), function);
#endif
//    qDebug() << "calling " << library << function << v;
    QTextStream sout(stdout);
    sout << "calling ";
    sout << library;
    sout << function << endl;
//    sout << v;
    if (v != 0) {
        return v();
    }
    sout << "Could not resolve func/lib " << qApp->applicationDirPath() << "/lib" << library << " " << infoloader->loadLib(qApp->applicationDirPath()+"/lib"+library) << " " << function << endl;
//    sout << QLibrary::errorString() << endl;
    return false;
}

void MainWindow::showUI()
{
    infoloader->run();

//    ui->webView->setHtml(html,QUrl("qrc:/"));

    QTextStream sout(stdout);
    sout << infoloader->resultAsText();

    ui->progressBar->setVisible(false);
    bool qmlUI = false;

    // If QtDeclarative and Qt Quick Components are available, use QML UI
    if (infoloader->isLoaded("QtDeclarative")) { // go for fancy declarative UI instead of QWidgets
        sout << "Declarative module present, contemplating QML UI";
        if (callBoolFunction("declarativeui", "isQmlUiAvailable")) {
            sout << "loading QML UI";
            QWidget* widget = loadWidget("declarativeui", "declarativeUI");
            if (widget) {
                qmlUI = true;
                ui->textBrowser->setVisible(false);
                ui->widget->setEnabled(true);
                ui->widget->setVisible(true);
                widget->showFullScreen();
                // Note that QML buttons should call the same methods as the auto-slot-connected buttons
            }
        }
    } else {
//        this->statusBar()->setVisible(true);
        ui->emailButton->setVisible(true);
        ui->jsbinButton->setVisible(true);
        ui->clipboardButton->setVisible(true);
        ui->saveButton->setVisible(true);
#ifndef Q_WS_MAEMO_5
        ui->closeButton->setVisible(true); // maemo5 has X provided by the window manager
#endif
    }

    if (!qmlUI) {
        ui->textBrowser->setHtml(infoloader->resultAsHTML());
    } else {
        delete ui->textBrowser;
        ui->textBrowser = 0;
    }
}

void MainWindow::updateLoadScreen(QString str)
{
    ui->textBrowser->setText(str + "\n" + ui->textBrowser->toPlainText());
    qApp->processEvents();
}


code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QClipboard>
#include <QDesktopServices>
#include <QUrl>
#include <QFile>
#include <QApplication>
#include <QTextStream>
#include <QFileDialog>
#include <QDebug>
#include "infoloader.h"

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
//    void startLoading() { infoloader->start(); }
//    void startLoading() { infoloader->run(); showUI(); }

public slots:
    void updateLoadScreen(QString str);
    void on_closeButton_clicked(bool checked) { this->close(); }
    void on_emailButton_clicked(bool checked) { QDesktopServices::openUrl(QUrl(QString("mailto:user@foo.com?subject=QtInfo&body=%0").arg(infoloader->resultAsText()))); }
#ifdef Q_WS_MAEMO_5
//    void on_mailButton_clicked(bool checked) { QDBusInterface browser("com.nokia.modest", "/com/nokia/modest", "com.nokia.modest")  ; browser.call("MailTo", "");}
#endif
    void on_saveButton_clicked(bool checked) { QFile outfile(QFileDialog::getSaveFileName(this, "Save output as", "/home/user/MyDocs/qtinfo.html")); outfile.open(QIODevice::WriteOnly); outfile.write(infoloader->resultAsHTML().toUtf8()); outfile.close();  }
    void on_jsbinButton_clicked(bool checked) { QDesktopServices::openUrl(QUrl("http://pastebin.com")); }
    void on_clipboardButton_clicked(bool checked) { QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(infoloader->resultAsText()); }
    void showUI();

private:
    QWidget * loadWidget(QString library, const char *function);
    bool callBoolFunction(QString library, const char *function);
    Ui::MainWindow *ui;
    InfoLoader* infoloader;

};

#endif // MAINWINDOW_H


code:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>480</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>QtInfo</string>
  </property>
  <widget class="QWidget" name="centralWidget">
   <layout class="QVBoxLayout" name="verticalLayout">
    <property name="margin">
     <number>0</number>
    </property>
    <item>
     <widget class="QTextBrowser" name="textBrowser">
      <property name="html">
       <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<meta name="qrichtext" content="1" />

Please wait, identifying libraries and components...
</string>
      </property>
     </widget>
    </item>
    <item>
     <widget class="QProgressBar" name="progressBar">
      <property name="value">
       <number>0</number>
      </property>
     </widget>
    </item>
    <item>
     <widget class="QWidget" name="widget" native="true">
      <property name="enabled">
       <bool>false</bool>
      </property>
     </widget>
    </item>
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
       <widget class="QPushButton" name="clipboardButton">
        <property name="text">
         <string>To clipboard</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QPushButton" name="jsbinButton">
        <property name="text">
         <string>To pastebin</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QPushButton" name="saveButton">
        <property name="text">
         <string>To file</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QPushButton" name="emailButton">
        <property name="text">
         <string>To email</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QPushButton" name="closeButton">
        <property name="text">
         <string>Close</string>
        </property>
       </widget>
      </item>
     </layout>
    </item>
   </layout>
  </widget>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>


code:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=QtInfo
Exec=/opt/qtinfo/bin/qtinfo
Icon=qtinfo
X-Window-Icon=qtinfo
X-Window-Icon-Dimmed=qtinfo
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable


code:
#-------------------------------------------------
#
# Project created by QtCreator 2011-03-17T15:58:35
#
#-------------------------------------------------

QT       += core gui

contains (QT_MAJOR_VERSION,5): QT += widgets

TARGET = qtinfo
TEMPLATE = app

SOURCES += main.cpp  \
    mainwindow.cpp \
    infoloader.cpp

HEADERS  += mainwindow.h \
    infoloader.h

FORMS    += mainwindow.ui

qnx {
# Cant switch UIs on BB10 so have to start with cascades upfront
    SOURCES -= main.cpp mainwindow.cpp
    HEADERS -= mainwindow.h
    SOURCES += maincascades.cpp maincascadeswindow.cpp
    HEADERS += maincascadeswindow.hpp
    CONFIG += cascades
    LIBS   += -lbbdata

}

symbian {
    TARGET.EPOCSTACKSIZE = 0x14000
    TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
    ICON=qtinfo.svg

    # Hide the icon from the menu while maintaining the application registered
    # this allows the laucher icon to be the only one visible
    # while the laucher can still find the GUI app in the list of installed apps.
    # comment out when the launcher is not used
    RSS_RULES += "hidden = KAppIsHidden;"
}

contains(QMAKE_HOST.os, Linux): {
    GITREV=$$system(git rev-parse HEAD)
    message(Git rev $$GITREV)
}

exists($$QMAKE_INCDIR_QT"/../qmsystem2/qmkeys.h"):!contains(MEEGO_EDITION,harmattan): {
  MEEGO_VERSION_MAJOR     = 1
  MEEGO_VERSION_MINOR     = 2
  MEEGO_VERSION_PATCH     = 0
  MEEGO_EDITION           = harmattan
  DEFINES += MEEGO_EDITION_HARMATTAN
}

CONFIG(release, debug|release): DEFINES += QT_NO_DEBUG_OUTPUT

RESOURCES += \
    qtinfo.qrc

unix:!symbian { # not funny
    desktopfile.files = $${TARGET}.desktop
    maemo5 {
        icon.files = $${TARGET}.png
        icon.path = /usr/share/icons/hicolor/64x64/apps
        desktopfile.path = /usr/share/applications/hildon
    } else {
        icon.files = $${TARGET}.svg
        icon.path = /usr/share/themes/base/meegotouch/icons
        desktopfile.path = /usr/share/applications
    }
    target.path = /opt/qtinfo/bin
#    INSTALLS += desktopfile icon target
}

load(sailfishsilicabackground)
contains(LIBS,-lsailfishsilicabackground): {
    message(SailfishOS build)
    # QML files and folders
    qml.files = *.qml pages cover main.qml

    # The .desktop file
    desktop.files = qtinfo_sailfish.desktop

    # Please do not modify the following line.
    include(../sailfishapplication/sailfishapplication.pri)

    OTHER_FILES = qtinfo.yaml

}

qnx {
    !contains($${PWD}, $${OUT_PWD}) { # copy files in case of shadow building (packaging duh)
        unix: COPY = cp -r
        win32: COPY = copy /y
        QMAKE_POST_LINK +=    $$COPY $${PWD}/bb10icon.png $${OUT_PWD}/icon.png
        QMAKE_POST_LINK += && $$COPY $${PWD}/../cascadesui/assets $${OUT_PWD}/../cascadesui
    }
    OTHER_FILES += \
        bb10icon.png \
        bar-descriptor.xml
}

symbian: include(../qtinfo_symbianplatsec.pri)


code:
<RCC>
    <qresource prefix="/">
        <file>Qt_info.html</file>
        <file>end.png</file>
    </qresource>
</RCC>


code:
Name:    qtinfo
Summary: Your Qt Development Swiss Army Knife Info-Tool
Version: 1.0
Release: 1
Group:   Qt/Qt
License: LICENSE
Sources:
    - "%{name}-%{version}.tar.bz2"
Description: |
  Your Qt Development Swiss Army Knife Info-Tool
# Qt Applications generally don't use configure and do use qmake
Configure: none
Builder: qmake
# pkgconfigs we depend on to build
PkgConfigBR:
  - ""
# Packages we depend on to build
PkgBR:
  - "libqtwebkit-devel libqt-devel libqtopengl-devel qt-mobility-devel"
# Packages we require to run
Requires:
  - ""
Files:
  - "/opt"

# This is a spectacle file.
# It is a yaml file that uses specify to manage the spec file used to package the application.
# See https://wiki.merproject.org/wiki/Spectacle for more information


code:
[Desktop Entry]
Type=Application
Name=untitled
Icon=icon-launcher-gallery
Exec=invoker --type=j -s /opt/sdk/bin/untitled
Comment=Sailfish UI application


code:
#all libraries and Qt based GUI share the same UID
#self-signable capabilities are used as a default

symbian {

    TARGET.UID3 = 0xA00002D6
    TARGET.CAPABILITY = LocalServices NetworkServices ReadUserData UserEnvironment WriteUserData

}


code:
import Qt 4.7

Rectangle {
    width: 100
    height: 100
}


code:
import QtQuick 1.0

Rectangle {
    width: 100
    height: 100
}


code:
import QtQuick 1.1

Rectangle {
    width: 100
    height: 100
}


code:
import QtQuick 2.0

Rectangle {
    width: 100
    height: 100
}


code:
#include "qtquick2info.h"
#include <QQuickView>
#include <QQmlEngine>
#include <QStringList>
#include <QDir>
#include <QDebug>

QString qtQuickVersion()
{
    QQuickView view;
    view.setSource(QUrl("qrc:///qml/qtquick20.qml"));
    if (view.status() == QQuickView::Ready && view.errors().length() == 0) return "2.0";
    view.setSource(QUrl("qrc:///qml/qtquick11.qml"));
    if (view.status() == QQuickView::Ready && view.errors().length() == 0) return "1.1";
    view.setSource(QUrl("qrc:///qml/qtquick10.qml"));
    if (view.status() == QQuickView::Ready && view.errors().length() == 0) return "1.0";
    view.setSource(QUrl("qrc:///qml/qt47.qml"));
    if (view.status() == QQuickView::Ready && view.errors().length() == 0) return "1.0 (import Qt 4.7)";

    return "Could not determine Qt Quick version";
}

// Parses a qmldir file, outputs the components defined in qmldir to result.
void parseQmldir(QString& fileName, QStringList& result)
{
    QFile file(fileName);

    if (file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QTextStream in(&file);
        QString line = in.readLine();
        while (!line.isNull()) {
            QStringList items = line.split(' ');

            if (items.length() > 1)
            {
                // qmldir has a line "plugin dllname", ignore that
                if (items.at(0) != "plugin")
                {
                    // Append component name + version
                    QString component = "    ";
                    component += items.at(0) + " " + items.at(1);
                    result.append(component);
                }
            }

            line = in.readLine();
        }

        file.close();
    }
}

// Searches for QML plugins in a directory + all its subdirectories
// Outputs plugin import names "e.g. com.nokia.symbian" to pluginList and all the existing
// Qt Quick Components to qtComponentsList
void searchPlugin(QString path, QString plugin, QStringList& pluginList, QStringList& qtComponentsList)
{
    QDir directory(path);
    QStringList dirs = directory.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);

    if (directory.exists("qmldir"))
    {
        // This directory contains file qmldir, so it's probably
        // a plugin
        pluginList.append(plugin);

        if (plugin == "Qt.labs.components" || plugin == "Qt.labs.components.native" ||
            plugin == "com.nokia.symbian" || plugin == "com.nokia.meego" ||
            plugin == "com.nokia.extras" || plugin == "bb.cascades")
        {
            qtComponentsList.append(""+plugin+"");
            QString qmldir = path+"/qmldir";
            parseQmldir(qmldir, qtComponentsList);
        }
    }

    // Go through all subdirs
    foreach(QString entry, dirs)
    {
        QString prefix = plugin == "" ? "" : ".";
        searchPlugin(path+"/"+entry, plugin+prefix+entry, pluginList, qtComponentsList);
    }
}

// Returns a string with all QML plugins found from the QDeclarativeEngine import path
QString qtQuickPlugins(QStringList& qtComponents)
{
    QQmlEngine engine;
    QStringList importPaths = engine.importPathList();
    QStringList plugins;

    foreach(QString path, importPaths)
    {
        searchPlugin(path,"",plugins, qtComponents);
    }

    QString pluginList;
    foreach(QString plugin, plugins)
    {
        pluginList += plugin + "
";
    }

    return pluginList;
}

QList<QPair<QString, QString> > qtQuick2Info()
{
    QList<QPair<QString, QString> > info;
    info.append(QPair<QString,QString>("section", "Qt Quick (via QtQml/Quick)"));

    info.append(QPair<QString,QString>("Qt Quick version", qtQuickVersion()));

    QStringList plugins;
    QStringList qtComponents;

    info.append(QPair<QString,QString>("Qt Quick plugins", qtQuickPlugins(qtComponents)));

    QString components;
    foreach(QString component, qtComponents)
    {
        components += component + "
";
    }

    if (!components.isEmpty()) info.append(QPair<QString,QString>("Qt Components", components));

    QQmlEngine engine;
    QStringList importPaths = engine.importPathList();
    QString list;
    foreach(QString path, importPaths)
    {
        list.append(path + "
");
    }

    info.append(QPair<QString,QString>("Qt Quick import path", list));

    return info;
}

#ifdef _MSC_VER
QString qtQuick2InfoQString()
{
    QStringList qsl;
    typedef QPair<QString, QString> StringPair;
    QList<StringPair> info = qtQuick2Info();
    foreach (StringPair pair, info)
    {
       qsl << pair.first + "##PAIRSEPARATOR##" + pair.second;
    }
    return qsl.join("##LINESEPARATOR##");
}
#endif


code:
#ifndef QTQUICK2INFO_H
#define QTQUICK2INFO_H

#include <QList>
#include <QPair>
#include <QString>

#ifdef Q_OS_WIN
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT
#endif

extern "C" MY_EXPORT QString qtQuick2InfoQString();
#ifndef _MSC_VER
extern "C" {
QList<QPair<QString, QString> > qtQuick2Info();
}
#endif

#endif // QTQUICK2INFO_H


code:
######################################################################
# Automatically generated by qmake (2.01a) to 24. maalis 09:24:08 2011
######################################################################

TEMPLATE = lib
#TARGET =
DEPENDPATH += .
INCLUDEPATH += .

QT += qml quick

# Input
HEADERS += qtquick2info.h
SOURCES += qtquick2info.cpp

unix:!symbian: {
    target.path = /opt/qtinfo/bin
    INSTALLS += target
}

OTHER_FILES += \
    qtquick10.qml \
    qtquick11.qml \
    qtquick20.qml \
    qt47.qml

RESOURCES += \
    qtquick2qmls.qrc


code:
<RCC>
    <qresource prefix="/qml">
        <file>qt47.qml</file>
        <file>qtquick10.qml</file>
        <file>qtquick11.qml</file>
        <file>qtquick20.qml</file>
    </qresource>
</RCC>


code:
#include "qtquickinfo.h"
#include <QtDeclarative>
#include <QStringList>
#include <QDebug>

QString qtQuickVersion()
{
#ifdef Q_OS_BLACKBERRY
    return "Could not determine Qt Quick version";
#endif
    QDeclarativeView view;
    view.setSource(QUrl("qrc:///qml/qtquick20.qml"));
    if (view.status() == QDeclarativeView::Ready && view.errors().length() == 0) return "2.0";
    view.setSource(QUrl("qrc:///qml/qtquick11.qml"));
    if (view.status() == QDeclarativeView::Ready && view.errors().length() == 0) return "1.1";
    view.setSource(QUrl("qrc:///qml/qtquick10.qml"));
    if (view.status() == QDeclarativeView::Ready && view.errors().length() == 0) return "1.0";
    view.setSource(QUrl("qrc:///qml/qt47.qml"));
    if (view.status() == QDeclarativeView::Ready && view.errors().length() == 0) return "1.0 (import Qt 4.7)";

    return "Could not determine Qt Quick version";
}

// Parses a qmldir file, outputs the components defined in qmldir to result.
void parseQmldir(QString& fileName, QStringList& result)
{
    QFile file(fileName);

    if (file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QTextStream in(&file);
        QString line = in.readLine();
        while (!line.isNull()) {
            QStringList items = line.split(' ');

            if (items.length() > 1)
            {
                // qmldir has a line "plugin dllname", ignore that
                if (items.at(0) != "plugin")
                {
                    // Append component name + version
                    QString component = "    ";
                    component += items.at(0) + " " + items.at(1);
                    result.append(component);
                }
            }

            line = in.readLine();
        }

        file.close();
    }
}

// Searches for QML plugins in a directory + all its subdirectories
// Outputs plugin import names "e.g. com.nokia.symbian" to pluginList and all the existing
// Qt Quick Components to qtComponentsList
void searchPlugin(QString path, QString plugin, QStringList& pluginList, QStringList& qtComponentsList)
{
    QDir directory(path);
    QStringList dirs = directory.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);

    if (directory.exists("qmldir"))
    {
        // This directory contains file qmldir, so it's probably
        // a plugin
        pluginList.append(plugin);

        if (plugin == "Qt.labs.components" || plugin == "Qt.labs.components.native" ||
            plugin == "com.nokia.symbian" || plugin == "com.nokia.meego" ||
            plugin == "com.nokia.extras" || plugin == "bb.cascades")
        {
            qtComponentsList.append(""+plugin+"");
            QString qmldir = path+"/qmldir";
            parseQmldir(qmldir, qtComponentsList);
        }
    }

    // Go through all subdirs
    foreach(QString entry, dirs)
    {
        QString prefix = plugin == "" ? "" : ".";
        searchPlugin(path+"/"+entry, plugin+prefix+entry, pluginList, qtComponentsList);
    }
}

// Returns a string with all QML plugins found from the QDeclarativeEngine import path
QString qtQuickPlugins(QStringList& qtComponents)
{
    QDeclarativeEngine engine;
    QStringList importPaths = engine.importPathList();
    QStringList plugins;

    foreach(QString path, importPaths)
    {
        searchPlugin(path,"",plugins, qtComponents);
    }

    QString pluginList;
    foreach(QString plugin, plugins)
    {
        pluginList += plugin + "
";
    }

    return pluginList;
}

QList<QPair<QString, QString> > qtQuickInfo()
{
    QList<QPair<QString, QString> > info;
    info.append(QPair<QString,QString>("section", "Qt Quick (via QtDeclarative)"));

    info.append(QPair<QString,QString>("Qt Quick version", qtQuickVersion()));

    QStringList plugins;
    QStringList qtComponents;

    info.append(QPair<QString,QString>("Qt Quick plugins", qtQuickPlugins(qtComponents)));

    QString components;
    foreach(QString component, qtComponents)
    {
        components += component + "
";
    }

    if (!components.isEmpty()) info.append(QPair<QString,QString>("Qt Components", components));

    QDeclarativeEngine engine;
    QStringList importPaths = engine.importPathList();
    QString list;
    foreach(QString path, importPaths)
    {
        list.append(path + "
");
    }

    info.append(QPair<QString,QString>("Qt Quick import path", list));

    return info;
}

#ifdef _MSC_VER
QString qtQuickInfoQString()
{
    QStringList qsl;
    typedef QPair<QString, QString> StringPair;
    QList<StringPair> info = qtQuickInfo();
    foreach (StringPair pair, info)
    {
       qsl << pair.first + "##PAIRSEPARATOR##" + pair.second;
    }
    return qsl.join("##LINESEPARATOR##");
}
#endif


code:
#ifndef QTQUICKINFO_H
#define QTQUICKINFO_H

#include <QList>
#include <QPair>
#include <QString>

#ifdef Q_OS_WIN
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT
#endif

extern "C" MY_EXPORT QString qtQuickInfoQString();
#ifndef _MSC_VER
extern "C" {
QList<QPair<QString, QString> > qtQuickInfo();
}
#endif

#endif // QTQUICKINFO_H


code:
######################################################################
# Automatically generated by qmake (2.01a) to 24. maalis 09:24:08 2011
######################################################################

TEMPLATE = lib
#TARGET =
DEPENDPATH += .
INCLUDEPATH += .

QT += core gui declarative

# Input
HEADERS += qtquickinfo.h
SOURCES += qtquickinfo.cpp

symbian {
    #Build STDDLL
    CONFIG += stdbinary

    TARGET = qtquickinfolib

    #Symbian specific definitions
    MMP_RULES += EXPORTUNFROZEN

    TARGET.EPOCALLOWDLLDATA = 1

    addFiles.sources = $${TARGET}.dll
    addFiles.path = !:/sys/bin
    DEPLOYMENT += addFiles
}

unix:!symbian: {
    target.path = /opt/qtinfo/bin
    INSTALLS += target
}

OTHER_FILES += \
    qtquick10.qml \
    qtquick11.qml \
    qtquick20.qml \
    qt47.qml

RESOURCES += \
    qtquickqmls.qrc

include(../qtinfo_symbianplatsec.pri)


code:
#include <QApplication>
#include <QDir>
#include <QGraphicsObject>

#ifdef DESKTOP
#include <QGLWidget>
#endif

#include <QDeclarativeComponent>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
#include <QDeclarativeView>

#ifdef HAS_BOOSTER
#include <MDeclarativeCache>
#endif

#include "sailfishapplication.h"

QApplication *Sailfish::createApplication(int &argc, char **argv)
{
#ifdef HAS_BOOSTER
    return MDeclarativeCache::qApplication(argc, argv);
#else
    return new QApplication(argc, argv);
#endif
}

QDeclarativeView *Sailfish::createView(const QString &file)
{
    QDeclarativeView *view;
#ifdef HAS_BOOSTER
    view = MDeclarativeCache::qDeclarativeView();
#else
    view = new QDeclarativeView;
#endif

    bool isDesktop = qApp->arguments().contains("-desktop");

    QString path;
    if (isDesktop) {
        path = qApp->applicationDirPath() + QDir::separator();
#ifdef DESKTOP
        view->setViewport(new QGLWidget);
#endif
    } else {
        path = QString(DEPLOYMENT_PATH);
    }
    view->setSource(QUrl::fromLocalFile(path + file));

    return view;
}

void Sailfish::showView(QDeclarativeView* view) {
    view->setResizeMode(QDeclarativeView::SizeRootObjectToView);

    bool isDesktop = qApp->arguments().contains("-desktop");

    if (isDesktop) {
        view->setFixedSize(480, 854);
        view->rootObject()->setProperty("_desktop", true);
        view->show();
    } else {
        view->setAttribute(Qt::WA_OpaquePaintEvent);
        view->setAttribute(Qt::WA_NoSystemBackground);
        view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
        view->viewport()->setAttribute(Qt::WA_NoSystemBackground);

        view->showFullScreen();
    }
}


code:
#ifndef SAILFISHAPPLICATION_H
#define SAILFISHAPPLICATION_H

class QString;
class QApplication;
class QDeclarativeView;

namespace Sailfish {

QApplication *createApplication(int &argc, char **argv);
QDeclarativeView *createView(const QString &);
void showView(QDeclarativeView* view);

}

#endif // SAILFISHAPPLICATION_H


code:
QT += declarative

SOURCES += $$PWD/sailfishapplication.cpp
HEADERS += $$PWD/sailfishapplication.h
INCLUDEPATH += $$PWD

#TARGETPATH = /opt/sdk/bin
#target.path = $$TARGETPATH

DEPLOYMENT_PATH = /opt/sdk/share/$$TARGET
qml.path = $$DEPLOYMENT_PATH
desktop.path = /opt/sdk/share/applications

contains(CONFIG, desktop) {
    DEFINES *= DESKTOP
    QT += opengl
}

INSTALLS += target qml desktop

DEFINES += DEPLOYMENT_PATH=\"\\\"\"$${DEPLOYMENT_PATH}/\"\\\"\"

CONFIG += link_pkgconfig
packagesExist(qdeclarative-boostable) {
    message("Building with qdeclarative-boostable support")
    DEFINES += HAS_BOOSTER
    PKGCONFIG += qdeclarative-boostable
} else {
    warning("qdeclarative-boostable not available; startup times will be slower")
}


code:
#include "sqlinfo.h"
#include <QSqlDatabase>
#include <QStringList>

QList<QPair<QString, QString> > sqlInfo()
{
    QList<QPair<QString, QString> > info;
    info.append(QPair<QString,QString>("section", "SQL"));

    info.append(QPair<QString,QString>("Drivers", QSqlDatabase::drivers().join(", ")));

    return info;
}

#ifdef _MSC_VER
QString sqlInfoQString()
{
    QStringList qsl;
    typedef QPair<QString, QString> StringPair;
    QList<StringPair> info = sqlInfo();
    foreach (StringPair pair, info)
    {
       qsl << pair.first + "##PAIRSEPARATOR##" + pair.second;
    }
    return qsl.join("##LINESEPARATOR##");
}
#endif


code:
#ifndef SQLINFO_H
#define SQLINFO_H

#include <QList>
#include <QPair>
#include <QString>

#ifdef Q_OS_WIN
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT
#endif

extern "C" MY_EXPORT QString sqlInfoQString();
#ifndef _MSC_VER
extern "C" MY_EXPORT QList<QPair<QString, QString> > sqlInfo();
#endif

#endif // SQLINFO_H


code:
######################################################################
# Automatically generated by qmake (2.01a) to 24. maalis 09:24:08 2011
######################################################################

TEMPLATE = lib
#TARGET =
DEPENDPATH += .
INCLUDEPATH += .

QT += core gui sql

# Input
HEADERS += sqlinfo.h
SOURCES += sqlinfo.cpp

symbian {
    #Build STDDLL
    CONFIG += stdbinary

    TARGET = sqlinfolib

    #Symbian specific definitions
    MMP_RULES += EXPORTUNFROZEN

    TARGET.EPOCALLOWDLLDATA = 1
    addFiles.sources = $${TARGET}.dll
    addFiles.path = !:/sys/bin
    DEPLOYMENT += addFiles
}

unix:!symbian: {
    target.path = /opt/qtinfo/bin
    INSTALLS += target
}

include(../qtinfo_symbianplatsec.pri)


code:
#include "webkitinfo.h"
#include <QtWebKit>
#include <QStringList>
#include <QSslSocket>

QList<QPair<QString, QString> > webkitInfo()
{
    QList<QPair<QString, QString> > info;
    info.append(QPair<QString,QString>("section", "WebKit"));

    info.append(QPair<QString,QString>("WebKit version", qWebKitVersion()));
    info.append(QPair<QString,QString>("SSL support", (QSslSocket::supportsSsl() ? "YES" : "NO")));

    //TODO The QtWebKit version (such as 2.1.0 in Symbian), QTWEBKIT_VERSION is no good as it's compile time

    //TODO presence of the QtWebKit platform plugin would also be interesting.
    //  QtWebKit tries to load platformplugin.dll on startup, and if that is
    //  found, it will be used for certain platform-specific operations.

    //TODO get plugin list (flash, java, etc)

    QStringList valuelist;
    info.append(QPair<QString,QString>("section", "Networking"));
    foreach (QNetworkInterface qni, QNetworkInterface::allInterfaces () ) {
        if (!qni.addressEntries().isEmpty())
            info.append(QPair<QString,QString>(qni.name(), QString("%0 - %1").arg(qni.hardwareAddress()).arg(qni.addressEntries().at(0).ip().toString())));
        else
            info.append(QPair<QString,QString>(qni.name(), qni.hardwareAddress()));
    }

    // 4.7 functionality, for an eventual networkinfo plugin
    // QList<QNetworkConfiguration> QNetworkConfigurationManager::allConfigurations

    return info;
}

#ifdef _MSC_VER
QString webkitInfoQString()
{
    QStringList qsl;
    typedef QPair<QString, QString> StringPair;
    QList<StringPair> info = webkitInfo();
    foreach (StringPair pair, info)
    {
       qsl << pair.first + "##PAIRSEPARATOR##" + pair.second;
    }
    return qsl.join("##LINESEPARATOR##");
}
#endif


code:
#ifndef WEBKITINFO_H
#define WEBKITINFO_H

#include <QList>
#include <QPair>
#include <QString>

#ifdef Q_OS_WIN
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT
#endif

extern "C" MY_EXPORT QString webkitInfoQString();
#ifndef _MSC_VER
extern "C" {
QList<QPair<QString, QString> > webkitInfo();
}
#endif

#endif // WEBKITINFO_H


code:
######################################################################
# Automatically generated by qmake (2.01a) to 24. maalis 09:24:08 2011
######################################################################

TEMPLATE = lib
#TARGET =
DEPENDPATH += .
INCLUDEPATH += .

QT += core gui webkit network

# Input
HEADERS += webkitinfo.h
SOURCES += webkitinfo.cpp

symbian {
    #Build STDDLL
    CONFIG += stdbinary

    TARGET = webkitinfolib

    #Symbian specific definitions
    MMP_RULES += EXPORTUNFROZEN
    TARGET.EPOCALLOWDLLDATA = 1

    addFiles.sources = $${TARGET}.dll
    addFiles.path = !:/sys/bin
    DEPLOYMENT += addFiles
}

unix:!symbian: {
    target.path = /opt/qtinfo/bin
    INSTALLS += target
}

include(../qtinfo_symbianplatsec.pri)


code:
# twitrip

Twitter profile image downloader

license: mit


code:
#!/usr/bin/env zsh
set -u -o pipefail

#==============================================================================
# Initialization Table
#==============================================================================

_proto_scheme="https"
_nitter_host="${_proto_scheme}://nitter.snopyta.org"

#==============================================================================
# Error Table
#==============================================================================

_check_deps()
{
  declare -i local _dep_ct
  local _deps=(curl twint wget)

  for dep_ct in {1..${#deps[@]}}; do
    [[ "$(which ${_deps[${_dep_ct}]})" =~ "not found" ]] \
      && __err_dep_path ${_deps[${_dep_ct}]} || :
  done

  unset _dep_ct _deps
}

_err_username()
{
  declare -i local _err_code
  _err_code="${1}"

  case "${_err_code}" in
    1) echo "[ERR.] Illegal character in username string." ;;
    2) echo "[ERR.] usage: twitrip <username>" ;;
    *) echo "[ERR.] usage: twitrip <username>" ;;
  esac

  unset _err_code
  exit
}

__err_dep_path()
{
  echo "[ERR.] ${1} not found. Ensure it is installed and in your PATH."
  exit
}

#==============================================================================
# Executive Table
#==============================================================================

_directory_init()
{
  echo "[${USERNAME}] Creating directory"

  mkdir -p "${HOME}/rips/twitter/${USERNAME}"
  _user_dir="${HOME}/rips/twitter/${USERNAME}"
}

__unshorten()
{
  echo "[${USERNAME}] Resolving URL"

  _media_url=$(curl 'https://wheregoes.com/retracer.php' 2>/dev/null \
                -H  'Content-Type: application/x-www-form-urlencoded' \
                --data-raw "traceme=${_short_url}&url=" \
                | grep tracecontent \
                | grep -Eo 'http[^ ]{1,}' \
                | sed 's|<br||g' \
                | grep -v "${_short_url}" \
                | tail -n 1 \
                | sed 's|twitter.com|nitter.snopyta.org|g')
}

_get_img_posts()
{
  echo "[${USERNAME}] Building post index"

  _img_posts=($(twint -u "${USERNAME}" --images 2>/dev/null \
                 | grep -Eo 'pic.twitter.com[^ ]{1,}'))
}

_iterative_download()
{
  declare local    _username
  declare local    _img_url
  declare local    _img_param
  declare local    _img_filename
  declare -a local _media_post_array
  declare -i local _status_no
  declare local    _username

  for i in {1..${#_img_posts[@]}}; do
    _short_url="${_img_posts[${i}]}"

    __unshorten

    _status_no=$(cut -d '/' -f1 <<< ${_media_url##*status/})
    _username=$(cut -d '/' -f1 <<<  ${_media_url##$_nitter_host/})
    _media_post_array=($(wget $_media_url -qO- /dev/null \
                          | grep -Eo '/[^ ]{1,}orig'))

    echo "[${_username}] post:${_status_no} [${i}/${#_img_posts[@]}]"

    for j in {1..${#_media_post_array[@]}}; do
      _img_url="${_nitter_host}${_media_post_array[${j}]}"
      _img_param="${${_img_url##*(%2F|/)}%.jpg}"
      _img_param=$(awk -F '%3F' '{print $1}' <<< "${_img_param}")
      _img_filename="${_username}_${_status_no}_${_img_param}"

      echo "[${_status_no}] Downloading image [${j}/${#_media_post_array[@]}]"

      wget -U mozilla $_img_url \
        -O "${_user_dir}"/"${_img_filename}" \
        -nc 2>/dev/null
    done
  done
}

###############################################################################
# Main Function
###############################################################################

_main()
{
  [[ -z "${1}" ]] && _err_username 2 || :
  [[ "${1}" =~ [^a-zA-Z0-9] ]] && err_username 1 || USERNAME="${1}"

  _check_deps
  _directory_init
  _get_img_posts
  _iterative_download
}

###############################################################################
# Main Call
###############################################################################

_main "$@"

echo "[${USERNAME}] Exiting"

path: bin/twitrip


code: ## ![Maxima, a Computer Algebra System](https://maxima.sourceforge.io/index.html)

repo_name: Tonypythony/new


code: demine-build*

repo_name: snapshot/demine

path: .gitignore


code:
Copyright (c) 2011 Mladen Milankovic <mmlado at gmail.com>.

This file is part of Demine application

Sink Submarines is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Sink Submarines is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Demine.  If not, see <http://www.gnu.org/licenses/>.


code:
The Debian Package demine
----------------------------

Comments regarding the Package

 -- Mladen Milankovic <mmlado@unknown>  Fri, 24 Jun 2011 19:07:04 +0200


code:
demine (0.1.0) unstable; urgency=low

  * Colors made color-blind friendly
  * Dialog color changed to black
  * Table jumps to zero coordinates when game starts
  * Menu added, through main window, with options new game and options
  * Number of rows, columns and mines can be changed in options

 -- Mladen Milankovic <mmlado@gmail.com>  Fri, 24 Jun 2011 19:07:04 +0200


code:
This package was debianized by Mladen Milankovic <mmlado@gmail.com> on
Fri, 24 Jun 2011 19:07:04 +0200.

Upstream Author(s):

    Mladen Milankovic <mmlado@gmail.com>

Copyright:

    <Copyright (C) 2011 Mladen Milankovic>

License:

This file is part of Demine application

Demine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Demine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Demine.  If not, see <http://www.gnu.org/licenses/>.

On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

The Debian packaging is (C) 2011, Mladen Milankovic <mmlado@gmail.com> and
is licensed under the GPL, see above.

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.


code:
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

configure: configure-stamp
configure-stamp:
	dh_testdir
        # qmake PREFIX=/usr# Uncomment this line for use without Qt Creator

	touch configure-stamp

build: build-stamp

build-stamp: configure-stamp
	dh_testdir

	# Add here commands to compile the package.
        # $(MAKE) # Uncomment this line for use without Qt Creator
	#docbook-to-man debian/demine.sgml > demine.1

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	$(MAKE) clean

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/demine.
	$(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/demine install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	# dh_shlibdeps # Uncomment this line for use without Qt Creator
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure


code:
The Debian Package demine
----------------------------

Comments regarding the Package

 -- Mladen Milankovic <mmlado@unknown>  Fri, 24 Jun 2011 19:07:00 +0200


code:
demine (0.5.0) unstable; urgency=low
  * timer added to track player time. It pauses/resumes depending if the game is active (settings and about page)
  * standby page added. Shown when application is inactive. It pauses/resumes the game

 -- Mladen Milankovic <developer@mmlado.com>  Fri, 10 Feb 2012 18:55:59 +0100

demine (0.4.1) unstable; urgency=low
  * typo fix in about page

 -- Mladen Milankovic <developer@mmlado.com>  Tue, 07 Feb 2012 20:46:14 +0100

demine (0.4.0) unstable; urgency=low
  * settings for table (number of columns, rows and mines) are saved in settings file and loaded when app starts

 -- Mladen Milankovic <developer@mmlado.com>  Thu, 02 Feb 2012 07:32:16 +0100

demine (0.3.0) unstable; urgency=low
  * Initial release

 -- Mladen Milankovic <developer@mmlado.com>  Tue, 10 Jan 2012 20:00:00 +0100


code:
This package was debianized by Mladen Milankovic <mmlado@mmlado.com> on
Fri, 24 Jun 2011 19:07:00 +0200.

It was downloaded from <url://example.com>

Upstream Author(s):

    <put author's name and email here>
    <likewise for another author>

Copyright:

    <Copyright (C) YYYY Name OfAuthor>
    <likewise for another author>

License:

    This package is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This package is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this package; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

The Debian packaging is (C) 2011, Mladen Milankovic <mmlado@unknown> and
is licensed under the GPL, see above.

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.


code:
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

configure: configure-stamp
configure-stamp:
	dh_testdir
	# qmake PREFIX=/usr# Uncomment this line for use without Qt Creator

	touch configure-stamp

build: build-stamp

build-stamp: configure-stamp
	dh_testdir

	# Add here commands to compile the package.
	# $(MAKE) # Uncomment this line for use without Qt Creator
	#docbook-to-man debian/demine.sgml > demine.1

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	$(MAKE) clean

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/demine.
	$(MAKE)  INSTALL_ROOT="$(CURDIR)"/debian/demine install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	# dh_shlibdeps # Uncomment this line for use without Qt Creator
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure


code:
Name: demine
Summary: Demine is a clone of the popular game minesweeper
Version: 0.0.1
Release: 1
License: <Enter your application's license here>
Group: <Set your application's group here>
%description
<Insert longer, multi-line description
here.>

%prep
%setup -q

%build
# You can leave this empty for use with Qt Creator.
%install
rm -rf %{buildroot}
make INSTALL_ROOT=%{buildroot} install

%clean
rm -rf %{buildroot}

BuildRequires:
# %define _unpackaged_files_terminate_build 0
%files
%defattr(-,root,root,-)/usr
/opt
# Add additional files to be included in the package here.
%pre
# Add pre-install scripts here.%post
/sbin/ldconfig # For shared libraries
%preun
# Add pre-uninstall scripts here.%postun
# Add post-uninstall scripts here.


code:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=demine
Exec=/opt/demine/bin/demine
Icon=demine
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable


code:
# Add more folders to ship with the application, here
folder_01.source = qml/demine
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01

# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =

symbian:TARGET.UID3 = 0xEAE47473

# Smart Installer package's UID
# This UID is from the protected range and therefore the package will
# fail to install if self-signed. By default qmake uses the unprotected
# range value if unprotected UID is defined for the application and
# 0x2002CCCF value if protected UID is given to the application
#symbian:DEPLOYMENT.installer_header = 0x2002CCCF

# Allow network access on Symbian
symbian:TARGET.CAPABILITY += NetworkServices

# If your application uses the Qt Mobility libraries, uncomment the following
# lines and add the respective components to the MOBILITY variable.
# CONFIG += mobility
# MOBILITY +=
CONFIG += qdeclarative-boostable

# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp \
    mainwindow.cpp

# Please do not modify the following two lines. Required for deployment.
include(qmlapplicationviewer/qmlapplicationviewer.pri)
qtcAddDeployment()

OTHER_FILES += \
    ../qtc_packaging/debian_harmattan/rules \
    ../qtc_packaging/debian_harmattan/README \
    ../qtc_packaging/debian_harmattan/copyright \
    ../qtc_packaging/debian_harmattan/control \
    ../qtc_packaging/debian_harmattan/compat \
    ../qtc_packaging/debian_harmattan/changelog \
    ../qtc_packaging/debian_fremantle/rules \
    ../qtc_packaging/debian_fremantle/README \
    ../qtc_packaging/debian_fremantle/copyright \
    ../qtc_packaging/debian_fremantle/control \
    ../qtc_packaging/debian_fremantle/compat \
    ../qtc_packaging/debian_fremantle/changelog \
    ../qtc_packaging/meego.spec \
    ../licence.txt

HEADERS += \
    mainwindow.h \
    settings.h


code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="64px"
   height="64px"
   id="svg3104"
   version="1.1"
   inkscape:version="0.48.1 r9760"
   sodipodi:docname="New document 10">
  <defs
     id="defs3106">
    <linearGradient
       inkscape:collect="always"
       id="linearGradient5521">
      <stop
         style="stop-color:#626667;stop-opacity:1;"
         offset="0"
         id="stop5523" />
      <stop
         style="stop-color:#626667;stop-opacity:0;"
         offset="1"
         id="stop5525" />
    </linearGradient>
    <linearGradient
       id="linearGradient4063">
      <stop
         style="stop-color:#5b5f60;stop-opacity:1;"
         offset="0"
         id="stop4065" />
      <stop
         style="stop-color:#5b5f60;stop-opacity:0;"
         offset="1"
         id="stop4067" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       id="linearGradient4053"
       osb:paint="gradient">
      <stop
         style="stop-color:#000000;stop-opacity:1;"
         offset="0"
         id="stop4055" />
      <stop
         style="stop-color:#000000;stop-opacity:0;"
         offset="1"
         id="stop4057" />
    </linearGradient>
    <radialGradient
       inkscape:collect="always"
       xlink:href="#linearGradient5521"
       id="radialGradient5527"
       cx="29.965534"
       cy="37.925095"
       fx="29.965534"
       fy="37.925095"
       r="26.272728"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(5.1071169,-5.1891099,3.3633319,3.3101882,-242.76168,82.025601)" />
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="8.8122669"
     inkscape:cx="18.583977"
     inkscape:cy="36.968676"
     inkscape:current-layer="layer1"
     showgrid="true"
     inkscape:document-units="px"
     inkscape:grid-bbox="true"
     inkscape:snap-grids="false"
     showguides="false"
     inkscape:window-width="1680"
     inkscape:window-height="995"
     inkscape:window-x="-4"
     inkscape:window-y="-1"
     inkscape:window-maximized="1">
    <inkscape:grid
       type="xygrid"
       id="grid3134"
       empspacing="5"
       visible="true"
       enabled="true"
       snapvisiblegridlinesonly="true" />
  </sodipodi:namedview>
  <metadata
     id="metadata3109">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     id="layer1"
     inkscape:label="Base"
     inkscape:groupmode="layer">
    <path
       sodipodi:type="arc"
       style="fill:url(#radialGradient5527);fill-opacity:1;opacity:1;fill-rule:nonzero"
       id="path3130"
       sodipodi:cx="38.272728"
       sodipodi:cy="31.727272"
       sodipodi:rx="26.272728"
       sodipodi:ry="26.272728"
       d="m 64.545456,31.727272 a 26.272728,26.272728 0 1 1 -52.545456,0 26.272728,26.272728 0 1 1 52.545456,0 z"
       transform="matrix(1.0263929,0,0,1.0263929,-7.1562324,-0.59850525)" />
  </g>
  <g
     inkscape:groupmode="layer"
     id="layer3"
     inkscape:label="Circles">
    <path
       sodipodi:type="arc"
       style="fill:none;stroke:#000000;stroke-opacity:1"
       id="path5530"
       sodipodi:cx="32.000847"
       sodipodi:cy="30.750895"
       sodipodi:rx="26.894329"
       sodipodi:ry="26.894329"
       d="m 58.895176,30.750895 a 26.894329,26.894329 0 1 1 -53.7886582,0 26.894329,26.894329 0 1 1 53.7886582,0 z"
       transform="matrix(0.69720063,0,0,0.69720063,9.9382462,10.560457)" />
    <path
       sodipodi:type="arc"
       style="fill:none;stroke:#000000;stroke-opacity:1"
       id="path5530-4"
       sodipodi:cx="32.000847"
       sodipodi:cy="30.750895"
       sodipodi:rx="26.894329"
       sodipodi:ry="26.894329"
       d="m 58.895176,30.750895 a 26.894329,26.894329 0 1 1 -53.7886582,0 26.894329,26.894329 0 1 1 53.7886582,0 z"
       transform="matrix(0.60000282,0,0,0.60000282,13.208224,13.230246)" />
    <path
       sodipodi:type="arc"
       style="fill:none;stroke:#000000;stroke-opacity:1"
       id="path5530-4-4"
       sodipodi:cx="32.000847"
       sodipodi:cy="30.750895"
       sodipodi:rx="26.894329"
       sodipodi:ry="26.894329"
       d="m 58.895176,30.750895 a 26.894329,26.894329 0 1 1 -53.7886582,0 26.894329,26.894329 0 1 1 53.7886582,0 z"
       transform="matrix(0.52958208,0,0,0.52958208,15.507684,15.373597)" />
    <path
       sodipodi:type="arc"
       style="fill:none;stroke:#000000;stroke-opacity:1"
       id="path5530-4-4-0"
       sodipodi:cx="32.000847"
       sodipodi:cy="30.750895"
       sodipodi:rx="26.894329"
       sodipodi:ry="26.894329"
       d="m 58.895176,30.750895 a 26.894329,26.894329 0 1 1 -53.7886582,0 26.894329,26.894329 0 1 1 53.7886582,0 z"
       transform="matrix(0.45916134,0,0,0.45916134,17.647729,17.36888)" />
    <path
       sodipodi:type="arc"
       style="fill:none;stroke:#000000;stroke-opacity:1"
       id="path5530-4-4-0-8"
       sodipodi:cx="32.000847"
       sodipodi:cy="30.750895"
       sodipodi:rx="26.894329"
       sodipodi:ry="26.894329"
       d="m 58.895176,30.750895 a 26.894329,26.894329 0 1 1 -53.7886582,0 26.894329,26.894329 0 1 1 53.7886582,0 z"
       transform="matrix(0.3763134,0,0,0.3763134,20.46915,19.859788)" />
    <path
       sodipodi:type="arc"
       style="fill:none;stroke:#000000;stroke-opacity:1"
       id="path5530-4-4-0-8-4"
       sodipodi:cx="32.000847"
       sodipodi:cy="30.750895"
       sodipodi:rx="26.894329"
       sodipodi:ry="26.894329"
       d="m 58.895176,30.750895 a 26.894329,26.894329 0 1 1 -53.7886582,0 26.894329,26.894329 0 1 1 53.7886582,0 z"
       transform="matrix(0.28518066,0,0,0.28518066,23.271997,22.775681)" />
    <path
       sodipodi:type="arc"
       style="fill:#666666;stroke:#ffdd55;stroke-opacity:1;fill-opacity:1"
       id="path5626"
       sodipodi:cx="32.738453"
       sodipodi:cy="31.375023"
       sodipodi:rx="3.9149971"
       sodipodi:ry="3.9149971"
       d="m 36.65345,31.375023 a 3.9149971,3.9149971 0 1 1 -7.829994,0 3.9149971,3.9149971 0 1 1 7.829994,0 z"
       transform="translate(-0.34043454,0.22695636)" />
  </g>
  <g
     inkscape:groupmode="layer"
     id="layer2"
     inkscape:label="Holes">
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(1.901669,48.642395)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-4"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(24.020724,26.616695)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-9"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(24.001254,70.621091)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-9-4"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(45.637292,48.414592)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-40"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(5.4660167,36.839818)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-0"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(12.72862,29.690693)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-6"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(34.743387,29.577215)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-8"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(42.573381,37.293731)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-5"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(43.25425,58.741106)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-49"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(34.516431,67.705882)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-46"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(13.069055,67.705882)" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1"
       id="path3137-83"
       sodipodi:cx="8.264843"
       sodipodi:cy="-16.642395"
       sodipodi:rx="2.166512"
       sodipodi:ry="2.166512"
       d="m 10.431355,-16.642395 a 2.166512,2.166512 0 1 1 -4.333024,0 2.166512,2.166512 0 1 1 4.333024,0 z"
       transform="translate(5.0121038,59.535453)" />
  </g>
</svg>


code:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=demine
Exec=/usr/bin/invoker --splash=/opt/demine/splash.png --type=d -s /opt/demine/bin/demine
Icon=/usr/share/icons/hicolor/80x80/apps/demine80.png
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable


code:
/*
* Copyright (c) 2011 Mladen Milankovic <mmlado at gmail.com>.
*
* This file is part of Demine application
*
* Sink Submarines is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sink Submarines is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.

* You should have received a copy of the GNU General Public License
* along with Demine.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <QtGui/QApplication>
#include <QDeclarativeContext>
#include "qplatformdefs.h"
#include "settings.h"
#if defined(Q_WS_MAEMO_5)
#include "mainwindow.h"
#else
#include "qmlapplicationviewer.h"
#endif

Q_DECL_EXPORT main(int argc, char *argv[])
{
    //const QRect screenGeometry = QApplication::desktop()->screenGeometry();
    QApplication app(argc, argv);
    app.setOrganizationName("mmlado");
    app.setOrganizationDomain("mmlado.com");
    app.setApplicationName("Demine");
    app.setApplicationVersion("0.5.0");

#if defined(Q_WS_MAEMO_5)
    MainWindow main;
    main.show();
#else
    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
    Settings* settings = new Settings();
    viewer.rootContext()->setContextProperty("settingsCont", settings);
#if defined(MEEGO_EDITION_HARMATTAN)
    viewer.setMainQmlFile(QLatin1String("/opt/demine/qml/demine/harmattan.qml"));
#else
    viewer.setMainQmlFile(QLatin1String("qml/demine/main.qml"));
#endif

    // Graphic flicker fix
    // "Avoiding graphics flicker in Qt / QML "
    // http://blog.rburchell.com/2011/11/avoiding-graphics-flicker-in-qt-qml.html
    // Don't know if it's needed, will leave here in any case
    //viewer.setAttribute(Qt::WA_OpaquePaintEvent);
    //viewer.setAttribute(Qt::WA_NoSystemBackground);
    //viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    //viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);

    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    //viewer.showFullScreen();
    //view.setGeometry(screenGeometry);
    viewer.showExpanded();
#endif

    return app.exec();
}


code:
#include "mainwindow.h"
#include <QtGui/QApplication>
#include <QCoreApplication>
#include <QString>
#include <QDir>
#include <QObject>
#include <QGraphicsObject>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    //view = new QDeclarativeView;
    QString dir;
    dir = QCoreApplication::applicationDirPath()
          + QLatin1String("/../qml/demine/main.qml");
    view.setSource(QUrl::fromLocalFile(dir));
    setCentralWidget(&view);
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    view.show();
    QObject *rootObject = dynamic_cast<QObject*>(view.rootObject());

    newGame = new QAction(tr("&New game"), this);
    options = new QAction(tr("&Options"), this);
    menu = menuBar()->addMenu(tr("Demine"));
    menu->addAction(newGame);
    menu->addAction(options);

    connect(newGame, SIGNAL(triggered()), rootObject, SLOT(newGame()));
    connect(options, SIGNAL(triggered()), rootObject, SLOT(openOptions()));
}

MainWindow::~MainWindow()
{
    //delete ui;
}


code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QAction>
#include <QDeclarativeView>

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    QMenu * menu;
    QAction *newGame;
    QAction *options;
    QAction *about;
    QDeclarativeView view;
};

#endif // MAINWINDOW_H