Commit b04b5e5d authored by Christian Stenger's avatar Christian Stenger

Squish: Provide functions for getting paths inside Qt installation

Change-Id: I273304f0c6d451d28a256c99588479525eef95e4
Reviewed-by: default avatarRobert Loehning <robert.loehning@qt.io>
parent 48423414
......@@ -23,6 +23,7 @@
#
############################################################################
import __builtin__
import operator
# for easier re-usage (because Python hasn't an enum type)
......@@ -200,3 +201,55 @@ class Qt5Path:
else:
return map(os.path.expanduser, ["~/Qt5.2.1/5.2.1/clang_64" + path52,
"~/Qt5.3.1" + path53])
@staticmethod
def __preCheckAndExtractQtVersionStr__(target):
if target not in Targets.ALL_TARGETS:
raise Exception("Unexpected target '%s'" % str(target))
matcher = re.match("^Desktop (5\\d{2}).*$", Targets.getStringForTarget(target))
if matcher is None:
raise Exception("Currently this is supported for Desktop Qt5 only, got target '%s'"
% str(Targets.getStringForTarget(target)))
return matcher.group(1)
@staticmethod
def __createPlatformQtPath__(qt5Minor):
# special handling for Qt5.2
if qt5Minor == 2:
if platform.system() in ('Microsoft', 'Windows'):
return "C:/Qt/Qt5.2.1/5.2.1/msvc2010"
elif platform.system() == 'Linux':
if __is64BitOS__():
return os.path.expanduser("~/Qt5.2.1/5.2.1/gcc_64")
else:
return os.path.expanduser("~/Qt5.2.1/5.2.1/gcc")
else:
return os.path.expanduser("~/Qt5.2.1/5.2.1/clang_64")
# Qt5.3+
if platform.system() in ('Microsoft', 'Windows'):
return "C:/Qt/Qt5.%d.1" % qt5Minor
else:
return os.path.expanduser("~/Qt5.%d.1" % qt5Minor)
@staticmethod
def examplesPath(target):
qtVersionStr = Qt5Path.__preCheckAndExtractQtVersionStr__(target)
qtMinorVersion = __builtin__.int(qtVersionStr[1])
if qtMinorVersion == 2:
path = "examples"
else:
path = "Examples/Qt-5.%d" % qtMinorVersion
return os.path.join(Qt5Path.__createPlatformQtPath__(qtMinorVersion), path)
@staticmethod
def docsPath(target):
qtVersionStr = Qt5Path.__preCheckAndExtractQtVersionStr__(target)
qtMinorVersion = __builtin__.int(qtVersionStr[1])
if qtMinorVersion == 2:
path = "doc"
else:
path = "Docs/Qt-5.%d" % qtMinorVersion
return os.path.join(Qt5Path.__createPlatformQtPath__(qtMinorVersion), path)
......@@ -26,7 +26,8 @@
source("../../shared/qtcreator.py")
def main():
sourceExample = os.path.abspath(Qt5Path.getPaths(Qt5Path.EXAMPLES)[0] + "/declarative/keyinteraction/focus")
target = Targets.DESKTOP_521_DEFAULT
sourceExample = os.path.join(Qt5Path.examplesPath(target), "declarative/keyinteraction/focus")
proFile = "focus.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)):
return
......@@ -34,9 +35,9 @@ def main():
if not startedWithoutPluginError():
return
# add docs to have the correct tool tips
addHelpDocumentation([os.path.join(Qt5Path.getPaths(Qt5Path.DOCS)[0], "qtquick.qch")])
addHelpDocumentation([os.path.join(Qt5Path.docsPath(target), "qtquick.qch")])
templateDir = prepareTemplate(sourceExample, "/../../helper")
openQmakeProject(os.path.join(templateDir, proFile), Targets.DESKTOP_521_DEFAULT)
openQmakeProject(os.path.join(templateDir, proFile), target)
openDocument("focus.QML.qml" + os.sep + "focus.focus\\.qml")
testRenameId()
testFindUsages()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment