diff options
Diffstat (limited to 'tools')
38 files changed, 1450 insertions, 88 deletions
diff --git a/tools/assistant/tools/assistant/helpenginewrapper.cpp b/tools/assistant/tools/assistant/helpenginewrapper.cpp index dc35b2d..8a5bb9c 100644 --- a/tools/assistant/tools/assistant/helpenginewrapper.cpp +++ b/tools/assistant/tools/assistant/helpenginewrapper.cpp @@ -115,7 +115,7 @@ private: QMap<QString, RecentSignal> m_recentQchUpdates; }; -const QString HelpEngineWrapper::TrUnfiltered = tr("Unfiltered"); +const QString HelpEngineWrapper::TrUnfiltered = HelpEngineWrapper::tr("Unfiltered"); HelpEngineWrapper *HelpEngineWrapper::helpEngineWrapper = 0; diff --git a/tools/assistant/tools/qhelpconverter/filespage.cpp b/tools/assistant/tools/qhelpconverter/filespage.cpp index 4ebf391..fd4a40e 100644 --- a/tools/assistant/tools/qhelpconverter/filespage.cpp +++ b/tools/assistant/tools/qhelpconverter/filespage.cpp @@ -59,8 +59,8 @@ FilesPage::FilesPage(QWidget *parent) connect(m_ui.removeAllButton, SIGNAL(clicked()), this, SLOT(removeAllFiles())); - m_ui.fileLabel->setText(tr("<p><b>Warning:</b> Be aware " - "when removing images or stylesheets since those files " + m_ui.fileLabel->setText(tr("<p><b>Warning:</b> " + "When removing images or stylesheets, be aware that those files " "are not directly referenced by the .adp or .dcf " "file.</p>")); } diff --git a/tools/assistant/tools/qhelpconverter/filterpage.cpp b/tools/assistant/tools/qhelpconverter/filterpage.cpp index c782943..c15a580 100644 --- a/tools/assistant/tools/qhelpconverter/filterpage.cpp +++ b/tools/assistant/tools/qhelpconverter/filterpage.cpp @@ -50,7 +50,7 @@ FilterPage::FilterPage(QWidget *parent) setTitle(tr("Filter Settings")); setSubTitle(tr("Specify the filter attributes for the " "documentation. If filter attributes are used, " - "also define a custom filter for it. Both, the " + "also define a custom filter for it. Both the " "filter attributes and the custom filters are " "optional.")); diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index a3473af..8a62fe1 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -92,6 +92,7 @@ SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \ $$QT_SOURCE_TREE/src/corelib/io/qiodevice.cpp \ $$QT_SOURCE_TREE/src/corelib/io/qtextstream.cpp \ $$QT_SOURCE_TREE/src/corelib/io/qtemporaryfile.cpp \ + $$QT_SOURCE_TREE/src/corelib/plugin/qsystemlibrary.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qbitarray.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qdatetime.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qmap.cpp \ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 3abfb0c..7ca5703 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -279,6 +279,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; dictionary[ "DECLARATIVE" ] = "auto"; + dictionary[ "DECLARATIVE_DEBUG" ]= "yes"; dictionary[ "PLUGIN_MANIFESTS" ] = "yes"; QString version; @@ -961,6 +962,10 @@ void Configure::parseCmdLine() dictionary[ "DECLARATIVE" ] = "no"; } else if (configCmdLine.at(i) == "-declarative") { dictionary[ "DECLARATIVE" ] = "yes"; + } else if (configCmdLine.at(i) == "-no-declarative-debug") { + dictionary[ "DECLARATIVE_DEBUG" ] = "no"; + } else if (configCmdLine.at(i) == "-declarative-debug") { + dictionary[ "DECLARATIVE_DEBUG" ] = "yes"; } else if (configCmdLine.at(i) == "-no-plugin-manifests") { dictionary[ "PLUGIN_MANIFESTS" ] = "no"; } else if (configCmdLine.at(i) == "-plugin-manifests") { @@ -1836,6 +1841,8 @@ bool Configure::displayHelp() desc("SCRIPTTOOLS", "yes", "-scripttools", "Build the QtScriptTools module."); desc("DECLARATIVE", "no", "-no-declarative", "Do not build the declarative module"); desc("DECLARATIVE", "yes", "-declarative", "Build the declarative module"); + desc("DECLARATIVE_DEBUG", "no", "-no-declarative-debug", "Do not build the declarative debugging support"); + desc("DECLARATIVE_DEBUG", "yes", "-declarative-debug", "Build the declarative debugging support"); desc( "-arch <arch>", "Specify an architecture.\n" "Available values for <arch>:"); @@ -2288,6 +2295,8 @@ void Configure::autoDetection() dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no"; if (dictionary["DECLARATIVE"] == "auto") dictionary["DECLARATIVE"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no"; + if (dictionary["DECLARATIVE_DEBUG"] == "auto") + dictionary["DECLARATIVE_DEBUG"] = dictionary["DECLARATIVE"] == "yes" ? "yes" : "no"; if (dictionary["AUDIO_BACKEND"] == "auto") dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no"; if (dictionary["WMSDK"] == "auto") @@ -3113,6 +3122,7 @@ void Configure::generateConfigfiles() if (dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6"; if (dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT"; if (dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE"; + if (dictionary["DECLARATIVE_DEBUG"] == "no") qconfigList += "QDECLARATIVE_NO_DEBUG_PROTOCOL"; if (dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON"; if (dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA"; if (dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS"; @@ -3410,6 +3420,7 @@ void Configure::displayConfig() cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl; cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl; cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl; + cout << "Declarative debugging......." << dictionary[ "DECLARATIVE_DEBUG" ] << endl; cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl; cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl; cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl; diff --git a/tools/designer/src/components/formeditor/formeditor_optionspage.cpp b/tools/designer/src/components/formeditor/formeditor_optionspage.cpp index 102f44a..8e0cc66 100644 --- a/tools/designer/src/components/formeditor/formeditor_optionspage.cpp +++ b/tools/designer/src/components/formeditor/formeditor_optionspage.cpp @@ -86,9 +86,11 @@ ZoomSettingsWidget::ZoomSettingsWidget(QWidget *parent) : m_zoomCombo->setEditable(false); const IntList zoomValues = ZoomMenu::zoomValues(); const IntList::const_iterator cend = zoomValues.constEnd(); - //: Zoom percentage - for (IntList::const_iterator it = zoomValues.constBegin(); it != cend; ++it) + + for (IntList::const_iterator it = zoomValues.constBegin(); it != cend; ++it) { + //: Zoom percentage m_zoomCombo->addItem(QCoreApplication::translate("FormEditorOptionsPage", "%1 %").arg(*it), QVariant(*it)); + } // Layout setCheckable(true); diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index efdf9ef..8520cf7 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -1522,7 +1522,7 @@ void MainWindow::selectedMessageChanged(const QModelIndex &sortedIndex, const QM } m_phraseView->setSourceText(-1, QString()); } - if (m) { + if (m && !m->fileName().isEmpty()) { if (hasFormPreview(m->fileName())) { m_sourceAndFormView->setCurrentWidget(m_formPreviewView); m_formPreviewView->setSourceContext(model, m); @@ -1577,7 +1577,7 @@ void MainWindow::updateTranslation(const QStringList &translations) return; m->setTranslations(translations); - if (hasFormPreview(m->fileName())) + if (!m->fileName().isEmpty() && hasFormPreview(m->fileName())) m_formPreviewView->setSourceContext(m_currentIndex.model(), m); updateDanger(m_currentIndex, true); @@ -1996,7 +1996,7 @@ void MainWindow::updateLatestModel(int model) if (m_currentIndex.isValid()) { if (MessageItem *item = m_dataModel->messageItem(m_currentIndex)) { - if (hasFormPreview(item->fileName())) + if (!item->fileName().isEmpty() && hasFormPreview(item->fileName())) m_formPreviewView->setSourceContext(model, item); if (enableRw && !item->isObsolete()) m_phraseView->setSourceText(model, item->text()); diff --git a/tools/linguist/linguist/sourcecodeview.cpp b/tools/linguist/linguist/sourcecodeview.cpp index b8dd9c0..d2eef56 100644 --- a/tools/linguist/linguist/sourcecodeview.cpp +++ b/tools/linguist/linguist/sourcecodeview.cpp @@ -64,7 +64,7 @@ void SourceCodeView::setSourceContext(const QString &fileName, const int lineNum m_fileToLoad.clear(); setToolTip(fileName); - if (fileName.isNull()) { + if (fileName.isEmpty()) { clear(); m_currentFileName.clear(); appendHtml(tr("<i>Source code not available</i>")); diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 970d44b..6ea7299 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -489,6 +489,7 @@ STRING(class); STRING(findMessage); STRING(friend); STRING(namespace); +STRING(operator); STRING(qtTrId); STRING(return); STRING(struct); @@ -753,6 +754,20 @@ uint CppParser::getToken() if (yyWord == strnamespace) return Tok_namespace; break; + case 'o': + if (yyWord == stroperator) { + // Operator overload declaration/definition. + // We need to prevent those characters from confusing the followup + // parsing. Actually using them does not add value, so just eat them. + while (isspace(yyCh)) + yyCh = getChar(); + while (yyCh == '+' || yyCh == '-' || yyCh == '*' || yyCh == '/' || yyCh == '%' + || yyCh == '=' || yyCh == '<' || yyCh == '>' || yyCh == '!' + || yyCh == '&' || yyCh == '|' || yyCh == '~' || yyCh == '^' + || yyCh == '[' || yyCh == ']') + yyCh = getChar(); + } + break; case 'q': if (yyWord == strqtTrId) return Tok_trid; @@ -1678,6 +1693,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) functionContextUnresolved.clear(); // Pointless prospectiveContext.clear(); pendingContext.clear(); + + yyTok = getToken(); } break; case Tok_namespace: @@ -1689,7 +1706,6 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) HashString ns = HashString(text); yyTok = getToken(); if (yyTok == Tok_LeftBrace) { - yyTok = getToken(); namespaceDepths.push(namespaces.count()); enterNamespace(&namespaces, ns); @@ -1697,6 +1713,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) functionContextUnresolved.clear(); prospectiveContext.clear(); pendingContext.clear(); + yyTok = getToken(); } else if (yyTok == Tok_Equals) { // e.g. namespace Is = OuterSpace::InnerSpace; QList<HashString> fullName; diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index cfb2178..02cfb07 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -123,8 +123,8 @@ class Translator public: Translator(); - bool load(const QString &filename, ConversionData &err, const QString &format /*= "auto"*/); - bool save(const QString &filename, ConversionData &err, const QString &format /*= "auto"*/) const; + bool load(const QString &filename, ConversionData &err, const QString &format /* = "auto" */); + bool save(const QString &filename, ConversionData &err, const QString &format /* = "auto" */) const; bool release(QFile *iod, ConversionData &cd) const; int find(const TranslatorMessage &msg) const; diff --git a/tools/porting/src/rpp.cpp b/tools/porting/src/rpp.cpp index 7b0bea1..2e2aa97 100644 --- a/tools/porting/src/rpp.cpp +++ b/tools/porting/src/rpp.cpp @@ -60,7 +60,7 @@ Source *Preprocessor::parse(const TokenEngine::TokenContainer &tokenContainer, const QVector<Type> &tokenTypeList, TypedPool<Item> *memoryPool) { m_memoryPool = memoryPool; - Source *m_source = createNode<Source>(m_memoryPool); //node whith no parent + Source *m_source = createNode<Source>(m_memoryPool); //node with no parent m_tokenContainer = tokenContainer; m_tokenTypeList = tokenTypeList; lexerTokenIndex = 0; @@ -538,7 +538,7 @@ bool Preprocessor::parsePragmaDirective(Item *group) } /* Reads a preprocessor line from the source by advancing lexerTokenIndex and - returing a TokenSection containg the read line. Text lines separated by + returning a TokenSection containing the read line. Text lines separated by an escaped newline are joined. */ TokenSection Preprocessor::readLine() diff --git a/tools/porting/src/semantic.cpp b/tools/porting/src/semantic.cpp index cf0b141..bd9175f 100644 --- a/tools/porting/src/semantic.cpp +++ b/tools/porting/src/semantic.cpp @@ -806,10 +806,10 @@ void Semantic::parseNameUse(NameAST* name) } /* - looks up name used in basescope. If name->isGlobal() is true or if classOrNamespaceList() + Looks up name used in basescope. If name->isGlobal() is true or if classOrNamespaceList() returns a non-empty list, the C++ qualified name lookup rules are used. Otherwise the unquialified name lookup rules are used. Returns the a list of members that was found, - In most cases this list will contain zero or one element, exept in the case of overloaded functions. + In most cases this list will contain zero or one element, except in the case of overloaded functions. TODO: Argument-dependent name lookup */ QList<CodeModel::Member *> Semantic::nameLookup(CodeModel::Scope *baseScope, const NameAST* name) diff --git a/tools/porting/src/tokenengine.h b/tools/porting/src/tokenengine.h index d998411..db68d88 100644 --- a/tools/porting/src/tokenengine.h +++ b/tools/porting/src/tokenengine.h @@ -55,7 +55,7 @@ namespace TokenEngine { class TokenContainer; /* - A token is defined as a start-postion and a lenght. Since the actual text + A token is defined as a start-position and a length. Since the actual text storage is not reffered to here, Token needs to be used together with a TokenContainer in order to be useful. */ diff --git a/tools/porting/src/tokenreplacements.cpp b/tools/porting/src/tokenreplacements.cpp index 02b7751..fa3cff8 100644 --- a/tools/porting/src/tokenreplacements.cpp +++ b/tools/porting/src/tokenreplacements.cpp @@ -126,7 +126,7 @@ int QualifiedNameParser::findScopeOperator(Direction direction) { int tokenIndex = currentIndex; QByteArray tokenText; - //loop until we get a token containg text or we pass the beginning/end of the source + //loop until we get a token containing text or we pass the beginning/end of the source tokenIndex += direction; while(tokenText.isEmpty() && isValidIndex(tokenIndex)) { tokenText = tokenContainer.text(tokenIndex).trimmed(); @@ -146,7 +146,7 @@ int QualifiedNameParser::nextScopeToken(Direction direction) if (tokenIndex == -1) return -1; QByteArray tokenText; - //loop until we get a token containg text or we pass the start of the source + //loop until we get a token containing text or we pass the start of the source tokenIndex += direction; while(tokenText.isEmpty() && isValidIndex(tokenIndex)) { tokenText = tokenContainer.text(tokenIndex).trimmed(); @@ -266,7 +266,7 @@ bool ScopedTokenReplacement::doReplace(const TokenContainer &tokenContainer, int if (!attributes->attribute(sourceIndex, "unknown").isEmpty()) return false; // If nameUse is set we test if the nameUse refers to the correct declaration. - // This is done by checking the parentScope attriute, wich returns the scope + // This is done by checking the parentScope attribute, which returns the scope // for the declaration associated with this name use. const bool haveNameUseInfo = !attributes->attribute(sourceIndex, "nameUse").isEmpty(); if (haveNameUseInfo) { @@ -314,7 +314,7 @@ bool ScopedTokenReplacement::doReplace(const TokenContainer &tokenContainer, int const QByteArray sourceScope = tokenContainer.text(sourceScopeIndex); // If we have no name use info and the source and old scopes don't match, - // we generally dont't do a replace, unless the old scope is Qt and + // we generally don't do a replace, unless the old scope is Qt and // the source scope inherits Qt. For example, QWidget::ButtonState should // be renamed to Qt::ButtonState. if (!haveNameUseInfo && sourceScope != oldScope) { diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index bc71b6e..77e306a 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -943,10 +943,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, } } else { - out() << "<ol type="; + out() << "<ol class="; if (atom->string() == ATOM_LIST_UPPERALPHA) { out() << "\"A\""; - } /* why type? */ + } /* why type? changed to */ else if (atom->string() == ATOM_LIST_LOWERALPHA) { out() << "\"a\""; } @@ -1966,7 +1966,7 @@ void HtmlGenerator::generateFooter(const Node *node) switch (application) { case Online: out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; - out() << " <!-- <script type=\"text/javascript\">\n"; + out() << " <script type=\"text/javascript\">\n"; out() << " var _gaq = _gaq || [];\n"; out() << " _gaq.push(['_setAccount', 'UA-4457116-5']);\n"; out() << " _gaq.push(['_trackPageview']);\n"; @@ -1977,7 +1977,7 @@ void HtmlGenerator::generateFooter(const Node *node) out() << "'.google-analytics.com/ga.js';\n"; out() << " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; out() << " })();\n"; - out() << " </script> -->\n"; + out() << " </script>\n"; out() << "</body>\n"; break; case Creator: @@ -4185,36 +4185,16 @@ void HtmlGenerator::generateQmlSummary(const Section& section, CodeMarker *marker) { if (!section.members.isEmpty()) { - NodeList::ConstIterator m; - int count = section.members.size(); - bool twoColumn = false; - if (section.members.first()->type() == Node::QmlProperty) { - twoColumn = (count >= 5); - twoColumn = false; - } - if (twoColumn) - out() << "<table class=\"qmlsummary\">\n"; - if (++numTableRows % 2 == 1) - out() << "<tr class=\"odd topAlign\">"; - else - out() << "<tr class=\"even topAlign\">"; - // << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; - - int row = 0; + NodeList::ConstIterator m; m = section.members.begin(); while (m != section.members.end()) { - if (twoColumn && row == (int) (count + 1) / 2) - out() << "</ul></td><td class=\"topAlign\"><ul>\n"; out() << "<li class=\"fn\">"; generateQmlItem(*m,relative,marker,true); out() << "</li>\n"; - row++; ++m; } out() << "</ul>\n"; - if (twoColumn) - out() << "</td></tr>\n</table>\n"; } } diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index a674c72..6a06a8c 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -103,6 +103,7 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/src/3rdparty/freetype \ $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ $QT_SOURCE_TREE/src/3rdparty/kdebase \ + $QT_SOURCE_TREE/src/3rdparty/libconninet \ $QT_SOURCE_TREE/src/3rdparty/libjpeg \ $QT_SOURCE_TREE/src/3rdparty/libmng \ $QT_SOURCE_TREE/src/3rdparty/libpng \ diff --git a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf index e0bb630..c24ddef 100644 --- a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf @@ -32,9 +32,9 @@ qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 qhp.Qt.extraFiles = index.html \ images/bg_l.png \ images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ images/bg_r.png \ images/box_bg.png \ images/breadcrumb.png \ @@ -73,6 +73,7 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/src/3rdparty/freetype \ $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ $QT_SOURCE_TREE/src/3rdparty/kdebase \ + $QT_SOURCE_TREE/src/3rdparty/libconninet \ $QT_SOURCE_TREE/src/3rdparty/libjpeg \ $QT_SOURCE_TREE/src/3rdparty/libmng \ $QT_SOURCE_TREE/src/3rdparty/libpng \ diff --git a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf index 4a79991..d932dfb 100644 --- a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf @@ -32,9 +32,9 @@ qhp.Qt.customFilters.Qt.filterAttributes = qt 4.8.0 qhp.Qt.extraFiles = index.html \ images/bg_l.png \ images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ images/bg_r.png \ images/box_bg.png \ images/breadcrumb.png \ @@ -73,6 +73,7 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/src/3rdparty/freetype \ $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ $QT_SOURCE_TREE/src/3rdparty/kdebase \ + $QT_SOURCE_TREE/src/3rdparty/libconninet \ $QT_SOURCE_TREE/src/3rdparty/libjpeg \ $QT_SOURCE_TREE/src/3rdparty/libmng \ $QT_SOURCE_TREE/src/3rdparty/libpng \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index cf028ef..b3bf764 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -9,11 +9,6 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div id=\"nav-logo\">\n" \ " <a href=\"index.html\">Home</a></div>\n" \ " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ - " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearchTop\">\n" \ - " <fieldset>\n" \ - " <input type=\"text\" value=\"\" id=\"pageType2\" name=\"searchstring\"/>\n" \ - " </fieldset>\n" \ - " </form></div>\n" \ " <div id=\"nav-topright\">\n" \ " <ul>\n" \ " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ @@ -89,7 +84,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global Declarations</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qmlelements.html\">QML elements</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ " </ul> \n" \ " </div>\n" \ " </div>\n" \ @@ -98,13 +93,13 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " Qt Topics</h2>\n" \ " <div id=\"list002\" class=\"list\">\n" \ " <ul id=\"ul002\" >\n" \ - " <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \ - " <li><a href=\"qtquick.html\">Device UI's & Qt Quick</a></li> \n" \ - " <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \ - " <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \ - " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ - " <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \ - " <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"qtquick.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \ + " <li class=\"defaultLink\"><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ " </ul> \n" \ " </div>\n" \ " </div>\n" \ @@ -138,20 +133,20 @@ HTML.postpostheader = " </ul>\n" \ " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ " <span>Print</span></a></li>\n" \ " </ul>\n" \ - " </div>\n" \ + " </div>\n" \ " </div>\n" \ " <div class=\"content\">\n" -HTML.footer = " <!-- /div -->\n" \ +HTML.footer = "" \ " <div class=\"feedback t_button\">\n" \ " [+] Documentation Feedback</div>\n" \ " </div>\n" \ " </div>\n" \ + " </div> \n" \ " <div class=\"ft\">\n" \ " <span></span>\n" \ " </div>\n" \ " </div> \n" \ - " </div> \n" \ " <div class=\"footer\">\n" \ " <p>\n" \ " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ @@ -160,26 +155,24 @@ HTML.footer = " <!-- /div -->\n" \ " <p>\n" \ " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ " </div>\n" \ " <div id=\"feedbackBox\">\n" \ " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ - " <p id=\"noteHead\">Thank you for giving your feedback. <div class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \ - " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</div></p>\n" \ + " <p id=\"noteHead\">Thank you for giving your feedback.</p> <p class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \ + " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p>\n" \ " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \ " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ " </form>\n" \ " </div>\n" \ " <div id=\"blurpage\">\n" \ - " </div>\n" \ - " <!--/div -->\n" \ - "<script type=\"text/javascript\">\n" \ - " var _gaq = _gaq || [];\n" \ - " _gaq.push([\'_setAccount\', \'UA-4457116-5\']);\n" \ - " _gaq.push([\'_trackPageview\']);\n" \ - " (function() {\n" \ - " var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;\n" \ - " ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';\n" \ - " var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);\n" \ - " })();\n" \ - "</script>\n" + " </div>\n" diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf index e2abd2a..da20766 100644 --- a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf @@ -156,6 +156,15 @@ HTML.footer = " <!-- /div -->\n" \ " <p>\n" \ " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ " </div>\n" \ " <div id=\"feedbackBox\">\n" \ " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf index 2c5c9d9..b91530f 100644 --- a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf @@ -156,6 +156,15 @@ HTML.footer = " <!-- /div -->\n" \ " <p>\n" \ " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " <p>\n" \ + " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ + " Free Documentation License version 1.3</a>\n" \ + " as published by the Free Software Foundation.</p>\n" \ " </div>\n" \ " <div id=\"feedbackBox\">\n" \ " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 3874915..f50cb69 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -103,6 +103,7 @@ excludedirs = $QTDIR/src/3rdparty/clucene \ $QTDIR/src/3rdparty/freetype \ $QTDIR/src/3rdparty/harfbuzz \ $QTDIR/src/3rdparty/kdebase \ + $QTDIR/src/3rdparty/libconninet \ $QTDIR/src/3rdparty/libjpeg \ $QTDIR/src/3rdparty/libmng \ $QTDIR/src/3rdparty/libpng \ diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp new file mode 100644 index 0000000..0670ac4 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#define ENSURE_RUNNING_MEEGO {if (! QMeeGoGraphicsSystemHelper::isRunningMeeGo()) { qFatal("Using meego functionality but not running meego graphics system!"); }} + +#include "qmeegographicssystemhelper.h" +#include <private/qapplication_p.h> +#include <private/qgraphicssystem_runtime_p.h> +#include <private/qpixmap_raster_p.h> +#include "qmeegoruntime.h" + +QString QMeeGoGraphicsSystemHelper::runningGraphicsSystemName() +{ + if (! QApplicationPrivate::instance()) { + qWarning("Querying graphics system but application not running yet!"); + return QString(); + } + + QString name = QApplicationPrivate::instance()->graphics_system_name; + if (name == QLatin1String("runtime")) { + QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system; + name = rsystem->graphicsSystemName(); + } + + return name; +} + +bool QMeeGoGraphicsSystemHelper::isRunningMeeGo() +{ + return (runningGraphicsSystemName() == QLatin1String("meego")); +} + +void QMeeGoGraphicsSystemHelper::switchToMeeGo() +{ + if (isRunningMeeGo()) + return; + + if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) + qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system."); + else { + QApplication *app = static_cast<QApplication *>(QCoreApplication::instance()); + app->setGraphicsSystem(QLatin1String("meego")); + } +} + +void QMeeGoGraphicsSystemHelper::switchToRaster() +{ + if (runningGraphicsSystemName() == QLatin1String("raster")) + return; + + if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) + qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system."); + else { + QApplication *app = static_cast<QApplication *>(QCoreApplication::instance()); + app->setGraphicsSystem(QLatin1String("raster")); + } +} + +Qt::HANDLE QMeeGoGraphicsSystemHelper::imageToEGLSharedImage(const QImage &image) +{ + ENSURE_RUNNING_MEEGO; + return QMeeGoRuntime::imageToEGLSharedImage(image); +} + +QPixmap QMeeGoGraphicsSystemHelper::pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage) +{ + // This function is supported when not running meego too. A raster-backed + // pixmap will be created... but when you switch back to 'meego', it'll + // be replaced with a EGL shared image backing. + return QMeeGoRuntime::pixmapFromEGLSharedImage(handle, softImage); +} + +QPixmap QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(int w, int h) +{ + ENSURE_RUNNING_MEEGO; + return QMeeGoRuntime::pixmapWithGLTexture(w, h); +} + +bool QMeeGoGraphicsSystemHelper::destroyEGLSharedImage(Qt::HANDLE handle) +{ + ENSURE_RUNNING_MEEGO; + return QMeeGoRuntime::destroyEGLSharedImage(handle); +} + +void QMeeGoGraphicsSystemHelper::updateEGLSharedImagePixmap(QPixmap *p) +{ + ENSURE_RUNNING_MEEGO; + return QMeeGoRuntime::updateEGLSharedImagePixmap(p); +} + +void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent) +{ + ENSURE_RUNNING_MEEGO; + QMeeGoRuntime::setTranslucent(translucent); +} diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h new file mode 100644 index 0000000..02f2fa2 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMEEGOGRAPHICSSYSTEMHELPER_H +#define QMEEGOGRAPHICSSYSTEMHELPER_H + +#include <QPixmap> +#include <QImage> +#include "qmeegolivepixmap.h" + +class QLibrary; + +//! The base class for accressing special meego graphics system features. +/*! + This class is a helper class with static-only methods for accessing various + meego graphics system functionalities. The way it works is that the helper + dynamically calls-in to the loaded graphicssystem plugin... therefore, you're + expected to make sure that you're indeed running with 'meego' before using any + of the specialized methods. + + In example: + + \code + QPixmap p; + if (QMeeGoGraphicsSystemHelper::isRunningMeeGo()) { + p = QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(64, 64); + } else { + p = QPixmap(64, 64); + } + \endcode + + Calling any of the meego-specific features while not running meego might + give unpredictable results. The only functions safe to call at all times are: + + \code + QMeeGoGraphicsSystemHelper::isRunningMeeGo(); + QMeeGoGraphicsSystemHelper::runningGraphicsSystemName(); + QMeeGoGraphicsSystemHelper::switchToMeeGo(); + QMeeGoGraphicsSystemHelper::switchToRaster(); + \endcode +*/ + +class Q_DECL_EXPORT QMeeGoGraphicsSystemHelper +{ +public: + //! Returns true if running meego. + /*! + Returns true if the currently active (running) system is 'meego' with OpenGL. + This returns both true if the app was started with 'meego' or was started with + 'runtime' graphics system and the currently active system through the runtime + switching is 'meego'. + */ + static bool isRunningMeeGo(); + + //! Switches to meego graphics system. + /*! + When running with the 'runtime' graphics system, sets the currently active + system to 'meego'. The window surface and all the resources are automatically + migrated to OpenGL. Will fail if the active graphics system is not 'runtime'. + */ + static void switchToMeeGo(); + + //! Switches to raster graphics system + /*! + When running with the 'runtime' graphics system, sets the currently active + system to 'raster'. The window surface and the graphics resources (including the + EGL shared image resources) are automatically migrated back to the CPU. All OpenGL + resources (surface, context, cache, font cache) are automaticall anihilated. + */ + static void switchToRaster(); + + //! Returns the name of the active graphics system + /*! + Returns the name of the currently active system. If running with 'runtime' graphics + system, returns the name of the active system inside the runtime graphics system + */ + static QString runningGraphicsSystemName(); + + //! Creates a new EGL shared image. + /*! + Creates a new EGL shared image from the given image. The EGL shared image wraps + a GL texture in the native format and can be easily accessed from other processes. + */ + static Qt::HANDLE imageToEGLSharedImage(const QImage &image); + + //! Creates a QPixmap from an EGL shared image + /*! + Creates a new QPixmap from the given EGL shared image handle. The QPixmap can be + used for painting like any other pixmap. The softImage should point to an alternative, + software version of the graphical resource -- ie. obtained from theme daemon. The + softImage can be allocated on a QSharedMemory slice for easy sharing across processes + too. When the application is migrated ToRaster, this softImage will replace the + contents of the sharedImage. + + It's ok to call this function too when not running 'meego' graphics system. In this + case it'll create a QPixmap backed with a raster data (from softImage)... but when + the system is switched back to 'meego', the QPixmap will be migrated to a EGL-shared image + backed storage (handle). + */ + static QPixmap pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage); + + //! Destroys an EGL shared image. + /*! + Destroys an EGLSharedImage previously created with an ::imageToEGLSharedImage call. + Returns true if the image was found and the destruction was successfull. Notice that + this destroys the image for all processes using it. + */ + static bool destroyEGLSharedImage(Qt::HANDLE handle); + + //! Updates the QPixmap backed with an EGLShared image. + /*! + This function re-reads the softImage that was specified when creating the pixmap with + ::pixmapFromEGLSharedImage and updates the EGL Shared image contents. It can be used + to share cross-proccess mutable EGLShared images. + */ + static void updateEGLSharedImagePixmap(QPixmap *p); + + //! Create a new QPixmap with a GL texture. + /*! + Creates a new QPixmap which is backed by an OpenGL local texture. Drawing to this + QPixmap will be accelerated by hardware -- unlike the normal (new QPixmap()) pixmaps, + which are backed by a software engine and only migrated to GPU when used. Migrating those + GL-backed pixmaps when going ToRaster is expsensive (they need to be downloaded from + GPU to CPU) so use wisely. + */ + static QPixmap pixmapWithGLTexture(int w, int h); + + //! Sets translucency (alpha) on the base window surface. + /*! + This function needs to be called *before* any widget/content is created. + When called with true, the base window surface will be translucent and initialized + with QGLFormat.alpha == true. + */ + static void setTranslucent(bool translucent); +}; + +#endif diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro new file mode 100644 index 0000000..1e6e233 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro @@ -0,0 +1,10 @@ +TEMPLATE = lib +TARGET = QtMeeGoGraphicsSystemHelper + +include(../../src/qbase.pri) + +QT += gui +INCLUDEPATH += '../../src/plugins/graphicssystems/meego' + +HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoliveimage.h qmeegoruntime.h qmeegoliveimage_p.h qmeegolivepixmap_p.h +SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegoliveimage.cpp diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp b/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp new file mode 100644 index 0000000..83a1e28 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmeegoliveimage.h" +#include "qmeegoliveimage_p.h" +#include "qmeegolivepixmap.h" +#include "qmeegolivepixmap_p.h" + +/* QMeeGoLiveImagePrivate */ + +QMeeGoLiveImagePrivate::QMeeGoLiveImagePrivate() +{ +} + +QMeeGoLiveImagePrivate::~QMeeGoLiveImagePrivate() +{ + if (attachedPixmaps.length() > 0) + qWarning("Destroying QMeeGoLiveImage but it still has QMeeGoLivePixmaps attached!"); +} + +void QMeeGoLiveImagePrivate::attachPixmap(QMeeGoLivePixmap* pixmap) +{ + attachedPixmaps << pixmap; +} + +void QMeeGoLiveImagePrivate::detachPixmap(QMeeGoLivePixmap* pixmap) +{ + attachedPixmaps.removeAll(pixmap); +} + +/* QMeeGoLiveImage */ + +QMeeGoLiveImage* QMeeGoLiveImage::liveImageWithSize(int w, int h, Format format, int buffers) +{ + if (format != Format_ARGB32_Premultiplied) { + qWarning("Only _ARGB32_Premultiplied format is supported for live images now!"); + return 0; + } + + if (buffers != 1) { + qWarning("Only single-buffer streams are supported at the moment"); + return 0; + } + + QMeeGoLiveImage *liveImage = new QMeeGoLiveImage(w, h); + return liveImage; +} + +QMeeGoLiveImage::QMeeGoLiveImage(int w, int h) : QImage(w, h, QImage::Format_ARGB32_Premultiplied), d_ptr(new QMeeGoLiveImagePrivate()) +{ + Q_D(QMeeGoLiveImage); + d->q_ptr = this; +} + +QMeeGoLiveImage::~QMeeGoLiveImage() +{ +} + +void QMeeGoLiveImage::lock(int buffer) +{ + if (buffer != 0) + qWarning("Only locking 0 buffer is supported at the moment!"); +} + +void QMeeGoLiveImage::release(int buffer) +{ + Q_D(QMeeGoLiveImage); + + if (buffer != 0) { + qWarning("Only locking 0 buffer is supported at the moment!"); + return; + } + + // We need to copy the update image to all the client QMeeGoLivePixmap's + foreach (QMeeGoLivePixmap* livePixmap, d->attachedPixmaps) + livePixmap->d_ptr->copyBackFrom((const void *) bits()); +} diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage.h b/tools/qmeegographicssystemhelper/qmeegoliveimage.h new file mode 100644 index 0000000..1e21e7b --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegoliveimage.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMEEGOLIVEIMAGE_H +#define QMEEGOLIVEIMAGE_H + +#include <QImage> + +class QMeeGoLivePixmap; +class QMeeGoLiveImagePrivate; + +//! A streamable QImage subclass. +/*! +*/ + +class QMeeGoLiveImage : public QImage +{ +public: + //! Format specifier. + /*! + Used to specify the format of the underlying image data for QMeeGoLiveImage. + */ + enum Format { + Format_ARGB32_Premultiplied //! 32bit, AARRGGBB format. The typical Qt format. + }; + + //! Locks the access to the image. + /*! + All drawing/access to the underlying image data needs to happen between + ::lock() and ::unlock() pairs. + */ + void lock(int buffer = 0); + + //! Unlocks the access to the image. + /*! + All drawing/access to the underlying image data needs to happen between + ::lock() and ::unlock() pairs. + */ + void release(int buffer = 0); + + //! Destroys the image. + /*! + It's a mistake to destroy an image before destroying all the QMeeGoLivePixmaps + built on top of it. You should first destroy all the QMeeGoLivePixmaps. + */ + virtual ~QMeeGoLiveImage(); + + //! Creates and returns a new live image with the given parameters. + /*! + The new image is created with the given width w and the given height h. + The format specifies the color format used by the image. Optionally, a + number of buffers can be specfied for a stream-like behavior. + */ + static QMeeGoLiveImage* liveImageWithSize(int w, int h, Format format, int buffers = 1); + +private: + QMeeGoLiveImage(int w, int h); //! Private bits. + Q_DISABLE_COPY(QMeeGoLiveImage) + Q_DECLARE_PRIVATE(QMeeGoLiveImage) + +protected: + QScopedPointer<QMeeGoLiveImagePrivate> d_ptr; + + friend class QMeeGoLivePixmap; + friend class QMeeGoLivePixmapPrivate; +}; + +#endif diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h b/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h new file mode 100644 index 0000000..085fed4 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmeegoliveimage.h" + +#ifndef QMEEGOLIVEIMAGE_P_H +#define QMEEGOLIVEIMAGE_P_H + +class QMeeGoLiveImagePrivate +{ +public: + Q_DECLARE_PUBLIC(QMeeGoLiveImage); + QMeeGoLiveImagePrivate(); + virtual ~QMeeGoLiveImagePrivate(); + void attachPixmap(QMeeGoLivePixmap* pixmap); + void detachPixmap(QMeeGoLivePixmap* pixmap); + + QList <QMeeGoLivePixmap*> attachedPixmaps; + QMeeGoLiveImage *q_ptr; + + friend class QMeeGoLivePixmap; + friend class QMeeGoLivePixmapPrivate; +}; + +#endif diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp new file mode 100644 index 0000000..2a1c04b --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmeegolivepixmap.h" +#include <private/qimage_p.h> +#include <private/qpixmap_raster_p.h> +#include "qmeegolivepixmap_p.h" +#include "qmeegoliveimage_p.h" +#include <QSharedMemory> + +/* QMeeGoLivePixmapPrivate */ + +QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate() : shm(0), shmSerial(0), owns(true), parentImage(0) +{ +} + +void QMeeGoLivePixmapPrivate::copyBackFrom(const void *raw) +{ + Q_Q(QMeeGoLivePixmap); + + q->detach(); + shm->lock(); + uchar *dest = ((uchar *) shm->data()) + (2 * sizeof(int)); + memcpy(dest, raw, q->width() * q->height() * 4); + shm->unlock(); +} + +QMeeGoLivePixmapPrivate::~QMeeGoLivePixmapPrivate() +{ + Q_Q(QMeeGoLivePixmap); + + if (parentImage) + parentImage->d_ptr->detachPixmap(q); + + if (shm) + shm->detach(); + + if (owns) + delete shm; +} + +/* QMeeGoLivePixmap */ + +QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate()) +{ + Q_D(QMeeGoLivePixmap); + d->q_ptr = this; +} + +QMeeGoLivePixmap* QMeeGoLivePixmap::fromLiveImage(QMeeGoLiveImage *liveImage) +{ + static int counter = 100; + QSharedMemory *shm = NULL; + uchar* imgData = NULL; + int *header = NULL; + int w = liveImage->width(); + int h = liveImage->height(); + + counter++; + shm = new QSharedMemory(QString(QLatin1String("QMeeGoLivePixmap%1")).arg(counter)); + shm->create((w * h * 4) + 2 * sizeof(int)); // +2 to store width & height + shm->attach(); + + imgData = ((uchar *) shm->data()) + (2 * sizeof(int)); + header = (int *) shm->data(); + + header[0] = w; + header[1] = h; + + QImage img(imgData, w, h, QImage::Format_ARGB32_Premultiplied); + + QPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType); + pmd->fromImage(img, Qt::NoOpaqueDetection); + + QMeeGoLivePixmap *livePixmap = new QMeeGoLivePixmap(pmd); + livePixmap->d_ptr->shm = shm; + livePixmap->d_ptr->owns = true; + livePixmap->d_ptr->shmSerial = counter; + livePixmap->d_ptr->parentImage = liveImage; + + liveImage->d_ptr->attachPixmap(livePixmap); + + return livePixmap; +} + +QMeeGoLivePixmap* QMeeGoLivePixmap::fromHandle(Qt::HANDLE handle) +{ + QSharedMemory *shm = NULL; + int *header; + int width; + int height; + uchar* imgData; + + shm = new QSharedMemory(QString(QLatin1String("QMeeGoLivePixmap%1")).arg(handle)); + shm->attach(); + + shm->lock(); + header = (int *) shm->data(); + width = header[0]; + height = header[1]; + shm->unlock(); + + imgData = ((uchar *) shm->data()) + (2 * sizeof(int)); + QImage img(imgData, width, height, QImage::Format_ARGB32_Premultiplied); + + QPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType); + pmd->fromImage(img, Qt::NoOpaqueDetection); + + QMeeGoLivePixmap *livePixmap = new QMeeGoLivePixmap(pmd); + livePixmap->d_ptr->shm = shm; + livePixmap->d_ptr->owns = false; + livePixmap->d_ptr->shmSerial = handle; + + return livePixmap; +} + +QMeeGoLivePixmap::~QMeeGoLivePixmap() +{ +} + +Qt::HANDLE QMeeGoLivePixmap::handle() +{ + Q_D(QMeeGoLivePixmap); + return d->shmSerial; +} diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h new file mode 100644 index 0000000..2fa9db2 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMEEGOLIVEPIXMAP_H +#define QMEEGOLIVEPIXMAP_H + +#include <QPixmap> +#include "qmeegoliveimage.h" + +class QMeeGoLivePixmapPrivate; +class QSharedMemory; +class QImage; + +//! A pixmap representing streamed content. +/*! +*/ + +class QMeeGoLivePixmap : public QPixmap +{ +public: + //! Creates new pixmap from the given QMeeGoLiveImage. + /*! + The created QMeeGoLivePixmap will be attached to the given QMeeGoLiveImage. + Updates to the QMeeGoLiveImage will be represented on this newly created + QMeeGoLivePixmap. + */ + static QMeeGoLivePixmap* fromLiveImage(QMeeGoLiveImage *liveImage); + + //! Creates a new QMeeGoLivePixmap from the specified handle. + /*! + The handle can be used to share QMeeGoLivePixmap cross-process. + */ + static QMeeGoLivePixmap* fromHandle(Qt::HANDLE handle); + + //! Returns the handle for this QMeeGoLivePixmap. + /*! + The handle can be used to share QMeeGoLivePixmap cross-process. + */ + Qt::HANDLE handle(); + + //! Destroys the QMeeGoLivePixmap. + /*! + All QMeeGoLivePixmaps attached to a given QMeeGoLiveImage have to be destroyed + before the QMeeGoLiveImage itself is destroyed. + */ + virtual ~QMeeGoLivePixmap(); + +private: + QMeeGoLivePixmap(QPixmapData *p); + Q_DISABLE_COPY(QMeeGoLivePixmap) + Q_DECLARE_PRIVATE(QMeeGoLivePixmap) + +protected: + QScopedPointer<QMeeGoLivePixmapPrivate> d_ptr; //! Private bits. + + friend class QMeeGoLiveImage; + friend class QMeeGoLiveImagePrivate; +}; + +#endif diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h new file mode 100644 index 0000000..c2591dc --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmeegolivepixmap.h" + +#ifndef QMEEGOLIVEPIXMAP_P_H +#define QMEEGOLIVEPIXMAP_P_H + +class QMeeGoLivePixmapPrivate +{ +public: + Q_DECLARE_PUBLIC(QMeeGoLivePixmap); + QMeeGoLivePixmapPrivate(); + void copyBackFrom(const void *raw); + virtual ~QMeeGoLivePixmapPrivate(); + + QSharedMemory *shm; + int shmSerial; + bool owns; + QMeeGoLiveImage *parentImage; + + QMeeGoLivePixmap *q_ptr; + + friend class QMeeGoLiveImage; + friend class QMeeGoLiveImagePrivate; +}; + +#endif diff --git a/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp b/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp new file mode 100644 index 0000000..f9f14ae --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QDebug> +#include <QEvent> +#include <QMouseEvent> +#include <QCoreApplication> +#include "qmeegooverlaywidget.h" +#include "qmeegographicssystemhelper.h" +#include "qmeegoruntime.h" + +QMeeGoOverlayWidget::QMeeGoOverlayWidget(int surfaceWidth, int surfaceHeight, QWidget *parent) : QWidget(parent, 0), + sw(surfaceWidth), + sh(surfaceHeight) +{ + if (! QMeeGoGraphicsSystemHelper::isRunningMeeGo()) + qFatal("QMeeGoOverlayWidget can only be used when running with 'meego' graphics system!"); + + QMeeGoRuntime::setSurfaceFixedSize(surfaceWidth, surfaceHeight); + + scaleW = sw / 864.0; + scaleH = sh / 480.0; + installEventFilter(this); +} + +QPoint QMeeGoOverlayWidget::convertPoint(const QPoint &p) +{ + int x = p.x() * scaleW; + int y = p.y() * scaleH; + return QPoint(x, y); +} + +void QMeeGoOverlayWidget::showEvent(QShowEvent *) +{ + QMeeGoRuntime::setSurfaceScaling(0, 0, width(), height()); +} + +bool QMeeGoOverlayWidget::eventFilter(QObject *, QEvent *event) +{ + if (event->spontaneous() == false) + return false; + + switch(event->type()) { + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + { + QMouseEvent *e = static_cast <QMouseEvent *>(event); + QMouseEvent newEvent = QMouseEvent(e->type(), + convertPoint(e->pos()), + convertPoint(e->globalPos()), + e->button(), + e->buttons(), + e->modifiers()); + QCoreApplication::sendEvent(this, &newEvent); + return true; + } + + default: + return false; + } +} diff --git a/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h b/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h new file mode 100644 index 0000000..c2c08b4 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMEEGOOVERLAYWIDGET_H +#define QMEEGOOVERLAYWIDGET_H + +#include <QWidget> + +//! A widget automatically scaling it's content. +/*! +*/ + +class QMeeGoOverlayWidget : public QWidget +{ +public: + //! Constructs a new scaling widget. + /*! + The real surface used for this widget will have the specified + width and height. + */ + QMeeGoOverlayWidget(int surfaceWidth, int surfaceHeight, QWidget *parent = 0); + + + //! Event filtering function. + /*! + Converts coordinates for mouse/touch event. Do not + call manually. + */ + bool eventFilter(QObject *obj, QEvent *event); + + //! Standard override. + /*! + The surface scaling on the target paint device is being + set when the widget is displayed for the first time. + */ + virtual void showEvent(QShowEvent *event); + +private: + //! Converts coordinates between real & virtual area of the widget. + QPoint convertPoint(const QPoint &p); + + int sw; /// Surface real width. + int sh; /// Surface real height. + float scaleW; /// Width scaling factor. + float scaleH; /// Height scaling factor. +}; + +#endif diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp new file mode 100644 index 0000000..70b5dc1 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmeegoruntime.h" + +#include <private/qlibrary_p.h> +#include <private/qfactoryloader_p.h> +#include <private/qgraphicssystemplugin_p.h> + +#define ENSURE_INITIALIZED {if (!initialized) initialize();} + +bool QMeeGoRuntime::initialized = false; + +typedef int (*QMeeGoImageToEglSharedImageFunc) (const QImage&); +typedef QPixmapData* (*QMeeGoPixmapDataFromEglSharedImageFunc) (Qt::HANDLE handle, const QImage&); +typedef QPixmapData* (*QMeeGoPixmapDataWithGLTextureFunc) (int w, int h); +typedef bool (*QMeeGoDestroyEGLSharedImageFunc) (Qt::HANDLE handle); +typedef void (*QMeeGoUpdateEglSharedImagePixmapFunc) (QPixmap*); +typedef void (*QMeeGoSetSurfaceFixedSizeFunc) (int w, int h); +typedef void (*QMeeGoSetSurfaceScalingFunc) (int x, int y, int w, int h); +typedef void (*QMeeGoSetTranslucentFunc) (bool translucent); + +static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL; +static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL; +static QMeeGoPixmapDataWithGLTextureFunc qt_meego_pixmapdata_with_gl_texture = NULL; +static QMeeGoDestroyEGLSharedImageFunc qt_meego_destroy_egl_shared_image = NULL; +static QMeeGoUpdateEglSharedImagePixmapFunc qt_meego_update_egl_shared_image_pixmap = NULL; +static QMeeGoSetSurfaceFixedSizeFunc qt_meego_set_surface_fixed_size = NULL; +static QMeeGoSetSurfaceScalingFunc qt_meego_set_surface_scaling = NULL; +static QMeeGoSetTranslucentFunc qt_meego_set_translucent = NULL; + +void QMeeGoRuntime::initialize() +{ + QFactoryLoader loader(QGraphicsSystemFactoryInterface_iid, QLatin1String("/graphicssystems"), Qt::CaseInsensitive); + + QLibraryPrivate *libraryPrivate = loader.library(QLatin1String("meego")); + Q_ASSERT(libraryPrivate); + + QLibrary library(libraryPrivate->fileName, libraryPrivate->fullVersion); + + bool success = library.load(); + + if (success) { + qt_meego_image_to_egl_shared_image = (QMeeGoImageToEglSharedImageFunc) library.resolve("qt_meego_image_to_egl_shared_image"); + qt_meego_pixmapdata_from_egl_shared_image = (QMeeGoPixmapDataFromEglSharedImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_shared_image"); + qt_meego_pixmapdata_with_gl_texture = (QMeeGoPixmapDataWithGLTextureFunc) library.resolve("qt_meego_pixmapdata_with_gl_texture"); + qt_meego_destroy_egl_shared_image = (QMeeGoDestroyEGLSharedImageFunc) library.resolve("qt_meego_destroy_egl_shared_image"); + qt_meego_update_egl_shared_image_pixmap = (QMeeGoUpdateEglSharedImagePixmapFunc) library.resolve("qt_meego_update_egl_shared_image_pixmap"); + qt_meego_set_surface_fixed_size = (QMeeGoSetSurfaceFixedSizeFunc) library.resolve("qt_meego_set_surface_fixed_size"); + qt_meego_set_surface_scaling = (QMeeGoSetSurfaceScalingFunc) library.resolve("qt_meego_set_surface_scaling"); + qt_meego_set_translucent = (QMeeGoSetTranslucentFunc) library.resolve("qt_meego_set_translucent"); + + if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && qt_meego_pixmapdata_with_gl_texture + && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap && qt_meego_set_surface_fixed_size + && qt_meego_set_surface_scaling && qt_meego_set_translucent) + { + qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion)); + } + } else { + Q_ASSERT(false); + } + + initialized = true; +} + +Qt::HANDLE QMeeGoRuntime::imageToEGLSharedImage(const QImage &image) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_image_to_egl_shared_image); + return qt_meego_image_to_egl_shared_image(image); +} + +QPixmap QMeeGoRuntime::pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_pixmapdata_from_egl_shared_image); + return QPixmap(qt_meego_pixmapdata_from_egl_shared_image(handle, softImage)); +} + +QPixmap QMeeGoRuntime::pixmapWithGLTexture(int w, int h) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_pixmapdata_with_gl_texture); + return QPixmap(qt_meego_pixmapdata_with_gl_texture(w, h)); +} + +bool QMeeGoRuntime::destroyEGLSharedImage(Qt::HANDLE handle) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_destroy_egl_shared_image); + return qt_meego_destroy_egl_shared_image(handle); +} + +void QMeeGoRuntime::updateEGLSharedImagePixmap(QPixmap *p) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_update_egl_shared_image_pixmap); + return qt_meego_update_egl_shared_image_pixmap(p); +} + +void QMeeGoRuntime::setSurfaceFixedSize(int w, int h) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_set_surface_fixed_size); + qt_meego_set_surface_fixed_size(w, h); +} + +void QMeeGoRuntime::setSurfaceScaling(int x, int y, int w, int h) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_set_surface_scaling); + qt_meego_set_surface_scaling(x, y, w, h); +} + +void QMeeGoRuntime::setTranslucent(bool translucent) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_set_translucent); + qt_meego_set_translucent(translucent); +} diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h new file mode 100644 index 0000000..82fdb52 --- /dev/null +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QPixmap> +#include <QImage> + +class QMeeGoRuntime +{ +public: + static void initialize(); + + static Qt::HANDLE imageToEGLSharedImage(const QImage &image); + static QPixmap pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage); + static QPixmap pixmapWithGLTexture(int w, int h); + static bool destroyEGLSharedImage(Qt::HANDLE handle); + static void updateEGLSharedImagePixmap(QPixmap *p); + static void setSurfaceFixedSize(int w, int h); + static void setSurfaceScaling(int x, int y, int w, int h); + static void setTranslucent(bool translucent); + +private: + static bool initialized; +}; diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index b38e80d..c59621a 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -692,12 +692,14 @@ QDeclarativeViewer::~QDeclarativeViewer() void QDeclarativeViewer::enableExperimentalGestures() { +#ifndef QT_NO_GESTURES canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); canvas->viewport()->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); canvas->viewport()->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); canvas->viewport()->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); canvas->viewport()->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents); +#endif } QDeclarativeView *QDeclarativeViewer::view() const @@ -1067,11 +1069,7 @@ void QDeclarativeViewer::loadDummyDataFiles(const QString& directory) QStringList list = dir.entryList(); for (int i = 0; i < list.size(); ++i) { QString qml = list.at(i); - QFile f(dir.filePath(qml)); - f.open(QIODevice::ReadOnly); - QByteArray data = f.readAll(); - QDeclarativeComponent comp(canvas->engine()); - comp.setData(data, QUrl()); + QDeclarativeComponent comp(canvas->engine(), dir.filePath(qml)); QObject *dummyData = comp.create(); if(comp.isError()) { diff --git a/tools/runonphone/ossignalconverter.cpp b/tools/runonphone/ossignalconverter.cpp index 6554e9f..8566458 100644 --- a/tools/runonphone/ossignalconverter.cpp +++ b/tools/runonphone/ossignalconverter.cpp @@ -42,6 +42,7 @@ #include "ossignalconverter_p.h" #include <signal.h> #include <QTimer> +#include <stdio.h> Q_GLOBAL_STATIC(OsSignalConverter, osSignalConverter); diff --git a/tools/tools.pro b/tools/tools.pro index f254230..8f23fe4 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -43,3 +43,7 @@ embedded: SUBDIRS += makeqpf CONFIG+=ordered QTDIR_build:REQUIRES = "contains(QT_CONFIG, full-config)" + +!win32:!embedded:!mac:!symbian:CONFIG += x11 + +x11:contains(QT_CONFIG, opengles2):contains(QT_CONFIG, egl):SUBDIRS += qmeegographicssystemhelper |